Piling-up lemma

From HandWiki
Short description: Principle used in linear cryptanalysis

In cryptanalysis, the piling-up lemma is a principle used in linear cryptanalysis to construct linear approximations to the action of block ciphers. It was introduced by Mitsuru Matsui (1993) as an analytical tool for linear cryptanalysis.[1] The lemma states that the bias (deviation of the expected value from 1/2) of a linear Boolean function (XOR-clause) of independent binary random variables is related to the product of the input biases:[2]

[math]\displaystyle{ \epsilon(X_1\oplus X_2\oplus\cdots\oplus X_n)=2^{n-1}\prod_{i=1}^n \epsilon(X_i) }[/math]

or

[math]\displaystyle{ I(X_1\oplus X_2\oplus\cdots\oplus X_n ) =\prod_{i=1}^n I(X_i) }[/math]

where [math]\displaystyle{ \epsilon \in [-\tfrac{1}{2}, \tfrac{1}{2}] }[/math] is the bias (towards zero[3]) and [math]\displaystyle{ I \in [-1, 1] }[/math] the imbalance:[4][5]

[math]\displaystyle{ \epsilon(X) = P(X=0) - \frac{1}{2} }[/math]
[math]\displaystyle{ I(X) = P(X=0) - P(X=1) = 2 \epsilon(X) }[/math].

Conversely, if the lemma does not hold, then the input variables are not independent.[6]

Interpretation

The lemma implies that XOR-ing independent binary variables always reduces the bias (or at least does not increase it); moreover, the output is unbiased if and only if there is at least one unbiased input variable.

Note that for two variables the quantity [math]\displaystyle{ I(X \oplus Y) }[/math] is a correlation measure of [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math], equal to [math]\displaystyle{ P(X=Y)-P(X\ne Y) }[/math]; [math]\displaystyle{ I(X) }[/math] can be interpreted as the correlation of [math]\displaystyle{ X }[/math] with [math]\displaystyle{ 0 }[/math].

Expected value formulation

The piling-up lemma can be expressed more naturally when the random variables take values in [math]\displaystyle{ \{-1,1\} }[/math]. If we introduce variables [math]\displaystyle{ \chi_i = 1 - 2X_i = (-1)^{X_i} }[/math] (mapping 0 to 1 and 1 to -1) then, by inspection, the XOR-operation transforms to a product:

[math]\displaystyle{ \chi_1\chi_2\cdots\chi_n = 1 - 2(X_1 \oplus X_2\oplus\cdots\oplus X_n) = (-1)^{X_1 \oplus X_2\oplus\cdots\oplus X_n} }[/math]

and since the expected values are the imbalances, [math]\displaystyle{ E(\chi_i)=I(X_i) }[/math], the lemma now states:

[math]\displaystyle{ E\left(\prod_{i=1}^n \chi_i \right)=\prod_{i=1}^nE(\chi_i) }[/math]

which is a known property of the expected value for independent variables.

For dependent variables the above formulation gains a (positive or negative) covariance term, thus the lemma does not hold. In fact, since two Bernoulli variables are independent if and only if they are uncorrelated (i.e. have zero covariance; see uncorrelatedness), we have the converse of the piling up lemma: if it does not hold, the variables are not independent (uncorrelated).

Boolean derivation

The piling-up lemma allows the cryptanalyst to determine the probability that the equality:

[math]\displaystyle{ X_1\oplus X_2\oplus\cdots\oplus X_n=0 }[/math]

holds, where the X's are binary variables (that is, bits: either 0 or 1).

Let P(A) denote "the probability that A is true". If it equals one, A is certain to happen, and if it equals zero, A cannot happen. First of all, we consider the piling-up lemma for two binary variables, where [math]\displaystyle{ P(X_1 = 0)=p_1 }[/math] and [math]\displaystyle{ P(X_2 = 0)=p_2 }[/math].

Now, we consider:

[math]\displaystyle{ P(X_1 \oplus X_2 = 0) }[/math]

Due to the properties of the xor operation, this is equivalent to

[math]\displaystyle{ P(X_1=X_2) }[/math]

X1 = X2 = 0 and X1 = X2 = 1 are mutually exclusive events, so we can say

[math]\displaystyle{ P(X_1=X_2)=P(X_1=X_2=0) + P(X_1=X_2=1)=P(X_1=0, X_2=0) + P(X_1=1, X_2=1) }[/math]

Now, we must make the central assumption of the piling-up lemma: the binary variables we are dealing with are independent; that is, the state of one has no effect on the state of any of the others. Thus we can expand the probability function as follows:

[math]\displaystyle{ P(X_1 \oplus X_2 = 0) }[/math] [math]\displaystyle{ =P(X_1=0)P(X_2=0)+P(X_1=1)P(X_2=1) }[/math]
[math]\displaystyle{ =p_1p_2 + (1-p_1)(1-p_2) }[/math]
[math]\displaystyle{ =p_1p_2 + (1-p_1-p_2+p_1p_2) }[/math]
[math]\displaystyle{ =2p_1p_2-p_1-p_2+1 }[/math]

Now we express the probabilities p1 and p2 as ½ + ε1 and ½ + ε2, where the ε's are the probability biases — the amount the probability deviates from ½.

[math]\displaystyle{ P(X_1 \oplus X_2 = 0) }[/math] [math]\displaystyle{ =2(1/2+\epsilon_1)(1/2+\epsilon_2)-(1/2+\epsilon_1)-(1/2+\epsilon_2)+1 }[/math]
[math]\displaystyle{ =1/2+\epsilon_1+\epsilon_2+2\epsilon_1\epsilon_2-1/2-\epsilon_1-1/2-\epsilon_2+1 }[/math]
[math]\displaystyle{ =1/2+2\epsilon_1\epsilon_2 }[/math]

Thus the probability bias ε1,2 for the XOR sum above is 2ε1ε2.

This formula can be extended to more X's as follows:

[math]\displaystyle{ P(X_1\oplus X_2\oplus\cdots\oplus X_n=0)=1/2+2^{n-1}\prod_{i=1}^n \epsilon_i }[/math]

Note that if any of the ε's is zero; that is, one of the binary variables is unbiased, the entire probability function will be unbiased — equal to ½.

A related slightly different definition of the bias is [math]\displaystyle{ \epsilon_i = P(X_i=1) - P(X_i=0), }[/math] in fact minus two times the previous value. The advantage is that now with

[math]\displaystyle{ \varepsilon_{total}= P(X_1\oplus X_2\oplus\cdots\oplus X_n=1)- P(X_1\oplus X_2\oplus\cdots\oplus X_n=0) }[/math]

we have

[math]\displaystyle{ \varepsilon_{total}=(-1)^{n+1}\prod_{i=1}^n \varepsilon_i, }[/math]

adding random variables amounts to multiplying their (2nd definition) biases.

Practice

In practice, the Xs are approximations to the S-boxes (substitution components) of block ciphers. Typically, X values are inputs to the S-box and Y values are the corresponding outputs. By simply looking at the S-boxes, the cryptanalyst can tell what the probability biases are. The trick is to find combinations of input and output values that have probabilities of zero or one. The closer the approximation is to zero or one, the more helpful the approximation is in linear cryptanalysis.

However, in practice, the binary variables are not independent, as is assumed in the derivation of the piling-up lemma. This consideration has to be kept in mind when applying the lemma; it is not an automatic cryptanalysis formula.

See also

  • Variance of a sum of independent real variables

References

  1. Matsui, Mitsuru (1994). "Linear Cryptanalysis Method for DES Cipher". Advances in Cryptology – EUROCRYPT '93. Lecture Notes in Computer Science. 765. pp. 386–397. doi:10.1007/3-540-48285-7_33. ISBN 978-3-540-57600-6. 
  2. Li, Qin; Boztaş, S. (December 2007). "Extended Linear Cryptanalysis and Extended Piling-up Lemma". http://www.iscturkey.org/assets/files/2016/03/2007-49.pdf. 
  3. The bias (and imbalance) may also be taken as an absolute value; if the bias with flipped sign (bias towards one) is used the lemma needs an additional (-1)^(n+1) sign factor in the right hand side.
  4. Harpes, Carlo; Kramer, Gerhard G.; Massey, James L. (1995). "A Generalization of Linear Cryptanalysis and the Applicability of Matsui's Piling-up Lemma". Advances in Cryptology – EUROCRYPT '95. Lecture Notes in Computer Science. 921. pp. 24–38. doi:10.1007/3-540-49264-X_3. ISBN 978-3-540-59409-3. 
  5. Kukorelly, Zsolt (1999). "The Piling-Up Lemma and Dependent Random Variables". Cryptography and Coding. Lecture Notes in Computer Science. 1746. pp. 186–190. doi:10.1007/3-540-46665-7_22. ISBN 978-3-540-66887-9. 
  6. Nyberg, Kaisa (February 26, 2008). "Linear Cryptanalysis (Cryptology lecture)". http://www.tcs.hut.fi/Studies/T-79.5501/2008SPR/lectures/lecture5.pdf.