xref: /dflybsd-src/crypto/openssh/crypto_api.h (revision 664f47636b7e6e9e2c54a4799ca4884a9c628df5)
1*664f4763Szrj /* $OpenBSD: crypto_api.h,v 1.5 2019/01/21 10:20:12 djm Exp $ */
236e94dc5SPeter Avalos 
336e94dc5SPeter Avalos /*
436e94dc5SPeter Avalos  * Assembled from generated headers and source files by Markus Friedl.
536e94dc5SPeter Avalos  * Placed in the public domain.
636e94dc5SPeter Avalos  */
736e94dc5SPeter Avalos 
836e94dc5SPeter Avalos #ifndef crypto_api_h
936e94dc5SPeter Avalos #define crypto_api_h
1036e94dc5SPeter Avalos 
11*664f4763Szrj #include "includes.h"
12*664f4763Szrj 
1336e94dc5SPeter Avalos #ifdef HAVE_STDINT_H
1436e94dc5SPeter Avalos # include <stdint.h>
1536e94dc5SPeter Avalos #endif
1636e94dc5SPeter Avalos #include <stdlib.h>
1736e94dc5SPeter Avalos 
18*664f4763Szrj typedef int8_t crypto_int8;
19*664f4763Szrj typedef uint8_t crypto_uint8;
20*664f4763Szrj typedef int16_t crypto_int16;
21*664f4763Szrj typedef uint16_t crypto_uint16;
2236e94dc5SPeter Avalos typedef int32_t crypto_int32;
2336e94dc5SPeter Avalos typedef uint32_t crypto_uint32;
2436e94dc5SPeter Avalos 
2536e94dc5SPeter Avalos #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
26*664f4763Szrj #define small_random32() arc4random()
2736e94dc5SPeter Avalos 
2836e94dc5SPeter Avalos #define crypto_hash_sha512_BYTES 64U
2936e94dc5SPeter Avalos 
3036e94dc5SPeter Avalos int	crypto_hash_sha512(unsigned char *, const unsigned char *,
3136e94dc5SPeter Avalos     unsigned long long);
3236e94dc5SPeter Avalos 
3336e94dc5SPeter Avalos int	crypto_verify_32(const unsigned char *, const unsigned char *);
3436e94dc5SPeter Avalos 
3536e94dc5SPeter Avalos #define crypto_sign_ed25519_SECRETKEYBYTES 64U
3636e94dc5SPeter Avalos #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
3736e94dc5SPeter Avalos #define crypto_sign_ed25519_BYTES 64U
3836e94dc5SPeter Avalos 
3936e94dc5SPeter Avalos int	crypto_sign_ed25519(unsigned char *, unsigned long long *,
4036e94dc5SPeter Avalos     const unsigned char *, unsigned long long, const unsigned char *);
4136e94dc5SPeter Avalos int	crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
4236e94dc5SPeter Avalos     const unsigned char *, unsigned long long, const unsigned char *);
4336e94dc5SPeter Avalos int	crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
4436e94dc5SPeter Avalos 
45*664f4763Szrj #define crypto_kem_sntrup4591761_PUBLICKEYBYTES 1218
46*664f4763Szrj #define crypto_kem_sntrup4591761_SECRETKEYBYTES 1600
47*664f4763Szrj #define crypto_kem_sntrup4591761_CIPHERTEXTBYTES 1047
48*664f4763Szrj #define crypto_kem_sntrup4591761_BYTES 32
49*664f4763Szrj 
50*664f4763Szrj int	crypto_kem_sntrup4591761_enc(unsigned char *cstr, unsigned char *k,
51*664f4763Szrj     const unsigned char *pk);
52*664f4763Szrj int	crypto_kem_sntrup4591761_dec(unsigned char *k,
53*664f4763Szrj     const unsigned char *cstr, const unsigned char *sk);
54*664f4763Szrj int	crypto_kem_sntrup4591761_keypair(unsigned char *pk, unsigned char *sk);
55*664f4763Szrj 
5636e94dc5SPeter Avalos #endif /* crypto_api_h */
57