xref: /netbsd-src/crypto/external/bsd/openssh/dist/crypto_api.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: crypto_api.h,v 1.4 2021/03/05 17:47:16 christos Exp $	*/
2 /* $OpenBSD: crypto_api.h,v 1.7 2021/01/08 02:33:13 dtucker 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 int	crypto_verify_32(const unsigned char *, const unsigned char *);
33 
34 #define crypto_sign_ed25519_SECRETKEYBYTES 64U
35 #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
36 #define crypto_sign_ed25519_BYTES 64U
37 
38 int	crypto_sign_ed25519(unsigned char *, unsigned long long *,
39     const unsigned char *, unsigned long long, const unsigned char *);
40 int	crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
41     const unsigned char *, unsigned long long, const unsigned char *);
42 int	crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
43 
44 #define crypto_kem_sntrup761_PUBLICKEYBYTES 1158
45 #define crypto_kem_sntrup761_SECRETKEYBYTES 1763
46 #define crypto_kem_sntrup761_CIPHERTEXTBYTES 1039
47 #define crypto_kem_sntrup761_BYTES 32
48 
49 int	crypto_kem_sntrup761_enc(unsigned char *cstr, unsigned char *k,
50     const unsigned char *pk);
51 int	crypto_kem_sntrup761_dec(unsigned char *k,
52     const unsigned char *cstr, const unsigned char *sk);
53 int	crypto_kem_sntrup761_keypair(unsigned char *pk, unsigned char *sk);
54 
55 #endif /* crypto_api_h */
56