Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_ecc.h File Reference

Curve25519 primitives: X25519 key agreement and Ed25519 signatures. More...

#include <stddef.h>
#include "nilorea/n_openssl_compat.h"
Include dependency graph for n_ecc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define N_ECC_AVAILABLE   N_OSSL_HAVE_RAW_EVP_25519
 1 when the linked library provides Curve25519 through the raw-key EVP API (OpenSSL 1.1.1+, LibreSSL 3.7+), 0 otherwise.
#define N_ECC_KEY_LEN   32
 raw X25519/Ed25519 key length in bytes
#define N_ECC_SIG_LEN   64
 Ed25519 signature length in bytes.

Functions

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_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 bytes).
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 public key.
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 public key.
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.

Detailed Description

Curve25519 primitives: X25519 key agreement and Ed25519 signatures.

Author
Castagnier Mickael
Version
1.0

Definition in file n_ecc.h.