briansmith / ring

Safe, fast, small crypto using Rust
Other
3.68k stars 693 forks source link

AEAD: Move input length checks to to individual algorithm implementations #1949

Closed briansmith closed 6 months ago

briansmith commented 6 months ago

Use usize-based math instead of u64-based math, addressing the longstanding TODO. Then move the length check into the individual algorithm implementations. Especially in the case of AES-GCM, this makes it clearer that there will be no overflows in the handling of the input lengths. (There weren't any, but this makes that clearer.) See the individual commit messages for details.

codecov[bot] commented 6 months ago

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (3772c45) 96.23% compared to head (df31fb3) 96.23%.

Files Patch % Lines
src/aead.rs 0.00% 4 Missing :warning:
src/aead/chacha20_poly1305.rs 92.85% 2 Missing :warning:
src/aead/aes_gcm.rs 92.30% 1 Missing :warning:
src/aead/gcm.rs 94.11% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1949 +/- ## ======================================= Coverage 96.23% 96.23% ======================================= Files 135 135 Lines 20617 20649 +32 Branches 226 226 ======================================= + Hits 19840 19872 +32 Misses 743 743 Partials 34 34 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.