Searching for Subspace Trails and Truncated Differentials
Total Page:16
File Type:pdf, Size:1020Kb
IACR Transactions on Symmetric Cryptology ISSN 2519-173X, Vol. 2018, No. 1, pp. 74–100. DOI:10.13154/tosc.v2018.i1.74-100 Searching for Subspace Trails and Truncated Differentials Gregor Leander1, Cihangir Tezcan1,2 and Friedrich Wiemer1 1 Horst Görtz Institute for IT-Security, Ruhr-Universität Bochum, Bochum, Germany {gregor.leander,friedrich.wiemer}@rub.de 2 Informatics Institute, Department of Cyber Security, CYDES Laboratory, and Department of Mathematics, Middle East Technical University, Ankara, Turkey [email protected] Abstract. Grassi et al. [GRR16] introduced subspace trail cryptanalysis as a general- ization of invariant subspaces and used it to give the first five round distinguisher for Aes. While it is a generic method, up to now it was only applied to the Aes and Prince. One problem for a broad adoption of the attack is a missing generic analysis algorithm. In this work we provide efficient and generic algorithms that allow to compute the provably best subspace trails for any substitution permutation cipher. Keywords: Subspace Trail Cryptanalysis · Truncated Differentials · Tools 1 Introduction Despite good progress in the last decades, especially within the Aes competition and more recently within the area of lightweight cryptography, some fundamental questions of the design and analysis of block ciphers (or hash-functions or cryptographic permutations) still remain open. Several of those fundamental questions can be found in the area of differential cryptanalysis and its variants. In differential cryptanalysis we are interested in studying the behavior of the output differences of (parts of) the cipher for a given fixed input difference. In order to analyze the distribution of those differences, we (i) are required to make simplifying assumptions (like assuming independent round keys), (ii) argue about average behavior only, and (iii) study differential characteristics instead of differentials. While the general experience is that for most practical applications, the simplified analysis is a sufficiently good heuristic, the situation is clearly unsatisfactory from a scientific perspective. Any progress here would significantly improve our understanding of block ciphers. Another example of a related area for which a strict analysis without simplifying heuristics is still missing is the topic of truncated differentials. Informally, for truncated differentials, instead of trying to understand the exact behavior of the output difference, one restricts to understand certain patterns that appear in the differences with an unusual high probability. Truncated differentials have been introduced by Knudsen [Knu95] more than 20 years ago and since then been used in the analysis of many symmetric primitives, e. g., [BN14; Gra17; KRW99; Tez16]. Surprisingly, even the case of truncated differentials with probability one is not fully understood yet, as this work shows. Recently, new interest in truncated differentials has been triggered by [GRR16] where the notion of subspace trail cryptanalysis has been defined and used to derive new interesting properties of the Aes. As subspace trails are closely related to truncated differentials Licensed under Creative Commons License CC-BY 4.0. Received: 2017-09-01, Revised: 2017-11-23, Accepted: 2018-01-23, Published: 2018-03-01 Gregor Leander, Cihangir Tezcan and Friedrich Wiemer 75 with probability one, those recent works again highlight that it is important to finally completely understand this topic. A one round subspace trail can be captured as follows: Given a function F on n bit n strings, a subspace trail is specified by two subspaces U, V ⊆ F2 , such that any coset of U is mapped to a coset of V , that is n n ∀a ∈ F2 ∃b ∈ F2 such that F (U + a) ⊆ V + b and we denote this by U → V . Extending this concept to r rounds of an iterated block cipher with round function F , we consider subspace trails given by a tuple of vector spaces (U0,...,Ur) such that for all i we have Ui → Ui+1. The important question, both for the design as well as for the analysis of block ciphers, is how to identify the most powerful subspace trails, where most powerful basically corresponds to covering as many rounds as possible. In the case of truncated differentials, several heuristics have been used to solve this problem so far. For SPN ciphers, where each round function consists of a layer of parallel S-boxes followed by a linear mapping, the two most common ones are to ignore the details of the S-box and to restrict to the cases where U0 only activates one S-box. While intuitively this approach seems to cover the best subspace trails, it seems hard to exclude the existence of better subspace trails outside those special cases. Indeed, to underline that the heuristic of activating a single S-box is not sufficient in general we provide several examples (see Section 3) where the best subspace trails actually activate more than one S-box. For the designers of block ciphers it would be very convenient to exclude the existence of subspace trails without making any restrictions and thus to avoid having to base the security arguments of a cipher upon heuristics. For attackers it is interesting to see if attacks could be improved by avoiding those restrictions. As an example, the subspace trail used in [GRR17] does not make use of any specific properties of the Aes S-box. Thus, one important question raised is, if those results on Aes could actually be improved by taking the specific structure of the Aes S-box into account. 1.1 Our Contribution In this work we rigorously analyse subspace trails for SPN ciphers. As a result of our considerations, we provide efficient and generic algorithms that can be applied to any SPN cipher and compute the longest subspace trails without any heuristics or restrictions. As a first step in Section 2, after fixing our notation and recalling basic facts, we recall that it is actually possible to efficiently compute the entire subspace trail for any number of rounds efficiently, given the starting subspace U0. Thus, the task of finding the best solution actually boils down to choosing the best starting spaces U0. However, apriori there is a huge choice of possible starting spaces and it is clearly inefficient to simply try all possible U0. We thus have to exhibit a way to reduce the choice of U0 to a suitable number in such a way that we are guaranteed to not exclude the best choices. Our consideration here show an interesting difference depending on whether the S-box used in the cipher has linear structures or not.1 Makarim and Tezcan [MT14] already observed an influence of linear structures on truncated differentials, but restricted themselves to linear structures in the coordinate functions of S-boxes. By considering all linear structures of an S-box, we are able to fully understand its influence on subspace trails. 1We like to note that both situations, that is S-boxes with and without linear structures occur in actual cipher designs. 76 Searching for Subspace Trails and Truncated Differentials More precisely, if the S-box used in the cipher does not have any linear structures (see Section 4), we can prove that the approach sketched above, that is to ignore the details of the S-box and to only consider the case where U0 activates a single S-box, always results in the strongest subspace trail. More technically, we show that in this case for any subspace trail the subspaces Ui are without loss of generality direct products of subspaces that are aligned with the S-box layer. Note that the Aes S-box does not have any linear structures. In particular, this shows that an attacker cannot hope to improve the work of [GRR17] by taking the details of the Aes S-box into account. In the case when the S-box actually does have linear structures (see Section 5), the situation is slightly more complicated and the choice for U0 remains huge. However, we show that simply switching from the input subspace of the first S-box layer to the output subspace of the first S-box layer results in a simple and efficient workaround. Here, we can prove that it is sufficient to consider a very limited choice of at most k2n choices for the output subspace of the first S-box layer, where k is the number of parallel S-boxes and n is the input size of a single S-box. The price to pay for this switch is that it is in general unclear if any of those trails can actually be extended backwards through the first S-box layer. However, using this approach we are able to provably bound the longest subspace trail. More precisely, our bound is either tight (in the case where we can actually extend trails backwards) or off by at most one round (in the case where we cannot). All our algorithms are efficient for any concrete instance of a block cipher we are aware of. We run the algorithms on a number of ciphers and report on the results in the respective parts of Sections 4 and5. Note that while our results will most likely not lead to new attacks on the ciphers we have been investigating, the main point is that we can now provably exclude the existence of such attacks. We implemented all algorithms in c and Sage; the Sage the source code is listed in the Appendix A. 1.2 Related Work Besides the subspace trail on Aes [GRR17], subspace trail cryptanalysis has been applied to Prince in [GR16]. A paper that is technically related, but focuses on invariant subspaces instead of subspace trails is [LR17]. Grassi et al. [GRR16] noted the strong connection between subspace trails and truncated differentials with probability one.