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