1 /* $NetBSD: crypto_api.h,v 1.5 2023/07/26 17:58:15 christos Exp $ */ 2 /* $OpenBSD: crypto_api.h,v 1.8 2023/01/15 23:05:32 djm Exp $ */ 3 4 /* 5 * Assembled from generated headers and source files by Markus Friedl. 6 * Placed in the public domain. 7 */ 8 9 #ifndef crypto_api_h 10 #define crypto_api_h 11 12 #include <stdint.h> 13 #include <stdlib.h> 14 15 typedef int8_t crypto_int8; 16 typedef uint8_t crypto_uint8; 17 typedef int16_t crypto_int16; 18 typedef uint16_t crypto_uint16; 19 typedef int32_t crypto_int32; 20 typedef uint32_t crypto_uint32; 21 typedef int64_t crypto_int64; 22 typedef uint64_t crypto_uint64; 23 24 #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len)) 25 #define small_random32() arc4random() 26 27 #define crypto_hash_sha512_BYTES 64U 28 29 int crypto_hash_sha512(unsigned char *, const unsigned char *, 30 unsigned long long); 31 32 #define crypto_sign_ed25519_SECRETKEYBYTES 64U 33 #define crypto_sign_ed25519_PUBLICKEYBYTES 32U 34 #define crypto_sign_ed25519_BYTES 64U 35 36 int crypto_sign_ed25519(unsigned char *, unsigned long long *, 37 const unsigned char *, unsigned long long, const unsigned char *); 38 int crypto_sign_ed25519_open(unsigned char *, unsigned long long *, 39 const unsigned char *, unsigned long long, const unsigned char *); 40 int crypto_sign_ed25519_keypair(unsigned char *, unsigned char *); 41 42 #define crypto_kem_sntrup761_PUBLICKEYBYTES 1158 43 #define crypto_kem_sntrup761_SECRETKEYBYTES 1763 44 #define crypto_kem_sntrup761_CIPHERTEXTBYTES 1039 45 #define crypto_kem_sntrup761_BYTES 32 46 47 int crypto_kem_sntrup761_enc(unsigned char *cstr, unsigned char *k, 48 const unsigned char *pk); 49 int crypto_kem_sntrup761_dec(unsigned char *k, 50 const unsigned char *cstr, const unsigned char *sk); 51 int crypto_kem_sntrup761_keypair(unsigned char *pk, unsigned char *sk); 52 53 #endif /* crypto_api_h */ 54