Skip to content

Add native HKDF bindings - #525

Merged
cjpatton merged 1 commit into
cloudflare:masterfrom
punkeel:punkeel/hkdf
Sep 23, 2026
Merged

cjpatton merged 1 commit into
cloudflare:masterfrom
punkeel:punkeel/hkdf

Conversation

@punkeel

@punkeel punkeel commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Add HkdfSuite, configured with MessageDigest, for RFC 5869 extraction and expansion using BoringSSL’s native HKDF functions.

Extraction returns allocation-free DigestBytes. Expansion fills a caller-provided buffer, accepts PRKs of at least the digest output length, and enforces the RFC output limit. Both operations return ErrorStack on failure.

Tests cover RFC SHA-1/SHA-256 vectors, independent SHA-384/SHA-512 vectors, empty inputs, block boundaries, output limits, and short/long PRKs. A tested example derives an AES-256-GCM key and uses it to encrypt and decrypt a message.

Comment thread boring/src/hkdf.rs Outdated
Comment thread boring/src/hkdf.rs
@punkeel
punkeel force-pushed the punkeel/hkdf branch 3 times, most recently from 87594e5 to f255c8b Compare September 22, 2026 23:20
@punkeel punkeel changed the title Add native HKDF-SHA-256 bindings Add native HKDF bindings Sep 22, 2026
Comment thread boring/src/hkdf.rs Outdated
Comment thread boring/src/hkdf.rs Outdated
Expose HkdfSuite configured with MessageDigest, returning allocation-free DigestBytes from extract and filling caller-provided output buffers during expand. Preserve BoringSSL errors and enforce RFC 5869 PRK and output-length requirements.

Cover RFC SHA-1 and SHA-256 vectors, independent SHA-384 and SHA-512 vectors, empty inputs, block boundaries, digest-dependent output limits, and short and long PRKs. Document RFC argument semantics.
@cjpatton
cjpatton merged commit 02c0298 into cloudflare:master Sep 23, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants