ed25519.h (946B)
1 /* see LICENSE file for copyright and license details */ 2 #ifndef ED25519_H 3 #define ED25519_H 4 5 #include <stddef.h> 6 #include <stdint.h> 7 8 /* 9 * ed25519 signatures (rfc 8032), small and constant time where it matters, 10 * after tweetnacl. a secret key is the 32 byte seed followed by the public 11 * key, as nacl and signify keep it. hashing is aruu's sha512 12 */ 13 14 enum { 15 ED25519_SEED = 32, 16 ED25519_PUBLIC = 32, 17 ED25519_SECRET = 64, 18 ED25519_SIG = 64, 19 }; 20 21 /* the key pair of seed: sk is seed then pk */ 22 void ed25519_keypair( 23 uint8_t pk[ED25519_PUBLIC], uint8_t sk[ED25519_SECRET], const uint8_t seed[ED25519_SEED] 24 ); 25 26 /* sig over the n bytes of m */ 27 void ed25519_sign( 28 uint8_t sig[ED25519_SIG], const uint8_t *m, size_t n, const uint8_t sk[ED25519_SECRET] 29 ); 30 31 /* 0 when sig is pk's over m, -1 otherwise */ 32 int ed25519_verify( 33 const uint8_t sig[ED25519_SIG], const uint8_t *m, size_t n, const uint8_t pk[ED25519_PUBLIC] 34 ); 35 36 #endif