Skip to content

aes-gcm: fix P_MAX and A_MAX values#762

Merged
newpavlov merged 3 commits into
masterfrom
aes-gcm/fix_p_max
Jan 16, 2026
Merged

aes-gcm: fix P_MAX and A_MAX values#762
newpavlov merged 3 commits into
masterfrom
aes-gcm/fix_p_max

Conversation

@newpavlov

@newpavlov newpavlov commented Jan 16, 2026

Copy link
Copy Markdown
Member

In Section 5.2.1.1 of NIST 800-38D maximum plaintext and AAD lengths are defined as 2^39-256 and 2^64-1 bits accordingly.

Reported in https://github.com/RustCrypto/AEADs/security/advisories/GHSA-8xg6-2rjr-7rv3

@newpavlov newpavlov requested a review from tarcieri January 16, 2026 13:48
Comment thread aes-gcm/src/lib.rs
@newpavlov newpavlov added the security Security-critical issues label Jan 16, 2026
@newpavlov

Copy link
Copy Markdown
Member Author

Note that our implementation uses apply_keystream_partial which should panic on counter overflow, so in the worst case scenario this bug can result only in DoS.

@newpavlov newpavlov removed the security Security-critical issues label Jan 16, 2026
@newpavlov newpavlov merged commit 9436649 into master Jan 16, 2026
13 checks passed
@newpavlov newpavlov deleted the aes-gcm/fix_p_max branch January 16, 2026 15:39
@tarcieri tarcieri mentioned this pull request Jun 27, 2026
tarcieri added a commit that referenced this pull request Jun 28, 2026
## Added
- `bytes` feature passthrough (#631)
- Support for 32-bit and 64-bit tags under `hazmat` feature (#777)

## Changed
- Bump `aead` from `0.5` to `0.6` (#583)
- Bump `aes` from `0.8` to `0.9` (#583)
- Bump `cipher` from `0.4` to `0.5` (#583)
- Bump `ctr` from `0.9` to `0.10` (#583)
- Bump `ghash` from `0.5` to `0.6` (#583)
- Edition changed to 2024 and MSRV bumped to 1.85 (#662)
- Relax MSRV policy and allow MSRV bumps in patch releases
- `getrandom` feature renamed as `os_rng` (#662)

## Fixed
- `P_MAX` and `A_MAX` constants; plaintext and AAD length checks (#762)

## Removed
- `std` & `stream` features (#662)
- `C_MAX` constant (#762)
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.

2 participants