xref: /freebsd/sys/contrib/libsodium/src/libsodium/include/sodium/crypto_kdf.h (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1 #ifndef crypto_kdf_H
2 #define crypto_kdf_H
3 
4 #include <stddef.h>
5 #include <stdint.h>
6 
7 #include "crypto_kdf_blake2b.h"
8 #include "export.h"
9 
10 #ifdef __cplusplus
11 # ifdef __GNUC__
12 #  pragma GCC diagnostic ignored "-Wlong-long"
13 # endif
14 extern "C" {
15 #endif
16 
17 #define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN
18 SODIUM_EXPORT
19 size_t crypto_kdf_bytes_min(void);
20 
21 #define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX
22 SODIUM_EXPORT
23 size_t crypto_kdf_bytes_max(void);
24 
25 #define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES
26 SODIUM_EXPORT
27 size_t crypto_kdf_contextbytes(void);
28 
29 #define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES
30 SODIUM_EXPORT
31 size_t crypto_kdf_keybytes(void);
32 
33 #define crypto_kdf_PRIMITIVE "blake2b"
34 SODIUM_EXPORT
35 const char *crypto_kdf_primitive(void)
36             __attribute__ ((warn_unused_result));
37 
38 SODIUM_EXPORT
39 int crypto_kdf_derive_from_key(unsigned char *subkey, size_t subkey_len,
40                                uint64_t subkey_id,
41                                const char ctx[crypto_kdf_CONTEXTBYTES],
42                                const unsigned char key[crypto_kdf_KEYBYTES]);
43 
44 SODIUM_EXPORT
45 void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES]);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif
52