METHOD FOR SELECTING ONE VALUE FROM TWO VALUES RECORDED IN TWO DIFFERENT RECORDS
The method addresses side-channel vulnerabilities by concatenating and rotating values in two registers to maintain consistent execution and energy consumption, enhancing security against attacks.
Patent Information
- Application Number
- FR2023001610
- Authority / Receiving Office
- FR · FR
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing methods for selecting a value from two different registers in a computer system are vulnerable to side-channel attacks, as they cause variations in energy consumption, execution time, or electromagnetic fields that can be observed by attackers, potentially revealing the selection bit's value, especially in cryptographic processes.
A method involving concatenation, rotation, and deletion of values stored in two registers to create a concatenated word, where the selected value is positioned in a specific portion, and the unselected value is deleted, using a two-step rotation to obscure the selection bit's influence on execution time and energy consumption.
The method ensures a consistent execution time and energy consumption regardless of the selection bit's value, making it robust against side-channel attacks and complex for attackers to determine the selection bit.
Smart Images

Figure 00000000_0000
Abstract
Description
Description Title of the invention: METHOD FOR SELECTING ONE VALUE FROM TWO VALUES RECORDED IN TWO DIFFERENT REGISTERS
[0001] — Embedding and implementation methods relate to computer systems, in particular a method for selecting a value from among two values recorded in two different registers of the computer system from a selection bit.
[0002] Some applications of a computer system require selecting a value between two values recorded in two different registers of this in- system Informatics. This value selection can be performed using a selection bit that The user wishes to keep it secret.
[0003] In particular, the selection of a value from among two values stored in two Different registers can be implemented within the framework of cryptographic processes. By for example, algorithms that calculate modular exponentiation in a finite field or scalar multiplication on an elliptic curve can implement such a selection. These algorithms are used in the "RSA" cryptosystems and “ElGamal”, the “DSA” algorithms (acronym for “Digital Signature”) Algorithm") and "ECDSA" (acronym for "Elliptic curve digital signature"). algorithm") and the "ECDH" protocol (acronym for "Elliptic-curve Diffie- Hellman"). The selection bit is, for example, a bit of a cryptographic key that The user wishes to keep it secret.
[0004] Furthermore, the manipulation of data in a computer system can lead to a change in the energy consumption of the processing unit performing this data manipulation.
[0005] — Data manipulation can also lead to a change in time execution based on the data being handled. In particular, a computer system can use a cache. This cache can temporarily store data. Access to cached data is faster than access to data stored in memory for which the cache memory serves of intermediary.
[0006] — Data manipulation can also lead to a change in the electro- field magnetic of the processing unit handling the data.
[0007] — These changes are examples of physical observations usable by a attacker seeking to retrieve information from the computer system. These ob- reservations are referred to by the expression "side channel attack" (in English "Side-channel attack") In particular, an attacker might try to determine the value of the selection bit used to choose between two values stored in different registers. However, selecting a value from two values stored in two different registers is performed by executing computer instructions that can, for example, cause changes in energy consumption and / or execution time, or electromagnetic fields. These changes can be observed by an attacker. Observing these changes can allow the attacker to determine the value of the selection bit. Thus, for example, using the cryptographic methods mentioned earlier, an attacker can observe the changes to determine each bit of the cryptographic key. This allows the attacker to retrieve the cryptographic key, which they can then use maliciously. We know of several solutions that allow us to select between two values stored in different registers. One known solution is to implement an if-then-else function in which the evaluated condition is the value of the selection bit. The implementation of the if-then-else function uses instruction sequences that differ depending on the value of the selection bit. These instruction sequences can result in different execution times, different energy consumption, or even different magnetic fields. Therefore, an attacker can determine the value of the selection bit based on their observations. A second solution involves storing these two values in an array, then accessing the selected value from the array based on the value of the selection bit. This solution may involve using a cache during memory accesses performed according to the value of the selection bit. Using a cache can modify memory access times depending on the value of the selection bit. On an architecture supporting a cache, it is therefore possible for an attacker to recover the value of the selection bit based on observed memory access times. A third solution involves using a mask on the values to be selected, the mask used depending on the selection bit. For example, on a 32-bit architecture, the mask could be OXFFFFFFFFF or 0x00000000 depending on the value of the selection bit. However, these masks have very different Hamming weights (number of 1 bits). Thus, the energy consumption for using these masks can vary significantly depending on the mask selected. If the difference in energy consumption due to the use of the masks is sufficient to be noticeable, an attacker can recover the value of the selection bit. A fourth solution is described in the US patent application published under the Issue number 2021 / 306134. This solution uses masks with the same Hamming weight on a 32-bit architecture. Specifically, the masks correspond to an alternation of 1 bits and 0 bits. In particular, the masks have the values 0xAAAAAAAA or 0x55555555 depending on the value of the selection bit. The mask value is obtained by shifting the value 0xAAAAAAAA one bit to the right, depending on the value of the selection bit. If the shift occurs, all 32 bits of the register change value simultaneously. Otherwise, no bit changes value. Such a difference can also lead to a significant variation in power consumption depending on the hardware. If the difference in power consumption due to the use of the masks is sufficient to be noticeable, an attacker can recover the value of the selection bit. There is therefore a need to propose a solution that allows selecting a value from two values stored in two different registers in a simple and discreet way, in particular to be robust against side-channel attacks. According to one aspect, a computer-implemented method is proposed – specifically, a computer system such as the one described below, for example a system-on-a-chip – for selecting one value from two values stored in two different registers using a selection bit, the method comprising: - a concatenation of the two values recorded in the two registers so as to obtain a concatenated word presenting said two values in two distinct parts of the concatenated word, then - a rotation of said concatenated word according to the value of the selection bit so as to position the selected value in a given portion of the concatenated word among said two portions, then - a removal of the unselected value in the concatenated word so as to retain only the selected value in the concatenated word by eliminating the unselected value from the concatenated word. Such a selection method has the advantage of being implemented by a sequence of instructions independent of the value of the selection bit and does not contain memory accesses dependent on the selection bit. In particular, such a selection method has the advantage of being robust against side-channel attacks. Preferably, said removal of the unselected value in the concatenated word includes shifting the concatenated word so as to retain only the selected value in the concatenated word by removing the unselected value from the concatenated word. Advantageously, concatenation allows you to concatenate two 16-bit values of in order to obtain a concatenated 32-bit word in which the two values are contained within two 16-bit portions of the concatenated word. In an advantageous implementation mode, said rotation of said concatenated word comprises: - a first rotation of the concatenated word according to a predetermined number M of bits, M being different from 0 and a multiple of 16, then - a second rotation of the concatenated word according to a number of bits depending on the selection bits in order to obtain the selected value on said given portion. Performing a two-step rotation avoids performing a 0-bit rotation when the selection bit is 0. Such a rotation, not changing the value contained in the register, could indeed be observed by an attacker. Advantageously, the number of shift bits for the second rotation is determined by performing: - a logical function WHERE the value of the selection bit is between the value of the selection bit and a value equal to 0xN0000000 where N is between 1 and F in hexadecimal and is defined with respect to the predetermined number M of bits for the first rotation, then - a 28-bit rotation on the value obtained by the logical WHERE function so as to obtain a value of the number of shift bits for the second rotation. According to another aspect, a computer program product is proposed comprising instructions which, when the program is executed by a computer, lead the computer to implement a selection process as described above. From another perspective, a computer system is proposed comprising: - a memory in which a computer program product, as described above, is stored, and - a processing unit configured to run said computer program product. In particular, the processing unit features an architecture that supports register content rotation. Other advantages and features of the invention will become apparent upon examination of the detailed description of embodiments, which are by no means limiting, and the accompanying drawings in which: [Fig.1] [Fig.2] illustrate embodiments and implementations of the invention. Figure 1 illustrates a method of implementing a process, implemented by a computer (in particular by a computer system as described below), of selecting a value from among two values recorded in two different registers of the computer from a selection bit. The selection bit is stored in a computer register. This selection bit is a secret selection bit. Each of these values can be represented using 16 bits. Alternatively, each of these values can be represented using 32 bits. When each value is represented on 32 bits, the steps of the selection process described below are carried out first on the 16 most significant bits of each value and then a second time on the 16 least significant bits of each value, or vice versa. In other words, the steps of the process are performed once to select the 16 most significant bits of a value from among the two values depending on the selection bit, and then a second time to select the 16 least significant bits of that same value, or vice versa. The selected most significant and least significant bits are then concatenated to obtain the selected value. The process includes a concatenation step (step 20) in which the two values stored in the two different registers are concatenated. The concatenation of the two values results in a concatenated word. This concatenated word has a first portion containing the first value and a second portion containing the second value. Both portions have the same number of bits. For example, each portion has 16 bits, so the concatenated word has 32 bits. The process then includes a rotation step 21 in which a rotation operation is performed on the bits of the concatenated word. The rotation operation is performed according to the value of the selection bit. For example, the concatenated word is rotated so that the bits of the value selected by the selection bit are placed on the most significant bits of the concatenated word. In particular, when the concatenated word comprises two 16-bit segments, the rotation performed is either a 16-bit or a 32-bit rotation, depending on the value of the selection bit. The operation 21 of rotating the concatenated word can be performed in two steps. In particular, the process can include a first rotation 21a of the concatenated word by a predetermined number M of bits. The number M can be between 1 and 15, for example. Next, the process may include a second rotation 21b of the concatenated word by a number of bits dependent on the selection bits so as to obtain the selected value on the most significant bit portion of the concatenated word. For example, the number of shift bits for the second rotation is determined by first performing an OR logic function between the value of the selection bit and a value equal to OxN0000000, where N is between 1 and F in hexadecimal and is defined relative to the predetermined number M of bits for the first rotation. The OR logic function then yields a value equal to OxXxN0000000 when the selection bit is 0, and OXNO000001 when the selection bit is 1. A 28-bit rightward rotation is then performed to obtain a value equal to 0x0000000N when the selection bit is 0 and 0x0000001N. This calculated value defines the number of offset bits for the second rotation. The first rotation and the second rotation allow the concatenated word to be rotated by a number of bits equal to M+Ny, if the selection bit is 0 or to M+(1N),5. The values of M and N are chosen so that the sum M+N, is equal to 16 (in decimal system) and so that the sum M+(1N)y5 is equal to 32 (in decimal system). Performing a 21-bit rotation in two steps (a first rotation of 21a followed by a second rotation of 21b) prevents the rotation from being directly 0 bits (when the rotation is 32 bits) or 16 bits. The first rotation thus allows for a modification of the concatenated word regardless of the value of the selection bit. In this way, determining the selection bit from an observation of the rotation becomes more complex. Once the rotation operation 21 has been performed on the concatenated word, the value selected by the selection bit is located in a given portion of the concatenated word, for example, the 16 most significant bits of the concatenated word, that is, in the first portion of the concatenated word. The value not selected by the selection bit is then located in the 16 least significant bits of the concatenated word, that is, in the second portion of the concatenated word. The process then includes a deletion step 22 in which the unselected value is removed from the concatenated word. In particular, the deletion step 22 may, for example, include a shift operation on the concatenated word so as to retain only the value selected by the selection bit. For example, a 16-bit right shift is performed so as to place the selected value in the 16 least significant bits of the concatenated word, that is, in the second portion of the concatenated word. Thus, the unselected value is eliminated from the concatenated word, leaving only the selected value. Alternatively, a mask can be applied to the concatenated word to remove the unselected value and keep only the selected value. Such a selection method has the advantage, at least for some architectures, of being able to be executed in the same execution time regardless of the value of the selection bit. Indeed, the selection method comprises the same sequence of instructions to be executed regardless of the value of the selection bit. Such a selection method has the advantage of being robust against side-channel attacks. Tables [Table 1] to [Table 4] illustrate different examples of implementation of the the process described previously. These tables show the instructions executed by the computer. The instructions are represented here in assembly language for an ARM Cortex®-M3 processor. Tables [Table 1] and [Table 2] illustrate examples of implementing the same process when the selection is made between two 16-bit values based on the value of the select bit. Tables [Table 3] and [Table 4] illustrate examples of implementing another process in which the selection is made between two 32-bit values based on the value of the select bit. Table [Table 1] illustrates an example of implementing the process when the two values v0 and v1 initially stored in registers r0 and rl are 16 bits, and when the value of the Sel_bit selection bit initially stored in register r2 is equal to 0 so as to select the value v0 stored in register r0. [Tables 1] Instruction No. 1#0 1#1 |EOR r0,r0,r11,LSL vivo æ | ROR r0,r0, #1 (v11| v0O) >>> 1 (#3 TORR 0xF0000000 u4 #5 Lors pr Bt RO No. instruction | instruction 1" Register r0 Register 1 Register r2 jt l EORTO.10,11LSL live T #æ ROR r0.10, #1 1} vo)>>> 1 H #8 jORR 0xF0000000 Î |r2,12,=0xF0 Instruction #1 is an "EOR rû, r0, r1, LSL#16" instruction. This instruction concatenates the values v0 and v1 stored in registers r0 and r1 to obtain a concatenated word v1llvO and stores this concatenated word v1IIvO in register r0. Specifically, this instruction shifts the 16-bit value v1 left by 16 bits before performing an XOR operation between this shifted v1 value and the value vO to obtain the concatenated word v1lIvO. The concatenated word then consists of a first 16-bit most significant portion containing the value v1 and a second 16-bit least significant portion containing the value vO0. Instruction #2 is an "ROR rû, r0, #1" instruction. This instruction performs a 1-bit right rotation on the concatenated word v1IIvO, resulting in a concatenated word shifted 1 bit to the right (v1llv0)>>>1. This shifted concatenated word is stored in register r0. Instruction #3 is an "ORR 12, r2, =0xF0000000" instruction. This instruction performs a logical OR operation between the value of the selection bit Sel_bit stored in register r2 and the value OXFO000000 (represented here in hexadecimal), and stores the result of this operation in register r2. Since the value of the selection bit is 0, the result of the logical OR operation is... is equal to OxF0000000. Instruction #4 is an "ROR r2, r2, #28" instruction. This instruction performs a 28-bit right rotation on the result of the logical OR operation stored in register r2, and saves the result of this rotation operation to register r2. Here, the result of the rotation operation is 0x0000000F in hexadecimal, which is 15 in decimal. Instruction #5 is an "ROR rD, r0, r2" instruction. This instruction performs a right rotation operation of a number of bits corresponding to the value stored in register r2 (here Ox0000000F, i.e. a 15-bit right rotation) on the shifted concatenated word (v1llv0)>>>1 stored in register r0, and allows the result of this rotation operation to be recorded in register r0.Here, the result of this 15-bit rotation operation corresponds to the concatenated word vOllv1, which has a first 16-bit portion of most significant bit containing the value v0 and a second 16-bit portion of least significant bit containing the value v1. Thus, this result corresponds to a 16-bit rotation of the concatenated word v1IIv0. Instruction #6 corresponds to an "LSR rD, r0, #16" instruction. This instruction performs a 16-bit right shift operation on the concatenated word vOllv1 resulting from the rotation operation and stores the result of this shift operation in register r0. This shift operation eliminates the unselected value v1 and keeps only the selected value v0. Table 2 illustrates an example of implementation of the process when the two values v0 and v1 initially stored in registers r0 and r1 are 16 bits, and when the value of the selection bit Sel_bit initially stored in register r2 is equal to 1 so as to select the value vl. [Tables 2] No. Instruction instruction | Registrerû Registrert | Register 2 i#t lEOR ,r0,1,LSL v1{v0 Ï #2 ROR r0.r0,#1 | (v11|v0)>>> 1 5 ORR OxF0000C01 #4 ROR 2.12 #28 + 0x0000001F = 3 1#5 1#6 LSR r0r0,#16 | vi same ms SEE yen ÎN° Instruction Instruction 1" Register rÙ Registerri 1 Register 2 jt | FOR rD,10,1,LSL v1i|v0 Ï Ï æ TROR 10.r0, #1 WU vO)>>=1 er ee me PET ma lORR OxF0000001 M. RONA ESS I Lo rhyme OOONOIE 3 | #5. PORTO 0 I VA iron iw6 ILSR 010,416 vi Î i The instructions are identical to those described in relation to Table 1. However, the results of the operations performed by executing these instructions differ from those in Table 1 because the value of the selection bit is equal to l and no longer 0. In particular, the result of the logical WHERE operation of instruction #3 is equal to OxF0000001, and no longer OxXF0000000. Thus, the result of the rotation operation of instruction #4 is equal to 0x0000001F, that is 31 in decimal system. The rotation operation performed by instruction #5 is therefore a 31-bit rotation, not a 15-bit one. Thus, the result of this rotation operation corresponds to the concatenated word v1lIvO. This concatenated word v1llvO has a first 16-bit portion of the most significant bit containing the value v1 and a second 16-bit portion of the least significant bit containing the value vO. This result corresponds to a 32-bit rotation of the concatenated word v1llvO obtained after the execution of instruction #2. Therefore, the result of the shift operation in instruction #6 is equal to the selected value v1. The instructions executed are the same regardless of the value of the selection bit. Therefore, the execution time of the process is the same regardless of the value of the selection bit on an architecture where the execution time of the instructions used is constant. This makes it more difficult for an attacker to identify the value of the selection bit. Furthermore, the value of register r2 differs by only one bit depending on the values of the selection bit. This makes it difficult for an attacker to identify a change in register r2 based on the selection bit. Therefore, determining the value of the selection bit by observing register r2 is also complex. Furthermore, as mentioned earlier, rotating the concatenated word in two steps (a first rotation of 1 bit followed by a second rotation of 15 or 31 bits) prevents the rotation from being directly 0 or 16. In particular, a rotation of 0 could be detected by an attacker. Rotating the concatenated word in two steps makes it more difficult to identify the value of the selection bit. Furthermore, the method maintains a constant Hamming weight in register r0 until instruction #6. In other words, the method ensures that the same number of bits remain set to 1 in the register values. Consequently, identifying the value of the selection bit becomes more difficult for an attacker. Tables [Table 3] and [Table 4] illustrate examples of implementing a selection process between two 32-bit values based on the value of the selection bit. Table 3 illustrates an example of implementing the method when the two values v0 and v1 initially stored in registers r0 and rl are represented using 32 bits, and when the value of the selection bit Sel_bit initially stored in register r2 is equal to 0 so as to select the value v0 stored in register r0. The value v0 comprises 16 most significant bits vOH and 16 least significant bits vOX. The value v1 comprises 16 most significant bits (v1#) and 16 least significant bits (v1-). [Tables 3] Instruction No. 1#0 | Initial support 1 MO = vOH ii vob 1 = |jvtt 1 Sel bh=0 #1 {UXTH 3.0 + + | PE #2 EORrar3t.LSL È 2:06 p.m. Érmmemmenmennn nan tanmnennnnnnt anna mnmnmenmenmentrmnmnnane (#3 TRORr@135t y Ï | (vi |} vO) >>> #4 TUXTH 0 M ROR wat 1#6 | EORr'rOSTLSR ; vor || hiv #7 #8 #0 #41 1#12 ELSLr,11, #16 4 vor #13 | EOR OM, 3 LSR MO = vOF 1 V0 PSE bel Minstracion —[inatructon | Regirerd _ soul agi ee | '#0 the inival star NO SV A = VRIME UE SeLbh=0 FT [uxhre; ; | ES #2 EORra,rart LSL Hi vase | i#s | RORrG13#1 Ï Ë (vt5]p vo >>> 4 144 |UXTH MO M,ROR vo 145 LSLrO10#16 j 005110 { jne lEORFIOAISR 1 VIE T #7 ES d OA >> 1 | TR ee rt mie RE ana ixe | ROR r2,12,428 Î | 0x0000000F = 15 #10 trs rleti2 v1+ 11 OH i ET [ROR 2732 Ï $ Ï vob #3 EORTOM / BLSR 0-01 PL | Instruction #1 is an "UXTH r3, r0" instruction. This instruction sets the 16 most significant bits of the value v0 to zero and saves the result of this operation in register r3. The result of this operation recovers only the 16 least significant bits v0* of the value v0. Instruction #2 is an "EOR r3, r3, rl, LSL#16" instruction. This instruction concatenates the least significant bits v1! and v0" of the values v1 and v0 stored in registers rl and r0 to obtain a first concatenated word v14Iv0* and saves this concatenated word v14Iv0" in register r3. In particular, this instruction allows shifting the value v1 by 16 bits to the left before performing an XOR logical operation between this shifted value v1L and the value vO- to obtain the concatenated word v14IIvO4. The concatenated word v14IvO- then presents a first portion of 16 most significant bits containing the 16 least significant bits v1- of the value v1 and a second portion of 16 least significant bits containing the 16 least significant bits vO- of the value vO0. Instruction #3 is a "ROR r3, r3, #1" instruction. This instruction performs a 1-bit right rotation on the concatenated word v1HIvO+ to obtain a concatenated word shifted by 1 bit per right rotation (v15IvO4)>>>1. This shifted concatenated word is stored in register r3. Instruction #4 is an "UXTH r0, r0, ROR#16" instruction. This instruction performs a 16-bit right rotation of the vO value, swapping the vO# values of the most significant bits with the vO* values of the least significant bits, before setting the 16 most significant bits of the resulting rotation to zero and storing the result in register r0. The result of This operation allows us to recover only the 16 most significant bits v0H of the value vO. Instruction #5 is an LSL instruction r0,r0,#16. This instruction shifts the value v0# 16 bits to the left. The result of this operation is the concatenated word v0H110. Instruction #6 is an "EOR rl, r0, rl, LSR#16" instruction. This instruction concatenates the most significant bits v0H and v1H of the values v0 and v1 to obtain a second concatenated word v0#l|v1H, and stores this concatenated word vOHllv1H in the rl register. Specifically, this instruction isolates the 16 most significant bits of v1 by shifting v1 16 bits to the right before performing an XOR operation between the values v0#110 and v1# to obtain the concatenated word v0#l|v1#. The concatenated word v0HIlv1H then presents a first portion of 16 most significant bits containing the 16 most significant bits v0# of the value v0 and a second portion of 16 least significant bits containing the 16 most significant bits v1# of the value vl. Instruction #7 is a "ROR rl, rl, #1" instruction. This instruction performs a 1-bit right rotation on the concatenated word vO#l|v1# to obtain a concatenated word shifted 1 bit right by rotation (vO# |v1H)>>>1. This shifted concatenated word is stored in the rl register. Instruction #8 is an "ORR r2, r2, =0xF0000000" instruction. This instruction performs a logical OR operation between the value of the Sel_bit selection bit stored in register r2 and the value OxF0000000 (represented here in hexadecimal), and saves the result of this operation in register r2. Since the value of the selection bit is 0, the result of the logical OR operation is OxF0000000. Instruction #9 is a "ROR r2, r2, #28" instruction. This instruction performs a 28-bit right rotation on the result of the logical OR operation stored in register r2, and saves the result of this rotation operation to register r2. Here, the result of the rotation operation is equal to 0x0000000F in hexadecimal, which is 15 in decimal. Instruction #10 is a "ROR rl, rl, r2" instruction. This instruction performs a right rotation operation of a number of bits corresponding to the value stored in register r2 (here 0x0000000F, i.e., a 15-bit right rotation) on the shifted concatenated word (vO#Ilv1#)>>>1 stored in register rl, and saves the result of this rotation operation in register rl. Here, the result of this 15-bit rotation corresponds to the concatenated word v1#IIvO#, which has a first 16-bit most significant portion comprising the 16 most significant bits v1# of the value v1 and a second 16-bit least significant portion including the 16 most significant bits v0# of the value v0. Thus, this result corresponds to a 16-bit rotation of the concatenated word vO0H[Iv1H. Instruction #11 is an "ROR r3, r3, r2" instruction. This instruction performs a right rotation of a number of bits corresponding to the value stored in register r2 (here Ox0000000F, i.e., a 15-bit right rotation) on the shifted concatenated word (v1HlIv0")>>>1 stored in register r3, and saves the result of this rotation operation in register r3. Here, the result of this 15-bit rotation corresponds to the concatenated word vOMlv1-, which has a first 16-bit most significant portion comprising the 16 least significant bits vO* of the value v0 and a second 16-bit least significant portion comprising the 16 least significant bits v1} of the value v1. Thus, this result corresponds to a 16-bit rotation of the concatenated word v1}I|vOL. Instruction #12 corresponds to an "LSL rl, rl, #16" instruction. This instruction performs a 16-bit left shift operation on the concatenated word v1H[Iv0# resulting from the rotation operation, and stores the result of this shift operation in the rl register. This shift operation eliminates the unselected value v1H and retains only the selected value v0#. Instruction #13 corresponds to an "EOR r0, rl, r3, LSR #16" instruction. This instruction concatenates the 16 most significant bits v0* and the 16 least significant bits v0- of the value v0 to retrieve the selected value v0, and then stores this retrieved value v0 in register r0. Specifically, this instruction first shifts the concatenated word v0+ lIv1+ in register r3 16 bits to the right to obtain VO* before performing an XOR operation on the value v0# to obtain the concatenated word vOHIIvO- corresponding to the selected value v0. Table 4 illustrates an example of implementation of the process when the two values v0 and v1 initially stored in registers r0 and rl are represented on 32 bits, and when the value of the selection bit Sel_bit initially stored in register r2 is equal to 1 so as to select the value v1 stored in register rl. [Tableaux4] Set_bit=+ Instruction No. #0 Etat initial VO =V0H ut 1 V1 "uiHijyt* 1 If ht = 1 #1 UXTH 3,10 ï d ve Pa EOR 13, / 5,H,150 Ï Ter # ROR 13.13 #1 Ï Peas #4 UXTH O0, ROR vos 1w5 LSLrO,r0.#16 vu |o #6 EOR M r0,r1,LSR 5 iutr #7 CxF000C001 #9 ;#10 RORM.r.r2 à VOF INT #i RCR 13,0,2 MA} vo #2 TsLririmie ; en ; ; | Instruction No. Instruction Register Regulations | Register2 | Registrar3 #0 Initial state WEvoHiquet 1 ui =viMiivtt | SeLht=1 EEE T2 EOR TA,15,1,L80 Ï PU AÈNIVOE # ROR 13,13 #1 Ï l'encjves >ss 4 i m1 145 LELrO 10H16 T0 4 ; ; % EORFOMILER Feb i #16 i 4 #7 ROR M1 ROVER) >>> 41 Ï PRG TEE res + ROR 12.12#28! | 0x0000G01F =31 | #1 RCR13,13,12 MI} vOE j#12 LELriri#16 vf; | #13 EOR rO.r1.13,LSR 91 SH pt + È The instructions are identical to those described in relation to Table 3. However, the results of the operations performed by executing these instructions differ from those in Table 3 because the value of the selection bit is 1 instead of 0. In particular, the result of the logical WHERE operation in instruction #8 is equal to OxF0000001, not OxF0000000. Therefore, the result of the rotation operation in instruction #9 is equal to 0x0000001F, which is 31 in decimal. The rotation operations performed by instructions #10 and #11 are thus 31-bit rotations, not 15-bit rotations. More specifically, the result of the rotation operation in instruction #10 corresponds to the concatenated word v0#IIv1H. This concatenated word v0#IIv15 has a first portion of 16 most significant bits comprising the 16 most significant bits v0# of the value v0 and a second portion of 16 least significant bits comprising the 16 most significant bits v1# of the value v1. This result corresponds to a 32-bit rotation of the concatenated word v0HIlv15 obtained after the execution of instruction #6. The result of the rotation operation in instruction #11 is therefore the concatenated word v1HIIvOl. This concatenated word v1IIvOt has a first portion of 16 most significant bits comprising the 16 least significant bits v1t of the value v1 and a second portion of 16 least significant bits comprising the 16 least significant bits vO- of the value v0. This result corresponds to a 32-bit rotation of the concatenated word v1- IIVO- obtained after the execution of instruction #2. Therefore, the result of the shift operation in instruction #12 is equal to the 16 most significant bits v1H of the selected value v1, and the result of the operation EXCLUSIVE OR of instruction #13 gives as a result the concatenated word v1#[| v14 corresponding to the selected value v1. The selection methods described can be implemented within a cryptographic process. In particular, the described selection methods can be implemented in the RSA and ElGamal cryptosystems, the DSA (Digital Signature Algorithm) and ECDSA (Elliptic Curve Digital Signature Algorithm) algorithms, and the ECDH (Elliptic-Curve Diffie-Hellman) protocol. For example, the described selection methods can be implemented in a Montgomery ladder algorithm. More specifically, the selection bit can be a bit from a cryptographic key that the user wishes to keep secret. For example, such a selection can be implemented to calculate a modular exponentiation or a scalar multiplication based on a bit of the cryptographic key. Figure 2 illustrates one embodiment of a computer system SYS, such as a system-on-a-chip. The computer system SYS comprises a processing unit (PU) and a memory (MEM) in which a computer program (PRG) is stored. The processing unit (PU) has an architecture that supports register content rotation. The computer program PRG includes instructions which, when the program is executed by the processing unit UT, cause the latter to implement a selection process such as those described previously.
Claims
Claims
1. A computer-implemented method of selecting a value from two values stored in two different registers from one bit selection, the method comprising: - a concatenation (20) of the two values recorded in the two registers so as to obtain a concatenated word presenting the said two values in two distinct portions of the concatenated word, then - a rotation (21, 21a, 21b) of said concatenated word according to the value of the bit selection so as to position the selected value in a given portion of the concatenated word among said two portions, then - a deletion (22) of the unselected value in the word concatenated to keep only the selected value in the concatenated word by removing the unselected value from the word concatenated.
2. A method according to claim |, wherein said removal of the unselected value in concatenated word includes offset (22) of the concatenated word so as to retain only the se- value selected from the concatenated word by eliminating the unselected value of the concatenated word.
3. A method according to any one of claims 1 or 2, wherein concatenation allows you to concatenate two 16-bit values of way to obtain a concatenated 32-bit word in which the two values are comprised in two 16-bit portions of the concatenated word.
4. The method of claim 3, wherein said rotation of said word concatenated includes: - a first rotation (21a) of the concatenated word according to a number M of predetermined bits, M being different from 0 and a multiple of 16, then - a second rotation (21b) of the concatenated word according to a number of bits depending on the selection bit so as to obtain the selected value on the said given portion.
5. The method of claim 4, wherein the number of bits of offset for the second rotation is determined by performing: - a logical function WHERE between the value of the selection bit and a value equal to OxN0O000000 where N is between | and F in system hexadecimal and is defined relative to the predetermined number M of bits for the first rotation, then - a 28-bit rotation on the value obtained by the logic function OR to obtain a value of the number of shift bits for the second rotation.
6. Computer program product comprising instructions which, when the program is executed by a computer, drive it to implement a method according to one of claims 1 to 5.
7. Computer system comprising: - a memory in which a program product is stored computer according to claim 6, and - a processing unit configured to execute said product computer program.
Citation Information
Patent Citations
Method for performing cryptographic operations in a processing device, corresponding processing device and computer program product
US20210194689A1
Method for performing cryptographic operations on data in a processing device, corresponding processing device and computer program product
US20210306134A1
