libsodium: Needed for Dnscrypto-proxy Release 1.3.0
[tomato.git] / release / src / router / libsodium / src / libsodium / include / sodium / crypto_generichash_blake2b.h
blob108541d1a9dd51d041b8c11e4e04d461379872f5
1 #ifndef crypto_generichash_blake2b_H
2 #define crypto_generichash_blake2b_H
4 #include <stddef.h>
5 #include <stdint.h>
6 #include <stdlib.h>
8 #include "export.h"
10 #define crypto_generichash_blake2b_BYTES 32U
11 #define crypto_generichash_blake2b_BYTES_MIN 16U
12 #define crypto_generichash_blake2b_BYTES_MAX 64U
13 #define crypto_generichash_blake2b_KEYBYTES 32U
14 #define crypto_generichash_blake2b_KEYBYTES_MIN 16U
15 #define crypto_generichash_blake2b_KEYBYTES_MAX 64U
16 #define crypto_generichash_blake2b_BLOCKBYTES 128U
18 #if defined(_MSC_VER)
19 # define CRYPTO_ALIGN(x) __declspec(align(x))
20 #else
21 # define CRYPTO_ALIGN(x) __attribute__((aligned(x)))
22 #endif
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 #pragma pack(push, 1)
29 CRYPTO_ALIGN(64) typedef struct crypto_generichash_blake2b_state {
30 uint64_t h[8];
31 uint64_t t[2];
32 uint64_t f[2];
33 uint8_t buf[2 * crypto_generichash_blake2b_BLOCKBYTES];
34 size_t buflen;
35 uint8_t last_node;
36 } crypto_generichash_blake2b_state;
37 #pragma pack(pop)
39 SODIUM_EXPORT
40 size_t crypto_generichash_blake2b_bytes_min(void);
42 SODIUM_EXPORT
43 size_t crypto_generichash_blake2b_bytes_max(void);
45 SODIUM_EXPORT
46 size_t crypto_generichash_blake2b_keybytes_min(void);
48 SODIUM_EXPORT
49 size_t crypto_generichash_blake2b_keybytes_max(void);
51 SODIUM_EXPORT
52 size_t crypto_generichash_blake2b_blockbytes(void);
54 SODIUM_EXPORT
55 const char * crypto_generichash_blake2b_blockbytes_primitive(void);
57 SODIUM_EXPORT
58 int crypto_generichash_blake2b(unsigned char *out, size_t outlen,
59 const unsigned char *in,
60 unsigned long long inlen,
61 const unsigned char *key, size_t keylen);
63 SODIUM_EXPORT
64 int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
65 const unsigned char *key,
66 const size_t keylen, const size_t outlen);
68 SODIUM_EXPORT
69 int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state *state,
70 const unsigned char *in,
71 unsigned long long inlen);
73 SODIUM_EXPORT
74 int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state *state,
75 unsigned char *out,
76 const size_t outlen);
78 #ifdef __cplusplus
80 #endif
82 #define crypto_generichash_blake2b_ref crypto_generichash_blake2b
83 #define crypto_generichash_blake2b_ref_init crypto_generichash_blake2b_init
84 #define crypto_generichash_blake2b_ref_update crypto_generichash_blake2b_update
85 #define crypto_generichash_blake2b_ref_final crypto_generichash_blake2b_final
87 #endif