script: Use hkdf crate for HKDF in WebCrypto#40650
Merged
TimvdLippe merged 2 commits intoservo:mainfrom Nov 15, 2025
Merged
Conversation
Signed-off-by: Kingsley Yung <[email protected]>
Signed-off-by: Kingsley Yung <[email protected]>
TimvdLippe
approved these changes
Nov 15, 2025
Contributor
TimvdLippe
left a comment
There was a problem hiding this comment.
Another big chunk of passing chunks 🎉
15 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.
We currently use the crate
aws-lc-rsfor HKDF in the WebCrypto API. When generating output bytes from the output of HKDF-Expand operation (OKM, Output Key Material), it enforces the requested output length must match the length of key type (see error condition ofOkm::fillat https://docs.rs/aws-lc-rs/1.14.1/aws_lc_rs/hkdf/struct.Okm.html#method.fill). However, according to the WebCrypto API specification, user should be allowed to choose the output length (https://w3c.github.io/webcrypto/#hkdf-operations-derive-bits). The restriction fromaws-lc-rscauses several HKDF-related WPT tests to fail.This patch switches to use a more flexible crate
hkdf(https://crates.io/crates/hkdf) for implementing HKDF in our WebCrypto API, and allowing variable length output. This helps to make those HKDF-related WPT tests pass.Testing: Pass some WPT tests that were expected to fail.