blob: eb05251ff16482d14687d3b60ad8681253cf6266 [file] [log] [blame]
djm@openbsd.orgdfd59162019-01-21 10:20:12 +00001/* $OpenBSD: crypto_api.h,v 1.5 2019/01/21 10:20:12 djm Exp $ */
Damien Miller5be9d9e2013-12-07 11:24:01 +11002
Damien Miller6674eb92013-12-18 17:50:39 +11003/*
4 * Assembled from generated headers and source files by Markus Friedl.
5 * Placed in the public domain.
6 */
Damien Miller5be9d9e2013-12-07 11:24:01 +11007
8#ifndef crypto_api_h
9#define crypto_api_h
10
Damien Miller89f09ee2018-01-24 12:20:44 +110011#include "includes.h"
12
Darren Tuckerac413b62014-01-17 12:31:33 +110013#ifdef HAVE_STDINT_H
14# include <stdint.h>
15#endif
Damien Miller5be9d9e2013-12-07 11:24:01 +110016#include <stdlib.h>
17
djm@openbsd.orgdfd59162019-01-21 10:20:12 +000018typedef int8_t crypto_int8;
19typedef uint8_t crypto_uint8;
20typedef int16_t crypto_int16;
21typedef uint16_t crypto_uint16;
Damien Miller5be9d9e2013-12-07 11:24:01 +110022typedef int32_t crypto_int32;
23typedef uint32_t crypto_uint32;
24
25#define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
djm@openbsd.orgdfd59162019-01-21 10:20:12 +000026#define small_random32() arc4random()
Damien Miller5be9d9e2013-12-07 11:24:01 +110027
Damien Miller5be9d9e2013-12-07 11:24:01 +110028#define crypto_hash_sha512_BYTES 64U
29
30int crypto_hash_sha512(unsigned char *, const unsigned char *,
31 unsigned long long);
32
33int crypto_verify_32(const unsigned char *, const unsigned char *);
34
Damien Miller5be9d9e2013-12-07 11:24:01 +110035#define crypto_sign_ed25519_SECRETKEYBYTES 64U
36#define crypto_sign_ed25519_PUBLICKEYBYTES 32U
37#define crypto_sign_ed25519_BYTES 64U
38
39int crypto_sign_ed25519(unsigned char *, unsigned long long *,
40 const unsigned char *, unsigned long long, const unsigned char *);
41int crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
42 const unsigned char *, unsigned long long, const unsigned char *);
43int crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
44
djm@openbsd.orgdfd59162019-01-21 10:20:12 +000045#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
50int crypto_kem_sntrup4591761_enc(unsigned char *cstr, unsigned char *k,
51 const unsigned char *pk);
52int crypto_kem_sntrup4591761_dec(unsigned char *k,
53 const unsigned char *cstr, const unsigned char *sk);
54int crypto_kem_sntrup4591761_keypair(unsigned char *pk, unsigned char *sk);
55
Damien Miller5be9d9e2013-12-07 11:24:01 +110056#endif /* crypto_api_h */