Method for protecting against side-channel attacks lattice-based post quantum cryptographic schemes
By applying arithmetic and Boolean masking to split polynomial coefficients in lattice-based cryptographic schemes, the method effectively protects against side-channel attacks without costly conversions, enhancing security and efficiency.
Patent Information
- Application Number
- PCT/EP2025/073224
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-26
- Filing Date
- 2025-08-13
- Publication Date
- 2026-03-05
AI Technical Summary
Lattice-based post quantum cryptographic schemes, such as Kyber, are vulnerable to side-channel attacks due to the sensitivity of the Compress function in the decapsulation algorithm, which processes polynomial coefficients, making it susceptible to attacks through power consumption or electromagnetic analysis.
The method employs arithmetic and Boolean masking to split input polynomial coefficients into shares, generating output polynomial coefficients with Boolean masking without performing costly Arithmetic to Boolean conversions, using intermediate shares and additional masking to ensure proper Boolean masking, thus obscuring the relationship between input and output coefficients.
This approach significantly enhances resistance to side-channel attacks by obscuring the correlation between input and output polynomial coefficients, reducing resource requirements while maintaining effective protection against such attacks.
Smart Images

Figure EP2025073224_05032026_PF_FP_ABST
Abstract
Description
[0001] METHOD FOR PROTECTING AGAINST SIDE-CHANNEL ATTACKS LATTICE-BASED POST QUANTUM CRYPTOGRAPHIC SCHEMES
[0002] FIELD OF THE INVENTION
[0003] The present invention relates to the field of cryptographic schemes, and of associated cryptographic devices, and more particularly to protecting against side-channel attacks lattice-based post quantum cryptographic schemes.
[0004] BACKGROUND OF THE INVENTION
[0005] The increasing computational power of quantum computers is a growing threat to the security of classical cryptographic schemes such as RSA or ECDSA. Such schemes will eventually be completely defenseless against attacks performed using quantum computers. Therefore, work is being done to develop new efficient schemes that would be resistant against such attacks.
[0006] Lattice based schemes have been proved resistant to quantum computer attacks. Among this class of schemes, Dillithium and Kyber have been selected by the NIST to become Post-Quantum Cryptography standards for supporting respectively signature and encryption.
[0007] Nevertheless, such cryptographic algorithms may be sensitive to sidechannel attacks, based on an analysis of the power consumption or electromagnetic signature of the device performing the encryption.
[0008] Kyber cryptographic scheme full description can be found in « CRYSTALS- KYBER Algorithm Specifications And Supporting Documentation (version 3.02) » by R. Avanzi, J. Bos, L. Ducas, E. Kiltz, T. Lepoint, V. Lyubashevsky, J. M. Schanck, P. Schwabe, G. Seiler, D. Stehle, August 4, 2021 . In the rest of this document, this reference is referred to as “KYBER Documentation reference”. More specifically, CRYSTALS-Kyber cryptographic scheme comprises a Key Encapsulation Mechanism (KEM) enabling two entities to securely exchange a shared secret K, such as a shared key to be used as a session key. This KEM has been standardized by the NIST as the Module-Lattice-based KEM (ML-KEM) in the publication “FIPS203 - Module-Lattice-based Key-Encapsulation Mechanism Standard”. Such a KEM comprises a key encapsulation algorithm (algorithm 8 of KYBER Documentation reference; algorithm 16 of ML-KEM Documentation reference) enabling a first entity to generate from the public key pk of the second entity the shared secret K and a ciphertext c, and a decapsulation algorithm (algorithm 9 of KYBER Documentation reference; algorithm 17 of ML-KEM Documentation reference) enabling the second entity to retrieve the shared secret K from the ciphertext c using its private key sk. Such a decapsulation algorithm uses a Compress function (called Compressq in KYBER Documentation reference or called Compress in ML-KEM documentation reference) which is in charge of converting polynomial coefficients generated from the ciphertext c into bits of the shared secret K, using the secret key of the second entity. Therefore, the input and output of the Compress function is sensitive data which should be protected against any access by anyone other than the two entities cooperating in the Key Exchange Mechanism. Indeed, an attacker gaining knowledge of part of the processed data would gain knowledge of at least part of either the shared secret K or the secret key of the second entity and may eventually be able to retrieve the shared secret K.
[0009] A problem is that the Compress function manipulates the coefficients of its polynomial input one by one for generating corresponding bits of the shared secret K. Therefore, it would be fairly easy for an attacker to guess the value of the coefficients of the polynomial used as input to the function from a sidechannel analysis of the operations performed by the Compress function when it processes each coefficient of its input.
[0010] Therefore, there is a need of a method performing the key decapsulation algorithm of Kyber KEM or ML-KEM and being protected against side channel analysis when performing the step of generating the bits of the shared secret K which is performed by the Compress function in existing implementations of such a scheme.
[0011] SUMMARY OF THE INVENTION
[0012] For this purpose and according to a first aspect, this invention therefore relates to a method for securing against side channel attacks execution of a Compress function designed to be used in a decapsulation algorithm of a Kyber Lattice-based Post Quantum cryptographic key-encapsulation mechanism, said decapsulation algorithm generating, from a secret key sk of a key requesting device and a ciphertext c transmitted by a key generation device, a key (K) to be shared between said key requesting device and said key generation device, wherein said Compress function converts an input polynomial P(X) in a polynomial ring Rq= Fq[X] / (Xn+1 ) into an output polynomial B(X) in a polynomial ring R2 such that each coefficient bi of the output polynomial B(x) equals 1 if the corresponding coefficient Pi of the input polynomial P(X) is in ](q-1 ) / 4, 3(q-1 ) / 4[ and bi equals 0 otherwise, with i in {1 ,..,n}, n being an integer and q being a prime number, each coefficient Pi of said input polynomial P(x) being masked using an arithmetic splitting masking and represented by L arithmetic shares Ai1, Ai2, ... , AiLsuch that Ai1+ Ai2+ ... + AiL= Pi modulo q, with L an integer, and each coefficient bi of said output polynomial B(X) being masked with a Boolean splitting masking and represented by a plurality of Boolean shares, said method being performed by the key requesting device comprising a processor and a memory and comprising, instead of applying Compress function to said input polynomial P[X], for each coefficient Pi of said input polynomial P(X): - obtaining said L polynomial shares A1i, A2i , ... , ALi of said coefficient Pi,
[0013] - for each polynomial share i with j in {1 , ... , L}, computing an intermediate share vji equal to 0 when floor([2 i+ Zj.(q-1 ) / 2] / q ) is even and equal to 1 when it is odd, with Zi such that Z1+ Z2+ ... + ZL= 1 and Z.(q-1 ) / 2 is an integer, - computing an additional intermediate share vL+1i equal to 0 when floor( [ 27(2 Aji + ZJ.(q-1 ) / 2) mod q) ] / q) is even and equal to 1 when it is odd,
[0014] - obtaining said plurality of Boolean shares (b1i, b2i , ... ,bLi) from said L computed intermediate shares v\ .... vLi and said computed additional intermediate share vL+1i.
[0015] Such a method enables to generate, from the arithmetic shares of a coefficient Pi of the input polynomial P(X), a coefficient bi of the output polynomial B(X) which is split as a plurality of Boolean shares without performing any costly Arithmetic to Boolean conversion of the shares. q may be a 12-bit prime and n may be equal to 256.
[0016] According to an embodiment, when L= 2, the method according to the first aspect may comprise :
[0017] - generating a random value RO in [0;q[,
[0018] - updating said second polynomial share A2i such that A2i = (A1i - RO + A2i modulo q),
[0019] - computing a first intermediate share v1i = floor( (2 A1i + (q-1 ) / 2) / q) &1 ,
[0020] - computing a second intermediate share v2i = floor ( (2 A2i / q) ) &1 ,
[0021] - computing an additional intermediate share v3i equal to 1 when ( ( [2 A1i + (q-1 ) / 2 mod q] + [2 A2i mod q] )>= q and equal to 0 otherwise,
[0022] - obtaining a first Boolean share b1 = v1i and a second Boolean share b2 = v2i XOR v3i .
[0023] Said additional intermediate share v3i may be computed using a multiplicative masking.
[0024] Obtaining said plurality of Boolean shares (b1i, b2i , ... ,bLi ) from said L computed intermediate shares and said computed additional intermediate share may comprise performing XOR operations. The coefficients Pi of said input polynomial P(X) may be processed in random order.
[0025] It makes it harder for an attacker performing high-level side channel attacks to determine which collected traces correspond to which coefficient of the output polynomial.
[0026] The Compress function may be Compress function from Module-Latticebased Key-Encapsulation Mechanism Standard or Compressq function from CRYSTALS-KYBER Algorithm Specification.
[0027] According to a second aspect, this invention therefore relates also to a computer program product directly loadable into the memory of at least one computer, comprising software code instructions for performing the steps of the method according to the first aspect when said product is run on the computer.
[0028] According to a third aspect, this invention therefore relates also to a cryptographic device comprising a processor and a memory configured for performing the steps of the method according to the first aspect.
[0029] BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The following description and the annexed drawings set forth in detail certain illustrative aspects and are indicative of but a few of the various ways in which the principles of the embodiments may be employed. Other advantages and novel features will become apparent from the following detailed description when considered in conjunction with the drawings and the disclosed embodiments are intended to include all such aspects and their equivalents.
[0031] • Figure 1 is a schematic illustration of the Kyber decapsulation algorithm and of the Kyber Decryption algorithm given in KYBER Documentation reference; • Figure 2 is a schematic illustration of the Compressq function given in KYBER Documentation reference;
[0032] • Figure 3 is a schematic illustration of the Decoder function given in KYBER Documentation reference;
[0033] • Figure 4 is a schematic illustration of a key requesting device according to an embodiment of the present invention;
[0034] • Figures 5 and 6 are schematic illustrations of the method according to an embodiment of the present invention;
[0035] DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION
[0036] The invention relates to methods, and associated devices, for securing against side channel attacks an execution of a Compress function: the Compressq function used in the decapsulation algorithm of a Kyber Lattice-based Post Quantum cryptographic key-encapsulation mechanism, or equivalently the Compress function used in the decapsulation algorithm of ML-KEM. In the rest of the description, this Compress function is called Compressq and the invention is described in the case of the decapsulation algorithm of Kyber KEM but of course it also applies to the standardized implementation of the NIST called ML-KEM described in FIPS203 in which the Compress function is simply called “Compress”.
[0037] In this key-encapsulation mechanism, a key generation device and a key requesting device exchange information to share a secret key. The key generation device uses a public key of the key requesting device to generate a ciphertext c and transmits it to the key requesting device. The key requesting device then performs said decapsulation algorithm to retrieve, from the ciphertext c, using its secret key the secret key K to be shared between the key generation device and the key requesting device. As shown on Figure 1 , Kyber decapsulation algorithm (algorithm 9 of KYBER Documentation reference) calls Kyber Decryption algorithm (algorithm 6 of KYBER Documentation reference), which in turn calls the Compressq function. A general definition of this Compressq function is given in KYBER Documentation reference and reproduced on Figure 2 as Compressq(x, d) = round((2d / q) * x) mod+- 2dwith x in Zq, q being a prime number and d an integer. mod+- operator can be defined the following way: for two integers r and m, m being even, r mod+- m is the unique integer r' such that -m / 2 < r' < m / 2 and such that m divides r-r’. In KYBER Documentation reference q=3329. When the first argument of Compressq function is a polynomial, it is applied, as defined above, sequentially to each coefficient of the polynomial used as input.
[0038] Kyber Decryption algorithm (algorithm 6 of KYBER Documentation reference) calls Compressq(x, d) function, on line 4, using as argument x an input polynomial, hereafter called P(X), which is in a polynomial ring Rq= Fq[X] / (Xn+1 ) and is obtained from the ciphertext c received from the key generation device and from the secret key sk of the key requesting device, with n an integer. In KYBER Documentation reference n=256.
[0039] In this call to the function Compressq the second argument of the function is taken equal to 1 . Given the general definition of Compressq(x; d) given above, the execution of Compressq(x, 1 ) generates, from the input polynomial P(X), an output polynomial B(X), in the polynomial ring R2, such that each coefficient bi of the output polynomial B(x) equals 1 if the corresponding coefficient Pi of the input polynomial P(X) is in ](q-1 ) / 4, 3(q-1 ) / 4[ and bi equals 0 otherwise.
[0040] The secret key K to be shared between the key generating device and the key requesting device is then generated from the output polynomial B(X) using a function Encodei which serializes the 256 coefficients of the polynomial into a binary string of length 32 bytes. Encodei function corresponds to the function Encoder with ^1 . A general definition of the function Decoder which is the inverse of the Encoder function is given in KYBER Documentation reference and reproduced on Figure 3.
[0041] In existing Kyber implementations, the input and output values of the Compressq function are protected using masks: the coefficients of the input polynomial P(X), which are in [0,q[, are masked using an arithmetic splitting masking; and the coefficients of the output polynomial B(X), which are binary values, are masked using a Boolean splitting masking. Therefore, such implementations embed in Compressq function an Arithmetic to Boolean conversion of the polynomial coefficients shares, which is a costly operation.
[0042] Therefore, the present invention aims at providing an alternative implementation of the Compressq function which takes as input an input polynomial masked using an arithmetic splitting and outputs an output polynomial with Boolean splitting masking of its coefficients, without performing any Arithmetic to Boolean conversion of shares.
[0043] In the rest of this description, any reference to the execution of the Compressq function refers to the execution of the Compressq function as defined in Kyber specification when called by Kyber Decryption algorithm using as argument d=1 . It is noted Compressq(x,1 ) or more simply just Compressq.
[0044] The method according to the invention may be performed by a key requesting device. Such a device may for example be a personal computer or a server. It may also be a tamper-proof device such as a Hardware Security Module HSM. It may also be a smaller device such as a smartchip.
[0045] Figure 4 is a schematic illustration of such a key requesting device 100. It may include a processor 101 connected via a bus 102 to a random-access memory (RAM) 103, a read-only memory (ROM) 104, and / or a non-volatile memory (NVM) 105. The processor 101 may further include a communication interface 106 connected to the bus and which may be used to connect the device to various forms of wireless networks, e.g., wide-area networks, WiFi networks, or mobile telephony networks, or to wired networks such as an Ethernet network, which may be used to communicate with the key requesting device. It may also include an input-output interface 107 providing interfaces to an administrator, such as one or more screens, loudspeakers, a mouse, tactile surfaces, a keyboard etc... The key requesting device may further include a coprocessor 108. This coprocessor may be dedicated to performing cryptographic computations. For example, it may be a hardware accelerator, such as a FPGA or an ASIC, implementing an extendable output function. This coprocessor may be a separate chip in the device, or it may be included with the processor in a SoC.
[0046] In order to generate an output polynomial B(X) whose coefficients bi are each masked by a Boolean splitting masking from the arithmetically masked corresponding coefficient Pi of the input polynomial P(X) without performing any Arithmetic to Boolean conversion, a first idea of the invention is to express each coefficient Pi of the input polynomial as a sum of arithmetic shares.
[0047] For each share of the coefficient Pi, an arithmetic share of (q-1 ) / 2 is generated. Then each polynomial coefficient share is multiplied by 2 and then summed with exactly one share of (q-1 ) / 2. Each arithmetic masking share can be translated into a Boolean masking share for the coefficient bi, without Arithmetic to Boolean conversion, depending on the parity of the quotient of the division of the share by q. Nevertheless, coefficient bi generated this way would not take into account the fact that the sum of the remainders of these divisions can be greater than q and change the quotient parity.
[0048] Therefore, a second main idea of the invention is to generate similarly an extra Boolean masking share for considering into the Boolean masking the sum of these remainders, such that XORing all the shares directly obtained from the arithmetic shares of the coefficient Pi and this extra share would give the correct value of the corresponding coefficient bi of the output polynomial. More precisely, the following steps, illustrated on Figure 5 and on Figure 6, may be performed repeatedly by the key requesting device to determine from each coefficient Pi, for any value of i between 0 and n, of the input polynomial P(X) the corresponding Boolean shares which when XORed together are equal to the coefficient bi of the output polynomial B(X), instead of computing Compressq(P(X),1 ) as instructed in original Kyber Encryption algorithm.
[0049] In a first step S1 , the key requesting device splits the coefficient Pi of the input polynomial according to an arithmetic splitting and obtains L polynomial shares A1i, A2i , ... , ALi with L a predetermined integer. These polynomial shares are such that i modulo q.
[0050] Optionally, for increasing the randomness of the polynomial shares, the key requesting device may update the L polynomial shares (A1i , A2i , ... , ALi) obtained at the first step S1 . For a better clarity, in this paragraph, and on Figure 6, their updated values are called transformed polynomial shares (A’1i , A’2i , ... , A’Li) but in the rest of the description, the polynomial shares, updated or not, are always called polynomial shares (A1i , A2i , ... , ALi). For updating the L polynomial shares (A1i , A2i , ... , ALi), the key requesting device may generate L-1 random values and set L-1 transformed polynomial shares (A’1i , A’2i , ... , A’L"1i) to these random values. Then the last transformed polynomial share A’Li may be computed as A’Li
[0051] In a second step S2, for each polynomial share i , with j in {1 , ... ,L}, the key requesting device computes an intermediate share vji equal to 0 when floor ([2Ai+ Zj.(q-1 ) / 2] I q) is even and equal to 1 when it is odd. The Zjcoefficients are such that Z1+ Z2+ ... + ZL= 1 and such that Zj.(q-1 ) / 2 is an integer. Optionally, all the Z coefficients but one may be random and the non-random one may be selected such that Z1+ Z2+ ... + ZL= 1 . As an example, depicted on Figure 6, floor([2Aji+ Zj.(q-1 ) / 2] I q) may be expressed as a binary value and vji may be computed as floor([2 i+ Zj.(q-1 ) / 2] I q ) & 1 with & the bitwise AND operator.
[0052] The Zjcoefficients used for computing intermediate shares vji for a given coefficient Pi may not be the same as the ones used for computing intermediate shares for another coefficient. As an example, a new set of 7 coefficients may be used for the computations performed for each coefficient.
[0053] Unfortunately, such intermediate shares are not sufficient for generating proper shares for a Boolean splitting masking of the coefficient bi of the output polynomial B(X). Indeed, the generated intermediate shares miss to take into account the remainder of their division by q / 2. Therefore, the sum of the generated intermediate shares should be corrected in order to take into account the sum of these remainders.
[0054] To this end, in a third step S3, the key requesting device computes an additional intermediate share vL+1i equal to 0 when floor([ 27(2 Ai + ZJ.(q-1 ) / 2) mod q) ] / q) is even and equal to 1 when it is odd. As an example, depicted on Figure 6, floor([ 27(2 i + ZJ.(q-1 ) / 2) mod q)] / q) may be expressed as a binary value and vJj may be computed as floor([27(2 Ai + Zj.(q-1 ) / 2) mod q)] / q) & 1 , with & the bitwise AND operator.
[0055] Such a computation should be performed securely, using for example obfuscation techniques, in order not to expose the value of the additional intermediate share.
[0056] In a fourth step S4, the key requesting device obtains the Boolean shares of the coefficient bi of the output polynomial from the L intermediate shares vji and the additional intermediate share VL+1L Since the coefficient bi of the output polynomial B(X) may be retrieved by XORing the L intermediate shares vji and the additional intermediate share vL+1i, in an embodiment the coefficient bi is represented as masked using L+1 Boolean shares bi i with j in {1 , ... , L+1 } such that b1iAb2iA...AbL+1i = bi by setting the L+1 shares bi i simply equal to the L intermediate share vji and the additional intermediate share vL+1i.
[0057] Nevertheless, it may be desirable to have a coefficient bi split in only L shares, as the coefficient Pi of the input polynomial. Therefore, in another embodiment, the key requesting device may obtain L Boolean shares b1i, b2i , ... ,bLi of the output polynomial coefficient from the L intermediate shares v\ .... vLi computed for that coefficient and from the additional intermediate share vL+1i, computed for that coefficient. Such a reduction of L+1 shares to only L shares may be easily performed by performing a XOR operation or ADD operations between one of the computed intermediate shares and the additional intermediate share. Alternatively, an ADD operation between these two shares may be performed and the corresponding Boolean share may be equal to the parity of the sum.
[0058] The sequence of operations described above may slightly differ by using a different distribution over the described steps of the operations to be performed. For example, the intermediate shares vji may be equal to floor([2 i + Zi(q- 1 ) / 2] / q), and their parity may be determined later, by applying the &1 operation, at the fourth step S4 when computing the corresponding Boolean share bL Similarly, the floor operation may also be applied at the fourth step S4 rather than at the second step S2 and third step S3.
[0059] In order to generate the masked value of each coefficient bi of the output polynomial B(X), for i in {0, ... ,n} the steps described above have to be repeated for each coefficient Pi of the input polynomial P(X). In an embodiment, the coefficients Pi of said input polynomial P(X) are processed in random order.
[0060] The following paragraphs give an example where L=2. In the first step S1 , the key requesting device splits the coefficient Pi of the input polynomial into two shares A1i, A2i such that A1i + A2i = Pi modulo q.
[0061] In this example, the two polynomial shares (A1i, A2i) of the coefficient Pi of the input polynomial may be updated by performing the following substeps.
[0062] In a first substep, the key requesting device may generate a random value RO in [0;q[.
[0063] In a second substep, the key requesting device may update the second polynomial share A2i as A2i = (A1i - RO + A2i modulo q).
[0064] In a third substep, the key requesting device may update the value of the first polynomial share A1i to RO.
[0065] In the second step S2, the key requesting device computes two intermediate shares vji : v1i = floor((2 A1i + (q-1 ) / 2) / q) & 1 and v2i = floor(2A2i / q) &1 . Such formulas assume that Z1=1 and Z2=0 and that the two floor values are expressed as binary values before applying the bitwise-and operators “&”.ln the third step S3, the key requesting device computes the additional intermediate share v3i which is equal to 1 if ([2 A1i + (q-1 ) / 2 mod q] + [2 A2i mod q]) is greater than q or equal to q. It is equal to 0 otherwise. Such a computation may be performed using a multiplicative masking. For example, it can be tested whether rnd1 *[2 A1i + (q- 1 ) / 2 mod q] rnd2 + rnd1 *[2 A2i mod q] - rnd1 *q <= 0, where rnd2 < rnd1 .
[0066] In the fourth step S4, the key requesting device obtains the Boolean shares of the coefficient bi of the output polynomial from the 2 intermediate shares v1i, v2i and the additional intermediate share v3i.
[0067] For example, it can set b1 = v1i, b2 = v2i and b3 = v3i. In order to decrease the number of Boolean shares of the coefficient bi to two, the second share b2 may be set to (v2i XOR v3i).
[0068] According to a second aspect, the invention is also related to a computer program product directly loadable into the memory of at least one computer, comprising software code instructions for performing the steps of the method described above when said product is run on the computer.
[0069] According to a third aspect, the invention is also related to a cryptographic device 100 comprising a processor 101 and a memory 103, 104, 105 configured for performing the steps of the method described above.
[0070] As a result, the method according to the invention enables to generate from each coefficient Pi of the input polynomial P(X), masked using an arithmetic splitting, a coefficient bi of the output polynomial B(X), masked using a Boolean splitting, without performing any Arithmetic to Boolean mask conversion. Such a method therefore requires much less resources than existing implementations of Kyber encapsulation method protecting the execution of the Compressq function using coefficient splitting but relying on Arithmetic to Boolean mask conversion, while providing a similar level of protection of this function against side channel attacks.
Claims
1. CLAIMS1 . A method for securing against side channel attacks execution of a Compress function designed to be used in a decapsulation algorithm of a Kyber Latticebased Post Quantum cryptographic key-encapsulation mechanism, said decapsulation algorithm generating, from a secret key sk of a key requesting device and a ciphertext c transmitted by a key generation device, a key (K) to be shared between said key requesting device and said key generation device, wherein said Compress function converts an input polynomial P(X) in a polynomial ring Rq= Fq[X] / (Xn+1 ) into an output polynomial B(X) in a polynomial ring R2 such that each coefficient bi of the output polynomial B(x) equals 1 if the corresponding coefficient Pi of the input polynomial P(X) is in ](q-1 ) / 4, 3(q-1 ) / 4[ and bi equals 0 otherwise, with i in {1 ,..,n}, n being an integer and q being a prime number, each coefficient Pi of said input polynomial P(x) being masked using an arithmetic splitting masking and represented by L arithmetic shares Ai1, Ai2, ... , AiLsuch that Ai1+ Ai2+ ... + AiL= Pi modulo q, with L an integer, and each coefficient bi of said output polynomial B(X) being masked with a Boolean splitting masking and represented by a plurality of Boolean shares, said method being performed by the key requesting device (100) comprising a processor (101 ) and a memory (103, 104, 105) and comprising, instead of applying Compress function to said input polynomial P[X], for each coefficient Pi of said input polynomial P(X) :- obtaining (S1 ) said L polynomial shares A1i, A2i , ... , ALi of said coefficient Pi,- for each polynomial share Ai with j in {1 , ... , L}, computing an intermediate share vji (S2) equal to 0 when floor([2Aji+ Zj.(q-1 ) / 2] / q ) is even and equal to 1 when it is odd, with Z such that Z1+ Z2+ ... + ZL= 1 and Z.(q-1 ) / 2 is an integer,- computing (S3) an additional intermediate share vL+1i equal to 0 when floor([ 2 2 i + ZJ.(q-1 ) / 2) mod q)] / q) is even and equal to 1 when it is odd,- obtaining (S4) said plurality of Boolean shares (b1i, b2i , ... ,bLi) from said L computed intermediate shares (v\ .... vLi) and said computed additional intermediate share (vL+1i).
2. The method of claim 1 , wherein q is a 12-bit prime and n = 256.
3. The method of claim 1 or 2, comprising, when L= 2:- generating a random value RO in [0;q[,- updating said second polynomial share A2i such that A2i = (A1i - RO + A2i modulo q),- updating the value of the first polynomial share A1i to RO,- computing a first intermediate share v1i = floor( (2 A1i + (q-1 ) / 2) / q) &1 ,- computing a second intermediate share v2i = floor ( (2 A2i / q) ) &1 ,- computing an additional intermediate share v3i equal to 1 when ( ( [2 A1i + (q-1 ) / 2 mod q] + [2 A2i mod q] )>= q and equal to 0 otherwise,- obtaining a first Boolean share b1 = v1i and a second Boolean share b2 = v2iXOR v3i .
4. The method of claim 3, wherein said additional intermediate share v3i is computed using a multiplicative masking.
5. The method of any of claims 1 to 4, wherein obtaining said plurality of Boolean shares (b1i, b2i , ... ,bLi) from said L computed intermediate shares and said computed additional intermediate share comprises performing XOR operations.
6. The method of any of claims 1 to 5, wherein the coefficients Pi of said input polynomial P(X) are processed in random order.
7. The method of any of claims 1 to 6, wherein said Compress function is Compress function from Module-Lattice-based Key-EncapsulationMechanism Standard or Compressq function from CRYSTALS-KYBER Algorithm Specification.
8. A computer program product directly loadable into the memory of at least one computer, comprising software code instructions for performing the steps of any one of claim 1 to 7 when said product is run on the computer.
9. A cryptographic device (100) comprising a processor (101 ) and a memory (103, 104, 105) configured for performing the steps of any one of claim 1 to 7.