Next Article in Journal
Improving Comfort and Air Conditioner Performance by Optimizing Controllers under Actual Usage Conditions
Next Article in Special Issue
Performing Cache Timing Attacks from the Reconfigurable Part of a Heterogeneous SoC—An Experimental Study
Previous Article in Journal
Filtering-Based Regularized Sparsity Variable Step-Size Matching Pursuit and Its Applications in Vehicle Health Monitoring
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Search-Space Reduction for S-Boxes Resilient to Power Attacks

by
Carlos Miguel Legón-Pérez
1,
Ricardo Sánchez-Muiña
2,
Dianne Miyares-Moreno
2,
Yasser Bardaji-López
2,
Ismel Martínez-Díaz
1,
Omar Rojas
3 and
Guillermo Sosa-Gómez
3,*
1
Institute of Cryptography, University of Havana, Havana 10400, Cuba
2
Faculty of Computer Science, Technologic University of Havana, Havana 19390, Cuba
3
Facultad de Ciencias Económicas y Empresariales, Universidad Panamericana, Álvaro del Portillo 49, Zapopan, Jalisco 45010, Mexico
*
Author to whom correspondence should be addressed.
Appl. Sci. 2021, 11(11), 4815; https://doi.org/10.3390/app11114815
Submission received: 10 March 2021 / Revised: 17 May 2021 / Accepted: 19 May 2021 / Published: 24 May 2021
(This article belongs to the Special Issue Side Channel Attacks in Embedded Systems)

Abstract

:
The search of bijective n × n S-boxes resilient to power attacks in the space of dimension ( 2 n ) ! is a controversial topic in the cryptology community nowadays. This paper proposes partitioning the space of ( 2 n ) ! S-boxes into equivalence classes using the hypothetical power leakage according to the Hamming weights model, which ensures a homogeneous theoretical resistance within the class against power attacks. We developed a fast algorithm to generate these S-boxes by class. It was mathematically demonstrated that the theoretical metric confusion coefficient variance takes constant values within each class. A new search strategy—jumping over the class space—is justified to find S-boxes with high confusion coefficient variance in the space partitioned by Hamming weight classes. In addition, a decision criterion is proposed to move quickly between or within classes. The number of classes and the number of S-boxes within each class are calculated, showing that, as n increases, the class space dimension is an ever-smaller fraction of the space of S-boxes, which significantly reduces the space of search of S-boxes resilient to power attacks, when the search is performed from class to class.

Graphical Abstract

1. Introduction

Technology has taken an important role in modern society, increasing the amount of transmitted information. The methods for data encryption protect the access to such information and ensure its confidentiality. In particular, in symmetric cryptography, in block cipher design, particularly, S-boxes are essential components that provide the confusion on encryption and decryption processes [1].
Traditional S-box design criteria focus on the resistance to differential and linear attacks [2,3]. Some S-box transformations, equivalences and classes have been proposed to address this goal. In [4], Biryukov et al. presented algorithms to detect linear and affine equivalences between two S-boxes. They solved the affine equivalence problem by finding unique representatives for the linear equivalence classes. Leander et al. [5] classified all optimal 4-bit S-boxes into 16 different affine equivalence classes, given a representative for each class. The classification criteria were the optimal values for S-boxes concerning linear and differential cryptanalysis, known as values for dimension four. Such a result is remarkable and relevant because exhaustively checking all permutations to find good S-boxes is not a feasible option; the number of mappings from n-bit to n-bit is large; and the classification into optimal classes reduces the work and helps find the most area-efficient S-box.
Despite the encouraging results in traditional S-box design [6], some other interesting approaches from combinatorial optimization have arisen [7,8]. The rising number of cyberattacks based on physical information leaks, known as side-channel analysis, gives way to a new design context [9]. In particular, power attacks are a real threat to cryptographic algorithm implementations [10,11], and it is necessary to find a balance between the intrinsic resistance of S-boxes to to those attacks and the resistance against linear and differential cryptanalysis [12]. To measure the theoretical resistance of S-boxes to differential power attacks, different metrics have been proposed, such as the order of transparency redefined and revisited under the Hamming distance leakage model [13,14], and  the confusion coefficient of the variance under the Hamming weight leakage model [15]. In this context, different methods have been used to search for S-boxes with high nonlinearity and high resistance to power attacks [8,16,17]. In these attacks, different models are used to simulate the hypothetical power leakage, the most common being the Hamming weight model, Hamming distance and its adaptations to different scenarios [18].
Motivated by the benefits provided by the definition of equivalence classes in [5] and the non-existence of equivalence classes in the new design context, we propose in this investigation a new equivalence relationship between bijective S-boxes using the Hamming weight leakage model. This relationship provides us with a way to define equivalence classes represented by the Hamming weight vector of the S-boxes’ outputs. According to the Hamming weight leakage model, all S-boxes in the same class have the same hypothetical power leakage. We also present a new algorithm, which receives an initial S-box as an input and randomly generates a new S-box equivalent to the initial one; both S-boxes belong to the same Hamming weight class. The algorithm is simple but not trivial, since it depends on the representation of the class in sets of inputs for each weight, which is also a novel result of this work. We used the algorithm to confirm our hypotheses. We generated random S-boxes belonging to the same Hamming weight class and selected some elementary classes, such as the Advanced Encryption Standard S-box class. When we performed correlation power attacks on these S-boxes using their hypothetical leaks but the same real leaks generated by the Advanced Encryption Standard cipher, we obtained the same results for all of them and probed that the theoretical confusion coefficient variance metric returns the same value for all generated S-boxes belonging to the same class. Our equivalence relationship does not attempt to reflect resistance against linear and differential attacks. We follow the goal, not to obtain good S-boxes in the sense of trade-off classical resistance and the resistance against power attacks, but to provide a novel formal framework for the actual S-box design context. This result can be applied to search over the Hamming weight class space instead of searching over the entire S-box space, which entails reducing the space and improving the performance of the search process.
Taking into account that all S-boxes belonging to the same Hamming weight class have, by the way the classes are defined, the same hypothetical leakage according to the Hamming weight leakage model, it is intuitively expected that all of them have the same resistance to power attacks, when quantified using the confusion coefficient variance metric, since this metric is based on that leakage model. Based on this idea, it was experimentally verified that the value of the variance of the confusion coefficient is constant within each Hamming weight class, and, to explain these experimental results, this property was theoretically demonstrated. However, to present the content in a more logical sequence, the document presents first the theoretical proof and then its experimental and statistical confirmations: (1) effective attack on 1000 S-boxes that belongs to the Advanced Encryption Standard S-box class; and (2) constant confusion coefficient variance value on S-boxes in the same class. In both cases, we generated the S-boxes using our new randomized algorithm.
The paper is structured as follows. Section 2 includes the necessary basics concepts. Section 3 presents the contributions about the new equivalence relationship; the Hamming weight equivalence classes and their representatives; the algorithm to generate the S-boxes into each class; and the theoretical demonstration and experimental verification that random S-boxes of a class have the same resistance to power attacks. The number of classes and the number of S-boxes within each class are calculated, showing that, as n increases, the class space dimension is an ever-smaller fraction of the space of S-boxes, which significantly reduces the space of search of S-boxes resilient to power attacks, when the search is performed from class to class. Finally, Section 4 provides concluding remarks.

2. Basic Concepts

We begin by stating some basic definitions. Bijective S-boxes are vector functions used in most block ciphers, represented as a mapping F : { 0 , 1 } n { 0 , 1 } n , n N . For each binary vector x { 0 , 1 } n , H W ( x ) represents the Hamming weight of x [10]. Its objective is to cause the greatest possible confusion by masking the relationship between the plain text and the ciphertext [2,19].
The correlation power attack (CPA) [20] uses the linear correlation coefficient as a distinction to quantify the statistical dependence between the real power leak Y k , p generated from the K key and the hypothetical leak X j , p calculated with the model from the assumed key J. In the Hamming weight model [2], the hypothetical leakage X j , p of the power consumption evaluating an S-box is represented by the value X j , p = H W ( F ( j p ) ) , where F is the S-box, p represents the clear text and j is the assumed subkey to encrypt the plain text.
S-boxes have a set of properties that allow for the evaluation of their cryptographic quality, such as the high degree of nonlinearity (NL) that protects against linear attacks. The coefficient of confusion (CC) and the confusion coefficient variance (CCV) are two of the used metrics to measure resistance to differential power attacks (DPA). The coefficient of confusion (CC) theoretical metric was introduced by Y. Fei et al. in 2012 [21], who defined the confusion coefficient κ over two keys ( k i , k j ) as:
κ = κ ( k i , k j ) = P r [ ( L k i ) ( L k j ) ] = N ( L k i ) ( L k j ) N t ,
where N t is the total number of values for the relevant cipher-text bits and N ( L k i ) ( L k j ) is the number of occurrences for which different key hypotheses k i and k j result in different L values. In the DPA model, L has only two possible outcomes 0 and 1, but, in other power attack models, L can take more than two values. Then, in [22], the authors defined a general confusion coefficient as:
κ ( k i , k j ) = E [ ( L k i L k j ) 2 ] .
Particularly, under the DPA model, E [ ( L k i L k j ) 2 ] becomes P r [ ( L k i ) ( L k j ) ] .
In [15], Picek et al. considered κ ( k i , k j ) equal to the expected value E P (among all the possible p plain texts) of the distance between the power leaks L ( F ( k i p ) ) and L ( F ( k j p ) ) , using the pair of keys k i and k j , i.e.,
κ ( k i , k j ) = E P L ( F ( k i p ) L ( F ( k j p ) ) 2 ,
and proposed to take a new theoretical metric as the variance ( σ 2 ) of the CC vector over all possible pairs of keys:
C C V ( F ) = σ 2 k ¯ ¯ = σ 2 κ ( k i , k j ) | i < j .
When using the Hamming weight leakage model as the L function, the CCV is:
C C V ( F ) = σ 2 E P ( H W ( F ( k i p ) ) H W ( F ( k j p ) ) 2 | i < j
We expect that arbitrary keys, different from a real key, will look the same for the DPA attack at a higher value of variance. It increases the DPA resistance of the S-box [22,23].
Next, we recall the Stirling formula for factorial calculation. The value of n ! grows extremely quickly, but, for large values of n, it can be estimated using the well-known Stirling formula (see Table 1), the full proof of which appears in [24],
n ! 2 π n n n e n ,
which, using base 10 logarithm, can be expressed equivalently as:
n ! = 10 1 2 log ( 2 π ) + 1 2 log ( n ) + n log ( n ) n log ( e ) .
A refinement of the Stirling formula, in terms of lower and upper bounds is given by
( 2 π · n n + 1 2 · e n ) ( e ( 12 n + 1 ) 1 ) < n ! < ( 2 π · n n + 1 2 · e n ) ( e ( 12 n ) 1 ) .
Table 1. Examples of estimating n ! by the Stirling formula, for  n = 8 , 28 , 56 , 70 .
Table 1. Examples of estimating n ! by the Stirling formula, for  n = 8 , 28 , 56 , 70 .
FactorialStirling’s FormulaUpper BoundLower Bound
70! 10 100 10 100.0779669 10 100.0779665
56! 10 75 10 75.846396 10 75.846395
28! 10 29 10 29.48214 10 29.48213
8! 10 4 10 4.60537 10 4.60532

3. Our Contributions: Reduction of the S-Boxes Search-Space into a Hamming Weight Class SEARCH-Space

In this work, we only work with bijective S-boxes.

3.1. S-Boxes HW Equivalent

Definition 1.
Two bijective S-boxes F 1 , F 2 of order n × n are called HW equivalent if they have the same leakage of power according to the Hamming weight model, i.e.,  F 1 , F 2 are HW equivalent if and only if H W ( F 1 ( x ) ) = H W ( F 2 ( x ) ) , for all x { 0 , , 2 n 1 } .
Proposition 1.
The HW equivalence relationship defined in the space of all S-boxes F of order n × n , is an equivalence relationship.
Proof. 
It is immediate from the definition that the S-boxes meet the properties of reflexivity, symmetry and transitivity. It proves the HW equivalent relation between the S-boxes. The HW equivalence class < F a > associated with any S-box, F a can be expressed as:
< F a > = { F b | H W ( F b ( x ) ) = H W ( F a ( x ) ) , x { 0 , , 2 n 1 } } .
   □
This equivalence relation is used to partition the space of bijective S-boxes into Hamming weight classes. The cardinality of the class space is much smaller than the cardinality of the S-box space. According to the confusion coefficient variance, the theoretical resistance to power attacks is constant within each class and can be different between classes. It is proposed to replace the search in the space of S-boxes by the search in the class space Hamming weight (when trying to search for S-boxes resistant to Power attacks).
Now, we discuss the representation of the HW classes using the vector of weights of the S-boxes outputs that compose it. Considering that the vector of weights of outputs of the S-boxes that belong to a class is the same for all S-class boxes. This vector of weights is used to represent any class: < F a > = ( H W ( F a ( 0 ) ) , , H W ( F a ( 2 n 1 ) ) ) .
Example 1
(PRINT cipher). The following example represents the PRINT S-box F P r i n t ( x ) and its HW class < F P r i n t > = ( 0 , 1 , 2 , 2 , 3 , 1 , 2 , 1 ) using its vector of output weights. This S-box has a variance of the CCV confusion coefficient of 0.275510 (see Table 2).
Example 2
(PRESENT). The representation of the PRESENT S-box class < F P R E S E N T > , through its weight vector, is given in the Appendix A (see Table A1 and Table A2).
Example 3
(AES). The representation of the AES S-box class < F A E S > , through its weight vector, is given in the Appendix B (see Table A3 and Table A4).
Considering that all S-boxes in a class have the same hypothetical power leakage according to the Hamming weight model, it is theoretically expected that all S-boxes in a class have the same resistance to power attacks. We also look forward in the direction of having some invariant theoretical metric.
Proposition 2
(CCV is constant within each class). Let F a and F b be two S-boxes defined in the same domain and image {0,1 } n . If  F a and F b are HW equivalents, then C C V ( F a ) = C C V ( F b ) .
Proof. 
In the CCV expression under the Hamming weight leakage model,
C C V ( F ) = σ 2 E P ( H W ( F ( k i p ) ) H W ( F ( k j p ) ) 2 | i < j .
It can be seen that two HW equivalent S-boxes have the same CCV value because, for all x, H W ( F a ( x ) ) = H W ( F b ( x ) ) , the Hamming weights of the outputs of each S-box are equal to each other for all possible inputs, and  therefore the expected value and the variance that define the CCV are equal.    □
The proposition ensures that two S-boxes of the same class have the same CCV value, but the CCV values of different HW classes could be the same or different. This is a problem that will be investigated in future works.

3.2. Redefining the Equivalence Relation and the HW Classes

For the generation of the elements of each class < F a > , it is convenient to redefine it, representing it from the following ( n + 1 ) subsets:
C ( F ) k = { x | H W ( F ( x ) ) = k , x { 0 , , 2 n 1 } } .
Thus, C ( F ) k is the set of inputs of the S-box F whose outputs have weight k.
Proposition 3
(Necessary and sufficient condition of HW equivalence). F 1 , F 2 are HW equivalents if and only if C ( F 1 ) k = C ( F 2 ) k , k { 0 , , n } .
Proof. 
Starting from the hypothesis, H W ( F 1 ( x ) ) = H W ( F 2 ( x ) ) , x { 0 , , 2 n 1 } . If it is assumed that x exists such that x C ( F 1 ) k and x C ( F 2 ) k , then the hypothesis contradicts. On the other hand, assuming that C ( F 1 ) k = C ( F 2 ) k , k { 0 , 1 , 2 , , n } , if there exists an x C ( F 1 ) k , then x C ( F 2 ) k , and  therefore H W ( F 1 ( x ) ) = H W ( F 2 ( x ) ) = k . By redefining the equivalence relationship, the class associated with the S-box F a can be expressed as: < F a > = { F b | C ( F b ) k = C ( F a ) k , k { 0 , , n } } . From the redefinition of the class, it is easy to see that it is determined by the ( n + 1 ) sets C ( F a ) k , k { 0 , , n } .    □
Example 4
(Redefinition of class < F P r i n t > .). Let < F P r i n t > = ( H W ( F P r i n t ( 0 ) ) , ,   H W ( F P r i n t ( 7 ) ) ) = ( 0 , 1 , 2 , 2 , 3 , 1 , 2 , 1 ) . The  C ( F a ) k sets that determine the class < F P r i n t > associated with the S-box of PRINT are:
  • C ( F P r i n t ) 0 = { 0 } : F P r i n t ( x ) inputs x such that H W ( F P r i n t ( x ) ) = 0 .
  • C ( F P r i n t ) 1 = { 1 , 5 , 7 } : F P r i n t ( x ) inputs x such that H W ( F P r i n t ( x ) ) = 1 .
  • C ( F P r i n t ) 2 = { 2 , 3 , 6 } : F P r i n t ( x ) inputs x such that H W ( F P r i n t ( x ) ) = 2 .
  • C ( F P r i n t ) 3 = { 4 } : F P r i n t ( x ) inputs x such that H W ( F P r i n t ( x ) ) = 3 .
Example 5
(Redefinition of class < F A E S > ). The sets C ( F a ) k that determine the class < F A E S > = ( H W ( F A E S ( 0 ) ) , , H W ( F A E S ( 255 ) ) ) associated with the S-box F A E S of the AES, are:
  • C ( F A E S ) 0 = { 75 } .
  • C ( F A E S ) 1 = { 53 , 57 , 76 , 9 a , c 8 , c c , e 9 , e a } .
  • C(FAES)2 = {5,6,9,24,50,54,5c,5f,71,72,7a,7d,7e,7f,91,9d,b3,b8,c0,c3,c4,cb,cf,e2,e6,ed,f3,ff}.
  • C ( F A E S ) 3 = { 1 , 2 , a , b , e , 20 , 23 , 27 , 2 b , 2 c , 2 f , 45 , 51 , 52 , 58 , 5 b , 5 e , 64 , 68 , 6 b , 6 f , 70 , 73 , 77 , 79 , 7 b , 7 c , 90 , 92 , 96 , 99 , 9 b , 9 c , 9 e , b 0 , b 7 , b b , b c , b e , b f , c 2 , c 5 , c 7 , c 9 , c e , d 1 , d a , d e , e 0 , e 1 , e 4 , e 5 , e e , f 0 , f 8 , f c } .
  • C ( F A E S ) 4 = { 0 , 3 , 4 , 7 , 8 , c , d , f , 1 b , 1 c , 1 f , 21 , 22 , 28 , 29 , 2 d , 2 e , 31 , 36 , 3 d , 41 , 42 , 46 , 4 a , 4 d , 55 , 56 , 59 , 5 a , 5 d , 60 , 63 , 67 , 6 c , 74 , 78 , 80 , 84 , 88 , 8 b , 8 c , 93 , 94 , 95 , 97 , 98 , a 6 , a 7 , a 9 , a a , b 1 , b 2 , b 4 , b 6 , b 9 , b d , c 6 , c a , d 0 , d 6 , d d , e 3 , e 7 , e 8 , e b , e c , e f , f 4 , f 7 , f b } .
  • C ( F A E S ) 5 = { 10 , 13 , 14 , 17 , 18 , 19 , 1 e , 25 , 26 , 2 a , 32 , 35 , 37 , 3 a , 3 b , 3 e , 43 , 47 , 48 , 49 , 4 b , 4 c , 4 e , 61 , 62 , 65 , 66 , 69 , 6 a , 6 e , 83 , 87 , 8 f , 9 f , a 0 , a 1 , a 2 , a 5 , a d , a e , b 5 , b a , c 1 , c d , d 2 , d 3 , d 4 , d 5 , d 7 , d 8 , d 9 , f 5 , f 9 , f a , f d , f e } .
  • C ( F A E S ) 6 = { 12 , 15 , 16 , 1 d , 30 , 33 , 38 , 39 , 3 c , 3 f , 40 , 44 , 4 f , 6 d , 82 , 85 , 89 , 8 a , 8 e , a 3 , a 4 , a b , a c , d c , d f , f 1 , f 2 , f 6 } .
  • C ( F A E S ) 7 = { 11 , 1 a , 34 , 81 , 86 , a 8 , a f , d b } .
  • C ( F A E S ) 8 = { 8 d } .
The determination of the class by the ( n + 1 ) sets allows deducing an algorithm to easily generate the elements of a class: Let F a be an arbitrary initial S-box. Any permutation of two or more elements within a C ( F a ) k set (or within several C ( F a ) k sets simultaneously), generates a new S-box F b , which belongs to the same HW class < F a > as the initial S-box F a , ( F b < F a > ) since within each subset the weights of their outputs are the same.

3.3. Generation of HW Equivalent S-Boxes. ESboxG Algorithm

We present an equivalent S-box Generator (ESboxG) (Algorithm 1) to generate S-boxes belonging to a class by permuting elements of C ( F a ) k sets.
Algorithm 1 ESboxG
Input: S-box s
  Integer n s s //Number of sets to be swapped
  Integer m n o s // Max number of outputs that can be swapped
Output: S-box r // HW equivalent with s
1: Select n s s weights
2: for each k weight do
3:  create two lists I n p u t s k and O u t p u t s k // where each input holds in
    I n p u t s [ k ] , H W ( s [ i n p u t ] ) = k
4: end for
5: for each of the selected n s s k weights do
6:  s h u f f l e ( O u t p u t s [ k ] , m n o s )
7: for p = 0 to | C k | 1 do
8:    r [ I n p u t s [ k ] [ p ] ] = O u t p u t s [ k ] [ p ]
9:  end for
10: end for
11: return r
The complexity of this algorithm is determined by the permutations it performs within the subsets C ( F a ) k (Lines 5–10), in particular by the values of the two parameters ( n s s , m n o s ) . Three possible cases of different complexity are highlighted:
  • The maximum complexity is reached when all elements of all sub-assemblies are exchanged (maximum values of n s s and m n o s ).
  • The complexity can be reduced by exchanging only elements of a single subset C ( F a ) k , ( n s s = 1 ) .
  • The minimum complexity is reached when only two elements are permuted within a single subset ( n s s = 1 , m n o s = 2 ).
Proposition 4
(Necessary condition of belonging to the same class). If two S-boxes F a ( x ) and F b ( x ) belong to the same class, then C ( F a ) 0 = C ( F b ) 0 and C ( F a ) n = C ( F b ) n , or equivalently: F a 1 ( 0 ) = F b 1 ( 0 ) and F a 1 ( 2 n 1 ) = F b 1 ( 2 n 1 ) , F b < F a > .
Proof. 
The proof is straightforward and is essentially based on two conditions:
1.
The S-boxes of a class are generated by permuting the elements inside the sets
C ( F a ) k , k = 1 , n 1
2.
The sets C ( F a ) 0 and C ( F a ) n have a single element.
By Condition 2, for each of the sets C ( F a ) 0 and C ( F a ) n , it is not possible to permute elements of equal weight within the same class.
If an element of one of these sets is permuted, it will necessarily be permuted with an element of a different weight, which immediately leads to another HW class through Condition 1. □

3.4. Experimental Verification That all S-Boxes of a Class Have the Same Resistance to Power Attacks

SILK is a high level of abstraction simulator that builds a leakage trace based on a source code of an algorithm and several user-defined parameters. As source code, we used the AES cipher, which is executed using a plain text and a key. We also used the default SILK consumption power noise.
The objective of this experiment was to verify that all the S-boxes of a Hamming weight class have the same resistance to power attacks since they all have the same hypothetical power leakage, according to the Hamming weight leakage model. In particular, it was verified that, with the power leakage traces of an arbitrary S-box F a ( x ) , the power attack can be performed on all the S-boxes of its class < F a > . The S-box of the AES cryptographic algorithm was selected as S-box F a ( x ) , taking into account that this S-box is vulnerable to this type of attack. The SILK simulator was used only once to generate the power drain traces of the AES S-box. The proposed HW equivalent relationship theoretically ensure homogeneous DPA resistance within each class. To verify it practically, the following experiment was carried out in two steps:
Step 1. With the ESboxG algorithm, 1000 S-boxes belonging to the < F A E S > class were generated. The SILK simulator [25] was used to generate the energy leak traces of the AES S-box, using 200 plain texts and the key 00112233445566778899aabbccddeeff. We also used the default SILK consumption power noise. Subsequently, the power attack (CPA) was carried out on the 1000 S-boxes, but, in all cases, the energy leakage generated with the SILK Simulator was used for the first S-box.
It was found that, for each of the 1000 S-boxes generated, the same results were obtained (the correct 16 bytes of the key) as for the first S-box. It is important to note that, in all cases (the 1000 S-boxes), the traces of the first S-box were used. This experimental result confirms that, in practice, HW classes fulfill the theoretically expected property of Section 3.1.
Step 2. The objective of this second step was to illustrate in practice that Step 1 is not obtained with S-boxes that do not belong to the < F A E S > class. First, 1000 S-boxes not belonging to the < F A E S > class were randomly generated, and the attack was carried out again with the same energy leak traces from step one. Unsurprisingly, no byte was obtained correctly from the key, and the results were different for each S-box.

3.5. Experimental Verification of the Constant Value of Confusion Coefficient Variance CCV within HW Classes

To experimentally confirm that the CCV metric has a constant value within each HW class, a sample of 4 HW classes were taken: < F A E S C C > , < F S C R E A M > , < F A E S > and < F S T R I B O G > . In each class, 10,000 S-boxes were generated by the ESboxG algorithm, and its CCV value was calculated. The results after experimenting were as expected. For the 10,000 S-boxes, the same constant value of CCV was obtained within the class in each class.
There are differences between the CCV values of the four analyzed classes.
  • C C V ( < F A E S C C > ) = 0.149357 ;
  • C C V ( < F S C R E A M > ) = 0.121967 ;
  • C C V ( < F A E S > ) = 0.111304 ; and
  • C C V ( < F S T R I B O G > ) = 0.097765 .
By decreasing these CCV values, the S-boxes are decreased by their theoretical resistance to power attacks as follows: AESCC, SCREAM, AES and STRIBOG (as in [26]).

3.6. New Search Strategy for S-Boxes Resistant to Power Attacks Based on HW Classes

This section proposes a new search strategy for S-boxes resistant to power attacks based on the HW classes. It reduces the search space avoiding unnecessary operations. We suggest moving between HW classes and avoiding analyzing all S-boxes in the same class because they have the same DPA resistance. This new partition in classes allows us to define a new approach to search S-boxes with high CCV, and that also satisfies other desirable properties such as high nonlinearity. The proposed new strategy consists of two steps:
Step 1. As long as the S-box evaluated has a CCV value less than the desired one, the HW class must be changed.
Step 2. When a high CCV value is reached, it is necessary to search within that class the S-boxes that meet the other cryptographic properties, such as high nonlinearity.
The practical application of this strategy supports two aspects. First, changing classes is enough to swap at least two elements of the input whose outputs have different weights, and, second, the generation algorithm of S-boxes within the class (ESboxG algorithm) is easy to use and not complicated to implement. It is enough to permute two elements within one of the subsets C ( F ) k defined in Section 3.2.
Different meta-heuristics can be used to perform movement between classes and within classes. The objective function used for the search within the classes will depend on the remaining cryptographic properties of the S-box to be optimized.

3.7. Comparison between the Partition of the Space of S-Boxes in Related Classes and Hamming Weight Classes

Properties of the Partition of the space of S-boxes in Affine Classes.
1.
Constant cryptographic properties within classes.
The nonlinearity is constant within each class: the classes, by way of construction, fulfill the property that all the S-boxes of a class have the same nonlinearity value. This ensures that all S-boxes in a class have the same resistance against linear attacks.
Other cryptographic properties are not constant within each class since they were not taken into account for the definition of these classes. For example, the resistance to power attacks is not constant within the class; if measured with the theoretical metric of the confusion coefficient variance (CCV), this metric can take different values for S-boxes that belong to the same class.
2.
Movement between classes and within classes.
Movement within each class: Given an S-box F a , to obtain another S-box F b of the same class, transformations related to F a are performed.
Movement between different classes: Given an S-box F a , to obtain another S-box F b belonging to a different class, it is enough that affine transformations do not relate the two S-boxes.
3.
Number of classes.
The number of affine classes is approximately ( 2 n ) ! / | G | 2 , where | G | is the linear or affine group size, as estimated in [27].
Properties of the S-box Space Partition in Hamming Weight Classes (HW) Based on the Theoretical Resistance to Power Attacks According to the Metric of the Confusion Coefficient Variance (CCV).
1.
Constant cryptographic properties within classes.
The variance of the confusion coefficient variance (CCV) is constant within each class: the “theoretical” resistance to power attacks is constant within the class. The HW classes, by the way of construction, fulfill the property that all the S-boxes of a class have the same value of the confusion coefficient variance (CCV). This ensures that all S-boxes in a class have the same “theoretical” resistance against power attacks, based on this metric.
None of the known theoretical metrics of resistance against Power Attacks is exact, nor is the confusion coefficient variance (CCV), therefore, the actual resistance against these attacks is “approximately” constant within the class.
Other cryptographic properties are not constant within each class, since they were not taken into account for the definition of these classes. For example, nonlinearity can take different values for S-boxes that belong to the same Hamming weight class.
2.
Movement between classes and within classes.
Movement within each class: Given an S-box F a , to obtain another S-box F b of the same class, it is necessary and sufficient to swap between two elements of the output of F a that have the same Hamming weight. The swap can be generalized between several pairs of elements, as long as the two elements of each pair have the same weight, which can be different between the pairs.
Movement between different classes: Given an S-box F a , to obtain another S-box F b belonging to a different class, it is necessary and sufficient to perform the swap between two elements of the output that have different Hamming weights.
3.
Number of classes.
The number of classes and the number of S-boxes in each class are estimated in this work (by two different ways) for any n, by means of Propositions 5 and 6.
The number of classes is exponentially less than the number of S-boxes.
For n = 3 , in Partition of the 3 × 3S-box space into equivalence classes, the list of the 1120 HW classes is given.

3.8. Quantifying the Search-Space Reduction Achieved Using the Partition into HW Classes Instead of Searching by S-Boxes

In previous sections, a new partition in equivalence classes is proposed for the S-boxes of n × n , denoted as a partition in Hamming weight (HW) classes. According to the Hamming weight model, all S-boxes in an HW class have the same hypothetical power leakage. According to the CCV metric, we experimentally verified that all S-boxes of a class have the same theoretical resistance to power attacks. Based on this result, we propose a new strategy consisting of going through the class space and not the S-box space, and we argue that this reduces the search space, when the search is performed from class to class.
In this section, for the S-boxes of n × n , we obtain the expression of the exact number of Hamming weight classes and the number of S-boxes within each class. Using this expression, we quantify the reduction in the search space associated with this new strategy. In particular, it is shown that, as n increases, the number of classes represents an increasingly smaller proportion of the number of S-boxes. For n = 3 , 4 , 5 , 6 , 7 , 8 , we calculate the total number of classes, the number of S-boxes per class and the reduction achieved in the search space when going through the class space HW and not the space of S-boxes.

3.8.1. Estimate of the Number of HW Classes and the Number of S-Boxes in Each Class as Permutation with Repetition

Proposition 5
(Calculating the number of HW classes). When the space of ( 2 n ) ! S-boxes of dimension n × n is partitioned into Hamming weight (HW) classes:
(a) 
The total number of HW equivalence classes is: P R 2 n C ( n , 0 ) , , C ( n , n ) = ( 2 n ) ! r = 0 n C ( n , r ) ! .
(b) 
The total number of S-boxes in each HW equivalence class is: r = 0 n C ( n , r ) ! .
Proof. 
The demonstration is direct because the HW classes definition meets that each class is equivalent to a permutation with repetition of 2 n elements grouped into ( n + 1 ) groups, where group r has exactly C ( n , r ) equal elements. Keep in mind that, if the 2 n outputs of the S-boxes { S ( X ) : X = 0 , , 2 n 1 } are grouped by their weights, then the 2 n weights of these outputs { S ( X ) : S ( X ) = 0 , , 2 n 1 } are divided into ( n + 1 ) groups corresponding to the ( n + 1 ) different values r = 0 , , n , which can take their weights { S ( X ) = r : r = 0 , , n } . The essential observation is that classes are defined by the permutations of the positions occupied by the ( n + 1 ) groups. In turn, within a class, the S-boxes are determined by the permutation of the groups’ elements.
In group r, there are C ( n , r ) elements (the ways of locating r ones in a binary vector of length n), corresponding to outputs of the S-box whose weights are equal to r. It is important to note that the order is not crucial in each group because all the weights are equal to r (indistinguishable elements). However, the order is essential between groups because they correspond to different weights (distinguishable elements). Therefore, to find the number of HW classes of the S-boxes of n × n , we directly applied the formula P R 2 n C ( n , 0 ) , , C ( n , n ) which calculates the number of permutations with repetition. From here (a) follows.
Given that in group r, there are precise C ( n , r ) elements equal to r; then, they can be permuted in ( C ( n , r ) ) ! ways. In general, we can permute the elements within the groups in r = 0 n C ( n , r ) ! , which corresponds to the number of S-boxes within a class, demonstrating the statement in (b). □
We now dwell in an interpretation of Proposition 5. Notice that the numerator ( 2 n ) ! corresponds to the total number of S-boxes of n × n , while the denominator r = 0 n C ( n , r ) ! is the number of S-boxes within a class and its quotient is exactly the number of classes. Although this is an exact expression very appropriate for theoretical analysis, it should be noted that, in practice, for large values of ( 2 n ) and C ( n , r ) , the calculation of their factorials will be approximate, using the Stirling formula. The following Corollary will be very useful to quantify the reduction of the search space.
Corollary 1.
The number of HW classes among the number of S-boxes of n × n is equal to:
N u m b e r o f H W c l a s s e s N u m b e r o f S - b o x e s o f n × n = P R 2 n C ( n , 0 ) , , C ( n , n ) ( 2 n ) ! = 1 r = 0 n C ( n , r ) ! .
Proof. 
Using Proposition 5, P R 2 n C ( n , 0 ) , , C ( n , n ) = ( 2 n ) ! r = 0 n C ( n , r ) !
N u m b e r o f H W c l a s s e s N u m b e r o f S - boxes o f n × n = P R 2 n C ( n , 0 ) , , C ( n , n ) ( 2 n ) ! = ( 2 n ) ! r = 0 n C ( n , r ) ! ( 2 n ) ! = 1 r = 0 n C ( n , r ) ! .

3.8.2. Reduced Search-Space

The corollary above provides an inverse measure of the reduction in search space achieved by replacing the S-boxes path with the path over the HW classes. It tells us what fraction of the initial space of S-boxes is reduced by HW’s classes space. The lower the value of 1 r = 0 n C ( n , r ) = 1 r = 1 n 1 C ( n , r ) , the more significant the reduction achieved when going through the classes and not the S-boxes.
Now, we discuss the reduction speed as a function of n. Note that as n increases, the value r = 0 n C ( n , r ) ! grows very quickly and 1 r = 0 n C ( n , r ) ! decreases very rapidly. Note that
lim n N u m b e r o f H W c l a s s e s N u m b e r o f S b o x e s o f n × n = lim n ( 1 r = 0 n C ( n , r ) ! ) = 0 .
The above expression shows that as n increases, the class space’s dimension becomes an ever-smaller fraction of the S-box space. This fraction decreases very rapidly as n grows.

3.8.3. Examples of the Number of HW Classes, the Number of S-Boxes per Class and the Reduction in Search-Space Achieved with the New Proposed Strategy

In this subsection, we illustrate the previous proposition’s application to estimate the search space reduction using some examples (see Table 3).
We next discuss some observations on the data shown in Table 3. With respect to the dimension of the class space, notice how for n = 3 , 4 , 5 , 6 , 7 , 8 the dimension of the class space is, respectively, equal to 10 1 , 10 6 , 10 17 , 10 43 , 10 52 and 10 316 , i.e., for each part of the initial space of S-boxes, there is a smaller and smaller fraction of the initial space. Note that, for n = 3 , 4 , 5 , 6 , 7 , the number of classes is greater than the class’s cardinal, while, for n = 8 , the number of classes is less than the class’s cardinal.
On the exponential reduction of space, for n = 8 , the dimension of the class space is approximately 10 316 times less than the initial space of S-boxes. Therefore, when applying the proposed strategy of moving from class to class and not from S-box to S-box, the reduction of the search space is of the order 10 316 . Importantly, by rejecting a class for having a low CCV value, one is simultaneously rejecting approximately ∼ 10 316 S-boxes. On the other hand, accepting a class, due to having a high value of CCV, there are approximately 10 316 S-boxes among which to look for some that meet the remaining cryptographic properties.
Now, relating the comparison of S-box space partitions, consider the case n = 4 . In [5], for n = 4 , the bijective S-box space is partitioned into classes considering the resistance to differential and linear cryptanalysis. In this work, the space of S-boxes is divided into HW classes according to their theoretical resistance to power attacks, according to the CV metric. It would be very interesting to compare both partitions, which is left for future work.
With respect to all S-boxes in a 3 × 3 class, consider the following. For the 3 × 3 S-box of the PRINT cryptographic algorithm [28], the 36 equivalent S-boxes were generated. They are shown in the Appendix. It is observed how the necessary condition given in Proposition 4 is fulfilled. The preimages of 0 and 7 = 2 3 1 are constant within the class: F a 1 ( 0 ) = F b 1 ( 0 ) = 0 and F a 1 ( 7 ) = F b 1 ( 7 ) = 4 , F b < F a > . The 1120 HW equivalence classes were constructed.

3.8.4. Estimation of the Number of HW classes and the Number of S-boxes in Each Class as an Occupation Problem

The following proposition provides another alternative way of calculating the number of classes and the number of S-boxes per class.
Proposition 6
(Calculating the S-box number within each HW class). When we partition the space of ( 2 n ) ! S-boxes of dimension n × n , into Hamming weight (HW) classes, then the following hold:
(a) 
The number of “ H a m m i n g W e i g h t ” equivalence classes is equal to:
N H W = 2 n r = 1 n C 2 n i = 0 r 1 C ( n , i ) , C ( n , r )
(b) 
The number of S-boxes within each HW equivalence class is exactly equal to:
N S = ( 2 n ) ! 2 n r = 1 n C 2 n i = 0 r 1 C ( n , i ) , C ( n , r )
Proof. 
The demonstration of Statement (a) is based on modeling the construction of the classes using an occupation problem, with successive dependent launches. It is taken into account that the 2 n weights { S ( X ) : S ( X ) = 0 , , 2 n 1 } of the outputs of the S-boxes can be divided into ( n + 1 ) groups corresponding to the ( n + 1 ) different values { r : r = 0 , , n } that can take their weights { S ( X ) = r : r = 0 , , n } , where the group r contains exactly C ( n , r ) equal elements. The essential observation is that each class corresponds to a different location of the ( n + 1 ) weight groups in the 2 n places. Without loss of generality, it can be assumed that the groups are located in increasing order of the value of r.
The first group corresponds to the weight r = 0 , containing C ( n , 0 ) = 1 , only one element and can be located in any of the C ( 2 n , 1 ) = 2 n possible places. For the remaining groups r = 1 , , ( n 1 ) , the reduction in the number of available places caused by the location of the previous groups must be taken into account, as discussed below.
In general, to locate the C ( n , r ) elements of the rth group, for r = 1 , , ( n 1 ) , there are exactly 2 n i = 0 r 1 C ( n , i ) available places, since the i = 0 r 1 C ( n , i ) places occupied by the previous groups are subtracted from the 2 n starting places. The selection of those C ( n , r ) positions among the available 2 n i = 0 r 1 C ( n , i ) can be done in C 2 n i = 0 r 1 C ( n , i ) , C ( n , r ) forms. Therefore, the total number of ways to locate the ( n + 1 ) weight groups in the 2 n places is equal to 2 n r = 1 n C ( 2 n i = 0 r 1 C ( n , i ) , C ( n , r ) ) , which is exactly the number of HW classes.
Now, we turn to Statement (b). By dividing the total number ( 2 n ) ! of S-boxes of n × n between the number of classes, ( 2 n ) r = 1 n C ( 2 n i = 0 r 1 C ( n , i ) , C ( n , r ) ) calculated for Statement (a), it is obtained that the number of S-boxes inside each class is
N S = ( 2 n ) ! 2 n r = 1 n C ( 2 n i = 0 r 1 C ( n , i ) , C ( n , r ) ) .

3.9. Examples Using Proposition 6

In this subsection, we present some examples derived from Proposition 6.
Example 6.
Let n = 3 . The number of classes is equal to
2 n r = 1 n C ( 2 n i = 0 r 1 C ( n , i ) , C ( n , r ) ) = 2 3 r = 1 3 C ( 2 3 i = 0 r 1 C ( 3 , i ) , C ( 3 , r ) )
= 8 C ( 8 1 , 3 ) C ( 7 3 , 3 ) C ( 4 3 , 1 ) = 8 C ( 7 , 3 ) C ( 4 , 3 ) C ( 1 , 1 ) = 8 ( 35 ) ( 4 ) ( 1 ) = 1120 H W c l a s s e s o f 3 × 3 .
This example illustrates the calculation of the number of HW classes by Proposition 6, according to which there are 1120 classes. This statement was tested experimentally and the 1120 classes obtained are shown in the Appendix C (see Table A5).
Example 7.
For n = 8 , ( 2 n ) ! = ( 256 ) ! 10 506 by F. Stirling (see Table 4). This example illustrates the difficulty in calculating the number of S-boxes even for small values of n ( n = 8 ) if it is necessary and convenient to use the Stirling formula.
Finally, we establish a comparison of the number of classes estimated by Propositions 5 and 6. For n = 3 , it is observed that both values coincide ( 1120 H W c l a s s e s o f 3 × 3 ) , as expected since they are exact calculations. For n = 8 , the Stirling formula was used in both cases to approximate different factorials, so there may be differences between the two estimates (see Table 5). The difference between both estimates is of the order 10 2 . It can be considered acceptable, given the dimensions of the spaces being estimated. This comparison can be improved using the refinement of the Stirling formula.

4. Conclusions

The main results of the present work are the proposal of a new equivalence relationship between S-boxes and their application to exponentially reduce the search space for nonlinear S-boxes and resistance to power attacks, when the search is performed from class to class.
This result provides new theoretical knowledge about the internal structure of the bijective S-box space and its partition into equivalence classes according to its resistance to power attacks. As far as we know, there are no previous reports of results of this type
New equivalence classes: This paper proposes a new definition of equivalence classes to relate S-boxes according to their power leak following the Hamming weight model (HW equivalence). A new algorithm is presented, which randomly generates an S-box HW equivalent to the initial one, given an initial S-box of input. Three variants of different complexity are proposed to apply this algorithm. It was demonstrated that the metric “variance of the confusion coefficient (CCV)” that theoretically measures the resistance of an S-box against power attacks takes constant values within the HW classes. This result was confirmed experimentally (using the previous algorithm) for four S-boxes classes, corresponding to the S-boxes of the AESCC, SCREAM, AES and STRIBOG algorithms.
Exponential reduction of the search space: Based on these new HW equivalence classes, a new strategy was proposed to search for S-boxes resistant to power attacks, essentially consisting of moving in the class space and not in the S-box space, changing of classes as long as the CCV value is low. When a high CCV class is found, the S-boxes inside the class are scanned to evaluate the remaining cryptographic properties of the S-boxes, such as nonlinearity. An advantage of this strategy is that it is easily applied because, to change classes, it is enough to swap at least two elements of different hamming weights, while, to change S-boxes within the class, it is enough to swap at least two elements of equal weight. The main advantage of this strategy is that it allows an exponential reduction of the search space. The cardinal of the class space was calculated using two different methods. Its comparison with the cardinal of the space of S-boxes shows that, as n increases, the class space represents a smaller and smaller fraction of the space of S-boxes. For n = 8 , this reduction reaches the order of 10 316 . This result was confirmed experimentally for n = 3 .
In future work, we will investigate the probability distribution of other S-box cryptographic properties within these new HW classes and how to use these distributions to improve the effectiveness or efficiency of searching for S-boxes that are not linear with a high value of CCV. On the other hand, although all S-boxes in a class have the same CCV value, we will investigate different HW classes with the same CCV value and the conditions that these classes must meet. Future studies will investigate whether the increase in the number of permuted elements influences the search’s effectiveness. If positive, the optimal number of elements to be exchanged must be determined, considering the compromise between effectiveness and efficiency. In this work, the space of S-boxes was divided into HW classes according to their theoretical resistance to power attacks, according to the CCV metric. For n = 4 , it would be interesting to compare with the partition of G. Leander and A. Poschmann [5], which is left proposed.

Author Contributions

Conceptualization, C.M.L.-P.; methodology, G.S.-G. and C.M.L.-P.; Data curation, R.S.-M. and Y.B.-L.; validation, R.S.-M. and Y.B.-L.; formal analysis, G.S.-G., O.R. and C.M.L.-P.; investigation, G.S.-G. and C.M.L.-P.; writing—original draft preparation, O.R., D.M.-M. and I.M.-D.; writing—review and editing, G.S.-G., O.R. and C.M.L.-P.; and supervision, C.M.L.-P. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A Example S-Box 4×4 Equivalent to the PRESENT Cipher S-Box from Its HW Class

Table A1. PRESENT S-box Hamming weight class.
Table A1. PRESENT S-box Hamming weight class.
0123
02223
12023
22341
31311
Table A2. S-box 4 × 4 equivalent to the PRESENT cipher S-box from its HW class.
Table A2. S-box 4 × 4 equivalent to the PRESENT cipher S-box from its HW class.
0123
0C56B
190AD
23EF8
32714

Appendix B S-Box 8 × 8 Equivalent to the AES Cipher S-Box from Its HW Class

Table A3. Class HW < F A E S > of the S-box of the AES algorithm.
Table A3. Class HW < F A E S > of the S-box of the AES algorithm.
0123456789ABCDEF
04566556421547655
14246644454364342
26743467434554433
31534242432146445
42333454235553552
54406164545643336
63747344336172463
73415353655521864
85235652435653535
92255232236426536
A3342322435433445
B6355454444554551
C5434344446454643
D3554226334553345
E4532454354455427
F3333752324443363
Table A4. S-box F b < F A E S > equivalent to the AES S-box.
Table A4. S-box F b < F A E S > equivalent to the AES S-box.
x0xlx2x3x4x5x6x7x8x9xaxbxcxdxexf
0x63f2777b7c676fc530016b2bfed776ab
lxca82c97dfa5947fOadd4a2af9ca472c0
2xb7fd9326363ff7ce34a5e5fl71d83115
3x04c723c3lb96059a071280e2eb27b275
4x09832clalb6e5aa0523bd6b329e32f84
5x53dl00ed20febl5b6acbbe39la4c59cf
6xdOefaafb434d338545f9027f503c9faa
7x51a3408f929d38fSbeb6da2110fff3d2
8xcd0c13ec5f974417c4a77e3d645d1973
9x60814fde222a908946eeb814de5e0bdb
axe0323a0a4906245ec2d3ac629195e479
bxe7c9376d8dd54ea96c56f4ea657aae08
exba78252elea6b4c6e8dd74lf4bbd8b9a
dx703eb5664b03f60e613557b986elld9e
exelf89b1169d9be949ble87e9ce552bdf
fxbeal890db fe6426941992d0fb054bb16
This S-box was obtained from the AES S-box by exchanging three pairs of equal weight elements within each pair. In this particular case, in all pairs, the permuted elements were of weight 5, as can be seen in Table A5 for class < F A E S > . The pairs of permuted elements are: (7c, f2), (6b, 67), and (ab, 76). These elements are located in Row 1 and Columns (1,4), (5, a), and (e, f).

Appendix C

  • Construction, by columns, of the 36 equivalent S-boxes from the HW class < F P r i n t > of the PRINT cipher’s S-box F P r i n t . All of them have C C V = 0.275510 .
    Let the S-box be F P r i n t of the PRINT cipher’s (Example 3).
    Column12345678
    Input x to the
    S-box F P r i n t
    01234567
    Output
    F P r i n t ( x )
    01367452
    Hamming weight
    of the output
    01223121
    The < F P r i n t > class can be represented directly by the output weight vector: < F P r i n t > = ( H W ( F P r i n t ( 0 ) ) , , H W ( F P r i n t ( 7 ) ) = ( 0 , 1 , 2 , 2 , 3 , 1 , 2 , 1 ) , of the last row; however, for the construction of the class, it is more convenient to use the representation through the sets { C ( F P r i n t ) k : k = 0 , 1 , 2 , 3 } = { I n p u t s x w h o s e o u t p u t F P r i n t ( x ) h a s ; w e i g h t H W ( F P r i n t ( x ) ) = k } .
    Class construction:
    Column 1: C ( F P r i n t ) 0 = { 0 } Input 0 with output 0 of weight 0. Taking into account that, for the weight k = 0 , the set C ( F P r i n t ) 0 = { 0 } has cardinal one, its elements cannot be permuted with each other, therefore all the S-boxes F b of the < F P r i n t > class satisfy that F b ( 0 ) = 0 (Proposition 4).
    Column 5: C ( F P r i n t ) 3 = { 4 } . Input 4, with output 7 of weight 3. Analogously for the weight k = 3 , the set C ( F P r i n t ) 3 = { 4 } has cardinal one and its elements cannot be permuted with each other; therefore, all S-boxes F b of the < F P r i n t > class satisfy that F b ( 4 ) = 7 (Proposition 4).
    Columns 2, 6, and 8: C ( F P r i n t ) 1 = { 1 , 5 , 7 } . 1 , 5 , 7 inputs with 1 , 4 , 2 outputs of weight 1. The three outputs 1 , 4 , 2 can be interchanged { ( 1 , 2 , 4 ) , ( 1 , 4 , 2 ) , ( 2 , 1 , 4 ) , ( 2 , 4 , 1 ) , ( 4 , 1 , 2 ) , ( 4 , 2 , 1 ) } in Columns 2 , 6 , 8 , without altering the weight of the outputs, and therefore the hypothetical leakage of the S-box is not altered according to the Hamming weight leakage model.
    Columns 3, 4, and 7: C ( F P r i n t ) 2 = { 2 , 3 , 6 } . Inputs 2 , 3 , 6 with outputs 3 , 6 , 5 of weight 2.
    The three outputs 3 , 6 , 5 can be interchanged { ( 3 , 5 , 6 ) , ( 3 , 6 , 5 ) , ( 5 , 3 , 6 ) , ( 5 , 6 , 3 ) , ( 6 , 3 , 5 ) , ( 6 , 5 , 3 ) } in Columns 3 , 4 , 7 without altering the weight of the outputs and therefore the hypothetical leakage of the S-box according to the Hamming weight leak model is not altered.
    Cartesian product of the two sets of permutations: By making the Cartesian product of the two sets of six permutations each { ( 1 , 4 , 2 ) , ( 1 , 2 , 4 ) , ( 4 , 1 , 2 ) , ( 4 , 2 , 1 ) , ( 2 , 1 , 4 ) , ( 2 , 4 , 1 ) } in Columns 2 , 6 , 8 and { ( 3 , 6 , 5 ) , ( 3 , 5 , 6 ) , ( 5 , 3 , 6 ) , ( 5 , 6 , 3 ) , ( 6 , 3 , 5 ) , ( 6 , 5 , 3 ) } in Columns 3 , 4 , 7 , keeping Columns 1 and 5 fixed, the 36 S-boxes of the < F P r i n t > class are obtained. Due to their construction, the 36 S-boxes have the same hypothetical leakage according to the. “Hamming weight” leakage model.
    The 36 S-boxes of this class are shown below (some rows are left blank to visualize the Cartesian product better).
Table A5. The 36 S-boxes equivalent to F P r i n t and the 1120 HW classes of 3 × 3 .
Table A5. The 36 S-boxes equivalent to F P r i n t and the 1120 HW classes of 3 × 3 .
Row/Column12345678
Input x to the S-box01234567
F 1 = F P r i n t S-box01367452
S-box equiv. F201357462
S-box equiv.F301537462
S-box equiv.F401567432
S-box equiv.F501637452
S-box equiv.F601657432
S-box equiv.F701367254
S-box equiv.F801357264
S-box equiv.F901537264
S-box equiv.F1001567234
S-box equiv.F1101637254
S-box equiv.F1201657234
S-box equiv.F1304367152
S-box equiv.F1404357162
S-box equiv.F1504537162
S-box equiv.F1604567132
S-box equiv.F1704637152
S-box equiv.F1804657132
S-box equiv.F1904367251
S-box equiv.F2004357261
S-box equiv.F2104537261
S-box equiv.F2204567231
S-box equiv.F2304637251
S-box equiv.F2404657231
S-box equiv.F2502367154
S-box equiv.F2602357164
S-box equiv.F2702537164
S-box equiv.F2802567134
S-box equiv.F2902637154
S-box equiv.F3002657134
S-box equiv.F3102367451
S-box equiv.F3202357461
S-box equiv.F3302537461
S-box equiv.F3402567431
S-box equiv.F3502637451
S-box equiv.F3602657431
  • All 3 × 3 classes. For n = 3 , the 1120 HW equivalence classes were constructed. They can be seen by consulting the link:

References

  1. Avanzi, R. A Salad of Block Ciphers. The State of the Art in Block Ciphers and Their Analysis; IACR: Lyon, France, 2017. [Google Scholar]
  2. Kryszczuk, K. Springer Encyclopedia of Cryptography and Security; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2014. [Google Scholar]
  3. Mihailescu, M.I.; Nita, S.L. Linear and Differential Cryptanalysis. In Pro Cryptography and Cryptanalysis; Springer: Berlin/Heidelberg, Germany, 2021; pp. 457–481. [Google Scholar]
  4. Biryukov, A.; De Cannière, C.; Braeken, A.; Preneel, B.A. A toolbox for cryptanalysis: Linear and affine equivalence algorithms. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2003; Volume 2656, pp. 33–50. [Google Scholar] [CrossRef] [Green Version]
  5. Leander, G.; Poschmann, A. On the classification of 4 bit S-boxes. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2007; Volume 4547 LNCS, pp. 159–176. [Google Scholar] [CrossRef]
  6. Nyberg, K. On the construction of highly nonlinear permutations. In Workshop on the Theory and Application of of Cryptographic Techniques; Springer: Berlin/Heidelberg, Germany, 1992; pp. 92–98. [Google Scholar]
  7. Ramamoorthy, V.; Silaghi, M.C.; Matsui, T.; Hirayama, K.; Yokoo, M. The design of cryptographic S-Boxes using CSPs. In Proceedings of the International Conference on Principles and Practice of Constraint Programming, Perugia, Italy, 12–16 September 2011; Springer: Berlin/Heidelberg, Germany, 2011; pp. 54–68. [Google Scholar]
  8. Picek, S. Applications Of Evolutionary Computation to Cryptology. J. Chem. Inf. Model. 2015, 53, 1689–1699. [Google Scholar] [CrossRef]
  9. Picek, S.; Ege, B.; Papagiannopoulos, K.; Batina, L.; Jakobović, D. Optimality and beyond: The case of 4 × 4 S-boxes. In Proceedings of the 2014 IEEE International Symposium on Hardware-Oriented Security and Trust, HOST, Arlington, VA, USA, 6–7 May 2014; pp. 80–83. [Google Scholar] [CrossRef]
  10. Prouff, E. DPA attacks and S-boxes. In Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2005; Volume 3557, pp. 424–441. [Google Scholar] [CrossRef] [Green Version]
  11. Gupta, D.; Tripathy, S.; Mazumdar, B. Correlation Power Analysis of KASUMI and Power Resilience Analysis of Some Equivalence Classes of KASUMI S-Boxes. J. Hardw. Syst. Secur. 2020, 4, 297–313. [Google Scholar] [CrossRef]
  12. Carlet, C.; Heuser, A.; Picek, S. Trade-offs for S-boxes: Cryptographic properties and side-channel resilience. In Proceedings of the International Conference on Applied Cryptography and Network Security, Kanazawa, Japan, 10–12 July 2017; Springer: Berlin/Heidelberg, Germany, 2017; pp. 393–414. [Google Scholar] [CrossRef]
  13. Chakraborty, K.; Sarkar, S.; Maitra, S.; Mazumdar, B.; Mukhopadhyay, D.; Prouff, E. Redefining the transparency order. Des. Codes Cryptogr. 2017, 82, 95–115. [Google Scholar] [CrossRef] [Green Version]
  14. Li, H.; Zhou, Y.; Ming, J.; Yang, G.; Jin, C. The Notion of Transparency Order, Revisited. Comput. J. 2020. [Google Scholar] [CrossRef]
  15. Picek, S.; Papagiannopoulos, K.; Ege, B.; Batina, L.; Jakobovic, D. Confused by confusion: Systematic evaluation of DPA resistance of various S-boxes. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2014; Volume 8885, pp. 374–390. [Google Scholar] [CrossRef] [Green Version]
  16. Freyre-Echevarría, A.; Martínez-Díaz, I.; Legón-Pérez, C.M.; Sosa-Gómez, G.; Rojas, O. Evolving Nonlinear S-Boxes With Improved Theoretical Resilience to Power Attacks. IEEE Access 2020, 8, 202728–202737. [Google Scholar] [CrossRef]
  17. Xu, Y.; Wang, Q. Searching for Balanced S-Boxes with High Nonlinearity, Low Differential Uniformity, and Improved DPA-Resistance. In Proceedings of the International Conference on Information Security, Bali, Indonesia, 16–18 December 2020; Springer: Berlin/Heidelberg, Germany; pp. 95–106. [Google Scholar]
  18. Ng, J.S.; Chen, J.; Kyaw, N.A.; Lwin, N.K.Z.; Ho, W.G.; Chong, K.S.; Gwee, B.H. A Highly Efficient Power Model for Correlation Power Analysis (CPA) of Pipelined Advanced Encryption Standard (AES). In Proceedings of the 2020 IEEE International Symposium on Circuits and Systems (ISCAS), Seville, Spain, 10–21 October 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 1–5. [Google Scholar]
  19. Carlet, C. Vectorial Boolean Functions for Cryptography. In Boolean Models and Methods in Mathematics, Computer Science, and Engineering; Crama, Y., Hammer, P.L., Eds.; Cambridge University Press: Cambridge, UK, 2013; pp. 398–470. [Google Scholar] [CrossRef] [Green Version]
  20. Brier, E.; Clavier, C.; Olivier, F. Correlation power analysis with a leakage model. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2004; Volume 3156, pp. 16–29. [Google Scholar] [CrossRef] [Green Version]
  21. Fei, Y.; Luo, Q.; Ding, A.A. A statistical model for DPA with novel algorithmic confusion analysis. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2012; Volume 7428 LNCS, pp. 233–250. [Google Scholar] [CrossRef] [Green Version]
  22. Fei, Y.; Ding, A.A.; Lao, J.; Zhang, L. A Statistics-based Fundamental Model for Side-channel Attack Analysis. IACR Cryptol. EPrint Arch. 2014, 2014, 152. [Google Scholar]
  23. Heuser, A.; Rioul, O.; Guilley, S. A theoretical study of Kolmogorov-Smirnov distinguishers. In Proceedings of the International Workshop on Constructive Side-Channel Analysis and Secure Design, Paris, France, 13–15 April 2014; Springer: Berlin/Heidelberg, Germany, 2014; pp. 9–28. [Google Scholar]
  24. Feller, W. An Introduction to Probability Theory and its Applications; John Wiley & Sons: Hoboken, NJ, USA, 2008; Volume 2. [Google Scholar]
  25. Veshchikov, N. SILK: High Level of Abstraction Leakage Simulator for Side Channel Analysis; ACM International Conference Proceeding Series; ACM: New York, NY, USA, 2014. [Google Scholar] [CrossRef]
  26. Lerman, L.; Markowitch, O.; Veshchikov, N. Comparing Sboxes of ciphers from the perspective of side-channel attacks. In Proceedings of the 2016 IEEE Asian Hardware Oriented Security and Trust Symposium, AsianHOST 2016, Taipei Area, Taiwan, 19–20 December 2016. [Google Scholar] [CrossRef]
  27. De Cannière, C. Analysis and Design of Symmetric Encryption Algorithms. Ph.D. Thesis, KULeuven, Leuven, Belgium, 2007. [Google Scholar]
  28. Knudsen, L.; Leander, G.; Poschmann, A.; Robshaw, M.J. PRINTcipher: A block cipher for IC-printing. In Lecture Notes in Computer Science; Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; Springer: Berlin/Heidelberg, Germany, 2010; Volume 6225 LNCS, pp. 16–32. [Google Scholar] [CrossRef] [Green Version]
Table 2. PRINT S-box F P r i n t ( x ) and its HW class < F P r i n t > .
Table 2. PRINT S-box F P r i n t ( x ) and its HW class < F P r i n t > .
x01234567
F Print ( x ) 01367452
< F Print > 01223121
Table 3. Example for n = 3 , 4 , 5 , 6 , 7 , 8 estimate of the number of S-boxes, number of HW classes, the number of S-boxes per class and the reduction in search space.
Table 3. Example for n = 3 , 4 , 5 , 6 , 7 , 8 estimate of the number of S-boxes, number of HW classes, the number of S-boxes per class and the reduction in search space.
nNumber
( 2 n ) ! of
S-Boxes n × n
Number
PR 2 n C ( n , 0 ) , , C ( n , n )
of HW Classes
r = 0 n C ( n , r ) !
of S-Boxes
in Each Class
1 r = 0 n C ( n , r )
3 8 ! = 40320 10 4 1120∼ 10 3 36∼ 10 1 10 1
4 16 ! 10 13 10 7 10 6 10 6
5 32 ! 10 35 10 18 10 17 10 17
6 64 ! 10 89 10 46 10 43 10 43
7 128 ! 10 215 10 163 10 52 10 52
8256∼ 10 506 10 190 10 316 10 316
Table 4. Number of classes for n = 8 , by Proposition 5.
Table 4. Number of classes for n = 8 , by Proposition 5.
r C 2 n i = 0 r 1 C n , i , C n , r Estimated ValueAccumulated Product
0C(256, 1) = 256 10 2 10 2
1C(256-1, 8) = C(255, 8) 10 15 10 17
2C(255-8, 28) = C(247, 28) 10 37 10 54
3C(255-8, 28) = C(219, 56) 10 54 10 108
4C(219-56, 70) = C(163, 70) 10 47 10 155
5C(163-70, 56) = C(93, 56) 10 27 10 182
6C(93-56, 28) = C(37, 28) 10 9 10 191
7C(37-28, 8) = C(9, 8) = 9 10 1 10 192
8C(9-8, 1) = C(1, 1) = 1 10 0 10 192
# of classesExactly
[ 256 × C ( 255 , 8 ) × C ( 247 , 28 ) ×
C ( 219 , 56 ) × C ( 163 , 70 ) ×
C ( 93 , 56 ) × C ( 37 , 28 ) × 9 ]
Approximately ∼ 10 192
Table 5. n = 8 , number of classes estimated by Propositions 5 and 6.
Table 5. n = 8 , number of classes estimated by Propositions 5 and 6.
Estimated Number of HW
Classes of 8 × 8
Proposition 5 10 190
Proposition 6 10 192
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Legón-Pérez, C.M.; Sánchez-Muiña, R.; Miyares-Moreno, D.; Bardaji-López, Y.; Martínez-Díaz, I.; Rojas, O.; Sosa-Gómez, G. Search-Space Reduction for S-Boxes Resilient to Power Attacks. Appl. Sci. 2021, 11, 4815. https://doi.org/10.3390/app11114815

AMA Style

Legón-Pérez CM, Sánchez-Muiña R, Miyares-Moreno D, Bardaji-López Y, Martínez-Díaz I, Rojas O, Sosa-Gómez G. Search-Space Reduction for S-Boxes Resilient to Power Attacks. Applied Sciences. 2021; 11(11):4815. https://doi.org/10.3390/app11114815

Chicago/Turabian Style

Legón-Pérez, Carlos Miguel, Ricardo Sánchez-Muiña, Dianne Miyares-Moreno, Yasser Bardaji-López, Ismel Martínez-Díaz, Omar Rojas, and Guillermo Sosa-Gómez. 2021. "Search-Space Reduction for S-Boxes Resilient to Power Attacks" Applied Sciences 11, no. 11: 4815. https://doi.org/10.3390/app11114815

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop