# Patent

## Title
Chinese remainder theorem-based computation method for cryptosystems

## Abstract

A computer hardware implemented cryptography method computes a modular exponentiation, M :=Cd (mod p·q), upon a message data value C using a Chinese Remainder Theorem (CRT) based technique. To secure against cryptanalysis, the private key moduli p and q are transformed by multiplication with a generated random value s, so that p′: =p·s and q′ :=q·s, as shown in an exemplary embodiment in FIG. 2. The CRT steps of the modular exponentiation are applied using the transformed moduli p′ and q′ to obtain a random intermediate message data value M′. A final reduction of M′ modulo p·q yields the final message data value M. Values needed for the computation are loaded into data storage and accessed as needed by electronic processing hardware.

## Background
TECHNICAL FIELD
The present invention relates to cryptographic methods carried out in electronic processing hardware with associated software. In particular, the invention relates to cryptographic computations performed by such electronic processing hardware that involve finite field, residue or congruence operations, and especially modular exponentiation calculations employing Chinese Remainder Theorem based techniques, with attention to variations for thwarting cryptanalysis.
BACKGROUND ART
Many cryptographic algorithms are based on modular exponentiation calculations of the type m≡cd (mod n) , where c and m can correspond to data of various kinds (plaintext and ciphertext messages, signatures, message digests, authentication codes, etc.) and where d and n cat correspond to elements of public or private keys for operating upon that data. The modulus n is usually the product of two very large primes p and q that are kept secret. The RSA algorithm is one example of an encryption system (and related digital signature scheme) that uses modular exponentiation. The Diffie-Hellman key agreement protocol is another.
In the RSA algorithm, a public key {e, n} and a corresponding private key {d, p, q} are provided for encryption and decryption, where d·e≡1 (mod φ(n)), n=p·q, φ(n)=(p-1) (q-1), and where integer e and φ(n) are co-prime. Alternatively, a function λ(n)=LCM(p-1,q-1) is often used in place of the original φ (n). (RSA PKCS#1 v.2.1) For encryption a ciphertext c may be obtained from a plaintext message m using the public key {e, n} according to the relation c=me (mod n). The public key exponent e is usually a small value (e.g., 3, 5, 35, or 216+1=65537) chosen for ease and speed of encryption. For decryption, the plaintext message m may be recovered from the ciphertext c using the private key {d, p, q} according to the relation m≡cd (mod (p·q)).
The Chinese Remainder Theorem (CRT) is often used to speed the modular exponentiation calculations involved in the decryption, since the otherwise secret prime factors p and q are known to the user. That theorem generally states that given a set of simultaneous congruences x≡ai (mod ni), for i=1 to r, and for which the moduli ni are pairwise relatively prime, the solution is x≡[Σi ai·bi (N/ni)] (mod N), where N=ni·n2·−nr and the bi are determined from bi (N/ni)≡1 (mod ni). For two relatively prime positive integers p and q and two integers a and b (i.e., the case r=2), there exists an integer m uniquely determined modulo p·q, such that m≡a (mod p)≡b (mod q). That is, for GCD (p, q)=1, every pair of residue classes modulo p and q corresponds to a simple residue class modulo p·q. The solution finds m≡[a·(q−1 mod p)·q+b·(p−1 mod q)·p] (mod p·g). A modular inverse of an integer x−1 modulo z is defined such that x·x−1≡1 (mod z). For a prime modulus, every nonzero integer not a multiple of the modulus has an inverse.)
CRT implementation of the RSA algorithm calculates the modular exponentiation m:=cd (mod (p·q)) as follows. First define a pair of private key derived exponents as d1:=d (mod (p-1)) and d2:=d (mod (q-1)). Then, calculate m1:=cd1 (mod p) and m2:=cd2 (mod q).
Finally, m=CRT(m1, m2):=m1+p·{[(m2−m1)·R] (mod q)}, where R≡p−1 (mod q).
That last formula of the CRT implementation, namely m=CRT(m1,m2), has many variants. Three examples of these variants are:
CRT2 (m1,m2):=(m1·R1·q+m2·R2·p) (mod p·q), where R1≡q−1 (mod p) and R2≡p−1 (mod q);
CRT3(m1,m2):={[(m1·R1)(mod p)]·q+[(m2·R2) (mod q)]·p]} (mod p·q), where again R1≡q−1 (mod p) and R2≡p−1 (mod q); and
CRT4 (m1,m2):=(q·{[(m1-m2)·R4] (mod p)}+m2) (mod p·g), where R4≡p−1 (mod q).
Variant CRT implementations perform the modular exponentiation calculation in ways designed to thwart cryptanalysis, especially in the context of tokens (e.g., smart cards) where an attacker has access to the hardware carrying out the cryptographic computations. An attacker may employ noninvasive measurement and timing analysis of electromagnetic emissions, power consumption, or other accessible parameters of a device during computational processes in order to extract useful information regarding the private keys. The variant implementations typically employ pseudo-random variables at various stages of the cryptographic algorithm in order to mask the underlying mathematical operations without affecting the final result.
For example, in CRT implementations of modular exponentiation, some variants transform the message variable m or its CRT components, m1 and m2, by multiplying with a random value at some early stage in the computational process then at a later stage divide the message variable by that same random value or by a related value derived from it to obtain the true result. Other variants may transform the private key exponent d or its CRT components, d1 and d2, by adding a random multiple of (p-1) or (q-1) to obtain another (random) member of the congruence class for that private key component. The private key exponent d could likewise be reduced to transformed CRT components, d1′ and d2′, using moduli that are corresponding random multiples of (p-1) and (q-1), respectively. In all these cases, the design of the transformations are chosen to obtain a true final result, while randomly varying the intermediate calculations in a manner that take advantage of equivalences in congruence arithmetic. Unfortunately, many of these variants can be quite complex and computationally intense.
SUMMARY DISCLOSURE
The present invention is a computer hardware-implemented cryptography method using Chinese Remainder Theorem (CRT) implemented modular operations, in which a modulus for the computations is transformed in order to blind cryptoanalytic observations of intermediate results. In particular, for a modular exponentiation operation, m=cd (mod p·q), a transformation factor s is used to transform the co-prime factors p and q into p′=s·p and q′=s·q. The CRT steps are applied using the transformed moduli p′ and q′. After obtaining an intermediate result m′, the final result m is recovered by a final reduction modulo p·q. The transformation factor s may be a random value, a random choice from a finite set of preselected fixed values, or, if security is not an issue in a given circumstance, could even be a fixed value. The method is relatively simple and less computational intense than many other variants, yet is still substantially secure against cryptanalysis. Hence, it is suitable for use in smart cards and other cryptographic token applications. It can be employed with any cryptographic algorithm that relies on modular exponentiation with CRT implementations.
The method may he implemented as a cryptography program in data processing hardware, such as smart card or other token, that comprises a cryptographic processor unit, data storage accessible to that processor unit, and pseudo-random number generating circuitry providing the random factor.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic plan view of exemplary processor hardware for use in executing a cryptography method in accord with the present invention, including CRT-based modular exponentiation.
FIG. 2 is a flow diagram illustrating the general steps for modular exponentiation in accord with an exemplary embodiment of the present invention.



DETAILED DESCRIPTION
With reference to FIG. 1, the cryptographic method of the invention may be implemented in a wide variety of digital processing systems, logic circuitry or electronic hardware, or by executing an equivalent firmware or software program in a data processor or computer. Exemplary computational processor hardware in accord with the present invention may include an arithmetic-logic unit (ALU) 10, or similar computational circuitry containing a hardware multiplier, for executing numerical operations, including modular exponentiation, upon provided data. The ALU 10 generally has access to a memory (RAM) 12 and various working registers 14. An operation sequencer 16 comprises logic circuitry for controlling the ALU, including data transfers to and from the memory 12 and registers 14, in accord with firmware or software instructions for the set of operations of a cryptographic algorithm. operation sequencer 16 may access operation parameters in the form of pointers stored in registers 18 that enable the operation sequencer 16 to locate an operand within the RAM 12, as well as other control information and the destination addresses of intermediate results. The hardware may also include a pseudo-random number generator (PRNG) circuit 20 that performs calculations and outputs a random numerical value. This random generator 20 may be accessed by the ALU 10, as directed by the operation sequencer in accord with the cryptographic algorithm and especially modular exponentiation steps thereof.
With reference to FIG. 2, an exemplary CRT-based modular exponentiation computation, M:=Cd (mod (p·g)), by the aforesaid hardware and in accord with the present invention typically begins (step 10) by loading the private key values {d, p, q} into data storage accessible to the processing hardware, such as into the RAM 12 in FIG. 1. From there, the values can be transferred as needed into working registers 14 for use by the ALU 10. A random qenerator, such as the PRNG circuit 20 in FIG. 1, generates a random value for the transformation factor s (step 11) which is then used to randomize the private key modulus values p and q by means of multiplication transformations (step 12):

p′:=p·s; 

q′:=q·s. 

An inverse value R′:=(p′)−1 mod q is calculated (step 14) by the processing hardware in a manner similar to calculations of inverse R:=p−1 (mod q) known in prior versions of CRT-based modular exponentiation.

These transformed values p′ and q′ and the inverse R′, will be used in later steps. Each decryption session using the private key values {d, p, q} will involve a different random value s, and hence different randomized values of the moduli p′ and q′ and of the inverse R′, thereby securing cryptographic operations involving the modular exponentiation from cryptanalysis. (Note: The random value s must be co-prime with the original moduli p and q, so a standard divisibility test for co-primality should be a part of the random generation step 11 in order to weed out any unsuitable random values.) If desired, the size of the random value s may be selected to be within a specified range, so that the values p′, q′, d1 and d2 will be substantially the same size.
Alternatively, the transformation factor S could be a random choice from a finite set of preselected fixed values, instead of being randomly generated from scratch for each session. This can save substantial processing time, especially if p′, q′, and R′ are also precomputed for each possible choice of s in the set. If for any reason, cryptographic security is deemed not to be an issue in a given circumstance, the choice of factor s, and hence of p′, q′, and R′, could be a fixed value.
CRT exponents d1 and d2 are computed (step 14) from private key exponent d in the same manner as known in prior versions of CRT-based modular exponentiation, i.e.:

d1:=d (mod (p-1));

d2:=d (mod (q-1)).

If desired, this step could also be conveniently placed before the randomization of p and q, i. e. before step 12. Indeed, since the CRT exponents d1 and d2 are directly related only to the private key values d, p, and q, they can be pre-computed and loaded into the hardware data storage in place of private key exponent d, in step 10, eliminating step 16 from the session computations.

The variable C for the modular exponentiation is loaded (step 18) into data storage accessible by the processing hardware, e.g., into the RAM 12 of FIG. 1. From there it may be transferred as needed to working registers 14 for use by the ALU 10, usually as blocks of known size in accord with a cryptographic program. The variable C typically represents a ciphertext message to be decrypted; but could represent other cryptographic data, such as a digital signature. As with the computation of the CRT exponents d1 and d2, the particular place in the program sequence in which this step occurs can vary, as long as it is available by the time it is needed in step 20.
The CRT steps (steps 20 and 22) are applied, using the transformed moduli p′ and q′ and transformed inverse R′, so as to obtain an intermediate message result M′. In particular, in step 20, CRT message components M1′ and M2′ are computed by the processing hardware in a manner similar to that known from prior CRT-based modular exponentiation operations, but using p′ and q′ as the moduli instead of the original private key modulus values p and q. That is,

M1′:=Cd1 (mod p′); and

M2′:=Cd2 (mod q′).

Then the intermediate message result M′ is computed (in step 22) by the processing hardware from the CRT message components M1′ and M2′ using the Chinese Remainder Theorem:

M′:=M1′+p′·{[(M2′-M1′)·R′] (mod q′)}.

Note that since p′ and q′ are randomized for each decryption session, the values M1′, M2′ and M′ are likewise randomized in each session, thwarting cryptanalysis by known text attacks (e.g., repeated use by an attacker of a known value C) and other cryptanalysis techniques that may rely upon eavesdropping on hardware emitted parameters (EM emissions, time-dependent power consumption, etc.). The computations are different each time in a random way, yet are not much more computationally intensive than the straightforward application of CRT-based modular exponentiation.

The intermediate result M′ has been obtained by applying an adapted CRT formula for CRT(M1′,M2′). Other variant CRT formulae (such as the three examples given in the Background Art section) can be applied instead, if adapted with the appropriate transformations. To transform an initial CRT formula, the general rule is to always set p′:=p·s and q′:=q·s. For all parts of the formula, like R1:=q−1 (mod p) and R2:=p−1 (mod q), we transform to R1′:=(q′)−1 (mod p) and R2′:=(p′)−1 (mod q). If p or q appears as a multiply factor in the formula, change it to p′ or q′, respectively. If p or q appears as a modulus, (mod p) or (mod q), we change it to (mod p′) or (mod q′). For example, the CRT exponents, d1 and d2, are always d1:=d (mod (p-1)) and d2:=d (mod (q-1)). However, the CRT message components M1′ and M2′ are always transformed using p′ and s′ as moduli, per the invention, as described above. Thus, for the three exemplary variants, we obtain:

M′=CRT2′ (m1′,m2′):=(m1′·R1′·q′+m2′·R2′·p′)(mod p′·q′),

M′=CRT3′ (m1′,m2′):={[(m1′·R1′) (mod p′)]·q′+[(m2′·2′) (mod q′)]·p′}(mod p′·q′),

M′=CRT4′(m1′,m2′):=q′·{[(m1′-m2′)·R4′](mod p′)}+m2′.

Once the intermediate message result M′ is obtained, it may be easily reduced to the final message M by a basic modular reduction operation (step 24):

M:=M′(mod(p·q)):=M′(mod n).

This final reduction modulo p·q applies to all variants. Note that the product p·q has previously been computed as part of key generation, and is simply the public key modulus n available to all parties. Thus, it need not be recomputed if n has also been loaded into data storage available to the hardware processor, such as in association with previous step 10. Moreover, since use of the public key modulus n does not reveal anything about the private keys, the final reduction can be computed without random transformations and still be secure from cryptanalysis. The final message M is the same, even though p′, q′, M′, etc. are random, since using a transformed modulus that is a random multiple s of the original modulus produces intermediate results that, while random, are still of the same congruence class as that found by using untransformed moduli.

## Claims

1. A cryptographic method implemented in an electronic processing system for performing modular exponentiation computations, comprising:
loading private key values, including at least one private key exponent and two private key moduli p and q, wherein the two private key moduli are p and q, into a data storage accessible to electronic processing hardware;
selecting, by the electronic processing hardware, a non-random pre modular exponentiation transformation factor to secure cryptographic operations utilizing modular exponentiation from cryptanalysis, wherein the transformation factor is co-prime with the private key moduli;
multiplying, by the electronic processing hardware, the private key moduli by the transformation factor to produce transformed moduli p′ :=p·s and q′ :=q·s, wherein the transformed moduli are p′ and q′ and wherein the transformation factor is s;
loading a first data value into the data storage at any time prior to performing modular exponentiation;
computing, by the electronic processing hardware, at least one transformed inverse value, R′ :=(p′)−1(mod q);
performing, by the electronic processing hardware, a modular exponentiation upon the first data value using the at least one private key exponent and the transformed moduli to obtain an intermediate data value; and
reducing, by the electronic processing hardware, the intermediate data value modulo a product of the two private key moduli to obtain a final data value.

2. The method as in claim 1 wherein the selected transformation factor is a fixed value.

3. The method as in claim 1, wherein performing modular exponentiation is executed using a Chinese Remainder Theorem (CRT) calculation of the intermediate data value.

4. The method as in claim 3, wherein a pair of CRT exponents are computed from a single private key exponent as part of the performing the modular exponentiation.

5. The method as in claim 3, wherein a pair of CRT exponents are pre-computed from a single private key exponent, the pair of CRT exponents being loaded as private key exponents into the data storage.

6. The method as in claim 1, wherein the product of the two private key moduli is pre-computed as a public key modulus, the public key modulus also being loaded into the data storage for subsequent use in the reducing of the intermediate data value.

7. The method as in claim 1, wherein the first data value represents a ciphertext message, the modular exponentiation is executed in the electronic processing hardware as part of a cipher program, and the final data value represents a decrypted plaintext message.

8. A cryptographic method implemented in an electronic processing system for performing modular exponentiation computations, comprising:
loading at least one private key exponent d and two private key moduli p and q, wherein the two private key moduli are p and q, into a data storage accessible to electronic processing hardware;
selecting, by the electronic processing hardware, a non-random pre modular exponentiation transformation factor s to secure cryptographic operations utilizing modular exponentiation from cryptanalysis, wherein the transformation factor is co-prime with the private key moduli;
multiplying, by the electronic processing hardware, the private key moduli by the transformation factor to produce transformed moduli p′ :=p·s and q′ :=q·s, wherein the transformed moduli are p′ and q′;
computing, by the electronic processing hardware, at least one transformed inverse value, R′ :=(p′)−1(mod q);
loading a first data value C into the data storage at any time prior to performing modular exponentiation;
performing a modular exponentiation upon the first data value C using the at least one private key exponent d and the transformed moduli p′ and q′ to obtain an intermediate data value M′, wherein performing modular exponentiation is executed by the electronic processing hardware using a Chinese Remainder Theorem (CRT) calculation of the intermediate data value involving:
(a) computing CRT exponents d1 :=d (mod (p−1)) and d2 :=d (mod (q−1)),
(b) computing CRT message components M1 ′:=Cd1 (mod p′) and M2′:=Cd2 (mod q′), and
(c) computing an intermediate data value M′ from the CRT message components M1and M2′; and reducing, by the electronic processing hardware, the intermediate data value M′ modulo a product of the two private key moduli, n =p·q, to obtain a final data value M :=M′ (mod n).

9. The method as in claim 8, wherein the CRT exponents are pre-computed from the private key exponent d and loaded as a pair of private key exponents d1 and d2 into the data storage.

10. The method as in claim 8, wherein M′:=M1′+p′·{[(M2′−M1′)·R′](mod q′)}.

11. The method as in claim 8, wherein M′:=(M1′·R1′·q′+M2′·R2′·p′) (mod p′·q′), and R1′:=(q′)−1 (mod p).

12. The method as in claim 8, wherein M′:={[(M1′·R1′) (mod p′)]·q′+[(M2′·R′) (mod q′)]·p′}(mod p′·q′), and R1′:=(q′)−1 (mod p).

13. The method as in claim 8, wherein M′:=q′·{[(M1′−M2′)·R′](mod p′)}+M2′.

14. The method as in claim 8, wherein the product n=p·q is pre-computed and loaded into the data storage for subsequent use during the reducing of the intermediate data value.

15. The method as in claim 8, wherein the first data value represents a ciphertext message, the modular exponentiation is executed in the electronic processing hardware as part of a cipher program, and the final data value represents a decrypted plaintext message.