This application claims priority to foreign European patent application No. EP 23307230.5, filed on Dec. 15, 2023, the disclosure of which is incorporated by reference in its entirety.
The invention generally relates to the protection of processing devices and, in particular, to a processing system configured to protect the execution of a processing function.
As part of huge endeavors to enhance the security of processing systems, such as including smartcards, mobile devices, smart IoT devices, etc., secure implementations are required to be compliant to international/national standards before being deployed on the market.
A processing system such as a cryptographic system can implement a processing function applied to an input information word, such as in the AES cryptographic algorithm for example which apply an AES function to an input information word.
In order to implement a processing function, several elementary operations are generally executed such as additions and multiplications.
However, the elementary operations performed to execute a processing function must be secured against non-invasive attacks that attempt to correlate the leakage of some operations with a hypothetical model.
Non-invasive attacks can use power consumption, electromagnetic (EM) radiation, and timing measurements to extract information. The measurement techniques rely on the data-dependent internal behavior of the underlying system. Exemplary non-invasive attacks include power analysis attacks. Power analysis can be used to identify the specific portions of the program being executed to induce timing glitches that may be used to bypass key checking.
A known solution to protect arithmetic operations against such attacks threat is masking as described in Stefan Mangard, Elisabeth Oswald, and Thomas Popp. Power Analysis Attacks: Revealing the Secrets of Smart Cards. Springer, December 2006. ISBN 0-387-30857-1. “Masking” refers to a change of intermediate variables of the computation into randomized versions which are thus decorrelated from the unprotected variables, each being a potential target for a side-channel attack.
In particular, the mainstream approach consists in using purely Boolean Masking (BM). This is the case of widely used and standardized ciphers, such as DES (Data Encryption Standard) and AES (Advanced Encryption Standard). In both DES and AES examples, most cryptographic operations (except from simple data move, which does not leak by itself) are implemented using XORs and in look-up-tables (LUTs). Boolean masking (BM) shall be configured to achieve higher-order protections. However, the Boolean masking has merely no protection when the noise level is low, and the usual transitional leakages can downgrade the protection.
Another approach to perform masking is called inner product masking (IPM). IPM shall reduce or even prevent transitional leakages. However, such approach also suffers from noise level dependence. More generally, IPM can be further enhanced by utilising better linear codes, and extended to other masking schemes.
Besides, the processing system can also be victim of physical perturbations, which can lead to a corruption of the result. Such malfunction is harmful to both the processing system safety and cybersecurity. Indeed, from a safety point of view, incorrect results likely yield unspecified behaviours, with severe impacts unless detected. From a cybersecurity point of view, attacks can result in exploitation paths leading to cryptanalysis. Detection is one technique to protect against this devastating consequence. However, usually, detection is hard to build into the processing system, and can also be contradictory with the passive side-channel protections.
There is consequently a need for improved systems, methods, and computer program products for improving the protection of a processing function implemented by a processing system against non-invasive attacks.
To address these and other problems, there is provided a processing system (1) configured to execute a processing function ƒ(x) in response to the receipt of an input information word x comprising k information symbols, the processing system comprising a protection device configured to protect the execution of the processing function. The processing system comprises a processing unit configured to execute the processing function, the processing unit being configured to decompose the processing function ƒ into one or more basis operations comprising one or more elementary operations between two operands, the elementary operations comprising at least a component-wise multiplication operation. The processing unit comprises a multiplier configured to perform the multiplication operation, and the protection device comprises at least:
The processing device is configured to apply the encoder to the input information word x, and to each operand of an elementary operation, each elementary operation being applied to the encoded words determined by the encoder for each operand,
The multiplication operation performed by the multiplier is further masked using the pseudo-inverse matrix A−1 of the encoding matrix A, and the pseudo-inverse transpose matrix A−T of the encoding matrix A, such that (AT)−1=(A−1)T.
In some embodiments, the encoding matrix A may be applied by the encoder to pad k information symbols of an encoder input with m random numbers, the output of the encoder being a masked vector x of length n, with n≥k+m, the masked vector {circumflex over (x)} belonging to , the encoding matrix A being an (k+m)×n matrix in the field
.
In some aspects, in response to the receipt of an encoder input X, the encoder is configured to determine random masks MX∈ and an error indicator ϵX∈
in association with the encoder input X, and to encode the encoder input using the encoding matrix A, the random masks MX and the error indicator ϵX.
In some embodiments, the encoder output x may be determined as:
{circumflex over (X)}=(X,MX,ϵX)A
The encoding matrix belongs to and n′=k+m+e.
In some aspects, in response to the receipt of two inputs {circumflex over (X)} and Ŷ masked by the encoder, the multiplier may be configured to:
In response to the receipt of two inputs x and Y masked by the encoder, the multiplier may be configured to:
In some aspects, the elementary operations may further comprise a component-wise addition operation and the processing device may comprise an adder configured to perform the addition operation using inputs previously encoded by the encoder.
In some aspects, the protection device may further comprise a decoder configured to apply a decoding operation to word {circumflex over (X)} previously encoded by the encoder, the decoder being configured to provide a decoder output comprising original data X, using the encoded word {circumflex over (X)} and the pseudo-inverse matrix A−1 of the encoder matrix A.
The decoder output may further comprise random masks MX∈ and an error indicator ϵX∈
in association with the output original data X, and the decoding operation DECmsk applied by the decoder may be defined by:
In some aspects, the protection device may further comprise a refreshing unit configured to perform a refreshing operation, at one or more instant times during the execution of the processing function, the refreshing operation consisting in determining a refreshed encoded word {circumflex over (X)}′ for an encoder input word X previously applied to the decoder to determine encoded word {circumflex over (X)} such that both encoded word {circumflex over (X)} and the refreshed encoded word {circumflex over (X)}′ correspond to the same input information word X, the refreshing unit being configured to replace the encoded word {circumflex over (X)} by the refreshed encoded word {circumflex over (X)}′.
In some aspects, the protection device may further comprise a checking unit configured to perform a checking operation consisting in checking if a computing error occurred in the operations performed by the encoder, the adder, or the multiplier.
The checking unit may be configured to check whether the error indicator variable ϵX associated with the word X meets the condition ϵX=cst where cst is a predefined constant, and to detect whether an error occurred from the condition.
Wherein no error is detected if ϵX=cst, and if the error indicator variable ϵX is different from the predefined constant cst, the checking unit may be configured to further apply a syndrome decoding technique using syndromes of linear codes to determine if an error occurred.
In some aspects, the masking code may have the largest possible dual distance, in the finite field of interest for the application to satisfy a security code criteria and/or the masking code may be sparse or structured to satisfy a performance power area (PPA) code criteria.
In some aspects, the information code and the random code, used to generate the encoding matrix A, have no intersection of non-zero codewords.
In one embodiment, the encoding matrix A may be generated from a Vandermonde matrix.
There is also provided a method, implemented in a processing system, for executing a processing function ƒ(x) in response to the receipt of an input information word x comprising k information symbols, the method comprising protecting the execution of the processing function. The execution of the processing function comprises decomposing the processing function ƒ into one or more basis operations comprising one or more elementary operations between two operands, the elementary operations comprising at least a multiplication operation, the multiplication being a component-wise multiplication, the processing function execution step comprising:
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate various embodiments of the invention and, together with the general description of the invention given above, and the detailed description of the embodiments given below, serve to explain the embodiments of the invention.
Embodiments of the invention provide a processing system and a method that protects a processing function implemented by the processing system using an improved masking scheme.
Referring to
The processing function ƒ may be any function that is executed by a processing system 1 that can be decomposed into elementary operations including one or more additions and/or multiplications, and possibly additional operations. The processing function may be for example a cryptographic function (e.g. AES or SM4 function), an inference function, a statistics function on input data, a mean function, or a variance function, etc.
Indeed, these two elementary operations (addition and multiplication) are universal in that any digital computation involved in a processing performed by a processing system 1 can be achieved by interleaving them. They amount to evaluate arbitrary polynomials, which interpolate the processing function. More additional operations can be added, such as scaling (i.e., multiplication by a constant), exponentiation (i.e., iterated multiplications), etc. The decomposition of a processing function into basis operations (elementary operations and additional operation) may be determined so as to optimize performances.
The processing system 1 may be any information processing system, device, chip or circuit executing a processing function such as for example and without limitation a smartcard, a mobile device, a smart IoT device, or a crypto system. The following description of some embodiments of the invention will be mainly made with reference to a crypto system for illustration purpose only.
The processing system 1 comprises a protection device 10 configured to protect the execution of the processing function by applying an improved masking scheme, referred to hereinafter as a tweakable code-based masking (TCBM) scheme, against non-invasive physically attacks, such as side-channel attacks, and against (semi-) invasive attacks such as fault injection attacks, simultaneously under proper configurations.
Advantageously, the masking scheme depends on an encoded matrix A that is generated using at least two linear codes comprising an information code C and a masking code D without non-zero codeword in their intersection (i.e. the information code C and the random code D, used to generate the encoding matrix A, have no intersection of non-zero codewords). The masking scheme uses these two linear codes to determine a random sharing of a key-dependent sensitive variable by confusing the information words with random words. The random words may be generated by an in-chip true random number generators (TRNG), or input directly to the protection device 10.
The processing system 1 comprises a processing device 11 configured to execute the processing function, the processing device being configured to decompose the processing function ƒ into one or more basis operations comprising one or more elementary operations, and possibly one or more additional operations.
An additional operation may be for example and without limitations an operation among a scaling operation (such as a multiplication with a constant), an exponentiation (such as a self-multiplication performed a given number of times), an inverse operation, etc.
As used herein, an elementary operation refers to an addition operation or a multiplication operation. The addition operation and the multiplication operation are component-wise operations.
As shown in
The protection device 10 may comprise an encoding matrix determination unit 101 configured to randomly determine the information code C and the masking linear codes D. The information code C and the masking code D satisfy predefined code property. The encoding matrix determination unit 101 is further configured to determine the encoding matrix A from the linear codes C and D.
Each of the information code C and the masking code D may be represented by a vector structure comprising a set of vectors. The matrix A is determined by stacking vertically vectors of information code C and of the masking code D.
The protection device 10 further comprises an encoder 102 configured to apply an encoding operation to the original input information word X and to each input (operand) of the elementary operations (addition, multiplication), the encoding operation consisting in encoding the received input using an encoding technique, which provides an encoded information word. Advantageously, the encoded operation applied by the encoder 102 is masked with the encoding matrix A. The encoding matrix A used by the encoder may subsequently remain the same for the execution of a series of elementary operations (additions, and multiplications) into which the processing function is decomposed. In particular, the encoding matrix A shall remain consistent end to end until the computation of the processing function is terminated, at which point the decoder 110 can be called. It should be noted that decoding and re-encoding afresh (i.e., with a new matrix A) is technically possible. However, refreshing the encoding matrix A during the execution of the processing function might lead to weak spots inbetween, that is a divulgation of an unmasked variable or undetected corruption of a variable, in both cases the “inner computation” variable having a risk to be sensitive (i.e., depending on a secret, or critical for the computation integrity).
Further, the multiplication operation performed by the multiplier 105 is masked using the pseudo-inverse matrix A−1 of the encoding matrix A, and the pseudo-inverse transpose matrix A−T of the encoding matrix A. As used herein, A−T is a shortcut notation of (A−1)T.
In the embodiments where A is a square matrix, the pseudo-inverse matrix A−1 of the encoding matrix A is the inverse matrix, and the pseudo-inverse transpose matrix A−T of the encoding matrix A is the inverse transpose matrix (the term “pseudo-inverse” is therefore used herein for the general case where the encoding matrix is rectangular).
In some aspects, the encoder 102 may be configured to encode all internal variables involved in the execution of the basis operations including the internal variable involved in the additional operations. In such embodiments, only the initial data input X (also denoted Xin) and final output of f(X) can be in plain-text (non-encoded). The initial data input X may be initially in plain-text (not encoded), but when it is used to execute the processing function, the initial data input X is encoded.
In some embodiments, the encoding matrix A specifies a general code-based masking (CBM) scheme consisting in padding the k symbols with m random numbers to determine a masked vector of length n (n≥ k+m) belonging to , the encoding matrix A being a (k+m)×n matrix with elements in the field
.
In some embodiments, the random determination of the information code C and the masking code D comprise selecting the information code C and the random D such that the codes C and D satisfy one or more code properties, which may include security properties and/or efficiency properties in terms of PPA (Performance, Power & Area).
For example, in aspect, the masking code D may be determined such as it has the largest possible dual distance, in the finite field of interest for the application to satisfy a security property.
In another aspect, the masking code D may be sparse (even in its subfield, e.g., , when the main field
is composite) or structured to satisfy a performance power area (PPA) criteria.
In some embodiments, the information code C and the masking code D are determined such that they do not overlap (except in {0}) and span a subspace.
The protection device 10 may further comprise a decoder 110 configured to apply a decoding operation to words which have been previously encoded by the encoder 102 during the execution of the processing function (input data x received by the processing system 1 and/or inputs of the elementary functions). In response to a received encoded input {circumflex over (X)}, the decoder 110 is configured to provide a decoder output comprising the original data X, using the received encoded input x and the pseudo-inverse matrix A−1 of the encoder matrix A.
In some aspects, the protection device 10 may further comprise a refreshing unit 106 configured to perform a refreshing operation, at one or more instant times during the execution of the processing function, the refreshing operation consisting in determining a refreshed encoded word {circumflex over (X)}′ for an encoder input word X previously applied to the encoder 102 to deliver an encoded word {circumflex over (X)} such that both encoded word X and the refreshed encoded word X′ correspond to the same input information word X, the refreshing unit 106 being configured to replace the encoded word {circumflex over (X)} by the refreshed encoded word {circumflex over (X)}′.
The protection device 10 may also comprise a checking unit 108 (also called ‘fault detection unit’) configured to perform a checking operation consisting in checking if a computing error occurred in the operations performed by the encoder 102, the adder 104, and or the multiplier 105.
The embodiments of the invention enable protecting information against side-channel analysis (SCA) and fault injection attacks (FIA) using masking. The protection against side-channel analysis requires code-based masking with random numbers, whereas protecting against fault injection attacks requires error-detection coding on top of masked information.
The protection device 10 is configured to ensure side-channel protection against side-channel attacks and to perform fault injection detection.
To facilitate the understanding of the following description of some embodiments, the following definitions are provided.
It is considered that the information processing system 1 manipulates information word represented as vectors of information symbols, the information symbols belonging to a finite field , which can be:
The following description of some embodiments of the invention will be essentially made with reference to any finite field F of characteristic p (p being a prime number, equal to 2 or more). The notation F will be therefore used to represent the considered finite field. For instance:
An input information word x, to which the execution function ƒ is to be applied, consists in k symbols, which can be protected together (e.g., utilizing concept of “cost amortization”).
The side-channel protection leverages m independent random masks y.
The fault detection is applied on top, and allows inserting some redundancy to be able to verify that the data z be not altered. It consists in applying a word of e symbols and checking for its value at some points in the function execution method. For example, these e words are null. The fact that the redundancy “covers” the masked data allows to avoid this protection from diminishing (interfering negatively) with it.
In the following description of some embodiments, the following notations will be used:
uppercase letters (e.g., X) will be used for random variables and lowercase letters (e.g., x) will be used for their realizations.
Vectors and matrices (e.g., X) will be generally written in bold characters and subscripts (e.g., Xi or Xi,j) are used to index the elements of such data structures.
the parameters k, m, e and n will be used to denote respectively the size of information symbols, the size of random masks, the size of error detection indicators and the size of masking sharing.
The parameters k, m, e and n are such that n≥k+m+e. In the following description, it will be considered that n′=k+m+e for the sake of simplification and for illustration purpose only, so that n≥n′.
All the computations performed by the protection device 10 and the processing device 11 are performed in the finite field .
Further:
Further, some intermediary functions used in relation with embodiments of the invention are further defined.
A first intermediary function is called flatten function. A flatten function serializes a matrix to a vector by concatenating each row in the matrix. Specifically, the operator flatten turns an I×J matrix M, defined according to equation 1, with elements in , into a vector which contains all elements albeit laid out in a linear arrangement:
Taking a matrix M as in equation (1), the way the flatten function operates is defined according to formula (2):
The inverse operation of the flatten function, denoted flatten−1, reshapes a vector to a matrix. More specifically, taking a (row) vector ∈, the inverse flatten function flatten−1 operates according to equation (3):
As used herein, the notation with the exponent 1×IJ is used to indicate that the vector is horizontal.
A second intermediary function used in connection with embodiments of the invention is called ‘pick function’. The pick function picks some elements in a vector. The pick function can be expressed by using the vectorized operation by multiplying with a matrix S.
While the flatten operator will yield an I·J-long vector when fed with a I×J matrix, the pick operator picks the first element in the first J-symbol chunk, then the second element in the second J-symbol chunk, etc. It will be considered in the following description, that I≤J.
By induction, the matrix S in pick operator is defined as:
In formula (4), each term Si has a size J×I and has only single non-zero element (Si)i,i, for 1≤i≤I. If I≠J, then S is not a square matrix, but the pick operator keeps the same.
More formally, taking a vector X∈, the pick function is defined according to formula (5):
By combining the two operators flatten and pick, the following nominal operation to execute is obtained by taking two vectors x, y ∈ and I=J:
The combined operator pick (flatten (xTy)) actually selects the diagonal elements of the targeted matrix in a vectorial fashion so that:
In the following description of some embodiments, the size of S will be specified depending on the operation context.
The encoding matrix A used by tweakable code-based masking scheme is a matrix that turns k symbols of information and m symbols of masking material into a masked vector of length n (recall that n≥n′=k+m+e), which shall detect e faults. The matrix A is therefore a rectangle n′×n matrix in IF.
In some embodiments, the encoding matrix A may be a square matrix for example.
The encoding matrix A specifies a general code-based masking scheme.
The inverse matrix of A is denoted as A−1 and the pseudo-inverse transpose matrix of A is denoted A−T. Therefore A−1 and A−T satisfy the equation:
It should be noted that if the encoding matrix A is not square, the encoding matrix A may be defined using a Vandermonde matrix V, of size n×n. A Vandermonde matrix V is related to Reed-Solomon codes. as the generator matrix of a Reed-Solomon code is a Vandermonde matrix. The use of Vandermonde matrices to generate the encoding matrix is particularly advantageous, as reed-Solomon codes are optimal codes, in the sense that they reach the Singleton bound. Moreover, random Vandermonde matrices are easy to build. It is sufficient to select n different non-zero field elements α1, . . . , αn, and to define the matrix V as V=(αji-1), where 1≤i≤n is the row index and 1≤j≤n the column index. In such case, the encoding matrix A can be written:
As a result, the pseudo-inverse matrix of A, also denoted by A−1, is equal to:
As mentioned, a Vandermonde matrix is a matrix with the terms of a geometric progression in each row (a sequence of non-zero numbers where each term after the first in the row is found by multiplying the previous one by a fixed, non-zero number also referred to as “common ratio”). Therefore, the entries of the V matrix denoted Vi,j meet the relation Vi,j=vij, with vij being the j-ème power of the number vi, for all zero-based indices i and j.
Considering the above construction of A and A−1, then:
For each received input vector X∈, the protection device is further configured to determine random masks MX∈
and an error indicator ϵX∈
. The random masks may be refreshed as often as possible. The error indicator ϵX may be for example set to the zero constant. The random masks MX may be initialized by taking random values over
, that is uniformly distributed.
We can add a sentence saying that random masks are generated (initialized) randomly.
The matrix A may be pre-computed and then used to encode any input data X.
The encoding matrix A enables taking k information symbols to process an input information word x, and padding those symbols with m random numbers and e nulls to get a masked vector {circumflex over (x)}∈.
In step 300, the input information vector X∈ is received.
In step 301, the associated random masks MX∈ and the associated error indicator ϵX∈
are determined.
In step 302, the generated encoding matrix A is received.
In step 303, the input information vector X∈ is encoded (or masked) using the encoding matrix A and random masks MX. More specifically, given the information X∈
, the random masks MX∈
and the error indicator ϵX∈
, the encoder matrix A∈
is applied in step 202 to mix X, MX, and ϵX such that the unprotected input information vector X becomes a masked vector {circumflex over (X)}∈
defined by:
In equation (8), (X, MX, ϵX) is multiplied by the matrix A.
In step 304, the masked X, also referred hereinafter as a CBM-protected vector, is returned. The masked vector X can advantageously resist side-channel attacks up to order ds=d−1, where d is the dual distance of the linear code D generated by the matrix and is equal to the m lines of A after the first k lines (i.e. the linear code D is generated by lines k+1 to k+m in the encoding matrix A).
In particular, ds may equal m if A has a full rank.
The multiplication by the matrix A as defined in equations (7) and (8) implements the generic encoder 102, where n′ is defined by n′=k+m+e.
The protection device 10 may include a further fault detection capability denoted by df such that df=e implemented by the checking unit 108.
Among the elementary operations into which a processing function can be decomposed, the multiplication is usually the most costly operation in masking scheme over .
The multiplication operation performed by the multiplier 105 corresponds to a component-wise product. The component-wise product of the k information symbols is not a natural operation. The outer product is, but yields k2 cross-coupled products. Therefore, there is a need to manage the return from k2 intermediate results into the k ones that matter.
A prior art component-wise product, without masking, refers to the operation that computes, given two input vectors X and Y having the same length k:
In should be noted that the parameter k in equation (9) is an arbitrary positive integer, not limited to the length of information words. In the presence of masking, the component-wise product involves all n shares, making it more complicated to achieve.
An elementary operation performed by the adder 104 or by the multiplier 105 involves two operands that will be noted hereinafter x and y, or X and Y in their vector representation, which correspond to input variables applied to an elementary operation associated with the execution of the processing function. Although the same notation x or X is used to designate one of the inputs of the adder or the multiplier, and the initial input received by the processing system 1 on which the execution function ƒ is to be applied, it should be noted that they refer to distinct variable. Such similar notation is in particular used to simplify the description of the encoding performed by the encoder 104 as it applies not only to the initial data received by the processing system 1 (otherwise referred to as Xin) but also to the inputs received by the adder 104 or by the multiplier 105, prior to the execution of the addition or multiplication operation.
Indeed, according to some aspects, prior to executing the addition operation or the multiplication operation, the two inputs received by the adder 104 or the multiplier 105 respectively, namely the vectors x and y, are protected by the encoder 102, according to the encoding method described with reference to
The multiplier 105 is configured to apply a masked component-wise product function prodmsk to inputs {circumflex over (X)} and Ŷ being the masked vectors of X and Y respectively, defined as:
Equation (10) is such that the demasked variable is defined by:
The masked component-wise product function may be redefined as:
In equation (11), the matrix S is an initialization of equation (4), with I=J=n′, and Ŝ∈ is defined according to formula (12):
Indeed, equation (8) can be simplified using the following notations:
Accordingly, it comes:
Therefore, the right-hand side of Equation (11) can therefore be written according to formula (15):
In step 410, the two masked variables {circumflex over (X)} and Ŷ are received.
In step 412, the pseudo-inverse matrix A−1 of A, the pseudo-inverse transpose matrix A−T of A and the matrix Ŝ defined by formula 12 are retrieved. The pseudo-inverse matrix A−1 of A, the pseudo-inverse transpose matrix A−T of A and the matrix S defined by formula 12 may be precomputed and used for the complete execution of the processing function (which may comprise a series of elementary operation such as for example a series of additions and multiplications in the case of the AES algorithm).
In step 414, the cross-product W of the masked vectors is determined from the first masked variable X and the second masked variable Ŷ such that W={circumflex over (X)}TŶ.
In step 416, the result of the multiplication is flattened by applying the flatten function to A−TW which provides the flattened matrix T defined as T=flatten (A−TW).
In step 418, the protected multiplication {circumflex over (Z)} is determined by performing the product of the flattened matrix T and of the matrix Ŝ such that {circumflex over (Z)}=TŜ.
In step 410, the result is returned {circumflex over (Z)}.
The end-to-end masked equation (11) is inspired by the computation specified in equation (6).
In equation (15), the following variables are all masked:
In equation (11), the expressions are to be evaluated in the order governed by the parentheses. Besides, in some embodiments, the left-wise application of A−T of equation (11) may be delayed.
It should be noted that the matrix S may be pre-computed for speed-up online computation, instead of computing it in step 412 in the same step as the pseudo-inverse matrix A−1 of A, the pseudo-inverse transpose matrix A−T of A.
In some cases, if step 416 is not performed as expected, certain vulnerabilities might appear (for example unintended demasking of either {circumflex over (X)} or Ŷ). To prevent such vulnerabilities, in some embodiments, some internal randomness may be added to enhance the side-channel resistance in step 416 (flattening step).
In such embodiments using internal randomness, the method of determining a masked component-wise multiplication may comprise a generation of a random matrix and use the random matrix to enhance the side-channel resistance in step 416.
To introduce the internal randomness and generate the random matrix, a parameter γ∈{0, . . . , n2−1} may be introduced, representing a linear indexing of a matrix of size n×n and defined by γ=μn+λ, where μ and λ ϵ{0, . . . , n−1}. For the sake of simplifications, the notation B=A−T and B′=A−1 will be also used.
The random matrix {circumflex over (R)}∈ may be determined such that diag(A−T{circumflex over (R)}A−1)=diag(B′{circumflex over (R)}B′)=0n′, where diag denotes the diagonal elements of the matrix and 0n, is a zero-vector of length n′.
The element (i, i) of B{circumflex over (R)}B′ for 0≤i≤n′, is equal to:
In formula (16),
In equation (17), M is an n2×n′ matrix, whose (i, j) coefficient is:
For example, the solution to equation (18) may be given in Magma computer algebra system by using the KernelMatrix.
The generation of the random matrix R may then comprise:
Using equations (16) and (17), each element (i, i) of A−T{circumflex over (R)} A−1 equals 0 for 1≤i<n′. Therefore, the generated random matrix R satisfies the following equation (19):
The determination of the masked component-wise product defined in equation (11) can be enhanced by adding internal randomness according to equation (20):
The matrices S and S used in equation (20) are the same as the ones used in equation 11.
Indeed, given a matrix M, according to equation (6B), the diagonal elements of the matrix M are defined by:
Equation (19) further indicates that flatten (A−TR A−1) S=0n′
Therefore:
Accordingly, the determination of the masked component-wise product defined in equation (11) can be enhanced by adding internal randomness according to equation (20):
The matrices S and Ŝ are the same as the ones used in equation (11).
In step 501, the pseudo-inverse matrix A−1 of A, the pseudo-inverse transpose matrix A−T of A and the matrix Ŝ defined by formula 12 are retrieved. The pseudo-inverse matrix A−1 of A, the pseudo-inverse transpose matrix A−T of A and the matrix Ŝ may have been precomputed and used for all the computations performed by the encoder 102, the adder 104, the multiplier 105, and the decoder 110 during the execution of the processing function.
In step 502, the matrix M and the matrix ker(M) are pre-computed according to equation (18).
In step 503, determining a random seed sd is determined uniformly in
In step 504, the random matrix R is determined by performing {circumflex over (R)}=flatten−1(sd·ker(M)).
In step 505, the sum W of cross-product of the masked vectors and of the random matrix is determined from the first masked variable {circumflex over (X)}, the second masked variable Ŷ and the random matrix {circumflex over (R)} such that W={circumflex over (X)}TŶ+{circumflex over (R)}.
In step 506, the result of the multiplication is flattened by applying the flatten function to A−TW which provides the flattened matrix T defined as T=flatten (A−TW).
In step 507, the two masked variables x and Y are received.
In step 508, the protected multiplication 2 is determined by performing the product of the flattened matrix T and of the matrix Ŝ such that {circumflex over (Z)}=TŜ.
In step 510, the result is returned {circumflex over (Z)}.
Steps 502, 503, 504 and 505 have been added or modified with respect to the flowchart of figure NN. By using the random matrix {circumflex over (R)}, the potential vulnerability is fixed since it removes indirect demasking of {circumflex over (X)} and Ŷ.
It should be noted that the matrices M and ker(M) may be alternatively pre-computed instead of computing them in step 502, during the execution of the method.
The embodiments of the invention provide a tweakable code-based masking (TCBM) method and device against side-channel attacks by providing higher-order protection for crypto systems. Advantageously, the TCBM method and device be configured to detect faults against fault injection attacks.
Turning back to
The tweakable code-based masking (TCBM) scheme enables to efficiently use masked protection and processing operations including:
The masked protection and processing operations using the TCBM scheme may further include:
It should be noted that although some aspects of the instant disclosure are described herein conjointly (in particular the different component 102, 104, 105, 106, 108, 110), they can be used separately or independently or according to different combinations of components.
As described with reference to
In some aspects, the decoder 110 may be configured to apply a masked encoding operation DECmsk to an encoded input {circumflex over (X)} using the encoding matrix A. More specifically, given an input encoded word vector {circumflex over (X)}, the masked decoding operation outputs the original data X using {circumflex over (X)} and the inverse matrix A−1 of the encoder matrix A such that:
In equation (23), A−1 is the pseudo-inverse matrix of A, defined according to equation (7).
In some aspects, the adder 104 may be configured to determine the masked addition operation ADDmsk using the encoder matrix A. The masked addition operation performed by the adder 104 is a component-wise addition. More specifically, the adder 102 is configured to receive two encoded word vectors {circumflex over (X)} and Ŷ, which corresponds respectively to original data X et Y, previously encoded by the encoder 102 according to equation (20) using the encoding matrix A and to apply the masked addition operation to determine an encoded word {circumflex over (Z)}′, from Z′=X+Y=(X1+Y1, X2+Y2, . . . , Xn+Yn)∈, {circumflex over (X)} and Ŷ such that:
The masked addition ADDmsk is also a component-wise addition.
It should be noted that the symbol ‘+’ used in the above two equations is equivalent to XOR in .
According to other aspects, the multiplier 105 may be configured to apply a masked multiplication operation MULTmsk using the encoding matrix A. The multiplier 105 is more specifically configured to receive two vectors {circumflex over (X)} and Ŷ, corresponding to original data X et Y, previously encoded by the encoder 102 according to equation (20) using the encoding matrix A, and to apply the masked multiplication operation to determine an encoded word such {circumflex over (Z)} which corresponds to Z such that Z=X·Y=(X1Y1, X2Y2, . . . , Xn Yn)∈, {circumflex over (Z)} being defined according to equation (25):
{circumflex over (Z)} can be accordingly determined according to the multiplication method of
In some embodiments, the refreshing unit 106 may be configured to determine the masked refreshing operation REFmsk using the encoding matrix A. Given an input encoded word vector {circumflex over (X)}, previously encoded by the encoder 102 according to equation (20), the refreshing unit 106 is configured to output a new encoded word {circumflex over (X)}′ (‘refreshed encoded word’) using the encoder matrix A such that:
The refreshed encoded word {circumflex over (X)}′ may be therefore determined by applying a component-wise addition between (0, M′X, 0) A and the initially determined encoded word x.
The refreshing computation may be performed, anytime, for any input of the adder and/or the multiplier and/or only for the originally received input word. The frequency of the refreshing computation may vary depending on the application of the invention.
In some aspects, the checking unit 108 may be configured to perform a masked checking operation CHKmsk using the encoder matrix A.
In step 600, an input encoded word vector x is received. Step 600 may further comprise receiving a predefined constant cst. The input encoded word vector x received in step 600 may be any word encoded by the encoding unit 102 that can be decoded and then checked. In particular, step 600 may apply to any encoded variable, including those input to the adder 104 and/or the multiplier 105.
In step 602, a first decoding of R is determined by the decoder 110 by performing (X, MX, ϵX)=DECmsk(X), using the encoding matrix A, according to equation (23), which provides the original vector X.
Step 603 consists in checking whether the error indicator variable ϵX associated with X meets ϵX=cst where cst is the predefined constant received in step 600.
In step 604, if it is determined that ϵX=cst, no error is detected (block 605).
In step 606, if it is determined that ϵX is different from cst (ϵX≠cst), it is checked whether an error occurred during the computation, by a syndrome decoding technique using syndromes of linear codes. Syndrome decoding is a method of decoding a linear code over a noisy channel, where errors may have been made. Syndrome decoding is a minimum distance decoding using a reduced lookup table.
If an error occurred (block 607), the error may be notified (block 608). Otherwise no error is detected (block 609).
It can be considered for example an encoding matrix A, generated from a Vandermonde matrix. Using a Vandermonde matrix for A has particular advantages as the linear codes generated by Vandermonde matrices are MDS (maximum distance separable) codes with maximized distances. The dual code of a MDS code is also a MDS code, so that the dual distance may be maximized, which can result in the optimal side-channel protection ds. For instance, A is a (transposed) Vandermonde matrix that can be generated as:
In the encoding matrix A according to definition (29), αi≠αj for any distinct i, j ∈[1, n]. The encoding matrix A can be optimized by selecting optimal elements αi for 1≤i≤n in the sense that ds is maximized at bit-level (e.g., over ).
Further, the following example will be made considering that q=8, and =
like in the block ciphers AES or SM4, and the irreducible polynomial is: P(α)=α8=α4+α3+α2+1. Further, the parameters k, m, e, n and n′ are defined by k=2, m=2, e=1 and n=6, thus n′=5<n.
An irreducible polynomial is a polynomial that cannot be factored into the product of two non-constant polynomials and is used to generate a finite field.
The encoding matrix A is then randomly generated as follows:
The inverse matrix A−1 of the encoding matrix A is then determined as:
The two following random vectors are then considered:
The encoder 102 will then determine the corresponding masked vectors {circumflex over (x)} and ŷ as follows:
The adder 104 can then determine the sum of x and y using the masked addition operation ADDmsk according to the following equation:
By decoding {circumflex over (z)}′ using DECmsk, it can be verified that:
The multiplier 105 can further determine the product of x and y using the masked multiplication operation MULTmsk and output {circumflex over (Z)}=MULTmsk({circumflex over (x)}, ŷ), according to the method of
The matrices Ŝ, M and ker(M) are not shown below to simplify the description of this example.
In step 503 of as n2−n′=31, as follows:
In step 504 of
It can be verified that:
In step 505, the matrix W is then determined as W={circumflex over (X)}TŶ+{circumflex over (R)} from the first masked variable {circumflex over (X)}, the second masked variable Ŷ and the random matrix {circumflex over (R)},
which provides:
In step 506, the result of the multiplication is flattened by applying the flatten function to A−TW which provides the following flattened matrix T defined as T=flatten (A−TW):
In step 508, the protected multiplication {circumflex over (Z)} is determined by performing the product of the flattened matrix T and of the matrix Ŝ such that {circumflex over (Z)}=TŜ.
In step 510, the result {circumflex over (Z)} is returned.
By decoding {circumflex over (Z)} using DECmsk, it can be verified that:
With Z=(x1·x2, y1·y2)=(α253, α29).
As formally analysed in previous art works (such as for example in Wei Cheng, Sylvain Guilley, Claude Carlet, Jean-Luc Danger, and Sihem Mesnager. Information Leakages in Code-based Masking: A Unified Quantification Approach. IACR Trans. Cryptogr. Hardw. Embed. Syst., 2021 (3): 465-495, 2021; or in Wei Cheng, Sylvain Guilley, Claude Carlet, Sihem Mesnager, and Jean-Luc Danger. Optimizing Inner Product Masking Scheme by a Coding Theory Approach. IEEE Trans. Inf. Forensics Secur., 16:220-235, 2021), the side-channel resistance of a processing system is upper limited by the security order in the encodings (or decodings) of CBM.
The protection device 10 according to the embodiments of the invention being based on the improved TCBM scheme, the security order is determined by the dual distance of the underlying linear code, generated by the encoding matrix A.
Considering that ds denotes the side-channel security order, the encoding matrix A may be split (or divided) into three sub-matrices as follows:
In Equation (27), the sub-matrix Ak∈, the sub-matrix Am∈
and the sub-matrix Ae∈
.
Each sub-matrix resulting from the division of the encoding matrix A respectively corresponds to a linear code (i.e. a sub-matrix generates a respective linear code). The sub-matrix Ak is thereby associated with a linear code C, the sub-matrix Am is associated with a linear code D and the sub-matrix Ae is associated with a linear code E.
Considering the matrix subdivision defined by equation (27), the side-channel security order of TCBM is defined by:
In equation (28), the linear code D is generated by the sub-matrix Am.
Advantageously, the protection device 10 may provide a fault detection capability against fault injection attack, which is another important threat to cryptographic implementations.
In some embodiment, the checking unit 108 may be configured to cover the computations performed by the different components of the protection device 10 and of the processing device 11, and in particular the computations performed inside the components by the different components 102, 104, 105, 106, 110. For instance, given two masked input vectors (x, mx, ϵX) and (y, my, ϵy), the masked multiplication performed by the multiplier 105 returns not only the k pairwise products of information, but also the m pairwise products of masks and the e pairwise products of ϵx and ϵy. Further, the refresh operation performed by the refreshing unit 106 may happen on the full codeword or selectively on the encoding of the (information, mask). This allows not altering the redundancy injected in the e elements.
Several fault detection strategies may be implemented by the checking unit 108.
For example, the randomness (independent of the sensitive information) may be fed in the e elements, and it can be checked at any point of the method implemented by the protection device 10 or the processing device 11 that the same operations have been carried out on the random elements than on the actual data. Such random elements are also referred to as ‘canaries’ in the security field. For example, if the processing function is related to AES, if k=e, one protected AES and another AES on other unrelated data can be carried out. As the end-to-end masking mangles the k and e elements, and error on codewords is very likely to impact the independent AES, this can be verified at the end on the ciphertext.
The e elements can also be a checksum on the masked data, which allows for fresh-ness of the canaries, though at the expense of causing more leakage if inadequately or defectively implemented.
A constant cst can be injected, which waives the requirement to verify the extra AES, since the output will be the same across AES invocations.
According to another fault detection strategy, a fault detection analysis may be performed in the elementary operations like the additions and multiplications performed by the adder 104 and the multiplier 105.
For example, considering two input vectors (x, mx, ϵX) and (y, my, ϵy) and the constant cst:
For the addition operation performed by the adder 104, as the addition uses two input operands (even), the parameters ϵX and ϵy will be cancelled out if there is no fault, so that the constant cst may be compensated one more time. For example, taking e=1 for detection of a single uniformly distributed fault and if there is any fault that makes either ϵX≠cst or ϵy≠cst, the faults can be detected at the end, with the fault coverage probability being 100% for one error indicator over .
For the multiplication operation performed by the multiplier 105, after the component-wise multiplication, it comes ϵ′=prod(ϵX, ϵy). Assuming there is no fault, then ϵ′ is component-wise square; then the inverse of cst has to be multiplied for compensation. This can be achieved by performing a multiplication with empty information and mask, but with the error indicator part being inverse of cst. In this case, cst is a nonzero element. Taking the same setting with e=1 for detection of a single uniformly distributed fault, the fault coverage probability is given by:
(The former part for ϵx≠0, and the later for ϵx=0).
The same reasoning holds for ϵy for one error indicator over .
Accordingly, the fault detection capability implemented by the checking unit 108 may be mainly determined by e error indicators ϵ, which typically results in high fault detection coverage in computations under mild conditions.
In step 700, the initial information word x (also denoted xin) comprising k information symbols are received.
In step 702, the encoding matrix A is determined from an information code C and a masking code D.
In step 704, the processing function is decomposed into basis operations including one or more elementary operations and possibly one or more additional operations. The elementary operations comprise one or more elementary operations including at least a multiplication operation. The elementary operations may also comprise one or more addition operation.
It should be noted that steps 702 and 704 may be performed according to a different order (inverse order or in parallel). Further, the step 704 may be performed previously and step 704 be replaced by a step consisting in using the precomputed decomposition of the processing function into elementary operations and additional operations.
In step 706, the encoding operation ENCmsk is applied to the initial information word x (also denoted xin) and to each input of an elementary operation resulting from the decomposition, which provides encoded variables.
In step 708, the elementary operations are executed using the variables encoded in step 706 (protected variables) instead of the corresponding original variables (unprotected variables). The elementary operations may comprise one or more additions ADDmsk (step 709) and/or one or more multiplications MULTmsk (step 710). In particular, the multiplication operation MULTmsk is masked using the pseudo-inverse matrix A−1 of said encoding matrix A, and the pseudo-inverse transpose matrix A−T of said encoding matrix A.
The additional operations may also be executed until all the basis operations are executed. The encoded variables may be refreshed once or at different instant times.
In step 712, in response to the computation of all basis operations, the variable encoded in step 706 or only some of them may be decoded using the decoding operation DECmsk ( ).
A checking step may be implemented to detect if failure occurred in the previous computations, at different phases of the processing, and if an error is detected an error notification may be generated.
In step 714, if an error was detected, the error notification is returned. Otherwise the result of the execution function ƒ(x) (also denoted ƒ(xin)) is returned.
The processing system may be used in various applications such as in various consumer, commercial, industrial, and infrastructure applications. The skilled person will readily understand that the invention is not limited to cryptosystems and can be applied to other processing systems 1 such as safety-critical systems (industrial systems, automotive systems, satellite systems, etc.) complying to standards such as IEC 62443, ISO 26262 & ISO/SAE 21434, etc. Those standards mandate fault detection capability, whilst at the same time ability to resist attacks, including side-channel attacks.
Embodiments of the present disclosure can take the form of an embodiment containing software only, hardware only or both hardware and software elements.
Furthermore, the methods described herein can be implemented by computer program instructions supplied to the processor of any type of computer to produce a machine with a processor that executes the instructions to implement the functions/acts specified herein. These computer program instructions may also be stored in a computer-readable medium that can direct a computer to function in a particular manner. To that end, the computer program instructions may be loaded onto a computer to cause the performance of a series of operational steps and thereby produce a computer implemented process such that the executed instructions provide processes for implementing the functions specified herein. In particular, the methods described herein may be implemented in a computer system.
It should be noted that the functions, acts, and/or operations specified in the flow charts, sequence diagrams, and/or block diagrams may be re-ordered, processed serially, and/or processed concurrently consistent with embodiments of the disclosure. For example steps 410 and 412 may be performed according to a different order or even in parallel. Moreover, any of the flow charts, sequence diagrams, and/or block diagrams may include more or fewer blocks than those illustrated consistent with embodiments of the disclosure.
While embodiments of the disclosure have been illustrated by a description of various examples, and while these embodiments have been described in considerable detail, it is not the intent of the applicant to restrict or in any way limit the scope of the appended claims to such detail. In particular, the invention is not limited to an encoding matrix A generated using a Vandermonde matrix. Indeed the encoding matrix may be generally generated from any matrix which meets a number of properties including at least security properties, the encoding matrix A being generated to meet security objectives in terms of dual distance. These properties may also include a property related to a PPA metric, the encoding matrix A being generated to reach a structure or a sparsity, which improves the PPA metric.
Additional advantages and modifications will readily appear to those skilled in the art. The disclosure in its broader aspects is therefore not limited to the specific details, representative methods, and illustrative examples shown and described.
Number | Date | Country | Kind |
---|---|---|---|
23307230.5 | Dec 2023 | EP | regional |