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 embed_bool (*
extract)(uint8_t *,
const uint8_t *, size_t,
const uint8_t *, size_t, uint8_t *);
47 embed_bool (*
expand)(uint8_t *,
const uint8_t *,
const uint8_t *, size_t, uint8_t *, size_t);
48 embed_bool (*
expand_label)(uint8_t *,
const uint8_t *,
const char *, uint8_t *, size_t,
const char *);
49 embed_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);
76embed_bool
protocore_hkdf_expand(uint8_t *work,
const uint8_t *prk,
const uint8_t *info,
size_t info_len, uint8_t *out,
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);
embed_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).
embed_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).
embed_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.
embed_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.
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#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.
embed_bool(* expand_label)(uint8_t *, const uint8_t *, const char *, uint8_t *, size_t, const char *)
embed_bool(* extract)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t, uint8_t *)
embed_bool(* expand_label_ctx)(uint8_t *, const uint8_t *, const char *, const uint8_t *, size_t, uint8_t *, size_t, const char *)
embed_bool(* expand)(uint8_t *, const uint8_t *, const uint8_t *, size_t, uint8_t *, size_t)