Wenxiao QIAO, Siwei SUN, and Lei HU, “New Algebraic Attacks on Grendel with the Strategy of Bypassing SPN Steps,” Chinese Journal of Electronics, vol. 33, no. 3, pp. 635–644, 2024. DOI: 10.23919/cje.2023.00.127
Citation:
Wenxiao QIAO, Siwei SUN, and Lei HU, “New Algebraic Attacks on Grendel with the Strategy of Bypassing SPN Steps,” Chinese Journal of Electronics, vol. 33, no. 3, pp. 635–644, 2024. DOI: 10.23919/cje.2023.00.127
Wenxiao QIAO, Siwei SUN, and Lei HU, “New Algebraic Attacks on Grendel with the Strategy of Bypassing SPN Steps,” Chinese Journal of Electronics, vol. 33, no. 3, pp. 635–644, 2024. DOI: 10.23919/cje.2023.00.127
Citation:
Wenxiao QIAO, Siwei SUN, and Lei HU, “New Algebraic Attacks on Grendel with the Strategy of Bypassing SPN Steps,” Chinese Journal of Electronics, vol. 33, no. 3, pp. 635–644, 2024. DOI: 10.23919/cje.2023.00.127
QIAO Wenxiao: Wenxiao QIAO is a Ph.D. candidate of Institute of Information Engineering, Chinese Academy of Sciences. Her research interests include Symmetric cryptanalysis and Design. (Email: qiaowenxiao@iie.ac.cn)
SUN Siwei: Siwei SUN received the Ph.D. degree from Chinese Academy of Sciences in 2013. He is a Professor in School of Cryptology, University of Chinese Academy of Sciences, Beijing, China. His research interests include Symmetric cryptanalysis and Design. (Email: siweisun.isaac@gmail.com)
HU Lei: Lei HU received the Ph.D. degree from Chinese Academy of Sciences in 1994. He is a Professor in Institute of Information Engineering, Chinese Academy of Sciences, Beijing, China. His research interests include basic theory of applications of pseudorandom sequences and arrays, analysis of cryptographic algorithms and theoretical cryptography. (Email: hulei@iie.ac.cn)
The rapid development of modern cryptographic applications such as zero-knowledge, secure multi-party computation, fully homomorphic encryption has motivated the design of new so-called arithmetization-oriented symmetric primitives. As designing ciphers in this domain is relatively new and not well-understood, the security of these new ciphers remains to be completely assessed. In this paper, we revisit the security analysis of arithmetization-oriented cipher Grendel. Grendel uses the Legendre symbol as a component, which is tailored specifically for the use in zero-knowledge and efficiently-varifiable proof systems. At FSE 2022, the first preimage attack on some original full GrendelHash instances was proposed. As a countermeasure, the designer adds this attack into the security analysis and updates the formula to derive the secure number of rounds. In our work, we present new algebraic attacks on GrendelHash. For the preimage attack, we can reduce the complexity or attack one more round than previous attacks for some instances. In addition, we present the first collision attack on some round-reduced instances by solving the constrained input/constrained output problem for the underlying permutations.
With the rapid development of new applications such as zero-knowledge (ZK), secure multi-party computation (MPC), fully homomorphic encryption (FHE), some efficient symmetric schemes suitable for these scenarios have been proposed in recent years. Different from traditional symmetric ciphers, the design goal of such ciphers is not to reduce execution time, energy consumption, memory footprint, etc. Instead, they optimize the algebraic complexity, i.e., they attempt to minimize the number of non-linear operations in their natural algorithm description. Therefore, they are often referred to as arithmetization-oriented (AO) ciphers.
Since the cipher LowMC [1] was proposed at Eurocrypt 2015 by Albrecht et al., which is friendly to MPC and FHE, an increasing number of AO symmetric-key primitives have been raised, including FLIP [2], Kreyvrium [3], Rasta [4], MiMC [5], Feistel-MiMC [5], GMiMC [6], Ciminion [7], Poseidon [8], and Neptune [9]. Most of them use low-degree nonlinear functions such as x→xd.
However, for some use cases of ZK proof systems, it is feasible to reach efficiency with high-degree nonlinear functions. In such a use case, the complexity of proving/verifying a given statement y=F(x) for a certain function F is considered. Instead of proving/verifying y=F(x) directly, proving/verifying an equivalent relation G(x,y)=c may be more efficient. This approach is used in Vision [10], Rescue-Prime [11] and Grendel [12]. In Vision, a high-degree function x→x−1 is used. In Rescue-Prime, a low-degree function x→xd and a high-degree function x→x1d are used. In Grendel, the nonlinear layer uses the Legendre symbol as a component, which is a function of high degree p−12 over an odd prime field Fp.
On the other side, these AO symmetric primitives propose new challenges for cryptanalysts to analyze their security. And as designing symmetric ciphers in this domain is reasonably new and not well-studied, some fatal errors may be neglected at the design phase. For instance, soon after the publication of LowMC, a higher-order differential cryptanalysis [13] and an optimized interpolation cryptanalysis [14] were given, which made LowMC move to LowMC v2. Later the difference enumeration technique [15] was proposed, which made LowMC v2 move to LowMC v3. However, the recent attacks [16]–[19] have demonstrated that some instances in LowMC v3 are still insecure.
In order to better evaluate the security of AO hash functions, Ethereum Foundation put forward a challenge1 to analyze the constrained input/constrained output (CICO) problem for some round-reduced versions of permutations underlying several sponge-based AO hash functions, including Feistel-MiMC, Poseidon, Rescue-Prime and Reinforced Concrete [20]. Later, the work done by Bariant et al. [21] showed that the security cryptanalysis presented by the challenge’s authors or designers of three such primitives (i.e., Feistel-MiMC, Poseidon and Rescue-Prime) was too optimistic.
In this paper, we evaluate the security of the AO cipher Grendel [12]. Grendel defines a family of permutations, which are used to obtain hash functions by applying the sponge construction [22]–[24]. At FSE 2022, Grassi et al. [25] proposed the first preimage attack on some original full GrendelHash instances. This attack considered the case where the output of GrendelHash consists of one field element. It used the strategy that if let the input state only have one unknown field element (denoted by x) and all Legendre symbols in the scheme be fixed, then the output of GrendelHash can be written as a univariate polynomial in terms of x, of which the degree may be low. As a countermeasure, the designer adds this attack into the security analysis and updates the formula to derive the secure number of rounds.
Our contributions In our work, we propose three new algebraic attacks on GrendelHash and consider the case where the digest consists of one field element. In the work done by Bariant et al. [21] at FSE 2023, the strategy of bypassing substitution-permutation networks (SPN) steps was used to solve the CICO problem for the cryptographic permutations which are intended for use in a sponge construction to build hash functions. We give a generalization of this strategy such that it can be used to deal with more than just CICO problem. Our results are detailed as follows:
1) With bypassing one SPN step, we can find a preimage with a lower complexity than previous attacks for some round-reduced instances.
2) Regarding the special case where the sponge capacity consists of one field element, with bypassing two SPN steps, a) For the preimage attack, the complexity can be reduced further and we can attack one more round than previous attacks for some round-reduced instances; b) By solving the CICO problem for the underlying permutations, we propose the first collision attack on some round-reduced instances.
The results are summarized in Tables 1–3. The complexity of original preimage attack is derived from the formula presented in Scetion V in [25]. The complexity of designer’s attack is derived from the formula presented in Table 1 in [12].
Table
1.
A summary of the attacks on GrendelHash instances with parameters α=2,λ=128,log2(p)≈256
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.
Organization of the paper In Section II, we give some notations and related definitions. Besides, we give a brief description of Grendel and the algorithm for solving univariate system. In Section III, we revisit the original preimage attack on GrendelHash. In Section IV, we give a generalization of the strategy of bypassing SPN steps. In Section V, we introduce our first preimage attack. In Section VI, we introduce our second preimage attack and the first collision attack. The experimental results of our attacks are given in Section VII. Finally, the paper is concluded in Section VIII.
II.
Preliminaries
In this section, we will first give some notations and related definitions. Then, we will give a brief description of Grendel [12]. Finally, we will describe the algorithm [21] for solving univariate system.
1
Notations and related definitions
In the following content of this paper, p denotes an odd prime. Fp denotes the finite field with p elements. For x=(x0,…,xa−1)∈Fap and y=(y0,…,yb−1)∈Fbp, the concatenation of x and y is denoted by x∥y, i.e., x∥y=(x0,…,xa−1,y0,…,yb−1)∈Fa+bp.
Definition 1 The hash function H is λ-bit secure against preimage attack if no algorithm has an expected complexity less than 2λ for finding u given h such that H(u)=h.
Definition 2 The hash function H is λ-bit secure against collision attack if no algorithm has an expected complexity less than 2λ for finding u1,u2 such that H(u1)=H(u2) and u1≠u2.
Definition 3 Let F:Fnp→Fnp be a permutation. Zt is the set of all elements of Fnp such that their last t coordinates are equal to 0. The CICO problem is finding x∈Fnp such that x∈Zt and F(x)∈Zt.
2
Description of Grendel
Grendel [12] defines a family of permutations with SHARK-like constructions [26]. Based on the Grendel permutation, the Grendel hash function is obtained by applying the sponge construction [22]–[24] and using the primitive as an inner permutation. The different permutations in the family are determined by the triple (p,m,c,λ) representing respectively the size of the field over which the primitive’s operations are defined, the number of field elements in the state, the number of field elements in the sponge capacity and the target security level. The secure number of rounds R can be obtained from these parameters as follows:
In other words, R is set to the smallest integer such that the complexities of all attacks presented in Table 1 in [12] are at least 21.25λ.
Grendel permutation uses the Legendre symbol as a component. Therefore we first introduce the definition of the Legendre symbol.
Definition 4 The Legendre symbol is a function (⋅p):Fp→Fp defined as
(xp)={0,ifx=01,ifx∈QRp−1,ifx∉QRp∪{0}
where QRp={b2|b∈Fp∖{0}}.
Grendel permutation P:Fmp→Fmp(m≥2) iterates a round function R times. At the i-th (0≤i≤R−1) round the round function consists of the following operations, as depicted in Figure 1.
1) SboxLayer (SB): A S-box S:Fp→Fp is applied to the m elements of the state in parallel. The S-box is defined as S(x)=xα×(xp), where if p≡3mod4 then α=2 and if p≡1mod4 then α≥3 is the smallest integer such that gcd(α,p−1)=1.
2) LinearLayer (L): The state vector is multiplied with an MDS matrix M of size m×m.
3) ConstantAddition (AC): The round constant Cim+j∈Fp is added to the j-th element of the state, where j∈{0,1,…,m−1}.
By using the Grendel permutation in a sponge construction, the Grendel hash function is obtained. Specifically, r and c denote the number of field elements in the sponge rate and the sponge capacity respectively. And the number of field elements in the digest is denoted by l. Then for the input consisting of elements of Fp, the procedure for computing its digest consists of the following operations, as depicted in Figure 2.
1) Padding: If the input length is variable, then the input is padded as follows: first append a single 1 to the input, and then append zeros until the total length is a multiple of r. If the input length is fixed, then the input does not need to be processed in this phase. Then divide the result into blocks m0,m1,…,mk−1, where each block mi(0≤i≤k−1) consists of r elements of Fp.
2) Initializing: The state is initialized to IV=(0,0,…,0)∈Fmp.
3) Absorbing: The blocks m0,m1,…,mk−1 are added into the top r elements of the state, interleaved with applications of the permutation P. When all blocks are processed, switch to the squeezing phase.
4) Squeezing: First extract min(l,r) elements from the top r elements of the state. If l>r, then apply P to the state and extract min(l−r,r) elements from the top r elements of the state. Repeat this process until the number of extracted elements reach l.
In addition, for the target security level λ-bit, the number of field elements in the sponge capacity c and the number of field elements in the digest l should satisfy clog2(p)2≥λ and llog2(p)2≥λ.
3
Solving univariate system
In this part, we will introduce the algorithm [21] for solving univariate system. Let g(x)∈Fp[x] and d denote the degree of g(x). Our goal is to find the roots of g(x) in Fp. The algorithm consists of the following steps.
1) Use repeated squaring algorithm [27] in Fp[x]/⟨g(x)⟩ to compute q(x)=xpmodg(x).
2) Compute r(x)=gcd(q(x)−x,g(x)).
3) Factor r(x).
Complexity evaluation The algorithm’s complexity given in [21] is O(dlog2(d)(log2(d)+log2(p))log2(log2(d))) field operations.
Specifically, multiplying two polynomials of degree n by using an FFT algorithm needs O(nlog2(n)log2(log2(n))) field operations. O(dlog2(p)log2(d)log2(log2(d))) field operations are needed in step 1); O(d(log2(d))2log2(log2(d))) field operations are needed in step 2). In general, the degree of r(x) is only one or two because g(x) has few roots in Fp. Thus, the complexity of the third step is negligible.
We note that this algorithm was also used in the original preimage attack [25] and had a different complexity evaluation. However, the complexity given in [21] is sharper, which will be used in our work.
III.
The Original Preimage Attack
In this section, we will briefly revisit the original preimage attack [25] on N-round GrendelHash instances, of which the number of field elements in the digest l is 1. And the number of field elements in the sponge rate r≥2.
Given a digest h∈Fp, the overall procedure for finding a preimage can be separated into the following steps, as depicted in Figure 3.
Figure
3.
Introduce the steps of the original preimage attack, where the unknown Legendre symbols are colored in yellow and the known intermediate values are colored in gray.
1) Choose u=(u1,…,ur−1)∈Fr−1p randomly. Let the input of GrendelHash be x∥u∈Frp, where x is an unknown variable.
2) Guess the values (only 1 or −1) of the L=1+m(N−1) unknown Legendre symbols (i.e., the yellow states in the Figure 3) in the N rounds. Then write the first element in the output state of N-round Grendel permutation P as a polynomial in terms of x, which is denoted by p(x) and has a degree of αN.
3) Solve the equation p(x)−h=0 in Fp. For each solution x∗, if all computed Legendre symbols equal the guessed ones, then the solution is valid and return x∗∥u. If all solutions we find are not valid, then go to step 2) and guess the Legendre symbols with values we have not tried before.
4) If all possible guesses are traversed and no valid solution is found, then go to step 1) and try again with a different u.
Success probability For a random u∈Fr−1p, it can be expected that there is a value x0∈Fp such that the digest of x0∥u equals h. The probability that a Legendre symbol is equal to 1 is p−12p, the probability that a Legendre symbol is equal to −1 is p−12p, and the probability that a Legendre symbol is equal to 0 is 1p. As for x0, the probability that the L Legendre symbols are different from 0 is (1−1p)L, which is extremely close to 1 for the parameters considered in the attack. Therefore, the x0 can be found successfully with a high enough probability. In order to increase the success probability of the attack, try twice with different u.
As a countermeasure, the designer added this attack into the security analysis. The total complexity is estimated as 2Nm−c⋅αN⋅N2 by the designer in [12].
IV.
A Generalization of the Strategy of Bypassing SPN Steps
In this section, we will give a generalization of the strategy of bypassing SPN steps, which was originally proposed by Bariant et al. [21] to solve the CICO problem (in the case where Zt=Z1).
Let F=F1∘F0 be a permutation of Fnp with a SPN construction. Let B⊆Fnp and Hbj={(y1,y2,…,yn)∈Fnp|yj=b}, where 1≤j≤n and b∈Fp. Our problem is finding x∈Fnp such that x∈B and F(x)∈Hbj.
If we find an affine space W={sβ+γ|s∈Fp} in which β=(β0,…,βn−1),γ=(γ0,…,γn−1)∈Fnp such that F−10(W)⊆B, then we will handle the permutation F1 rather than the full permutation F. It could be easier to solve the problem. The detailed procedure can be separated into the following steps, as depicted in Figure 4.
1) Let the output state of F0 (i.e., the input state of F1) be zβ+γ=(β0z+γ0,…,βn−1z+γn−1), where z is an unknown variable.
2) Write the j-th element in the output state of F1 as a polynomial in terms of z, which is denoted by fj1(z).
3) Find a root z0 in Fp for the polynomial fj1(z)−b.
4) Compute x0=F−10(z0β+γ) and return x0.
V.
Our First Preimage Attack
In this section, we will introduce our first preimage attack on N-round GrendelHash instances. The number of field elements in the output l=1, the number of field elements in the sponge rate r≥2, and log2(p)≥2λ. In the following, each SPN step consists of one round of Grendel.
1
Bypass one SPN step
Let B1 be the set of all elements of Fmp such that their last c coordinates are equal to 0, i.e., B1={(x0,x1,…,xm−1)∈Fmp|xi=0,m−c≤i≤m−1}. For a given digest h∈Fp, if we find x∈Fmp such that x∈B1 and P(x)∈Hh1, where P is the underlying N-round Grendel permutation, then we will find a preimage. Therefore, we can exploit the strategy of bypassing SPN steps presented in Section IV in this attack.
Let N-round Grendel permutation be P=PN−1∘P1, where P1 consists of one SPN step of Grendel, i.e., the operations in the 0th round. Let the MDS matrix M be
Choose w=(w1,…,wr−1)∈Fr−1p. Let β=(a0,0,a1,0,…,am−1,0) and γ=(∑r−1i=1a0,iwi+C0,∑r−1i=1a1,iwi+C1,…,∑r−1i=1am−1,iwi+Cm−1). Then the affine space W={sβ+γ|s∈Fp} satisfies P−11(W)⊆B1, as depicted in Figure 5.
Therefore, the remaining task is to find z0 in Fp such that PN−1(z0β+γ)⊆Hh1.
2
The steps of our first preimage attack
In the following, we will introduce our first preimage attack in detail. Let the input state of PN−1 be zβ+γ, where z is an unknown variable. Denote the first coordinate in PN−1(zβ+γ) by f1N−1(z). In order to find z0 in Fp such that PN−1(z0β+γ)⊆Hh1, instead of solving the equation f1N−1(z)=h in Fp directly, we exploit the strategy that was used in the original preimage attack [25].
Specifically, the procedure for finding a preimage in this attack can be separated into the following steps (as shown in Algorithm 1).
1) Choose w=(w1,…,wr−1)∈Fr−1p randomly. Let β=(a0,0,a1,0,…,am−1,0) and γ=(∑r−1i=1a0,iwi+C0,∑r−1i=1a1,iwi+C1,…,∑r−1i=1am−1,iwi+Cm−1).
2) Let the input of PN−1 be zβ+γ, where z is an unknown variable.
3) Guess the values (only 1/−1) of the L1=m(N−1) unknown Legendre symbols in PN−1. And write the first element in the output state of PN−1 as a polynomial in terms of z, which is denoted by p1(z).
4) Solve the equation p1(z)−h=0 in Fp. For each solution z∗, if all computed Legendre symbols equal the guessed ones in the N−1 rounds, then the solution is valid and return the first r elements in P−11(z∗β+γ). If all solutions we find are invalid, then go to step 3) and guess the Legendre symbols with values we have not tried before.
5) If all possible guesses are traversed and no valid solution is found, then go to step 1) and try again with a different w.
Algorithm 1 Our first preimage attack on N-Round GrendelHash
Input: The given digest h∈Fp.
Output: A preimage.
1: Choose w=(w1,w2,…,wr−1)∈Fr−1p randomly;
2: Let β=(a0,0,a1,0,…,am−1,0) and γ=(∑r−1i=1a0,iwi+C0,∑r−1i=1a1,iwi+C1,…,∑r−1i=1am−1,iwi+Cm−1);
3: Let the input of PN−1 be zβ+γ, where z is an unknown variable;
4: for guessed values (only 1 or −1) of L1 Legendre symbols do
5: Build the polynomial p1(z) forwards to represent the first element in the output of PN−1;
6: Solve the equation p1(z)−h=0 in Fp;
7: for solution z∗ we find do
8: if all computed Legendre symbols equal the guessed ones then
9: Compute x=P−11(z∗β+γ);
10: returnx[0:r];
11: return No valid solution, try again with a different w.
Success probability For a random w∈Fr−1p, it can be expected that there is a value z0 in Fp such that PN−1(z0β+γ)⊆Hh1. As for z0, the probability that the L1 Legendre symbols in PN−1 are different from 0 is equal to (1−1p)L1, which is extremely close to 1 for the parameters considered in our attack. Thus, z0 can be found successfully with a high enough probability. Similarly to that in the original preimage attack, we try twice with different w to increase the success probability of the attack.
Complexity evaluation For each guess, we need to find the roots of the polynomial p1(z)−h in Fp and it can be expected that the number of roots in Fp is 1. Since the degree D1 of p1(x)−h is αN−1, then as shown in Section II.3, the complexity of solving the equation p1(z)−h=0 is equal to
C1sol=D1log2(D1)(log2(D1)+log2(p))log2(log2(D1))
For the solution, when verifying whether it is valid, we need to compute the Legendre symbols forwards until there is a computed value that do not match the guessed one. The expected number of Legendre symbols that need to be computed is equal to
∑i≥1i2i=2
In addition, the complexity of computing a Legendre symbol [28] is equal to
Cver=log2(p)(log2(log2(p)))2log2(log2(log2(p)))
Hence, the expected complexity of our first preimage attack on N-round GrendelHash is
C1=2L1+1×(C1sol+2×Cver)
The results of our first preimage attack on some instances are summarized in Tables 1–3.
Remark In our first preimage attack, the reasons for the reduced complexity compared to the original preimage attack [25] are as follows. First, the number of Legendre symbols needed to be guessed is reduced by 1. Second, the degree of univariate polynomial needed to be solved after guessing the values of the unknown Legendre symbols is αN−1, which is α times lower than that in the original preimage attack. Third, for the algorithm of solving univariate system, we use the complexity evaluation given in [21] at FSE 2023, which is better than that used in [25].
VI.
For the Special Case Where c = 1
In this section, we will introduce our second preimage attack and the first collision attack on some N-round GrendelHash instances. The number of field elements in the output l=1, the number of field elements in the sponge rate r≥2, the number of field element in the sponge capacity c=1, and log2(p)≥2λ.
1
Bypass two SPN steps
Let B2 be the set of all elements of Fmp such that their last coordinate is equal to 0, i.e., B2={(x0,x1,…,xm−1)∈Fmp|xm−1=0}. Let the underlying permutation be P=PN−2∘P2, where P2 consists of two SPN steps of Grendel, i.e., the operations in the 0th round and the 1st round. Let the inverse of M be
In the following, we will describe the steps of our second preimage attack. For a given digest h∈Fp, in order to find z1 in Fp such that PN−2(z1˜β+˜γ)⊆Hh1, we also exploit the strategy that was used in the original preimage attack [25].
Specifically, the procedure for finding a preimage in this attack can be separated into the following steps (as shown in Algorithm 2).
1) Let the input state of PN−2 be z˜β+˜γ, where z is an unknown variable.
2) Guess the values (only 1/−1) of the L2=m(N−2) unknown Legendre symbols in the PN−2. And write the first element in the output of PN−2 as a polynomial in terms of z, which is denoted by p2(z).
3) Solve the equation p2(z)−h=0 in Fp. For each solution z∗, if the computed Legendre symbols equal the guessed ones, then the solution is valid and go to step 4). If all solutions are invalid, then go to step 2) and guess the Legendre symbols with values we have not tried before.
4) Compute x=P−12(z∗˜β+˜γ) and return the first r elements of x.
Algorithm 2 Our second preimage attack on N-round GrendelHash
Input: The given digest h∈Fp.
Output: A preimage.
1: Let the input of PN−2 be z˜β+˜γ, where z is an unknown variable;
2: for guessed values (only 1 or -1) of L2 Legendre symbols do
3: Build the polynomial p2(z) forwards to represent the first element in the output state of PN−2;
4: Solve the equation p2(z)−h=0 in Fp;
5: for solution z∗ we find do
6: if all computed Legendre symbols equal the guessed ones then
7: Compute x=P−12(z∗˜β+˜γ);
8: returnx[0:r];
9: return No valid solution.
Success probability It can be expected that there is a value z1∈Fp such that the first element in PN−2(z1˜β+˜γ) equals the given digest h. As for z1, the probability that the L2 Legendre symbols are different from 0 is equal to (1−1p)L2, which is extremely close to 1 for the parameters considered in our attack. Therefore, we can find a preimage for a given digest h with a high enough probability.
Complexity evaluation In this attack, for each guess, the degree D2 of p2(z)−h is αN−2. Then the complexity of solving the equation p2(z)−h=0 is equal to
C2sol=D2log2(D2)(log2(D2)+log2(p))log2(log2(D2))
Therefore, the expected complexity of our second preimage attack on N-round GrendelHash is
C2=2L2×(C2sol+2×Cver)
(2)
The results of our second preimage attack on some instances are summarized in Tables 1–3.
3
The first collision attack
In the following, we will present our collision attack by solving the CICO problem (in the case where Zt=Z1) for the underlying permutation P. The procedure for finding a solution to the CICO problem is almost the same as the steps of our second preimage attack. After finding a solution x=(x0,x1,…,xr−1,0) to the CICO problem, where P(x)=(y0,y1…,yr−1,0), let m=(x0,x1,…,xr−1) and m′=(x0−y0,x1−y1,…,xr−1−yr−1). Then GrendelHash(m)=GrendelHash(m‖m′).
Specifically, the procedure for the collision attack can be separated into the following steps (as shown in Algorithm 3).
1) Let the input state of PN−2 be z˜β+˜γ, where z is an unknown variable.
2) Guess the values (only 1/−1) of the L2=m(N−2) unknown Legendre symbols in the PN−2. And write the last element in the output of PN−2 as a polynomial in terms of z, which is denoted by p3(z).
3) Solve the equation p3(z)=0 in Fp. For each solution z∗, if the computed Legendre symbols equal the guessed ones, then the solution is valid and go to step 4). If all solutions are invalid, then go to step 2) and guess the Legendre symbols with values we have not tried before.
4) Compute x=P−12(z∗˜β+˜γ) and y=PN−2(z∗˜β+˜γ). Denote x=(x0,x1,…,xr−1,0) and y=(y0,y1,…,yr−1,0). Let m=(x0,x1,…,xr−1) and m′=(x0−y0,x1−y1,…,xr−1−yr−1). Return m and m‖m′.
Algorithm 3 Our collision attack on N-round GrendelHash
Output: A collision.
1: Let the input state of PN−2 be z˜β+˜γ, where z is an unknown variable;
2: for guessed values (only 1 or −1) of L2 Legendre symbols do
3: Build the polynomial p3(z) forwards to represent the last element in the output state of PN−2;
4: Solve the equation p3(z)=0 in Fp;
5: for solution z∗ we find do
6: if all computed Legendre symbols equal the guessed ones then
7: Compute x=P−12(z∗˜β+˜γ) and y=PN−2(z∗˜β+˜γ);
8: Let m=x[0:r] and m′=x[0:r]−y[0:r];
9: returnm, m‖m′.
We note that the success probability and expected complexity of our collision attack are the same as those of our second preimage attack that presented in Section VI.2. The results of our collision attack on some instances are summarized in Tables 1–3.
VII.
Experiments
In order to verify the feasibility of our methods, we made experiments for our three new algebraic attacks on the round-reduced GrendelHash instance with parameters (p,m,r,c,λ)=(264−59,3,2,1,32). And the number of attacked round N=6. We provide our code at https://github.com/wxqiao/New-algebraic-attacks-on-Grendel. Let the prime field Fp={0,1,…,p−1}.
First, we performed 100 tests for our first preimage attack. By using the Algorithm 1, 83 tests of them can be attacked successfully. For instance, for a given digest h1=4509062438608773474∈Fp, we found a preimage
(1856239268434541265,11004345080245978645)∈F2p
Second, we performed 1000 tests for our second preimage attack. By using the Algorithm 2, 608 tests of them can be attacked successfully. For instance, for a given digest h2=14681296474556465288∈Fp, we found a preimage
(15277210688656701824,1087535840334498627)∈F2p
Third, for our collision attack, by using the method presented in Section VI.3, we found a solution x=(3978053920827369818,11054388833269671370,0)∈F3p to the CICO problem for the underlying Grendel permutation P successfully, where P(x)=(12866554063376284852,7184824262592905636,0)∈F3p. Let m=(3978053920827369818,11054388833269671370)∈F2p and
Then, a collision GrendelHash(m)=GrendelHash(m‖m′) is obtained for this round-reduced GrendelHash instance successfully.
VIII.
Conclusion
In this paper, we analyze the security of AO cipher Grendel. We propose three algebraic attacks on some GrendelHash instances. As a result, we can find a preimage with a lower complexity or attack one more round than previous attacks [12], [25] for some GrendelHash instances. In addition, we present the first collision attack on some round-reduced GrendelHash instances by solving the CICO problem for the underlying permutations.
A. Canteaut, S. Carpov, C. Fontaine, et al., “Stream ciphers: A practical solution for efficient homomorphic-ciphertext compression,” Journal of Cryptology, vol. 31, no. 3, pp. 885–916, 2018. DOI: 10.1007/s00145-017-9273-9
[4]
C. Dobraunig, M. Eichlseder, L. Grassi, et al., “Rasta: A cipher with low ANDdepth and few ANDs per bit,” in Proceedings of the 38th Annual International Cryptology Conference, Santa Barbara, CA, USA, pp.662–692, 2018.
L. Grassi, D. Khovratovich, C. Rechberger, et al., “Poseidon: A new hash function for zero-knowledge proof systems,” in Proceedings of the 30th USENIX Security Symposium, online, pp.519–535, 2021.
[9]
L. Grassi, S. Onofri, M. Pedicini, et al., “Invertible quadratic non-linear layers for MPC-/FHE-/ZK-friendly schemes over Fnp: Application to poseidon,” IACR Transactions on Symmetric Cryptology, vol. 2022, no. 3, pp. 20–72, 2022. DOI: 10.46586/tosc.v2022.i3.20-72
[10]
A. Aly, T. Ashur, E. Ben-Sasson, et al., “Design of symmetric-key primitives for advanced cryptographic protocols,” IACR Transactions on Symmetric Cryptology, vol. 2020, no. 3, pp. 1–45, 2020. DOI: 10.13154/tosc.v2020.i3.1-45
[11]
A. Szepieniec, T. Ashur, and S. Dhooghe, “Rescue-prime: A standard specification (SoK),” Available at: https://eprint.iacr.org/2020/1143, 2020.)
[12]
A. Szepieniec, “On the use of the Legendre symbol in symmetric cipher design, ” Available at: https://eprint.iacr.org/2021/984, 2021.
[13]
C. Dobraunig, M. Eichlseder, and F. Mendel, “Higher-order cryptanalysis of LowMC,” in Proceedings of the 18th International Conference, Seoul, South Korea, pp. 87–101, 2016.
C. Rechberger, H. Soleimany, and T. Tiessen, “Cryptanalysis of low-data instances of full LowMCv2,” IACR Transactions on Symmetric Cryptology, vol. 2018, no. 3, pp. 163–181, 2018. DOI: 10.13154/tosc.v2018.i3.163-181
[16]
F. K. Liu, T. Isobe, and W. Meier, “Cryptanalysis of full LowMC and LowMC-M with algebraic techniques,” in Proceedings of the 41st Annual International Cryptology Conference, Virtual Event, pp.368–401, 2021.
F. K. Liu, W. Meier, S. Sarkar, et al., “New low-memory algebraic attacks on LowMC in the picnic setting,” IACR Transactions on Symmetric Cryptology, vol. 2022, no. 3, pp. 102–122, 2022. DOI: 10.46586/tosc.v2022.i3.102-122
A. Bariant, C. Bouvier, G. Leurent, et al., “Algebraic attacks against some arithmetization-oriented primitives,” IACR Transactions on Symmetric Cryptology, vol. 2022, no. 3, pp. 73–101, 2022. DOI: 10.46586/tosc.v2022.i3.73-101
L. Grassi, D. Khovratovich, S. Rønjom, et al., “The Legendre symbol and the modulo-2 operator in symmetric schemes over Fnp: Preimage Attack on Full Grendel,” IACR Transactions on Symmetric Cryptology, vol. 2022, no. 1, pp. 5–37, 2022. DOI: 10.46586/tosc.v2022.i1.5-37
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.
Note: The complexity is estimated in field operations. R denotes the secure number of rounds; N denotes the number of attacked rounds; Bold numbers indicate the attacks are valid.