File syn_ed25519.h¶
FileList > crypto > syn_ed25519.h
Go to the source code of this file
Pure C99 Ed25519 Key Generation, Signing & Verification (RFC 8032).
#include "syn_sha512.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Public Types¶
| Type | Name |
|---|---|
| typedef SYN_SHA512 | SYN_SHA512_Ctx Alias for SHA-512 context. |
Public Functions¶
| Type | Name |
|---|---|
| bool | syn_ed25519_create_keypair (uint8_t public_key, uint8_t secret_key, const uint8_t seed) Create an Ed25519 keypair from a 32-byte random seed (RFC 8032). |
| bool | syn_ed25519_publickey (const uint8_t secret_key, uint8_t public_key) Derive a 32-byte Ed25519 public key from a 32-byte secret key (RFC 8032 Section 5.1.5). |
| bool | syn_ed25519_sign (const uint8_t * msg, size_t msg_len, const uint8_t secret_key, const uint8_t public_key, uint8_t sig) Generate an Ed25519 signature (RFC 8032 Section 5.1.6). |
| bool | syn_ed25519_verify (const uint8_t sig, const uint8_t * msg, size_t msg_len, const uint8_t public_key) Verify an Ed25519 signature (RFC 8032 Section 5.1.7). |
| bool | syn_ed25519_verify_hash (const uint8_t sig, const uint8_t h, const uint8_t public_key) Verify an Ed25519 signature from a precomputed 64-byte challenge digest H(R || A || M). |
Macros¶
| Type | Name |
|---|---|
| define | SYN_ED25519_PUBLIC_KEY_SIZE 32USize of Ed25519 public key in bytes (32). |
| define | SYN_ED25519_SECRET_KEY_SIZE 32USize of Ed25519 secret key (seed) in bytes (32). |
| define | SYN_ED25519_SEED_SIZE 32USize of Ed25519 seed in bytes (32). |
| define | SYN_ED25519_SIGNATURE_SIZE 64USize of Ed25519 signature in bytes (64). |
Public Types Documentation¶
typedef SYN_SHA512_Ctx¶
Alias for SHA-512 context.
Public Functions Documentation¶
function syn_ed25519_create_keypair¶
Create an Ed25519 keypair from a 32-byte random seed (RFC 8032).
Parameters:
public_keyOutput 32-byte public key.secret_keyOutput 32-byte secret key (copies seed).seedInput 32-byte random seed.
Returns:
true on success, false on invalid parameter.
function syn_ed25519_publickey¶
Derive a 32-byte Ed25519 public key from a 32-byte secret key (RFC 8032 Section 5.1.5).
Parameters:
secret_key32-byte private key/seed.public_keyOutput 32-byte compressed Edwards public key.
Returns:
true on success, false on invalid parameter.
function syn_ed25519_sign¶
Generate an Ed25519 signature (RFC 8032 Section 5.1.6).
bool syn_ed25519_sign (
const uint8_t * msg,
size_t msg_len,
const uint8_t secret_key,
const uint8_t public_key,
uint8_t sig
)
Parameters:
msgMessage to sign.msg_lenLength of message in bytes.secret_key32-byte private key.public_key32-byte public key (optional; if NULL, derived internally from secret_key).sigOutput 64-byte signature (R || S).
Returns:
true on success, false on invalid parameter.
function syn_ed25519_verify¶
Verify an Ed25519 signature (RFC 8032 Section 5.1.7).
bool syn_ed25519_verify (
const uint8_t sig,
const uint8_t * msg,
size_t msg_len,
const uint8_t public_key
)
Parameters:
sig64-byte signature (R || S).msgMessage bytes.msg_lenMessage length in bytes.public_key32-byte Ed25519 public key.
Returns:
true if valid signature, false otherwise.
function syn_ed25519_verify_hash¶
Verify an Ed25519 signature from a precomputed 64-byte challenge digest H(R || A || M).
Parameters:
sig64-byte signature (R || S).h64-byte SHA-512 digest.public_key32-byte Ed25519 public key.
Returns:
true if valid signature, false otherwise.
Macro Definition Documentation¶
define SYN_ED25519_PUBLIC_KEY_SIZE¶
Size of Ed25519 public key in bytes (32).
define SYN_ED25519_SECRET_KEY_SIZE¶
Size of Ed25519 secret key (seed) in bytes (32).
define SYN_ED25519_SEED_SIZE¶
Size of Ed25519 seed in bytes (32).
define SYN_ED25519_SIGNATURE_SIZE¶
Size of Ed25519 signature in bytes (64).
The documentation for this class was generated from the following file src/syntropic/crypto/syn_ed25519.h