4#ifndef PROTOCORE_HKDF_H
5#define PROTOCORE_HKDF_H
37#define PROTOCORE_HKDF_HASH_LEN 32
41#define PROTOCORE_HKDF_LABEL_PREFIX "tls13 "
46 proto_bool (*extract)(uint8_t *,
const uint8_t *, size_t,
const uint8_t *, size_t, uint8_t *);
47 proto_bool (*expand)(uint8_t *,
const uint8_t *,
const uint8_t *, size_t, uint8_t *, size_t);
48 proto_bool (*expand_label)(uint8_t *,
const uint8_t *,
const char *, uint8_t *, size_t,
const char *);
49 proto_bool (*expand_label_ctx)(uint8_t *,
const uint8_t *,
const char *,
const uint8_t *, size_t, uint8_t *, size_t,
65 size_t ikm_len, uint8_t *prk);
89 size_t out_len,
const char *label_prefix);
103 const uint8_t *context,
size_t context_len, uint8_t *out,
size_t out_len,
104 const char *label_prefix);
proto_bool protocore_hkdf_expand_label_ctx(uint8_t *work, const uint8_t *secret, const char *label, const uint8_t *context, size_t context_len, uint8_t *out, size_t out_len, const char *label_prefix)
Expand under an HkdfLabel carrying a context, the Derive-Secret form.
proto_bool protocore_hkdf_extract(uint8_t *work, const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, uint8_t *prk)
PRK = HMAC-SHA256(salt, ikm) (RFC 5869 sec 2.2).
PROTOCORE_NS HkdfNs Hkdf PROTOCORE_UNUSED
Module namespace.
proto_bool protocore_hkdf_expand(uint8_t *work, const uint8_t *prk, const uint8_t *info, size_t info_len, uint8_t *out, size_t out_len)
OKM = T(1) | T(2) | ..., info taken verbatim (RFC 5869 sec 2.3).
proto_bool protocore_hkdf_expand_label(uint8_t *work, const uint8_t *secret, const char *label, uint8_t *out, size_t out_len, const char *label_prefix)
Expand under an HkdfLabel with an empty context.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
proto_bool(* extract)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t, uint8_t *)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS