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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto: pass all WebCryptoAPI WPTs #43656
crypto: pass all WebCryptoAPI WPTs #43656
Changes from 11 commits
9952d1f
491ea8d
d9cd385
f0c0a9c
3720974
4fcfa50
e305875
7745cb0
41d849d
07a8676
fb5eb54
03275d0
8c05855
2561171
09a6e50
d51c30c
c8d7b2c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a non-zero-length key work with a 0-length salt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://datatracker.ietf.org/doc/html/rfc5869#section-2.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's allowed, I am just wondering if OpenSSL implements it that way. The RFC's statement
if not provided
could be interpreted as "if the user does not callEVP_PKEY_CTX_set1_hkdf_salt
".Now I am confused as to whether an empty salt is the same as passing no salt in our current implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our implementation does not allow to omit passing salt, we require the argument, albeit we allow it to be zero-length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's also covered by a passing wpt btw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a brief comment to the beginning of the
else
branch to explain why it exists for future readers?If we accept that this branch must exist (until we fully drop OpenSSL 1.1.1), then we should probably either
EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND
and pass thekey
toHMAC
in this new branch (that should be equivalent as far as I can tell), orTODO
comment saying to remove this branch once we have dropped OpenSSL 1.1.1.The first option would give us improved coverage because all HMAC operations would go through it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
I think that can be done as a follow-up, I am not up for such challenge myself.
You mean to change the implementation to use
EVP_KDF-HKDF
when 1.1.1 is dropped?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to verify that no other uses of
KeyObjectData
(and related structures) assume that the stored pointer is notnullptr
. Otherwise, we might end up with aborts/crashes if someone constructs 0-length keys and uses them with other APIs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a zero length buffer key data treated as a nullptr? I would like to keep the check here but I don't understand the C++ keyobject implementation enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be because
malloc(len)
forlen = 0
is allowed to return anullptr
. The standard only requires the returned pointer to be valid forlen
bytes, whichnullptr
fulfills whenlen = 0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a suggestion that would allow us to keep this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to
reject
when theworker
emits anerror
event, you could also useawait events.once(worker, 'exit')
.That being said, it looks like the caller never awaits the returned
Promise
(e.g., intest-webcrypto.js
). What is the point in creating thePromise
here if the caller does not await it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is to process the queue one by one. This has helped stabilize CI, especially the keygen tests that easily bogged the hosts down minutes at a time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rejecting would skip running the rest of the queue. So maybe this?
or