Masked Grid-Based Cryptographic Method
Patent Information
- Application Number
- DE502022002978
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-11-23
- Filing Date
- 2022-11-22
- Publication Date
- 2025-03-20
- Estimated Expiration
- 2042-11-22
Description
Field of the invention
[0001] The invention relates to a masked lattice-based cryptographic method, and a computing device with an implementation of such a method. State of the art
[0002] Many lattice-based cryptographic schemes work with polynomials of degree 200 or higher. Such polynomials must be multiplied during the computation. To efficiently compute this multiplication, many schemes use the "Number Theoretic Transform," or NTT for short, or discrete Fourier transform over a finite field. The polynomials to be multiplied are transformed into two vectors using the NTT, these vectors are multiplied componentwise, and the resulting vector is transformed back using an inverse NTT, NTT -1< . Examples can be found in the specifications of the key exchange schemes Kyber ([2], pp. 8, 9), New Hope ([1], p. 7), and the signature scheme Dilithium ([3], p. 13).
[0003] Implementations of cryptographic schemes can be vulnerable to side-channel attacks. Side-channel attacks attempt to draw conclusions about processed secret data from measurements of physical parameters on a device during the execution of a cryptographic scheme. Examples of typical physical parameters used for such attacks include runtime, power consumption, or electromagnetic radiation. Numerous publications on this topic have been published based on the fundamental work [7].
[0004] A well-known measure to protect implementations against side-channel attacks is the masking of intermediate results, which is described, for example, in document [4] ([4], p. 163).
[0005] Document [2], page 9, Algorithm 6, describes a method for decrypting a ciphertext using a secret key sk to generate a message m as output. The secret key sk is stored in the form of a key matrix ŝ T< applied. Algorithm 6 comprises, after preparatory steps 1-3, in which the values u and v are derived from the ciphertext, a step 4 in which the message m is obtained. In the following central message extraction step (1) of step 4, the secret key sk is represented as a key matrix, ŝ T< , applied to the two values v and u derived from the ciphertext: v − NTT − 1 s ^ T ° NTT u
[0006] Here, ° stands for component-wise multiplication. In the message extraction step (1), the value u extracted from the ciphertext is subjected to an NTT to generate a vector NTT(u) corresponding to u. The generated vector NTT(u) is multiplied with the key matrix ŝ T< component-wise multiplied. The result of this component-wise multiplication is transformed back using the inverse NTT, NTT -1< . The result of the inverse transformation is combined with the other value obtained from the ciphertext, v.
[0007] In the notation from document [2], the secret key (in matrix representation) ŝ T< can be masked by the following procedure:
[0008] Here, the value r in step 1 is a randomly selected random number. In step 2, the value u derived from the ciphertext is replaced by a value u' masked with the random number r. In step 3, the masked message extraction step corresponding to the message extraction step (1) above is applied to the masked value u' from step 2, thereby obtaining the decrypted message w masked with r. In step 4, an auxiliary value c is calculated, which is needed to compensate for the masking of the value u in step c. In step 5, the auxiliary value c from step 4 is applied to the result w of the masked message extraction step 3, thereby obtaining the decrypted (unmasked) message w'.
[0009] Fig. 3 shows the multiplication of an input vector (x0, x1, ...xn-1) with a matrix α̂ T< to generate an output vector (X0, X1, ...Xn-1).
[0010] The NTT from Algorithm 1 above is computationally a component-wise matrix multiplication of the masked vector NTT(u') with the key matrix ŝ T< , like the one in Fig. 3 where the vector NTT(u') from Algorithm 1 corresponds to the vector x from Fig. 3 corresponds, and the key matrix ŝ T< from Algorithm 1 of the matrix α̂ T< out of Fig. 3 corresponds.
[0011] The masked vector NTT(u') is a concatenation of elements of the value u, which is derived from the ciphertext, and random values r used for masking. The vector NTT(u') therefore has the form NTT(u') = (u0, u1, ...un-1, r0, r1, ...rn-1). Due to the additional vector elements r0, r1, ...rn-1, which are derived from the random number r used for masking, the masked message retrieval step, and thus the masked decryption, requires significantly more computational effort than the unmasked message retrieval step and the unmasked decryption.
[0012] A direct application of masking with r to protect the implementation of the cryptographic scheme therefore has a major impact on the runtime of the cryptographic scheme.
[0013] In specific applications where the cryptographic procedure must adhere to certain runtime limits, masking can lead to the runtime limit being violated.
[0014] For example, in a payment transaction, the cryptographic procedure used to authenticate the payment transaction must complete its calculation within the specified timeframe; otherwise, the authentication and thus the payment transaction fail. Similar timeframes can be set for the authentication of identification documents.
[0015] Foregoing masking the cryptographic procedure in favor of runtime represents a security risk.
[0016] Cryptographic methods that must combine runtime restrictions and security specifications are used in practice, for example in subscriber identity modules (SIMs) in eUICCs in mobile devices, in payment cards with chips, and in identification documents such as passports with chips and ID cards, as well as healthcare system documents (such as health insurance cards or healthcare professional cards). A mobile device is understood to be a device that is operated with an eUICC and is configured to communicate with the eUICC in a mobile network, although the device does not have to be physically mobile. Examples of mobile devices are mobile phones and automotive telematics devices. The eUICCs operated in mobile devices can have different form factors, for example plug-in SIM cards, soldered or solderable embedded eUICCs, or integrated iUICCs integrated into the chipset of the mobile device.
[0017] Prior art document [8] DE102018108313A1 discloses a method for obfuscating a polynomial by multiplying the polynomial with a blend polynomial that is sparsely populated.
[0018] The document [9] "Fast and Power-Analysis Resistant Ring Lizard Crypto-Processor Based on the Sparse Ternary Property", P. Choi et al, IEEE Access, August 7, 2019, discloses a crypto-processor solution based on the quantum-resistant PKI cryptosystem Ring Lizard, which uses sparse polynomials. Summary of the invention
[0019] The invention is based on the object of creating a runtime-improved and at the same time secure masked lattice-based cryptographic method for encrypting or decrypting data with a key.
[0020] The object is achieved by a method for masking a lattice-based cryptographic method according to claim 1. Advantageous embodiments of the invention are specified in the dependent claims.
[0021] The inventive method according to claim 1 is designed for encrypting or decrypting data with a key s. The method comprises multiplying an input vector by a key matrix. The input vector comprises the same number of data elements and masking elements. The key matrix represents the key. The multiplication of the input vector by the key matrix occurs in an NTT implementation, in which the data elements and the masking elements are multiplied by powers of the key predetermined by the cryptographic method. The method is characterized in that at least one, or some, of the masking elements, with the exception of at least one individual masking element, are deliberately set to zero.
[0022] By setting some masking elements (at least one) to zero, some NTT calculation steps are omitted because they are based on a multiplication by zero. This reduces the runtime of the procedure and thus improves the performance. The limiting case of this measure would be to set all masking elements to zero. While this would result in the best possible runtime reduction, it would also eliminate the masking altogether. Therefore, at least one masking element is set to a non-zero value.
[0023] Due to the architecture of the NTT procedure, masking values set to zero only result in unmasked data elements at the beginning of the procedure, during the first NTT calculation step. As the procedure progresses, during subsequent NTT calculation steps, different data elements input in parallel at the input of the procedure are intermixed by the NTT calculation steps. This intermixes unmasked data elements with masked data elements, so that the masking is extended beyond the already masked data elements to the data elements that remained unmasked in previous calculation steps.
[0024] Consequently, sufficient masking and thus security of the procedure is maintained even though some masking elements are set to zero.
[0025] Therefore, according to claim 1, a runtime-improved and at the same time secure masked lattice-based cryptographic method for encrypting or decrypting data with a key is created.
[0026] The procedure can be designed as one of the following: a method for encrypting a message with an encryption key, in particular a public key, wherein the message or an element derived from the message is provided as data elements in the input vector and the encryption key or a key derived from the encryption key is provided as the key; a method for decrypting a ciphertext generated by encrypting a message with a decryption key, in particular a private key, wherein the ciphertext or an element derived from the ciphertext is provided as data elements in the input vector and the decryption key or a key derived from the decryption key is provided as the key; a method for signature generation by a decryption method; a method for signature verification by an encryption method.
[0027] A security element according to the invention contains an implementation of a masked lattice-based cryptographic method configured therein. The implementation is configured to execute a method described above.
[0028] The security element can be designed as one of the following: Subscriber identity module, SIM, implemented in an eUICC for communication in a mobile network; integrated circuit implemented in a payment card; integrated circuit implemented in an identification document; integrated circuit implemented in a healthcare system document.
[0029] The security element is optionally integrated into a security document, which can be designed as one of the following: payment card, eUICC, identification document or healthcare system document (in particular health insurance card or healthcare professional card).
[0030] A terminal is configured to communicate with a security element or security document as described above. Short description of the drawings
[0031] In the following, the invention is explained in more detail using exemplary embodiments and with reference to the drawing, in which: Fig. 1 shows an NTT implementation in DIF ("Decimation in Frequency") representation, suitable for the application of the invention; Fig. 2 shows an NTT implementation in DIT ("Decimation in Time") representation, suitable for the application of the invention; Fig. 3 shows the multiplication of an input vector x with a matrix to generate an output vector X. Detailed description of implementation examples
[0032] The method according to the invention according to one embodiment of the method is designed for encrypting or decrypting data with a key s. The method comprises multiplying an input vector u' by a key matrix ŝ T< . The input vector comprises u' n data elements u0, ... , un-1 and n masking elements r0, ..., rn-1. The key matrix ŝ T< the key s is shown. The multiplication of the input vector u' with the key matrix ŝ T< is carried out in an NTT implementation in which the data elements u0, ..., un-1 and the masking elements r0, ..., rn-1 are multiplied by powers of the key s predetermined by the cryptographic method. The method is characterized in that at least one, or some, of the masking elements r0, ..., rn-1, with the exception of at least one single masking element ri, are deliberately set to zero.
[0033] Fig. 1shows an NTT implementation in DIF ("Decimation in Frequency") representation, suitable for the application of the invention. The operation symbol x in the circle represents the multiplication of the value fed in from the left by a power of a primitive unit root α. The feeding of the primitive square roots at the operation symbols x in the circle corresponds to multiplication with the matrix α̂ T< as they are in Fig. 3 The primitive unit root α is equal to the secret key s in the case of decryption with a secret key.
[0034] If Algorithm 1 from the present application, according to one possible embodiment, is converted into the vector x0, ..., x15 from Fig. 1 x0, ... , x7, x8, ..., x15 = u0, ... , un-1, r0, ..., rn-1. The Fig. 1The values fed in are therefore in the upper eight vector elements x0, ... , x7 the value u derived from the ciphertext, i.e. data elements u0, ..., un-1, and in the lower eight vector elements x8, ... , x15 the random number r introduced for masking, i.e. masking elements r0, ..., rn-1.
[0035] Each of the data elements u0, ... , un-1 and each of the masking elements r0, ..., rn-1 must be multiplied by a power of the key s. The power to be applied is Fig. 3 where α is Fig. 3 is equal to the key s.
[0036] If some of the masking elements r0, ..., rn-1 are set to zero, no multiplication needs to be performed for these masking elements r0, ..., rn-1 set to zero, since the result of the multiplication is zero anyway.
[0037] Are in Fig. 1If the vector elements x0 to x7 at the input (left) are set to the values of the data elements ui, and the vector elements x8 to x15 of the masking elements ri at the input (also left) are all set to zero, then no masking takes place. If, on the other hand, a single masking element, for example x8, is set to a value other than zero, and the masking values x9 ... x15 are set to zero, then in the first NTT step, at the first x in the circle, a value other than zero is generated for the masking value x8, which is then added to the first data element x0. For all other masking elements x9 ... x15, a value equal to zero is generated in the first NTT step, so that the data elements x1 ... x7 remain unmasked in the first NTT step. In the next NTT step, the data element x0 masked with x8 is merged with the data element x4, so that now x0 and x4 are already masked with x8.In the next NTT step, starting with data element x0, data element x2 is masked with x8, and starting with data element x4, data element x6 is masked with x8. Even if masking elements are set to zero, the masking also penetrates data elements that remained unmasked at the input of the process due to the structure of the NTT procedure.
[0038] In the example, Fig. 2 the vector elements x0, x4, x2, x6, x1, x5, x3, x7 are set to the data elements ui, and some of the remaining vector elements ri set up for masking are set to zero, and at least one is set to something other than zero, then unmasked data elements ui remain after the first NTT calculation step, but these are masked in the further course of the NTT procedure. Cited prior art
[0039] [1] Erdem Alkim u. a. "NewHope - Submission to the NIST post-quantum project". In: (10. Apr. 2020). url: https: / / www.newhopecrypto.org / data / NewHope_2020_04_10.pdf. [2] Roberto Avanzi u. a. "CRYSTALS-Kyber (version 3.01) - Submission to round 3 of the NIST post-quantum project". In: (31. Jan. 2021). url: https : / / pq - crystals . org / kyber / data / kyber - specification - rou nd3-20210131. pdf. [3] Léo Ducas u. a. "CRYSTALS-Dilithium - Algorithm Specifications and Supporting Documentation (Version 3.1)". In: (8. Feb. 2021). url: https: / / pq - crystals . org / dilithium / data / dilithium - specification - rou nd3-20210208. pdf. [4] Louis Goubin und Jacques Patarin. "DES and Differential Power Analysis The "Duplication" Method". In: Cryptographic Hardware and Embedded Systems. Hrsg. von Cetin K. Koc und Christof Paar. Berlin, Heidelberg: Springer Berlin Heidelberg, 1999, S. 158-172. isbn: 978-3-540-48059-4. [5] Douglas L. Jones. Digital Signal Processing - A User's Guide. Kap. 3.4.2.2 Decimation-in-frequency (DIF) Radix-2 FFT. url: https: / / cnx.org / contents / qAa9OhlP@2.44:XaYDVUAS@6 / Decimation- in- Frequency-DIF-Radix-2-FFT. [6] Douglas L. Jones. Digital Signal Processing - A User's Guide. Kap. 3.4.2.1 Decimation-in-time (DIT) Radix-2 FFT. url: https: / / cnx.org / contents / qAa9OhlP@2.44:zmcmahhR@7 / Decimation-in-time-DIT-Radix-2-FFT. [7] Paul Kocher, Joshua Jaffe und Benjamin Jun. "Differential Power Analysis". In: Advances in Cryptology - CRYPTO' 99. Hrsg. von Michael Wiener. Berlin, Heidelberg: Springer Berlin Heidelberg, 1999, S. 388-397. isbn: 978-3-540-48405-9. url: https: / / doi.org / 10.1007 / 3-540-48405-1_25. [8] DE102018108313A1 [9] "Fast and Power-Analysis Resistant Ring Lizard Crypto-Processor Based on the Sparse Ternary Property", P. Choi et al, IEEE Access, 7. August 2019.
Claims
1. Masked grating-based cryptographic method for encrypting or decrypting data using a key s, comprising multiplying an input vector (u') by a key matrix (ŝT), - wherein the input vector (u') comprises, as data, n data elements (u0, ..., un-1) concatenated with n masking elements (r0, ..., rn-1) , - wherein the key s is represented by the key matrix ŝT, - wherein the input vector (u') is multiplied by the key matrix (ŝT) in an NTT implementation in which the data elements (u0, ..., un-1) and the masking elements (r0, ..., rn-1) are multiplied by powers of the key s that are predetermined by the cryptographic method, and - wherein at least one, or some, of the masking elements (r0, ..., rn-1) , with the exception of at least one single masking element (ri), is or are intentionally set to zero.
2. Method according to Claim 1, wherein the method is one of the following: - a method for encrypting a message using an encryption key, in particular a public key, wherein the message or an element derived from the message is provided in the input vector as data elements and the encryption key or a key derived from the encryption key is provided as key; - a method for decrypting a ciphertext generated by encrypting a message using a decryption key, in particular a private key, wherein the ciphertext or an element derived from the ciphertext is provided in the input vector as data elements and the decryption key or a key derived from the decryption key is provided as key; - a signature generation method using a decryption method; - a signature verification method using an encryption method.
3. Security element having an implementation set up therein that is configured to carry out a method according to Claim 1 or 2.
4. Security element according to Claim 3, designed as one of the following: - a subscriber identity module, SIM, set up in an eUICC for communication in a mobile telecommunications network; - an integrated circuit, set up in a payment card; - an integrated circuit, set up in an identification document; - an integrated circuit, set up in a health system document.
5. Security document having a security element according to Claim 4, and designed as one of the following: a payment card, an eUICC, an identification document or a health system document.
6. Terminal configured to communicate with a security element according to Claim 4 and / or to communicate with a security document according to Claim 5.