AES-GCM, spelled out

Authenticated encryption, every step

Duc V. Le

Study notes · October 2026

Roadmap

Two halves

Fundamental concepts

Confidentiality and authentication are different goals

Fundamental concepts

Encryption alone does not authenticate

Generic composition 1 of 3

Encrypt-and-MAC: the tag is computed over the plaintext

Generic composition 3 of 3

Encrypt-then-MAC: the tag is computed over the ciphertext

Generic composition · summary

Only one of the three is generically secure

Fundamental concepts

What "AE-secure" asks for

Fundamental concepts

Some data must be authenticated but not encrypted

Part two

AES-GCM

CTR mode for secrecy, GMAC for the tag

AES-GCM

Two parts, one key

Designed by David McGrew and John Viega, 2004. NIST standard SP 800-38D, 2007.

AES-GCM · encryption

CTR mode encrypts counters, not data

AES-GCM · encryption

Where the counters come from

AES-GCM · encryption

Why the payload stops at $2^{32}-2$ blocks

AES-GCM · encryption

Six things to remember about CTR

AES-GCM · the tag

Arithmetic in $\mathrm{GF}(2^{128})$

What it means to multiply two 128-bit blocks

GF(2^128)

A block is a polynomial

GF(2^128)

Multiply, then reduce — worked all the way through

Recap

GMAC packs the message into one polynomial

AES-GCM · the tag

Evaluating $f_A(H)$ without ever forming a power

Security argument · the simplified tag

First attack: guess the tag outright

  1. 1Drop the one-time pad for now and consider the simplified tag $t' = f_A(H)$. It is a single 128-bit value.
  2. 2She submits one guess. Exactly one of the $2^{128}$ values is accepted, so $\Pr[\text{success}] = 1/2^{128}$.
  3. 3A rejected guess teaches her nothing: the verifier answers only accept or reject, and every other value stays equally likely.

Security argument · the simplified tag

Guessing $H$ succeeds with probability at most $\frac{v+1}{2^{128}}$

  1. 1Strip the one-time pad and look at $t' = f_A(H)$ alone. The adversary wants $t'$ for a message $A$ of her choice, without knowing $H$.
  2. 2She picks one guess $H'$ and outputs $t' = f_A(H')$. She wins exactly when $f_A(H') = f_A(H)$.
  3. 3Put everything on one side: $g(x) = f_A(x) + f_A(H')$. In characteristic 2 subtraction is addition, so she wins iff $g(H) = 0$.
  4. 4$g$ is not the zero polynomial and $\deg g = v+1$: adding the constant $f_A(H')$ changes only the $x^0$ term, and the leading term $A_1x^{v+1}$ survives.
  5. 5A nonzero degree-$d$ polynomial over a field has at most $d$ roots. So at most $v+1$ of the $2^{128}$ elements are roots of $g$.
  6. 6$H = \mathrm{AES}_k(0^{128})$ is unknown and uniform, and she chose $H'$ before seeing it. So $\Pr[g(H) = 0] \le \dfrac{v+1}{2^{128}}$.

Security argument · the simplified tag

Third attack: one valid pair, and the guessing stops

Security argument · the fix

Hide the polynomial value behind a one-time pad

AES-GCM · the full scheme

What goes in and what comes out

Input

namewhatlimit
$A$authenticated, not encrypted$\le 2^{64}-1$ bits
$M$encrypted and authenticated$\le 2^{39}-256$ bits
$IV$the nonce96 bits recommended
$k$the AES key128, 192 or 256 bits

Output

namewhatsize
$IV$echoed back96 bits
$A$in the clearunchanged
$C$the ciphertextsame length as $M$
$t$the tag128 bits

AES-GCM · the full scheme

Encryption and authentication, side by side

AES-GCM · the full scheme

One polynomial over the header and the ciphertext

AES-GCM · the full scheme

Verify first, decrypt second

AES-GCM · the sharpest edge

Reusing one IV hands over the key material

AES-GCM · in practice

Seven properties worth knowing

AES-GCM · in practice

The special instructions are worth about 14×

algorithmblock (bits)key (bits)digest (bits)speed (MB/s)
ChaCha20—256—323
Triple-DES64168—21
AES-128128128—170
AES-128-NI128128—2426
AES-256128256—129
AES-256-NI128256—1830
GMAC128128128247
GMAC-PCLMUL1281281281741

Intel Xeon E3-1220 V2 at 3.10 GHz, 64-bit mode, 2018. Source: bearssl.org/speed.html, via Menezes V5 p.21.

AES-GCM · in practice

The proof took eight years to get right

Summary

Five things to carry away

Backup

Backup slides

Notation, and what this deck leaves out

Backup

Notation reference

symbolmeaningsize
$k$the AES key128, 192 or 256 bits
$IV$the nonce, never repeated under one $k$96 bits (recommended)
$J_0$$IV \| 0^{31} \| 1$; its AES value masks the tag128 bits
$J_i$$\mathrm{inc32}(J_{i-1})$, the counter blocks128 bits
$H$$\mathrm{AES}_k(0^{128})$, the secret evaluation point128 bits
$A$additional authenticated data, $v$ blocks$\le 2^{64}-1$ bits
$M$, $C$plaintext and ciphertext, $u$ blocks$\le 2^{39}-256$ bits
$L$$L_A \| L_M$, the two lengths as 64-bit integers128 bits
$f_{A,C}$the message polynomialdegree $u+v+1$
$t$$\mathrm{AES}_k(J_0) \oplus f_{A,C}(H)$, the tag128 bits

Menezes V5 p.11, 14, 17, 18. Length bounds from NIST SP 800-38D §5.2.1.1.

Backup

What this deck leaves out