xref: /netbsd-src/crypto/external/bsd/openssh/dist/crypto_api.h (revision 9469f4f13c84743995b7d51c506f9c9849ba30de)
1*9469f4f1Schristos /*	$NetBSD: crypto_api.h,v 1.6 2024/09/24 21:32:18 christos Exp $	*/
2*9469f4f1Schristos /* $OpenBSD: crypto_api.h,v 1.9 2024/09/02 12:13:56 djm Exp $ */
35484a5efSchristos 
45484a5efSchristos /*
55484a5efSchristos  * Assembled from generated headers and source files by Markus Friedl.
65484a5efSchristos  * Placed in the public domain.
75484a5efSchristos  */
85484a5efSchristos 
95484a5efSchristos #ifndef crypto_api_h
105484a5efSchristos #define crypto_api_h
115484a5efSchristos 
125484a5efSchristos #include <stdint.h>
135484a5efSchristos #include <stdlib.h>
145484a5efSchristos 
15aa36fcacSchristos typedef int8_t crypto_int8;
16aa36fcacSchristos typedef uint8_t crypto_uint8;
17aa36fcacSchristos typedef int16_t crypto_int16;
18aa36fcacSchristos typedef uint16_t crypto_uint16;
195484a5efSchristos typedef int32_t crypto_int32;
205484a5efSchristos typedef uint32_t crypto_uint32;
2117418e98Schristos typedef int64_t crypto_int64;
2217418e98Schristos typedef uint64_t crypto_uint64;
235484a5efSchristos 
245484a5efSchristos #define randombytes(buf, buf_len) arc4random_buf((buf), (buf_len))
25aa36fcacSchristos #define small_random32() arc4random()
265484a5efSchristos 
275484a5efSchristos #define crypto_hash_sha512_BYTES 64U
285484a5efSchristos 
295484a5efSchristos int	crypto_hash_sha512(unsigned char *, const unsigned char *,
305484a5efSchristos     unsigned long long);
315484a5efSchristos 
325484a5efSchristos #define crypto_sign_ed25519_SECRETKEYBYTES 64U
335484a5efSchristos #define crypto_sign_ed25519_PUBLICKEYBYTES 32U
345484a5efSchristos #define crypto_sign_ed25519_BYTES 64U
355484a5efSchristos 
365484a5efSchristos int	crypto_sign_ed25519(unsigned char *, unsigned long long *,
375484a5efSchristos     const unsigned char *, unsigned long long, const unsigned char *);
385484a5efSchristos int	crypto_sign_ed25519_open(unsigned char *, unsigned long long *,
395484a5efSchristos     const unsigned char *, unsigned long long, const unsigned char *);
405484a5efSchristos int	crypto_sign_ed25519_keypair(unsigned char *, unsigned char *);
415484a5efSchristos 
4217418e98Schristos #define crypto_kem_sntrup761_PUBLICKEYBYTES 1158
4317418e98Schristos #define crypto_kem_sntrup761_SECRETKEYBYTES 1763
4417418e98Schristos #define crypto_kem_sntrup761_CIPHERTEXTBYTES 1039
4517418e98Schristos #define crypto_kem_sntrup761_BYTES 32
46aa36fcacSchristos 
4717418e98Schristos int	crypto_kem_sntrup761_enc(unsigned char *cstr, unsigned char *k,
48aa36fcacSchristos     const unsigned char *pk);
4917418e98Schristos int	crypto_kem_sntrup761_dec(unsigned char *k,
50aa36fcacSchristos     const unsigned char *cstr, const unsigned char *sk);
5117418e98Schristos int	crypto_kem_sntrup761_keypair(unsigned char *pk, unsigned char *sk);
52aa36fcacSchristos 
53*9469f4f1Schristos #define crypto_kem_mlkem768_PUBLICKEYBYTES 1184
54*9469f4f1Schristos #define crypto_kem_mlkem768_SECRETKEYBYTES 2400
55*9469f4f1Schristos #define crypto_kem_mlkem768_CIPHERTEXTBYTES 1088
56*9469f4f1Schristos #define crypto_kem_mlkem768_BYTES 32
57*9469f4f1Schristos 
585484a5efSchristos #endif /* crypto_api_h */
59