kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

ed25519.h (877B)


      1 #ifndef KIT_DIST_ED25519_H
      2 #define KIT_DIST_ED25519_H
      3 
      4 #include <stddef.h>
      5 #include <stdint.h>
      6 
      7 #include "dist.h"
      8 
      9 /* Signature scheme used by minisign. */
     10 
     11 /* Derive a keypair from a 32-byte seed. */
     12 void dist_ed25519_keypair(uint8_t pk[DIST_ED25519_PK_LEN],
     13                           uint8_t sk[DIST_ED25519_SK_LEN],
     14                           const uint8_t seed[DIST_ED25519_SEED_LEN]);
     15 
     16 /* Sign `msg` with `sk`, writing a 64-byte signature. */
     17 void dist_ed25519_sign(uint8_t sig[DIST_ED25519_SIG_LEN], const uint8_t* msg,
     18                        size_t msglen, const uint8_t sk[DIST_ED25519_SK_LEN]);
     19 
     20 /* Verify `sig` over `msg` against `pk`. Returns 1 if valid, 0 otherwise. */
     21 int dist_ed25519_verify(const uint8_t sig[DIST_ED25519_SIG_LEN],
     22                         const uint8_t* msg, size_t msglen,
     23                         const uint8_t pk[DIST_ED25519_PK_LEN]);
     24 
     25 #endif