code wiki / (root) / hkdf_sha1.nx

hkdf_sha1.nx

buildroot/runtime/hkdf_sha1.nx

4621 B145 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic hkdf
docsdependenciesstructsconstsfunctions

about

hkdf_sha1.nx -- HMAC-based Key Derivation Function with SHA-1. RFC 5869 HKDF, SHA-1 variant. Less common today than the SHA-256 variant (hkdf.nx) but still on the wire in: - Signal Protocol interop with older clients - Some TLS 1.2 PRF variants - Legacy WPA3 Dragonfly (SAE) key schedule HKDF in two phases: PRK = HMAC(salt, IKM) (extract) T(0) = \"\" T(i) = HMAC(PRK, T(i-1) || info || i) (expand) OKM = T(1) || T(2) || ... truncated to L The expand phase counter is a single byte (range 1..255), so max output is 255 * 20 = 5100 bytes. For larger keys (rare) composers must re-run with a different info string. Composes hmac_sha1.nx. Invariants: H1 If salt is empty, RFC 5869 says use a zero-filled HashLen (20 zeros). We implement that default. H2 Output length capped at 255 * 20 = 5100 bytes; beyond that we truncate silently. Callers requesting more should raise it in info/DOM-specific mode.

dependencies 2 imports · 0 importers

syscalls.nx hmac_sha1.nx hkdf_sha1.nx

imports: syscalls.nxhmac_sha1.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main hkdf_sha1 hkdf_sha1_extract hmac_sha1 sha1 sys_mmap sha1_process_block if_ge hkdf_sha1_expand hmac_sha1 ↻

structs

none

consts

31const HK_HLEN: i64 = 20
32const HK_MAX_OKM: i64 = 5100 // 255 * 20

functions

36func hkdf_sha1_extract(salt: *u8, salt_len: i64,
called by 1: hkdf_sha1 calls 1: hmac_sha1
52func hkdf_sha1_expand(prk: *u8,
called by 1: hkdf_sha1 calls 1: hmac_sha1
109func hkdf_sha1(salt: *u8, salt_len: i64,
122func main() -> i64 {
calls 1: hkdf_sha1