# Proposed Approach

The broad variety and heterogeneity of PA and FA attacks implies that it is hard to design countermeasures capable of providing wide scale protection. This is further supported by the fact that PA and FA combinations apart from eliminating vulnerabilities may introduce new ones. Apart from specific design oriented countermeasures like dual rail logic and power balancing [41, 42] that must be fine-tuned to a single implementation in order to be effective, algorithmic-based countermeasures may offer a more generic protection approach that can be applied to a wide range of RSA/ECC implementations regardless of the architecture those implementations follow. Our goal is to describe such algorithmic approaches for PA and FA resistance that combine effectively different PA and FA countermeasures and offer long-term PA-FA resistance against known attacks. This research approach focus point is on well-established PA-FA resistance principles rather than specific resistance countermeasures on ME and SM accelerator units.

As a basis of the proposed algorithm approach on PA-FA resistant ME/SM, the MPL algorithm is used. The MPL algorithm is resistant against many of the mentioned attack in Sect. 5.2.1, it does not rely on dummy operations in order to hide the computation flow during ME/SM execution (modular multiplication or squaring for ME or point addition and doubling for SM) and also favors operation parallelism thus leading to fast implementations. The original MPL algorithm though offers SSCA resistance (and more specifically Simple PA resistance) and under some restrictions is horizontal attack resistant. To further enhance the MPL with ASCA resistance, we must introduce some blinding technique through additive or multiplicative randomization. Such countermeasure follows the protection technique of message/base point blinding, since it constitutes an approach that under careful application in the MPL algorithm cannot be bypassed or introduce considerable performance overhead to a ME/SM implementation. Other techniques like exponent/scalar blinding are not very efficiently implemented and are found to have vulnerabilities [36, 37]. However, message/base point blinding must be realized in such a way that it should not suffer from vulnerabilities similar to the BRIP method [20].

Assuming that all operations in the proposed algorithm are defined in a group G, where G is either the multiplicative group Z* (for RSA) or the additive group *E(F*) (for ECC), we introduce a random element *B e* G and its inverse *B*^{-1} e G into the MPL computation flow that can blind the message multiplicatively *(B ? c mod n,*

i.e., message blinding for RSA) or the base point *P* additively *(B + P*, i.e., base point blinding). In contrast to similar approaches, where in each ME/SM round the round’s computed values are blinded with the same random element, in the proposed approach, a round’s values are randomized with a different number in each round (a multiple of the random element B).

Concerning FA resistance, our approach adopts a combination of the infective computation and fault detection resistance principles, following the intermediate values mathematical coherence characteristic of the MPL algorithm. As observed in [16] and by Giraud in [33], the *T** _{0}* and

*T*

*value in an MPL round always satisfy the equation T*

_{1}_{0}=

*c ? T*

_{1}*mod n*or T

_{0}=

*P + T*

*for ME or SM, respectively. Injecting a fault during computation in a*

_{1}*T*1 or

*T*0 variable will ruin this coherence and by introducing an MPL coherence detection mechanism in the end of the MPL algorithm, this fault will always be detected. Finally, efficiency of the proposed approach is achieved by employing Montgomery modular multiplication for ME and by exploiting the intrinsic parallelism that exist in the MPL algorithm. The proposed PA-FA resistant algorithm is presented below in two formulations, ME for RSA and SM for ECC schemes.

**FA-PA Montgomery ME algorithm for RSA primitives**

Input: *c, B, B*^{-1}, *e =* (1, *e*_{t-2}*,*...e_{0}) e Z* where *n* is the public modulus Output: *(s*_{0}*, s*_{1}*, s*_{2}*, s*_{4}*) =* (*B ^{e} ? c^{e}* mod

*n, B*

^{e+1}*?*c

^{e+1}mod

*n, B*

^{2}?

*c*mod

^{2}‘*n, B*

^{-e}mod *n)*

Initialization: T = R^{2} mod n, *s _{0} = s_{1} = b_{R} = B ? R* mod n,

*s*mod n, where

_{3}= s_{4}= s_{5}= b_{R-1}= B^{-1}? R*R =*2

*+*

^{j}^{2}

- 1.
*T*mod_{R}= T ? c ? R^{-1}*n* - 2.
*s*R_{2}= b_{R}? T_{R}?^{-1}mod*n* - 3. For
*i =*0 to*t —*1 - (a) If
*e*1 then_{i}=

*s _{0} = s_{0} ? s_{2} ?* R

^{-1}mod n,

*s*R

_{4}= s_{4}? s_{3}?^{-1}mod

*n*else

*s _{1}* =

*s*?

_{1}*s*R

_{2}?^{-1}mod n,

*s*R

_{5}= s_{5}? s_{3}?^{-1}mod

*n*

- (b)
*s*R_{2}= s2 ?^{-1}mod n, s_{3}= s| ? R^{-1}mod*n* - 4.
*s*R_{0}= s_{0}? b^{-1}?^{-1}mod n, s_{1}= s_{1}?*c ?*R^{-1}mod*n*

*s _{2} = s_{2} ?* 1 ? R

^{-1}mod n,

*s*R

_{4}= s_{4}? b ?^{-1}mod

*n*

5. If (values of *i*, *e* are not modified and *s _{0} ? s_{1} ?* R

^{-1}mod

*n = s*1 ? R

_{2}?^{-1}mod n)

then return *s _{0}, s_{1}, s_{2}, s_{4}* else return error

The above algorithm can be used for non CRT RSA or as a building block for CRT RSA primitive. It employs as inputs the message *c*, the random number *B* and its multiplicative inverse *B ^{-}*1, the public modulus

*n*and the exponent

*e*. Note that

*ei*corresponds to the

*i*-th bit of

*e*and that

*j*is the bit length of the modulus n. We assume that the multiplicative inverse of

*B*exists, meaning that

*gcd(B, n) =*1 (B and n are relatively prime). Possible fault injection attack can be detected by checking

*s*R

_{0}? s_{1}? R^{-1}modn = s_{2}?^{-1}mod

*n*(Z* MPL coherency check). If no fault is injected, the above equation is always true.

^{3}The exponentiation result can be found after fault detection by performing

*s*mod

_{0}? s_{4}*n = B*mod

^{e}? c^{e}? B^{-e}*n = c*mod n.

^{e}* FA-PA SM algorithm for ECC primitives *Input:

*P, B, B*

^{-1}

*e E*(

*F), e =*(1,

*e*

_{t-2}, ...e_{0}) e FOutput: (50, 51, 52, 54) = *(e ? (B + P), (e +* 1) ? (*B + P), 2 ^{t} ? (B + P), (-e) ? B) *Initialization: 5

_{0}= 5

_{1}= B, s

_{3}=

*s*

_{4}= s_{5}= —B- 1.
*5*2*= B + P* - 2. For
*i =*0 to*t -*1 - (a) If
*ei =*1 then - 50
*= 50 +*52, - 54 = 54 + 53 else
- 51 = 51 + 52,
- 55 = 55 + 53
- (b) 52 = 2 ? 52, 53 = 2 ? 53
- 3Note that
*e*is logical NOT of*e*and that*e + e =*2^{t}- 1.

- 3.
*So = So - B*,*Si = Si + P S**4**=*S4 +*B* - 4. If (values of
*i*,*e*are not modified and*S*_{0}*+ S*_{1}*= S*then return_{2})*S*_{0}, S_{1y}S_{2}, Selse return error_{4 }

The above algorithm can be applied to any EC type (Wierstrass, Hessian, Montgomery, Edwards curves etc.) under any coordinate system (affine, projective, mixed). It employs as inputs the base point *P*, a random point *B* and its additive inverse B^{-1} = -B, along with the scalar e. Note that *e _{i}* corresponds to the

*i*-th bit of

*e*and that

*j*is the bit length of all involved finite field elements. Similar to its ME

version, possible fault injection attack can be detected by evaluating the *E (F)* MPL

?

coherence check S_{0} + S_{1} = S_{2}. If no fault is injected, the above equation is always true and only then can the exponentiation result be released (after fault detection) by performing S_{0} + S_{4} calculation.