This repository has been archived by the owner on Feb 5, 2021. It is now read-only.
Correct WebCrypto API parameter value from bytes to bits #157
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.
The encrypt call for AES-CTR by the WebCrypto provider is incorrect. The
length
parameter indicating the number of rightmost bits to be used for incrementing should be128
to be consistent with other implementations.I've checked to see how the SoftCrypto provider, the python version of miscreant and the AES-SIV available in pycryptodome configures the CTR. They all allow the CTR to use the whole range for counting. Other limitations may apply that I'm unaware of and it seems the programmer must pay attention to security limits of the counter as described in RFC 5297 section 2.5.
The current value of
16
overflows at a bigger than 1MB message and the WebCrypto API raises an exception.I've tested the change up to 32MB payloads and they work correctly.