-
Notifications
You must be signed in to change notification settings - Fork 54
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
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