Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.

Correct WebCrypto API parameter value from bytes to bits#157

Open
Traktormaster wants to merge 1 commit intomiscreant:developfrom
Traktormaster:ctr-counter-bug
Open

Correct WebCrypto API parameter value from bytes to bits#157
Traktormaster wants to merge 1 commit intomiscreant:developfrom
Traktormaster:ctr-counter-bug

Conversation

@Traktormaster
Copy link
Copy Markdown

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 be 128 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant