Repository navigation
fix(hkdf): accept a zero-length input keying material - #1080
Merged
Merged
Conversation
OpenSSL rejects a null key pointer even when the length is 0, so empty IKM derivation failed. Pass a non-null empty buffer instead. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@matthiasgeihs is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
3 of 4 tasks
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.
Summary
HybridHkdf::deriveKeySyncpassed a null pointer for a zero-length key. OpenSSL 3.6.2 (the version this package vendors) rejects that withpassed a null parameter, soEVP_KDF_derivefails and callers seeHKDF derivation failed.crypto.hkdfSync. Empty salt is unchanged: it is still omitted, and OpenSSL usesHashLenzero bytes.subtle.importKey({ name: 'HKDF' })hits for an empty key, including NoiseSplit(HKDF(chaining key, empty)).Test plan
hkdfSync: zero-length IKM and empty saltmatcheseb70f01d…hkdfSync: zero-length IKM with saltmatchesb5a5789a…WebCrypto HKDF deriveBits: zero-length IKMimports an empty raw key and derives the salted vectorThe new vectors were checked against Node.js
crypto.hkdfSyncon OpenSSL 3.6.2. The null-pointer call fails there; the non-null empty buffer succeeds. The example tests need a native rebuild.Made with Cursor