xref: /freebsd/crypto/openssh/crypto_api.h (revision 99aeb219cad9a5a0347ca3ffef963bb614c99eb9)
1 /* $OpenBSD: crypto_api.h,v 1.7 2021/01/08 02:33:13 dtucker 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 "includes.h"
12 
13 #ifdef HAVE_STDINT_H
14 # include <stdint.h>
15 #endif
16 #include <stdlib.h>
17 
18 typedef int8_t crypto_int8;
19 typedef uint8_t crypto_uint8;
20 typedef int16_t crypto_int16;
21 typedef uint16_t crypto_uint16;
22 typedef int32_t crypto_int32;
23 typedef uint32_t crypto_uint32;
24 typedef int64_t crypto_int64;
25 typedef uint64_t crypto_uint64;
26 
27 #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
28 #define small_random32() arc4random()
29 
30 #define crypto_hash_sha512_BYTES 64U
31 
32 int	crypto_hash_sha512(unsigned char *, const unsigned char *,
33     unsigned long long);
34 
35 int	crypto_verify_32(const unsigned char *, const unsigned char *);
36 
37 #define crypto_sign_ed25519_SECRETKEYBYTES 64U
38 #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
39 #define crypto_sign_ed25519_BYTES 64U
40 
41 int	crypto_sign_ed25519(unsigned char *, unsigned long long *,
42     const unsigned char *, unsigned long long, const unsigned char *);
43 int	crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
44     const unsigned char *, unsigned long long, const unsigned char *);
45 int	crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
46 
47 #define crypto_kem_sntrup761_PUBLICKEYBYTES 1158
48 #define crypto_kem_sntrup761_SECRETKEYBYTES 1763
49 #define crypto_kem_sntrup761_CIPHERTEXTBYTES 1039
50 #define crypto_kem_sntrup761_BYTES 32
51 
52 int	crypto_kem_sntrup761_enc(unsigned char *cstr, unsigned char *k,
53     const unsigned char *pk);
54 int	crypto_kem_sntrup761_dec(unsigned char *k,
55     const unsigned char *cstr, const unsigned char *sk);
56 int	crypto_kem_sntrup761_keypair(unsigned char *pk, unsigned char *sk);
57 
58 #endif /* crypto_api_h */
59