AES-GCM
Counter-mode AES with a GHASH polynomial MAC; the default AEAD of TLS and IPsec
Overview
AES-GCM combines AES in counter mode with GHASH, a universal hash over GF(2^128), to provide authenticated encryption with associated data. It is standardised in NIST SP 800-38D and is the most widely deployed AEAD in TLS, IPsec, SSH and disk and storage protocols.
Galois/Counter Mode encrypts the plaintext with AES in counter mode, starting from a counter block derived from the nonce. The authentication tag is computed by GHASH, a polynomial evaluation in GF(2^128) keyed with H = AES_K(0), over the associated data, the ciphertext and a length block; the result is masked with the encryption of the initial counter block.
The construction is fully parallelisable and runs at high speed on processors with AES and carry-less multiplication instructions (AES-NI and PCLMULQDQ on x86, the ARMv8 crypto extensions). NextSSL exposes AES-128-GCM, AES-192-GCM and AES-256-GCM with the standard 96-bit nonce and 128-bit tag.
GCM is simple to use correctly only if nonces never repeat under one key. Its security bounds also degrade with very large data volumes per key, which is why protocols such as TLS 1.3 define key-update limits.
History
2004–2018GCM published by David McGrew and John Viega
Approved in NIST SP 800-38D
Used in TLS 1.2 cipher suites
One of the mandatory TLS 1.3 AEADs
How it works
- Derive the hash key H by encrypting the all-zero block with AES under K.
- Form the initial counter block J0 from the 96-bit nonce and encrypt the plaintext in counter mode starting at J0 + 1.
- Run GHASH over the associated data, the ciphertext and a 128-bit length block.
- Encrypt J0 and XOR it with the GHASH output to produce the tag; truncate if a shorter tag is configured.
- On decryption, recompute and compare the tag in constant time before releasing any plaintext.
Security notes
Reusing a nonce with the same key reveals the XOR of plaintexts and allows recovery of the GHASH key, after which an attacker can forge arbitrary messages. Short tags and non-96-bit nonces weaken the guarantees; use random or counter nonces with strict uniqueness and rekey well before the usage limits.
Typical uses
Variants in NextSSL
3| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| AES-128-GCM aes-128-gcm |
standard FIPS | key 16 · nonce 12 · tag 16 | NIST SP 800-38D | safe |
| AES-192-GCM aes-192-gcm |
standard FIPS | key 24 · nonce 12 · tag 16 | NIST SP 800-38D | safe |
| AES-256-GCM aes-256-gcm |
standard FIPS | key 32 · nonce 12 · tag 16 | NIST SP 800-38D | safe |
Frequently asked questions
Which AES-GCM variants does NextSSL include?
NextSSL registers 3 AES-GCM variants: aes-128-gcm, aes-192-gcm, aes-256-gcm.
Families with similar names
Other authenticated encryption
All 392Related
CBC-MAC then counter-mode encryption with AES (NIST SP 800-38C, RFC 3610)
AES-GCM-SIVNonce-misuse-resistant AES mode using POLYVAL and synthetic IVs (RFC 8452)
ChaCha20-Poly1305ARX stream cipher with a one-time Poly1305 MAC; fast and constant-time in software
AESThe Advanced Encryption Standard: the world's default 128-bit block cipher
GHASHThe GF(2^128) polynomial hash at the core of AES-GCM and GMAC
ChaChaBernstein's ARX stream cipher; ChaCha20 secures much of today's TLS, SSH and VPN traffic