MCPcopy Create free account
hub / github.com/ElementsProject/lightning / hkdf_two_keys

Function hkdf_two_keys

common/cryptomsg.c:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <wire/wire_io.h>
10
11static void hkdf_two_keys(struct secret *out1, struct secret *out2,
12 const struct secret *in1,
13 const struct secret *in2)
14{
15 /* BOLT #8:
16 *
17 * * `HKDF(salt,ikm)`: a function defined in
18 * `RFC 5869`<sup>[3](#reference-3)</sup>, evaluated with a
19 * zero-length `info` field
20 * * All invocations of `HKDF` implicitly return 64 bytes of
21 * cryptographic randomness using the extract-and-expand component
22 * of the `HKDF`.
23 */
24 struct secret okm[2];
25
26 BUILD_ASSERT(sizeof(okm) == 64);
27 hkdf_sha256(okm, sizeof(okm), in1, sizeof(*in1), in2, sizeof(*in2),
28 NULL, 0);
29 *out1 = okm[0];
30 *out2 = okm[1];
31}
32
33static void maybe_rotate_key(u64 *n, struct secret *k, struct secret *ck)
34{

Callers 1

maybe_rotate_keyFunction · 0.70

Calls 1

hkdf_sha256Function · 0.85

Tested by

no test coverage detected