1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#ifndef crypto_kdf_hkdf_sha512_H
#define crypto_kdf_hkdf_sha512_H
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "crypto_kdf.h"
#include "crypto_auth_hmacsha512.h"
#include "export.h"
#ifdef __cplusplus
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
extern "C" {
#endif
#define crypto_kdf_hkdf_sha512_KEYBYTES crypto_auth_hmacsha512_BYTES
SODIUM_EXPORT
size_t crypto_kdf_hkdf_sha512_keybytes(void);
#define crypto_kdf_hkdf_sha512_BYTES_MIN 0U
SODIUM_EXPORT
size_t crypto_kdf_hkdf_sha512_bytes_min(void);
#define crypto_kdf_hkdf_sha512_BYTES_MAX (0xff * crypto_auth_hmacsha512_BYTES)
SODIUM_EXPORT
size_t crypto_kdf_hkdf_sha512_bytes_max(void);
SODIUM_EXPORT
int crypto_kdf_hkdf_sha512_extract(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES],
const unsigned char *salt, size_t salt_len,
const unsigned char *ikm, size_t ikm_len)
__attribute__ ((nonnull(1)));
SODIUM_EXPORT
void crypto_kdf_hkdf_sha512_keygen(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
__attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_kdf_hkdf_sha512_expand(unsigned char *out, size_t out_len,
const char *ctx, size_t ctx_len,
const unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
__attribute__ ((nonnull(1)));
/* ------------------------------------------------------------------------- */
typedef struct crypto_kdf_hkdf_sha512_state {
crypto_auth_hmacsha512_state st;
} crypto_kdf_hkdf_sha512_state;
SODIUM_EXPORT
size_t crypto_kdf_hkdf_sha512_statebytes(void);
SODIUM_EXPORT
int crypto_kdf_hkdf_sha512_extract_init(crypto_kdf_hkdf_sha512_state *state,
const unsigned char *salt, size_t salt_len)
__attribute__ ((nonnull(1)));
SODIUM_EXPORT
int crypto_kdf_hkdf_sha512_extract_update(crypto_kdf_hkdf_sha512_state *state,
const unsigned char *ikm, size_t ikm_len)
__attribute__ ((nonnull));
SODIUM_EXPORT
int crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
__attribute__ ((nonnull));
#ifdef __cplusplus
}
#endif
#endif
|