Automatic insertion of masking into an algorithm
Abstract
A computer implemented method, program product, and system implementing the method for converting a call graph representation of an algorithm into a secure call graph representation of the algorithm. The call graph includes an input (a, b, f), an internal variable that is an edge of the graph (c, d, e), a base function that is a node of the graph, and an output (g), the function being linear or non-linear , the method comprising the steps of: - masking each input of the call graph, - replacing each unmasked internal variable of the call graph with a masked variable, - at least each of the call graphs. Replacing the non-linear function with an equivalent function applied to the masked variable, unmasking each output of the call graph.

Term
11.4 yearsto projected expiry
Projected expiry 23 February 2038, counted from filing; an application has no term until it is granted.
- Priority and filed
- Published
- Today
- Projected expiry
12 claims: 5 independent, 7 dependent
- 1알고리즘의 호출 그래프 표현(call graph representation)을 상기 알고리즘의 보안 호출 그래프 표현(secured call graph representation)으로 변환하기 위한 컴퓨터 구현 방법으로서, 상기 호출 그래프는 적어도 하나의 입력(a, b, f), 적어도 하나의 에지(c, d, e), 적어도 하나의 노드(P, Q, R, S) 및 적어도 하나의 출력(g)을 포함하고, 상기 호출 그래프의 상기 에지는 상기 알고리즘의 내부 변수를 나타내고, 상기 호출 그래프의 상기 노드는 상기 알고리즘의 선형 또는 비선형 기본 함수를 나타내고, 상기 컴퓨터 구현 방법은, - 상기 호출 그래프의 각각의 입력을 마스킹하는 단계(601), - 상기 호출 그래프의 각각의 마스킹되지 않은(unmasked) 내부 변수를 마스킹된 변수로 대체하는 단계(602), - 상기 호출 그래프의 적어도 각각의 비선형 함수를, 마스킹된 변수에 적용되는 등가 함수로 대체하는 단계(603), - 상기 호출 그래프의 각각의 출력을 마스킹 해제하는(unmasking) 단계(604)를 포함하는, 컴퓨터 구현 방법.
- 2제1항에 있어서, 상기 호출 그래프는 반복적으로 프로세싱되는 부분을 포함하고, 상기 마스킹되지 않은 내부 변수를 마스킹된 내부 변수에 의해 대체하는 단계(602)는, 반복적으로 프로세싱되는 상기 호출 그래프의 부분의 입력 및 출력 둘 다로서 사용되는 내부 변수(b, g)를 식별하는 단계, 및 상기 호출 그래프의 상기 부분의 입력 및 출력에서 이들 변수에 대해 동일한 마스크(m 2 )를 사용하는 단계를 포함하는, 컴퓨터 구현 방법.
- 3제1항에 있어서, 상기 호출 그래프는 반복적으로 프로세싱되는 부분을 포함하고, 상기 마스킹되지 않은 내부 변수를 마스킹된 내부 변수에 의해 대체하는 단계(602)는, 반복적으로 프로세싱되는 상기 호출 그래프의 부분의 입력 및 출력 둘 다로서 사용되는 내부 변수(b, g)를 식별하는 단계, 및 상기 내부 변수의 마스크를 수정하기 위한 추가 노드(120)를 상기 반복 부분의 피드백 에지에 삽입하는 단계를 포함하는, 컴퓨터 구현 방법.
- 4제1항 내지 제3항 중 어느 한 항에 있어서, 반복적으로 프로세싱되는 상기 호출 그래프의 부분에서의 내부 변수의 상기 마스크는 규칙적인 간격으로 변경되고, 관련된 함수가 상응하게 수정되는, 컴퓨터 구현 방법.
- 5제4항에 있어서, 상기 반복 부분의 상기 내부 변수의 상기 마스크를 리프레쉬하기 위한 추가 노드(402)를 상기 호출 그래프에 삽입하는 단계를 더 포함하는, 컴퓨터 구현 방법.
- 6제1항 내지 제5항 중 어느 한 항에 있어서, 상기 호출 그래프의 적어도 각각의 비선형 함수를, 마스킹된 변수에 적용되는 등가 함수로 대체하는 단계(603)에서 계산되는 등가 함수는 매치 테이블(match table)을 사용하여 구현되는, 컴퓨터 구현 방법.
- 7제1항 내지 제6항 중 어느 한 항에 있어서, 상기 호출 그래프의 적어도 각각의 비선형 함수를, 마스킹된 변수에 적용되는 등가 함수로 대체하는 단계(603)는, 상기 호출 그래프의 각각의 선형 함수를, 상기 입력 및 출력 내부 변수의 마스크를 고려하는 등가 함수에 의해 대체하는 단계를 더 포함하는, 컴퓨터 구현 방법.
- 8제1항 내지 제7항 중 어느 한 항에 있어서, 모든 마스크 값은 랜덤하게 결정되는, 컴퓨터 구현 방법.
- 9제1항 내지 제8항 중 어느 한 항에 있어서, 보호된 실행 가능 코드를 생성하도록 상기 호출 그래프를 컴파일하는 추가 단계를 더 포함하는, 컴퓨터 구현 방법.
- 10컴퓨터 시스템으로 하여금 제1항 내지 제9항 중 어느 한 항에 따른 방법을 수행하게 하기 위한 컴퓨터 실행 가능 명령어를 포함하는, 비휘발성 컴퓨터 판독 가능 데이터 저장 매체 상에 저장되는 컴퓨터 프로그램 제품.
- 11컴퓨터 시스템으로 하여금 제1항 내지 제9항 중 어느 한 항에 따른 방법을 수행하게 하기 위한 컴퓨터 실행 가능 명령어를 포함하는 비휘발성 컴퓨터 판독 가능 데이터 저장 매체.
- 12메모리에 커플링되는 프로세서를 포함하는 시스템으로서, 상기 메모리는, 상기 시스템으로 하여금 알고리즘의 호출 그래프 표현을 상기 알고리즘의 보안 호출 그래프 표현으로 변환하기 위한 컴퓨터 구현 방법을 수행하게 하기 위한 컴퓨터 실행가능 명령어를 저장하고, 상기 호출 그래프는 적어도 하나의 입력, 적어도 하나의 에지(c, d, e), 적어도 하나의 노드(P, Q, R, S) 및 적어도 하나의 출력(g)을 포함하며, 상기 호출 그래프의 상기 에지는 상기 알고리즘의 내부 변수를 나타내고, 상기 호출 그래프의 상기 노드는 상기 알고리즘의 선형 또는 비선형 기본 함수를 나타내며, 상기 시스템은 상기 프로세싱 디바이스를 포함하고, 상기 프로세싱 디바이스는, - 상기 호출 그래프의 각각의 입력을 마스킹하도록, - 상기 호출 그래프의 각각의 마스킹되지 않은 내부 변수를 마스킹된 변수로 대체하도록, - 상기 호출 그래프의 적어도 각각의 비선형 함수를, 상기 마스킹된 변수에 적용되는 등가 함수에 의해 대체하도록, 그리고 - 상기 호출 그래프의 각각의 출력을 마스킹 해제하도록 구성되는, 메모리에 커플링되는 프로세서를 포함하는 시스템.
Independent claims12
122 paragraphs in 1 section, as filed
AUTOMATIC INSERTION OF MASKING INTO AN ALGORITHM
The present invention has application in the field of cryptography, and in particular relates to a method for protecting an implementation of an algorithm against side-channel attacks.
Existing encryption algorithms that involve encrypting sensitive data provide effective robustness against cryptanalysis and content recovery attacks. Since the attacker has only knowledge of the input and output of the encryption algorithm, these techniques are referred to as "black box techniques". Most encryption algorithms are standardized, and one of the most popular known and used is the Advanced Encryption Standard (AES). The confidentiality of encryption is based on a shared secret encryption key. The best option for an attacker to ignore the secret key is to try all possible combinations (brute force decoding). If the key is 128 or 256 bits long, the number of iterations required makes brute force decoding very computationally difficult to manage.
However, some attacks, called Side-Channel Attacks (SCAs), are executed in cryptographic algorithms based on information leaking from the physical implementation of the cryptographic algorithm, such as timing information, power consumption, electromagnetic leaks, etc. It gives attackers an opportunity to retrieve secret information.
Therefore, first of all, there is a need to provide a method for protecting the implementation of an algorithm that is sensitive to such attacks.
Any algorithm can be represented as a graph of operations, or a call graph, which is a directed graph in which each node is a function and each edge is an intermediate variable (also called an inner variable). . This call graph may also be referred to as a data flow graph or a control flow graph.
A function may be a single operation, or it may be a combination of linear or non-linear operations. It is a straight piece of code with no jumps. When a function contains multiple operands, it can be decomposed into multiple unary or binary operands.
A typical operation is one that can be implemented in a given technology. For example, a software program can compute arithmetic and logical operations such as addition ('+') or exclusive boolean OR ('XOR'). A Digital Signal Processor (DSP) or field programmable gate array (FPGA) is implemented in a look-up-table (LUT) or arithmetic operation using a multiply-accumulate (MAC) unit. Any function can be calculated. An Application Specific Integrated Circuit (ASIC) can calculate any type of operation by utilizing a standard cell library.
A function can be expressed in a high-level language, but can also be mapped as a set of operations. It is the compiler's job to translate these functions, potentially described in a high-level language, into a machine language that optimizes processing time and resource consumption.
The graph representing the algorithm is a directed graph: each node or function has as many entering edges as the input argument and as many outgoing edges as the output result. For example, if a function is a simple binary operation (with two arguments and one result), it has two inputs and one output.
Edges pass typed variables that are passed from node to node. The type can be a byte, a 32-bit word, and so on.
Considering a sensitive algorithm, such as a cryptographic algorithm, described as a call graph, and transforming the algorithm to protect the cryptographic algorithm against side-channel attacks, regardless of the type of algorithm or any consideration regarding the implementation of the cryptographic algorithm. It is an object of the present invention.
In order to increase the robustness of the algorithm against side-channel attacks, it is known to mask important data of the algorithm. One example of masking is based on secret sharing, which divides the initial variable into a plurality of new variables such that the sum of the new variables yields the initial variable. The sum must be understood according to the underlying type of the variable. For example, if the variable is one byte, the sum may be bitwise XOR or addition modulo 256 addition.
If the operation affecting the masked data is a linear function, the value of the masked output of the function may be calculated from the masked input. However, if the function is non-linear (eg, a power function, a substitution box of a cryptographic algorithm, ...), the mask calculation may not be possible. The mask must be removed from the function's input, and a new mask must be inserted at the function's output.
Various masking techniques are known, some of which have been proven. They apply to linear programs, which are linear call graphs. Masking is a chaining operation with random reshare (or refresh) of the mask between operations, whenever appropriate. However, if the graph is not straight, some vulnerabilities may appear.
In Provably secure higher-order masking of AES by M. Rivain and E. Proof in CHES 2010, pages 413-427, a fully masked AES algorithm is presented. In this paper, the masking of specific linear and nonlinear functions is described, and the functions are chained to describe the complete AES algorithm. However, JE of FSE 2013 pages 11-13. Even with an approach specifically dedicated to the AES algorithm, some implementation problems may arise, as shown in High-Order Side Channel Security and Mask Refreshing by Coron, E. Proof, M. Rivain, and T. Roche. These implementation problems arise from the reuse of some variables, and therefore the achieved level of security is reduced.
Thus, today, most masking implementations are performed manually, which is prone to implementation errors (eg, sensitive variables are not masked). Only a few studies consider automatic masking.
Among these studies is the article Compiler assisted masking, Cryptographic Hardware and Embedded Systems by A. Moss, E. Oswald, CHES 2012, pages 58-75. In this paper, sensitive data is annotated by the programmer, and their confidentiality is treated as values in a grid that allows the compiler to pass confidential information through the program. Once compiled, the secret data never appears in plain text during program execution, thereby ensuring the confidentiality of the masked data, especially against side-channel attacks. The algorithm then takes steps to detect sensitive information leaks in all values of the program, especially in temporary variables introduced when transforming expressions, and if a leak occurs, it uses a set of program transforms to try to prevent the leak. try
A disadvantage of the solution revealed in this paper is that it only applies to first-order Boolean masking schemes and linear codes. Moreover, the steps of detecting leaks and transforming programs to prevent such leaks are not constrained to converge.
Synthesis of masking countermeasures against side channel attacks, Computer aided verification (pages 114-130) by Eldib H., Wang C. of Springer International Publishing, January 2014, in which the entire algorithm is masked, including all intermediate values. that is suggested To deal with non-linear functions, it is proposed to determine a functionally equivalent linear function, to ensure that the function is equally and perfectly masked for all possible inputs.
This method has similar disadvantages to Moss et al.'s method, since it only applies to the call graph of the Boolean type. Also, the method follows a trial and error methodology with no guaranteed execution time.
Accordingly, there is a more stringent need for a fully automatic and robust method for converting an unprotected algorithm into a secure version of the algorithm.
To address these and other problems, a computer-implemented method for converting a call graph representation of an algorithm into a secured call graph representation of the algorithm is provided. A call graph includes one or more inputs, one or more edges (c, d, e), one or more nodes (P, Q, R, S), and one or more outputs (g). The edges of the call graph represent the internal variables (or intermediate variables) of the algorithm, and the nodes of the call graph represent the linear or non-linear basic function of the algorithm. A computer implemented method according to the present invention comprises:
<img file="KR20180098172A_D0001.tif" /> masking each input of the call graph;
<img file="KR20180098172A_D0002.tif" /> replacing each unmasked internal variable of the call graph with a masked variable;
<img file="KR20180098172A_D0003.tif" /> replacing at least each nonlinear function in the call graph with an equivalent function applied to the masked variable;
<img file="KR20180098172A_D0004.tif" /> Unmasking each output of the call graph.
The method advantageously applies to both linear and non-linear call graphs with limited and deterministic execution times, and is not limited to boolean types of operations.
Transforming an unprotected algorithm into a secure version of the algorithm satisfies two required characteristics:
<img file="KR20180098172A_D0005.tif" /> Preserves semantics, i.e., the same result is obtained from a determined set of inputs compared to the original program, and
<img file="KR20180098172A_D0006.tif" /> Mask all intermediate variables (i.e. variables passed by vertices).
If the call graph includes parts that are iteratively processed, replacing the unmasked internal variable by the masked internal variable may include: identifying, and using the same mask for these variables at the input and at the output of that portion of the call graph.
Alternatively, replacing an unmasked inner variable by a masked inner variable comprises: identifying an inner variable used as both an input and an output of a portion of a call graph that is iteratively processed, and This may be ensured by inserting an additional node at the feedback edge to modify the mask of the internal variable.
Advantageously, the mask of an internal variable in a portion of the call graph that is processed iteratively may be changed at regular intervals, and the associated function is modified accordingly. This mechanism can be achieved by inserting an additional node into the call graph to refresh the mask of the internal variable of the iteration part.
In a computer implemented method according to certain embodiments of the present invention, the equivalence function calculated in the step of replacing at least each non-linear function in the call graph with an equivalence function applied to the masked variable uses a match table. may be implemented. According to one embodiment of the present invention, the linear function of the call graph may be replaced by an equivalent function that takes into account the masks of the input and output internal variables.
According to one embodiment of the present invention, some or all of the mask values of the secure call graph may be randomly determined.
According to one embodiment of the present invention, the computer implemented method may further comprise the further step of compiling the call graph to generate protected executable code.
The present invention also provides a computer program product stored on a non-volatile computer readable data storage medium comprising computer executable instructions for causing a computer system to perform a computer implemented method according to any embodiment of the present invention, and a computer A non-volatile computer-readable data storage medium comprising computer-executable instructions for causing a system to perform the computer-implemented method.
The invention also relates to a system comprising a processor coupled to a memory, wherein the memory causes the system to perform a computer implemented method for converting a call graph representation of an algorithm into a secure call graph representation of the algorithm. Stores executable instructions. A call graph includes one or more inputs, one or more edges (c, d, e), one or more nodes (P, Q, R, S), and one or more outputs (g). The edges of the call graph represent the internal variables of the algorithm, and the nodes of the call graph represent the linear or non-linear basic function of the algorithm. The system includes a processing device, the processing device comprising:
<img file="KR20180098172A_D0007.tif" /> to mask each input of the call graph,
<img file="KR20180098172A_D0008.tif" /> to replace each unmasked internal variable in the call graph with a masked variable,
<img file="KR20180098172A_D0009.tif" /> to replace at least each nonlinear function in the call graph by an equivalent function applied to the masked variable, and
<img file="KR20180098172A_D0010.tif" /> to unmask each output of the call graph
is composed
BRIEF DESCRIPTION OF THE DRAWINGS The present invention will be better understood, and its various features and advantages will appear from the following description of a number of exemplary embodiments, which are provided for illustrative purposes only, and from the accompanying drawings thereof, in which: 1a shows an unprotected call graph as known from the prior art; 1b and 1c show a call graph which is protected according to two embodiments of the invention, advantageously ensuring in particular the consistency of the mask applied to the variables used as inputs and outputs of the repeating part of the graph; , - Figures 2a and 2b illustrate two ways of processing a linear function; 3 illustrates one way of processing a non-linear function, by constructing a match table equivalent to the non-linear function, taking into account masked inputs and outputs; Figure 4a shows an unprotected call graph with the repeating part expanded for illustrative purposes; - Figures 4b and 4c are diagrams showing a protected call graph according to two embodiments of the present invention, wherein the mask of internal variables used in the iteration part of the call graph is modified at each iteration, and the repeating part is for illustrative purposes; has been developed for - Figure 5a is a typical call graph representation of an AES algorithm, Figure 5b is a corresponding protected call graph generated according to one embodiment of the present invention; 6 is a flowchart depicting a computer implemented method according to certain embodiments, and 7 illustrates a system that may be used for processing the present invention; The examples disclosed herein are merely illustrative of some embodiments of the present invention. They do not in any way limit the scope of the invention as defined by the appended claims.
1A shows an unprotected call graph as known from the prior art. This representation is a standard representation for purposes of illustration.
The unprotected call graph of Figure 1A illustrates the execution of computer code. It contains a plurality of nodes (P, Q, R, S), each of which relates to a function performed by the code. As indicated above, each function expressed as a node may consist of a single operation or a combination of operations. A function may or may not be linear.
The unprotected call graph also includes oriented links that connect the output of a node to the input of another node, called an edge of the graph. These edges are associated with intermediate variables (c, d, e) that are transferred from one function to the next.
The unprotected call graph further includes one or more inputs (a, b, f), and one or more outputs (g).
The unprotected call graph also includes an iteration portion 101 in which functions P, Q, R and S are processed multiple times, with subsequent iterations taking as input the output of the previous iteration.
The call graph is a representation of the interdependencies of functions during the execution of a program, and the interactions required to produce an output variable g from the input variables a, b, f. It can be described using various programming languages, for example, Graphic, Unified Modeling Language (UML) or HyperText Markup Language (HTML). It can be compiled from source code using software such as Doxygen© or Eclipse©, or compiled code (assembler language, LLVM-IR (Low Level Virtual Machine - Intermediate Representation; Low Level Virtual Machine - Intermediate Representation), VHDL (VHSIC Hardware) Description Language (VHSIC hardware description language), can be generated automatically from Verilog©, or even manually.
1B shows a protected call graph according to a first embodiment of the present invention.
In order to provide robustness against cryptography and content recovery attacks, the present invention involves masking each variable of a program with a mask, and, in accordance with some advantageous embodiments of the present invention, changing this mask during program execution. based on
To this end, the input variables a, b, f are masked (111, 112, 113). mask value (m<sub>1</sub>, m<sub>2</sub>, m<sub>6</sub>) may be arbitrarily selected. The masked variable is then aθm<sub>1</sub>, bθm<sub>2</sub> and fθm<sub>6</sub>is designated as
Then, each unmasked internal variable (c, d, e) of the call graph is the masked variable (cθm)<sub>3</sub>, dθm<sub>4</sub>, eθm<sub>5</sub>) is replaced by The mask may be chosen randomly, or if the internal variable is the output of a linear function, it may be correspondingly inherited from the mask used for the input of the function.
In this embodiment, to ensure consistency of the protected call graph, when an internal variable is used as both the input and output of the repeating portion of the graph (for Fig. 1g), the mask variable is the input and You can also use the same mask on both outputs. Thus, the masks associated with variables b and g are the same (m<sub>2</sub>).
Thus, the input of function P' is masked equally at each iteration.
After assigning a mask to each input and replacing each unmasked inner variable with a masked variable, the functions (P, Q, R, S) associated with the nodes of the call graph are for (P', Q', R', S').
If the function is linear and the masking is Boolean, the output mask may be inherited from the input mask. Thus, the function does not need to be modified. Otherwise, the function must be replaced by an equivalent function that arrives at the same result, while taking the masked variable as input, and masks the output of the function.
If the function is non-linear, it is generally not possible to make a link between the output mask and the input(s) mask(s). Unmasking the input data, processing the function, and masking the result cannot be considered, since unprotected information would appear and could be considered an information leak. Thus, a function may be replaced by a match table that gives all possible results of the function, the match table being constructed taking into account input and output masks. In this way, in contrast to the prior art, all variables processed by the algorithm are protected and no approximation of the non-linear function(s) will be made.
Finally, the variable g that outputs the call graph may be unmasked (114).
In the first embodiment, all internal variables are correspondingly protected, and the result of the protected call graph of FIG. 1B is exactly the same as the result of the unprotected call graph of FIG. 1A . Except for masking the input and unmasking the output of the program, this first embodiment does not affect the number of nodes in the program. Its final complexity and processing time will not be affected by the additional protection layer. Once compiled, none of the internal variables will appear unprotected. Thus, the execution of the program is fully protected against cryptography and content recovery attacks.
1C shows a second embodiment of the present invention. In this embodiment, as in Fig. 1b, the inputs a, b and f are masked, the unprotected internal variables c, d, e are replaced by the protected variables, and the function is modified correspondingly, The output (g) of the call graph is unmasked.
However, the consistency of the masking with respect to the repeating portion of the graph introduces to the feedback loop 101 of the repeating portion an additional node 120 configured to modify the mask value of an internal variable used as both an input and an output of the repeating portion. Guaranteed by inserting
In Fig. 1c, the output of the repeating part is the masked variable (gθm<sub>7</sub>), and node 120 is gθm<sub>7</sub>gθm<sub>2</sub>Modify the mask of this variable to convert to . To ensure that the information does not appear unprotected, the output mask (m<sub>7</sub>) before the input mask (m<sub>2</sub>) is applied. As in Fig. 1b, the input of function P' has the same mask at each iteration.
An advantage of the second embodiment compared to the first embodiment is that all the masks may be randomly selected.
Various methods may be used to mask the data. Masking may be, for example, simple first-order Boolean masking, such as summing a variable with a secret shared value, higher-order Boolean masking, or any other more sophisticated masking technique. One of the advantages of the present invention is that it is compatible with any masking technique.
Figure 2a illustrates how to process a linear function. In this function, if the masking is Boolean, the mask applied to the output variable(s) 203 depends on the mask applied to the input variable(s) 201 and 202 . Thus, the output mask is given by applying a linear function to the input mask. In this example, the input variables (a and b) are the values (m<sub>1</sub> and m<sub>2</sub>) are masked by The output of the function is the mask(f(m<sub>1</sub>, m<sub>2</sub>)) is masked by the value that is the result of the function applied to it. Considering a simplified example, if function 211 is a multiplicative function, then f(m<sub>1</sub>, m<sub>2</sub>) is m<sub>1</sub> *m<sub>2</sub>same as
2B illustrates an embodiment for processing a linear function when the protected value appearing as a result of the function has a particular mask value.
In this embodiment, two possibilities may be implemented:
<img file="KR20180098172A_D0011.tif" /> Inserting an additional node 212 into the call graph, the additional node is the mask f(m) that affects the result of the linear function<sub>1</sub>, m<sub>2</sub>) required mask (m<sub>3</sub>) to the conversion to To this end, the function 212 is a mask f(m)<sub>1</sub>, m<sub>2</sub>)) on the result of the linear function before removing the mask (m<sub>3</sub>) may be added, or
<img file="KR20180098172A_D0012.tif" /> Compute a match table 221 equivalent to a linear function taking into account the values of the mask, the match table stored in memory. This table is aθm<sub>1</sub> and bθm<sub>2</sub>Include as input all possible values of , and output each of these values (cθm<sub>3</sub>) with the corresponding value of The match table may be computed by executing functions 211 and 212 for all possible inputs. This table may be stored encrypted, but it may not be necessary, since the data contained in the table does not allow determining any information about the original unprotected data processed by the function.
Processing of a linear function as shown in Figure 2b allows to use a random mask for each internal variable of the call graph.
3 illustrates an embodiment for processing a non-linear function. In this embodiment, the processing of the non-linear function is based on constructing a match table equivalent to the function, taking into account the masked inputs and outputs. It should be noted that this processing can also be applied to process linear functions.
In contrast to the linear function shown in Figures 2a and 2b, the mask of the output values cannot be determined from the mask of the input values. For this reason, the non-linear function must be replaced by an equivalent match table 310 that provides the result of the function for every possible set of inputs. The match table is an input variable (aθm<sub>1</sub> and bθm<sub>2</sub>) may be computed by unmasking 301 and 302 , applying a nonlinear function 303 , and masking the result of the nonlinear function 304 .
To construct a table, all possible input variables may be browsed. Accordingly, the table may be proportional to the number of inputs, the number of outputs, and/or the data size. For example, considering that the inputs (a and b) are coded over 8 bits, the relevant match table is: 2^8(number of possibilities for a) * 2^8(number of possibilities for b) * It is a table that reaches a size of 8 bits (size of c).
Fig. 4A shows the unprotected call graph of Fig. 1A in an embodiment in which the iterative portion of the algorithm is deployed. In the following description of FIG. 4A , it is contemplated that the repeating portion is executed only twice, for illustrative purposes only.
The function (P, Q, R, and S) is executed twice, where the values of the inner variable (c', d', e' and g') during the second iteration are equal to the values of the same variable during the first iteration (c , d, e and g).
4B and 4C show a protected call graph according to another embodiment of the present invention, wherein the mask of internal variables used in the iteration portion of the call graph is modified at each iteration. In the following description of Figs. 4b and 4c, it is considered that the repeating part is developed as in Fig. 4a.
A high level of protection is obtained by refreshing the mask value at the end of each iteration (ie by changing the mask value), especially against side-channel attacks that use certain aspects of the mask being applied.
In Figure 4b, the first iteration is masking each input (a, b and f), masking each internal variable (c, d, e and g) to the masked variable (cθm)<sub>3</sub>, dθm<sub>4</sub>, eθm<sub>5</sub> and gθm<sub>7</sub>), and modifying the function to take into account the masked variables (P', Q', R' and S'), as in Fig. 1b or 1c.
For subsequent iterations, the masks used for the internal variables c, d, e and g are modified, and the associated function is modified correspondingly. The mask applied to the variable used as input to the iteration may also be modified. In that example, the input (a and f) has a mask (m<sub>1</sub> and m<sub>6</sub>Nodes 111 and 113 applying a new mask m<sub>8</sub> and m<sub>12</sub>) is changed to the nodes 401 and 403 that apply. Masked variable (cθm)<sub>3</sub>, dθm<sub>4</sub> and eθm<sub>5</sub>) is the new masked variable (cθm<sub>9</sub>, dθm<sub>10</sub> and eθm<sub>11</sub>) is changed to mask (m<sub>1</sub> and m<sub>2</sub>A function (P') which takes as input a variable masked by ) is modified with an equivalent function (P"), where<sub>8</sub> and m<sub>7</sub>It takes as input a variable masked by . If function P' is a linear function and the output of the function is masked by a mask that is inherited from the input mask, then P' may remain unmodified. The functions Q', R' and S' are correspondingly modified into the functions Q", R" and S".
In an alternative embodiment (not represented), the masks of inputs a and f may not be modified from iteration to iteration.
The call graph may be represented, for example, in FIG. 1C , using an additional node corresponding to refreshing the mask of all variables involved in the iteration, such as node 120 in the feedback loop of the iteration portion.
4C illustrates another embodiment in which node 402 is inserted into a feedback loop of an iteration. This node 402 is involved in refreshing all masks applied to the inputs and variables involved in the iteration. Also, as shown in Fig. 4c, this node further changes the mask affecting the output of the previous iteration, thereby causing the mask (m<sub>7</sub>) to the mask (m<sub>9</sub>) can be converted to
5A is a call graph representation of an unencrypted AES algorithm. These exemplary representations are used to illustrate the method according to the present invention. This representation is byte 0 (x<sub>0</sub>), and iteratively processed steps of the AES algorithm, called "round steps". In the standard implementation of the AES algorithm, the first round (pre-processing) and the last round (post-processing) are special. These rounds are not represented here, and Fig. 5a focuses only on the intermediate rounds of the data path (AES key (k<sub>It's</sub>) not shown).
Each round is an iterative process, where y is the output of one iteration of the round.<sub>0</sub> byte is the input to the round, x<sub>0</sub>This means that it loops back to .
In the call graph representation, the circles represent operations performed on different variables, while the edges of the graph represent internal variables. In Figure 5, there are no inputs or outputs, as they are processed in the first and last iterations (not represented) of the round.
x in round<sub>0</sub>The first function applied to is called a permutation box (known as S-box). This permutation is the main element of the algorithm and x<sub>0</sub>It is a bijective nonlinear operation performed on . The output of the first substitution box is the intermediate variable (a) of FIG. 5A.
The following function applied to a is a set of three linear operations performed on the Galois field: times 1 (times 1), times 2 (times 2), and times 3 (times 3). These operations are linear.
The results of these operations, called b, b' and b", are bytes 5, 10 and 15 (x<sub>5</sub>, x<sub>A</sub>, x<sub>F</sub>) is mixed with the result of the corresponding operation performed on This operation is referred to as "Mixcolumn". Blend is an XOR operation performed on four entries. This function is equivalent to three consecutive XOR operations. The output of the "mixcolumn" operation is the intermediate variable (c).
The next function applied to c is a step called "Addroundkey", which XORs c to the key (or the specific bytes processed from the key) (k<sub>0</sub>), mixed with y to be used as input for subsequent iterations<sub>0</sub>create
5B is a call graph representation of the AES algorithm of FIG. 5A after being protected in accordance with one embodiment of the present invention.
x<sub>0</sub>Since is the intermediate variable, it is the mask (θm<sub>00</sub>) is masked by this mask is x<sub>0</sub>may be an XOR performed between and a known random value, but it may also be multidimensional sharing meaning that multiple mask layers are applied. In the latter case, θm<sub>00</sub>is not necessarily a byte (8-bit) share, but can be any dimension of sharing. It may also be a pair or triplet or any other association of masks having the same or different sizes.
After processing in the S box step, the intermediate variable (a) is the mask (θm)<sub>01</sub>) is masked by Since the permutation box is a non-linear function, as illustrated in Fig. 3, it is the mask (θm<sub>00</sub>) must be replaced by an equivalent match table that removes all at once, performs a non-linear function, and masks the result (θm<sub>01</sub>) must be used to mask it. Therefore, θm<sub>01</sub>is necessarily θm<sub>00</sub>is not related to
One After performing the doubling, doubling, and tripling operations, the intermediate variable (b) is the mask (θm).<sub>02</sub>) may be masked by In some embodiments, the mask is θm<sub>01</sub>may be equal to, or the function may be replaced by an equivalent match box, so that θm<sub>02</sub>is θm<sub>01</sub>can be selected completely independently of
In another embodiment, an equivalent match table 501 may be computed that performs the operation of the permutation box and the operation of 1, 2, and 3 times. The match table is one input (x<sub>0</sub>qm<sub>00</sub>) and three outputs (bθm<sub>02</sub>, b'θm<sub>02</sub>, b"θm<sub>02</sub>) may have Alternatively, three match tables may be computed, each of which has one input and one output. Permutation boxes, regrouped by 1x, 2x and 3x operators in the match table, represent operations called "T-box" (Table box) when unencrypted.
In other embodiments, a different mask may be assigned to each of the intermediate variables b, b' and b".
The step of mixing the results of calculations performed on various bytes is a linear function. As a result, the output mask (θm<sub>03</sub>) is the mask of the input (θm<sub>01</sub>, θm<sub>51</sub>, θm<sub>A1</sub>, and θm<sub>F1</sub>)(θm<sub>51</sub>, θm<sub>A1</sub>, and θm<sub>F1</sub>is the variable (x<sub>5</sub>, x<sub>A</sub> and x<sub>F</sub>) can be retrieved from the mask each associated with the output of the T box calculation for processing. However, the output mask (θm) is completely independent of the input mask.<sub>03</sub>) may be computed with an equivalent match table allowing to select
In the next step, the intermediate variable (cθm<sub>03</sub>) is the key (k<sub>0</sub>) is mixed with Since the key is a constant and not a variable, the key does not need to be masked. The result of mixing is y<sub>0</sub>θm<sub>04</sub>am. Since the mixing operation is linear, θm<sub>04</sub>is θm<sub>03</sub>, or can be completely independent if the mixing function is replaced by an equivalent match table.
Finally, a refresh node 502 may be inserted. The first purpose of the refresh node is to<sub>0</sub>/x<sub>0</sub>) is used as the input/output of the repeating part of the call graph, θm<sub>04</sub>θm<sub>00</sub>It is to ensure the consistency of the protected call graph by converting to . In some embodiments, the refresh mask may further involve changing the mask for at least some of the internal variables belonging to the iterative loop (in which case the mask θm<sub>00</sub>, θm<sub>01</sub>, θm<sub>02</sub>, θm<sub>03</sub> and θm<sub>04</sub>)Lim).
When the nodes of a linear function inherit from their parent node, the mask(s) of the variable that is the input to the loop (θm in Fig. 5a)<sub>00</sub>) and a mask of variables that are output(s) of the non-linear function(s) (θm in FIG. 5B , according to an embodiment)<sub>01</sub> or θm<sub>02</sub>) can be refreshed. This means modifying the associated equivalence table to ensure call graph consistency. The refreshed mask is automatically propagated to the input/output of the linear function.
It should be noted that the refresh node 512 is optional. Another way to ensure the consistency of the protected call graph is, for example, θm<sub>00</sub>θm equal to<sub>04</sub>may be to choose
6 is a flowchart depicting a computer implemented method in accordance with certain embodiments.
The method includes:
- masking the input of the call graph to generate a masked input (601);
- replacing (602) unprotected variables of the graph represented by edges of the graph by masked variables. The mask of the masked variable may be chosen randomly, or may be the result of the use of a linear function on the masked variable;
- replacing ( 603 ) at least the non-linear function of the calling graph represented by the nodes of the graph by the equivalent function, so as to perform the same operation as the initial function, taking into account the mask affecting the input/output of the function. This operation can also be performed on linear functions of the call graph. One possible implementation is to replace the function by a match table that is created taking into account the masks affecting the input/output, and to relate the output value to each possible combination of the input values; and
- unmasking (604) the output of the call graph.
The method according to the invention modifies the repeating portion of the graph such that the masked inputs and variables are refreshed at each iteration of the loop, either regularly or randomly, or at a slower rate (meaning that the value of the mask is modified). may include an additional optional step 605 of Therefore, a variable that is calculated repeatedly is never protected with the same mask. Although not limited to this application, the method according to the present embodiment has particular advantages when applied to cryptographic algorithms that often include a very large number of iterations performed over small computations.
The methods described herein may be provided to any type of processor or any software programmable machine, such as, for example, a microprocessor, microcontroller, or DSP to implement the functions/acts specified herein. may be implemented by computer program instructions that create a machine that executes the instructions. These computer program instructions may also be stored on a computer-readable medium capable of instructing a computer to function in a particular manner. To this end, computer program instructions may be loaded onto a computer such that the executed instructions provide a process for implementing the functions specified herein, cause performance of a series of operational steps, and thereby create a computer implemented process. have.
The method includes protected compiled code that can be used alone, but can be paired with a compiler, and thereby be executed by a computational machine, to generate a protected representation of an algorithm from an unprotected algorithm; or hardware code, for example, in the form of a netlist implemented on a dedicated computing machine such as a field programmable gate array (FPGA), or an application specific integrated circuit (ASIC) and generated by a compiler.
To this end, the method may include an additional step 606 of compiling the protected call graph to generate executable code that is robust to cryptography and content recovery attacks.
7 illustrates a system, eg, a general purpose computer system, that may be used to process the present invention. The system retrieves unprotected data, such as non-volatile computer readable memory (M) in which a computer program product is stored, source code or executable code processed by a processor (CPU), or unprotected call graphs, It includes an input/output interface I/O for generating a call graph, wherein the processor is coupled to the memory and the input/output interface via a data bus.
More generally, the methods and devices described herein may be implemented by various means. For example, these techniques may be implemented in hardware, software, or a combination thereof.
Various embodiments of the present invention provide several advantages, including:
- they present a high-level approach that is not related to implementation;
- they give the algorithm robustness against all kinds of side-channel attacks, notably because all variables processed by the algorithm are masked while the meaning of the algorithm is preserved;
- they are applicable to any type of software program, to linear and non-linear functions;
- they are fairly easy to implement and compile,
- they do not represent information leakage, since all variables are masked;
- They can be programmed to run automatically, without involving a human operator.
Although embodiments of the present invention have been illustrated by way of description of various examples, and while these embodiments have been described in considerable detail, it is the applicant's responsibility to limit or in any way limit the scope of the appended claims to these details. not intentional Additional advantages and modifications will be readily apparent to those skilled in the art. Accordingly, the invention in its broader aspects is not limited to the specific details, representative methods, and exemplary embodiments shown and described.
26 sheets
Sheet 1 Sheet 2 Sheet 3 Sheet 4 Sheet 5 Sheet 6 Sheet 7 Sheet 8 Sheet 9 Sheet 10 Sheet 11 Sheet 12 Sheet 13 Sheet 14 Sheet 15 Sheet 16 Sheet 17 Sheet 18 Sheet 19 Sheet 20 Sheet 21 Sheet 22 Sheet 23 Sheet 24 Sheet 25 Sheet 26
Every citation, both ways
| Document | Relation | Office | Cited during |
|---|---|---|---|
| US8091139B2 | Cites | United States of America | Search report |
| Alexander DeTrano et. al., “Exploiting small leakages in masks to turn a second-order attack into a first-order attack and improved rotating substitution box masking with linear code cosets”, Hindawi Publishing Corporation, The Scientific World Journal (2015.)* | Non-patent | – | Search report |
8 members in 4 offices
Members8
| Document | Office | Kind | |
|---|---|---|---|
| EP3367606A1 | European Patent Office (EPO) | A1 | |
| US2018248682A1 | United States of America | A1 | |
| KR20180098172AThis record | Republic of Korea | A | |
| CN108512645A | China | A | |
| EP3367606B1 | European Patent Office (EPO) | B1 | |
| KR102049656B1 | Republic of Korea | B1 | |
| US10735179B2 | United States of America | B2 | |
| CN108512645B | China | B |
6 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| Full renewal or maintenance fee paidU11 | U11 | |
| Annual fee paymentFPAY | FPAY | |
| Written decision to grantGRNT | GRNT | |
| Decision to grant or registration of patent rightE701 | E701 | |
| Notification of reason for refusalE902 | E902 | |
| Request for examinationA201 | A201 |
Numbers
- Publication
- 10-2018-0098172
- Application
- 100022242
Titles5
- Korean
- 알고리즘으로의 마스킹의 자동 삽입
- English
- AUTOMATIC INSERTION OF MASKING INTO AN ALGORITHM
- English
- Automatic insertion of masking into the algorithm
- Unlabeled
- 알고리즘으로의 마스킹의 자동 삽입{AUTOMATIC INSERTION OF MASKING INTO AN ALGORITHM}
- Unlabeled
- AUTOMATIC INSERTION OF MASKING INTO AN ALGORITHM
Classification
- CPC, 11
- H04L9/002
- H04L9/003
- G06F21/75
- H04L2209/04
- G06F7/764
- H04L2209/046
- G06F2207/7233
- G06F2207/7238
- G06F21/755
- H04L9/008
- H04L9/0631
- IPC, 2
- H04L9 00
- G06F7 76