Skip to content
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

aes-gcm: make AesGcm generic around nonce size #126

Merged
merged 2 commits into from
Mar 14, 2020

Conversation

tarcieri
Copy link
Member

Support for non-96-bit nonces, while still implementing the current Aead interface and type safety for nonce lengths.

@codecov-io
Copy link

codecov-io commented Mar 14, 2020

Codecov Report

Merging #126 into master will increase coverage by 0.71%.
The diff coverage is 92.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #126      +/-   ##
==========================================
+ Coverage   96.26%   96.98%   +0.71%     
==========================================
  Files          28       28              
  Lines         697      730      +33     
==========================================
+ Hits          671      708      +37     
+ Misses         26       22       -4     
Impacted Files Coverage Δ
crypto_box/tests/lib.rs 95.34% <85.71%> (-4.66%) ⬇️
aes-gcm/src/lib.rs 90.00% <88.00%> (-4.88%) ⬇️
aes-gcm/src/ctr.rs 100.00% <100.00%> (ø)
aes-siv/tests/aead.rs 100.00% <100.00%> (ø)
chacha20poly1305/tests/lib.rs 100.00% <100.00%> (ø)
ring-aead/tests/common/mod.rs 100.00% <100.00%> (ø)
ring-aead/src/lib.rs 87.09% <0.00%> (+6.45%) ⬆️
chacha20poly1305/src/lib.rs 100.00% <0.00%> (+16.66%) ⬆️
crypto_box/src/lib.rs 100.00% <0.00%> (+18.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a28e70...0b0a23f. Read the comment docs.

@tarcieri
Copy link
Member Author

tarcieri commented Mar 14, 2020

The test vectors still pass for 96-bit nonces, however there aren't any for non-96-bit nonces, and I'm not convinced this is correct yet, namely this part:

Screen Shot 2020-03-14 at 9 32 15 AM

It appears after inputting a zero-padded non-96-bit nonce into GHASH, it should also be followed by its length.

Regardless, we should add test vectors for non-96-bit nonces.

@tarcieri tarcieri force-pushed the aes-gcm/non-96-bit-nonces branch from d8d2685 to 0b0a23f Compare March 14, 2020 16:35
@tarcieri tarcieri force-pushed the aes-gcm/non-96-bit-nonces branch from 0b0a23f to fb163e4 Compare March 14, 2020 17:19
@tarcieri
Copy link
Member Author

I added some tests for non-96-bit IVs based on the NIST CAVS vectors and they're presently failing, even after attempting to include the IV length in the GHASH message.

@tarcieri tarcieri force-pushed the aes-gcm/non-96-bit-nonces branch from fb163e4 to a128b93 Compare March 14, 2020 18:33
Support for non-96-bit nonces, while still implementing the current
`Aead` interface and type safety for nonce lengths.
@tarcieri tarcieri force-pushed the aes-gcm/non-96-bit-nonces branch from a128b93 to 4dae48b Compare March 14, 2020 18:46
@tarcieri tarcieri marked this pull request as ready for review March 14, 2020 18:47
@tarcieri
Copy link
Member Author

Ok, got it working after updating the CTR implementation to parse a base counter value from 𝐉₀

@tarcieri tarcieri merged commit 8fe8807 into master Mar 14, 2020
@tarcieri tarcieri deleted the aes-gcm/non-96-bit-nonces branch March 14, 2020 18:53
This was referenced Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants