This application claims the benefit of French Application No. 1911349, filed on Oct. 11 2019, which application is hereby incorporated herein by reference.
The present disclosure relates generally to electronic systems, circuits and methods, and more specifically to methods and electronic devices configured to perform calculations on binary words, such as processors, for example. The present disclosure more specifically relates to methods and devices configured to process masked data values.
Among the various devices that are configured to perform calculations on binary words, processors are electronic components, present in many electronic systems and circuits, that are configured to process data values by executing commands and instructions from computer programs.
In some cases, a processor may have to process secret data values. These secret data values are generally encrypted, for example by masking.
It would be desirable to be able to improve, at least partially, certain aspects of known devices configured to perform calculations on binary words.
There is a need for more reliable devices configured to perform calculations on binary words.
There is a need for devices configured to perform calculations on binary words configured to process masked data values.
There is a need for devices configured to perform calculations on binary words configured to process masked data values without implementing an operation to unmask these data values.
One embodiment addresses all or some of the drawbacks of the known devices configured to perform calculations on binary words.
One embodiment addresses all or some of the drawbacks of known processors configured to process masked data values.
One embodiment provides a method for processing masked binary data values, implemented by a device configured to perform calculations on binary data values, comprising an operation for the extraction and insertion of a first part of a first masked binary data value in a second masked binary data value, in which the first and second masked binary data values stay masked throughout all of the processing.
According to one embodiment, the method does not comprise any unmasking operation of the first and second masked binary data values.
According to one embodiment, the first and second masked binary data values are masked by a masking operation only comprising arithmetic operations.
According to one embodiment, the masking operation is an operation in which the data value to be masked is added to a mask in order to obtain the masked data value.
According to one embodiment, a third binary data value is the result of the extraction and insertion operation, the third binary data value is a data value masked by a third mask.
According to one embodiment, the second masked binary data value is obtained by performing a masking operation of a binary data value for which all of the bits are equal to “o”.
According to one embodiment, the second masked binary data value is equal to a second mask used during the masking operation.
According to one embodiment, the third masked binary data value Z_M is given by the following formula:
Z_M[n−1;0]=(Z_M[n−1;p+1]*2p+1+CB(p+m)*2p+B_M[p+m−1;m])mod2n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value Z_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CB(i) represents the carry digit of rank i that may appear during the masking operation leading to a first masked data value;
B_M represents the first masked data value,
the carry digit CB(i+1), i being a natural integer less than or equal to n, is given by the following formulas:
wherein MB represents a first mask associated with the first masked binary data value, and the third mask MZ associated with the third masked binary data value is given by the following formula:
MZ[n−1;0]=(MZ[n−1;p+1]*2(p+1)+CB(m)+(m)+MB[p+m−1;m])mod2n
According to one embodiment, the third masked binary data value X_M is given by the following formula:
X_M[n−1;0]=(Z_M[n−1;p+1]*2p+1+CB(p+m)*2P+B_M[p+m−1;m]−CB(m))mod2n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value X_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CB(i) represents the carry digit of rank i that may appear during the masking operation leading to the first masked data value;
B_M represents the first masked data value,
the carry digit CB(i+1), i being a natural integer less than or equal to n, is given by the following formulas:
wherein MB represents the first mask associated with the first masked binary data value, and the third mask NIX associated with the third masked binary data value is given by the following formula:
MX[n−1;0]=(MX[n−1;p+1]*2(p+1)+MB[p+m−1;m])mod2n
According to one embodiment, the third masked binary data value F_M is given by the following formula:
F_M[n−1;0]={(E_M[n−1;k+p]+CEF(k+p))*2{circumflex over ( )}((k+p))+(D_M[m+p−1;m]+ME[k+p−−1;k]−MD[m+p−1;m]+CE(k)−CD(k))*2{circumflex over ( )}k+E_M[k−1;0]}mod2{circumflex over ( )}n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value X_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
k is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CEF(i) represents a carry digit correction with rank i;
CD(i) represents the carry digit of rank i that may appear during the masking operation leading to the first masked data value;
CD(i) represents the carry digit of rank i that may appear during the masking operation leading to the second masked data value;
D_M represents the first masked data value;
MD represents a mask associated with the first masked data value;
E_M represents the second masked data value; and
ME represents a mask associated with the second masked data value, the carry digit CD(i+1) is given by the following formulas:
the carry digit CE(i+1) is given by the following formulas:
the carry digit correction CEF(i) is given by the following formula:
the third mask associated with the third binary data value is equal to the mask associated with the second masked data value.
The method according to claim 5, wherein the third masked binary data value F_M is given by the following formula:
F_M[n−1;0]={E_M[n−1;k+p]*2(k+p)+(D_M[m+p−1;m]+ME[k+p−1;k]−MD[m+p−1;m]+CE(k)−CD(k))*2k+E_M[k−1;0]}mod2n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value X_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
k is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CD(i) represents the carry digit of rank i that may appear during the masking operation leading to the first masked data value;
CD(i) represents the carry digit of rank i that may appear during the masking operation leading to the second masked data value;
D_M represents the first masked data value;
MD represents a mask associated with the first masked data value;
E_M represents the second masked data value; and
ME represents a mask associated with the second masked data value, the carry digit CD(i+1) is given by the following formulas:
the carry digit CE(i+1) is given by the following formulas:
the third mask MF associated with the third binary data value is given by the following formula:
MF[n−1;0]=ME[n−1;0]−CEF(k+p)*2k+p
wherein CEF(i) represents a carry digit correction with rank i given by the following formula:
According to one embodiment, the third masked binary data value I_M is given by the following formula:
I_M[n−1;0]={(H_M[n−1;k+p]−CH(k+p))*2(k+p)+(G_M[m+p−1;m]−CG(m) +CG(m+p)*2p)*2k+(H_M[k−1;0]+CH(k)*2k)}mod2n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value X_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
k is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CG(i) represents the carry digit of rank i that may appear during the masking operation leading to the first masked data value;
CH(i) represents the carry digit of rank i that may appear during the masking operation leading to the second masked data value;
G_M represents the first masked data value;
G_M represents the second masked data value; and the carry digit CG(i+1) is given by the following formulas:
the carry digit CH(i+1) is given by the following formulas:
the third mask MI associated with the third masked binary data value is given by the following formula:
MI[n−1;0]=MH[n−1;k+p]*2p+k+MG[m+p−1;m]*2k+MH[k−1;0]
wherein:
wherein MG represents the mask associated with the first masked binary data value; and
wherein MH represents the mask associated with the second masked binary data value.
According to one embodiment, the third masked binary data value I_M is given by the following formula:
I_M[n−1;0]={H_M[n−1;k+p]*2(k+p)+(G_M[m+p−1;m]+CG(m+p)*2p)*2k+(H_M[k−1;0]+CH(k)*2k)}mod2n
wherein:
“+” represents the addition operation;
“mod” represents the modulo operation;
n represents the number of bits of the third masked binary data value X_M, n being a natural integer;
p is a natural integer of between o and n−1;
m is a natural integer of between o and n−p;
k is a natural integer of between o and n−p;
P[i;j] represents all of the bits of a binary data value P ranging from a rank i to a rank j; i and j being natural integers;
CG(i) represents the carry digit of rank i that may appear during the masking operation leading to the first masked data value;
CH(i) represents the carry digit of rank i that may appear during the masking operation leading to the second masked data value;
G_M represents the first masked data value;
G_M represents the second masked data value; and the carry digit CG(i+1) is given by the following formulas:
the carry digit CH(i+1) is given by the following formulas:
the third mask MI associated with the third masked binary data value is given by the following formula:
MI[n−1;0]=(MH[n−1;k+p]+CH(k+p))*2p+k+(MG[m+p−1;m]+CG(m))*2k+)MH[k−1;0]
wherein:
wherein MG represents the mask associated with the first masked binary data value; and
wherein MH represents the mask associated with the second masked binary data value.
Another embodiment provides a device configured to perform calculations on binary data values masked by a masking operation previously disclosed, the device being configured to carry out the method previously disclosed.
Electronic device comprising a device as previously disclosed.
The foregoing features and advantages, as well as others, will be described in detail in the following description of specific embodiments given by way of illustration and not limitation with reference to the accompanying drawings, in which:
Like features have been designated by like references in the various figures. In particular, the structural and/or functional features that are common among the various embodiments may have the same references and may dispose identical structural, dimensional and material properties.
For the sake of clarity, only the operations and elements that are useful for an understanding of the embodiments described herein have been illustrated and described in detail.
Unless indicated otherwise, when reference is made to two elements connected together, this signifies a direct connection without any intermediate elements other than conductors, and when reference is made to two elements coupled together, this signifies that these two elements can be connected or they can be coupled via one or more other elements.
In the following disclosure, unless indicated otherwise, when reference is made to absolute positional qualifiers, such as the terms “front”, “back”, “top”, “bottom”, “left”, “right”, etc., or to relative positional qualifiers, such as the terms “above”, “below”, “higher”, “lower”, etc., or to qualifiers of orientation, such as “horizontal”, “vertical”, etc., reference is made to the orientation shown in the figures.
Unless specified otherwise, the expressions “around”, “approximately”, “substantially” and “in the order of” signify within 10%, and preferably within 5%.
In the remainder of the disclosure, consideration is given to the data values, masked data values and masks, which are all binary words, for example with n bits, n being a natural integer. The following notation will be used:
P[m;k] designates the set of bits going from rank k to rank m of a binary word P, m and k being natural integers less than or equal to n, m being strictly greater than k; and
P[m] designates the bit with rank m of the binary word P.
The processor 10 is configured, inter alia, to process data values, and particularly masked data values. The processor receives masked data values Data_In, and their masks Mask_In, as input, and supplies masked data values Data_Out, and their masks Mask_Out, as output.
The input data values Data_In, respectively the output data values Data_Out, are masked with the masks Mask_In, respectively Mask_Out, by implementing masking of the arithmetic type. Masking of the arithmetic type is masking that only comprises arithmetic operations as opposed to logic operations. Arithmetic masking is, in the case described here, additive masking in which the mask is added to the data value to be masked. As an example, the mask and the data value to be masked are binary words of equal size. According to a variant, the mask and the data value to be masked are binary words of different sizes. More specifically, a masked data value A_M is given by the following formula:
A_M=(A+MA) mod2n
wherein:
A represents the data value to be masked;
MA represents the mask;
“+” represents the addition operation;
“mod” represents the modulo operation; and
n is the number of bits that make up the data value to be masked A, the mask MA and the masked data value A_M.
The processor 10 is configured to process the masked data values Data_In, and their masks Mask_In, by applying different operations to them, for example, addition, subtraction, complementary to 1 operations, or data values processing operations by extracting data values parts and inserting these parts into other data values. Embodiments of extraction and insertion operations carried out by the processor 10 are disclosed in relation with
The embodiment disclosed in relation with
In order to illustrate the operation of this embodiment, two masked data values B_M and Z_M are considered, as well as their masks MB and MZ. The masked data value B_M is the result of an additive masking operation, disclosed in relation with
During an extraction and insertion operation, part of a data value, in the case illustrated here a part B1_M of the masked data value B_M, is extracted, then inserted into a second data value, in the case disclosed here the data value Z_M. Since the data value B_M is a masked data value with mask MB, a part MBi of the mask MB is further extracted, then inserted into the mask MZ. The part MB1 has the same place in the mask MB as the part B1_M in the masked data value B_M.
More specifically, the part B1_M extracted from the masked data value B_M is a binary word with p bits, p being a natural integer less than or equal to n, corresponding to the bits of the masked data value B_M going from a rank m to a rank m+p−1, m being a natural integer of between o and n−p. Likewise, the part MBi extracted from the mask MB is a binary word with p bits, corresponding to the bits of the mask MB going from rank m to rank m+p−1.
According to one embodiment, the part B1_M is inserted into the data value Z_M, and p+1 bits of the data value Z_M are modified. As an example, the p+1 bits of low weight of the data value Z_M are modified, but as a variant, the p+1 modified bits can be in any place in the data value Z_M. When the p+1 modified bits are bits of low weight, the data value Z_M is given by the following formula:
Z_M[n−1;0]=(Z_M[n−1;p+1]*2p+1+CB(p+m)*2p+B_M[p+m−1;m])mod2n
wherein CB(i) represents the carry digit with rank i, i being an integer of between 1 and n, which can appear during the additive masking operation of the data value B, disclosed in relation with
The carry digit CB(i+1) is given by the following formulas:
The part MB1 is inserted into the mask MZ, and p+1 bits of the mask MZ are modified. As an example, the p+1 bits of low weight of the mask MZ are modified, but as a variant, the p+1 modified bits can be in any place in the mask MZ. The p+1 modified bits of the mask MZ are positioned in the same place as the p+1 modified bits of the data value Z_M. When the p+1 modified bits are bits of low weight, the mask MZ is given by the following formula:
MZ[n−1;0]=(MZ[n−1; p+1]*2(p+1)CB(m)+MB[p+m−1;m])mod2n
The extraction and insertion operation the to be “with compensation by the mask”, since the carry digit CB(m) is added to the mask MZ, the carry digit is the to be compensated by the mask. A variant in which the carry digit is compensated differently is disclosed in relation with
The masked data value Z_M and the mask MZ make it possible to find the nil data value again:
Z[n−1;0]=(Z_M[n−1;0]MZ[n−1;0])mod2n
The data value Z is then given by the following simplified formula:
Z[n−1;0]=B[m+p−1;m]
One advantage of this embodiment is that the extraction and insertion operation disclosed in relation with
Another advantage of this embodiment is that it makes it possible to add diversity among the masks used to mask data values.
The operation disclosed in relation with
In order to illustrate the operation of this embodiment, the masked data value B_M and its mask MB are considered, as well as a masked data value X_M and its mask MX. The masked data value X_M is the result of an additive masking operation, disclosed in relation with
It is considered here that the part B1_M of the masked data value B_M is extracted, then inserted into the neutral data value X_M. The part MBi of the mask MB is further extracted, then inserted into the mask MX.
Like in
The extraction and insertion operation disclosed here is the to be “with compensation on the masked data value”, thus the carry digit CB(m) with rank m that may appear during the additive masking operation with the mask MB leading to the data value B_M is compensated on the masked data value X_M, and not on the mask MX.
In this case, the masked data value X_M is given by the following formula:
X_M[n−1;0]=(X_M[n−1;p]*2p+1+CB(p+m)*2p+B_M[p+m−1;m]−CB(m))mod2n
The mask MX is given by the following formula:
MX[n−1;0]=(MX[n−1;p+1]*2(p+1)+MB[p+m−1;m])mod2n
Like in
X[n−1;0]=X_M[n−1;0]MX[n−1;0]
The data value X is then given by the following formula:
X[n−1;0]=B[m+p−1;m]
One advantage of this embodiment is that the extraction and insertion operation disclosed in relation with
Another advantage of this embodiment is that it can be used with masked data values whose masks are not modifiable data values.
The embodiment disclosed in relation with
To illustrate the operation of this embodiment, three masked data values D_M, E_M and F_M are considered. The masked data value D_M, respectively E_M, F_M, is the result of an additive masking operation, disclosed in relation with
In the extraction and insertion operation disclosed in relation with
More specifically, the part D1_M extracted from the masked data value D_M is a binary word with p bits, p being a natural integer less than or equal to n, corresponding to the bits of the masked data value D_M going from a rank m to a rank m+p−1, m being a natural integer of between o and n-p.
According to one embodiment, the part D1_M is inserted into the masked data value E_M, in order to form the masked data value F_M, and more specifically, p bits of the masked data value E_M going from rank k to rank k+p−1 are modified in order to form the masked data value F_M, k being a natural integer from o to n-p. As disclosed in relation with
The extraction and insertion operation disclosed here is intended to generate the masked data value F_M such that the data value F, obtained by unmasking the masked data value F_M with the mask MF, is equal to the data value E in which one has inserted, between ranks k and k+p−1, p bits of the data value D going from a rank m to a rank m+p−1.
In the case where the extraction and insertion operation is with “compensation on the masked data value”, the masked data value F_M is then given by the following formula:
F_M[n−1;0]={(E_M[n−1;k+p]+CEF(k+p))*2(k+p)+(D_M[m+p−1;m]+ME[k+p−1;k]−MD[m+p−1;m]+CE(k)−CD(k))*2k+E_M[k−1;0]}mod2n
wherein:
CEF(i) represents a carry digit correction with rank i, i being an integer between 1 and n, defined hereinafter;
CD(i) represents a carry digit of rank i that may appear during the additive masking operation, with the mask ME, leading to the masked data value E_M; and
CD(i) represents a carry digit of rank i that may appear during the additive masking operation, with the mask MD, leading to the masked data value D_M.
The carry digit CE(i+1) is given by the following formulas:
The carry digit CD(i+1) is given by the following formulas:
The carry digit correction CEF(i+1) depends on the carry digit CE(i+1) and a carry digit CF(i+1), and is given by the following formulas:
The mask MF associated with the masked data value F_M is, in the case of an operation with “compensation on the masked data value”, strictly equal to the mask ME associated with the data value E_M.
In the case where the extraction and insertion operation is with “compensation on the mask”, the masked data value F_M is then given by the following formula:
F_M[n−1;0]={E_M[n−1;k+p]*2(k+p)+(D_M[m+p−1;m]+ME[k+p−1;k]−MD[m+p−1;m]+CE(k)−CD(k))*2k+E_M[k−1;0]}mod2n
The mask MF is given by the following formula:
MF[n−1;0]=ME[n−1;0]−CEF(k+p)*2k+p
Whether in the case of an extraction and insertion operation with “compensation by the mask” or “with compensation by the masked data value”, the formulas defined above make it possible to find the data value F again from the masked data value F_M and the mask MF by applying an unmasking operation defined by the following formula:
F[n−1;0]=(F_M[n−1;0]MF[n−1;0])mod2n
One advantage of these embodiments is that the extraction and insertion operation does not require an unmasking operation for the masked data values D_M, E_M and F_M. Thus the data values D, E and F are not accessible during this operation.
The operation disclosed in relation with
To illustrate the operation of this embodiment, data values G_M, H_M and I_M are considered, as well as their masks MG, MH and MI. The masked data value G_M, respectively H_M, I_M, is the result of an arithmetic masking operation, disclosed in relation with
In the extraction and insertion operation disclosed in relation with
More specifically, the part G1_M, respectively the part MG1, is a binary word with p bits, corresponding to the bits of the masked data value G_M, respectively of the mask MG, going from a rank m to a rank m+p−1.
According to one embodiment, the part G1_M, respectively the part MG1, is inserted into the masked data value H_M, respectively the mask MH, to form the masked data value I_M, respectively the mask MI, and more specifically, p bits of the masked data value H_M, respectively of the mask MH, going from the rank k to the rank k+p−1 are modified to form the masked data value I_M, respectively the mask MI. As disclosed in relation with
The extraction and insertion operation disclosed here is intended to generate the masked data value I_M such that the data value I, obtained by unmasking the masked data value I_M with the mask MI, is equal to the data value H in which one has inserted, between ranks k and k+p−1, p bits of the data value G going from a rank m to a rank m+p−1.
In the case where the extraction and insertion operation is with “compensation on the masked data value”, the masked data value I_M is given by the following formula:
I_M[n−1;0]={(H_M[n−1k+p]−CH(k+p))*2(k+p)+(G_M[m+p−1;m]−CG(m)+CG(m+p)*2p)*2k+(H_M[k−1;0]+CH(k)*2k)}mod2n
wherein:
CH(i) represents a carry digit of rank i that may appear during the additive masking operation, with the mask MH, leading to the masked data value H_M; and
CG(i) represents a carry digit of rank i that may appear during the additive masking operation, with the mask MG, leading to the masked data value G_M.
The carry digit CH(i+1) is given by the following formulas:
The carry digit CG(i+1) is given by the following formulas:
The mask MI associated with the data value I_M is, in the case of an extraction and insertion operation with “compensation on the masked data value”, given by the following formula:
MI[n−1;0]=MH[n−1;k+p]*2k+p+MG[m+p−1;m]*2k+MH[k−1;0]
In the case where the extraction and insertion operation is with “compensation on the mask”, the masked data value I_M is given by the following formula:
I_M[n−1;0]={H_M[n−1;k+p]*2(k+p)+(G_M[m+p−1;m]+CG(m+p)*2p)*2k+(H_M[k−1;0]+CH(k)*2k)}mod2n
The mask MI, in this case, is given by the following formula:
MI[n−1;0]=(MH[n−1;k+p]+CH(k+p))*2k+p30 (MG[m+p−1;m]+CG(m))*2k+MH[p−1;0]mod2n
Whether in the case of an extraction and insertion operation with “compensation by the mask” or “with compensation by the masked data value”, the formulas defined above make it possible to find the data value I again from the masked data value I_M and the masked [sic] MI by applying an unmasking operation defined by the following formula:
I[n−1;0]=(I_M[n−1;0]MI[n−1;0])mod2n
One advantage of these embodiments is that the extraction and insertion operation does not require an unmasking operation for the masked data values G_M, H_M and I_M. Thus the data values G, H and I are not accessible during this operation.
Various embodiments and variants have been described. Those skilled in the art will understand that certain features of these embodiments can be combined and other variants will readily occur to those skilled in the art.
Finally, the practical implementation of the embodiments and variants described herein is within the capabilities of those skilled in the art based on the functional description provided hereinabove.
Number | Date | Country | Kind |
---|---|---|---|
1911349 | Oct 2019 | FR | national |