PBKDF2 allows zero length and returns and empty string #49045
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.
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/5979996
WPT-Export-Revision: 432189205babf9b8d0e448a8f48c448428694cf9