ed25519.c (876B)
1 #include "ed25519.h" 2 3 #include <string.h> 4 5 #include "monocypher/monocypher-ed25519.h" 6 7 void dist_ed25519_keypair(uint8_t pk[DIST_ED25519_PK_LEN], 8 uint8_t sk[DIST_ED25519_SK_LEN], 9 const uint8_t seed[DIST_ED25519_SEED_LEN]) { 10 uint8_t seed_copy[DIST_ED25519_SEED_LEN]; 11 memcpy(seed_copy, seed, sizeof seed_copy); 12 crypto_ed25519_key_pair(sk, pk, seed_copy); 13 } 14 15 void dist_ed25519_sign(uint8_t sig[DIST_ED25519_SIG_LEN], const uint8_t* msg, 16 size_t msglen, const uint8_t sk[DIST_ED25519_SK_LEN]) { 17 crypto_ed25519_sign(sig, sk, msg, msglen); 18 } 19 20 int dist_ed25519_verify(const uint8_t sig[DIST_ED25519_SIG_LEN], 21 const uint8_t* msg, size_t msglen, 22 const uint8_t pk[DIST_ED25519_PK_LEN]) { 23 return crypto_ed25519_check(sig, pk, msg, msglen) == 0 ? 1 : 0; 24 }