xref: /netbsd-src/crypto/external/bsd/openssh/dist/crypto_api.h (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1 /*	$NetBSD: crypto_api.h,v 1.3 2019/04/20 17:16:40 christos Exp $	*/
2 /* $OpenBSD: crypto_api.h,v 1.5 2019/01/21 10:20:12 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 
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_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_sntrup4591761_PUBLICKEYBYTES 1218
43 #define crypto_kem_sntrup4591761_SECRETKEYBYTES 1600
44 #define crypto_kem_sntrup4591761_CIPHERTEXTBYTES 1047
45 #define crypto_kem_sntrup4591761_BYTES 32
46 
47 int	crypto_kem_sntrup4591761_enc(unsigned char *cstr, unsigned char *k,
48     const unsigned char *pk);
49 int	crypto_kem_sntrup4591761_dec(unsigned char *k,
50     const unsigned char *cstr, const unsigned char *sk);
51 int	crypto_kem_sntrup4591761_keypair(unsigned char *pk, unsigned char *sk);
52 
53 #endif /* crypto_api_h */
54