43 n_log(
LOG_NOTICE,
"ex_ecc: skipped, this OpenSSL does not provide X25519/Ed25519");
69 const unsigned char msg[] =
"the quick brown fox";
70 size_t mlen =
sizeof(msg) - 1;
84 n_log(
LOG_ERR,
"ed25519 verify accepted a tampered signature");
88 unsigned char m2[
sizeof(msg) - 1];
89 memcpy(m2, msg, mlen);
92 n_log(
LOG_ERR,
"ed25519 verify accepted a tampered message");
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_ERR
error conditions
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL ).
#define LOG_NOTICE
normal but significant condition
int n_ed25519_keypair(unsigned char *priv, unsigned char *pub)
generate an Ed25519 keypair as N_ECC_KEY_LEN-byte raw private and public keys.
int n_ed25519_verify(const unsigned char *pub, const unsigned char *msg, size_t len, const unsigned char *sig)
Ed25519 verify the N_ECC_SIG_LEN-byte sig over len bytes of msg under the N_ECC_KEY_LEN-byte raw publ...
int n_x25519_keypair(unsigned char *priv, unsigned char *pub)
generate an X25519 keypair as N_ECC_KEY_LEN-byte raw private and public keys.
#define N_ECC_SIG_LEN
Ed25519 signature length in bytes.
#define N_ECC_KEY_LEN
raw X25519/Ed25519 key length in bytes
int n_ed25519_sign(const unsigned char *priv, const unsigned char *msg, size_t len, unsigned char *sig)
Ed25519 sign len bytes of msg with the N_ECC_KEY_LEN-byte raw private key into sig (N_ECC_SIG_LEN byt...
int n_x25519_derive(const unsigned char *priv, const unsigned char *peer_pub, unsigned char *shared)
X25519 ECDH: derive the N_ECC_KEY_LEN-byte shared secret from our raw private key and the peer's raw ...
Curve25519 primitives: X25519 key agreement and Ed25519 signatures.