Add native HKDF bindings - #525
Merged
Merged
Conversation
cjpatton
reviewed
Sep 22, 2026
punkeel
force-pushed
the
punkeel/hkdf
branch
3 times, most recently
from
September 22, 2026 23:20
87594e5 to
f255c8b
Compare
cjpatton
approved these changes
Sep 23, 2026
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.
punkeel
force-pushed
the
punkeel/hkdf
branch
from
September 23, 2026 15:40
f255c8b to
9688930
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
HkdfSuite, configured withMessageDigest, 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 returnErrorStackon 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.