Lecture Notes on Cryptographic Boolean Functions
Total Page:16
File Type:pdf, Size:1020Kb
Lecture Notes on Cryptographic Boolean Functions Anne Canteaut Inria, Paris, France [email protected] https://www.rocq.inria.fr/secret/Anne.Canteaut/ version: March 10, 2016 Contents 1 Boolean functions 3 1.1 Boolean functions and their representations . .3 1.1.1 Truth table and Algebraic normal form . .3 1.1.2 Computing the Algebraic Normal Form . .6 1.1.3 Reed-Muller codes . .7 1.2 Weight of a Boolean function . .9 1.2.1 Minimum weight of a Boolean function in R(r; n) ............. 10 1.2.2 Weights of affine functions . 10 1.2.3 Weights of functions of degree (n − 1) ................... 11 1.2.4 Weights of functions of degree 2 ....................... 11 1.2.5 Weight divisibility of Boolean functions . 11 1.3 Walsh transform . 11 1.3.1 Definitions . 11 1.3.2 Computing the Walsh transform. 12 1.3.3 Basic properties of the Walsh transform . 13 1.4 Linearity of a Boolean function . 14 1.4.1 Optimal linearity . 14 1.4.2 Link with Reed-Muller codes. 16 1.4.3 Affine equivalence for Boolean functions . 16 1.5 Existence of an approximation with fewer variables . 17 1.5.1 Correlation-immunity order . 18 1.5.2 Approximation of a function by a function of (t + 1) variables. 20 2 Cryptographic Sboxes 23 2.1 Representations of an Sbox . 23 2.1.1 Components of an Sbox . 23 2.1.2 Univariate representation . 24 2.2 Exploiting the degree of the Sbox . 27 2.2.1 Basic algebraic attack . 27 2.2.2 Enhanced algebraic attack . 30 2.2.3 Other attacks exploiting a low degree . 31 2.3 Linear properties of Sboxes . 32 2.3.1 Linear cryptanalysis . 32 2.3.2 Linearity of an Sbox . 33 2.4 Differential properties of Sboxes . 34 2.4.1 Differential cryptanalysis . 34 1 2 Contents 2.4.2 Differential uniformity . 34 2.5 Link between differential uniformity and linearity . 35 2.6 Sboxes with good cryptographic properties . 37 2.6.1 Affine equivalence . 37 2.6.2 Odd number of variables . 38 2.6.3 4-bit permutations . 38 2.6.4 6-bit permutations . 39 2.6.5 Sboxes of an even number of variables . 40 Chapter 1 Boolean functions 1.1 Boolean functions and their representations n Definition 1.1 (Boolean function). A Boolean function of n variables is a function from F2 n n into F2. Its value vector is the binary vector vf of length 2 composed of all f(x) when x 2 F2 . 1.1.1 Truth table and Algebraic normal form A Boolean function is usually defined by its truth table, which gives the images of all elements n in F2 . For instance, Table 1.1 is the truth table of a Boolean function of 3 variables. The x1 0 1 0 1 0 1 0 1 x2 0 0 1 1 0 0 1 1 x3 0 0 0 0 1 1 1 1 f(x1; x2; x3) 0 1 0 0 0 1 1 1 Table 1.1: Truth table of a Boolean function of 3 variables. 8 value vector of f is the vector of F2 corresponding to the last row in the truth table. Boolean functions are often identified with their value vectors. In particular, the weight and the support of a Boolean function f refer to the weight and the support of its value vector vf . Most cryptographic applications use balanced Boolean functions, i.e., Boolean functions f whose output is uniformly distributed. This equivalently means that the weight of vf is half of its length. Besides the truth table, there are several other representations of Boolean functions which may be more appropriate in some contexts. In coding theory and in cryptography, a very natural representation is the so-called algebraic normal form (ANF), which corresponds to the expression of a Boolean function as a multivariate polynomial. Since the n inputs of the 2 function take their values in F2, they must be considered modulo X + X. Therefore, this polynomial has degree at most 1 in each input variable. It follows that any monomial of this polynomial is the product of some input variables. Each monomial can then be characterized Q by a subset of I = f1; : : : ; ng, i.e., i2I xi, or equivalently by the n-bit vector u having I as support. This second notation will be extensively used in the context of Boolean functions. 3 4 Chapter 1. Boolean functions n u 2 2 Notation 1.2. For any u 2 F2 , x denotes the monomial in F2[x1; : : : ; xn]=(x1 + x1; : : : ; xn + xn) defined by n Y ui xi : i=1 The following theorem then shows that any Boolean function can be uniquely represented by a multivariate polynomial, and it also gives a simple formula for computing this polynomial from the value vector of the function. Theorem 1.3 (Algebraic normal form). Let f be a Boolean function of n variables. Then, 2 2 there exists a unique multivariate polynomial in F2[x1; : : : ; xn]=(x1 +x1; : : : ; xn +xn) such that X u f(x1; : : : ; xn) = aux ; with au 2 F2 : n u2F2 This multivariate polynomial is called the algebraic normal form (ANF) of f. Moreover, the coefficients of the ANF and the values of f satisfy: X X au = f(x) and f(u) = ax; xu xu where the sums are in F2 and x y if and only if xi ≤ yi for all 1 ≤ i ≤ n. Proof. We first show by induction on n that the ANF of an n-variable Boolean function can be uniquely computed from its truth table. • For n = 1, it is easy to check that the polynomial a1x + a0 with a1 = f(0) + f(1) and a0 = f(0) is the unique polynomial equal to f. • Induction step. Given an n-variable function f, we consider the two (n − 1)-variable Boolean functions g and h defined by g(x1; : : : ; xn−1) = f(x1; : : : ; xn−1; 0) and h(x1; : : : ; xn−1) = f(x1; : : : ; xn−1; 1) : Then, we have f(x1; : : : ; xn) = (1 + xn)g(x1; : : : ; xn−1) + xnh(x1; : : : ; xn−1) or equivalently, f(x1; : : : ; xn) = g(x1; : : : ; xn−1) + xn (g(x1; : : : ; xn−1) + h(x1; : : : ; xn−1)) : n−1 We apply the induction hypothesis and denote by αu (resp. βu) for u 2 F2 the coefficients of the ANF of g (resp. of h). We know that X X X X αu = g(x) = f(x; 0) and βu = h(x) = f(x; 1) : xu xu xu xu We then deduce that f(x1; : : : ; xn) = g(x1; : : : ; xn−1) + xn (g(x1; : : : ; xn−1) + h(x1; : : : ; xn−1)) n−1 n−1 ! X Y ui X Y ui = αu xi + (αu + βu) xi xn : n−1 i=1 n−1 i=1 u2F2 u2F2 1.1. Boolean functions and their representations 5 n Therefore, the coefficients av, v = (v1; : : : ; vn) 2 F2 , of the ANF of f are given by αv1;:::;vn−1 if vn = 0 av = αv1;:::;vn−1 + βv1;:::;vn−1 if vn = 1 From the expressions of the coefficients α and β, we deduce that ( P f(u; 0) if vn = 0 a = u(v1;:::;vn−1) v P f(u; 0) + P f(u; 1) if v = 1 u(v1;:::;vn−1) u(v1;:::;vn−1) n implying that X av = f(u) : uv 2n Conversely, the values of f are uniquely determined by its ANF since the function over F2 which maps the value vector of f to the vector of coefficients of its ANF is an involution. n Indeed, for any y 2 F2 , we have X X X au = f(x) uy uy xu X n = f(x)jfu 2 F2 : x u ygj xy X = 2wt(y)−wt(x)f(x) : xy All terms in this sum are then zero modulo 2 unless x = y. Thus X au = f(y) ; uy which means that the transformation we consider is an involution. Example 1.1. Computing the ANF of the function defined in Table 1.1. Using the previous theorem, we compute the coefficients of the ANF of this Boolean function: a000 = f(000) = 0 a100 = f(100) + f(000) = 1 a010 = f(010) + f(000) = 0 a110 = f(110) + f(010) + f(100) + f(000) = 1 a001 = f(001) + f(000) = 0 a101 = f(101) + f(001) + f(100) + f(000) = 0 a011 = f(011) + f(001) + f(010) + f(000) = 1 X a111 = f(x) = wt(f) mod 2 = 0 : 3 x2F2 Thus, the ANF of f is x1 + x1x2 + x2x3 : 6 Chapter 1. Boolean functions The degree of f is then the degree of the largest monomial in the ANF of f, i.e., deg f = max wt(u) : n u2F2 :au6=0 For instance the function considered in the previous example has degree 2. It is worth noticing that there exist several other representations of Boolean functions which may be more convenient than the ANF in some other contexts. For instance, the disjunctive normal form represents the function by some products between variables and negations of variables, which are added by an OR. A disjunctive normal form of the function defined in Table 1.1 is x1x2x3 OR x1x2x3 OR x1x2x3 OR x1x2x3 : Such a representation may be more appropriate than the ANF when we want to determine the smallest circuit which implements the function in a context where only AND, NOT and OR gates are available, see [Weg87] for more details. 1.1.2 Computing the Algebraic Normal Form The general form of the transformation which associates the coefficients of the ANF to the value vector is 2n 2n Mn : F2 ! F2 n n P a = (au; u 2 F2 ) 7! (bu; u 2 F2 ) with bu = vu av : This function is called the binary Möbius transform.