-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow length=0
in HKDF and PBKDF2 derive bits operations
#380
Conversation
RFC 8018 does not allow passing dkLen=0. Therefore, we explicitly return an empty ArrayBuffer in that case.
The algorithm registrations state that they return `ArrayBuffer`s, but the operations did not.
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.
Thanks!
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.
Thanks!
@nmahendru it´d be great if you could review this PR, to get also support from WebKit. |
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.
👍
cc: @annevk
This CL adapts our implementation to the spec change described in the PR#380 [1]. Instead of trowing an OperationError exception, we allow now zero as value for the 'length' parameter. Given that the deriveBits operation must result in an empty string, this change early returns to avoid the unnecessary computation of the bits derivation. The specific WTP defined for this case are modified in this CL as well, so no additional test cases are needed. [1] w3c/webcrypto#380 Bug: 376493194 Change-Id: If685c349a0a9d134a8e8f7c902e8aac342945226
The PR#380 [1] changed the PBKDF2 deriveBits operation to allow zero length and introduced an additional step to return an empty string in that case. It also reversted the PR#275 [2] so that HKDF also handles the zero length in the same way. This PR updates the tests cases affecting this 2 algorithms on the cases where zero was passed in the length parameter. [1] w3c/webcrypto#380 [2] w3c/webcrypto#275
The PR#380 [1] changed the PBKDF2 deriveBits operation to allow zero length and introduced an additional step to return an empty string in that case. It also reversted the PR#275 [2] so that HKDF also handles the zero length in the same way. This PR updates the tests cases affecting this 2 algorithms on the cases where zero was passed in the length parameter. [1] w3c/webcrypto#380 [2] w3c/webcrypto#275
The PR#380 [1] changed the PBKDF2 deriveBits operation to allow zero length and introduced an additional step to return an empty string in that case. It also reversted the PR#275 [2] so that HKDF also handles the zero length in the same way. This PR updates the tests cases affecting this 2 algorithms on the cases where zero was passed in the length parameter. [1] w3c/webcrypto#380 [2] w3c/webcrypto#275
… zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380
This CL adapts our implementation to the spec change described in the PR#380 [1]. Instead of trowing an OperationError exception, we allow now zero as value for the 'length' parameter. Given that the deriveBits operation must result in an empty string, this change early returns to avoid the unnecessary computation of the bits derivation. The specific WTP defined for this case are modified in this CL as well, so no additional test cases are needed. [1] w3c/webcrypto#380 Bug: 376493194 Change-Id: If685c349a0a9d134a8e8f7c902e8aac342945226 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5979996 Commit-Queue: Javier Fernandez <[email protected]> Reviewed-by: David Benjamin <[email protected]> Cr-Commit-Position: refs/heads/main@{#1381490}
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048 UltraBlame original commit: b60e10893fce2f9a640fe2999db7e1785f638b61
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048 UltraBlame original commit: b60e10893fce2f9a640fe2999db7e1785f638b61
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048 UltraBlame original commit: b60e10893fce2f9a640fe2999db7e1785f638b61
…ty ArrayBuffer when length is zero, a=testonly Automatic update from web-platform-tests WebCrypto: HDKF and PBKDF2 return an empty ArrayBuffer when length is zero (#49048) The HKDF and PBKDF2 derive bits operations were changed in [1] to allow a zero length to be passed and return an empty ArrayBuffer in that case. This PR updates the tests cases affecting these 2 algorithms in the cases where zero was passed as the length parameter. [1] w3c/webcrypto#380 -- wpt-commits: b81831169b8527a6c569a4ad92cf8a1baf4a7118 wpt-pr: 49048
Fixes #370.
This PR reverts #275, and addresses #274 in an alternative way, namely by explicitly returning an empty
ArrayBuffer
for PBKDF2 whenlength=0
(as RFC 8018 does not allowdkLen=0
).Additionally, explicitly return an
ArrayBuffer
in all cases (the algorithm registrations already stated this, but the operations did not).Preview | Diff