A fast calculation method for the branch number of linear diffusion layer based on MILP

By converting the number of branches of the linear diffusion layer into MILP problem and using CPLEX solution, the problem of high computational complexity in the prior art is solved, and the number of branches of the bit-level linear diffusion layer with a width greater than 32 is quickly calculated, which improves the The design and implementation efficiency of cryptographic algorithms.

CN114389791BActive Publication Date: 2024-10-22NO 30 INST OF CHINA ELECTRONIC TECH GRP CORP
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202111571646.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-10-22
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The prior art is difficult to quickly calculate the number of branches of a bit-level linear diffusion layer with a width greater than 32, resulting in high computational complexity and inability to solve within acceptable time, affecting the design and implementation of cryptographic algorithms.

Method used

The branch count calculation problem of the linear diffusion layer is transformed into a mixed integer linear programming (MILP) problem, a MILP model is established, and the linear programming solver CPLEX is used to quickly calculate the branch count through linear inequality.

Benefits of technology

Solve the number of branches of a linear diffusion layer with a width greater than 32 in a short time, which improves the efficiency and implementation performance of cryptographic algorithm design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114389791B_ABST
    Figure CN114389791B_ABST
Patent Text Reader

Abstract

The present invention provides a method for quickly calculating the number of branches of a linear diffusion layer based on MILP, comprising the following processes: step 1, converting the problem of calculating the number of branches of a linear diffusion layer into a MILP problem; step 2, establishing a MILP model based on the MILP problem, and using a linear programming solver to solve the problem to obtain the number of branches of the linear diffusion layer; wherein, in the MILP model, the propagation behavior of the differential and linear in the linear diffusion layer is characterized by a linear inequality. The method for quickly calculating the number of branches of a linear diffusion layer proposed by the present invention can solve the number of branches of a linear diffusion layer with a width greater than 32 in a relatively short time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of cryptographic algorithms, and in particular to a method for quickly calculating the number of linear diffusion layer branches based on MILP. Background Art

[0002] In the prior art, a block cipher algorithm usually has a confusion layer and a diffusion layer. The confusion layer is generally composed of a number of m×m S-boxes placed in parallel. For example, the confusion layer of the AES algorithm is composed of 16 8×8 S-boxes placed in parallel, and the confusion layer of the Camellia algorithm is composed of 8 8×8 S-boxes placed in parallel. The output m bits of an S-box are only related to its input m bits, and have nothing to do with the inputs of other S-boxes. The role of the diffusion layer is to shuffle and mix the outputs of these S-boxes so that the output m bits are as relevant as possible to the inputs of other S-boxes.

[0003] The diffusion layer is usually implemented by a linear transformation θ. If the confusion layer is composed of n m×m S-boxes, then θ can be regarded as A transformation of

[0004] Definition of the number of branches in the diffusion layer:

[0005] make x→θ(x)=y is a transformation, Then it is called:

[0006]

[0007] is the number of branches of θ. b (x) represents non-zero x i The number of (1≤i≤n) is called the packet weight of x. Usually, when the size of the S-box is 8 bits, x i When x is one byte and the size of the S box is 4 bits, i is a nibble. i Collectively referred to as a character block.

[0008] The concept of branch number is closely related to differential analysis and linear cryptanalysis. It can be used to give a bound on the number of active S-boxes of a block cipher and further quantify the resistance of a block cipher to differential cryptanalysis and linear cryptanalysis. For differential cryptanalysis and linear cryptanalysis, the differential branch number B of θ is similarly defined as d (θ) and the number of linear branches B l (θ):

[0009]

[0010]

[0011] For any linear transformation θ, since Therefore, the number of differential branches and the number of branches are consistent and the calculation method is the same.

[0012] If we linearly transform Expressed in matrix form, θ(x) = x·M, then θ(x)·β t = x·M·β t =x·(β·M t ) t , if and only if α=β·M t ;

[0013] So for the linear transformation θ(x) = x·M, the number of linear branches can be expressed as:

[0014]

[0015] That is, the number of linear branches of the linear transformation θ(x) = x·M is equal to λ(x) = x·M t , so when the linear transformation matrix M is a symmetric matrix, that is, M = M t When , the number of linear branches is equal to the number of differential branches.

[0016] For transformation The concept of branch number reflects the quality of θ diffusion. The larger the branch number, the better the θ diffusion effect. Therefore, the safety design indicator of the diffusion layer is to have as large a branch number as possible.

[0017] For any input x, we have ω b (θ(x))≤n, and we can always choose an input with a Hamming weight of 1. Therefore, the maximum number of branches of the diffusion layer θ can reach n+1. When the number of differential branches of the linear transformation reaches the maximum, it can be proved that its number of linear branches reaches the maximum. The transformation θ with the number of differential branches and linear branches reaching n+1 is called the optimal diffusion transformation. Using the knowledge of error correction codes, many optimal diffusion transformations can be constructed, such as the linear diffusion layer of the AES algorithm, which is The number of branches reaches 5. However, considering the implementation performance, the diffusion layer of some cryptographic algorithms adopts linear transformation on the 2-tuple domain, such as Camellia and ARIA algorithms. Although the number of branches cannot reach the maximum value n+1, it also reaches the maximum value achieved by the linear transformation on the byte-oriented 2-tuple domain. For example, the diffusion layer of Camellia can be represented as an 8×8 matrix on the 2-tuple domain, and its number of branches is 5. The diffusion layer of ARIA can be represented as a 16×16 matrix on the 2-tuple domain, and its number of branches is 8.

[0018] The linear diffusion layers discussed above are all block-oriented, while some cryptographic algorithms use bit-level diffusion layers, such as the diffusion layers of SMS4 and Dblock algorithms. Taking the SMS4 algorithm as an example, the linear diffusion layer is:

[0019]

[0020] If x is a 32-bit word, The number of branches of the transformation is 5. The calculation of the number of branches can be directly traversed and calculated in the defined way, and the calculation complexity is O(2 32 ). When the linear diffusion layer When the width is large, that is, when n×m ≥ 32, the traversal and calculation of the number of branches will become very slow according to the definition, and the computational complexity is O(2 n×m ). For example, when the linear diffusion layer of SMS4 is expanded to 64 bits, a bit-level linear diffusion layer is constructed as follows:

[0021]

[0022]

[0023] That is, x is 64 bits, and θ is regarded as When the linear diffusion layer is used, the complexity of traversing and calculating the number of branches is O(2 64 ), the number of branches cannot be calculated within an acceptable time using current computing resources. The efficiency of hardware and software implementation of this type of permutation is very fast. If the number of branches can be guaranteed, it can undoubtedly be used as a linear diffusion layer with good properties in the block cipher algorithm.

[0024] In addition, for example, the linear diffusion layer L64 used in the commercial cryptography competition algorithm SMBA is also bit-level The designer uses some properties of the permutation to ensure that its number of branches reaches 6, but the definition still cannot calculate its number of branches, and the computational complexity is O(2 64 ), if there is a method to quickly calculate the number of branches of a linear diffusion layer with a larger width, it will make the design of the linear diffusion layer of the block cipher much easier. Summary of the invention

[0025] Aiming at the problem that the number of branches of a bit-level linear diffusion layer with a width greater than 32 is difficult to calculate, a method for fast calculation of the number of branches of a linear diffusion layer based on MILP is provided. The essence of this method is to transform the calculation problem of the differential branch number and the linear branch number of the linear diffusion layer into a MILP problem. After establishing the MILP model, the linear programming solver CPLEX is called to solve it. The number of branches of a linear diffusion layer with a width greater than 32 can be solved in a relatively short time.

[0026] The technical solution adopted by the present invention is as follows: a method for quickly calculating the number of branches of a linear diffusion layer based on MILP, comprising the following process:

[0027] Step 1, transform the linear diffusion layer branch number calculation problem into a MILP problem;

[0028] Step 2: Establish a MILP model based on the MILP problem, and use a linear programming solver to solve it to obtain the number of branches in the linear diffusion layer;

[0029] In the MILP model, the differential and linear propagation behaviors in the linear diffusion layer are characterized by linear inequalities.

[0030] Furthermore, the specific process of establishing the MILP model in step 2 is as follows:

[0031] Step 2.1, taking the minimum number of non-zero blocks of the input and output of the linear diffusion layer as the objective function of the MILP problem;

[0032] Step 2.2, establishing constraints between each word block and the corresponding bit in the linear diffusion layer;

[0033] Step 2.3, the linear propagation relationship and differential propagation relationship of XOR, branching, and shifting between bits in the linear diffusion layer are equivalently described by the linear inequality of MILP;

[0034] Step 2.4: Complete the MILP model construction.

[0035] Furthermore, the constraint conditions in step 2.2 include: the input bit of the linear diffusion layer is non-zero; when any bit in each word block of the input and output linear diffusion layer is non-zero, the corresponding word block value is non-zero; when all bits in each word block of the input and output linear diffusion layer are zero, the value of the corresponding word block is zero.

[0036] Furthermore, in step 2.3, the differential propagation relationship of XOR adopts the following inequality constraint:

[0037]

[0038] In the linear diffusion layer, x→θ(x)=y, which is Transformation, x and y are the input and output of the linear diffusion layer respectively;

[0039]

[0040]

[0041]

[0042]

[0043] Among them, x i ,y i For blocks, x im ,y im For bits.

[0044] Furthermore, in step 2.3, the linear propagation relationship of XOR adopts the following inequality constraint:

[0045] x=y=z

[0046] Furthermore, in step 2.3, the differential propagation relationship of the branch adopts the following inequality constraint:

[0047] x=y=z

[0048] Furthermore, in step 2.3, the linear propagation relationship of the branch adopts the following inequality constraint:

[0049]

[0050] Compared with the prior art, the beneficial effect of adopting the above technical solution is that the method proposed by the present invention can solve the number of branches of the linear diffusion layer with a width greater than 32 in a relatively short time. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 This is a flow chart of the method for quickly calculating the number of linear diffusion layer branches based on MILP proposed by the present invention.

[0052] Figure 2 FIG. 4 is a model diagram of a linear diffusion layer in one embodiment of the present invention.

[0053] Figure 3 FIG. 4 is a diagram of an XOR operation in one embodiment of the present invention.

[0054] Figure 4 This is a branch operation diagram in one embodiment of the present invention.

[0055] Figure 5 It is a linear diffusion layer diagram of the SMBA algorithm in one embodiment of the present invention. DETAILED DESCRIPTION

[0056] The present invention is further described below in conjunction with the accompanying drawings.

[0057] like Figure 1 As shown, this embodiment proposes a method for solving the number of branches of a linear diffusion layer with a width greater than 32 in a relatively short time. The specific scheme is as follows:

[0058] A fast calculation method for the number of branches in a linear diffusion layer based on MILP includes the following steps:

[0059] Step 1, transform the linear diffusion layer branch number calculation problem into a MILP problem;

[0060] Step 2: Establish a MILP model based on the MILP problem, and use a linear programming solver to solve it to obtain the number of branches in the linear diffusion layer;

[0061] In the MILP model, the differential and linear propagation behaviors in the linear diffusion layer are characterized by linear inequalities.

[0062] Specifically, the specific process of establishing the MILP model in step 2 is:

[0063] Step 2.1, taking the minimum number of non-zero blocks of input and output of the linear diffusion layer (i.e., the number of branches) as the objective function of the MILP problem;

[0064] Step 2.2, establish constraints between each word block and the corresponding bit of the linear diffusion layer; that is, the input bit of the linear diffusion layer is non-zero; when any bit in each word block of the input and output linear diffusion layer is non-zero, the corresponding word block value is non-zero; when all bits in each word block of the input and output linear diffusion layer are zero, the value of the corresponding word block is zero;

[0065] Step 2.3, the linear propagation relationship and differential propagation relationship of XOR, branching, shifting, etc. between bits in the linear diffusion layer are equivalently described by the linear inequality of MILP;

[0066] Step 2.4: Complete the MILP model construction.

[0067] Specifically, the linear diffusion layer θ in this embodiment is as follows: Figure 2 As shown, x→θ(x)=y, which is The transformation of

[0068]

[0069]

[0070]

[0071]

[0072] x and y are the input and output of the linear diffusion layer respectively. i ,y i For blocks, x ij ,y ij is bits. Block x i ,y i , (1≤i≤n) whether it is zero can be represented by 0 and 1 values, x i ,yi When it is non-zero, it is recorded as 1, x i ,y i When it is zero, it is recorded as 0, and the formula is expressed as:

[0073]

[0074] Each input and output bit x ij ,y ij , (1≤i≤n, 1≤j≤m) are all variables on the binary domain, with values ​​of 0 or 1. When the value of the variable is 0, it means that the input-output difference or linear mask is 0, and when the value is 1, it means that the input-output difference or linear mask is 1, which is called an active bit.

[0075] For the above linear diffusion layer, the branch number calculation method proposed in the present invention is used for calculation, which is as follows:

[0076] Calculating the number of branches in the linear diffusion layer is essentially counting the minimum number of non-zero blocks of input and output of the linear diffusion layer, that is:

[0077] min: {x1+x2+…+x n +y1+y2+…+y n}

[0078] Taking it as the objective function of the MILP problem, we then examine the constraints of the MILP problem.

[0079] Specifically, it is necessary to ensure that the input bit of the linear diffusion layer is non-zero, that is, at least one bit difference or linear mask is introduced, which can be expressed as follows using a linear inequality:

[0080]

[0081] Establish constraints between each word block and the corresponding bit in the linear diffusion layer. When any bit in each byte block is non-zero, the corresponding word block value is non-zero, which can be expressed as a linear inequality constraint:

[0082]

[0083] When all bits in each word block are zero, the value of the corresponding byte block is also zero, and the linear inequality constraint is expressed as:

[0084]

[0085] The XOR operation between any two bits in the linear diffusion layer like Figure 3 As shown, the differential propagation relationship of XOR is constrained by linear inequality as follows:

[0086]

[0087] The linear propagation relationship of XOR is constrained by linear inequality:

[0088] x=y=z

[0089] The branch operation x→(y, z) of any bit inside the linear diffusion layer is as follows: Figure 4 As shown, the differential propagation relationship of the branch is constrained by linear inequality:

[0090] x=y=z

[0091] The linear propagation relationship of the branch is constrained by linear inequality:

[0092]

[0093] By adding constraints to the relationship within the linear diffusion layer according to the above conversion relationship, a MILP model is established, and the established model is handed over to the linear programming solver CPLEX for solving, the size of the branch number can be calculated in a shorter time.

[0094] Furthermore, in order to test the practicability of the present invention, we randomly constructed a batch of linear diffusion layers based on bit cyclic shift, and the formula is expressed as follows:

[0095]

[0096]

[0097] Where x is 64 bits, a, b, c, d, e, f, g are the number of bits of x cyclically shifted to the left, and a batch of constants satisfying the following properties are randomly generated:

[0098]

[0099] The number of branches was tested using a MILP-based method. Since the matrix of the θ permutation is symmetric, the number of differential branches and the number of linear branches are equal, so they are uniformly expressed in terms of the number of branches. The following table shows the test results when the cyclic shift constants (a, b, c, d, e, f, g) take different values.

[0100] Number of cyclic shifts Number of branches Time consumed (seconds) Number of cyclic shifts Number of branches Time consumed (seconds) 4,13,18,28,33,45,48 5 39.65 2,9,20,24,39,44,53 6 140.45 5,9,22,24,37,44,48 6 39.99 2,15,17,28,38,46,50 6 152.63 6,12,16,28,35,47,50 5 42.16 0,15,16,29,39,46,54 6 175.91 0,15,22,29,39,47,54 5 47.55 3,14,19,25,37,47,50 6 191.70 4,11,21,31,34,42,53 5 49.41 0,11,17,30,37,41,48 6 207.15 4,14,17,31,34,47,51 5 50.97 5,12,23,26,34,43,48 6 211.90 3,11,23,24,36,46,52 6 64.19 1,11,22,28,33,44,54 6 222.62 5,10,21,25,32,45,49 6 99.33 6,8,18,29,35,47,48 6 236.73 4,14,17,28,38,45,52 6 102.59 4,11,21,29,34,46,53 6 255.91 3,12,19,27,37,45,55 6 104.77 1,11,19,30,35,44,55 6 277.28 4,13,19,27,37,42,51 6 105.26 7,13,16,31,39,42,53 6 309.77 1,14,20,27,35,41,49 6 106.69 2,14,22,29,32,44,51 6 488.64 6,14,23,26,38,41,49 6 112.05 2,11,21,27,35,47,54 7 1097.75 4,10,20,24,39,43,53 6 112.72 0,15,21,29,34,42,52 7 1126.66 2,12,17,29,39,41,48 6 116.03 2,10,22,30,32,40,49 7 1475.72 7,15,17,25,35,42,53 6 116.85 4,9,21,26,39,46,53 7 1649.37 0,14,19,27,37,40,53 6 120.82 4,11,18,29,38,43,51 7 1763.98 7,13,17,25,32,42,50 6 120.85 0,11,19,27,38,47,51 7 2160.87 3,11,21,27,35,44,50 6 131.81 6,10,16,25,33,41,51 7 3802.51 1,10,19,25,36,46,55 6 137.19 6,15,23,30,35,42,53 7 4014.19

[0101] It can be seen from the above table that the speed of testing the number of branches of the above linear diffusion layer is relatively fast. When the number of branches of the linear diffusion layer is 5, the number of branches can be tested in less than 1 minute. When the number of branches is 6, the test time usually does not exceed 10 minutes. When the number of branches is 7, it takes about 1 hour.

[0102] In addition, we tested the linear diffusion layer L used in the commercial cryptography competition algorithm SMBA 64 The number of branches, L64 like Figure 5 As shown, the cyclic shift value u in the SMBA algorithm is 9, and we traverse other different cyclic shift values:

[0103] 0≤u≤31

[0104] The branch number calculation method based on MILP was used to test its branch number. The following table shows the test results.

[0105] Number of cyclic shifts Number of branches Time consumed (seconds) Number of cyclic shifts Number of branches Time consumed (seconds) 0 4 0.31 16 4 0.44 1 5 4.30 17 6 42.42 2 5 3.19 18 6 12.50 3 5 5.51 19 6 29.18 4 5 1.47 20 6 4.18 5 5 18.77 21 6 33.28 6 5 3.84 22 6 15.65 7 5 32.29 23 6 25.85 8 4 0.62 24 4 0.77 9 6 38.24 25 5 14.27 10 6 15.17 26 5 4.06 11 6 41.41 27 5 19.99 12 6 3.25 28 5 3.13 13 6 37.15 29 5 9.18 14 6 23.68 30 5 4.87 15 6 34.02 31 5 7.70

[0106] As can be seen from the above table, the speed of testing the branch number of the SMBA type linear diffusion layer is very fast, and it usually takes less than 1 minute to test the number of permuted branches.

[0107] The present invention is not limited to the above-mentioned specific embodiments. The present invention extends to any new features or any new combination disclosed in this specification, as well as any new method or process steps or any new combination disclosed. If non-substantial changes or improvements made by those skilled in the art without departing from the spirit of the present invention should fall within the scope of protection of the claims of the present invention.

[0108] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.

[0109] Any feature disclosed in this specification, unless otherwise stated, can be replaced by other equivalent or alternative features with similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.

Claims

1. A fast calculation method for the number of branches in a linear diffusion layer based on MILP, characterized in that: The process includes: Step 1, transform the linear diffusion layer branch number calculation problem into a MILP problem; Step 2: Establish a MILP model based on the MILP problem, and use a linear programming solver to solve it to obtain the number of branches in the linear diffusion layer; Among them, in the MILP model, the propagation behaviors of differential and linear in the linear diffusion layer are characterized by linear inequalities or equations; The specific process of establishing the MILP model in step 2 is: Step 2.1, taking the minimum number of non-zero blocks of the input and output of the linear diffusion layer as the objective function of the MILP problem; Step 2.2, establishing constraints between each word block and the corresponding bit in the linear diffusion layer; Step 2.3, the linear propagation relationship and differential propagation relationship of the XOR and branches between bits in the linear diffusion layer are equivalently described by using the linear inequality or equality of MILP; Step 2.4, complete the MILP model construction; The constraint conditions in step 2.2 include: the input bit of the linear diffusion layer is non-zero; when any bit in each word block of the input and output linear diffusion layer is non-zero, the corresponding word block value is non-zero; when all bits in each word block of the input and output linear diffusion layer are zero, the corresponding word block value is zero; In step 2.3, the differential propagation relationship of XOR adopts the following inequality constraint: Among them, in the linear diffusion layer, for The transformation of , are the input and output of the linear diffusion layer respectively; in, For the word block, for bits; In step 2.3, the linear propagation relationship of XOR adopts the following equality constraint: In step 2.3, the differential propagation relationship of the branch adopts the following equality constraint: In step 2.3, the linear propagation relationship of the branch adopts the following inequality constraints: 。

Citation Information

Patent Citations

  • Diffusion transformation method for block cipher substitution-permutation network block

    CN110266468A

  • Method for constructing cryptographic structure model based on cyclic shift and exclusive-OR operation

    CN112487410A

  • Tweeakable GOST2 differential route searching method based on MILP

    CN112953703A

  • Device and method for deciding parameter, ciphering device, and deciphering device

    JP2002023623A

  • Price-and-branch algorithm for mixed integer linear programming

    US20150331833A1