code wiki / (root) / nx_hkdf_sha1.nx

nx_hkdf_sha1.nx

buildroot/runtime/nx_hkdf_sha1.nx

4839 B155 linesdepth 4pulls 4 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. license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_5869

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_hmac_sha1.nx nx_hkdf_sha1.nx

imports: nx_syscalls.nxnx_hmac_sha1.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap hkdf_sha1 sys_mmap ↻ hkdf_sha1_extract sys_mmap ↻ hmac_sha1 sys_mmap ↻ sha1 sys_mmap ↻ sha1_process_block if_ge hkdf_sha1_expand sys_mmap ↻ hmac_sha1 ↻

structs

none

consts

41const HK_HLEN: i64 = 20
42const HK_MAX_OKM: i64 = 5100 // 255 * 20

functions

46func hkdf_sha1_extract(salt: *u8, salt_len: i64,
called by 1: hkdf_sha1 calls 2: sys_mmaphmac_sha1
62func hkdf_sha1_expand(prk: *u8,
called by 1: hkdf_sha1 calls 2: sys_mmaphmac_sha1
119func hkdf_sha1(salt: *u8, salt_len: i64,
132func main() -> i64