A Block-Cipher Mode of Operation for Parallelizable Message Authentication

J. Black^{∗}  P. Rogaway ^{†}

February 15, 2002

Appears in Advances in Cryptology – Eurocrypt ’02, Lecture Notes in Computer Science, Vol. ????, L. Knudsen, ed., Springer-Verlag. This is the full version.

Abstract

We define and analyze a simple and fully parallelizable block-cipher mode of operation for message authentication. Parallelizability does not come at the expense of serial efficiency: in a conventional, serial environment, the algorithm’s speed is within a few percent of the (inherently sequential) CBC MAC. The new mode, PMAC, is deterministic, resembles a standard mode of operation (and not a Carter-Wegman MAC), works for strings of any bit length, employs a single block-cipher key, and uses just max{1, ⌈|M|/n⌉} block-cipher calls to MAC a string M ∈ {0, 1}^{∗} using an n-bit block cipher. We prove PMAC secure, quantifying an adversary’s forgery probability in terms of the quality of the block cipher as a pseudorandom permutation.

Key words: block-cipher modes, message authentication codes, modes of operation, provable security.

∗ Department of Computer Science/171, University of Nevada, Reno, Nevada, 89557, USA. E-mail:

jrb@cs.unr.edu WWW: www.cs.unr.edu/~jrb/

† Department of Computer Science, University of California, Davis, California, 95616, USA. E-mail:

rogaway@cs.ucdavis.edu WWW: www.cs.ucdavis.edu/~rogaway/

1 Introduction

Background. Many popular message authentication codes (MACs), like the CBC MAC [17] and HMAC [1], are inherently sequential: one cannot process the i-th message block until all previous message blocks have been processed. This serial bottleneck becomes increasingly an issue as commodity processors offer up more and more parallelism, and as increases in network speeds outpace increases in the speed of cryptographic hardware. By now there would seem to be a significant interest in having a parallelizable MAC which performs well in both hardware and software, built from a block cipher like AES.

There are several approaches to the design of such an MAC. One is to generically construct a more parallelizable MAC from an arbitrary one. For example, one could begin with breaking the message M[1] ⋯ M[2m] into M′ = M[1]M[3] ⋯ M[2m − 1] and M′′ = M[2]M[4] ⋯ M[2m] then separately MAC each half. But such an approach requires one to anticipate the maximal amount of parallelism one aims to extract. In the current work we are instead interested in fully parallelizable MACs: the amount of parallelism that can be extracted is effectively unbounded.

One idea for making a fully parallelizable MAC is to use the Carter-Wegman paradigm [13, 23], as in [12, 16, 19], making sure to select a universal hash-function family that is fully parallelizable. In fact, most universal hash functions that have been suggested are fully parallelizable. This approach is elegant and can lead to a nice MAC, but constructions for fast universal hash-functions have proven to be quite complex to specify or to implement well [7, 9], and may be biased either towards hardware or towards software. Twenty years after the paradigm was introduced, we still do not know of a single Carter-Wegman MAC that actually gets used. So the current work goes back to giving a conventional mode, but one designed, this time around, for serial and parallel efficiency.

The XOR MAC. Bellare, Guérin and Rogaway introduced a parallelizable MAC in their XOR MACs [3]. The message M is divided into pieces M[1] ⋯ M[ℓ] of length less than the blocksize; for concreteness, think of each M[i] as having 64 bits when the blocksize is n = 128 bits. Each piece M[i] is preceded by [i], the number i encoded as a 64-bit number, and to each [i] ∥ M[i] one applies the block cipher E, keyed by the MAC key K. One more block is enciphered, it having a first bit of 1 and then a counter or random value in the remaining n − 1 bits. The MAC is that counter or random value together with the XOR of all ℓ + 1 ciphertext blocks. Thus the MAC uses ℓ+1 ≈ 2m+1 block-cipher invocations to authenticate a message of m blocks of n bits; one has paid for parallelizability at a cost of about a factor of two in serial speed. Further disadvantages include the need for randomness or state (conventional MACs are deterministic) and in the increased length of the MAC (because of the counter or random value that has to be included).

PMAC. Unlike the XOR MAC, our new algorithm, PMAC, doesn’t waste any block-cipher invocations because of block-indices (nor for a counter or random values). Also, in the spirit of [11], we optimally deal with short final blocks; we correctly MAC messages of arbitrary and varying bit lengths. The result is that PMAC makes do with just ⌈|M|/n⌉ block-cipher calls to MAC a non-empty message M using an n-bit block cipher. PMAC is deterministic, freeing the user from having to provide a counter or random value, and making the MAC shorter. Overhead beyond the block-cipher calls has been aggressively optimized, so a serial implementation of PMAC runs just a few percent slower than the CBC MAC.

Besides the efficiency measures already mentioned, PMAC uses very little key-setup: one blockcipher call. (A few shifts and conditional xors are also used.) The PMAC key is a single key for the underlying blocks cipher; in particular, we forgo the need for key-separation techniques. Avoiding multiple block-cipher keys saves time because many block ciphers have significant key-setup costs.

Being so stingy with keys and block-cipher invocations takes significant care; note that even the traditional CBC MAC uses between one and four additional block-cipher calls, as well as additional key material, once it has been enriched to take care of messages of arbitrary lengths [6, 11, 17, 21]. Of course avoiding this overhead doesn’t matter much on long messages, but it is significant on short ones. And in many environments, short messages are common.

We prove PMAC secure, in the sense of reduction-based cryptography. Specifically, we prove that PMAC approximates a random function (and is therefore a good MAC) as long as the underlying block cipher approximates a random permutation. The actual results are quantitative; the security analysis is in the concrete-security paradigm.

PMAC was proposed in response to NIST’s call for contributions for a first modes-of-operation workshop. Earlier versions of this writeup were submitted to NIST and posted to their website (Oct 2000, Apr 2001).

Additional related work. Building on [3], Gligor and Donescu describe a MAC they call the XECB MAC [14]. That MAC is not deterministic, it uses more block-cipher invocations, and it was not designed for messages of arbitrary bit length. But, like PMAC, it goes beyond the XOR MAC by combining a message index and a message block in a way other than encoding the two. In particular, [14] combines i and M[i] by adding to M[i], modulo 2^{n}, a secret multiple i. We combine i and M[i] by different means, to reduce overhead and obtain a better bound.

PMAC was also influenced by the variant of the XOR MAC due to Bernstein [8]. His algorithm is deterministic, and the way that the XOR MAC was made deterministic in [8] is similar to the way that PMAC has been made deterministic. Finally, there is also some similarity in appearance between PMAC and Jutla’s IAPM encryption mode [18].

2 Mathematical Preliminaries

Notation. If i ≥ 1 is an integer then ntz(i) is the number of trailing 0-bits in the binary representation of i. So, for example, ntz(7) = 0 and ntz(8) = 3. If A ∈ {0, 1}^{∗} is a string then |A| denotes its length in bits while ∥A∥_{n} = max{1, ⌈|A|/n⌉} denotes its length in n-bit blocks (where the empty string counts as one block). If A = a_{n−1} ⋯ a_{1}a_{0} ∈ {0, 1}^{n} is a string (each a_{i} ∈ {0, 1}) then str2num(A) is the number ∑_{i=0}^{n−1} 2^{i}a_{i}. If A, B ∈ {0, 1}^{∗} are equal-length strings than A ⊕ B is their bitwise xor. If A ∈ {0, 1}^{∗} and |A| < n then pad_{n}(A) is the string A 10^{n−|A|−1}. If A ∈ {0, 1}^{n} then pad_{n}(A) = A. With n understood we write pad(A) for pad_{n}(A). If A = a_{n−1}a_{n−2} ⋯ a_{1}a_{0} ∈ {0, 1}^{n} then A<<1 = a_{n−2}a_{n−3} ⋯ a_{1}a_{0}0 is the n-bit string which is the left shift of A by 1 bit while A>>1 = 0a_{n−1}a_{n−2} … a_{2}a_{1} is the n-bit string which is the right shift of A by one bit. In pseudocode we write “Partition M into M[1] ⋯ M[m]” as shorthand for “Let m = ∥M∥_{n} and let M[1], …, M[m] be strings such that M[1] ⋯ M[m] = M and |M[i]| = n for 1 ≤ i < m.”

The field with 2^{n} points. The field with 2^{n} points is denoted GF(2^{n}). We interchangeably think of a point a in GF(2^{n}) in any of the following ways: (1) as an abstract point in the field; (2) as an n-bit string a_{n−1} … a_{1}a_{0} ∈ {0, 1}^{n}; (3) as a formal polynomial a(x) = a_{n−1}x^{n−1} + ⋯ + a_{1}x + a_{0} with binary coefficients; (4) as a nonnegative integer between 0 and 2^{n} − 1, where a ∈ {0, 1}^{n} corresponds to str2num(a). We write a(x) instead of a if we wish to emphasize that we are thinking of a as a polynomial. To add two points in GF(2^{n}), take their bitwise xor. We denote this operation by a ⊕ b. To multiply two points, fix some irreducible polynomial p(x) having binary coefficients and degree n. To be concrete, choose the lexicographically first polynomial among the irreducible degree n polynomials having a minimum number of coefficients. To multiply points a, b ∈ GF(2^{n}), which we denote a · b, regard a and b as polynomials a(x) = a_{n−1}x^{n−1} + ⋯ + a_{1}x + a_{0} and b(x) = b_{n−1}x^{n−1}+⋯+b_{1}x+b_{0}, form their product c(x) where one adds and multiplies coefficients in GF(2), and take the remainder when dividing c(x) by p(x). Note that it is particularly easy to multiply a point a ∈ {0, 1}^{n} by x. We illustrate the method for n = 128, where p(x) = x^{128} + x^{7} + x^{2} + x + 1. Then multiplying a = a_{n−1} ⋯ a_{1}a_{0} by x yields

a · x = \{ \begin{matrix}a<<1 & if firstbit(a) = 0 \\ (a<<1) ⊕ 0^{120}10000111 & if firstbit(a) = 1 \end{matrix}  (1)

It is similarly easy to divide a by x (meaning to multiply a by the multiplicative inverse of x). To illustrate, assume that n = 128. Then

a · x^{−1} = \{ \begin{matrix}a>>1 & if lastbit(a) = 0 \\ (a>>1) ⊕ 10^{120}1000011 & if lastbit(a) = 1 \end{matrix}  (2)

If L ∈ {0, 1}^{n} and i ≥ −1, we write L(i) to mean L · x^{i}. To compute L(−1), L(0), …, L(μ), where μ is small, set L(0) = L and then, for i ∈ [1..μ], use Equation (1) to compute L(i) = L(i−1)·x from L(i − 1); and use Equation (2) to compute L(−1) from L.

We point out that huge = x^{−1} will be an enormous number (when viewed as a number); in particular, huge starts with a 1 bit, so huge > 2^{n−1}. In the security proof this fact is relevant, so there we use huge as a synonym for x^{−1} when this seems to add to clarity.

Gray codes. For any ℓ ≥ 1, a Gray code is an ordering γ^{ℓ} = γ_{0}^{ℓ} γ_{1}^{ℓ} … γ_{2^{ℓ}−1}^{ℓ} of {0, 1}^{ℓ} such that successive points differ (in the Hamming sense) by just one bit. For n a fixed number, PMAC makes use of the “canonical” Gray code γ = γ^{n} constructed by γ^{1} = 0 1 while, for ℓ > 0,

γ^{ℓ+1} = 0γ_{0}^{ℓ} 0γ_{1}^{ℓ} ⋯ 0γ_{2^{ℓ}−2}^{ℓ} 0γ_{2^{ℓ}−1}^{ℓ} 1γ_{2^{ℓ}−1}^{ℓ} 1γ_{2^{ℓ}−2}^{ℓ} ⋯ 1γ_{1}^{ℓ} 1γ_{0}^{ℓ}.

It is easy to see that γ is a Gray code. What is more, for 1 ≤ i ≤ 2^{n}−1, γ_{i} = γ_{i−1}⊕(0^{n−1}1<<ntz(i)). This makes it easy to compute successive points. Note that γ_{1}, γ_{2}, …, γ_{2^{n}−1} are distinct, different from 0, and γ_{i} ≤ 2i.

Let L ∈ {0, 1}^{n} and consider the problem of successively forming the strings γ_{1} · L, γ_{2} · L, γ_{3} · L, …, γ_{m} · L. Of course γ_{1} · L = 1 · L = L. Now, for i ≥ 2, assume one has already produced γ_{i−1} · L. Since γ_{i} = γ_{i−1} ⊕ (0^{n−1}1<<ntz(i)) we know that γ_{i} · L = (γ_{i−1} ⊕ (0^{n−1}1<<ntz(i))) · L = (γ_{i−1} · L) ⊕ (0^{n−1}1<<ntz(i)) · L = (γ_{i−1} · L) ⊕ (L · x^{ntz(i)}) = (γ_{i−1} · L) ⊕ L(ntz(i)). That is, the ith word in the sequence γ_{1} · L, γ_{2} · L, γ_{3} · L, … is obtained by xoring the previous word with L(ntz(i)).

3 Definition of PMAC

PMAC depends on two parameters: a block cipher and a tag length. The block cipher is a function E: K × {0, 1}^{n} → {0, 1}^{n}, for some number n, where each E(K, ·) = E_{K}(·) is a permutation on {0, 1}^{n}. Here K is the set of possible keys and n is the block length. The tag length is an integer τ ∈ [1..n]. By trivial means the adversary will be able to forge a valid ciphertext with probability 2^{−τ}. With E: K × {0, 1}^{n} → {0, 1}^{n} and τ ∈ [1..n], we let PMAC[E, τ] denote PMAC using block cipher E and tag length τ. We simplify to PMAC-E when τ is irrelevant. PMAC[E, τ] is a function taking a key K ∈ K and a message M ∈ {0, 1}^{∗} and returning a string in {0, 1}^{τ}. The function is defined in Figure 1 and illustrated in Figure 2. We comment that line 2 of Figure 1 is simply to ensure that PMAC is well-defined even for the highly unrealistic case that |M| > n2^{n} (by which time our security result becomes vacuous anyway). Alternatively, one may consider PMAC’s message space to be strings of length at most n2^{n} rather than strings of arbitrary length.

Algorithm PMAC_{K} (M)

1. L ← E_{K}(0^{n})

2. if |M| > n2^{n} then return 0^{τ}

3. Partition M into M[1] ⋯ M[m]

4. for i ← 1 to m − 1 do

5. X[i] ← M[i] ⊕ γ_{i} · L

6. Y [i] ← E_{K}(X[i])

7. Σ ← Y [1] ⊕ Y [2] ⊕ ⋯ ⊕ Y [m − 1] ⊕ pad(M[m])

8. if |M[m]| = n then X[m] = Σ ⊕ L · x^{−1}

9. else X[m] ← Σ

10. Tag = E_{K}(X[m]) [first τ bits]

11. return Tag

Figure 1: Definition of PMAC. The message to MAC is M and the key is K. The algorithm depends on a block cipher E: K × {0, 1}^{n} → {0, 1}^{n} and a number τ ∈ [1..n]. Constants γ_{1}, γ_{2}, …, the meaning of the multiplication operator, and the meaning of pad() are all defined in the text.

The following alternative description of PMAC may help to clarify what a typical implementation might choose to do. Key generation: Choose a random key K ←^{R} K for the block cipher. The key K is provided to both the party that generates MACs and the party that verifies them. Key setup: Both the party that generates the MACs and the party that verifies the MACs do any key setup useful for applying the block-cipher in its forward direction. Let L ← E_{K}(0^{n}). Let m^{∗} bound the maximum number of n-bit blocks for any message which will be MACed. Let μ ← ⌈log_{2} m^{∗}⌉. Let L(0) ← L. For i ∈ [1..μ], compute L(i) ← L(i − 1) · x by Equation (1), using a shift and a conditional xor. Compute L(−1) ← L · x^{−1} by Equation (2), using a shift and a conditional xor. Save the values L(−1), L(0), L(1), L(2), …, L(μ) in a table. (Alternatively, defer computing some or all of these L(i) values until the value is actually needed.) MAC generation: Let m ← ⌈|M|/n⌉. If m = 0 then let m ← 1. Let M[1], …, M[m] be strings such that M[1] ⋯ M[m] = M and |M[i]| = n for i ∈ [1..m − 1]. Let Offset ← 0^{n}. Let Σ ← 0^{n}. For i ← 1 to m − 1, do the following: let Offset ← Offset ⊕ L(ntz(i)); let Y [i] ← E_{K}(M[i] ⊕ Offset); let Σ ← Σ ⊕ Y [i]. Let Σ ← Σ ⊕pad(M[m]). If |M[m]| < n then let Y [m] ← E_{K}(Σ) else let Y [m] ← E_{K}(Σ ⊕L(−1)). Let Tag be the first τ bits of Y [m]. Return Tag as the computed MAC. MAC verification: Given (M, Tag′), do the following: Generate the MAC Tag for the message M using the MAC generation procedure just described. If Tag = Tag′ then regard the message M as authentic. If Tag ≠ Tag′ then regard the message M as inauthentic.

4 Comments

As we shall soon prove, PMAC is more than a good MAC: it is good as a pseudorandom function (PRF) having variable-input-length and fixed-output-length. As long as the underlying block cipher E is secure, no reasonable adversary will be able to distinguish PMAC_{K}(·), for a random and hidden key K, from a random function ρ from {0, 1}^{∗} to {0, 1}^{τ}. It is a well-known observation, dating to the introduction of PRFs [15], that a good PRF is necessarily a good MAC.

Conceptually, the key is (K, L). But instead of regarding this as the key (and possibly defining K and L from an underlying key), the value L is defined from K and then K is still used as a key. Normally such “lazy key-derivation” would get one into trouble, in proofs if nothing else. For PMAC we prove that this form of lazy key-derivation works fine.

[figure: τ; M[m]; E_{K}; γ_{2} · L; M[2]; E_{K}; γ_{m−1} · L; pad; E_{K}; E_{K}; γ_{1} · L; M[1]; first τ bits; Y [1]; X[1]; Y [2]; X[2]; M[m − 1]; X[m − 1]; Y [m − 1]; Tag; Σ; \begin{matrix}0^{n} & if |M[m]| < n \\ L · x^{−1} & if |M[m]| = n \end{matrix} \}]

Figure 2: Illustration of PMAC. Message M is written as M = M[1] ⋯ M[m], where m = max{1, ⌈|M|/n⌉} and |M[1]| = |M[2]| = ⋯ = |M[m − 1]| = n. Value L = E_{K}(0^{n}) is derived from K. The meaning of the γ_{i} · L values is described in the text.

Any string M ∈ {0, 1}^{∗} can be MACed, and messages which are not a multiple of the block length are handled without the need for obligatory padding, which would increase the number of block-cipher calls.

MAC generation is “on line,” meaning that one does not need to know the length of the message M in advance. Instead, the message can be MACed as one goes along, continuing until there is an indication that the message is now complete. The work of Petrank and Rackoff brought out the importance of this property [21].

In contrast to a scheme based on mod p arithmetic (for a prime p) or mod 2^{n} arithmetic, there is almost no endian-favoritism implicit in the definition of PMAC. (The exception is that the left shift used for forming L(i + 1) from L(i) is more convenient under a big-endian convention, as is the right shift used for forming L(−1) = L · x^{−1} from L.)

If τ = n (or one retains a constant amount of extra information) PMAC is incremental in the sense of [15] with respect to operations append(M, x) = M ∥ x, truncate(M, Δ) = M [first |M| − Δ bits], for |M| ≥ Δ, and replace(M, i, x) = M [first i − 1 bits] ∥ x ∥ M[last |M| − i − |x| + 1 bits], where |M| ≥ i + |x| − 1). For each operation it is easy to see how to update the MAC of M in time proportional to |x|, Δ, or |x|, respectively.

PMAC is parsimonious, as defined in [5]. Partition M into M[1] ⋯ M[m] and assume |M| ≥ n and τ = n. For i ∈ [1..m] such that |M[i]| = n, there is a simple algorithm to recover M[i] from K, M′ = M[1] ⋯ M[i − 1] M[i + 1] ⋯ M[m], and Tag = PMAC_{K}(M). As shown in [5], a parsimonious PRF can be combined with a parsimonious encryption scheme (eg., CTR mode) to yield a length-preserving pseudorandom permutation (a “variable-input-length block cipher”) that acts on messages of any number of bits greater than or equal to n.

5 Theorems

Security definitions. We first recall the needed definitions. A block cipher is a function E: K × {0, 1}^{n} → {0, 1}^{n} where K is a finite set and each E_{K}(·) = E(K, ·) is a permutation on {0, 1}^{n}. Let Perm(n) denote the set of all permutations on {0, 1}^{n}. This set can be regarded as a block cipher by imagining that each permutation is named by a unique element of K. Let A be an adversary (a probabilistic algorithm) with access to an oracle, and suppose that A always outputs a bit. Define

Adv_{E}^{prp}(A) = Pr[K ←^{R} K: A^{E_{K}(·)} = 1] − Pr[π ←^{R} Perm(n) : A^{π(·)} = 1]

The above is the probability that adversary A outputs 1 when given an oracle for E_{K}(·), minus the probability that A outputs 1 when given an oracle for π(·), where K is selected at random from K and π is selected at random from Perm(n). Similarly, a function family from n-bits to n-bits is a map F: K × {0, 1}^{n} → {0, 1}^{n} where K is a finite set. We write F_{K}(·) for F (K, ·). Let Rand(n) denote the set of all functions from {0, 1}^{n} to {0, 1}^{n}. This set can be regarded as a function family as above. Define

Adv_{F}^{prf}(A) = Pr[K ←^{R} K: A^{F_{K}(·)} = 1] − Pr[ρ ←^{R} Rand(n) : A^{ρ(·)} = 1]

Finally, a function family from {0, 1}^{∗} to {0, 1}^{τ} is a map f: K × {0, 1}^{∗} → {0, 1}^{τ} where K is a set with an associated distribution. We write f_{K}(·) for f(K, ·). Let Rand(∗, τ) denote the set of all functions from {0, 1}^{∗} to {0, 1}^{τ}. This set is given a probability measure by asserting that a random element ρ of Rand(∗, τ) associates to each string x ∈ {0, 1}^{∗} a random string ρ(x) ∈ {0, 1}^{τ}. Define

Adv_{f}^{prf}(A) = Pr[K ←^{R} K: A^{f_{K}(·)} = 1] − Pr[g ←^{R} Rand(∗, τ) : A^{g(·)} = 1]

Main result. We now give an information-theoretic bound on the security of our construction.

Theorem 1 [Security of PMAC] Fix n, τ ≥ 1. Let A be an adversary with an oracle. Suppose that A asks its oracle q queries, these having aggregate length of σ blocks. Let σ̄ = σ + 1. Then

Adv_{PMAC[Perm(n),τ]}^{prf} (A) ≤ \frac{σ̄^{2}}{2^{n−1}}

In the theorem statement and from now on, the aggregate length of messages M_{1}, …, M_{q} asked by A is the number σ = ∑_{r=1}^{q} ∥M_{r}∥_{n}.

From the theorem above it is standard to pass to a complexity-theoretic analog. Fix parameters n, τ ≥ 1 and block cipher E: K × {0, 1}^{n} → {0, 1}^{n}. Let A be an adversary with an oracle and suppose that A asks queries having aggregate length of σ blocks. Let σ̄ = σ + 1. Then there is an adversary B for attacking E that achieves advantage Adv_{E}^{prp}(B) ≥ Adv_{PMAC[E,τ]}^{prf}(A) − σ̄^{2}/2^{n−1}. Adversary B asks at most σ̄ oracle queries and has a running time equal to A’s running time plus the time to compute E on σ̄ points, plus additional time of cnσ̄ for a constant c that depends only on details of the model of computation.

10 L ←^{R} {0, 1}^{n}

11 for i ← 1 to m − 1 do { X[i] ← M[i] ⊕ γ_{i} · L; Y [i] ←^{R} {0, 1}^{n} }

12 Σ ← Y [1] ⊕ ⋯ ⊕ Y [m − 1] ⊕ pad(M[m])

13 if |M[m]| = n then X[m] ← Σ ⊕ huge · L else X[m] ← Σ 14 X ← {X[1], …, X[m]} 15 if there is a repetition in {0^{n}} ∪ X then Mcoll ← true

16 Equal ← {i ∈ [1.. min{m, m̄} − 1] : M[i] = M̄[i]}

17 Unequal ← [1..m̄] \ Equal 18 for i ← 1 to m̄ − 1 do 19 if i ∈ Equal then { X̄[i] ← X[i]; Ȳ [i] ← Y [i] } 20 if i ∈ Unequal then { X̄[i] ← M̄[i] ⊕ γ_{i} · L; Ȳ [i] ←^{R} {0, 1}^{n} } 21 Σ̄ ← Ȳ [1] ⊕ ⋯ ⊕ Ȳ [m̄ − 1] ⊕ pad(M̄[m̄]) 22 if |M̄[m̄]| = n then X̄[m̄] ← Σ̄ ⊕ huge · L else X̄[m̄] ← Σ̄ 23 X̄ ← {X̄[i] : i ∈ Unequal} 24 if X ∩ X̄ ≠ ∅ then MMcoll ← true

Figure 3: Defining the collision probabilities. Functions Mcoll_{n}(·) and MMcoll_{n}(·, ·) are defined using this game. In lines 14 and 23, X and X̄ are understood to be multisets. The union in line 15 is a multiset union. Recall that huge is a synonym for x^{−1}.

It is a standard result that being secure in the sense of a PRF implies an inability to forge with good probability. See [4, 15].

Structure of the proof. The proof combines two lemmas. The first, the structure lemma, measures the pseudorandomness of PMAC using two functions: the M-collision probability, denoted Mcoll_{n}(·), and the MM-collision probability, denoted MMcoll_{n}(·, ·). The second lemma, the collision-bounding lemma, upperbounds Mcoll_{n}(m) and MMcoll_{n}(m, m̄).

We begin by defining Mcoll_{n}(·) and MMcoll_{n}(·, ·). Fix n and choose M and M̄, partitioning them into M[1] ⋯ M[m] and M̄[1] ⋯ M̄[m̄]. Consider the experiment of Figure 3. When M is a string, let Mcoll_{n}(M) denote the probability that Mcoll gets set to true in line 15 when the program of Figure 3 is run on M. When m is a number, Mcoll_{n}(m) is the maximum value of Mcoll_{n}(M) over all strings M such that ∥M∥_{n} = m. Similarly, when M and M̄ are strings, let MMcoll_{n}(M, M̄) denote the probability that MMcoll gets set to true when the program of Figure 3 is run on strings M, M̄. When m and m̄ are numbers, let MMcoll_{n}(m, m̄) denote the maximum value of MMcoll_{n}(M, M̄) over all strings M, M̄ such that ∥M∥_{n} = m and ∥M̄∥_{n} = m̄. We can now state the structure lemma.

Lemma 1 [Structure lemma] Fix n, τ ≥ 1. Let A be an adversary that asks q queries, these having an aggregate length of σ blocks. Then

Adv_{PMAC[Perm(n),τ]}^{prf}(A) ≤

max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥1} \{ ∑_{1≤r≤q} Mcoll_{n}(m_{r}) + ∑_{1≤r<s≤q} MMcoll_{n}(m_{r}, m_{s})\} + \frac{(σ + 1)^{2}}{2^{n+1}}

The proof of this lemma is in Appendix A.

Explanation. Informally, Mcoll_{n}(m) measures the probability of running into trouble when the adversary asks a single question M having block length m. Trouble means a collision among the values X[0], X[1], …, X[m], where X[0] = 0^{n} and each X[i] is the block-cipher input associated to message block i. Informally, MMcoll_{n}(m, m̄) measures the probability of running into trouble across two messages, M and M̄, having lengths m and m̄. This time trouble means a “non-trivial” collision. That is, consider the m+m̄+1 points at which the block cipher is applied in processing M and M̄. There are m points X[1], …, X[m], another m̄ points X̄[1], …, X̄[m̄], and then there is the point 0^{n} (the block cipher was applied at this point to define L). Some pairs of these m + m̄ + 1 points could coincide for a “trivial” reason: namely, we know that X[i] = X̄[i] if i < m and i < m̄ and M[i] = M̄[i]. We say that there is a nontrivial collision between M and M̄ if some other X[i] and X̄[j] happened to coincide. Note that M-collisions include collisions with 0^{n}, while MMcollisions do not. Also, MM-collisions do not include collisions within a single message (or collisions with 0^{n}) because both of these possibilities are taken care of by way of M-collisions.

The structure lemma provides a simple recipe for measuring the maximum advantage of any adversary that attacks the pseudorandomness of PMAC: bound the collision probabilities Mcoll_{n}(·) and MMcoll_{n}(·, ·) and then use the formula. The lemma simplifies the analysis of PMAC in two ways. First, it allows one to excise adaptivity as a concern. Dealing with adaptivity is a major complicating factor in proofs of this type. Second, it allows one to concentrate on what happens to single messages and to a fixed pair of messages. It is easier to think about what happens with one or two messages than what is happening with all q of them.

Bounding the collision probabilities. The following lemma indicates that the two types of collisions we have defined rarely occur. The proof shall be given shortly.

Lemma 2 [Collision-bounding lemma] Let Mcoll_{n}(·) and MMcoll_{n}(·, ·) denote the M-collision probability and the MM-collision probability. Then

Mcoll_{n}(m) ≤ \binom{m + 1}{2} · \frac{1}{2^{n}}  and  MMcoll_{n}(m, m̄) ≤ \frac{mm̄}{2^{n}}

Concluding the theorem. Pseudorandomness of PMAC, Theorem 1, follows by combining Lemmas 1 and 2. Namely,

Adv

prf

PMAC[Perm(n),τ]

≤ max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥1} \{ ∑_{1≤r≤q} Mcoll_{n}(m_{r}) + ∑_{1≤r<s≤q} MMcoll_{n}(m_{r}, m_{s})\} + \frac{(σ + 1)^{2}}{2^{n+1}}

≤ max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥1} { ∑_{1≤r≤q} Mcoll_{n}(m_{r})}

+ max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥0} \{ ∑_{1≤r<s≤q} MMcoll_{n}(m_{r}, m_{s})\} + \frac{(σ + 1)^{2}}{2^{n+1}}

≤ max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥0} \{ ∑_{1≤r≤q} \binom{m_{r} + 1}{2} · \frac{1}{2^{n}} \}

+ max_{m_{1},...,mq ; σ=∑ m_{i} ; m_{i}≥0} \{ ∑_{1≤r<s≤q} \frac{m_{r}m_{s}}{2^{n}} \} + \frac{(σ + 1)^{2}}{2^{n+1}}

≤ \frac{(σ + 1)^{2}}{2^{n}} + \frac{(σ^{2}/2)}{2^{n}} + \frac{(σ + 1)^{2}}{2^{n+1}}  (3)
≤ \frac{2 (σ + 1)^{2}}{2^{n}}

where (3) follows because the first sum is maximized with a single message of length σ, while the second sum is maximized by q messages of length σ/q. (These claims can be justified using the method of Lagrange multipliers.) This completes the proof of Theorem 1.

Proof of Lemma 2. We now bound Mcoll_{n}(m) and MMcoll_{n}(m, m̄). To begin, let Unequal′ = Unequal \ {X̄[m̄]} (multiset difference: remove one copy of X̄[m̄]) and define

D_{1} = {0^{n}}  D_{2} = {X[1], …, X[m − 1]}  D_{3} = {X[m]}
D_{4} = {X̄[j] : j ∈ Unequal′} D_{5} = {X̄[m̄]}

We first show that for any two points X[i] and X[j] in the multiset D_{1} ∪ D_{2} ∪ D_{3}, where i < j and X[0] = 0^{n}, the probability that these two points collide is at most 2^{−n}. The inequality

Mcoll_{n}(m) ≤ \binom{m + 1}{2} · \frac{1}{2^{n}}

follows because there are m + 1 points in D_{1} ∪ D_{2} ∪ D_{3}. Afterwards, we show that for any point X[i] in D_{2} ∪ D_{3} and any point in X̄[j] in D_{4} ∪ D_{5}, the probability that they collide is at most 2^{−n}. The inequality

MMcoll_{n}(m, m̄) ≤ \frac{mm̄}{2^{n}}

follows because |D_{2} ∪ D_{3}| · |D_{4} ∪ D_{5}| ≤ mm̄.

To show Mcoll_{n}(m) ≤ \binom{m+1}{2} · \frac{1}{2^{n}} consider the following four cases:

Case (D_{1}, D_{2}): Pr[0^{n} = X[i]] = Pr[M[i] ⊕ γ_{i} · L = 0^{n}] = Pr[L = γ_{i}^{−1} · M[i]] = 2^{−n}. We have used that γ_{i} is nonzero and we are working in a field. (We will continue to use this without mention.)

Case (D_{1}, D_{3}): If |M[m]| < n and m ≥ 2 then Σ is a random n-bit string and so Pr[0^{n} = X[m]] = Pr[0^{n} = Σ] = Pr[0^{n} = Y [1] ⊕ ⋯ Y [m − 1] ⊕ pad(M[m])] = 2^{−n}. If |M[m]| = n and m ≥ 2 then Σ is a random n-bit string that is independent of L and so Pr[0^{n} = X[m]] = Pr[0^{n} = Σ⊕huge·L] = 2^{−n}. If |M[m]| < n and m = 1 then Pr[0^{n} = X[1]] = Pr[0^{n} = pad(M[m])] = 0. If |M[m]| = n and m = 1 then Pr[0^{n} = X[1]] = Pr[0^{n} = pad(M[m]) ⊕ huge · L] = 2^{−n}.

Case (D_{2}, D_{2}): For i, j ∈ [1..m − 1], i < j, Pr[X[i] = X[j]] = Pr[M[i] ⊕ γ_{i} · L = M[j] ⊕ γ_{j} · L] = Pr[M[i] ⊕ M[j] = (γ_{i} ⊕ γ_{j}) · L] = 2^{−n} because γ_{i} ≠ γ_{j} for i ≠ j. (Here one assumes that j < 2^{n} because the lemma gives a non-result anyway if j were larger.)

Case (D_{2}, D_{3}): Assume that m ≥ 2, for otherwise there is nothing to show. Suppose first that |M[m]| < n. Then Pr[X[i] = X[m]] = Pr[M[i] ⊕ γ_{i} · L = Σ]. The value Σ is uniformly random and independent of L, so this probability is 2^{−n}. Suppose next that |M[m]| = n. Then Pr[X[i] = X[m]] = Pr[M[i] ⊕ γ_{i} · L = Σ ⊕ huge · L] = Pr[M[i] ⊕ Σ = (γ_{i} ⊕ huge) · L]. This value is

Algorithm  16 B 128 B 2 KB
PMAC-AES128  22.1  18.7 18.4
CBCMAC-AES128  18.9  17.4 17.1

Figure 4: Performance results. Numbers are in cycles per byte (cpb) on a Pentium 3, for three message lengths, the code written in assembly.

2^{−n} since γ_{i} ≠ huge. Here we are assuming that i < 2^{n−1}, which is without loss of generality since a larger value of i, and therefore m, would give a non-result in the theorem statement.

Moving on, to show that MMcoll_{n}(m, m̄) ≤ \frac{mm̄}{2^{n}} we verify the following four cases:

Case (D_{2}, D_{4}): Let i ∈ [1..m−1] and j ∈ Unequal′ and consider Pr[X[i] = X̄[j]] = Pr[M[i]⊕γ_{i}·L = M̄[j] ⊕ γ_{j} · L] = Pr[M[i] ⊕ M̄[j] = (γ_{i} ⊕ γ_{j}) · L. If i ≠ j then γ_{i} ≠ γ_{j} and this probability is 2^{−n}. If i = j then the probability is 0 since, necessarily, M[i] ≠ M̄[j].

Case (D_{2}, D_{5}): Suppose that |M̄[m̄]| < n. Then Pr[X[i] = X̄[m̄]] = Pr[M[i] ⊕ γ_{i} · L = Σ̄] = 2^{−n} because Σ̄ is independent of L. Suppose that |M̄[m̄]| = n. Then Pr[X[i] = X̄[m̄]] = Pr[M[i] ⊕ γ_{i} · L = Σ̄ ⊕ huge · L] = Pr[M[i] ⊕ Σ̄ = (γ_{i} ⊕ huge) · L] = 2^{−n} because Σ̄ is independent of L and γ_{i} ≠ huge.

Case (D_{3}, D_{4}): Suppose that |M[m]| < n. Then Pr[X[m] = X̄[j]] = Pr[Σ = M̄[j] ⊕ γ_{j} · L] = 2^{−n} because Σ is independent of L. Suppose that |M[m]| = n. Then Pr[X[m] = X̄[j]] = Pr[Σ ⊕ huge · L = M̄[j] ⊕ γ_{j} · L] = Pr[Σ ⊕ M̄[j] = (γ_{j} ⊕ huge) · L] = 2^{−n} because γ_{j} ≠ huge.

Case (D_{3}, D_{5}): Suppose that |M[m]| < n and |M̄[m̄]| < n. If m > m̄ then Pr[X[m] = X̄[m̄]] = Pr[Σ = Σ̄] = 2^{−n} because of the contribution of Y [m − 1] in Σ—a random variable that is not used in the definition of Σ̄. If m < m̄ then Pr[X[m] = X̄[m̄]] = Pr[Σ = Σ̄] = 2^{−n} because of the contribution of Ȳ [m̄ − 1] in Σ̄—a random variable that is not used in the definition of Σ. If m = m̄ and there is an i < m such that M[i] ≠ M̄[i] then Pr[X[m] = X̄[m̄]] = Pr[Σ = Σ̄] = 2^{−n} because of the contribution of Ȳ [i] in Σ̄—a random variable that is not used in the definition of Σ. If m = m̄ and for every i < m we have that M[i] = M̄[i], then, necessarily, M[m] ≠ M̄[m]. In this case Pr[Σ = Σ̄] = 0, as the two checksums differ by the nonzero value pad(M[m]) ⊕ pad(M̄[m]).

Suppose that |M[m]| = n and |M̄[m̄]| = n. Then X[m] and X̄[m] are offset by the same amount, huge · L, so this offset is irrelevant in computing Pr[X[m] = X̄[m̄]. Proceed as above.

Suppose that |M[m]| < n and |M̄[m̄]| = n. Then Pr[X[m] = X̄[m]] = Pr[Σ = Σ̄ ⊕ huge · L] = 2^{−n} since Σ and Σ̄ are independent of L. Similarly, if |M[m]| = n and |M̄[m̄]| < n, then Pr[X[m] = X̄[m]] = 2^{−n}. This completes the proof.

6 Performance

A colleague, Ted Krovetz, implemented PMAC-AES128 and compared its performance in an entirely sequential setting to that of CBCMAC-AES128. The latter refers to the “basic” CBC MAC; nothing is done to take care of length-variability or the possibility of strings which are not a multiple of the block length. The code was written in modestly-optimized assembly under Windows 2000 sp1 and Visual C++ 6.0 sp4. All data fit into L1 cache. Disregarding the one-block message in Figure 4 we see that, in a serial environment, PMAC-AES128 was about 8% slower than CBCMAC-AES128. A more aggressively optimized implementation of CBCMAC-AES128, due to Helger Lipmaa, achieves 15.5 cpb for 1 KByte message lengths [20]. Adding the same 8%, we expect that this code could be modified to compute PMAC at a rate of about 16.7 cpb. In general, differences in implementation quality would seem to be a more significant in determining implementation speed than the algorithmic difference between PMAC and the CBC MAC.

Though some or all of the L(i)-values are likely to be pre-computed, calculating all of these values “on the fly” is not expensive. Starting with 0^{n} we form successive offsets by xoring the previous offset with L, 2 · L, L, 4 · L, L, 2 · L, L, 8 · L, and so forth, making the expected number of a · x-operations to compute an offset at most ∑_{i=1}^{∞} i/2^{i+1} = 1. For n = 128, each a · x instruction requires a 128-bit shift and a conditional 32-bit xor.

Acknowledgments

We would like to thank several people for helpful comments on drafts of this manuscript: Michael Amling, Mihir Bellare, Johan Håstad, Ted Krovetz, David McGrew, David Wagner, and the Eurocrypt program committee. Special thanks to Ted, who wrote reference code, prepared test vectors, and collected performance data. Virgil Gligor described [14] to Rogaway at Crypto ’00 and that event, along with the announcement of a NIST modes-of-operation workshop in October 2000, inspired the current work.

This paper was written while Rogaway was on leave from UC Davis, visiting the Department of Computer Science, Faculty of Science, Chiang Mai University.

References

[1] M. Bellare, R. Canetti, and H. Krawczyk. Keying hash functions for message authentication. Advances in Cryptology — CRYPTO ’96. Lecture Notes in Computer Science, vol. 1109, Springer-Verlag, pp. 1–15, 1996. Available at URL www-cse.ucsd.edu/users/mihir

[2] M. Bellare, S. Goldwasser, and O. Goldreich. Incremental cryptography and applications to virus protection. Proceedings of the 27th Annual ACM Symposium on the Theory of Computing (STOC ’95). ACM Press, pp. 45–56, 1995. Available at URL

www.cs.ucdavis.edu/∼rogaway

[3] M. Bellare, R. Guérin and P. Rogaway. “XOR MACs: New methods for message authentication using finite pseudorandom functions.” Advances in Cryptology — CRYPTO ’95. Lecture Notes in Computer Science, vol. 963, Springer-Verlag, pp. 15–28, 1995. Available at

URL www.cs.ucdavis.edu/∼rogaway

[4] M. Bellare, J. Kilian, and P. Rogaway. The security of the cipher block chaining message authentication code. Journal of Computer and System Sciences, vol. 61, no. 3, Dec 2000. (Full version of paper from Advances in Cryptology — CRYPTO ’94. Lecture Notes in Computer Science, vol. 839, pp. 340–358, 1994.) Available at URL www.cs.ucdavis.edu/∼rogaway

[5] M. Bellare and P. Rogaway. Encode-then-encipher encryption: How to exploit nonces or redundancy in plaintexts for efficient encryption. Advances in Cryptology — ASIACRYPT ’00. Lecture Notes in Computer Science, vol. 1976, Springer-Verlag, 2000. Available at URL

www.cs.ucdavis.edu/∼rogaway

[6] A. Berendschot, B. den Boer, J.P. Boly, A. Bosselaers, J. Brandt, D. Chaum, I. Damgård, M. Dichtl, W. Fumy, M. van der Ham, C.J.A. Jansen, P. Landrock, B. Preneel, G. Roelofsen, P. de Rooij, and J. Vandewalle. Integrity primitives for secure information systems, Final report of RACE integrity primitives evaluation (RIPE-RACE 1040). Lecture Notes in Computer Science, vol. 1007, Springer-Verlag, 1995.

[7] D. Bernstein. Floating-point arithmetic and message authentication. Unpublished

manuscript. Available at URL http://cr.yp.to/papers.html#hash127

[8] D. Bernstein. How to stretch random functions: the security of protected counter sums. Journal of Cryptology, vol. 12, no. 3, pp. 185–192 (1999). Available at URL cr.yp.to/djb.html

[9] J. Black, S. Halevi, H. Krawczyk, T. Krovetz, and P. Rogaway. UMAC: Fast and secure message authentication. Advances in Cryptology — CRYPTO ’99. Lecture Notes in Computer Science, Springer-Verlag, 1999. Available at URL www.cs.ucdavis.edu/∼rogaway

[10] J. Black and P. Rogaway. A block-cipher mode of operation for parallelizable message authentication. Full version of this paper. Available at URL www.cs.ucdavis.edu/∼rogaway

[11] J. Black and P. Rogaway. CBC MACs for arbitrary-length messages: The threekey constructions. Full version of paper from Advances in Cryptology — CRYPTO ’00. Lecture Notes in Computer Science, vol. 1880, pp. 197–215, 2000. Available at URL

www.cs.ucdavis.edu/∼rogaway

[12] G. Brassard. On computationally secure authentication tags requiring short secret shared keys. Advances in Cryptology — CRYPTO ’82. Plenum Press, pp. 79–86, 1983.

[13] L. Carter and M. Wegman. Universal hash functions. J. of Computer and System Sciences. vol. 18, pp. 143–154, 1979.

[14] V. Gligor and P. Donescu. Fast encryption and authentication: XCBC encryption and XECB authentication modes. Fast Software Encryption, Lecture Notes in Computer Science, Springer-Verlag, April 2001. Available at URL www.eng.umd.edu/∼gligor

[15] O. Goldreich, S. Goldwasser, and S. Micali. How to construct random functions. Journal of the ACM, vol. 33, no. 4, pp. 210–217, 1986.

[16] S. Halevi and H. Krawczyk. MMH: Software message authentication in the Gbit/second rates. Fast Software Encryption (FSE 4), Lecture Notes in Computer Science, vol. 1267, Springer-Verlag, pp. 172–189, 1997. Available at URL www.research.ibm.com/people/s/shaih

[17] Iso/Iec 9797. Information technology – Security techniques – Data integrity mechanism using a cryptographic check function employing a block cipher algorithm. International Organization for Standards (ISO), Geneva, Switzerland, 1994 (second edition).

[18] C. Jutla. Encryption modes with almost free message integrity. Advances in Cryptology — EUROCRYPT 2001. Lecture Notes in Computer Science, vol. 2045, B. Pfitzmann, ed., Springer-Verlag, 2001.

[19] H. Krawczyk. LFSR-based hashing and authentication. Advances in Cryptology — CRYPTO ’94. Lecture Notes in Computer Science, vol. 839, Springer-Verlag, pp 129–139, 1994.

[20] H. Lipmaa. Personal communication, July 2001. Further information available at

www.tcs.hut.fi/∼helger

[21] E. Petrank and C. Rackoff. CBC MAC for real-time data sources. Journal of Cryptology, vol. 13, no. 3, pp. 315–338, Nov 2000. Available at URL

www.cs.technion.ac.il/∼erez/publications.html. Earlier version as 1997/010 in the Cryptology ePrint archive, eprint.iacr.org

[22] B. Preneel. Cryptographic primitives for information authentication — State of the art. State of the Art in Applied Cryptography, COSIC ’97, LNCS 1528, B. Preneel and V. Rijmen, eds., Springer-Verlag, pp. 49–104, 1998.

Initialization

10 L ←^{R} {0, 1}^{n}; π(0^{n}) ← L

When A makes its r-th query, M_{r} = M_{r}[1] ⋯ M_{r}[m_{r}], where r ∈ [1..q] 20 for i ← 1 to m_{r} − 1 do 21 X_{r}[i] ← M_{r}[i] ⊕ γ_{i} · L 22 if X_{r}[i] ∈ Domain(π) then Y_{r}[i] ← π(X_{r}[i])

23 else Y_{r}[i] ←^{R} {0, 1}^{n}

24 if Y_{r}[i] ∈ Range(π) then \{ bad ← true; Y_{r}[i] ←^{R} \overline{Range}(π) \} 25 π(X_{r}[i]) ← Y_{r}[i] 26 Σ_{r} ← Y_{r}[1] ⊕ Y_{r}[2] ⊕ ⋯ ⊕ Y_{r}[m_{r} − 1] ⊕ pad(M_{r}[m_{r}]) 27 if |M_{r}[m_{r}]| = n then X_{r}[m_{r}] ← Σ_{r} ⊕ huge · L else X_{r}[m_{r}] ← Σ_{r} 28 if X_{r}[m_{r}] ∈ Domain(π) then \{ bad ← true; TAG_{r} ←^{R} \overline{Range}(π) \}

29 else TAG_{r} ←^{R} {0, 1}^{n}

30 if TAG_{r} ∈ Range(π) then \{ bad ← true; TAG_{r} ←^{R} \overline{Range}(π) \} 31 π(X_{r}[m_{r}]) ← TAG_{r} 32 Tag_{r} ← TAG_{r} [first τ bits]

33 return Tag_{r}

Figure 5: Game 1. This game accurately simulates PMAC[Perm(n), τ].

[23] M. Wegman and L. Carter. New hash functions and their use in authentication and set equality. J. of Comp. and System Sciences. vol. 22, pp. 265–279, 1981.

A Proof of the Structure Lemma

Let A be an adversary that attacks PMAC[Perm(n), τ]. Since A is computationally unbounded, there is no loss of generality to assume that A is deterministic. One can imagine A interacting with a PMAC[Perm(n), τ] oracle as A playing a certain game, Game 1, as defined in Figure 5. This game perfectly simulates the behavior of PMAC[Perm(n), τ]. It does so in a somewhat unusual way, sometimes setting a flag bad to true. We observe that if the flag bad is not set to true in an execution of the game, then the value Tag_{r} returned by the game at line 33 is a random one—the first τ bits of the string randomly selected at line 29. It follows that Adv_{PMAC[Perm(n),τ]}(A) is at most the probability that bad gets set to true in Game 1. The rest of the proof is devoted to bounding this probability.

We first consider the probability that bad gets set to true in line 24 or 30. In both cases, we have just chosen a random n-bit string and then we are testing it for membership in a set. The size of this set starts at 1 (after executing line 10) and grows one element at a time until, by the time just before the last addition of a point, it has size σ. Thus we have that

Pr_{1}[bad gets set in lines 24 or 30 ] ≤ \frac{1 + 2 + … + σ}{2^{n}}
≤ \frac{(σ + 1)^{2}}{2^{n+1}}  (4)

Here the subscript of 1 in the probability reminds us that we are considering the behavior of Game 1.

We can now modify Game 1 by changing the behavior when and only when bad is set, and adding as a compensating factor the bound given by Equation (4). In particular, we may simply Initialization

10 L ←^{R} {0, 1}^{n}; π(0^{n}) ← L

When A makes its r-th query, M_{r} = M_{r}[1] ⋯ M_{r}[m_{r}], where r ∈ [1..q] 20 for i ← 1 to m_{r} − 1 do 21 X_{r}[i] ← M_{r}[i] ⊕ γ_{i} · L 22 if X_{r}[i] ∈ Domain(π) then Y_{r}[i] ← π(X_{r}[i])

23 else { Y_{r}[i] ←^{R} {0, 1}^{n}; π(X_{r}[i]) ← Y_{r}[i] }

24 Σ_{r} ← Y_{r}[1] ⊕ Y_{r}[2] ⊕ ⋯ ⊕ Y_{r}[m_{r} − 1] ⊕ pad(M_{r}[m_{r}])

25 if |M_{r}[m_{r}]| = n then X_{r}[m_{r}] ← Σ_{r} ⊕ huge · L else X_{r}[m_{r}] ← Σ_{r} 26 if X_{r}[m_{r}] ∈ Domain(π) then bad ← true

27 TAG_{r}[m_{r}] ←^{R} {0, 1}^{n}

28 π(X_{r}[m_{r}]) ← TAG_{r}[m_{r}] 29 Tag_{r} ← TAG_{r} [first τ bits]

30 return Tag_{r}

Figure 6: Game 2. A simplification of Game 1. Bounding the probability that bad gets set in this game, and then adding a correction factor, serves to bound Adv_{PMAC[Perm(n),τ]}^{prf}.

omit lines 24 and 30, and the second statement in the compound statement of line 28 along with the following else. The modified game is rewritten in Figure 6. At this point we know that

Adv_{PMAC[Perm(n),τ]}^{prf}(A) ≤ Pr_{2}[bad gets set ] + \frac{(σ + 1)^{2}}{2^{n+1}}  (5)

Here the subscript of 2 in the probability reminds us that we are considering the behavior of Game 2.

Notice in Game 2 that the value Tag_{r} returned in response to a query M is always a random τ-bit string. But of course the game does more than just return these strings: it also chooses L at random, fills in π-values, and sets bad under certain conditions. We can defer doing all those things, and just return the random strings Tag_{1}, …, Tag_{q}. This does not change the view of the adversary that interacts with the game, nor will it change the probability that bad is set to true. The modified game is called Game 3, and it is depicted in Figure 7.

We need to bound the probability that bad gets set to true in Game 3. This probability is over the random TAG_{r}-values selected at line 10, the random value of L selected at line 20, and the random Y_{r}[i]-values selected at line 25. We want to show that, over these random values, bad will rarely be set. In fact, we show something stronger: that even if one arbitrarily fixes the values of TAG_{1}, …, TAG_{q} ∈ {0, 1}^{n} (and takes the probability over just the remaining values), still the probability that bad will be set to true is small. Since the oracle responses have now been fixed, and since the adversary itself is deterministic, the queries M_{1}, …, M_{q} that the adversary will generate have likewise been fixed. Interaction and the adversary itself are essentially gone at this point, replaced by universal quantification. The new game is show in Figure 8. It depends on constants C = (q, TAG_{1}, …, TAG_{q}, M_{1}, …, M_{q}). At this point in the proof we have that

Adv_{PMAC[Perm(n),τ]}^{prf}(A) ≤
max_{C}\{Pr[ bad gets set to true in game 4[C]\} + \frac{(σ + 1)^{2}}{2^{n+1}}  (6)

where, if A is limited to q queries of aggregate length σ, then C specifies q, strings M_{1}, …, M_{q} of aggregate block length σ, and TAG_{1}, …, TAG_{q} ∈ {0, 1}^{n}.

When A makes its r-th query, M_{r} = M_{r}[1] ⋯ M_{r}[m_{r}], where r ∈ [1..q]

10 TAG_{r} ←^{R} {0, 1}^{n}

11 return TAG_{r} [first τ bits]

When A is done making its q queries

20 L ←^{R} {0, 1}^{n}; π(0^{n}) ← L

21 for r ← 1 to q do 22 for i ← 1 to m_{r} − 1 do 23 X_{r}[i] ← M_{r}[i] ⊕ γ_{i} · L 24 if X_{r}[i] ∈ Domain(π) then Y_{r}[i] ← π(X_{r}[i])

25 else { Y_{r}[i] ←^{R} {0, 1}^{n}; π(X_{r}[i]) ← Y_{r}[i] }

26 Σ_{r} ← Y_{r}[1] ⊕ Y_{r}[2] ⊕ ⋯ ⊕ Y_{r}[m_{r} − 1] ⊕ pad(M_{r}[m_{r}]) 27 if |M_{r}[m_{r}]| = n then X_{r}[m_{r}] ← Σ_{r} ⊕ huge · L else X_{r}[m_{r}] ← Σ_{r} 28 if X_{r}[m_{r}] ∈ Domain(π) then bad ← true 29 π(X_{r}[m_{r}]) ← TAG_{r}

Figure 7: Game 3. Like Game 2, but we defer all but the selection of TAG_{r}-values. This does not change the view of the adversary or the chance that bad will be set to true.

10 L ←^{R} {0, 1}^{n}; π(0^{n}) ← L

11 for r ← 1 to q do 12 for i ← 1 to m_{r} − 1 do 13 X_{r}[i] ← M_{r}[i] ⊕ γ_{i} · L 14 if X_{r}[i] ∈ Domain(π) then Y_{r}[i] ← π(X_{r}[i])

15 else { Y_{r}[i] ←^{R} {0, 1}^{n}; π(X_{r}[i]) ← Y_{r}[i] }

16 Σ_{r} ← Y_{r}[1] ⊕ Y_{r}[2] ⊕ ⋯ ⊕ Y_{r}[m_{r} − 1] ⊕ pad(M_{r}[m_{r}]) 17 if |M_{r}[m_{r}]| = n then X_{r}[m_{r}] ← Σ_{r} ⊕ huge · L else X_{r}[m_{r}] ← Σ_{r} 18 if X_{r}[m_{r}] ∈ Domain(π) then bad ← true 19 π(X_{r}[m_{r}]) ← TAG_{r}

Figure 8: Game 4[C]. This game depends on constants C which specify: q, TAG_{1}, …, TAG_{q} ∈ {0, 1}^{n}, and M_{1} = M_{1}[1] ⋯ M_{1}[m_{1}], …, M_{q} = M_{q}[1] ⋯ M_{q}[m_{q}].

10 L ←^{R} {0, 1}^{n}; π(0^{n}) ← L

11 for r ← 1 to q do 12 for i ← 1 to m_{r} − 1 do

13 X_{r}[i] ← M_{r}[i] ⊕ γ_{i} · L; Y_{r}[i] ←^{R} {0, 1}^{n}

14 if M_{r}[i] = M_{s}[i] for some s < r and i < m_{s} then Y_{r}[i] ← π(X_{s}[i]) 15 else if X_{r}[i] ∈ Domain(π) then bad ← true 16 π(X_{r}[i]) ← Y_{r}[i] 17 Σ_{r} ← Y_{r}[1] ⊕ Y_{r}[2] ⊕ ⋯ ⊕ Y_{r}[m_{r} − 1] ⊕ pad(M_{r}[m_{r}]) 18 if |M_{r}[m_{r}]| = n then X_{r}[m_{r}] ← Σ_{r} ⊕ huge · L else X_{r}[m_{r}] ← Σ_{r} 19 if X_{r}[m_{r}] ∈ Domain(π) then bad ← true 20 π(X_{r}[m_{r}]) ← 0^{n}

Figure 9: Game 5[C]. This game sets bad at least as often as Game 4[C] does. It is this game that is related back to the one that defines the collision probabilities Mcoll_{n} and MMcoll_{n}.

The next step is to modify Game 4 so that the new game, Game 5, sets bad every time that Game 4 does, plus some additional times. Look at line 14 in Game 4. The value X_{r}[i] could have been in the domain of π for the “trivial” reason that M_{r}[i] = M_{s}[i] for some s < r and where i < m_{s}, or for some other, “non-trivial” reason: X_{r}[i] = 0^{n}, or X_{r}[i] = X_{s}[j] for some s < r and j ≠ i, or X_{r}[i] = X_{r}[j] for some j < i. If X_{r}[i] was in the domain of π for a non-trivial reason, we effectively give up, setting bad to true. Thus in Game 5, line 15, we set bad if X_{r}[i] is already in the domain of π and it is not due to the trivial cause (which is tested for in line 14). We also modify the last line, setting X_{r}[m_{r}] to some particular value, say 0^{n}, instead of to TAG_{r}. The only significance of this assignment was to make π defined at the point X_{r}[m_{r}]; the particular value associated to this point is not used unless bad has already been set to true.

The coins used in Game 5 are L and Y_{1} = Y_{1}[1] ⋯ Y_{1}[m_{1}], …, Y_{q} = Y_{q}[1] ⋯ Y_{q}[m_{q}], where Y_{s}[i] are either random coins or are a synonym Y_{u}[i] where u is the least number such that u < s and i < m_{u} and M_{s}[i] = M_{u}[i] (whenever such a u exists). Run Game 5 on M_{1}, …, M_{q} and the indicated vector of coins. Suppose that bad gets set to true on this execution. Let s ∈ [1..q] be the particular value of r when bad first got set to true. We differentiate the following possibilities:

Case 1. When bad was first set to true, this happened because X_{s}[i] = 0^{n} for some s, or this happened because X_{s}[i] = X_{s}[j] for some j ∈ [1..i − 1]. Case 2. When bad got set to true this happened because X_{s}[i] = X_{u}[j] for some u ∈ [1..s − 1] (and if i ≠ j then M_{s}[i] ≠ M_{u}[j]). In the first case, if we had run game 5 using coins L and Y_{s}, dropping line 14 and restricting

the execution of line 12 to r = s, then bad still would have been set to true. This exactly coincides with the game that defines Mcoll_{n}(M_{s}). Thus the probability that case 1 occurs for M_{s}, is at most Mcoll_{n}(M_{s}), and, by the sum bound, the probability that case 1 occurs is at most ∑_{1≤r≤q} Mcoll_{n}(m_{r}).

In the second case, if we had run game 5 using coins L, Y_{s} and Y_{u}, restricting the execution of line 12 to r ∈ {s, u}, then bad still would have been set to true. This exactly coincides with the game that defines Mcoll_{n}(M_{s}, M_{u}). Thus the probability that case 2 occurs for M_{s}, M_{u}, is at most MMcoll_{n}(M_{s}, M_{u}), and the probability that case 2 occurs due to (M_{s}, M_{u}) is at most MMcoll_{n}(M_{s}, M_{u}) and, by the sum bound, the probability of an MM collision is at most ∑_{1≤s<u≤q} MMcoll_{n}(m_{s}, m_{u}). This completes the proof.