|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Ed25519 (RFC 8032) sign + verify over edwards25519. More...
#include "crypto/asymmetric/ed25519.h"#include "crypto/asymmetric/curve25519.h"#include "crypto/asymmetric/fe25519.h"#include "crypto/crypto_opt.h"#include "crypto/crypto_scratch.h"#include "crypto/hash/sha512.h"Go to the source code of this file.
Functions | |
| void | pc_ed25519_pubkey (uint8_t pub[32], const uint8_t seed[32]) |
| void | pc_ed25519_sign (uint8_t sig[64], const uint8_t *msg, size_t mlen, const uint8_t seed[32]) |
| bool | pc_ed25519_verify (const uint8_t pub[32], const uint8_t *msg, size_t mlen, const uint8_t sig[64]) |
Ed25519 (RFC 8032) sign + verify over edwards25519.
Points are held in extended twisted-Edwards coordinates (X, Y, Z, T) as four field elements; scalar multiplication is a constant-time bit-by-bit double-and-add; scalars are reduced mod the group order L. SHA-512 hashes the seed, the nonce input, and R||A||M. Deterministic (no RNG). Validated against the RFC 8032 ยง7.1 vectors and a reference implementation (test_ed25519).
The field elements and point arithmetic have two implementations: the portable radix-2^16 pc_gf (from pc_curve25519, the native / non-S3 path), and on the ESP32-S3 a canonical uint32[8] layer that does each field multiply as one 256-bit modular multiply on the RSA/MPI accelerator (pc_fe25519.h, active as PC_FE25519_MPI_HW) - the same engine that accelerates the X25519 KEX, here driving the Edwards point arithmetic so the host-key signature runs several times faster. Only the point/field layer differs; the SHA-512 hashing and the scalar arithmetic mod L are shared. Both paths are byte-identical by construction.
Definition in file ed25519.cpp.
| void pc_ed25519_pubkey | ( | uint8_t | pub[32], |
| const uint8_t | seed[32] | ||
| ) |
Definition at line 584 of file ed25519.cpp.
References pc_sha512().
Referenced by pc_ssh_hostkey_ed25519_set().
| void pc_ed25519_sign | ( | uint8_t | sig[64], |
| const uint8_t * | msg, | ||
| size_t | mlen, | ||
| const uint8_t | seed[32] | ||
| ) |
Definition at line 594 of file ed25519.cpp.
References pc_sha512(), pc_sha512_final(), pc_sha512_init(), and pc_sha512_update().
| bool pc_ed25519_verify | ( | const uint8_t | pub[32], |
| const uint8_t * | msg, | ||
| size_t | mlen, | ||
| const uint8_t | sig[64] | ||
| ) |
Definition at line 647 of file ed25519.cpp.
References pc_sha512_final(), pc_sha512_init(), and pc_sha512_update().