[go: up one dir, main page]

JP2006091086A - Semiconductor device with montgomery inverse element arithmetic unit, and ic card - Google Patents

Semiconductor device with montgomery inverse element arithmetic unit, and ic card Download PDF

Info

Publication number
JP2006091086A
JP2006091086A JP2004273169A JP2004273169A JP2006091086A JP 2006091086 A JP2006091086 A JP 2006091086A JP 2004273169 A JP2004273169 A JP 2004273169A JP 2004273169 A JP2004273169 A JP 2004273169A JP 2006091086 A JP2006091086 A JP 2006091086A
Authority
JP
Japan
Prior art keywords
integer
montgomery
inverse element
register
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2004273169A
Other languages
Japanese (ja)
Inventor
Takashi Endo
隆 遠藤
Takashi Watanabe
高志 渡邊
Toshio Okochi
俊夫 大河内
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Technology Corp
Original Assignee
Renesas Technology Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Technology Corp filed Critical Renesas Technology Corp
Priority to JP2004273169A priority Critical patent/JP2006091086A/en
Publication of JP2006091086A publication Critical patent/JP2006091086A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To solve the problem that it takes time to perform a multiple-length precision integer operation for calculating a Montgomery inverse element and leak information due to a time difference of processing is generated depending upon an operation result. <P>SOLUTION: By a Montgomery inverse element arithmetic system by conventional technology, the direction of subtraction is determined after multiple-length precision integers are compared with each other, and then an operation is carried out. Namely, it is guaranteed that an intermediate result of the operation is always a positive value, but the multiple-length precision operation can directly be performed without making the large/small comparison by allowing the intermediate result to be a negative value, thereby decreasing the number of operations between multiple-length precision integers. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、モンゴメリ逆元演算装置を搭載した半導体装置に係り、特に機密性の高いICカードなどの耐タンパ装置の暗号処理に関するものである。   The present invention relates to a semiconductor device equipped with a Montgomery inverse arithmetic unit, and particularly relates to cryptographic processing of a tamper resistant device such as a highly confidential IC card.

暗号処理では、多倍長精度の剰余乗算を含み、処理時間の多くが剰余乗算に費やされている。多倍長精度の剰余乗算を行なう方法としては、計算途上でコストの大きい割り算を計算することなしに剰余乗算を行える、モンゴメリ剰余乗算が用いられることが多い。したがって、逆元を計算する際にも逆元を直接モンゴメリ表現上で計算する方法として、ユークリッド互除法 によるモンゴメリ型逆元(E.Savas、 C. K. Koc、 "The Montgomery Modular Inverse - Revised"、 IEEE Transactions on COMPUTERS、 VOL.49、 NO.7、 JULY 2000)が提案されている。図1、図2は従来手法による拡張ユークリッド互除法を用いたモンゴメリ型逆元計算のアルゴリズムである。
ユークリッド互除法によるモンゴメリ方逆元計算方式では、法をa、逆元を計算したい値をbとすると、k=0、p=1、r=0、u=a、q=0、s=1、v=bを初期値として、
Cryptographic processing includes multiple multiplication precision remainder multiplication, and much of the processing time is spent on remainder multiplication. As a method of performing multi-precision precision multiplication, Montgomery modular multiplication is often used in which modular multiplication can be performed without calculating a high-cost division during calculation. Therefore, the Montgomery type inverse element by Euclidean algorithm (E.Savas, CK Koc, "The Montgomery Modular Inverse-Revised", IEEE Transactions) on COMPUTERS, VOL.49, NO.7, JULY 2000). 1 and 2 are Montgomery-type inverse element calculation algorithms using the extended Euclidean mutual division method according to the conventional method.
In the Montgomery inverse calculation method using the Euclidean mutual division method, assuming that the modulus is a and the value to calculate the inverse is b, k = 0, p = 1, r = 0, u = a, q = 0, s = 1 , V = b as an initial value,

Figure 2006091086
Figure 2006091086

Figure 2006091086
なる関係がなりたつ。最終的にmod aした値のみが必要なので、式(1)、式(2)の両辺のmod a を取ると、
Figure 2006091086
The relationship becomes. Since only the value that was finally mod a is required, taking the mod a on both sides of Equation (1) and Equation (2),

Figure 2006091086
Figure 2006091086

Figure 2006091086
となる。
初期値からスタートし、uの値が1となるまで繰り返し次の演算を行う。
処理(1) uが偶数であれば、uを右シフトし、kの値を+1する。kが+1された後も式(4)が成り立つように、s←2sとし、処理(5)に移行する。uが偶数で無い場合は、処理(2)へ移行する。
処理(2) vが偶数であれば、vを右シフトし、kの値を+1する。kが+1された後も式(3)が成り立つように、r←2rとすし、処理(4)に移行する。uが偶数で無い場合は、処理(3)へ移行する。
処理(3) 処理(3)にたどり着くのは、u、vの両者が奇数の場合のみである。したがって、u、vの差を計算すると、必ず偶数となる。まず、u>vの場合は、式(4)から式(3)を引き、両辺を2で割った値で、rとuの値を更新する。具体的には、右辺はu←(u−v)/2、左辺はr←r+sとして、2で割る代わりに、k←k+1とする。kが+1された後も、式(4)が成り立つように、s←2sとし、処理(5)に移行する。u>vでない場合は、処理(4)へ移行する。
処理(4) ここにたどり着くのは、u、vが共に奇数で、u≦vの場合のみである。式(3)から式(4)を引き、両辺を2で割った値で、sとvの値を更新する。具体的には、右辺はv←(v−u)/2、左辺はs←s+rとして、2で割る代わりに、k←k+1とする。kが+1された後も、式(3)が成り立つように、r←2rとし、処理(5)に移行する。
処理(5) vの値が0より大きい場合は、処理(1)へ移行する。
以上の処理により、aが奇数で、aとbが互いに素である場合は、v=0になると、必ずu=1となる。処理(1)から処理(4)のいずれかが1回処理されると、uもしくはvの大きさが半分以下になる。しがたって、aのビット数をn、bのビット数をmとすると、最大n+m+1回の計算により、v=0にたどり着く。右辺の計算は、拡張ユークリッド互除法の演算と等価であるので、aとbが互いに素でない場合には、1120でuが1以上の値となり、エラーとなる。u=1では、式(3)は
Figure 2006091086
It becomes.
Starting from the initial value, the next calculation is repeated until the value of u becomes 1.
Process (1) If u is an even number, u is shifted right and the value of k is incremented by one. After k is incremented by 1, s ← 2s is set so that Expression (4) is satisfied, and the process proceeds to the process (5). If u is not an even number, the process proceeds to process (2).
Process (2) If v is an even number, v is shifted to the right and the value of k is incremented by one. Even after k is incremented by 1, r ← 2r is set so that the expression (3) is satisfied, and the process proceeds to the process (4). If u is not an even number, the process proceeds to process (3).
Process (3) Process (3) is reached only when both u and v are odd numbers. Therefore, when the difference between u and v is calculated, it is always an even number. First, when u> v, the value of r and u is updated by subtracting equation (3) from equation (4) and dividing both sides by 2. Specifically, u ← (u−v) / 2 on the right side and r ← r + s on the left side, and k ← k + 1 instead of dividing by 2. Even after k is incremented by 1, s ← 2s is set so that Expression (4) is satisfied, and the process proceeds to processing (5). If u> v is not satisfied, the process proceeds to process (4).
Process (4) The process arrives here only when u and v are both odd and u ≦ v. The value of s and v is updated by subtracting the equation (4) from the equation (3) and dividing both sides by 2. Specifically, the right side is v ← (v−u) / 2 and the left side is s ← s + r, and instead of dividing by 2, k ← k + 1. Even after k is incremented by 1, r ← 2r is set so that Expression (3) is satisfied, and the process proceeds to processing (5).
Process (5) When the value of v is larger than 0, the process proceeds to process (1).
With the above processing, when a is an odd number and a and b are relatively prime, u = 1 is always obtained when v = 0. When any one of the processes (1) to (4) is processed once, the size of u or v becomes half or less. Therefore, assuming that the number of bits of a is n and the number of bits of b is m, v = 0 is reached by a maximum of n + m + 1 calculations. Since the calculation on the right side is equivalent to the operation of the extended Euclidean algorithm, if a and b are not prime, u becomes a value of 1 or more in 1120, and an error occurs. When u = 1, equation (3) becomes

Figure 2006091086
となり、両辺に
Figure 2006091086
And on both sides

Figure 2006091086
を掛けると、
Figure 2006091086
Multiply

Figure 2006091086
を得る。モンゴメリ型逆元で求めたいのは、
Figure 2006091086
Get. What we want to find with the Montgomery inverse

Figure 2006091086
であるので、図2に示される処理フローにより、補正を行う。
まず
Figure 2006091086
Therefore, correction is performed according to the processing flow shown in FIG.
First

Figure 2006091086
を乗じ、
Figure 2006091086
Multiplied by

Figure 2006091086
を得る。
具体的には、(k−n)回右シフトを行うことにより、式(8)を乗じる。右シフトを行う際に、値が偶数の場合は、最下位ビットが0であるので、右シフトをそのまま行えるが、値が奇数の場合は、最下位ビットが1であるので、右シフトをそのまま行うことはできないため、aを加算して偶数にした後、右シフトを行う。モンゴメリ逆元補正処理の処理フロー図2に示す。2020でループカウンタを設定し、2030でループカウンタのチェックを行う。2040、2050、2060の処理は、rの値を右シフトするための処理で、右シフト可能なように、奇数の場合は法aを加算して、偶数に変換する。k−n回右シフトを行う。 最後に、符号を反転させるためにaから式(9)を引き、
Figure 2006091086
Get.
Specifically, the equation (8) is multiplied by performing a right shift (k−n) times. When performing a right shift, if the value is an even number, the least significant bit is 0, so the right shift can be performed as it is. However, if the value is an odd number, the least significant bit is 1, so the right shift is performed as it is. Since it cannot be performed, right shift is performed after adding a to an even number. FIG. 2 shows a processing flow of Montgomery inverse element correction processing. The loop counter is set at 2020, and the loop counter is checked at 2030. The processes 2040, 2050, and 2060 are processes for shifting the value of r to the right, and in the case of an odd number, the modulus a is added and converted into an even number so that the value can be shifted to the right. Shift right kn times. Finally, subtract equation (9) from a to reverse the sign,

Figure 2006091086
を得る。図2では、2080でこの処理が行われる。
Figure 2006091086
Get. In FIG. 2, this processing is performed at 2080.

特開平10−207689号公報Japanese Patent Laid-Open No. 10-207689 "The Montgomery Modular Inverse - Revisited"、IEEE Transactions on COMPUTERS、 VOL.49、 NO.7、 JULY 2000"The Montgomery Modular Inverse-Revisited", IEEE Transactions on COMPUTERS, VOL.49, NO.7, JULY 2000

RSAやECCに代表される公開鍵暗号系では、有限要素体上での演算により暗号処理を行っている。暗号処理では、パラメータのうちの一部を秘密情報として、入力値に対して出力値を計算する。たとえば、RSA暗号では、復号化式
M=Cd mod N
を計算することで、暗号文Cを平文Mに変換できるが、この式のうち、指数のdが秘密情報であり、このdの値が知られてしまうと、RSA暗号では、Nは公開カギの一部であるため、誰でもが復号化式を用いて暗号Cを平文Mに戻すことが出来てしまう。また、Nは2つの大きな素数p,qの積であることを利用して、演算を高速化する方法として、CRT(Chinese Remainder Theorem)演算による高速化手法が知られている。CRT演算では、モジュロN上の演算を、モジュロpおよびモジュロqの演算に分けて計算し、最後に2つの演算結果を合成することで、モジュロN上の演算と同じ結果を得る。RSAの公開指数をeとすると、秘密指数dは、dp=e-1 mod (p-1) およびdq=e-1 mod (q-1)に分割されて計算される。
In public key cryptosystems represented by RSA and ECC, cryptographic processing is performed by computation on a finite element field. In the cryptographic process, an output value is calculated for an input value using a part of the parameters as secret information. For example, in RSA encryption, the decryption formula
M = C d mod N
The ciphertext C can be converted into plaintext M by calculating, but in this formula, the exponent d is secret information, and if the value of this d is known, in RSA cryptography, N is the public key. Therefore, anyone can return the cipher C to the plaintext M using the decryption formula. Further, as a method for speeding up the operation by utilizing the fact that N is a product of two large prime numbers p and q, a speed-up method using CRT (Chinese Remainder Theorem) is known. In the CRT operation, the operation on the modulo N is divided into the operation of the modulo p and the modulo q, and finally the two operation results are combined to obtain the same result as the operation on the modulo N. When the public exponent of RSA is e, the secret exponent d is calculated by being divided into d p = e −1 mod (p−1) and d q = e −1 mod (q−1).

暗号文Cをそのまま演算に用いる実装の場合は、多くのビットが0で一部のビットのみが1となるように特別に選んだ暗号文Cを入力した場合、演算時の消費電流を観測することで、秘密指数dpおよびdqの推測が可能となる。逆元の定義と、秘密指数dpがp-1以下であることから、1<k≦e なる自然数kにより、
edp=(p-1)k+1
であり、kpについて解くと、
kp=edp+k-1
となる。Nの値は、素数p,qの積であるので、gcd(edp+k-1,N) をkの値を1からeまで変えながら計算すると、gcdの値が1以外の場合に、pが得られ、qの値も q = N / p から簡単に求まり、その結果
d = e-1 mod (p-1)(q-1)
より秘密鍵が分かってしまう。こうしたアタックを防ぐために、乱数rを用意し、
Cp=C mod p
の代りに、
Cpre mod p
を用いて計算し、最後にrの影響を取り除くために、
r-1 mod p
を乗じるという対策手法がある。r-1 mod p を計算する過程で、pが推定できると、結局は秘密鍵dが演算できてしまう。逆元を演算する方法としては、一般に拡張ユークリッド互除法を用いた手法が使われるが、拡張ユークリッド互助法演算では、演算終了時の内部状態が既知であるため、そこに至るまでの演算過程が既知となった場合、法の値が逆算できてしまう。r-1 mod pの場合、法の値がpは推定できることを意味する。
したがって、拡張ユークリッド互助法、および拡張ユークリッド互助法を拡張したアルゴリズムにおいては、演算の手順を外部から隠すことがセキュリティ上重要となる。
In the case of an implementation that uses ciphertext C as it is for computation, if ciphertext C that is specially selected so that many bits are 0 and only some bits are 1 is observed, current consumption during computation is observed. Thus, the secret indices d p and d q can be estimated. Since the definition of the inverse element and the secret exponent d p is less than or equal to p-1, the natural number k such that 1 <k ≦ e
ed p = (p-1) k + 1
And solving for kp,
kp = ed p + k-1
It becomes. Since the value of N is the product of the prime numbers p and q, gcd (ed p + k-1, N) is calculated while changing the value of k from 1 to e, and when the value of gcd is other than 1, p is obtained, and the value of q can be easily obtained from q = N / p.
d = e -1 mod (p-1) (q-1)
I know the secret key more. In order to prevent such an attack, a random number r is prepared,
C p = C mod p
Instead of
C p r e mod p
To calculate and finally remove the effect of r,
r -1 mod p
There is a countermeasure technique of multiplying by. If p can be estimated in the process of calculating r −1 mod p, the secret key d can be calculated after all. As a method of computing the inverse element, a method using the extended Euclidean mutual division method is generally used. However, in the extended Euclidean mutual aid method, since the internal state at the end of the calculation is known, the calculation process up to that is If known, the modulo value can be calculated backwards. In the case of r -1 mod p, it means that the modulus value p can be estimated.
Therefore, in the extended Euclidean mutual assistance method and the algorithm obtained by extending the extended Euclidean mutual assistance method, it is important for security to hide the operation procedure from the outside.

従来技術によるモンゴメリ逆元演算方式では、大きなビット長のuとvの大小を比較した後、判定結果によりu−vもしくはv−uのいずれか片方を計算する必要がある。uとvの大小比較を行うには、多倍長精度整数同士の減算を行う必要があり、uとvの大小関係判定後、u≦vであることが判明した場合は、v−uを計算しなおすか、計算結果の符号を反転する必要がある。u−vもしくはu−vを計算するステップでは、uとvの両方が奇数となるため、u−vの値は偶数となる。偶数の値の符号反転を行う場合、必ずキャリーの伝播が発生するため、高速に演算することが難しい。また、高速化のためにu−vを計算し、必要に応じて符号反転処理を行う場合、vとuの大小関係により、演算時間に差が出る。この差がリーク情報となり、秘密情報が推定できる。また、多倍長精度整数の加算器と減算器の両方が必要となる。   In the Montgomery inverse operation method according to the prior art, it is necessary to calculate either u−v or v−u based on the determination result after comparing the size of u and v having a large bit length. In order to compare the magnitudes of u and v, it is necessary to subtract multiple precision integers. If it is determined that u ≦ v after determining the magnitude relationship between u and v, v− It is necessary to recalculate or to reverse the sign of the calculation result. In the step of calculating uv or uv, since u and v are both odd numbers, the value of uv is an even number. When sign inversion of even values is performed, carry propagation always occurs, so that it is difficult to calculate at high speed. Further, when uv is calculated for speeding up and sign inversion processing is performed as necessary, there is a difference in calculation time due to the magnitude relationship between v and u. This difference becomes leak information, and secret information can be estimated. In addition, both an adder and a subtracter for multiple precision integers are required.

従来技術によるモンゴメリ逆元演算方式では、中間結果のu、vが常に正の値となることを保証するためにuとvの大小を比較している。モンゴメリ型逆元演算では、uもしくはvの偶数・奇数が重要な情報となるが、負の値であっても、偶数・奇数の判定は最下位ビットのみで正の値の時と同様に判別できる。したがって、v−uは計算せずに、常にu−vを計算し、結果が負になった場合は、次にu−vを計算する際に補正を行う。本発明の改良型モンゴメリ逆元演算方式では、vの値が負になることを許容することで、uとvの大小判定を、vの値の符号のチェック処理に置き換えることができる。符号の判定は、最上位ビットのみを検査することで判定できるため、減算を必要とする大小比較よりも大幅に計算量を削減可能となる。真のvの値はvの絶対値と等しい。
また、vの最上位ビットの判定後に行われる処理は、判定結果にかかわらずほぼ同一の演算を行うため、リーク情報はきわめて小さくなる。
また、モンゴメリ逆元として、最終的に必要な値は
In the Montgomery inverse operation method according to the prior art, the magnitudes of u and v are compared in order to ensure that the intermediate results u and v are always positive values. In Montgomery-type inverse element operation, even or odd numbers of u or v are important information. Even if they are negative values, even / odd numbers are determined by only the least significant bit as well as positive values. it can. Therefore, uv is not calculated, but uv is always calculated. If the result is negative, correction is performed when uv is next calculated. In the improved Montgomery inverse operation method of the present invention, it is possible to replace the determination of u and v with the sign of the value of v by allowing the value of v to be negative. Since the code can be determined by examining only the most significant bit, the amount of calculation can be greatly reduced as compared with a size comparison that requires subtraction. The true value of v is equal to the absolute value of v.
Further, since the processing performed after the determination of the most significant bit of v performs almost the same calculation regardless of the determination result, the leak information becomes extremely small.
As the Montgomery inverse, the final required value is

Figure 2006091086
であるが、従来技術によるモンゴメリ逆元演算では、
Figure 2006091086
However, in the Montgomery inverse operation according to the prior art,

Figure 2006091086
を求めた後に、
Figure 2006091086
After asking for

Figure 2006091086
を計算して、
Figure 2006091086
To calculate

Figure 2006091086
を求めている。s、rについても負の値を取ることを容認すると、直接
Figure 2006091086
Seeking. Accepting negative values for s and r, directly

Figure 2006091086
が求められるようになる。
従来技術によるモンゴメリ逆元演算では、ここで得られるrの値は、
0<r<2a
であるので、a以下になるように、
a≦r
である場合は、
r←r−a
を計算する。一方、s、rに負の値を容認した場合、式(3)、式(4)のbを(−b)に置き換え、式(3)を
Figure 2006091086
Will be required.
In the Montgomery inverse operation according to the prior art, the value of r obtained here is
0 <r <2a
So, so that it is below a,
a ≦ r
If
r ← r−a
Calculate On the other hand, if negative values are accepted for s and r, b in equation (3) and equation (4) is replaced with (−b), and equation (3) is

Figure 2006091086
とおき、式(4)を
Figure 2006091086
And formula (4)

Figure 2006091086
とし、式(17)、式(18)が成り立つように、rとsの初期値をそれぞれ、符号を反転し、
r=−0=0
s=−1
とする。u=1と成ったとき、式(17)は、
Figure 2006091086
And the signs of the initial values of r and s are reversed so that the equations (17) and (18) hold,
r = −0 = 0
s = -1
And When u = 1, equation (17) becomes

Figure 2006091086
となるので、rの値は、
Figure 2006091086
Therefore, the value of r is

Figure 2006091086
となる。また、rやsの値は、常に直前のr、sを2倍にした値であるか、sとrを加算した値であるので、必ず負の値になり、値の範囲は、
−2a<r<0
となる。この値を0≦r<aとするには、まず
r←r+a
の補正を行い、さらに補正後も
r<0
である場合に、
r←r+a
をもう一度計算する。従来技術によるモンゴメリ逆元の最後で、オーバーフローをチェックするための大小判定が必ず必要なのと同様、本発明でも
r←r+a
の補正が必須であるため、計算量的にはほぼ等価であるが、本発明では加算のみで補正が出来るという利点がある。すなわち、s、rについて負の値を認める場合、多倍長精度整数演算器としては加算器のみがあれば、逆元計算が実現できる。
Figure 2006091086
It becomes. Also, the values of r and s are always values obtained by doubling the preceding r and s, or are values obtained by adding s and r, so they are always negative values.
-2a <r <0
It becomes. In order to make this value 0 ≦ r <a, first, r ← r + a
And after the correction r <0
If
r ← r + a
Calculate again. In the present invention, r ← r + a is the same as the determination of the magnitude for checking the overflow is always required at the end of the Montgomery inverse by the prior art.
However, the present invention has an advantage that the correction can be performed only by addition. That is, when negative values are recognized for s and r, the inverse element calculation can be realized if there is only an adder as the multiple precision integer arithmetic unit.

本発明によれば、リーク情報が少なく、高速なモンゴメリ型逆元演算ハードウエアと、モンゴメリ型逆元演算ソフトウエアが実現できる。   According to the present invention, it is possible to realize Montgomery-type inverse element calculation hardware and Montgomery-type inverse element calculation software with a small amount of leak information.

図3は本発明の一実施例を示す。法をaとして、bのモンゴメリ型逆元を計算する場合、図3の処理が3190に達すると、     FIG. 3 shows an embodiment of the present invention. When the modulo is a and the Montgomery inverse of b is calculated, when the processing of FIG.

Figure 2006091086
が得られる。処理の流れは従来技術によるモンゴメリ逆元演算とは、uおよびvが奇数である場合の処理が異なる。図2では、3300で囲われた処理に相当する。本発明では、常に(u−v)/2を計算し、結果が正の値の場合は、結果をuに格納し、結果が負の場合は、結果をvに格納する。常に(u−v)/2を計算するので、vの値が正の場合はそのまま(u−v)/2を計算するが、vの値が負の場合は、減算ではなく、加算を行う。従来技術によるモンゴメリ逆元演算との違いは、vの値に負の値が現れるか否かだけであり、vの値が負数になった場合でも、絶対値を計算すれば、従来技術によるモンゴメリ逆元計算で現れる値と同一の値となる。
また、vの値自体は、モンゴメリ演算の終了判定のみで用いるので、負の値を格納しても問題にならない。
Figure 2006091086
Is obtained. The processing flow is different from the Montgomery inverse operation according to the prior art in the case where u and v are odd numbers. In FIG. 2, this corresponds to the process surrounded by 3300. In the present invention, (u−v) / 2 is always calculated, and if the result is a positive value, the result is stored in u, and if the result is negative, the result is stored in v. Since (u−v) / 2 is always calculated, if the value of v is positive, (u−v) / 2 is calculated as it is. However, if the value of v is negative, addition is performed instead of subtraction. . The only difference from the Montgomery inverse operation according to the prior art is whether or not a negative value appears in the value of v. Even when the value of v becomes a negative number, if the absolute value is calculated, This is the same value that appears in the inverse calculation.
Further, since the value of v is used only for the end determination of the Montgomery calculation, it does not matter if a negative value is stored.

図3の実施例の3300の部分をハードウエアで実装した場合の実施例を図5および図7に示す。   FIG. 5 and FIG. 7 show an embodiment in which the portion 3300 of the embodiment of FIG. 3 is implemented by hardware.

図5は本発明の一実施例であり、図3の処理フローのうちの3300の処理を回路化した実施例である。図3の3080の処理は5010に格納されているvの値の最上位ビットを検査することでvが負数であるかを判定し、uとvの加算を行うのか、減算を行うのかをALU5040に伝える。5040では、5030の信号に従って演算の種類を決定し、5060の算術右シフタで右に1ビット算術シフトする。   FIG. 5 shows an embodiment of the present invention, which is an embodiment in which the processing of 3300 in the processing flow of FIG. The processing of 3080 in FIG. 3 determines whether v is a negative number by checking the most significant bit of the value v stored in 5010, and determines whether u and v are added or subtracted. To tell. In 5040, the type of operation is determined in accordance with the signal 5030, and the arithmetic right shifter 5060 shifts the value by 1 bit to the right.

ここで、算術シフトを用いるのは、シフト対象の値が負の値を取りうるからである。従来技術によるモンゴメリ型逆元演算方法では、図4に示す様(図1の1300の回路化)、つねにu、vが正の値になるように制御しているので、単純なロジカルシフタでシフトすることが可能であるが、本発明では負数が入力される可能性があり、符号フラグ(MSB)を保存する必要がある。得られた演算結果は、一旦uやvとは異なる記憶手段w(5070)に格納される。uとvのいずれにwの値を格納すべきかは、wの値が正の値か、ゼロもしくは負の値であるかに依存する。5080のOR回路により、wの値がゼロもしくは負の値であるときにはwをv側に保存するように、セレクタ5100を制御する。   Here, the arithmetic shift is used because the value to be shifted can take a negative value. In the Montgomery-type inverse element calculation method according to the prior art, as shown in FIG. 4 (circuitization of 1300 in FIG. 1), since u and v are always controlled to be positive values, shifting is performed with a simple logical shifter. However, in the present invention, a negative number may be input, and it is necessary to save a sign flag (MSB). The obtained calculation result is temporarily stored in a storage means w (5070) different from u and v. Whether to store the value of w in u or v depends on whether the value of w is a positive value, zero, or a negative value. The selector 5100 is controlled by the OR circuit 5080 to store w on the v side when the value of w is zero or negative.

図6に、u=u−vを計算する代わりに、(−v)を計算して、加算器のみでu−vを計算する際の、(−v)の項を計算する方法に関する説明図を示す。vの値は図3の3300の部分を実行する場合は、常に奇数の値になる。これは、vもしくはuの値が偶数ある間は、3200の点線で囲われた部分のみが実行され、3300の点線で囲われた部分は、uおよびvが両方とも奇数になったときに初めて実行されるからである。   FIG. 6 is an explanatory diagram relating to a method of calculating the term (−v) when calculating (−v) instead of calculating u = u−v and calculating u−v using only the adder. Indicates. The value of v is always an odd number when the portion 3300 in FIG. 3 is executed. This is done only when the v or u value is even, and only the part enclosed by the 3200 dotted line is executed, and the part enclosed by the 3300 dotted line is the first time when both u and v are odd. This is because it is executed.

奇数の符号反転の処理では、キャリーの伝播は発生しない。符号反転処理では、すべてのビットを反転させ、+1を行うが、奇数の値のビットをすべて反転させると、最下位ビットは常に0になる。したがって、+1を行う際にも繰り上がりは発生しない。   In odd sign inversion processing, carry propagation does not occur. In the sign inversion process, all the bits are inverted and +1 is performed. However, when all the odd-numbered bits are inverted, the least significant bit is always 0. Therefore, no carry occurs even when +1 is performed.

図7は、図3の3300の部分の処理を図6の符号反転方式を用いて実現したモンゴメリ逆元計算装置の実施例である。7030で、最上位のビットを反転し、その結果を7040の排他的論理回路により、vの最下位ビット以外のビットとxorを演算する。この回路の意図は、vの値が負の場合は、vの値をそのまま加算器7060に送り、uとの和を計算することで、(u−v)を計算し、vの値が非負の場合は、7030の出力は1となるため、7040の排他的論理回路により、vの最下位ビット以外のビットを反転させる。非負の値のvの符号を反転し、−vとして加算器7060に送り、uとの和を計算することで、(u−v)を計算することになる。(u−v)の計算結果は算術右シフタ7080により1ビット右に算術シフトされ、(u−v)/2がwに格納される。   FIG. 7 shows an embodiment of the Montgomery inverse element calculation apparatus that realizes the processing of the portion 3300 in FIG. 3 by using the sign inversion method in FIG. At 7030, the most significant bit is inverted, and the result is subjected to xor with bits other than the least significant bit of v by the exclusive logic circuit of 7040. The intention of this circuit is that when the value of v is negative, the value of v is sent as it is to the adder 7060 and the sum with u is calculated to calculate (u−v), and the value of v is non-negative. In this case, since the output of 7030 is 1, bits other than the least significant bit of v are inverted by the exclusive logic circuit of 7040. (U−v) is calculated by inverting the sign of v of a non-negative value, sending it as −v to the adder 7060, and calculating the sum with u. The calculation result of (uv) is arithmetically shifted to the right by 1 bit by the arithmetic right shifter 7080, and (uv) / 2 is stored in w.

図8は、図1および図2に示される従来技術によるモンゴメリ逆元演算方式により、a=23を法として、b=17に対して、ビット長n=5のモンゴメリ逆元を求める際の、中間結果を示す。図8の8010は、図1および図2の符号に相当する。最終的な結果は、rに格納され、   FIG. 8 shows a case where a Montgomery inverse element having a bit length n = 5 is obtained for b = 17 using a Montgomery inverse element operation method according to the prior art shown in FIGS. Intermediate results are shown. 8010 in FIG. 8 corresponds to the reference numerals in FIGS. The final result is stored in r,

Figure 2006091086
が得られる。
Figure 2006091086
Is obtained.

図9は、本発明の実施例である、図3および図2の処理フローにより、a=23を法として、b=17に対して、ビット長n=5のモンゴメリ逆元を求める際の、中間結果である。従来技術によるモンゴメリ逆元計算の図8と比べて、vの値が負になる事を除いて、同じ中間結果および最終結果が得られる。   FIG. 9 is an embodiment of the present invention, and when the Montgomery inverse of bit length n = 5 is obtained for b = 17 using a = 23 as the modulo by the processing flow of FIGS. 3 and 2. Intermediate result. Compared to FIG. 8 of the Montgomery inverse calculation according to the prior art, the same intermediate result and final result are obtained except that the value of v becomes negative.

図10及び図11は、本発明の実施例のフローを示す。実施例1との違いは、10020で初期値として、s=0の代わりにs=−1を代入している点である。
その結果、図10のフローが10170に達したときには、rには、
k>nであり、最終的に
10 and 11 show the flow of the embodiment of the present invention. A difference from the first embodiment is that s = −1 is substituted for s = 0 as an initial value in 10020.
As a result, when the flow of FIG.
k> n and finally

Figure 2006091086
を得るためには、図11に示される改良版モンゴメリ型逆元補正処理を行う。図11に示される改良版モンゴメリ逆元補正処理は、図2の従来技術によるモンゴメリ逆元補正処理とは、最後に結果の符合を反転するための2080の処理がない点が異なる。
Figure 2006091086
Is obtained, the improved Montgomery-type inverse element correction process shown in FIG. 11 is performed. The improved Montgomery inverse element correction process shown in FIG. 11 differs from the Montgomery inverse element correction process according to the prior art of FIG. 2 in that there is no 2080 process for inverting the sign of the result.

図12は、図10、図11のフローにしたがってa=23を法として、b=17に対して、ビット長n=5のモンゴメリ逆元を求める際の、中間結果である。2080に相当する処理なしに、最終結果が得られている。   FIG. 12 shows an intermediate result when a Montgomery inverse element having a bit length n = 5 is obtained for b = 17 with a = 23 modulo according to the flow of FIGS. 10 and 11. The final result is obtained without the processing corresponding to 2080.

図10、図11の実施例の特徴は、多倍長精度整数演算が加算器のみで済む点が特徴である。したがって、ソフトウエアで多倍長演算をインプリメントする場合、演算の種類が1種類であるので、同じルーチンで演算が可能となり、たとえばリーク情報から現在演算に用いているプログラムのコードのアドレスを攻撃者が区別できる場合でも、演算の種類によるリークが生じない。また、ハードウエア実装を行う場合でも、多倍長精度整数の演算器が加算器のみで済むため、ハードウエアの規模が小さくなる。   A feature of the embodiments of FIGS. 10 and 11 is that the multiple precision integer operation only requires an adder. Therefore, when implementing multiple-precision arithmetic in software, since there is only one type of operation, it is possible to perform the operation in the same routine. For example, the attacker can specify the address of the code of the program currently used for the operation from leak information. Even if they can be distinguished, there is no leakage due to the type of operation. Even when hardware is implemented, the scale of the hardware is reduced because the arithmetic unit for multiple precision integers is only an adder.

図13(A)−(C)は従来技術の一実施例であり、図1の処理フローを回路化した実施例である。1030のフローに従い、以下の処理をvが0より大きい間、行う。まず、図13(A)において、uの最下位ビットが0であれば、セレクタ13040はuの値を選択し、セレクタ13070はセレクタ13040の出力を選択するように設定され、右シフタ13080により1/2に変換された値が、セレクタ13130をとおり、u記憶手段13020に格納され、図13(C)に示すように、sの値は、セレクタ13150によりsの値がセレクトされ、左シフタ13160を通り、セレクタ13120を通って、s記憶手段13230に格納される。   FIGS. 13A to 13C show an embodiment of the prior art, which is an embodiment in which the processing flow of FIG. 1 is made into a circuit. According to the flow 1030, the following processing is performed while v is greater than zero. First, in FIG. 13A, if the least significant bit of u is 0, the selector 13040 selects the value of u, the selector 13070 is set to select the output of the selector 13040, and the right shifter 13080 sets 1 The value converted to / 2 is stored in the u storage unit 13020 through the selector 13130. As shown in FIG. 13C, the value of s is selected by the selector 13150, and the left shifter 13160 is selected. Through the selector 13120 and stored in the s storage unit 13230.

図13(A)において、vの最下位ビットが0の場合は、セレクタ13040はvの値を選択し、セレクタ13070はセレクタ13040の出力を選択するように設定され、右シフタ13080により1/2に変換された値が、セレクタ13130をとおり、v記憶手段13010に格納され、図13(C)に示すように、rの値は、セレクタ13150によりsの値がセレクトされ、左シフタ13160を通り、セレクタ13110を通って、r記憶手段13220に格納される。図13(A)において、uおよびvの最下位ビットがいずれも1の場合は、比較回路13030により比較され、u>vの場合は、セレクタ13050はuを選択し、セレクタ13060はvを選択し、減算回路13170はu−vを計算し、セレクタ13070が減算回路13170の出力を選択することで、右シフタ13080は(u−v)/2を出力し、セレクタ13130は出力としてu記憶手段13020側を選択し、u記憶手段13020のuの値が更新され、図13(C)に示すように、加算器13140によりr+sが計算され、左シフタ13160により2倍された後、セレクタ13110を通じて、r記憶手段13220のrの値を更新したのち、セレクタ13150がsの値を選択し、左シフタ13160により値が2倍され、セレクタ13120を通じて、s記憶手段13230のsの値が更新される。   In FIG. 13A, when the least significant bit of v is 0, selector 13040 selects the value of v and selector 13070 is set to select the output of selector 13040. The value converted into is stored in the v storage means 13010 through the selector 13130. As shown in FIG. 13C, the value of r is selected as the value of s by the selector 13150 and passes through the left shifter 13160. And stored in the r storage means 13220 through the selector 13110. In FIG. 13A, when the least significant bits of u and v are both 1, they are compared by the comparison circuit 13030. When u> v, the selector 13050 selects u and the selector 13060 selects v. The subtraction circuit 13170 calculates uv, and the selector 13070 selects the output of the subtraction circuit 13170, so that the right shifter 13080 outputs (u−v) / 2, and the selector 13130 outputs u storage means. 13020 side is selected, the value of u in u storage means 13020 is updated, r + s is calculated by adder 13140 and doubled by left shifter 13160 as shown in FIG. After updating the value of r in the r storage means 13220, the selector 13150 selects the value of s, and the value is changed by the left shifter 13160. Is multiplied, via a selector 13120, the value of s for s storage means 13,230 is updated.

図13(A)において、u≦vの場合は、セレクタ13050はvを選択し、セレクタ13060はuを選択し、減算回路13170はv−uを計算し、セレクタ13070は減算回路13170の出力を選択することで、右シフタ13080は(v−u)/2を出力し、セレクタ13130は出力としてv記憶手段13010側が選択し、v記憶手段13010のvの値が更新され、図13(C)に示すように、加算器13140によりr+sが計算され、左シフタ13160により2倍された後、セレクタ13120を通じて、s記憶手段13230のsの値を更新したのち、セレクタ13150がrの値を選択し、左シフタ13160により値が2倍され、セレクタ13110を通じて、r記憶手段の13220sの値が更新される。その後、図13(B)に示すように、加算器13100によりk記憶手段13090に格納されたkの値に1が加算されて、k記憶手段13090に格納される。   In FIG. 13A, when u ≦ v, the selector 13050 selects v, the selector 13060 selects u, the subtraction circuit 13170 calculates v−u, and the selector 13070 outputs the output of the subtraction circuit 13170. By selecting, the right shifter 13080 outputs (v−u) / 2, the selector 13130 selects the output as the v storage means 13010 side, the value of v in the v storage means 13010 is updated, and FIG. As shown in FIG. 6, after the adder 13140 calculates r + s and doubles it by the left shifter 13160, the selector 13150 updates the value of s in the s storage unit 13230 through the selector 13120, and then the selector 13150 selects the value of r. The value is doubled by the left shifter 13160, and the value of 13220s of the r storage means is updated through the selector 13110. Thereafter, as shown in FIG. 13B, 1 is added to the value of k stored in the k storage unit 13090 by the adder 13100 and the result is stored in the k storage unit 13090.

図14は、本発明になるモンゴメリ逆演算装置が内蔵されたICカード用チップ14020を搭載したICカード14010を示す。   FIG. 14 shows an IC card 14010 on which an IC card chip 14020 having a built-in Montgomery inverse operation device according to the present invention is mounted.

図15は、図14に示すICカード用チップのシステムブロック図15010の一例である。なお、このシステムブロックは、CPU15020と、記憶手段であるROM15030、RAM15040およびEEPROM15050と、剰余乗算コプロセッサ15060並びにシリアル通信回路15070から構成されている。   FIG. 15 is an example of a system block diagram 15010 of the IC card chip shown in FIG. This system block includes a CPU 15020, a ROM 15030, a RAM 15040, and an EEPROM 15050 as storage means, a remainder multiplication coprocessor 15060, and a serial communication circuit 15070.

従来技術によるモンゴメリ型逆元計算手順を示す図。The figure which shows the Montgomery type | mold inverse element calculation procedure by a prior art. 従来技術によるモンゴメリ型逆元計算で用いられる補正処理手順を示す図。The figure which shows the correction | amendment process procedure used by the Montgomery type | mold inverse element calculation by a prior art. 本発明のモンゴメリ型逆元計算手順の一実施例を示す図。The figure which shows one Example of the Montgomery type | mold inverse element calculation procedure of this invention. 従来技術によるモンゴメリ型逆元計算回路図。The Montgomery type inverse element calculation circuit diagram by a prior art. 本発明のモンゴメリ型逆元計算回路の一実施例を示す図。The figure which shows one Example of the Montgomery type | mold inverse element calculation circuit of this invention. 符号反転方式の説明図。Explanatory drawing of a sign inversion system. 本発明のモンゴメリ型逆元計算回路の一実施例を示す図。The figure which shows one Example of the Montgomery type | mold inverse element calculation circuit of this invention. 従来技術によるモンゴメリ型逆元計算の内部変数の推移図。Transition diagram of internal variables of Montgomery type inverse element calculation according to the prior art. 本発明のモンゴメリ型逆元計算の内部変数の推移図。The transition figure of the internal variable of the Montgomery type inverse element calculation of this invention. 本発明のモンゴメリ型逆元計算手順の一実施例を示す図。The figure which shows one Example of the Montgomery type | mold inverse element calculation procedure of this invention. 本発明のモンゴメリ型逆元計算手順の一実施例を示す図。The figure which shows one Example of the Montgomery type | mold inverse element calculation procedure of this invention. 本発明のモンゴメリ型逆元計算の内部変数の推移図。The transition figure of the internal variable of the Montgomery type inverse element calculation of this invention. 従来技術によるモンゴメリ型逆元計算回路のu、v計算回路図。The u, v calculation circuit diagram of the Montgomery type inverse element calculation circuit by a prior art. 従来技術によるモンゴメリ型逆元計算回路のk計算回路図。The k calculation circuit diagram of the Montgomery type inverse element calculation circuit by a prior art. 従来技術によるモンゴメリ型逆元計算回路のr、s計算回路図。The r, s calculation circuit diagram of the Montgomery type inverse element calculation circuit by a prior art. ICカードを示す図。The figure which shows IC card. ICカード用チップのシステムブロック図。The system block diagram of the chip | tip for IC cards.

符号の説明Explanation of symbols

1010…モンゴメリ逆元演算処理開始ポイント、
1020…内部変数初期化処理、
1030…終了判定処理、
1040…uの偶数判定、
1050…uが偶数の場合のuおよびsの更新処理、
1060…vの偶数判定、
1070…vが偶数の場合のvおよびrの更新処理、
1080…uとvの大小判定、
1090…u>vの場合のu、r、sの更新処理、
1100…u≦vの場合のv、s、rの更新処理、
1110…2のベキの更新、
1120…逆元の存在判定、
1130…エラー終了ポイント、
1140…オーバーフロー補正の必要性判定、
1150…オーバーフロー補正処理、
1160…処理終了ポイント、
2010…モンゴメリ逆元補正処理開始ポイント、
2020…ループカウンタ初期化、
2030…ループ終了判定、
2040…奇数判定、
2050…奇数から偶数への補正処理、
2060…結果を2で割る処理、
2070…ループカウンタ更新、
2080…符号反転処理、
2090…処理終了ポイント、
3010…改良版モンゴメリ逆元処理開始ポイント、
3020…内部変数初期化処理、
3030…逆元計算判定処理、
3040…uの偶数判定、
3050…uが偶数の場合のuおよびsの更新処理、
3060…vの偶数判定、
3070…vが偶数の場合のvおよびrの更新処理、
3080…vの符号判定、
3090…vが非負の場合のwの計算処理、
3100…vが負の場合のwの計算処理、
3110…wの符号判定処理、
3120…wが正の値の場合のu、r、sの更新処理、
3130…wがゼロもしくは負の値の場合のv、r、sの更新処理、
3140…2のベキの更新、
3150…逆元の存在判定、
3160…エラー終了ポイント
3170…オーバーフロー補正の必要性判定、
3180…オーバーフロー補正処理、
3190…処理終了ポイント、
4010…v記憶手段、
4020…u記憶手段、
4030…キャリーフラグ出力つき減算演算回路、
4040…キャリーフラグ信号、
4050,4060…セレクタ、
4070…減算演算回路、
4080…右シフタ
4090…セレクタ、
5010…v記憶手段、
5020…u記憶手段、
5030…最上位ビット、
5040…算術演算回路、
5050…ゼロフラグ信号、
5060…算術右シフタ、
5080…OR回路、
5090…選択信号、
5100…セレクタ、
6010…元データ、
6020…最下位ビット、
6030…全ビット反転データ、
6040…最下位ビット、
6050…符号反転データ、
6060…最下位ビット、
7010…v記憶手段、
7020…u記憶手段、
7030…インバータ、
7040…排他論理和、
7050…最下位ビット
7060…加算器、
7070…ゼロフラグ信号、
7080…算術右シフタ、
7090…w記憶手段、
7100…最上位ビット、
7110…OR回路、
7120…選択信号、
7130…セレクタ、
8010…実行ステップ位置、
9010…実行ステップ位置、
10010…改良版モンゴメリ逆元処理開始ポイント、
10020…内部変数初期化処理、
10030…逆元計算判定処理、
10040…uの偶数判定、
10050…uが偶数の場合のuおよびsの更新処理、
10060…vの偶数判定、
10070…vが偶数の場合のvおよびrの更新処理、
10080…vの符号判定、
10090…vが非負の場合のwの計算処理、
10100…vが負の場合のwの計算処理、
10110…wの符号判定処理、
10120…wが正の値の場合のu、r、sの更新処理、
10130…wがゼロもしくは負の値の場合のv、r、sの更新処理、
10140…2のベキの更新、
10150…逆元の存在判定、
10160…エラー終了ポイント、
10170…負数の補正処理、
10180…負数の補正処理終了判定、
10190…処理終了ポイント、
11010…モンゴメリ逆元補正処理開始ポイント、
11020…ループカウンタ初期化、
11030…ループ終了判定、
11040…奇数判定、
11050…奇数から偶数への補正処理、
11060…結果を2で割る処理、
11070…ループカウンタ更新、
11090…処理終了ポイント、
12010…実行ステップ位置、
13010…v記憶手段、
13020…u記憶手段、
13030…大小比較手段、
13040,13050,13060,13070…セレクタ、
13080…右シフタ、
13090…k記憶手段、
13100…加算器、
13110,13120,13130,13150…セレクタ、
13140…加算器、
13160…左シフタ、
13170…減算器、
13220…r記憶手段、
13230…s記憶手段、
14010…ICカード、
14020,15010…ICカードチップ、
15020…CPU、
15030…ROM、
15040…RAM、
15050…EEPROM、
15060…剰余乗算コプロセッサ、
15070…シリアル通信回路。
1010 ... Montgomery inverse operation processing start point,
1020 ... Internal variable initialization processing,
1030 ... end determination processing,
1040 ... even judgment of u,
1050 ... Update processing of u and s when u is an even number,
1060 ... even judgment of v,
1070 ... Update processing of v and r when v is an even number,
1080: Judgment of magnitude of u and v,
1090 ... Update processing of u, r, s when u> v,
1100 ... Update processing of v, s, r when u ≦ v,
1110 ... 2 power update,
1120 ... Inverse element existence determination,
1130: Error end point,
1140: Determination of necessity of overflow correction,
1150: Overflow correction processing,
1160: Processing end point,
2010 ... Montgomery inverse correction start point,
2020 ... Loop counter initialization,
2030 ... Loop end determination,
2040 ... odd number judgment,
2050: Correction processing from odd number to even number,
2060: processing to divide the result by 2;
2070 ... Loop counter update,
2080 ... sign inversion processing,
2090 ... processing end point,
3010 ... Improved Montgomery inverse processing start point,
3020 ... Internal variable initialization processing,
3030: Inverse element calculation determination process,
3040 ... Even judgment of u,
3050 ... Update processing of u and s when u is an even number,
3060 ... even judgment of v,
3070 ... Update processing of v and r when v is an even number,
3080 ... v code determination,
3090 ... calculation processing of w when v is non-negative,
3100 ... calculation processing of w when v is negative,
3110 ... w code determination processing,
3120 ... Update processing of u, r, s when w is a positive value,
3130... Updating process of v, r, s when w is zero or negative value,
3140 ... 2 power update,
3150 ... Inverse element existence determination,
3160: Error end point 3170: Necessity determination of overflow correction,
3180 ... overflow correction processing,
3190: Processing end point,
4010 ... v storage means,
4020 ... u storage means,
4030 ... Subtraction operation circuit with carry flag output,
4040 ... Carry flag signal,
4050, 4060 ... selector,
4070: Subtraction operation circuit,
4080 ... Right shifter 4090 ... Selector,
5010 ... v storage means,
5020 ... u storage means,
5030 ... Most significant bit,
5040: Arithmetic operation circuit,
5050 ... Zero flag signal,
5060: Arithmetic right shifter,
5080 ... OR circuit,
5090 ... selection signal,
5100 ... selector,
6010 ... Original data,
6020 ... the least significant bit,
6030: All bit inverted data,
6040 ... the least significant bit,
6050 ... sign inversion data,
6060 ... least significant bit,
7010 ... v storage means,
7020 ... u storage means,
7030: Inverter,
7040: exclusive OR,
7050 ... Least significant bit 7060 ... Adder,
7070: Zero flag signal,
7080: Arithmetic right shifter,
7090 ... w storage means,
7100: most significant bit,
7110... OR circuit,
7120 ... selection signal,
7130 ... selector,
8010 ... execution step position,
9010 ... execution step position,
10010 ... Improved Montgomery inverse processing start point,
10020 ... Internal variable initialization processing,
10030 ... Inverse element calculation determination process,
10040 ... Even judgment of u,
10050 ... Update processing of u and s when u is an even number,
10060 ... even judgment of v,
10070 ... Update processing of v and r when v is an even number,
10080 ... v code determination,
10090 ... calculation processing of w when v is non-negative,
10100 ... Calculation processing of w when v is negative,
10110 ... w code determination processing,
10120 ... Update processing of u, r, s when w is a positive value,
10130... Updating process of v, r, s when w is zero or negative value,
10140 ... 2 power update,
10150 ... Inverse element existence determination,
10160: Error end point,
10170 ... negative number correction processing,
10180: Determination of end of negative number correction process,
10190 ... Processing end point,
11010 ... Montgomery inverse correction correction start point,
11020 ... Loop counter initialization,
11030 ... Loop end determination,
11040 ... odd number judgment,
11050 ... Correction processing from odd number to even number,
11060 ... processing to divide the result by 2;
11070 ... Loop counter update,
11090 ... processing end point,
12010 ... execution step position,
13010 ... v storage means,
13020 ... u storage means,
13030 ... Size comparison means,
13040, 13050, 13060, 13070 ... selector,
13080 ... Right shifter,
13090 ... k storage means,
13100 ... adder,
13110, 13120, 13130, 13150 ... selector,
13140 ... Adder,
13160 ... Left shifter,
13170 ... subtractor,
13220 ... r storage means,
13230 ... s storage means,
14010 ... IC card,
14020, 15010 ... IC card chip,
15020 ... CPU,
15030 ... ROM,
15040 ... RAM,
15050 ... EEPROM,
15060 ... residue multiplication coprocessor,
15070: Serial communication circuit.

Claims (12)

第1の整数aと、
前記第1の整数aと互いに素である第2の整数bと、
前記第1の整数aを法として、a<2を満たす整数nとが与えられ、
前記第2の整数bの逆元を整数b−1としたとき、
r≡b−1・2 mod aである第3の整数rを計算するモンゴメリ型逆元演算装置を備えた半導体装置において、
nビット長の整数値を格納する5つの格納部u、v、r、s、wと、
0から2nまでの値を表現でき、少なくとも{log(n)}+1ビット長の整数値を格納できる2つの格納部k、iとを有し、
ステップ(1)前記格納部u、v、r、s、およびkにおける格納値の初期状態をそ
れぞれ、u=a、v=b、r=0、s=1、およびk=0とする、
ステップ(2)vが0であれば、ステップ(8)の処理を行い、
vが0以外の値であれば、ステップ(3)の処理を行う、
ステップ(3)uの値が偶数であれば、u=u/2、s=2sの演算を行なって、ス
テップ(7)の処理に進み、
uの値が偶数でなければ、ステップ(4)の処理を行う、
ステップ(4)vの値が偶数であれば、v=v/2、r=2rの演算を行って、ステ
ップ(7)の処理に進み、
vの値が偶数でなければ、ステップ(5)の処理を行う、
ステップ(5)vの符号が非負の場合は、w=(u−v)/2の演算を行った後、ステ
ップ(6)の処理を行い、
vの符号が負の場合は、w=(u+v)/2の演算を行った後、ステッ
プ(6)の処理を行う、
ステップ(6)wの符号が負もしくはゼロの場合は、
v=w、r=r+s、r=2rの演算を行なった後、ステップ(7)の
処理に進み、
wの符号が正の場合は、u=w、r=r+s、r=2rの演算を行なっ
た後、ステップ(7)の処理に進む、
ステップ(7)k=k+1とし、ステップ(2)の処理に進む、
ステップ(8)uが1であるか否かを判定し、uが1以外の場合は逆元が存在しないと
判定して処理を完了し、
uが1以外の場合は、ステップ(9)の処理に進む、
ステップ(9)r>aであるか否かを判定し、r>aであれば、r=r−aとし、ステ
ップ(10)の処理に進み、
r≦aであれば、ステップ(10)の処理に進む、
ステップ(10)i=0とし、ステップ(11)の処理を行う、
ステップ(11)i<k−1であるか否かを判定し、i<k−1の場合は、ステップ(1
4)の処理を行い、
i<k−1でない場合は、ステップ(12)の処理を行う、
ステップ(12)rが奇数の場合は、r=r+aとし、ステップ(13)の処理を行い、
rが偶数の場合は、ステップ(13)の処理を行う、
ステップ(13)rを右シフトしその結果をrとし、i=i+1として、ステップ(1
1)の処理を行う、
ステップ(14)r=a−rとし、rを実行結果として処理を終了とする、
上記ステップ(1)乃至(9)の処理を実行する逆元計算部と、
上記ステップ(10)乃至(14)の処理を実行する逆元補正部とを有するモンゴメリ型逆元演算装置を備えることを特徴とする半導体装置。
A first integer a;
A second integer b which is relatively prime with the first integer a;
An integer n satisfying a <2 n modulo the first integer a,
When the inverse element of the second integer b is an integer b- 1 ,
In a semiconductor device including a Montgomery-type inverse element arithmetic unit that calculates a third integer r that is r≡b −1 · 2 n mod a,
5 storage units u, v, r, s, w for storing integer values of n bits length,
Having two storage units k and i that can express values from 0 to 2n and store at least {log 2 (n)} + 1-bit integer values;
Step (1) The initial state of the stored values in the storage units u, v, r, s, and k is
U = a, v = b, r = 0, s = 1, and k = 0,
Step (2) If v is 0, the process of Step (8) is performed,
If v is a value other than 0, the process of step (3) is performed.
Step (3) If the value of u is an even number, an operation of u = u / 2 and s = 2s is performed,
Proceed to step (7)
If the value of u is not an even number, the process of step (4) is performed.
Step (4) If the value of v is an even number, the calculation of v = v / 2 and r = 2r is performed, and the step
Proceed to step (7),
If the value of v is not an even number, the process of step (5) is performed.
Step (5) If the sign of v is non-negative, after calculating w = (u−v) / 2, the step
(6)
If the sign of v is negative, the operation of w = (u + v) / 2 is performed and then the step is performed.
(6)
Step (6) If the sign of w is negative or zero,
After calculating v = w, r = r + s, and r = 2r, step (7)
Proceed to processing
When the sign of w is positive, the calculation of u = w, r = r + s, r = 2r is performed.
Then, proceed to step (7).
Step (7) Set k = k + 1, and proceed to Step (2).
Step (8) It is determined whether u is 1 and if u is other than 1, there is no inverse element
To complete the process
If u is other than 1, proceed to step (9).
Step (9) It is determined whether r> a. If r> a, r = r−a,
Proceed to step (10),
If r ≦ a, the process proceeds to step (10).
Step (10) Set i = 0 and perform the process of Step (11).
Step (11) It is determined whether i <k−1. If i <k−1, step (1)
4)
If i <k−1, the process of step (12) is performed.
Step (12) If r is an odd number, set r = r + a and perform the process of Step (13).
If r is an even number, the process of step (13) is performed.
Step (13) r is shifted right and the result is set to r, i = i + 1, and step (1
Perform the process of 1)
Step (14) r = a−r, r is the execution result, and the process is terminated.
An inverse element calculation unit that executes the processes of steps (1) to (9) above;
A semiconductor device comprising a Montgomery-type inverse element arithmetic unit having an inverse element correction unit that executes the processes of steps (10) to (14).
符号を反転する符号反転部を有し、
前記ステップ(5)において、w=(u−v)/2とする演算処理に代えて、前記符号反転部によりv’=−vを求めた後に、w=(u+v’)/2の演算処理を実行するモンゴメリ型逆元演算装置を備えることを特徴とする請求項1記載の半導体装置。
Having a sign inverting unit for inverting the sign;
In step (5), instead of the arithmetic processing for setting w = (u−v) / 2, after calculating v ′ = − v by the sign inversion unit, the arithmetic processing for w = (u + v ′) / 2 is performed. The semiconductor device according to claim 1, further comprising a Montgomery-type inverse element arithmetic unit that executes.
前記符合反転部は、vの最下位ビット以外のすべてのビットを反転することで符号反転を行うモンゴメリ型逆元演算装置を備えることを特徴とする請求項2記載の半導体装置。   3. The semiconductor device according to claim 2, wherein the sign inversion unit includes a Montgomery-type inverse element arithmetic unit that performs sign inversion by inverting all bits other than the least significant bit of v. 加算部および減算部を有し、前記ステップ(5)において、
vの最上位ビットを用いてvの符号を判定し、前記判定の結果に従い前記加算部と前記減算部のいずれか1つを選択し、
vの符号が非負の場合は、w=(u−v)/2とする演算を行なった後に、ステップ
(6)の処理に進み、
vの符号が負の場合は、w=(u+v)/2とする演算を行なった後に、ステップ(6)の処理を行うモンゴメリ型逆元演算装置を備えることを特徴とする請求項1記載の半導体装置。
An adder and a subtractor, and in step (5),
determining the sign of v using the most significant bit of v, and selecting one of the addition unit and the subtraction unit according to the result of the determination;
If the sign of v is non-negative, after calculating w = (u−v) / 2, the process proceeds to step (6).
The Montgomery-type inverse element arithmetic unit that performs the processing of step (6) after performing the operation of w = (u + v) / 2 when the sign of v is negative. Semiconductor device.
第1の整数aと、
前記第1の整数aと互いに素である第2の整数bと、
前記第1の整数aを法として、a<2を満たす整数nとが与えられ、
前記第2の整数bの逆元を整数b−1としたとき、
r≡b−1・2 mod aである第3の整数rを計算するモンゴメリ型逆元演算装置を備えた半導体装置において、
nビット長の整数値を格納する5つの格納部u、v、r、s、wと、
0から2nまでの値を表現でき、少なくとも{log(n)}+1ビット長の整数値を格納できる2つの格納部k、iとを有し、

ステップ(1)前記格納部u、v、r、s、およびkにおける格納値の初期状態をそ
れぞれ、u=a、v=b、r=0、s=−1、およびk=0とする、
ステップ(2)vが0であれば、ステップ(8)の処理を行い、
vが0以外の値であれば、ステップ(3)の処理を行う、
ステップ(3)uの値が偶数であれば、u=u/2、s=2sの演算を行なった後に、
ステップ(7)の処理に進み、
uの値が偶数でなければ、ステップ(4)の処理を行う、
ステップ(4)vの値が偶数であれば、v=v/2、r=2rの演算を行なった後に、
ステップ(7)の処理に進み、
vの値が偶数でなければ、ステップ(5)の処理を行う、
ステップ(5)vの符号が非負の場合は、w=(u−v)/2の演算を行なった後に、
ステップ(6)の処理を行い、
vの符号が負の場合は、w=(u+v)/2の演算を行なった後に、ス
テップ(6)の処理を行う、
ステップ(6)wの符号が負もしくはゼロの場合は、
v=wとし、r=r+s、r=2rの演算を行なった後に、ステップ
(7)の処理に進み、
wの符号が正の場合は、u=w、r=r+s、r=2rの演算を行った
後に、ステップ(7)の処理に進む、
ステップ(7)kをk+1とし、ステップ(2)の処理に進む、
ステップ(8)uが1であるか否かを判定し、uが1以外の場合は逆元が存在しないと
判定して処理を完了し、
uが1以外の場合は、ステップ(9)の処理に進む、
ステップ(9)r=r+aとし、ステップ(10)の処理に進む、
ステップ(10)r<0であるか否かを判定し、r<0であれば、ステップ(9)の処理
に進み、
r≧0であれば、ステップ(11)の処理に進む、
ステップ(11)i=0とし、ステップ(11)の処理を行い、
ステップ(12)i<k−1であるか否かを判定し、i<k−1の場合は、ステップ(1
3)の処理を行い、
i<k−1でない場合は、ステップ(15)の処理を行う、
ステップ(13)rが奇数の場合は、r=r+aとし、ステップ(14)の処理を行い、
rが偶数の場合は、ステップ(14)の処理を行う、
ステップ(14)r=r/2、i=i+1の演算を行なった後に、ステップ(12)の処
理を行う、
ステップ(15)rを実行結果として処理を終了する、
上記ステップ(1)乃至(10)の処理を実行する逆元計算部と、
上記ステップ(11)乃至(15)の処理を実行する逆元補正部とを有するモンゴメリ型逆元演算装置を備えることを特徴とする半導体装置。
A first integer a;
A second integer b which is relatively prime with the first integer a;
An integer n satisfying a <2 n modulo the first integer a,
When the inverse element of the second integer b is an integer b- 1 ,
In a semiconductor device including a Montgomery-type inverse element arithmetic unit that calculates a third integer r that is r≡b −1 · 2 n mod a,
5 storage units u, v, r, s, w for storing integer values of n bits length,
Having two storage units k and i that can express values from 0 to 2n and store at least {log 2 (n)} + 1-bit integer values;

Step (1) The initial state of the stored values in the storage units u, v, r, s, and k is
Respectively, u = a, v = b, r = 0, s = −1, and k = 0.
Step (2) If v is 0, the process of Step (8) is performed,
If v is a value other than 0, the process of step (3) is performed.
Step (3) If the value of u is an even number, after calculating u = u / 2 and s = 2s,
Proceed to step (7).
If the value of u is not an even number, the process of step (4) is performed.
Step (4) If the value of v is an even number, after calculating v = v / 2 and r = 2r,
Proceed to step (7).
If the value of v is not an even number, the process of step (5) is performed.
Step (5) If the sign of v is non-negative, after calculating w = (u−v) / 2,
Perform step (6),
If the sign of v is negative, after performing the operation w = (u + v) / 2,
Step (6) is processed.
Step (6) If the sign of w is negative or zero,
After calculating v = w, r = r + s, r = 2r, step
Proceed to processing (7)
When the sign of w is positive, the calculation of u = w, r = r + s, r = 2r was performed.
Later, proceed to step (7).
Step (7) Set k to k + 1 and proceed to step (2).
Step (8) It is determined whether u is 1 and if u is other than 1, there is no inverse element
To complete the process
If u is other than 1, proceed to step (9).
Step (9) Set r = r + a and proceed to step (10).
Step (10) It is determined whether r <0. If r <0, the process of step (9)
Go to
If r ≧ 0, the process proceeds to step (11).
Step (11) Set i = 0, perform the process of Step (11),
Step (12) It is determined whether i <k−1. If i <k−1, step (1)
3)
If i <k−1, the process of step (15) is performed.
Step (13) If r is an odd number, set r = r + a and perform the process of Step (14).
If r is an even number, the process of step (14) is performed.
Step (14) After calculating r = r / 2 and i = i + 1, the process of step (12) is performed.
Do the
Step (15) terminates the process using r as an execution result,
An inverse element calculation unit for executing the processes of steps (1) to (10) above;
A semiconductor device comprising a Montgomery-type inverse element arithmetic unit having an inverse element correction unit that executes the processes of steps (11) to (15).
奇数の整数の符号反転部を有し、ステップ(5)において、w=(u−v)/2とする演算処理は、vの符号を反転した(−v)とuの加算処理を行った後に、算術右1ビットシフトを行うことにより、w=(u+(−v))/2の演算処理を行うモンゴメリ型逆元演算装置を備えることを特徴とする請求項5に記載の半導体装置。   In step (5), the arithmetic processing having an odd integer sign inverting unit and w = (u−v) / 2 is performed by inverting the sign of v (−v) and adding u. 6. The semiconductor device according to claim 5, further comprising a Montgomery-type inverse element arithmetic unit that performs arithmetic processing of w = (u + (− v)) / 2 by performing an arithmetic right 1-bit shift later. 多倍長精度の加算部と全ビットを反転させるNOT演算部とを有し、
ステップ(1)おいて、v=(a−b)とする演算処理の代わりに、v=a+NOT(b)+1とする演算処理を行うモンゴメリ型逆元演算装置を備えることを特徴とする請求項5に記載の半導体装置。
A multi-precision precision adder and a NOT operator that inverts all bits,
The step (1) includes a Montgomery-type inverse element arithmetic unit that performs an arithmetic process of v = a + NOT (b) +1 instead of an arithmetic process of v = (ab). 5. The semiconductor device according to 5.
第1の整数aと、
前記第1の整数aと互いに素である第2の整数bと、
前記第1の整数aを法として、a<2を満たす整数nとが与えられ、
前記第2の整数bの逆元を整数b−1としたとき、
r≡b−1・2 mod aである第3の整数rを計算するモンゴメリ型逆元演算装置を備えた半導体装置において、
初期状態としてaが設定されるuレジスタと、
初期状態としてbが設定されるvレジスタと、
初期状態として0が設定されるrレジスタと、
初期状態として1が設定されるsレジスタと、
初期状態として0が設定されるkレジスタと、
uを右シフト、sを左シフト、vを右シフト、rを左シフトのうち指定されたものを実行するビットシフタと、
uレジスタからvレジスタの内容を減じる処理、uレジスタにvレジスタの内容を加える処理、rレジスタにsレジスタの内容を加える処理、kレジスタに1を加える処理、rレジスタにaを加える処理、およびiに1を加える処理のうち指定されたものを実行する算術演算器と、
vの最上位ビットの符号が正か否か、vが0か否か、vが偶数か否か、uが偶数か否か、vが正か否か、uが1か否か、rが正か否か、rが偶数か否か、およびiが(k−1)より大きいか否かを判断する判定器と、
前記ビットシフタ、前記演算器、および前記判定器を制御する制御部とを有するモンゴメリ型逆元演算装置を備えることを特徴とする半導体装置。
A first integer a;
A second integer b which is relatively prime with the first integer a;
An integer n satisfying a <2 n modulo the first integer a,
When the inverse element of the second integer b is an integer b- 1 ,
In a semiconductor device including a Montgomery-type inverse element arithmetic unit that calculates a third integer r that is r≡b −1 · 2 n mod a,
A u register in which a is set as an initial state;
V register in which b is set as an initial state;
An r register set to 0 as an initial state;
An s register in which 1 is set as an initial state;
K register set to 0 as an initial state;
a bit shifter that executes a specified one of u right shift, s left shift, v right shift, and r left shift;
a process of subtracting the contents of the v register from the u register, a process of adding the contents of the v register to the u register, a process of adding the contents of the s register to the r register, a process of adding 1 to the k register, a process of adding a to the r register, and an arithmetic unit that executes a specified process of adding 1 to i;
Whether the sign of the most significant bit of v is positive, whether v is 0, whether v is even, whether u is even, whether v is positive, whether u is 1, whether r is A determinator that determines whether positive, r is even, and i is greater than (k−1);
A semiconductor device comprising a Montgomery-type inverse element arithmetic unit having a control unit that controls the bit shifter, the arithmetic unit, and the determination unit.
第1の整数aと、
前記第1の整数aと互いに素である第2の整数bと、
前記第1の整数aを法として、a<2を満たす整数nとが与えられ、
前記第2の整数bの逆元を整数b−1としたとき、
r≡b−1・2 mod aである第3の整数rを計算するモンゴメリ型逆元演算装置を備えた半導体装置において、
前記整数b、kと法aを入力して逆元X=b−1・2 mod aを求めるモンゴメリ逆元演算部と、
求められた逆元Xと法aを入力して除算結果r=b−1・2 mod aを求めるモンゴメリ逆元補正演算手部とを備え、
前記モンゴメリ逆元演算部は、初期状態としてaを保存するuレジスタと、
初期状態としてbを保存するvレジスタと、
uおよびvの演算結果を保存するwレジスタと、
uおよびvが奇数か否かを判定する判定部とを少なくとも有し、
前記判定部による判定の結果、奇数と判定されたuおよびvを保存する前記uレジスタおよび前記vレジスタと、
前記vレジスタの最上位ビットの正負符号を判定し、該判定の結果と前記uおよびvを入力し、前記判定の結果が正の場合には、u+vの演算を実行し、前記判定の結果が負の場合は、u−vの演算を実行する算術演算部と、
前記算術演算部からの出力を右シフトするシフタと、
前記シフタからの演算結果を保存するwレジスタと、
wが負の場合には、その値をuレジスタに保存し、wが非負の場合は、vレジスタに保存する判別処理を行なうセレクタとを含むモンゴメリ型逆元演算装置を有する半導体装置。
A first integer a;
A second integer b which is relatively prime with the first integer a;
An integer n satisfying a <2 n modulo the first integer a,
When the inverse element of the second integer b is an integer b- 1 ,
In a semiconductor device including a Montgomery-type inverse element arithmetic unit that calculates a third integer r that is r≡b −1 · 2 n mod a,
A Montgomery inverse operation unit that inputs the integers b and k and the modulus a to obtain the inverse element X = b −1 · 2 k mod a;
A Montgomery inverse correction unit for calculating a division result r = b −1 · 2 n mod a by inputting the obtained inverse X and modulus a;
The Montgomery inverse operation unit includes a u register that stores a as an initial state,
A v register that stores b as an initial state;
a w register for storing the operation results of u and v;
and at least a determination unit that determines whether u and v are odd numbers,
As a result of the determination by the determination unit, the u register and the v register that store u and v determined to be odd numbers;
The sign of the most significant bit of the v register is determined, the result of the determination and the u and v are input, and if the result of the determination is positive, the operation of u + v is executed, and the result of the determination is In the negative case, an arithmetic operation unit that performs an operation of uv,
A shifter for shifting the output from the arithmetic operation unit to the right;
A w register for storing a calculation result from the shifter;
A semiconductor device having a Montgomery-type inverse operation unit including a selector that performs a determination process of storing the value in a u register when w is negative and storing the value in a v register when w is nonnegative.
前記vレジスタの値に対して、vの最上位のビットを反転し、vの最下位ビット以外のビットとXOR演算を行なう排他的論理回路とを有し、
前記排他的論理回路の出力を前記算術演算部に入力するモンゴメリ型逆元演算装置を備える請求項9記載の半導体装置。
An exclusive logic circuit that inverts the most significant bit of v with respect to the value of the v register and performs an XOR operation with bits other than the least significant bit of v,
The semiconductor device according to claim 9, further comprising a Montgomery-type inverse element operation device that inputs an output of the exclusive logic circuit to the arithmetic operation unit.
請求項1又は5に記載の半導体装置を搭載することを特徴とするICカード。   An IC card on which the semiconductor device according to claim 1 or 5 is mounted. 請求項8又は9に記載の半導体装置を搭載することを特徴とするICカード。   An IC card on which the semiconductor device according to claim 8 is mounted.
JP2004273169A 2004-09-21 2004-09-21 Semiconductor device with montgomery inverse element arithmetic unit, and ic card Pending JP2006091086A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004273169A JP2006091086A (en) 2004-09-21 2004-09-21 Semiconductor device with montgomery inverse element arithmetic unit, and ic card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004273169A JP2006091086A (en) 2004-09-21 2004-09-21 Semiconductor device with montgomery inverse element arithmetic unit, and ic card

Publications (1)

Publication Number Publication Date
JP2006091086A true JP2006091086A (en) 2006-04-06

Family

ID=36232187

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004273169A Pending JP2006091086A (en) 2004-09-21 2004-09-21 Semiconductor device with montgomery inverse element arithmetic unit, and ic card

Country Status (1)

Country Link
JP (1) JP2006091086A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101548174B1 (en) 2008-12-02 2015-09-07 삼성전자주식회사 Method for calculating negative inverse of modulus
US9811318B2 (en) 2014-03-31 2017-11-07 Samsung Electronics Co., Ltd. Montgomery multiplication method for performing final modular reduction without comparison operation and montgomery multiplier

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101548174B1 (en) 2008-12-02 2015-09-07 삼성전자주식회사 Method for calculating negative inverse of modulus
US9811318B2 (en) 2014-03-31 2017-11-07 Samsung Electronics Co., Ltd. Montgomery multiplication method for performing final modular reduction without comparison operation and montgomery multiplier

Similar Documents

Publication Publication Date Title
CN109039640B (en) An encryption and decryption hardware system and method based on RSA cryptographic algorithm
US7904498B2 (en) Modular multiplication processing apparatus
US8977668B2 (en) Calculating unit for reducing an input number with respect to a modulus
US6795553B1 (en) Method and apparatus for modular inversion for information security and recording medium with a program for implementing the method
KR100442218B1 (en) Power-residue calculating unit using montgomery algorithm
JP3785044B2 (en) Power residue calculation device, power residue calculation method, and recording medium
EP0952697B1 (en) Elliptic curve encryption method and system
US7120660B2 (en) Method of and apparatus for modular multiplication
KR20040067779A (en) Information processing means
JP4662802B2 (en) Calculation method, calculation apparatus, and computer program
JP2011512556A (en) Apparatus and method for calculating a number of points on an elliptic curve
CN101243388A (en) Circuit arrangement and method for performing an inversion operation in cryptographic calculations
JP4360792B2 (en) Power-residue calculator
EP1600852B1 (en) Method and apparatus for calculating a modular inverse
CN117544297A (en) Data encryption method, device, system, electronic equipment and storage medium
JP2006091086A (en) Semiconductor device with montgomery inverse element arithmetic unit, and ic card
US10318245B2 (en) Device and method for determining an inverse of a value related to a modulus
JP4502817B2 (en) Elliptic curve scalar multiplication method and apparatus
Schinianakis et al. RNS-based public-key cryptography (RSA and ECC)
KR100451570B1 (en) Method and apparatus for implementing elliptic curve cryptosystem resisting against simple power attacks
JP5179933B2 (en) Data processing device
JP4306121B2 (en) Division circuit, multiplication and division circuit
JP3999554B2 (en) Multiplication residue calculation method and calculation device
JP3137599B2 (en) Circuit for calculating the remainder of B raised to the power of C modulo n
JP5000399B2 (en) Elliptic curve calculation device and elliptic curve calculation method