djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 1 | /* $OpenBSD: crypto_api.h,v 1.5 2019/01/21 10:20:12 djm Exp $ */ |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 2 | |
Damien Miller | 6674eb9 | 2013-12-18 17:50:39 +1100 | [diff] [blame] | 3 | /* |
| 4 | * Assembled from generated headers and source files by Markus Friedl. |
| 5 | * Placed in the public domain. |
| 6 | */ |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 7 | |
| 8 | #ifndef crypto_api_h |
| 9 | #define crypto_api_h |
| 10 | |
Damien Miller | 89f09ee | 2018-01-24 12:20:44 +1100 | [diff] [blame] | 11 | #include "includes.h" |
| 12 | |
Darren Tucker | ac413b6 | 2014-01-17 12:31:33 +1100 | [diff] [blame] | 13 | #ifdef HAVE_STDINT_H |
| 14 | # include <stdint.h> |
| 15 | #endif |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 16 | #include <stdlib.h> |
| 17 | |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 18 | typedef int8_t crypto_int8; |
| 19 | typedef uint8_t crypto_uint8; |
| 20 | typedef int16_t crypto_int16; |
| 21 | typedef uint16_t crypto_uint16; |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 22 | typedef int32_t crypto_int32; |
| 23 | typedef uint32_t crypto_uint32; |
| 24 | |
| 25 | #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len)) |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 26 | #define small_random32() arc4random() |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 27 | |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 28 | #define crypto_hash_sha512_BYTES 64U |
| 29 | |
| 30 | int crypto_hash_sha512(unsigned char *, const unsigned char *, |
| 31 | unsigned long long); |
| 32 | |
| 33 | int crypto_verify_32(const unsigned char *, const unsigned char *); |
| 34 | |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 35 | #define crypto_sign_ed25519_SECRETKEYBYTES 64U |
| 36 | #define crypto_sign_ed25519_PUBLICKEYBYTES 32U |
| 37 | #define crypto_sign_ed25519_BYTES 64U |
| 38 | |
| 39 | int crypto_sign_ed25519(unsigned char *, unsigned long long *, |
| 40 | const unsigned char *, unsigned long long, const unsigned char *); |
| 41 | int crypto_sign_ed25519_open(unsigned char *, unsigned long long *, |
| 42 | const unsigned char *, unsigned long long, const unsigned char *); |
| 43 | int crypto_sign_ed25519_keypair(unsigned char *, unsigned char *); |
| 44 | |
djm@openbsd.org | dfd5916 | 2019-01-21 10:20:12 +0000 | [diff] [blame] | 45 | #define crypto_kem_sntrup4591761_PUBLICKEYBYTES 1218 |
| 46 | #define crypto_kem_sntrup4591761_SECRETKEYBYTES 1600 |
| 47 | #define crypto_kem_sntrup4591761_CIPHERTEXTBYTES 1047 |
| 48 | #define crypto_kem_sntrup4591761_BYTES 32 |
| 49 | |
| 50 | int crypto_kem_sntrup4591761_enc(unsigned char *cstr, unsigned char *k, |
| 51 | const unsigned char *pk); |
| 52 | int crypto_kem_sntrup4591761_dec(unsigned char *k, |
| 53 | const unsigned char *cstr, const unsigned char *sk); |
| 54 | int crypto_kem_sntrup4591761_keypair(unsigned char *pk, unsigned char *sk); |
| 55 | |
Damien Miller | 5be9d9e | 2013-12-07 11:24:01 +1100 | [diff] [blame] | 56 | #endif /* crypto_api_h */ |