xref: /openbsd/sbin/iked/crypto_api.h (revision 9b50bc25)
1 /* $OpenBSD: crypto_api.h,v 1.1 2021/05/28 18:01:39 tobhe Exp $ */
2 
3 /*
4  * Assembled from generated headers and source files by Markus Friedl.
5  * Placed in the public domain.
6  */
7 
8 #ifndef crypto_api_h
9 #define crypto_api_h
10 
11 #include <stdint.h>
12 #include <stdlib.h>
13 
14 typedef int8_t crypto_int8;
15 typedef uint8_t crypto_uint8;
16 typedef int16_t crypto_int16;
17 typedef uint16_t crypto_uint16;
18 typedef int32_t crypto_int32;
19 typedef uint32_t crypto_uint32;
20 typedef uint64_t crypto_uint64;
21 
22 #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
23 #define small_random32() arc4random()
24 
25 #define crypto_hash_sha512_BYTES 64U
26 
27 int	crypto_hash_sha512(unsigned char *, const unsigned char *,
28     unsigned long long);
29 
30 int	crypto_verify_32(const unsigned char *, const unsigned char *);
31 
32 #define crypto_kem_sntrup761_PUBLICKEYBYTES 1158
33 #define crypto_kem_sntrup761_SECRETKEYBYTES 1763
34 #define crypto_kem_sntrup761_CIPHERTEXTBYTES 1039
35 #define crypto_kem_sntrup761_BYTES 32
36 
37 int	crypto_kem_sntrup761_enc(unsigned char *cstr, unsigned char *k,
38     const unsigned char *pk);
39 int	crypto_kem_sntrup761_dec(unsigned char *k,
40     const unsigned char *cstr, const unsigned char *sk);
41 int	crypto_kem_sntrup761_keypair(unsigned char *pk, unsigned char *sk);
42 
43 #endif /* crypto_api_h */
44