Next Article in Journal
Parallel Privacy-Preserving Shortest Path Algorithms
Next Article in Special Issue
On General Data Protection Regulation Vulnerabilities and Privacy Issues, for Wearable Devices and Fitness Tracking Applications
Previous Article in Journal
The Cost of a True Random Bit—On the Electronic Cost Gain of ASIC Time-Domain-Based TRNGs
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Fault Attack on the Family of Enocoro Stream Ciphers

Faculty of Informatics and Mathematics, University of Passau, D-94030 Passau, Germany
*
Author to whom correspondence should be addressed.
Cryptography 2021, 5(4), 26; https://doi.org/10.3390/cryptography5040026
Submission received: 13 August 2021 / Revised: 10 September 2021 / Accepted: 23 September 2021 / Published: 30 September 2021
(This article belongs to the Special Issue Cryptography: A Cybersecurity Toolkit)

Abstract

:
A differential fault attack framework for the Enocoro family of stream ciphers is presented. We only require that the attacker can reset the internal state and inject a random byte-fault, in a random register, during a known time period. For a single fault injection, we develop a differential clocking algorithm that computes a set of linear equations in the in- and output differences of the non-linear parts of the cipher and relates them to the differential keystream. The usage of these equations is two-fold. Firstly, one can determine those differentials that can be computed from the faulty keystream, and secondly they help to pin down the actual location and timing of the fault injection. Combining these results, each fault injection gives us information on specific small parts of the internal state. By encoding the information we gain from several fault injections using the weighted Horn clauses, we construct a guessing path that can be used to quickly retrieve the internal state using a suitable heuristic. Finally, we evaluate our framework with the ISO-standardized and CRYPTREC candidate recommended cipher Enocoro-128v2. Simulations show that, on average, the secret key can be retrieved within 20 min on a standard workstation using less than five fault injections.

1. Introduction

Besides numerous other uses, stream ciphers play a central role in mobile telecommunications. Essentially every hand-held communication device contains a hardware implementation of one or more stream ciphers. Since these devices are readily available to a potential attacker, there is an urgent need to secure those hardware implementations against side-channel attacks targeting the secret keys stored on the device and the keystream produced from them. Therefore it is an important task to analyze the security of current stream ciphers and stream cipher proposals against various types of side-channel attacks, both of the passive type (measuring power consumption, measuring electromagnetic radiation) and of the active type (generating power glitches, laser injections, mechanical disturbances).
In this paper we examine the Enocoro family of stream ciphers developed by Hitachi Ltd. (see [1]). These stream ciphers are contained in the Japanese government’s CRYPTREC recommended ciphers list (see [2]) and have been standardized by ISO in ISO/IEC 29192-3:2012 (see [3]). The Enocoro family consists of the stream ciphers Enocoro-80 (see [4]) and Enocoro-128v2 (see [1,2]). Their construction is inspired by the PANAMA hash function and stream cipher (see [5]). The security of Enocoro stream ciphers against various types of attacks has been considered in [6,7,8,9,10,11]. For instance, in [9], a slide attack is proposed, and [10] suggests a guess-and-determine attack which, despite its name, is unrelated to the attack studied here. Side channel attacks on the family of Enocoro stream ciphers have not been studied intensively. Only [7] briefly discusses two types of passive side channel attacks, namely Differential Power Analysis (DPA) and Correlation Power Analysis (CPA). Active side-channel attacks, in particular fault attacks, apparently have not yet been analyzed in this context. Notice that the core part of our attack relies on a guess-and-determine mechanism which has to adapt to the results of previous fault injections. For this reason, the guess-and-determine attack strategies presented in [6,10,11] cannot be adapted to the fault attack setting in a straightforward way and a completely new approach had to be developed in Section 5.
In general, fault attacks are a well-researched topic (see [12,13,14,15,16,17,18,19]). Their main characteristic is the set of assumptions made concerning the capabilities of the attacker: physical capabilities, computing power, or prior knowledge. So, let us start by specifying our
Fault Model: The proposed fault attack has byte-sized fault injections at its core. In addition, we are assuming the setting of a known plaintext attack. Since the bit stream of the plaintext is added to the keystream, this means that we are in possession of the keystream. Moreover, we assume that we can reset the internal state, typically by restarting the keystream generation with the same secret key and the same initialization vector. Of course, we do not assume the knowledge of these values, just the possibility of resets. As for the fault injections themselves, we require only a very mild spatial resolution, namely the injection of a byte fault into an unknown register, as well as a very mild temporal resolution, namely the possibility to time the injection within a small time period, i.e., a small number of clock cycles.
Feasibility: For an actual physical realization of our attack, these assumptions are not particularly hard to fulfill. Given physical hardware access, the first two assumptions can be reduced to the setting of a known plaintext attack and the assumption that we can convince the hardware device to take a certain initialization vector as an input. For the actual injection of faults, there are several different techniques available. These include the usage of electromagnetic or laser pulses, over-and under-clocking of the circuit, and voltage drops. For extensive studies on these techniques and their limitations, we refer to [20,21,22]. Practical implementations of much more demanding fault models have been reported in [23,24,25]. Based on these results, we believe that the injection of byte faults into unspecified registers on an FPGA-implementation is readily achievable with current technology.
The proposed fault attack framework consists of several parts. First we introduce a differential clocking algorithm. By comparing the correct keystream with the corrupted keystream, i.e., by considering the differential keystream, it allows us to determine the precise injection point and to find differentials in certain register values. Then the task is to use these differentials to derive other register values until we are able to completely reconstruct the internal state of the cipher at one point in time. Clocking the keystream back in time, we are then able to reveal the secret key and the cipher is broken.
So, how do we use several differentials in register values to deduce the full internal state? The construction of the cipher allows us to write down equations connecting the bits of the register values and the key stream bits. Then we can make deductions of the following kind:
If we know registers R at time t and R at time t , we can deduce the value of R at time t .
(Here “register” has to be replaced by the “keystream” in some cases.) All of these deductions are phrased as propositional logic formulas, more precisely, as Horn clauses. Since there is an efficient algorithm for checking the satisfiability of a set of Horn clauses, called the Marking Algorithm, we can quickly decide if our current knowledge suffices to deduce the entire internal state or not. In actual fact, we may not know the exact value of some register at some point in time, but only a (small) set of candidate values. Then our deduction technique has to be refined as follows. We assign each Horn clause a weight corresponding to the amount of information we have about it, i.e., how large the candidate sets of values are. Then we use a suitably adjusted version of the Marking Algorithm to check if we can reduce the candidate set for the internal state to a manageable size, where “manageable” means that we can find the correct internal state by a small enough exhaustive search. Furthermore, we extend the scope of this procedure by allowing the guessing of certain register value bits (thereby increasing the search space, of course), and finding the optimal guessing path heuristically. In other words, our attack tries to model and follow the information flow during the execution of the stream cipher, and it tries to optimize the information gain which can be derived from each fault injection.
Does this approach work? For the Enocoro family of stream ciphers, it seems to work extremely well. A successful fault attack on Enocoro-128v2 is possible using approximately five fault injections on average, where the fault is assumed to be injected anytime during the first 10 clock cycles. The ensuing computation requires approximately 20 min.
Contents. Now let us describe the course of the paper in somewhat greater detail. In Section 2 we recall the definition of the family of Enocoro stream ciphers. In particular, we provide the mathematical equations defining the clock and the update functions. In the next section we use this description to make our fault model, and the assumptions underlying it, very explicit. We also introduce some common terminology for fault attacks. The topic of Section 4 is the Differential Clocking Algorithm 1. This algorithm allows us to track differentials, i.e., input and output differences, through a clock cycle. More precisely, it returns a set of linear polynomials that relate distinct differentials with one another and with the keystream output. With these linear polynomials we can trace a generic fault through the internal states and the keystream output on a cycle-by-cycle basis. One of its first uses is the possibility to locate the injection point of a fault injection up to a small number of possible cases (see Propositions 2 and 3). After determining the injection point, we can then try to find as many input and output differences as possible. Concrete results for the cipher Enocoro-128v2 are given in the last part of this section.
In Section 5 our attentions shift to combining several fault injections in an optimal way. The basic strategy is to perform a Guess-and-Determine (GD) Attack. We describe logical implications between the knowledge of various register values by Horn clauses. When dealing with fault injections, often the acquired information is not exact, i.e., instead of the precise register value, only a small set containing that value can be found. As indicated above, this is modelled by assigning a weight to the corresponding Horn clause. Now the order in which the registers can be computed, represented by their corresponding Horn clauses, is called a (weighted) guessing path. The weighted clauses here are obtained by carefully tracking how the fault injections propagate through the internal state, and how the various differential in- and outputs that occur due to the faults are related to one another. The Guessing Path Attack Algorithm 2 allows us to find the initial state of the cipher if the guessing path has just small enough weight. Since finding an optimal guessing path is not feasible, we propose a Greedy Marking Algorithm 3 as a heuristic to find a guessing path of small weight.
These techniques are put to work in Section 6 where we apply them to construct actual fault attacks on Enocoro stream ciphers by describing an Enocoro Fault Attack Framework in Algorithm 4. In the final section we execute this framework in actual simulations and report on the timings and results. Using approximately five fault injections and about 20 min of calculations, we can expect to retrieve the internal state and break the cipher Enocoro-128v2.
Unless stated otherwise, we use the definitions and notation in [26,27]. The algorithms of Section 4 and Section 5 were implemented by the first author using the computer algebra system CoCoA-5 (see [28]).

2. Description of the Enocoro Stream Cipher Family

This section summarizes the relevant aspects of the family of Enocoro stream ciphers as specified in [1]. We adhere to the definition of a stream cipher, as in [29]. Let n b N and k 1 , k 2 , k 3 , k 4 , q 1 , p 1 , q 2 , p 2 , q 3 , p 3 { 0 , , n b 1 } with p i q i p j q j for i , j { 1 , 2 , 3 } and i j . Now the stream cipher Enocoro ( n b ; k 1 , k 2 , k 3 , k 4 , q 1 , p 1 , q 2 , p 2 , q 3 , p 3 ) is defined as follows:
(a)
The cipher consists of the registers R = { b 0 , , b n b 1 , a 0 , a 1 } and the value of register R R at time t 0 is denoted by R ( t ) F 2 8 . The internal state at time t is the tuple of the values of the registers at that time and denoted by:
S ( t ) = ( b 0 ( t ) , , b n b 1 ( t ) , a 0 ( t ) , a 1 ( t ) ) ( F 2 8 ) n b + 2
The first n b entries are also called the buffer, and the remaining two coordinates are known as the state.
(b)
The next-state function clock where S ( t + 1 ) = clock ( S ( t ) ) is defined by
b 0 ( t + 1 ) = b n b 1 ( t ) + a 0 ( t ) b i ( t + 1 ) = b i 1 ( t ) for i { 1 , , n b 1 } \ { q 1 + 1 , q 2 + 1 , q 3 + 1 } b q j + 1 ( t + 1 ) = b q j ( t ) + b p j ( t ) for j { 1 , 2 , 3 }
for the buffer registers. Notice that restricted to this part, the update function is linear. For updating the remaining two registers, one defines an invertible linear function L : ( F 2 8 ) 2 ( F 2 8 ) 2 and a non-linear S-Box s 8 : F 2 8 F 2 8 whose precise construction is not relevant for our attack and is omitted here. However, the following relation is important:
a 0 ( t + 1 ) , a 1 ( t + 1 ) = L a 0 ( t ) + s 8 ( b k 1 ( t ) ) , a 1 ( t ) + s 8 ( b k 2 ( t ) ) + s 8 ( b k 3 ( t ) ) , s 8 ( b k 4 ( t ) )
Observe that clock as a whole is an invertible function, i.e., it is possible to retrieve the so-called initial state  S ( 0 ) from any internal state S ( t ) .
(c)
The output function, denoted by keystr , is linear and given by keystr ( S ( t ) ) = a 1 ( t ) .
(d)
The general specification does not include an explicit description of the initialization function init that takes an initialization vector (IV) v IV and a secret key k K and returns the initial state S ( 0 ) . Usually this function is invertible, and heavily based on the next-state function clock .
From this general framework, two specific parameter sets were derived, for 128-bit security [1] and 80-bit security [4]. Those are both standardized in ISO 29192-3 [3] (along the well-studied cipher Trivium [30]), and the 128-bit version is part of the Candidate Recommended List of the Japanese CRYPTREC.
Example 1
(Enocoro-128 v2 [1]). For 128-bits of security, we let n b = 32 , k 1 = 2 , k 2 = 7 , k 3 = 16 , k 4 = 29 , p 1 = 6 , p 2 = 15 , p 3 = 28 , q 1 = 2 , q 2 = 7 , and q 3 = 16 . Then the internal state consists of 34 bytes. The initialization function is efficiently invertible and based on 96 applications of the next-state function clock . It takes a key in K = ( F 2 8 ) 16 and an IV in IV = ( F 2 8 ) 8 .
The next-state function of Enocoro-128v2 is also shown schematically in Figure 1.
From now on we assume that init is efficiently invertible. Thus the used key and IV can be derived quickly from the initial state S ( 0 ) (and any other internal state S ( t ) where t is not too large). The fault attack of this paper computes the initial state S ( 0 ) of a given Enocoro stream cipher instance. In the last section, results from simulations and experiments with the 128-bit version of Enocoro are presented.
In the following we fix a key k K and an IV v IV and consider the stream cipher S = Enocoro ( n b ; k 1 , k 2 , k 3 , k 4 , q 1 , p 1 , q 2 , p 2 , q 3 , p 3 ) with an (efficiently) invertible initialization function. We also denote the sequence of internal states by ( S ( t ) ) t 0 and the keystream output by ( z ( t ) ) t 0 .

3. Our Fault Model

Our fault attack is based on a differential fault analysis which is ultimately reduced to a close inspection of the differential keystream. For this, we clearly need to have access to the keystream at all times.
Assumption 1.
The keystream is accessible, i.e., we are in the setting of a known plaintext attack.
In practice, this assumption can be slightly weakened as we do not need to have the whole keystream available. The simulations in Section 7, for instance, never used more than the first 40 keystream words. In order to be able to combine information of different fault injections, it is necessary that they convey information about the same sequence of internal states.
Assumption 2.
The internal state of the cipher can be reset to the initial state, e.g., by restarting the cipher with the same IV and key.
Let us point out here that it would also be sufficient to assume that the attacker is able to force the internal state to be equal to some S ( t ) for t 0 and the attack works nonetheless. In practice, however, it is usually easier to force it to S ( 0 ) by simply re-initializing the cipher, also known as nonce-misuse. If the attacker has hardware access to the device under inspection, this assumption surely poses no problem. For the injection itself we only have small restrictions, namely that the fault must happen in a short time period and only in one single byte representing exactly one of the registers.
Assumption 3.
For a known T N we are able to inject a random byte-fault ε F 2 8 in a random register R R of the internal state at a random time t T during the generation of the keystream. (This means that the value R ( t ) of register R at time t is replaced by R ( t ) + ε .)
To be more precise, we assume that an injection at time t happens before the corresponding keystream output z ( t ) is computed, i.e., an injection at time t can already affect the keystream output of the same time t. Notice that this assumption does not require us to know the injected fault ε , nor its precise temporal or spacial resolution. The only requirement we have is that the injections happen in a short time period T. For the random distributions of the faults and the affected registers we also impose no restrictions.
Let us point out right away that our experimental results were obtained using uniform distributions and the time period T = { 1 , , 10 } , i.e., the first ten clock cycles. We would expect similarly good results for other distributions and sets T.
In the following, we fix a finite T N and assume that the above assumptions are satisfied for this set T. Recall that we also fixed an instance of the Enocoro stream cipher S with internal state S ( t ) , keystream z = ( z ( t ) ) t 0 , and set of registers R .
Definition 1.
Let ( R , t ) R × T , let z ˜ = ( z ˜ ( t ) ) t 0 be the keystream produced by the cipher if a fault ε F 2 8 is injected into R at time t, and let z diff = z + z ˜ .
(a) 
The tuple ( R , t ) is called aninjection point.
(b) 
The tuple ( R , t , z diff ) is called afault injection, where ( R , t ) is itsinjection point, z ˜ = z diff + z itsfaulty keystream, and z diff itsdifferential keystream.
If the injected fault ε F 2 8 is relevant in the context, we also denote the fault injection ( R , t , z diff ) by ( R , t , ε , z diff ) .
Under our assumptions an attacker is able to inject a fault ε F 2 8 at the injection point ( R , t ) R × T and observe the faulty keystream z ˜ , without knowing ε or ( R , t ) . From the original keystream one can then simply determine the differential keystream z diff . Hence, for every fault injection ( R , t , ε , z diff ) , we assume that an attacker is only in possession of z diff .
In the following section, we discuss the problem of finding the injection point of a fault injection and how one can use this information to gather information on the internal state of the cipher.

4. Differential Clocking Algorithm and Fault Localization

At the heart of every differential fault attack lies the propagation and computation of so-called differentials. These are the in- and output differences of a non-linear function used in the cipher. To precisely track the effect of a fault injection on the internal state and the keystream output we introduce a Differential Clocking Algorithm. This algorithm returns a set of linear polynomials that relate distinct differentials with one another and with the keystream output. As a consequence, it tells us exactly if—and how—certain differentials can be computed from the faulty keystream. Moreover, the output helps to decide whether a given differential keystream was produced by a fault injection at a certain injection point.
We use the following definition of a differential; notice that we only consider differentials in the non-linear function s 8 . This is sufficient here as no other non-linear functions are used in the specification of the Enocoro stream ciphers.
Definition 2.
Let ( δ , Δ ) ( F 2 8 ) 2 and x F 2 8 with s 8 ( x + δ ) = s 8 ( x ) + Δ . Then ( δ , Δ ) is called adifferentialin x, δ itsinput difference, and Δ its output difference, respectively.
The goal of a fault injection is to find as many differentials as possible, since every differential in x gives us information on x, as the next remark points out.
Remark 1.
Let R R , t 0 , and ( δ , Δ ) be a differential in the value R ( t ) F 2 8 of the register R at time t. Then we clearly have:
R ( t ) S ( δ , Δ ) : = { x F 2 8 s 8 ( x + δ ) = s 8 ( x ) + Δ }
So every differential in R ( t ) corresponds to a set of bit-tuples that contains R ( t ) . Given multiple differentials ( δ 1 , Δ 1 ) , , ( δ s , Δ s ) in the same register value R ( t ) , we also have:
R ( t ) S ( δ 1 , Δ 1 ) , , ( δ s , Δ s ) : = i = 1 s S ( δ i , Δ i )
Table 1 shows the average size of this set for one and more differentials. One can see that in a vast majority of all cases, two differentials suffice to uniquely determine R ( t ) . (Also notice that for s = 1 we have at least two solutions, as both R ( t ) and R ( t ) + δ are in S ( δ , Δ ) .)
Before we discuss the use of differentials in detail, we present the Differential Clocking Algorithm that forms the basis of all subsequent analyses.
Write the clock -function for S ( F 2 8 ) n b + 2 as:
clock ( S ) = ( clock 0 ( S ) , , clock n b + 1 ( S ) ) .
Then from the specification (see Section 2) we know that clock 0 , , clock n b 1 are all linear. Additionally, also keystr is a linear function.
For τ 0 we now define the polynomial ring:
P τ = F 2 [ e m , d j , m ( i ) , D j , m ( i ) , z m ( i ) 1 m 8 , 0 i τ , 1 j 4 ]
To keep the presentation simple, we abbreviate ( e 1 , , e m ) by e, ( z 1 ( i ) , , z 8 ( i ) ) by z ( i ) , etc.
Algorithm 1: Differential Clocking Algorithm.
Cryptography 05 00026 i001
Conceptually, this algorithm traces the propagation of a generic fault e = ( e 1 , , e 8 ) , injected at the injection point ( R , t ) , through the internal state and its differential keystream output, represented by the indeterminates z ( i ) . The algorithm keeps track of the structure of the differential internal state in terms of the fault and its propagations. With every clocking, the (differential) state, S ˜ gets updated as follows: if a register value is updated linearly, we can use the linear update function for the differential state as well (line 9). If the update function is non-linear, we introduce new indeterminates D i ( t ) representing the output difference in that specific part. This is done in line 10 where we replace each output of the function s 8 with inputs b k j by a new indeterminate. At the same time, we also keep track of the inputs to these non-linear functions using the indeterminates d i ( t ) in line 6. In this way, ( d j ( i ) , D j ( i ) ) takes the role of a generic differential in b k j ( i ) . In that context, line 7 is correct since s 8 is bijective: if the input difference is zero, then the output difference has to be zero, too. Finally, line 4 ensures that the differential keystream is related correctly to the differential internal state.
From this, we immediately see that, among others, the linear polynomials in L clearly relate the differential keystream indeterminates z ( i ) with the differentials in the values of the registers b k 1 , b k 2 , b k 3 , and b k 4 at all the times steps i { t , , τ } .
For better formalization, we denote the ideal generated by the output of Algorithm 1 by L τ ( R , t ) , where ( R , t ) R × T is the injection point and τ 0 . Moreover, the elimination ideal
Z τ ( R , t ) : = L τ ( R , t ) F 2 [ z m ( 0 ) , , z m ( τ ) 1 m 8 ]
in the keystream indeterminates will play a major role later on. Notice that a generating set of this ideal can be found via an appropriate Gaussian elimination of the linear polynomials in L τ ( R , t ) . Moreover, for a set of polynomials S F 2 [ x 1 , , x n ] we denote its set of zeros in F 2 n by:
Z F 2 ( S ) : = { ( a 1 , , a n ) F 2 n f ( a 1 , , a n ) = 0 for all f S } .
Now the next result is an immediate consequence of the above discussion.
Proposition 1.
Let ( R , t , ε , z diff ) be a fault injection and let ( δ 1 ( i ) , Δ 1 ( i ) ) , , ( δ 4 ( i ) , Δ 4 ( i ) ) be the differentials corresponding to b k 1 ( i ) , b k 2 ( i ) , b k 3 ( i ) , b k 4 ( i ) for 0 i τ which appear during the generation of the faulty keystream of the fault injection. Then we have
( ε , δ 1 ( 0 ) , Δ 1 ( 0 ) , , δ 4 ( τ ) , Δ 4 ( τ ) , z diff ( 0 ) , , z diff ( τ ) ) Z F 2 ( L τ ( R , t ) )
and thus, in particular
( z diff ( 0 ) , , z diff ( τ ) ) Z F 2 ( Z τ ( R , t ) ) .
Remark 2.
In view of the first part of this proposition, we see that one might be able to determine certain input and output differences from the differential keystream z diff , if the injection point ( R , t ) is known. For this, we compute a generating set of L τ ( R , t ) and consider the substitution z ( i ) z diff ( i ) for all 0 i τ . If the resulting system of linear equations has a unique solution for some of the indeterminates d j ( i ) and D j ( i ) , then these solutions correspond exactly to their in- and output differences δ j ( i ) , and Δ j ( i ) , respectively. Ideally, this happens for matching pairs of differences such that one can obtain a differential in some register value b k j ( i ) .
For Enocoro-128v2 it turns out that, for each injection point, between four and six differentials in the register b 2 can be found. All of this is, however, only possible, if the precise injection point is known. Thus we now focus on how to determine this injection point given just a corresponding faulty keystream.
A straightforward approach for this uses the previous proposition: Given the differential keystream z diff , one can check for all injection points ( R , t ) R × T whether ( z diff ( 0 ) , , z diff ( τ ) ) is a zero of Z τ ( R , t ) .
Clearly, a limitation of this method is that if the sets Z τ ( R , t ) and Z τ ( R , t ) are equal for two injection points ( R , t ) and ( R , t ) , the injection points cannot be distinguished. This hints at the more fundamental issue that, in general, there is no unique answer to our question, i.e., there are differential keystreams that can be produced from fault injections into distinct injection points.
Definition 3.
Two injection points ( R , t ) , ( R , t ) R × T are calledequivalentif and only if L τ ( R , t ) = L τ ( R , t ) for all τ 0 .
If two fault injections are equivalent according to this definition, then all the input and output differences are based in the same way on the previous differences and, in particular, the fault ε . Thus for any two fault injection sequences with the same fault ε in those injection points, the differential keystreams must be equal. This shows that points in the same equivalence class cannot be distinguished using just the differential keystream. However, since our fault analysis is based on these sets, L τ ( R , t ) , it is also sufficient to just determine the equivalence class.
Under certain conditions of the stream cipher’s parameters, the number of time steps it takes for a fault to affect the keystream is determined uniquely by the injection point, independent of the values of the internal state and the injected fault. This allows us to attribute the injection point corresponding to a given differential keystream to one of just nine equivalence classes. In particular, this result is applicable for our attack on Enocoro-128v2 (and also for Enocoro-80).
Proposition 2.
Assume that the parameters of the Enocoro stream cipher S satisfy:
k 1 q 1 < p 1 < k 2 q 2 < p 2 < k 3 q 3 < p 3 < k 4 .
(a) 
For every injection point ( R , t ) R × T there is a unique s N with:
t s t + max { k 1 k 4 + n b , k 2 k 1 , k 3 k 2 + 1 , k 4 k 3 }
such that for every fault injection ( R , t , z diff ) we have z diff ( 0 ) = = z diff ( s 1 ) = 0 and z diff ( s ) 0 .
Let ψ : R × T N be the map assigning each injection point ( R , t ) to the index s N , as above.
(b) 
Let s N . Then the set of injection points ψ 1 ( s ) : = { ( R , t ) R × T ψ ( R , t ) = s } contains at most nine equivalence classes.
Proof. 
For part (a) it suffices to show that it takes a fixed amount of time steps less than max { k 1 k 4 + n b , k 2 k 1 , k 3 k 2 + 1 , k 4 k 3 } for a fault in R ( t ) to reach the keystream. If R { a 0 , a 1 } , then a non-zero keystream difference can be found in z ( t ) or z ( t + 1 ) , respectively. Now we can assume that R is part of the buffer, which we decompose as follows:
{ b k 4 + 1 , , b n b 1 , b 0 , , b k 1 } { b k 1 + 1 , , b k 2 } { b k 2 + 1 , , b k 3 } { b k 3 + 1 , , b k 4 } .
By definition of clock , the fault can only spread to the differential keystream via the registers b k 1 , b k 2 , b k 3 , b k 4 , and a 0 , a 1 . Thus we only need to show that a fault in R ( t ) spreads to one of these registers in a small enough fixed number of time steps. By assumption on the parameters of the Enocoro cipher S , a fault in one of the above sets stays in the registers of that same set until it reaches exactly one of the registers in { b k 1 , b k 2 , b k 3 , b k 4 } . Moreover, the precise number of steps until this happens is determined by ( k 1 t ) mod n b , k 2 t , k 3 t , and k 4 t respectively. If the fault is in b k 1 , b k 2 , or b k 4 , then after just one additional clocking it is present in a 1 and thus affects the keystream of the same time stamp. In case the fault is in b k 3 , two additional time steps are required. One for the fault to get to a 0 and another one to spread to a 1 . As k 4 k 3 > 1 we also know that the fault in a 1 must be non-zero, since no other input for the state update of a 1 can already be corrupted. The claim is an immediate consequence.
In order to prove (b), notice that the above shows that the set ψ 1 ( s ) is a subset of:
{ ( a 1 , s ) } { ( a 0 , s 1 ) } { ( b i , s ( ( k 1 i mod n b ) + 1 ) ) k 4 i < n b or 0 i k 1 } { ( b i , s ( k 2 i + 1 ) ) k 1 < i p 1 } { ( b i , s ( k 2 i + 1 ) ) p 1 < i k 2 } { ( b i , s ( k 3 i + 2 ) ) k 2 < i p 2 } { ( b i , s ( k 3 i + 2 ) ) p 2 < i k 3 } { ( b i , s ( k 4 i + 1 ) ) k 3 < i p 3 } { ( b i , s ( k 4 i + 1 ) ) p 3 < i k 4 } .
A straightforward analysis shows that the injection points in each of those nine sets are indeed equivalent. □
For this proposition the actual equations in L τ ( R , t ) are irrelevant, the result is derived only from the structure of the Enocoro stream ciphers. In combination with Proposition 1, this gives us a fairly good tool to find a small set of equivalence classes containing the class of the actual injection point.
Proposition 3 (Locating Injection Points).
Assume that the parameters of the stream cipher S under consideration satisfy:
k 1 q 1 < p 1 < k 2 q 2 < p 2 < k 3 q 3 < p 3 < k 4 .
Let τ max T + max { k 1 k 4 + n b , k 2 k 1 , k 3 k 2 + 1 , k 4 k 3 } . Let ( R , t , z diff ) be a fault injection and let s 0 be minimal with z diff ( s ) 0 .
Then, ( R , t ) belongs to one of the, at most, nine equivalence classes contained in:
{ ( R , t ) ψ 1 ( s ) ( z diff ( 0 ) , , z diff ( τ ) ) Z F 2 ( Z τ ( R , t ) ) } .
This proposition admits an efficient implementation: the equivalence classes in ψ 1 ( s ) R × T can be represented by less than nine elements, and in view of the proof of Proposition 2 we can immediately derive those from s. Now, it suffices to check for each one of these injection points ( R , t ) , if the first τ + 1 differential keystream outputs are a zero of the (linear) generators of Z τ ( R , t ) , as this ideal is equal for equivalent injection points. The parameter τ should only be chosen large enough that the ideals, Z τ ( R , t ) , allow us to distinguish distinct equivalence classes as well as possible.
Remark 3.
One might think that the larger τ is, the more linear polynomials one can find in Z τ ( R , t ) . Although a larger τ surely increases the size of L τ ( R , t ) , the number of indeterminates that appear in this set increases as well. Close inspection of Algorithm 1 shows that the output contains between 32 t + 40 τ + 64 and 72 τ + 72 linear equations in 72 τ + 80 indeterminates. Thus, the system never has a unique solution. Furthermore, the more coordinates of the differential state S ˜ ( t ) are non-zero (in particular b ˜ k 1 , b ˜ k 2 , b ˜ k 3 , and b ˜ k 4 ), the fewer polynomials are added to L in line 6. Now, it suffices to notice that with each additional loop-iteration, more entries of S ˜ ( t ) are assigned to non-zero entries. This suggests that for some large enough τ 0 the ideal Z τ ( R , t ) could get stationary.
In the remainder of this section, we show the implications of the previous propositions for Enocoro-128v2. As indicated by the last remark, in practice, linear equations in the keystream indeterminates can only be derived from the first few non-zero differential keystream outputs.
Example 2.
For Enocoro-128v2 we have that Z t + 8 ( b 0 , t ) = = Z t + 80 ( b 0 , t ) and this ideal is generated by 24 + 8 t linear polynomials. For other injection points, we also come to the conclusion that Z τ ( R , t ) seems to get stationary already for τ = t + 8 .
The next remark collects some special properties we could observe when applying Proposition 3.
Remark 4.
Consider the parameters of Enocoro-128v2, and let s 0 .
(a) 
From Proposition 3 (and its proof), we see that ψ 1 ( s ) contains (at most) nine distinct equivalence classes with representatives ( a 0 , s ) , ( a 1 , s 1 ) , ( b 6 , s 2 ) , ( b 7 , s 1 ) , ( b 15 , s 3 ) , ( b 16 , s 2 ) , ( b 28 , s 2 ) , ( b 29 , s 1 ) , and ( b 2 , s 1 ) respectively.
(b) 
For s + 3 τ s + 80 , one can check that the sets Z τ ( R , t ) for these representatives form only a total of four distinct ideals; these are:
Z τ ( b 2 , s 1 ) Z τ ( b 6 , s 2 ) = Z τ ( b 7 , s 1 ) Z τ ( b 15 , s 3 ) = Z τ ( b 16 , s 2 ) = Z τ ( a 0 , s 1 ) Z τ ( b 28 , s 2 ) = Z τ ( b 29 , s 1 ) = Z τ ( a 1 , s )
Thus, our method cannot distinguish all different equivalence classes. In the best case, however, we can still learn to which of the four groups of equivalence classes { ( b 2 , s 1 ) } , { ( b 6 , s 2 ) , ( b 7 , s 1 ) } , { ( b 15 , s 3 ) , ( b 16 , s 2 ) , ( a 0 , s 1 ) } , or { ( b 28 , s 2 ) , ( b 29 , s 1 ) , ( a 1 , s ) } the actual injection point belongs to.
(c) 
Our experiments indicate that we are always in that best case. This means that an injection point is attributed to exactly the correct set of equivalence classes. Or in other words, there seems to be no differential keystream z diff that is a zero of more than one of the above four ideals. So, in practice, we can determine a set comprising of less than three injection points where one of them is equivalent to the real injection point.
This result is also summarized graphically in Figure 2. The injection points with the same base colour share the same ideal Z τ ( R , t ) , and those that also have the same colour shading are indeed equivalent.
(d) 
At last, we want to remark that in each of those four groups of equivalent injection points, the timings of the injection points are distinct. So if the time t of the injection point ( R , t ) is known, we can directly infer to the register R, and by that, uniquely identify the injection point.
To put it differently: if an actual physical implementation of our fault model allows us to measure the precise time a fault was injected in an instance of Enocoro-128v2, then, in practice, the corresponding injection point can be found with little effort. Using this additional information, our fault attack becomes considerably more efficient, while requiring the same small number of fault injections.
Example 3.
To illustrate this further, consider a fault injection ( b 18 , 3 , z diff ) for a given instance of Enocoro-128v2, let T = { 1 , , 10 } , and let τ > 35 . Then the first non-zero differential keystream output is z diff ( 15 ) .
(a) 
By Proposition 2, the injection points ( R , t ) R × T with ψ ( R , t ) = 15 can be partitioned into (at most) nine equivalence classes. These are given by:
{ ( b 30 , 10 ) , ( b 31 , 11 ) , ( b 0 , 12 ) , ( b 1 , 13 ) , ( b 2 , 14 ) } , { ( b 3 , 10 ) , , ( b 6 , 13 ) } , { ( b 7 , 14 ) } , { ( b 8 , 5 ) , , ( b 15 , 12 ) } , { ( b 16 , 13 ) } , { ( a 1 , 14 ) } , { ( b 17 , 2 ) , , ( b 28 , 13 ) } , { ( b 29 , 14 ) } , { ( a 0 , 15 ) } ,
intersected with R × T . After this intersection, five of those sets are empty. The remaining equivalence classes have representatives ( b 2 , 14 ) , ( b 6 , 13 ) , ( b 15 , 12 ) , and ( b 28 , 13 ) , respectively.
(b) 
Now we check whether the first τ + 1 elements of z diff are a zero of Z τ ( b 2 , 14 ) , Z τ ( b 6 , 13 ) , Z τ ( b 15 , 12 ) , and Z τ ( b 28 , 13 ) , respectively. As indicated in the previous remark, in practice it is only a zero of one of them, i.e., we are likely to observe that it is a zero only of Z τ ( b 28 , 13 ) .
This uniquely determines the equivalence class of the injection point, and indeed ( b 28 , 13 ) is equivalent to ( b 18 , 3 ) .
To finish this section, recall Remark 2, where we explained how to compute input and output differences from the set L τ ( R , t ) and the differential keystream z diff , if we are given a fault injection ( R , t , z diff ) . Table 2 gives an overview of the number of input and output differences that can be computed, as well as the register values in which those can be combined to differentials. Since these numbers only depend on the ideal L τ ( R , t ) , it suffices to list one injection point for each equivalence class.
Remark 5.
For an actual physical implementation of a fault injector satisfying our assumptions, the injection points that can be observed adhere to some probability distribution on R × T . If this distribution is known (or can be estimated), one can assign, to every equivalence class, the probability that the injection point lies in it based on the elements that the equivalence class has in common with R × T . This is the basis of a minor optimization in the fault attack where we perform an exhaustive search over the different injection points that come into question after using Proposition 3.

5. Combining Fault Injections

In this section we show how the information gain of several fault injections can be combined in a very structured and automated way. The core idea for this was first developed in [19]. There, a connection was drawn between Horn clauses that resemble relations between the values of registers at different time steps, guess-and-determine (GD) attacks, and fault attacks. In this work, we extend this approach to not only consider exact relations among the register values, but also containments of register values in small sets that are derived from other register values.
For completeness, we first introduce the original approach, before we explain our adjustments.
Construction 1.
Let τ 0 be the number of time steps to consider. Introduce propositional logic variables A τ = { A R ( t ) 0 t τ , R R } where A R ( t ) corresponds to the truth value of the statement ‘The value of register R at time t is known.’ Now relations among the values of the registers at consecutive times can be derived from the next-state-function clock . These relations are of the form:
R ( t ) = φ R 1 ( t 1 ) , , R k ( t k )
with R , R 1 , , R k R and t , t 1 , , t k { 0 , , τ } . This means that if the value of R i is known at time t i for all i = 1 , , k , so can be the value of register R at time t. In the logic setting this corresponds to the implication:
A R 1 ( t 1 ) A R k ( t k ) A R ( t )
In particular, such implications are Horn formulas, and we also denote them by the equivalent formula ¬ A R 1 ( t 1 ) ¬ A R k ( t k ) A R ( t ) , or the clause { ¬ A R 1 ( t 1 ) , , ¬ A R k ( t k ) , A R ( t ) } .
We collect all Horn clauses that one can derive in this way from the first τ 0 time steps using the definition of clock in the set C τ .
The following remark gives a few more details on how this set C τ can be constructed in the case of the Enocoro stream cipher.
Remark 6.
For any Enocoro stream cipher S every equation that is used to define the next-state-function clock admits as many clauses as distinct register values occur in them. As an example, consider b 0 ( t + 1 ) = b n b 1 ( t ) + a 0 ( t ) which holds for all t 0 . By rewriting it to b n b 1 ( t ) = b 0 ( t + 1 ) + a 0 ( t ) and a 0 ( t ) = b 0 ( t + 1 ) + b n b 1 ( t ) we get two more equations. Altogether they correspond to the three Horn formulas:
( A b n b 1 ( t ) A a 0 ( t ) ) A b 0 ( t + 1 ) , ( A b 0 ( t + 1 ) A a 0 ( t ) ) A b n b 1 ( t ) , ( A b 0 ( t + 1 ) A b n b 1 ( t ) ) A a 0 ( t ) .
By careful counting, we see that this construction admits exactly ( n b + 16 ) · ( τ 1 ) clauses.
In the following we denote the set of logical variables appearing in a set of clauses C by Vars ( C ) = { A 1 , , A n } , and for F C and ( a 1 , , a n ) F 2 n we define F ( a 1 , , a n ) as the truth value of F under the assignment A i a i , where 1 = true and 0 = false , as usual. The set of satisfying assignments of C is denoted by:
Sat ( C ) : = { a F 2 n F ( a ) = 1 for all F C }
Moreover, we denote the well-known Marking Algorithm (see [31]) of Horn logic by Mark . Recall that it takes a set of Horn formulas as input and returns the unique satisfiable assignment of minimal hamming weight, if it exists.
In [19], [Corollary 6.9] a deterministic algorithm based on Gröbner basis computations was proposed to find minimal sets G = { { A i 1 } , , { A i k } } , such that Mark ( C G ) = ( 1 , , 1 ) . Such a set, G, is called a guess basis for C. If C = C τ as in the above construction, then the following two statements are equivalent: G = { { A R 1 ( t 1 ) } , , { A R k ( t k ) } } is a guess basis for C τ , and the internal state can be computed from R 1 ( t 1 ) , , R k ( t k ) using the equations corresponding to the clauses in C τ .
This already indicates that every guess basis G for C τ gives rise to a guess-and-determine (GD) attack with an attack complexity of at most 2 8 · # G . Using mixed-integer linear programming solvers it was shown in [11] that for Enocoro-128v2 the smallest guess basis for C 16 , as in Construction 1, consists of at most 18 logical variables. Thus, the best GD attack requires a guess of no more than 18 register values, which is just slightly more complex than guessing the 16 bytes of the key and IV. This result tells us that the fault injections should provide us with information on the internal state comparable to at least 18 register values in order to be able to retrieve the internal state.
The following remark motivates as to why looking at several fault injections independently is not likely to result in a fault attack with complexity below 2 32 .
Remark 7.
Using Table 2 we see that every fault injection admits the knowledge of up to five differentials for the register b 2 . Assume that we repeatedly inject faults where the fault injection point can be determined uniquely, and ultimately we are able to derive so many differentials such that the value of b 2 can be determined for m consecutive time steps. Note that this requires at least 2 · m 5 fault injections, as a single differential can never uniquely determine a registers value.
To check whether we can compute the internal state from these register values we can switch to the logical setting: let τ 0 and C τ as in Construction 1. Moreover, let F m = { { A b 2 ( 1 ) } , , { A b 2 ( m ) } } model the fact that the value of b 2 is known for m consecutive time steps.
A simple computation shows that Mark ( C 500 F m ) ( 1 , , 1 ) for all 1 m 500 . This means that even more than 200 fault injections are not sufficient to determine the internal state directly.
Nonetheless, it might be possible that guessing just some additional register values might make this feasible. As long as we only need to guess a small amount of values this is clearly acceptable. This corresponds exactly to finding an optimal guess basis for C τ F m . Using the Gröbner basis method of [19], we computed those for C 35 F m where 1 m 35 . All of these guess bases contained more than four elements, i.e., the internal state can only be determined if, additional to the fault injections, at least four bytes are guessed.
This shows that a search space 2 32 is still left, even after considering more than 14 fault injections.
The remark indicates that looking at just the differentials that can be deduced from multiple fault injections isolated from the others, is not ideal. Therefore we are in need of a more sophisticated approach that better captures the interplay of various fault injections.
In the following, we take a different perspective on the concept of a guess basis. Instead of looking at the register values that need to be known to be able to determine the internal state, we focus on how this is done, i.e., the order in which the internal state can actually be computed and which formulas (and functions) are used in every step. Moreover, instead of functions that resemble exact relations among the register values, we allow functions that omit a small set in which another registers content is contained. To cope with the fact that these sets may—on average—have different sizes, we accompany the corresponding Horn clauses with a weight resembling the average size of this set.
Using this refined concept, we capture the information we gain on the internal state using multiple fault injections better. This includes modelling all the input and output differences that occur during the propagation of a fault injection by logical variables such that we do not only utilize those which are deduced from the differential keystream right away.
In the next definition, we denote the set of negative literals of a clause F by Neg ( F ) , and the set of positive literals by Pos ( F ) .
Definition 4.
Let C = { F 1 , , F n } be a set of weighted Horn clauses where w i R is the weight of F i .
(a) 
A sequence G = ( F i 1 , , F i s ) in C is called aguessing path, if Mark ( { F i 1 , , F i s } ) = ( 1 , , 1 ) and Neg ( F i l ) k < l Pos ( F i k ) for all l { 1 , , s } .
(b) 
Theweightof a guessing path G = ( F i 1 , , F i s ) is defined as ω ( G ) = j = 1 s w i j .
(c) 
A guessing path G in C is calledoptimalif there is no other guessing path G in C with ω ( G ) < ω ( G ) .
Informally speaking, a guessing path G represents the order in which the Marking Algorithm applied to { F i 1 , , F i s } can choose the clauses for the markings. Thus it is also clear that Mark ( C ) = ( 1 , , 1 ) , if and only if there exists a guessing path G in C. In fact, the notion of a guessing path can be seen as a generalization of the concept of a guess basis.
Remark 8.
Let G be a guess basis for a set of Horn clauses C, and let C = C { { A } A Vars ( C ) } be a set of weighted Horn clauses where all F C have weight 0, and all F C \ C have weight 1. Then we have:
(a) 
If G = ( F 1 , , F k ) is a guessing path in C , then G = { { A } A Vars ( C ) } { F 1 , , F k } is a guess basis for C. In particular we have # G = ω ( G ) .
(b) 
If G = { { A 1 } , , { A n } } is a guess basis for C, let G be the order in which the clauses of G C C are processed when computing Mark ( G C ) . Then G is a guessing path in C with ω ( G ) = # G .
(c) 
If G is an optimal guess basis for C, then we have for any optimal guessing path G in C that ω ( G ) = # G .
With this improved notion we are able to adequately treat relations arising from differentials ( δ , Δ ) in register values R i ( t ) , where we have R i ( t ) S ( δ , Δ ) . More precisely, we construct a set of weighted Horn clauses as follows.
Construction 2.
Let τ 0 be the number of time steps to be considered, and consider a set { ( R 1 , t 1 , z diff , 1 ) , , ( R m , t m , z diff , m ) } of m 0 fault injections. For every 1 s m denote the differentials that appear during the fault propagation of the injection ( R s , t s , z diff , s ) in the registers b k j ( i ) for every 0 i τ and 1 j 4 by ( δ j , s ( i ) , Δ j , s ( i ) ) . Furthermore, denote the set of all input and output differences of this fault injection by D s .
Introduce a set of propositional logic variables:
A τ = { A R ( t ) R R , 0 t τ } { A d j , s ( t ) , A D j , s ( t ) 1 j 4 , 0 t τ , 1 s m }
with the following correspondence:
A R ( t ) The value of register R at time t is known . A d j , s ( t ) The input difference in b k j at time t of the fault injection ( R s , t s , z diff , s ) is known . A D j , s ( t ) The output difference in b k j at time t of the fault injection ( R s , t s , z diff , s ) is known .
Similar to Construction 1, the next-state function clock and the fault injections admit relations of the form:
R ( t ) φ R 1 ( t 1 ) , , R k ( t k )
with R , R 1 , , R k R { d j , s , D j , s 1 j 4 , 1 s m } and t , t 1 , , t k { 0 , , τ } . This means that if the value of R i is known at time t i for all i = 1 , , k , one can determine the value of register R at time t as an element of a set. We translate this to our logical setting as the Horn clause:
( A R 1 ( t 1 ) A R k ( t k ) ) A R ( t )
with weight w = log 2 2 8 k ( r 1 , , r k ) ( F 2 8 ) k # φ ( r 1 , , r k ) equal to the logarithm of the average size of the set the relation is based on.
There are various ways to construct such a set of weighted Horn clauses and their associated functions for Enocoro stream ciphers. Clearly, one can adapt the functions that appear in Construction 1 such that they return a set containing exactly one element, and assign their respective clause the weight 0.
In view of Remark 7, it can also be useful to allow the guessing of entire register values. To model this, see Remark 8, we consider the fact clauses { A R ( i ) } for each R R and 0 i τ of weight 8, whose corresponding functions take no input and return the set F 2 8 .
The clauses so far use no fault information. Now let us describe precisely how to construct clauses encoding the information gain by fault injections and their mutual interplay.
Remark 9.
Consider the setting as in Construction 2. The desired weighted Horn clauses and their respective functions can also be found in the following ways:
(a) 
In Remark 2, we explained how certain input and output differences in D s can be computed from the differential keystream z diff , s using the set L τ ( R s , t s ) P τ . For each such difference d D s , we can consider the corresponding logical variable A d as a fact clause of weight 0. The corresponding function takes no input and returns the set containing only the value of the respective difference.
(b) 
From every differential ( δ j , s ( i ) , Δ j , s ( i ) ) we get the following three relations:
b k j , s ( i ) S ( δ j , s ( i ) , Δ j , s ( i ) ) δ j , s ( i ) s 8 1 ( Δ j , s ( i ) s 8 ( b k j ( i ) ) ) b k j ( i ) Δ j , s ( i ) s 8 ( b k j ( i ) ) + s 8 ( b k j ( i ) + δ j , s ( i ) )
which give rise to three weighted Horn formulas:
A d j , s ( i ) A D j , s ( i ) A b k j ( i ) of weight 1.352 , A b k j ( i ) A D j , s ( i ) A d j , s ( i ) of weight 0 , A b k j ( i ) A d j , s ( i ) A D j , s ( i ) of weight 0 .
where the weight of the first formula can be deduced from Table 1.
Additionally, for every subset F { 1 , , m } we also have b k j ( i ) s F S ( δ j , s ( i ) , Δ j , s ( i ) ) which translates to the Horn clause s F A d j , s ( i ) A D j , s ( i ) A b k j ( i ) . The corresponding weights can again be deduced from Table 1 if # F < 4 .
(c) 
The set L τ ( R s , t s ) also contains linear equations that relate the bits of the input and output differences in D s to one another. Each subset of those equations that relates all bits of one difference with the bits of other differences can then be translated to a Horn clause of weight 0. The set of all such relations can be computed using linear algebra techniques. However, we do not want to consider all those exponentially many clauses, since we need to quickly process them later on. Thus—for our experiments—we used the following strategy to find a set of such (linear) relations:
(1) 
Replace the keystream variables z ( i ) by the differential keystream z diff , s ( i ) in L τ ( R s , t s ) , and let L be a linear system generating the resulting ideal. Apply Gauss-Jordan elimination to L where we use the lexicographic ordering on the indeterminates of P τ .
(2) 
For every d D s construct the set L d L where the eight indeterminates corresponding to d appear. Let D d D s be the set of differences whose corresponding indeterminates appear in the set L d .
(3) 
For each subset { d 1 , , d k } D d \ { d } check whether the indeterminates corresponding to d are uniquely determined by L d if the differences d 1 , , d k are known. In that case we found a linear relation of the form d { φ ( d 1 , , d k ) } . This corresponds to a Horn formula of weight 0.
From now on, let C τ , ( ( R 1 , t 1 , z diff , 1 ) , , ( R m , t m , z diff , m ) ) be a set of weighted Horn clauses as described above. Notice that the last part of the remark ensures that there has to exist at least one guessing path. Given any such guessing path, Algorithm 2 can be used to determine the internal state of the stream cipher. (Notice the similarity to the GD attack framework in [19].)
Proposition 4.
Algorithm 2 is an algorithm that computes the inital state S ( 0 ) of the stream cipher.
Algorithm 2: Guessing Path Attack.
Cryptography 05 00026 i002
Proof. 
By definition of a guessing path, we have Neg ( F i ) { A R 1 , , A R i 1 } . Thus, the set S m , in the m-th iteration of the for-loop, can be computed in line 4 as the values r 1 , , r m 1 have already been chosen in a previous iteration. If the value r i is chosen as the value of the register (or input/output difference) corresponding to the logical variable A R i in line 6, then, by construction of the set C and the functions φ i , the value of R m is in S m . Thus, the algorithm terminates correctly. Since S i F 2 8 , by construction, lines 6 and 7 are performed less than 2 8 times in a single iteration. By induction on n, we also see that every step of the algorithm is performed at most 2 8 n times. This shows that the algorithm terminates in finitely many steps. □
Now we can also see why the construction of the weights as the logarithms to base 2 of the average size of the expected size of the sets S i is indeed useful.
Remark 10.
Let C be a set of weighted Horn clauses as in Construction 2, and let G be a guessing path in C. Assume that the values corresponding to the variables in Vars ( C ) behave like independent random variables of a uniform distribution. Then the expected size of the search space considered by Algorithm 2, used with the guessing path G , is bounded from above by 2 ω ( G ) .
Next, we compare the Guessing Path Attack to an approach using SAT solvers for combining partial information.
Remark 11.
Algorithm 2 proceeds in a way which bears some similarity to the approach of a DPLL-based SAT-solver. There we deal with Boolean variables instead of registers values here, the role of unit propagation there is taken by the guessing path here, and conflicts arise as empty sets S i (in line 5) and incorrect keystreams (in line 14).
Therefore, it appears possible to mimic the Guessing Path Attack with a modern SAT-solver by using the given guessing path as a variable guidance strategy and expressing the functions corresponding to weighted Horn clauses as CNF-formulas. (Here each register would have to be represented by eight Boolean variables.) While such a SAT-based approach could possibly deliver good timings, since it can learn from incorrect intermediate assignments, it also requires a substantial amount of work to construct an appropriate CNF encoding. It is unclear whether one can appropriately adapt the variable selection routine of the chosen SAT solver. In contrast to this, our Algorithm 2 admits a straightforward recursive implementation and proves to be more than sufficient for the requirements of our attack (see Section 7).
As a next step towards our fault attack, we need an efficient way to find guessing paths, since our attack must do this quite frequently. In general, finding optimal guessing paths is a hard problem (in particular harder than computing minimal guess bases, see Remark 8 and [19]). So, instead of finding an optimal one we restrain ourselves to finding paths of small weight. For this we propose Algorithm 3 as a greedy heuristic, based on the Marking Algorithm.
Algorithm 3: Greedy Marking Algorithm.
Cryptography 05 00026 i003
Clearly, this algorithm cannot find optimal guessing paths in general, and should also not be expected to construct good GD attacks all the time. However, in our experiments this simple heuristic proved to be a satisfactory choice which yielded acceptable results.

6. The Fault Attack on Enocoro Stream Ciphers

In this section we combine the algorithms and ideas of the previous two sections and present our fault attack on the Enocoro stream cipher. The attack is constructed in such a way that a new fault injection is only required if the algorithm does not expect to find a solution in a small enough search space. The algorithm takes two parameters as input: w max determines the maximal search space size that should actually be considered in the final step, and τ 0 specifies the number of time steps that are taken into account for the internal state retrieval.
Proposition 5.
Algorithm 4 is a Las-Vegas algorithm that computes the initial state S ( 0 ) , i.e., it may not terminate but when it terminates it computes S ( 0 ) .
Proof. 
If the algorithm terminates, then it must stop in line 11. Now the output is correct by virtue of Algorithm 2. □
In every iteration of line 2, our fault attack consists of up to two stages of exhaustive search: the first is to determine equivalent injection points for the m fault injections (line 6); the second one is outsourced to Algorithm 2 in line 10, but is only performed if it is reasonable to expect a small enough search space by virtue of line 9 (see Remark 10). Notice also that, by Proposition 2, the set L may contain more than 9 elements in every iteration. Therefore, in the worst case, line 6 is executed more than 9 m times. Because of that, our implementation uses (large) lookup-tables for line 7. This is also the reason why we do not recommend to search for optimal guessing paths in line 8, as it would just cost too much time. Instead, Algorithm 3 is a good enough choice. Note also that this heuristic is based on the Marking Algorithm which is known to be a linear-time algorithm [31]. Thus, it should be investigated if Algorithm 3 can be implemented with linear time complexity as well.
Algorithm 4: Enocoro Fault Attack Framework.
Cryptography 05 00026 i004
As a minor optimization, the order in which the elements F F are processed in line 6 can be chosen corresponding to the probabilities that the fault injections lie in the respective equivalence classes, as indicated already in Remark 5. This has no effect on the overall number of fault injections that are required for a successful attack, but ensures that the algorithm terminates faster on average.

7. Experiments and Timings

In this section we present experimental results of our fault attack (Algorithm 4) applied to Enocoro-128v2 using an implementation in the computer algebra system CoCoA-5 [28]. This system has a Python-like language and offers many specialized built-in functions, such as fast Gröbner basis calculations. Moreover, we were able to build upon the implementations for [19], shortening the implementation time and simplifying the code.
The set T that specifies the temporal resolution of the actual injections was chosen as { 1 , , 10 } . The results are based on a total of 500 simulations each, and the computations were carried out on a machine with an Intel Xeon E5-2623 v3 (3.00GHz) processor and 128 GB of RAM.
To aid the selection of the parameters τ and w max , we first consider a simplified version of the attack where the set F , in line 6, contains only a single element in every iteration. This corresponds to a fault attack with a fault model that also allows the attacker to retrieve the exact injection point. (In light of Remark 4.d this is, in practice, also equivalent to knowing just the time of the injection.) Observe that the number of fault injections required for a successful retrieval of the initial state and the weight of the corresponding guessing paths is the same as with our fault attack using the weaker fault model of Section 3. Thus, bad parameters for this simplified version are also bad ones for the full version.
From Proposition 3 we know that τ should be chosen larger than 23. Here we consider τ { 25 , 30 , 35 , 40 } and w max { 16 , 20 } . Table 3 presents the timing of the simplified fault attack for these parameters. There one can see the weight of the final guessing path w = ω ( G ) of line 10 along with the average w ^ of the exponential size of the search space that actually had to be considered. Furthermore, we provide the cumulative time of the repeated applications of our heuristic (Algorithm 3) used in line 8, the overall running time, and the average number of faults that had to be injected.
For larger parameters we did some preliminary experiments and can report that the variance of the timings increased significantly. Already for τ = 40 and w max = 16 , the timings ranged between a few seconds up to over 10 h. Since we target a fault attack that works well in the clear majority of cases, we did no further investigations. Nonetheless, the actual size of the last search space exceeded 2 w max only rarely, i.e., Remark 10 seems to be applicable in practice.
As for smaller parameters, we also ran experiments with τ = 30 and w max = 2 . On average, such an attack requires 9.96 fault injections and takes no more than 90 s to solve for the internal state. This shows that, with the simplified version of our attack corresponding to the stronger fault model, the internal state can be retrieved in negligible time with only about 10 fault injections. (In light of Remark 7 this shows that our structured formalization of the information gain of several fault injections and their interplay pays off very well.)
Looking at the table, we see that the differences between τ = 40 , τ = 35 , and τ = 30 can mainly be described as a significant decrease in the timing and a small (negligible) increase in the number of required fault injections. Only when we consider τ = 25 , the trade-off between timing and number of faults becomes noticeable. Since the complexity of our final fault attack is expected to be exponential in the number of required faults, we consider the trade-off here as acceptable, and favour a slightly larger τ . This motivates why we only consider τ = 30 for the evaluation of our fault attack.
In Table 4 the results of 500 simulations of our fault attack on Enocoro-128v2 (based on the fault model of Section 3) are shown. As above, we give information on the total time spent on finding light-weighted guessing paths with Algorithm 3, the average weight of the last iteration of line 6, the logarithm of the average search space size that had to be considered, and the average number of faults that needed to be injected.
Just as one could expect, the variance of the timings increased significantly, compared to the simplified attack. Nonetheless, in 95 % of all cases the attack finished within 2.5 h of computation. Moreover, we see that the attack is faster if we choose the larger value of w max . At first this may seem counter-intuitive, as this parameter bounds the search space size of the inner exhaustive search of the attack. However, the choice of w max also affects the number of fault injections that are required for the total attack. Consequently, the outer exhaustive search is enlarged. Hence, in view of the fault model, we can see that fewer fault injections actually benefit the timings. Choosing τ = 30 and w max = 20 , we end up with a fault attack that is able to retrieve the internal state, and thereby break the cipher, in about 20 min using less than five fault injections on average.
To conclude, we have presented a fault attack framework for the family of Enocoro stream ciphers that is based on a rather weak fault model, and successfully applied it to the standardized cipher Enocoro-128v2. This clearly shows that appropriate countermeasures should be developed and installed. One suggestion that we would like to offer is to insert a non-linear filter near the keystream output into the definition of the cipher.

Author Contributions

Conceptualization, J.D. and M.K.; methodology, J.D.; software, J.D.; validation, J.D.; formal analysis, J.D.; investigation, J.D.; resources, J.D.; data curation, J.D.; writing—original draft preparation, J.D.; writing—review and editing, J.D. and M.K.; visualization, J.D.; supervision, M.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by DFG (German Research Foundation) project “Algebraische Fehlerangriffe” grant KR 1907/6-2.

Data Availability Statement

The source code of the implementation used for the experiments is available on request from the first author.

Acknowledgments

The authors thank the anonymous referees for their diligent work and several useful suggestions.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hitachi Ltd. Pseudorandom Number Generator Enocoro–Specification Ver. 2.0. 2010. Available online: https://www.cryptrec.go.jp/en/cryptrec_13_spec_cypherlist_files/PDF/23_00espec.pdf (accessed on 22 September 2021).
  2. CRYPTREC. e-Government Recommended Ciphers List. 2021. Available online: www.cryptrec.go.jp/list/cryptrec-ls-0001-2012r6.pdf (accessed on 22 September 2021).
  3. International Organization for Standardization. ISO/IEC 29192-3:2012.2012. 2012. Available online: www.iso.org/standard/56426.html (accessed on 22 September 2021).
  4. Watanabe, D.; Ideguchi, K.; Kitahara, J.; Muto, K.; Furuichi, H.; Kaneko, T. Enocoro-80: A hardware oriented stream cipher. In Proceedings of the 2008 Third International Conference on Availability, Reliability and Security, Barcelona, Spain, 4–7 March 2008; pp. 1294–1300. [Google Scholar]
  5. Daemen, J.; Clapp, C. Fast hashing and stream encryption with PANAMA. In International Workshop Fast Softw. Encryption (FSE ’98); LNCS 1372; Springer: Berlin, Germany, 1998; pp. 60–74. [Google Scholar]
  6. Hell, M.; Johansson, T. Security Evaluation of Stream Cipher Enocoro-128v2; CRYPTREC Technical Report; 2010. Available online: https://www.cryptrec.go.jp/exreport/cryptrec-ex-2008-2010.pdf (accessed on 22 September 2021).
  7. Hitachi Ltd. Stream Cipher Enocoro–Evaluation Report. Available online: https://www.hitachi.com/rd/yrl/crypto/enocoro/enocoro_eval_20100222.zip (accessed on 22 September 2021).
  8. Mouha, N.; Wang, Q.; Gu, D.; Preneel, B. Differential and linear cryptanalysis using mixed-integer linear programming. In International Conference on Information Security and Cryptology; Springer: Berlin/Heidelberg, Germany, 2011; pp. 57–76. [Google Scholar]
  9. Ding, L.; Jin, C.; Guan, J. Slide attack on standard stream cipher Enocoro-80 in the related-key chosen IV setting. Pervasive Mob. Comput. 2015, 24, 224–230. [Google Scholar] [CrossRef]
  10. Jiao, L.; Li, Y.; Hao, Y. Guess-and-determine attacks on PANAMA-like stream ciphers. IET Inf. Secur. 2018, 12, 484–497. [Google Scholar] [CrossRef]
  11. Cen, Z.; Feng, X.; Wang, Z.; Cao, C. Minimizing Deduction System and its Application. 2020. Available online: arxiv.org/abs/2006.05833.pdf (accessed on 22 September 2021).
  12. Boneh, D.; DeMillo, R.A.; Lipton, R.J. On the Importance of Eliminating Errors in Cryptographic Computations. J. Cryptol. 2001, 14, 101–119. [Google Scholar] [CrossRef]
  13. Hoch, J.J.; Shamir, A. Fault analysis of stream ciphers. In Cryptographic Hardware and Embedded Systems (CHES 2004); Joye, M., Quisquater, J.J., Eds.; LNCS 3156; Springer: Berlin/Heidelberg, Germnay, 2004; pp. 240–253. [Google Scholar]
  14. Armknecht, F.; Meier, W. Fault attacks on combiners with memory. In Selected Areas in Cryptography (SAC 2005); Preneel, B., Tavares, S., Eds.; LNCS 3897; Springer: Berlin/Heidelberg, Germany, 2006; pp. 36–50. [Google Scholar]
  15. Debraize, B.; Corbella, I.M. Fault analysis of the stream cipher Snow 3G. In Proceedings of the Fault Diagnosis and Tolerance in Cryptography (FDTC 2009), Lusanne, Switzerland, 6 September 2009; IEEE: Piscataway, NJ, USA, 2009; pp. 103–110. [Google Scholar]
  16. Tunstall, M.; Mukhopadhyay, D.; Ali, S. Differential fault analysis of the advanced encryption standard using a single fault. In International Workshop Inf. Secur. Theory Pract. (WISTP 2011); Springer: Berlin/Heidelberg, Germany, 2011; pp. 224–233. [Google Scholar]
  17. Wong, K.K.H.; Bartlett, H.; Simpson, L.; Dawson, E. Differential Random Fault Attacks on Certain CAESAR Stream Ciphers. In Information Security and Cryptology (ICISC 2019); Seo, J.H., Ed.; Springer Int. Publishing: Cham, Switzerland, 2020; pp. 297–315. [Google Scholar]
  18. Orumiehchiha, M.A.; Rostami, S.; Shakour, E.; Pieprzyk, J. A differential fault attack on the WG family of stream ciphers. J. Cryptogr. Eng. (JCEN) 2020, 10, 189–195. [Google Scholar] [CrossRef]
  19. Danner, J.; Kreuzer, M. A Fault Attack on KCipher-2. Int. J. Comput. Math. Comput. Syst. Theory 2020, 1–22. [Google Scholar] [CrossRef]
  20. Joye, M.; Tunstall, M. Fault Analysis in Cryptography; Springer: Berlin/Heidelberg, Germany, 2012. [Google Scholar]
  21. Breier, J.; Hou, X.; Bhasin, S. Automated Methods in Cryptographic Fault Analysis; Springer Int. Publishing: Cham, Switzerland, 2019. [Google Scholar]
  22. Barenghi, A.; Breveglieri, L.; Koren, I.; Naccache, D. Fault injection attacks on cryptodevices: Theory, practice and countermeasures. Proc. IEEE 2012, 100, 3056–3076. [Google Scholar] [CrossRef] [Green Version]
  23. Dehbaoui, A.; Dutertre, J.M.; Robisson, B.; Tria, A. Electromagnetic transient faults injection on a hardware and a software implementations of AES. In Proceedings of the Fault Diagnosis and Tolerance in Cryptography (FDTC 2012), Leuven, Belgium, 9 September 2012; pp. 7–15. [Google Scholar]
  24. Fukunaga, T.; Takahashi, J. Practical fault attack on a cryptographic LSI with ISO/IEC 18033-3 block ciphers. In Proceedings of the Fault Diagnosis and Tolerance in Cryptography (FDTC 2009), Lusanne, Switzerland, 6 September 2009; pp. 84–92. [Google Scholar]
  25. Potestad-Ordóñez, F.E.; Jiménez-Fernández, C.J.; Valencia-Barrero, M. Fault attack on FPGA implementations of Trivium stream cipher. In Proceedings of the Symposium on Circuits and Systems (ISCAS 2016), Montreal, QC, Canada, 22–25 May 2016; pp. 562–565. [Google Scholar]
  26. Kreuzer, M.; Robbiano, L. Computational Commutative Algebra 1; Springer: Berlin/Heidelberg, Germany, 2000. [Google Scholar]
  27. Kreuzer, M.; Robbiano, L. Computational Commutative Algebra 2; Springer: Berlin/Heidelberg, Germany, 2008. [Google Scholar]
  28. Abbott, J.; Bigatti, A.M.; Robbiano, L. CoCoA: A system for doing Computations in Commutative Algebra. Available online: cocoa.dima.unige.it (accessed on 22 September 2021).
  29. Menezes, A.J.; van Oorschot, P.C.; Vanstone, S.A. Handbook of Applied Cryptography; CRC Press: Boca Raton, FL, USA, 1996. [Google Scholar]
  30. De Canniere, C.; Preneel, B. Trivium. In New Stream Cipher Designs; Springer: Berlin/Heidelberg, Germany, 2008; pp. 244–266. [Google Scholar]
  31. Dowling, W.F.; Gallier, J.H. Linear-time algorithms for testing the satisfiability of propositional Horn formulae. J. Log. Program. 1984, 1, 267–284. [Google Scholar] [CrossRef] [Green Version]
Figure 1. Overview of the clock -function of the Enocoro-128v2 stream cipher.
Figure 1. Overview of the clock -function of the Enocoro-128v2 stream cipher.
Cryptography 05 00026 g001
Figure 2. Overview of the different equivalence classes of injection points ( R , t ) with the same value of ψ ( R , t ) for Enocoro-128v2. Registers with the same base colour have the same ideal Z τ ( R , t ) , registers of the same colour and shading are equivalent.
Figure 2. Overview of the different equivalence classes of injection points ( R , t ) with the same value of ψ ( R , t ) for Enocoro-128v2. Registers with the same base colour have the same ideal Z τ ( R , t ) , registers of the same colour and shading are equivalent.
Cryptography 05 00026 g002
Table 1. Overview of the average size of S ( δ 1 , Δ 1 ) , , ( δ s , Δ s ) for s { 1 , 2 , 3 } .
Table 1. Overview of the average size of S ( δ 1 , Δ 1 ) , , ( δ s , Δ s ) for s { 1 , 2 , 3 } .
sAvg # S ( δ 1 , Δ 1 ) , , ( δ s , Δ s )
12.553
21.043
31.032
Table 2. Number of input and output differences that can be computed from L t + 60 ( R , t ) given an injection point ( R , t ) , in the case of Enocoro-128v2, as described in Remark 2.
Table 2. Number of input and output differences that can be computed from L t + 60 ( R , t ) given an injection point ( R , t ) , in the case of Enocoro-128v2, as described in Remark 2.
Inj pt# In-/Output DiffsDifferentials in
( a 0 , t ) 41 b 2 ( t + 3 ) , b 2 ( t + 4 ) , b 2 ( t + 6 ) , b 2 ( t + 7 )
( a 1 , t ) 42 b 2 ( t + 4 ) , b 2 ( t + 5 ) , b 2 ( t + 6 ) , b 2 ( t + 7 ) , b 2 ( t + 8 )
( b 2 , t ) 36 b 2 ( t + 4 ) , b 2 ( t + 6 ) , b 2 ( t + 7 ) , b 2 ( t + 8 )
( b 6 , t ) 27 b 2 ( t + 7 ) , b 2 ( t + 8 )
( b 7 , t ) 39 b 2 ( t + 4 ) , b 2 ( t + 5 ) , b 2 ( t + 6 ) , b 2 ( t + 7 ) , b 2 ( t + 8 )
( b 15 , t ) 36 b 2 ( t + 5 ) , b 2 ( t + 6 ) , b 2 ( t + 8 ) , b 2 ( t + 9 )
( b 16 , t ) 40 b 2 ( t + 4 ) , b 2 ( t + 5 ) , b 2 ( t + 7 ) , b 2 ( t + 8 )
( b 28 , t ) 35 b 2 ( t + 7 ) , b 2 ( t + 8 ) , b 2 ( t + 9 ) , b 2 ( t + 10 )
( b 29 , t ) 34 b 2 ( t + 6 ) , b 2 ( t + 7 ) , b 2 ( t + 8 ) , b 2 ( t + 9 )
Table 3. Timings of the simplified fault attack on Enocoro-128v2 where we considered T = { 1 , , 10 } and assumed that the injection points are always known. The results were obtained using 500 random key-IV pairs.
Table 3. Timings of the simplified fault attack on Enocoro-128v2 where we considered T = { 1 , , 10 } and assumed that the injection points are always known. The results were obtained using 500 random key-IV pairs.
ParamsAvg GP wtAvg TimingAvg
τ w max w w ^ Algorithm 3Total# Faults
251612.5310.299.6447.116.32
2015.0912.287.05105.365.66
301612.5710.9413.3169.265.52
2015.7212.4813.84148.614.85
351612.2811.7720.90113.265.44
2015.6312.2814.17226.214.85
401612.1311.8131.96150.025.43
2015.5213.1022.72429.054.78
Table 4. Timings of our fault attack on Enocoro-128v2 where we considered T = { 1 , , 10 } . The results were obtained using 500 random instances.
Table 4. Timings of our fault attack on Enocoro-128v2 where we considered T = { 1 , , 10 } . The results were obtained using 500 random instances.
ParamsAvg GP wtAvg Timing
τ w max w w ^ Algorithm 3Total# Faults
301612.4310.45818.802033.415.58
2015.6612.40283.351051.084.87
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Danner, J.; Kreuzer, M. A Fault Attack on the Family of Enocoro Stream Ciphers. Cryptography 2021, 5, 26. https://doi.org/10.3390/cryptography5040026

AMA Style

Danner J, Kreuzer M. A Fault Attack on the Family of Enocoro Stream Ciphers. Cryptography. 2021; 5(4):26. https://doi.org/10.3390/cryptography5040026

Chicago/Turabian Style

Danner, Julian, and Martin Kreuzer. 2021. "A Fault Attack on the Family of Enocoro Stream Ciphers" Cryptography 5, no. 4: 26. https://doi.org/10.3390/cryptography5040026

APA Style

Danner, J., & Kreuzer, M. (2021). A Fault Attack on the Family of Enocoro Stream Ciphers. Cryptography, 5(4), 26. https://doi.org/10.3390/cryptography5040026

Article Metrics

Back to TopTop