JPH10269060A - Montgomery division device, montgomery inverse element calculation device, montgomery division method and montgomery inverse element calculation method - Google Patents

Montgomery division device, montgomery inverse element calculation device, montgomery division method and montgomery inverse element calculation method

Info

Publication number
JPH10269060A
JPH10269060A JP1425098A JP1425098A JPH10269060A JP H10269060 A JPH10269060 A JP H10269060A JP 1425098 A JP1425098 A JP 1425098A JP 1425098 A JP1425098 A JP 1425098A JP H10269060 A JPH10269060 A JP H10269060A
Authority
JP
Japan
Prior art keywords
montgomery
register
inverse element
mod
integer
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.)
Granted
Application number
JP1425098A
Other languages
Japanese (ja)
Other versions
JP2937982B2 (en
Inventor
Atsushi Shinpo
淳 新保
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP10014250A priority Critical patent/JP2937982B2/en
Publication of JPH10269060A publication Critical patent/JPH10269060A/en
Application granted granted Critical
Publication of JP2937982B2 publication Critical patent/JP2937982B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/728Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic using Montgomery reduction

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Complex Calculations (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a Montgomery division device capable of obtaining a divided result in a Montgomery arithmetic area at a high speed. SOLUTION: This Montgomery division device 200 for obtaining the divided result Y in the Montgomery arithmetic area to be Y=B.A' (-1).2 n mod N for the integer (n) of (n)>=L when a bit length at the time of binarily expressing N is defined as L for a positive integer N, the positive integer A (0<=A<N and A and N are mutually prime) and the positive integer B is provided with a Montgomery inverse element calculation part 201 for inputting the integer A and a modulus N and obtaining an inverse element X=A (-1).2 (2n) mod N and a Montgomery multiplication part 202 for inputting the obtained inverse element X, the modulus N and the B and obtaining the divided result Y=B.X.2 (-n) mod N.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、計算機ネットワー
クでのデータ通信におけるデータの暗号化や通信相手の
確認に利用される公開鍵暗号など奇数の整数を法とする
多倍長の四則演算を繰り返し利用する処理のためのモン
ゴメリ除算装置及びモンゴメリ逆元計算装置並びにモン
ゴメリ除算方法及びモンゴメリ逆元計算方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention repeatedly performs a multiple-length arithmetic operation using an odd integer as a modulus, such as encryption of data in data communication on a computer network or public key encryption used for confirming a communication partner. The present invention relates to a Montgomery division apparatus, a Montgomery inverse element calculation apparatus, a Montgomery division method, and a Montgomery inverse element calculation method for processing to be used.

【0002】[0002]

【従来の技術】情報通信ネットワークや計算機システム
では、電子的な情報の交換・蓄積が行われる。そのよう
なシステムが、大規模化し不特定多数のユーザが利用す
る状況では、悪意のユーザによる情報の盗聴や改ざんな
どが問題となり、その対策として公開鍵暗号技術を利用
する場合が多い。
2. Description of the Related Art In information communication networks and computer systems, electronic information is exchanged and stored. In a situation where such a system is enlarged and used by an unspecified number of users, eavesdropping or falsification of information by a malicious user becomes a problem, and public key encryption technology is often used as a countermeasure.

【0003】公開鍵暗号では、多倍長の奇整数を法とす
る演算で実現される方式が多く、その高速化が性能に影
響を与える。多倍長の奇整数を法とする四則演算の中で
は、特に乗算と除算が処理時間に与える影響が大きい。
このうち、乗算を繰り返し実行する場合に適した計算ア
ルゴリズムとして、モンゴメリ算法が知られている。 モンゴメリ算法は文献(1)P.L.Montgome
ry、“Modularmultiplication
without trial division”、
Math. of Comp.、Vol.44、No.
170、pp.519−521(1985)に詳しい。
[0003] In public key cryptography, there are many schemes realized by an operation modulo a multiple-precision odd integer, and the speeding up thereof affects performance. Among the four arithmetic operations modulo a multiple-precision odd integer, multiplication and division have a particularly large effect on processing time.
Among them, Montgomery arithmetic is known as a calculation algorithm suitable for repeatedly executing multiplication. The Montgomery algorithm is described in Ref. L. Montgome
ry, “Modularmultiplication
"without trial division",
Math. of Comp. Vol. 44, no.
170, pp. 519-521 (1985).

【0004】モンゴメリ算法は多倍長の剰余乗算を多倍
長乗算2回程度の処理量で計算する方法である。多倍長
の剰余算は多倍長の乗算よりも性能が劣ることが多く、
その分の高速化が実現できる。このモンゴメリ算法はモ
ンゴメリ演算域の元(これも同じ剰余系である)の乗算
アルゴリズムであり、一般の剰余系での乗算をするに
は、まず乗数と被乗数をモンゴメリ演算域に変換し、次
にモンゴメリ乗算を行ない、最後にモンゴメリ演算域か
ら元の剰余系に結果を逆変換する。モンゴメリ変換とモ
ンゴメリ逆変換はいずれも多倍長乗算1回程度の処理で
あるため、剰余乗算を繰り返し行なう、べき乗演算では
変換と逆変換のオーバーヘッドが少なく、高速化が可能
である。したがって、RSA(Rivest−Sham
ir−Adleman)暗号など多くの公開鍵暗号で
は、剰余系でのベキ乗剰余演算c=me mod Nを
その基本演算としているため、このモンゴメリ算法を有
効に利用することができる(ただし、単純にいくつかの
乗算を行なうだけの場合には、変換と逆変換のオーバー
ヘッドのため必ずしも効率化にはつながらない)。
The Montgomery arithmetic method is a method of calculating a multiple-precision remainder multiplication with a processing amount of about twice the multiple-length multiplication. Multiple-precision remainder arithmetic often has lower performance than multiple-precision multiplication,
Higher speed can be realized. This Montgomery arithmetic method is a multiplication algorithm of the element of the Montgomery operation area (which is also the same remainder system). To perform multiplication in a general remainder system, first convert the multiplier and the multiplicand into the Montgomery operation area, and then Montgomery multiplication is performed, and finally the result is inversely transformed from the Montgomery operation area to the original remainder system. Since both the Montgomery transform and the inverse Montgomery transform are processes of about one multiple length multiplication, the overhead of the transform and the inverse transform is small in the exponentiation operation in which the remainder multiplication is repeated, and the speed can be increased. Therefore, RSA (Rivest-Sham)
The ir-Adleman) encryption and many other public key cryptosystems a modular exponentiation c = m e mod N in the residue system and its basic operation, can be effectively utilized the Montgomery algorithm (although simple Is not necessarily efficient because of the overhead of the transform and inverse transform.)

【0005】ところで、近年、新しい暗号方式が種々研
究・提案されており、例えば楕円曲線暗号が公開鍵暗号
の中で注目を集めている。これは、楕円曲線上の離散対
数問題がRSA暗号のベースとなっている合成数の素因
数分解に比べて計算量的に困難であるという予想に基づ
いている。
In recent years, various new cryptosystems have been studied and proposed. For example, elliptic curve cryptosystems have been receiving attention in public key cryptosystems. This is based on the expectation that the discrete logarithm problem on an elliptic curve is computationally more difficult than the prime factorization of a composite number on which RSA encryption is based.

【0006】ここで、楕円曲線暗号の基本演算について
簡単に説明する。
Here, the basic operation of the elliptic curve cryptosystem will be briefly described.

【0007】有限体Fp(ただし、p>3)において、 E(a,b)/Fp:y2 =x3 +ax+b mod
p ただし、0≦a,b<pなる整数、4a3 +27b2
0 mod pで定義される曲線を有限体Fp上の楕円
曲線という。楕円曲線上の点とは、上式を満たす(x,
y)の組(ただし、0≦x,y<pなる整数)に無限遠
点Oを加えたものをいう。この無限遠点Oは加算に関す
る単位元となる。
In a finite field Fp (where p> 3), E (a, b) / Fp: y 2 = x 3 + ax + b mod
p, where 0 ≦ a, b <p, an integer satisfying 4a 3 + 27b 2
A curve defined by 0 mod p is called an elliptic curve on a finite field Fp. A point on the elliptic curve satisfies the above equation (x,
y) (where 0 ≦ x, y <p is an integer) and an infinity point O is added. This infinity point O is a unit element for addition.

【0008】楕円曲線上の点は以下に示す加算に関して
群をなす。楕円曲線上の点P=(x1 ,y1 )、Q=
(x2 ,y2 )の加算点をS(x3 ,y3 )とすると、
次のようになる。ただし、−P=(x1 ,−y1 )であ
る。
The points on the elliptic curve form a group with respect to the following additions: Point P on elliptic curve = (x 1 , y 1 ), Q =
If the addition point of (x 2 , y 2 ) is S (x 3 , y 3 ),
It looks like this: However, -P = (x 1, -y 1) is.

【0009】(1)Qが単位元Oのとき、 S=P+Q=Q+P=P (2)Q=−Pのとき、 S=P+Q=Q+P=O (3)P≠Qのとき(ただし上記(1)(2)以外)、 x3 =(y2 −y1 2 /(x2 −x1 2 −x1 −x
2 mod p y3 =(y2 −y1 )(x1 −x3 )/(x2 −x1
−y1 mod p (4)P=Qのとき、 ・y1 ≠0の場合 x3 =(3x1 2 +a)2 /(2y1 2 −2x1
od p y3 =(3x1 2 +a)(x1 −x3 )/(2y1 )−
1 mod p ・y1 =0の場合 S=O また、楕円曲線上の点P=(x1 ,y1 )のe(整数)
倍演算は上記加算の繰り返しとして次のように定義され
る。 eP=P+P+…+P(Pをe回加算する) ただし、e<0の場合は、点(−P)を(−e)倍する
((−e)は正である)。e=0のときには0P=Oと
する。
(1) When Q is a unit element O, S = P + Q = Q + P = P (2) When Q = -P, S = P + Q = Q + P = O (3) When P ≠ Q (where 1) Other than (2)), x 3 = (y 2 −y 1 ) 2 / (x 2 −x 1 ) 2 −x 1 −x
2 mod py 3 = (y 2 −y 1 ) (x 1 −x 3 ) / (x 2 −x 1 )
-Y 1 mod p (4) When P = Q, For · y 1 ≠ 0 x 3 = (3x 1 2 + a) 2 / (2y 1) 2 -2x 1 m
od p y 3 = (3x 1 2 + a) (x 1 -x 3) / (2y 1) -
In the case of y 1 mod p · y 1 = 0 S = O Further, e (integer) of a point P = (x 1 , y 1 ) on the elliptic curve
The multiplication operation is defined as the repetition of the above addition as follows. eP = P + P +... + P (P is added e times) However, when e <0, the point (−P) is multiplied by (−e) ((−e) is positive). When e = 0, 0P = O.

【0010】楕円曲線暗号では、この楕円曲線上の点の
スカラー倍演算(ベキ加算)が基本演算となる。例え
ば、楕円ElGamal暗号、楕円ElGamal署
名、楕円DHなどにおける処理の大半を占める演算であ
る。
In the elliptic curve cryptography, a scalar multiplication (power addition) of a point on the elliptic curve is a basic operation. For example, the operation occupies most of the processing in the elliptical ElGamal encryption, the elliptical ElGamal signature, the elliptic DH, and the like.

【0011】したがって、RSA暗号が剰余乗算を基本
演算としているのに対して、楕円曲線暗号では、基本演
算を実現するのに四則演算が必要となる。
Therefore, while the RSA cryptosystem uses remainder multiplication as a basic operation, elliptic curve cryptography requires four arithmetic operations to realize the basic operation.

【0012】さて、楕円曲線暗号のように基本演算が多
倍長の四則演算の繰り返し処理であるような場合、四則
演算の中で処理に時間を要するものは、剰余乗算および
剰余除算であり、暗号処理全体を高速化するには、これ
ら剰余乗算および剰余除算を高速化する必要がある。こ
のうち前者の剰余乗算は、文献(1)のモンゴメリ乗算
のアルゴリズムなどを用いれば良い。
In the case where the basic operation is a repetition of a multiple-length arithmetic operation such as elliptic curve cryptography, the four arithmetic operations that require a long processing time are remainder multiplication and remainder division. In order to speed up the entire cryptographic process, it is necessary to speed up these remainder multiplication and remainder division. The remainder multiplication may use the Montgomery multiplication algorithm described in reference (1).

【0013】一方、剰余除算は逆元計算と剰余乗算との
組合せで実現でき、一般に逆元は拡張ユークリッド互除
法と呼ばれる算法で計算できる。しかし、一般にこのア
ルゴリズムはそれほど高速ではない。より高速な逆元の
計算法として、多倍長整数の右シフト(1/2倍)、加
算、減算で構成された計算法が、例えば文献(2)Ka
liski、B.S、Jr.、“The Montgo
mery invers and its appli
cation”、IEEE Tr. Comp.、Vo
l.44、No.8、pp.1064−1065、(A
ug.1995)に示されている。
On the other hand, remainder division can be realized by a combination of inverse element calculation and remainder multiplication, and the inverse element can be generally calculated by an algorithm called extended Euclidean mutual division method. However, this algorithm is generally not very fast. As a higher-speed inverse element calculation method, a calculation method configured by right-shifting (multiplying by 1/2), addition, and subtraction of a multiple-precision integer is described in, for example, Reference (2) Ka.
liski, B .; S, Jr. , "The Montgo
Mary invers and and it's appli
site ", IEEE Tr. Comp., Vo
l. 44, no. 8, pp. 1064-1065, (A
ug. 1995).

【0014】しかしながら、前述の文献(1)のモンゴ
メリ乗算と文献(2)の剰余系での除算の高速計算法を
そのまま適用することはできない。なぜなら、モンゴメ
リ演算域と元の剰余系との変換・逆変換を乗算や除算の
たびに実行しなければならず、オーバーヘッドが大きく
なるからである。
However, the high-speed calculation method of the Montgomery multiplication of the above-mentioned reference (1) and the division in the remainder system of the reference (2) cannot be directly applied. This is because the conversion and inverse conversion between the Montgomery operation area and the original remainder system must be performed each time multiplication or division is performed, which increases overhead.

【0015】また、剰余除算をモンゴメリ演算域で効率
良く求めるアルゴリズムはなかった。
Further, there is no algorithm for efficiently obtaining the remainder division in the Montgomery operation area.

【0016】このように、剰余除算を高速化することは
困難であるという問題点があった。
As described above, there is a problem that it is difficult to speed up the remainder division.

【0017】したがって、楕円曲線暗号のように基本演
算が四則演算(剰余系演算)の繰り返し処理であるよう
な暗号の処理を高速化することは困難であるという問題
点があった。
Therefore, there is a problem that it is difficult to speed up a cryptographic process in which the basic operation is an iterative process of four arithmetic operations (remainder operation), such as elliptic curve cryptography.

【0018】[0018]

【発明が解決しようとする課題】以上説明したように、
従来、公開鍵暗号の基本演算である剰余系での乗算と除
算を含む演算の繰り返し処理を効率化する算法は実現さ
れておらず、公開鍵暗号の一種である楕円曲線暗号など
における全体としての処理時間の効率化が困難であると
いう問題があった。
As described above,
Conventionally, an algorithm for improving the efficiency of repetition processing of operations including multiplication and division in a modulo system, which is a basic operation of public key cryptography, has not been realized. There is a problem that it is difficult to improve the processing time.

【0019】本発明は、上記事情を考慮してなされたも
ので、モンゴメリ演算域での逆元を高速に求めることの
できるモンゴメリ逆元計算装置及び方法、モンゴメリ演
算域での除算結果を高速に求めることのできるモンゴメ
リ除算装置及び方法を提供することを目的とする。
The present invention has been made in view of the above circumstances, and provides a Montgomery inverse element calculation apparatus and method capable of rapidly obtaining an inverse element in a Montgomery operation area, and a method for rapidly dividing a Montgomery operation area. It is an object of the present invention to provide a Montgomery division device and method which can be obtained.

【0020】[0020]

【課題を解決するための手段】本発明(請求項1)は、
正の整数N、正の整数A(0≦A<N、AとNは互いに
素)、正の整数Bについて、Nを2進表現したときのビ
ット長をLとして、n≧Lなる整数nに対して、Y=B
・A-1・2n mod Nなるモンゴメリ演算域での除
算結果Yを求めるモンゴメリ除算装置であって、整数A
と法Nを入力として逆元X=A-1・22n mod Nを
求めるモンゴメリ逆元計算手段と、求められた逆元Xと
法NとBを入力として除算結果Y=B・X・2-n mo
d Nを求めるモンゴメリ乗算手段とを備えたことを特
徴とする。
Means for Solving the Problems The present invention (claim 1) provides:
For a positive integer N, a positive integer A (0 ≦ A <N, where A and N are relatively prime), and a positive integer B, where L is the bit length when N is expressed in binary, and n ≧ L. For Y = B
A Montgomery division device for obtaining a division result Y in a Montgomery operation area of A −1 · 2 n mod N,
Montgomery inverse element calculating means for obtaining the inverse element X = A −1 · 2 2n mod N by inputting the inverse element X, the modulus N and B, and the division result Y = B · X · 2 -n mo
and Montgomery multiplication means for obtaining dN.

【0021】本発明(請求項2)は、請求項1に記載の
モンゴメリ除算装置において、前記モンゴメリ逆元計算
手段は、整数Aと法Nを入力として中間結果C=A-1
kmod Nとパラメータk(L≦k≦2L)を求め
る逆元計算手段と、求められた中間結果Cとパラメータ
kと法Nを入力として逆元X=C・22n-k modNを
求める逆元補正手段とを有することを特徴とする。
According to a second aspect of the present invention, in the Montgomery division device according to the first aspect, the Montgomery inverse element calculating means receives an integer A and a modulus N as inputs and obtains an intermediate result C = A -1.
Inverse element calculating means for obtaining 2 k mod N and a parameter k (L ≦ k ≦ 2L), and obtaining an inverse element X = C · 2 2n− k mod N by using the obtained intermediate result C, parameter k, and modulus N as inputs. And an inverse correction means.

【0022】本発明(請求項3)は、正の整数N、正の
整数A(0≦A<N、AとNは互いに素)、正の整数B
について、Nを2進表現したときのビット長をLとし
て、n≧Lなる整数nに対して、Y=B・A-1・2n
mod Nなるモンゴメリ演算域での除算結果Yを求め
るモンゴメリ除算装置であって、整数Aと法Nを入力と
して第1の中間結果C=A-1・2k mod Nとパラ
メータk(L≦k≦2L)を求める逆元計算手段と、求
められた第1の中間結果Cと法NとBを入力として第2
の中間結果D=B・C・2-n mod Nを求めるモン
ゴメリ乗算手段と、このモンゴメリ乗算手段により求め
られた第2の中間結果Dと前記逆元計算手段により求め
られたパラメータkと法Nを入力として除算結果Y=D
・22n-Kmod Nを求める逆元補正手段とを備えたこ
とを特徴とする。
According to the present invention (claim 3), a positive integer N, a positive integer A (0 ≦ A <N, A and N are relatively prime), a positive integer B
, L is the bit length when N is expressed in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n
A Montgomery division device for obtaining a division result Y in a Montgomery operation area of mod N, wherein an integer A and a modulus N are input and a first intermediate result C = A −1 · 2 k mod N and a parameter k (L ≦ k .Ltoreq.2L), a second intermediate value obtained by inputting the obtained first intermediate result C, modulo N and B,
Montgomery multiplication means for obtaining an intermediate result D = B · C · 2 −n mod N, a second intermediate result D obtained by the Montgomery multiplication means, a parameter k obtained by the inverse element calculation means, and a modulus N , The result of division Y = D
-Inverse correction means for obtaining 22n-K mod N is provided.

【0023】本発明(請求項4)は、正の奇整数N、正
の整数A(0≦A<N、AとNは互いに素)について、
Nを2進表現したときのビット長をLとして、n≧Lな
る整数nに対して、X=A-1・22n mod Nなるモ
ンゴメリ演算域での逆元Xを求めるモンゴメリ逆元計算
装置であって、整数Aと法Nを入力として中間結果C=
-1・2k mod Nとパラメータk(L≦k≦2
L)を求める逆元計算手段と、求められた中間結果Cと
パラメータkと法Nを入力として逆元X=C・22n-k
mod Nを求める逆元補正手段とを備えたことを特徴
とする。
The present invention (claim 4) provides a positive odd integer N and a positive integer A (0 ≦ A <N, where A and N are relatively prime).
Assuming that the bit length when N is expressed in binary is L, Montgomery inverse element calculation apparatus for finding the inverse element X in the Montgomery operation area where X = A -12n mod N for an integer n where n ≧ L And the intermediate result C =
A- 1 · 2 k mod N and parameter k (L ≦ k ≦ 2
L), an inverse element X = CC2 2n−k with the obtained intermediate result C, parameter k and modulus N as inputs.
and an inverse correction means for obtaining mod N.

【0024】本発明(請求項5)は、請求項4に記載の
モンゴメリ逆元計算装置において、内部に中間変数を記
憶する複数のレジスタと、前記レジスタを右または左に
シフトするビットシフト器と、2つのレジスタの内容の
加算または減算を行う加減算器と、2つのレジスタの内
容の大小比較およびレジスタ内部の所定のビット位置の
値の判定を行う判定器とを用いて前記逆元計算部および
前記逆元補正部を構成することを特徴とする。
According to the present invention (claim 5), in the Montgomery inverse element calculation device according to claim 4, a plurality of registers for storing intermediate variables therein, and a bit shifter for shifting the registers right or left are provided. An adder / subtractor for adding or subtracting the contents of two registers, and a determiner for comparing the contents of the two registers and determining the value of a predetermined bit position inside the register; The invention is characterized in that the inverse element correction unit is configured.

【0025】本発明(請求項6)は、正の奇整数N、正
の整数A(0≦A<N、AとNは互いに素)について、
Nを2進表現したときのビット長をLとして、n≧Lな
る整数nに対して、X=A-1・22n mod Nなるモ
ンゴメリ演算域での逆元Xを求めるモンゴメリ逆元計算
装置であって、初期状態を2進表現にてU=N、V=
A、T=0、S=1、k=0とし、Uの最下位ビットが
0ならば、Uを右シフトし、Sを左シフトし、kを1増
加するとともに、Vの最下位ビットが0ならば、Vを右
シフトし、Tを左シフトし、kを1増加する処理と、U
の最下位ビットが1かつVの最下位ビットが1で、U>
Vならば、UからVを減じ、Uを右シフトし、TにSを
加え、Sを左シフトし、kを1増加する処理と、Uの最
下位ビットが1かつVの最下位ビットが1で、U≦Vな
らば、VからUを減じ、Vを右シフトし、SにTを加
え、Tを左シフトし、kを1増加する処理からなる一連
のループ処理を、V>0の間、繰り返し、V=0になっ
た場合、T≧NならばTからNを減じた後に、NからT
を減じた値をTとし、T<NならばNからTを減じた値
をTとする逆元計算手段と、初期状態をi=0とし、前
記逆元計算手段により求められたTを左シフトした後、
T≧NならばTからNを減じてiを1増加し、T<Nな
らばiを1増加するループ処理を、i<2n−kの間、
繰り返し、i=2n−kになったときのTを逆元Xとす
る逆元補正手段とを備えたことを特徴とする。
According to the present invention (claim 6), for a positive odd integer N and a positive integer A (0 ≦ A <N, A and N are relatively prime),
Assuming that the bit length when N is expressed in binary is L, Montgomery inverse element calculation apparatus for finding the inverse element X in the Montgomery operation area where X = A -12n mod N for an integer n where n ≧ L Where U = N, V =
A, T = 0, S = 1, k = 0, and if the least significant bit of U is 0, U is shifted right, S is shifted left, k is increased by 1 and the least significant bit of V is If 0, shift V to the right, shift T to the left, and increase k by 1;
Is 1 and the least significant bit of V is 1, U>
If V, subtract V from U, shift U to the right, add S to T, shift S to the left, and increase k by 1. If the least significant bit of U is 1 and the least significant bit of V is If 1, U ≦ V, U is subtracted from V, V is shifted to the right, T is added to S, T is shifted to the left, and k is incremented by 1. When V = 0, if T ≧ N, N is subtracted from T, and then N to T
T is the value obtained by subtracting T from T, and T is the value obtained by subtracting T from N if T <N. The initial state is i = 0, and T obtained by the inverse calculation means is left. After shifting,
If T ≧ N, N is subtracted from T to increase i by 1. If T <N, a loop process of increasing i by 1 is performed while i <2n−k.
It is characterized by comprising inverse element correcting means for repeatedly setting T when X = 2n−k as an inverse element X.

【0026】本発明(請求項7)は、請求項6に記載の
モンゴメリ逆元計算装置において、初期状態としてNが
設定されるUレジスタと、初期状態としてAが設定され
るVレジスタと、初期状態として0が設定されるTレジ
スタと、初期状態として1が設定されるSレジスタと、
初期状態として0が設定されるkレジスタと、Uレジス
タの右シフト、Vレジスタの右シフト、Tレジスタの左
シフト、およびSレジスタの左シフトのうち指定された
ものを実行するビットシフト器と、UレジスタからVレ
ジスタの内容を減じる処理、VレジスタからUレジスタ
の内容を減じる処理、TレジスタにSレジスタの内容を
加える処理、SレジスタにTレジスタの内容を加える処
理、TレジスタからNを減じる処理、NからTレジスタ
の内容を減じる処理、およびkレジスタに1を加える処
理のうち指定されたものを実行する加減算器と、Uレジ
スタの最下位ビットが0であるか否か、Vレジスタの最
下位ビットが0であるか否か、Vレジスタの値が0にな
ったか否か、およびTレジスタの値がN以上であるか否
かを判断する判定器と、前記ビットシフト器、前記加減
算器および前記判定器を制御する制御部を備えたことを
特徴とする。
According to the present invention (claim 7), in the Montgomery inverse element calculation device according to claim 6, a U register in which N is set as an initial state, a V register in which A is set as an initial state, A T register in which 0 is set as a state, an S register in which 1 is set as an initial state,
A k register whose initial state is set to 0, a bit shifter for executing a specified one of a U register right shift, a V register right shift, a T register left shift, and an S register left shift; A process of subtracting the contents of the V register from the U register, a process of subtracting the contents of the U register from the V register, a process of adding the contents of the S register to the T register, a process of adding the contents of the T register to the S register, and subtracting N from the T register An adder / subtracter for executing a specified one of a process, a process of subtracting the contents of the T register from N, and a process of adding 1 to the k register, and whether the least significant bit of the U register is 0 or not, Determination of whether the least significant bit is 0, whether the value of the V register is 0, and whether the value of the T register is N or more When, wherein the bit shifter, comprising a control unit for controlling the adder-subtractor and said determiner.

【0027】本発明(請求項8)は、正の整数N、正の
整数A(0≦A<N、AとNは互いに素)、正の整数B
について、Nを2進表現したときのビット長をLとし
て、n≧Lなる整数nに対して、Y=B・A-1・2n
mod Nなるモンゴメリ演算域での除算結果Yを求め
るモンゴメリ除算方法であって、整数Aと法Nを入力と
して逆元X=A-1・22n mod Nを求める第1のス
テップと、求められた逆元Xと法NとBを入力として除
算結果Y=B・X・2-n mod Nを求める第2のス
テップとを有することを特徴とする。
In the present invention (claim 8), a positive integer N, a positive integer A (0 ≦ A <N, A and N are relatively prime), a positive integer B
, L is the bit length when N is expressed in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n
A Montgomery division method for obtaining a division result Y in a Montgomery operation area of mod N, wherein a first step of obtaining an inverse element X = A −1・ 2 n mod N using an integer A and a modulus N as inputs is performed. And a second step of obtaining a division result Y = B × X 2 −n mod N by using the inverse element X, the modulus N and B as inputs.

【0028】本発明(請求項9)は、請求項8に記載の
モンゴメリ除算方法において、前記第1のステップは、
整数Aと法Nを入力として中間結果C=A-1・2k
odNとパラメータk(L≦k≦2L)を求め、求めら
れた中間結果Cとパラメータkと法Nを入力として逆元
X=C・22n-k mod Nを求めるものであることを
特徴とする。
According to the present invention (claim 9), in the Montgomery division method according to claim 8, the first step comprises:
Intermediate result C = A −1 · 2 km with integer A and modulus N as inputs
and a parameter k (L ≦ k ≦ 2L), and an inverse element X = C · 2 2n−k mod N is obtained by using the obtained intermediate result C, parameter k, and modulus N as inputs. I do.

【0029】本発明(請求項10)は、正の整数N、正
の整数A(0≦A<N、AとNは互いに素)、正の整数
Bについて、Nを2進表現したときのビット長をLとし
て、n≧Lなる整数nに対して、Y=B・A-1・2n
mod Nなるモンゴメリ演算域での除算結果Yを求め
るモンゴメリ除算方法であって、整数Aと法Nを入力と
して第1の中間結果C=A-1・2k mod Nとパラ
メータk(L≦k≦2L)を求める第1のステップと、
この第1のステップにより求められた第1の中間結果C
と法NとBを入力として第2の中間結果D=B・C・2
-n mod Nを求める第2のステップと、この第2の
ステップにより求められた第2の中間結果Dと前記第1
のステップにより求められたパラメータkと法Nを入力
として除算結果Y=D・22n-K mod Nを求める第
3のステップとを有することを特徴とする。
According to the present invention (claim 10), when a positive integer N, a positive integer A (0 ≦ A <N, A and N are relatively prime), and a positive integer B, when N is expressed in binary, Assuming that the bit length is L, for an integer n where n ≧ L, Y = B · A −1 · 2 n
A Montgomery division method for obtaining a division result Y in a Montgomery operation area of mod N, wherein an integer A and a modulus N are input and a first intermediate result C = A −1 .2 k mod N and a parameter k (L ≦ k ≦ 2L); and
The first intermediate result C obtained by this first step
And the second intermediate result D = B · C · 2 by using
-n mod N, a second intermediate result D obtained by the second step, and the first
And a third step of obtaining a division result Y = D · 2 2n−K mod N using the parameter k and the modulus N obtained in the above step as inputs.

【0030】本発明(請求項11)は、正の奇整数N、
正の整数A(0≦A<N、AとNは互いに素)につい
て、Nを2進表現したときのビット長をLとして、n≧
Lなる整数nに対して、X=A-1・22n mod Nな
るモンゴメリ演算域での逆元Xを求めるモンゴメリ逆元
計算方法であって、整数Aと法Nを入力として中間結果
C=A-1・2k mod Nとパラメータk(L≦k≦
2L)を求め、求められた中間結果Cとパラメータkと
法Nを入力として逆元X=C・22n-k modNを求め
ることを特徴とする。
According to the present invention (claim 11), a positive odd integer N,
For a positive integer A (0 ≦ A <N, A and N are relatively prime), let L be the bit length when N is represented in binary, and n ≧
A Montgomery inverse element calculation method for obtaining an inverse element X in a Montgomery operation area of X = A −1 · 2n mod N with respect to an integer n of L, wherein an intermediate result C = A- 1 · 2 k mod N and parameter k (L ≦ k ≦
2L) is obtained, and the inverse element X = C 22 2 -k mod N is obtained by using the obtained intermediate result C, parameter k, and modulus N as inputs.

【0031】本発明(請求項12)は、正の奇整数N、
正の整数A(0≦A<N、AとNは互いに素)につい
て、Nを2進表現したときのビット長をLとして、n≧
Lなる整数nに対して、X=A-1・22n mod Nな
るモンゴメリ演算域での逆元Xを求めるモンゴメリ逆元
計算方法であって、初期状態を2進表現にてU=N、V
=A、T=0、S=1、k=0とし、Uの最下位ビット
が0ならば、Uを右シフトし、Sを左シフトし、kを1
増加するとともに、Vの最下位ビットが0ならば、Vを
右シフトし、Tを左シフトし、kを1増加する処理と、
Uの最下位ビットが1かつVの最下位ビットが1で、U
>Vならば、UからVを減じ、Uを右シフトし、TにS
を加え、Sを左シフトし、kを1増加する処理と、Uの
最下位ビットが1かつVの最下位ビットが1で、U≦V
ならば、VからUを減じ、Vを右シフトし、SにTを加
え、Tを左シフトし、kを1増加する処理からなる一連
のループ処理を、V>0の間、繰り返し、V=0になっ
た場合、T≧NならばTからNを減じた後に、NからT
を減じた値をTとし、T<NならばNからTを減じた値
をTとする第1のステップと、初期状態をi=0とし、
前記第1のステップにより求められたTを左シフトした
後、T≧NならばTからNを減じてiを1増加し、T<
Nならばiを1増加するループ処理を、i<2n−kの
間、繰り返し、i=2n−kになったときのTを逆元X
とする第2のステップとを有することを特徴とする。
According to the present invention (claim 12), a positive odd integer N,
For a positive integer A (0 ≦ A <N, A and N are relatively prime), let L be the bit length when N is represented in binary, and n ≧
A Montgomery inverse element calculation method for obtaining an inverse element X in a Montgomery operation area of X = A −1 · 2 2 n mod N for an integer n of L, where U = N in a binary representation, V
= A, T = 0, S = 1, k = 0, and if the least significant bit of U is 0, U is shifted right, S is shifted left, and k is 1
If the least significant bit of V is 0, V is shifted right, T is shifted left, and k is increased by 1;
If the least significant bit of U is 1 and the least significant bit of V is 1,
If> V, subtract V from U, shift U right, and add S to T
, S is shifted to the left, and k is increased by one. When the least significant bit of U is 1 and the least significant bit of V is 1, U ≦ V
Then, a series of loop processing consisting of subtracting U from V, shifting V to the right, adding T to S, shifting T to the left, and increasing k by 1 is repeated while V> 0. = 0, if T ≧ N, then subtract N from T, then N to T
A first step in which T is a value obtained by subtracting T from N if T <N, and an initial state i = 0,
After shifting T obtained in the first step to the left, if T ≧ N, N is subtracted from T, i is increased by 1, and T <
If N, the loop processing of increasing i by 1 is repeated while i <2n−k, and T when i = 2n−k is replaced by the inverse element X
And a second step.

【0032】本発明によれば、モンゴメリ演算域のまま
でモンゴメリ逆元計算を行なうモンゴメリ逆元計算手段
とモンゴメリ乗算手段を用いるため、モンゴメリ演算域
の元を入力として、モンゴメリ演算域での除算結果を直
接求めることができる。この結果、モンゴメリ演算域と
元の剰余系との変換・逆変換のオーバーヘッドがないた
め、モンゴメリ演算域での除算が高速に実現できる。
According to the present invention, since the Montgomery inverse element calculation means and the Montgomery multiplication means for performing the Montgomery inverse element calculation in the Montgomery operation area are used, the division result in the Montgomery operation area is input with the Montgomery operation area element as an input. Can be obtained directly. As a result, since there is no overhead of conversion and inverse conversion between the Montgomery operation area and the original remainder system, division in the Montgomery operation area can be realized at high speed.

【0033】また、本発明によれば、モンゴメリ演算域
のままモンゴメリ逆元計算を行なうことができ、モンゴ
メリ演算域と元の剰余系との変換・逆変換のオーバーヘ
ッドがないため、モンゴメリ演算域での逆元計算が高速
に実現できる。
Further, according to the present invention, the Montgomery inverse element calculation can be performed in the Montgomery operation area, and there is no overhead of conversion and inverse conversion between the Montgomery operation area and the original remainder system. Can be realized at high speed.

【0034】また、本発明によれば、モンゴメリ演算域
での逆元計算が多倍長レジスタの加減算とビットシフト
で実現できるため、ソフトウェア実装・ハードウェア実
装のどちらでも高速な装置構成が可能となる。さらに、
モンゴメリ演算域での除算も高速な装置構成が実現でき
る。
Further, according to the present invention, the inverse calculation in the Montgomery operation area can be realized by addition / subtraction of a multiple-length register and bit shift, so that a high-speed device configuration can be realized by either software implementation or hardware implementation. Become. further,
A high-speed device configuration can also be realized for division in the Montgomery operation area.

【0035】したがって、楕円曲線暗号などのように剰
余系での乗算と除算を含む演算の繰り返し処理を基本演
算とする暗号において、全体としての処理時間を高速化
することができる。
Therefore, in an encryption such as an elliptic curve encryption which uses a repetition of an operation including multiplication and division in a remainder system as a basic operation, the overall processing time can be shortened.

【0036】なお、装置に係る本発明は方法に係る発明
としても成立し、方法に係る本発明は装置に係る発明と
しても成立する。
The present invention relating to the apparatus is also realized as an invention relating to a method, and the present invention relating to a method is also realized as an invention relating to an apparatus.

【0037】また、装置または方法に係る本発明は、コ
ンピュータに当該発明に相当する手順を実行させるため
の(あるいはコンピュータを当該発明に相当する手段と
して機能させるための、あるいはコンピュータに当該発
明に相当する機能を実現させるための)プログラムを記
録したコンピュータ読取り可能な記録媒体としても成立
する。
The present invention relating to an apparatus or a method is provided for causing a computer to execute a procedure corresponding to the present invention (or for causing a computer to function as means corresponding to the present invention, or a computer corresponding to the present invention). The present invention is also realized as a computer-readable recording medium in which a program for realizing the function of performing the above is recorded.

【0038】[0038]

【発明の実施の形態】以下、図面を参照しながら発明の
実施の形態を説明する。
Embodiments of the present invention will be described below with reference to the drawings.

【0039】なお、以下では、整数s,uについてs
mod uは、sをuで割ったときの剰余を表すものと
する。
In the following, for integers s and u, s
mod u represents the remainder when s is divided by u.

【0040】前述したようにモンゴメリ演算域での乗算
は一般に、剰余系での乗算よりも効率良く実装できるこ
とが知られており、RSA暗号など剰余系の乗算を繰り
返す方式を実現する場合、モンゴメリ演算が利用される
ことがある。しかし、RSA暗号のように暗号化・復号
化に乗算を用いるだけではなく、除算や逆元計算を用い
る暗号もある。例えば、楕円曲線暗号では、剰余系での
四則演算を組合せて単位演算が構成され、その単位演算
を所定の回数繰り返すことで暗号アルゴリズムが構成さ
れる。ところが、モンゴメリ演算域での除算や逆元計算
としては効率良く実装できるものがなく、楕円曲線暗号
等のように剰余系での四則演算を組合せて単位演算が構
成されるものについてはモンゴメリ演算域を利用した処
理の効率化が困難であった。
As described above, it is generally known that multiplication in the Montgomery operation area can be implemented more efficiently than multiplication in the remainder system. May be used. However, there are ciphers that use not only multiplication but also division and inverse element calculation for encryption / decryption like the RSA encryption. For example, in elliptic curve cryptography, a unit operation is configured by combining four arithmetic operations in the remainder system, and an encryption algorithm is configured by repeating the unit operation a predetermined number of times. However, there is nothing that can be efficiently implemented as division or inverse element calculation in the Montgomery operation area, and in the case where unit arithmetic is formed by combining four arithmetic operations in a remainder system such as elliptic curve cryptography, the Montgomery operation area It was difficult to improve the efficiency of processing using

【0041】本実施形態に係る除算装置、逆元計算装置
は、それぞれモンゴメリ演算域での剰余除算、逆元計算
の結果を効率的に求めることができるようにしたもので
ある。
The dividing device and the inverse computing device according to the present embodiment can efficiently obtain the results of the remainder division and the inverse computing in the Montgomery operation area, respectively.

【0042】最初に、通常の剰余系Zp(pを法とする
剰余系を表す)とモンゴメリ演算域との関係およびモン
ゴメリ演算域での演算について説明する。
First, the relationship between a normal remainder system Zp (representing a remainder system modulo p) and a Montgomery operation area and an operation in the Montgomery operation area will be described.

【0043】図12に、モンゴメリ演算域と剰余系Zp
の2つの代数系の間における、定義域、元、逆元、およ
び加算、減算、乗算、除算の四則演算の関係を示す。
FIG. 12 shows the Montgomery operation area and the remainder system Zp.
2 shows a relationship between a domain, an element, an inverse element, and four arithmetic operations of addition, subtraction, multiplication, and division between the two algebraic systems.

【0044】なお、法の値pは整数であるが、好ましく
は奇整数を用いる。また、暗号システムに適用する場
合、pには素数を用いることが多い。
Although the modulus value p is an integer, an odd integer is preferably used. When applied to a cryptographic system, p is often a prime number.

【0045】剰余系Zpでの元をaとするとき、それに
対応するモンゴメリ演算域の元Aには、 A=a・R mod p により与えられる。
When an element in the remainder system Zp is a, the element A in the Montgomery operation area corresponding thereto is given by A = a · R mod p.

【0046】一方、モンゴメリ演算域の元Aから剰余系
Zpの元aへの逆変換は、 a=A・R-1 mod p により与えられる。
On the other hand, the inverse transformation from the element A of the Montgomery operation area to the element a of the remainder system Zp is given by a = A · R −1 mod p.

【0047】ここで、Rはモンゴメリ演算域を定義する
パラメータであり、その条件は、 (i)Rと法pとは互いに素であること (ii)R>p の2つである。
Here, R is a parameter that defines the Montgomery operation area, and there are two conditions: (i) R and modulus p are relatively prime; and (ii) R> p.

【0048】一般にRは2のべき乗(R=2n )とし、
さらにハードウェアのワード長の倍数を用いることが多
い。演算幅をできるだけ小さくするためには、法pのビ
ット数をLとした場合に、n≧Lを満たし、ワード長の
倍数である最小の値を用いることが好ましい。以下で
は、簡単のために、nは法pのビット長Lと等しいもの
として説明する。
In general, R is a power of 2 (R = 2 n ),
Further, a multiple of the word length of hardware is often used. In order to make the operation width as small as possible, when the number of bits of the modulus p is L, it is preferable to use the minimum value that satisfies n ≧ L and is a multiple of the word length. In the following, for the sake of simplicity, it is assumed that n is equal to the bit length L of the modulus p.

【0049】図13(a)に、p=23、R=25 (n
=5)とした場合の剰余系Zpの元aとモンゴメリ演算
域の元Aとの対応関係を一例として示す(ただし、現実
の暗号装置等で使用するpは非常に大きな整数であ
る)。
FIG. 13A shows that p = 23 and R = 2 5 (n
= 5), the correspondence between the element a of the remainder system Zp and the element A of the Montgomery operation area is shown as an example (however, p used in an actual encryption device or the like is a very large integer).

【0050】モンゴメリ演算域での除算装置や逆元計算
装置では、R=2n を用いるものとする。
It is assumed that R = 2 n is used in the division device and the inverse calculation device in the Montgomery operation area.

【0051】次に、モンゴメリ演算域での逆元計算と四
則演算は、剰余系Zpの元aに対しA=a・R mod
pなるモンゴメリ演算域の元が対応することを考慮し
て、図12のように定義できる。
Next, the inverse element calculation and the four arithmetic operations in the Montgomery operation area are performed by A = a · R mod with respect to the element a of the remainder system Zp.
Considering that the element of the Montgomery operation area of p corresponds, it can be defined as shown in FIG.

【0052】まず、モンゴメリ演算域の加算および減算
は、剰余系でのそれらと同様、 A+B mod p A−B mod p で定義される。
First, addition and subtraction in the Montgomery operation area are defined by A + B mod p AB mod p, similarly to those in the remainder system.

【0053】次に、モンゴメリ乗算は、 A・B・R-1 mod p により与えられる。Next, Montgomery multiplication is given by A · B · R −1 mod p.

【0054】他のモンゴメリ演算域での演算はモンゴメ
リ乗算ABR-1 mod pをもとにすると以下のよう
のに定義される。
Operations in other Montgomery operation areas are defined as follows based on Montgomery multiplication ABR -1 mod p.

【0055】Aの逆元Xは、AとXを乗数・被乗数とし
てモンゴメリ乗算を行なったときに、モンゴメリ演算域
での単位元となるRを結果として与えるような値とな
る。すなわち、逆元Xは、 A・X=R2 mod p を満たす値である。
The inverse element X of A is such a value that, when Montgomery multiplication is performed with A and X as multipliers and multiplicands, R as a unit element in the Montgomery operation area is given as a result. That is, the inverse element X is a value that satisfies A · X = R 2 mod p.

【0056】したがって、モンゴメリ演算域での法をp
とするAについての逆元計算は、 X=A-1・R2 mod p により与えられる。
Therefore, the modulus in the Montgomery operation domain is p
The inverse calculation for A is given by X = A −1 · R 2 mod p.

【0057】後述する本実施形態に係る逆元計算装置
は、入力Aと法pに対して、X=A-1・R2 mod
pを効率的に求める装置である。
The inverse calculation device according to the present embodiment, which will be described later, has X = A −1 · R 2 mod with respect to the input A and the modulus p.
This is a device for efficiently obtaining p.

【0058】同様にして、法をp、Aを除数、Bを被除
数すとるモンゴメリ除算は、 Y=B・A-1・R mod p =B・Ai ・R-1 mod p (ただし、Ai はモン
ゴメリ演算域でのAの逆元) により与えられる。
Similarly, Montgomery division where the modulus is p, A is a divisor, and B is a dividend is: Y = B · A −1 · R mod p = B · A i · R −1 mod p (where A i is given by the inverse of A in the Montgomery operation domain).

【0059】後述する本実施形態に係る除算装置は、入
力A,Bと法pに対して、B・Ai・R mod pを
効率的に求める装置である。
A dividing apparatus according to the present embodiment, which will be described later, is an apparatus for efficiently obtaining B ・Ai・ R mod p with respect to inputs A and B and modulus p.

【0060】図13(b)に、p=23、R=25 (n
=5)とした場合の剰余系Zpにおける元aと逆元xの
対応関係を一例として示す。また、図13(c)に、p
=23、R=25 (n=5)とした場合のモンゴメリ演
算域における元Aと逆元Xの対応関係を一例として示
す。
FIG. 13B shows that p = 23 and R = 2 5 (n
= 5) is shown as an example of the correspondence between the element a and the inverse element x in the remainder system Zp. FIG. 13C shows that p
= 23, R = 2 5 (n = 5), the correspondence between the element A and the inverse element X in the Montgomery operation area is shown as an example.

【0061】さて、このようなモンゴメリ演算を利用す
るには、最初に剰余系Zpからモンゴメリ演算域への変
換を行ない、モンゴメリ演算域で所定の演算処理を繰り
返した後、モンゴメリ演算域から剰余系Zpへの逆変換
を行なう。なお、これら変換・逆変換はそれぞれ多倍長
乗算1回程度の処理であり、全体としてはあまり大きな
オーバヘッドではない。
To use such a Montgomery operation, conversion from the remainder system Zp to a Montgomery operation region is first performed, and a predetermined operation process is repeated in the Montgomery operation region. Inverse conversion to Zp is performed. Note that each of these conversions and inverse conversions is a process of about one multiple length multiplication, and does not have a very large overhead as a whole.

【0062】ここで、モンゴメリ演算を利用した具体例
を示す。
Here, a specific example utilizing the Montgomery operation will be described.

【0063】例えば、p=23、R=25 (n=5)と
して、モンゴメリ演算を利用し剰余系Zpの元a=3の
逆元xを求める場合を考える。まず、剰余系Zpの元a
=3をモンゴメリ演算域の元Aに変換すると、A=4が
求まる。次に、モンゴメリ演算域の元A=4の逆元Xと
して、X=3が求まる。そして、モンゴメリ演算域の元
X=3を剰余系Zpの元xに逆変換すると、x=8が求
まる。なお、剰余系Zpの元a=3の逆元xを直接、剰
余系で求めると、x=8となり、上記の結果と一致する
ことがわかる。
For example, assume that p = 23 and R = 2 5 (n = 5), and the inverse element x of the element a = 3 of the remainder system Zp is obtained using Montgomery arithmetic. First, the element a of the residue system Zp
= 3 is converted to the element A of the Montgomery operation area, A = 4 is obtained. Next, X = 3 is obtained as the inverse element X of the element A = 4 in the Montgomery operation area. Then, when the element X = 3 in the Montgomery operation area is inversely transformed into the element x of the remainder system Zp, x = 8 is obtained. When the inverse element x of the element a = 3 of the remainder system Zp is directly obtained by the remainder system, x = 8, which is consistent with the above result.

【0064】また、例えば、p=23、R=25 (n=
5)として、モンゴメリ演算を利用し剰余系Zpの乗算
3×6を行なう場合を考える。まず、剰余系Zpの3と
6をモンゴメリ演算域の4と8に変換し、Y=4×8×
-1 mod pから、Y=1が求まる。これを剰余系
Zpに逆変換すると、乗算結果としてy=18が求ま
る。なお、剰余系Zpで直接y=3×6 mod pを
求めると、y=18となり、上記の結果と一致すること
がわかる。
Further, for example, p = 23, R = 2 5 (n =
5) Consider a case where multiplication 3 × 6 of the remainder system Zp is performed using Montgomery arithmetic. First, 3 and 6 of the residue system Zp are converted into 4 and 8 of the Montgomery operation area, and Y = 4 × 8 ×
From R -1 mod p, Y = 1 is obtained. When this is inversely transformed into the remainder system Zp, y = 18 is obtained as a multiplication result. Note that when y = 3 × 6 mod p is directly obtained by the remainder system Zp, y = 18, which is consistent with the above result.

【0065】また、例えば、p=23、R=25 (n=
5)として、モンゴメリ演算を利用し剰余系Zpの剰余
除算6/2を行なう場合を考える。まず、剰余系Zpの
6と2をモンゴメリ演算域の8と18に変換し、被除数
18の逆元として16を求め、Y=8/18×R-1
od p=8×16×R-1 mod pから、Y=4が
求まる。これを剰余系Zpに逆変換すると、除算結果と
してy=3が求まる。なお、剰余系Zpで直接y=6/
2 mod pを求めると、y=3となり、上記の結果
と一致することがわかる。
Further, for example, p = 23, R = 2 5 (n =
5) Consider a case where the remainder division 6/2 of the remainder system Zp is performed using Montgomery arithmetic. First, 6 and 2 of the remainder system Zp are converted into 8 and 18 of the Montgomery operation area, 16 is obtained as the inverse of the dividend 18, and Y = 8/18 × R −1 m
Y = 4 is obtained from od p = 8 × 16 × R −1 mod p. When this is inversely transformed into a remainder system Zp, y = 3 is obtained as a division result. Note that y = 6 /
When 2 mod p is obtained, y = 3, which is consistent with the above result.

【0066】以下では、本実施形態に係るモンゴメリ演
算域での逆元計算装置および除算装置について説明す
る。
In the following, the inverse calculation device and the division device in the Montgomery operation area according to the present embodiment will be described.

【0067】図1に、本発明の一実施形態に係るモンゴ
メリ演算域での除算装置の基本構成を示す。本除算装置
200は、モンゴメリ逆元計算部201とモンゴメリ乗
算部202を備えており、モンゴメリ逆元計算部201
とモンゴメリ乗算部202をシーケンシャルに利用して
モンゴメリ除算装置200を構成している。
FIG. 1 shows a basic configuration of a division device in a Montgomery operation area according to an embodiment of the present invention. The division device 200 includes a Montgomery inverse element calculation unit 201 and a Montgomery multiplication unit 202.
And the Montgomery multiplication unit 202 are sequentially used to constitute the Montgomery division device 200.

【0068】本実施形態では、モンゴメリ除算Y=B・
-1・R mod pを、 Y=B・(A-1・R2 )・R-1 mod p =(B・(A-1・R2 mod p)・R-1 mod p =B・X・R-1 mod p と変形して、まず、除数Aと法pを入力としてモンゴメ
リ逆元計算部201によりモンゴメリ演算域でのAの逆
元Xを求め、次に、このXと上記の被除数Bと法pを入
力としてモンゴメリ乗算部202によりY=B・X・R
-1 mod p、すなわちY=B・A-1・R mod
pを求める。
In the present embodiment, Montgomery division Y = B ·
A −1 · R mod p is represented by Y = B · (A −1 · R 2 ) · R −1 mod p = (B · (A −1 · R 2 mod p) · R −1 mod p = B · X · R −1 mod p, and first, using the divisor A and the modulus p as inputs, the Montgomery inverse element calculation unit 201 obtains the inverse element X of A in the Montgomery operation area. Using the dividend B and the modulus p as inputs, the Montgomery multiplication unit 202 calculates Y = B × X ・ R
-1 mod p, that is, Y = B · A −1 · R mod
Find p.

【0069】モンゴメリ乗算部202は、剰余系での乗
算部に比べて高速に実現できることが知られており、本
実施形態では例えば文献(1)などに開示された公知の
技術を用いることができる。
It is known that the Montgomery multiplication unit 202 can be realized at a higher speed than a multiplication unit in a remainder system, and in this embodiment, a known technique disclosed in, for example, Reference (1) can be used. .

【0070】図14に、モンゴメリ乗算部202におけ
る処理手順の一例を示す。ここでは、2数A、Bに対し
て、A・B・R-1 mod Nを求めるものとして表記
する。
FIG. 14 shows an example of the processing procedure in the Montgomery multiplication section 202. Here, it is described that A · B · R −1 mod N is calculated for two numbers A and B.

【0071】V=−N-1 mod R(すなわち、V・
N=−1 mod Rを満たすV)を求め(ステップS
101)、T=A・Bを求め(ステップS102)、W
=((T mod R)・V) mod Rを求め(ス
テップS103)、T+W・NをTに代入し(ステップ
S104)、T=T/Rを実行する(ステップS10
5)。そして、T>Nならば(ステップS106)、T
からNを減ずる(ステップS107)。このときに得ら
れるTが法をNとするAとBのモンゴメリ乗算結果であ
る。なお、Rを2のべき乗にとれば、剰余算や除算は2
進数の下位の切り出しや上位の切り出しで実現できる。
また、Vの値を法Nについて計算しておくことで、処理
の効率化が可能である。
V = −N −1 mod R (ie, V ·
N = V that satisfies −1 mod R) (Step S)
101), T = AB is obtained (step S102),
= ((T mod R) · V) mod R is obtained (step S103), T + W · N is substituted for T (step S104), and T = T / R is executed (step S10).
5). If T> N (step S106), T
Is subtracted from N (step S107). T obtained at this time is a Montgomery multiplication result of A and B where the modulus is N. If R is a power of 2, the remainder calculation and the division are 2
It can be realized by cutting out the lower part or the upper part of the radix.
Further, by calculating the value of V with respect to the modulus N, it is possible to increase the processing efficiency.

【0072】図15に、モンゴメリ乗算部202におけ
る処理手順の他の例を示す。この処理手順は図14の処
理手順を改良し、必要な演算を多倍長乗算2回程度にし
たものである。ここでは、2数A、Bに対して、A・B
・R-1 mod Nを求めるものとして表記する。ま
た、A、B、Nなどは、基数bで表現されているものと
する。例えば、A=ar-1 r-1 +ar-2 r-2 +…+
1 b+a0 などの形式である。ここで、基数bは2の
べき乗とし、例えば28 、216である。もちろん、b=
2でも構わない。
FIG. 15 shows another example of the processing procedure in the Montgomery multiplication section 202. This processing procedure is obtained by improving the processing procedure of FIG. 14 and reducing the number of necessary operations to about two times multiple-precision multiplication. Here, A · B for two numbers A and B
Notation for calculating R -1 mod N A, B, N, and the like are assumed to be represented by a radix b. For example, A = ar- 1br-1 + ar- 2br-2 + ... +
a 1 b + a 0 . Here, the radix b is a power of 2, for example, 2 8 or 2 16 . Of course, b =
2 is acceptable.

【0073】v0 =−N0 -1 mod b(すなわち、
0 ・N0 =−1 mod bを満たすv0 )を求め、
また、T=0、i=0とし(ステップS201)、T+
iBbi をTに代入し(ステップS202)、mi
i 0 mod bを求め(ステップS203)、T
+mi Nbi をTに代入し(ステップS204)、iを
1増加する。次に、ステップS206で、i≦(r−
1)ならばステップS202に戻る。また、ステップS
206で、i>(r−1)ならばループを抜けステップ
S207に移り、T=T/Rを実行する(ステップS2
07)。そして、T>Nならば(ステップS208)、
TからNを減ずる(ステップS209)。このときに得
られるTが法をNとするAとBのモンゴメリ乗算結果で
ある。
V 0 = −N 0 −1 mod b (ie,
v v 0) to seek to meet the 0 · N 0 = -1 mod b ,
Also, T = 0 and i = 0 (step S201), and T +
substituting a i Bb i to T (step S202), m i =
t i v seek 0 mod b (step S203), T
+ M i Nb i a is substituted into T (step S204), 1 increasing i. Next, in step S206, i ≦ (r−
If 1), the process returns to step S202. Step S
If i> (r−1), the process exits the loop and moves to step S207, where T = T / R is executed (step S2).
07). If T> N (step S208),
N is subtracted from T (step S209). T obtained at this time is a Montgomery multiplication result of A and B where the modulus is N.

【0074】この手順の1つの特徴は、ステップS20
7の実行直前において、Tの下位側のLブロックが全て
0(すなわち、TはRの倍数)になる点にある。したが
って、ワーク領域を削減することが可能となる。また、
剰余算は2進数の下位の切り出しで実現できる。また、
0 の値を法Nについて計算しておくことで、処理の効
率化が可能である。
One feature of this procedure is that step S20
Immediately before the execution of 7, all the L blocks on the lower side of T become 0 (that is, T is a multiple of R). Therefore, the work area can be reduced. Also,
The remainder operation can be realized by cutting out the lower part of a binary number. Also,
By calculating the value of v 0 with respect to the modulus N, the efficiency of the processing can be increased.

【0075】以上のようにモンゴメリ乗算部202は、
効率的な実現が可能である。また、詳しくは後述する
が、本発明によればモンゴメリ逆元計算部201を効率
的に実現することができる。従って、本実施形態の除算
装置200によれば、モンゴメリ演算域での除算を効率
良く実行することができる。
As described above, the Montgomery multiplication unit 202
Efficient realization is possible. Further, as will be described later in detail, according to the present invention, the Montgomery inverse element calculation unit 201 can be efficiently realized. Therefore, according to the division device 200 of the present embodiment, division in the Montgomery operation area can be efficiently executed.

【0076】図2に、本実施形態に係るモンゴメリ演算
域での逆元計算装置201の基本構成の一例を示す。も
ちろん、この逆元計算装置201は、図1のモンゴメリ
除算装置200のモンゴメリ逆元計算部201として用
いることができる。
FIG. 2 shows an example of the basic configuration of the inverse element calculation device 201 in the Montgomery operation area according to the present embodiment. Of course, this inverse element calculation device 201 can be used as the Montgomery inverse element calculation unit 201 of the Montgomery division device 200 in FIG.

【0077】本逆元計算装置201は、逆元計算部30
1と逆元補正部302を備えており、逆元計算部301
と逆元補正部302をシーケンシャルに利用してモンゴ
メリ逆元計算装置201を構成している。
The inverse element calculation unit 201 includes the inverse element calculation unit 30
1 and an inverse element correction unit 302.
The Montgomery inverse calculation device 201 is configured by sequentially using the inverse correction unit 302.

【0078】本実施形態では、逆元計算X=A-1・R2
mod p=A-1・22n modpを、 X=A-1・(2k ・22n-k) mod p =(A-1・2k )・22n-k mod p =(A-1・2k mod p)・22n-k mod p =C・22n-k mod p と変形して、まず、整数Aと法p(ただしAはpと互い
に素)を入力として逆元計算部301によりC=A-1
k mod pとkを求める。ここで、kはL以上2
L以下の整数で、Aとpから一意に決定される値であ
る。次に、このCとkと法pを入力として逆元補正部3
02により逆元X=C・22n-k mod p、すなわち
X=A-1・R2 mod pを求める。
In the present embodiment, the inverse element calculation X = A −1 · R 2
Mod p = A −1 · 2 2n modp, X = A −1 · (2 k · 2 2n−k ) mod p = (A− 1 · 2 k ) · 2 2n−k mod p = (A −1) • 2 k mod p) · 2 2n−k mod p = C · 2 2n−k mod p, first, the inverse element calculation unit using the integer A and the modulus p (where A is relatively prime to p) as input According to 301, C = A -1.
Find 2 k mod p and k. Here, k is not less than L and 2
It is an integer less than or equal to L and is a value uniquely determined from A and p. Next, the C, k, and modulus p are input and the inverse element correction unit 3
02, the inverse element X = C ・ 2 2−k mod p, that is, X = A −1 · R 2 mod p is obtained.

【0079】図3および図4に、逆元計算部301にお
ける処理手順の一例を示す。
FIG. 3 and FIG. 4 show an example of a processing procedure in the inverse calculation unit 301.

【0080】この手順は、Uレジスタ、Vレジスタ、T
レジスタ、Sレジスタの4つの多倍長レジスタを利用
し、レジスタの左右へのシフト演算とレジスタ同士の加
算、減算で構成され、ループの繰り返し回数がループカ
ウンタとして用いる変数kに格納される。kの値は法p
のビットサイズをLとするとき、L以上2L以下であ
り、加減算の処理量はO(L)であるため、全体でも高
々O(L2 )の処理量である。以下、図3および図4の
手順を流れを追って説明する。
This procedure consists of the U register, V register, T
Using a multiple length register of four registers, a register and an S register, the register is configured by a shift operation to the left and right of the register and addition and subtraction of the registers, and the number of loop iterations is stored in a variable k used as a loop counter. The value of k is modulo p
Is L or more and 2L or less and the processing amount of addition and subtraction is O (L), so that the total processing amount is at most O (L 2 ). Hereinafter, the procedures of FIGS. 3 and 4 will be described following the flow.

【0081】まず、与えられた法pをレジスタUに、p
以下の正の整数AをレジスタVに設定する。また、レジ
スタTに0、レジスタSに1、レジスタkに0をそれぞ
れ設定する(ステップS401)。以上が、変数初期化
の処理である。
First, the given modulus p is stored in the register U,
The following positive integer A is set in register V: Further, 0 is set in the register T, 1 is set in the register S, and 0 is set in the register k (step S401). The above is the variable initialization processing.

【0082】以降、ステップS402からステップS4
10の処理を、レジスタVが正の値である間(0になる
まで)、繰り返す。
Thereafter, steps S402 to S4
The process of 10 is repeated while the register V is a positive value (until it becomes 0).

【0083】まず、レジスタVが0でなければ、繰り返
し処理を続けるので、ステップS403にとぶ(ステッ
プS402)。
First, if the value of the register V is not 0, the process is repeated, and the process jumps to step S403 (step S402).

【0084】レジスタUの最下位ビットが0か否かを判
定する(ステップS403)。もし0であれば、レジス
タUを右に1ビットシフトし(ステップS411)、レ
ジスタSを左に1ビットシフトして(ステップS41
2)、ステップS410にとぶ。そして、ステップS4
10にてkの値を1増加し、ステップS402に戻る。
It is determined whether the least significant bit of the register U is 0 (step S403). If 0, the register U is shifted right by one bit (step S411), and the register S is shifted left by one bit (step S41).
2), and skip to step S410. Then, step S4
At 10, the value of k is increased by 1, and the process returns to step S402.

【0085】ステップS403にてレジスタUの最下位
ビットが0でなければ、レジスタVの最下位ビットが0
か否かを判定する(ステップS404)。もし0であれ
ば、レジスタVを右に1ビットシフトし(ステップS4
13)、レジスタTを左に1ビットシフトして(ステッ
プS414)、ステップS410にとぶ。そして、ステ
ップS410にてkの値を1増加し、ステップS402
に戻る。
If the least significant bit of register U is not 0 at step S403, the least significant bit of register V is 0
It is determined whether or not (step S404). If 0, the register V is shifted right by one bit (step S4).
13) The register T is shifted one bit to the left (step S414), and the process skips to step S410. Then, in step S410, the value of k is increased by 1, and in step S402
Return to

【0086】ステップS403にてレジスタUの最下位
ビットが0でなく、ステップS404にてレジスタVの
最下位ビットが0でなければ、レジスタUとVの大小比
較を行なう(ステップS405)。
If the least significant bit of the register U is not 0 in step S403 and the least significant bit of the register V is not 0 in step S404, the magnitudes of the registers U and V are compared (step S405).

【0087】もしU>Vならば、レジスタUからレジス
タVの内容を引き(ステップS415)、レジスタUを
右に1ビットシフトし(ステップS416)、レジスタ
TにレジスタSの内容を加算し(ステップS417)、
レジスタSを左に1ビットシフトする(ステップS41
8)。そして、ステップS410にてkの値を1増加
し、ステップS402に戻る。
If U> V, the content of register V is subtracted from register U (step S415), register U is shifted right by one bit (step S416), and the content of register S is added to register T (step S416). S417),
The register S is shifted left by one bit (step S41).
8). Then, in step S410, the value of k is increased by 1, and the process returns to step S402.

【0088】もしステップS405の結果、U<Vもし
くはU=Vの場合は、レジスタVからレジスタUの内容
を引き(ステップS406)、レジスタVを右に1ビッ
トシフトし(ステップS407)、レジスタSにレジス
タTの内容を加算し(ステップ408)、レジスタTを
左に1ビットシフトする(ステップS409)。そし
て、ステップS410にてkの値を1増加し、ステップ
S402に戻る。
If U <V or U = V as a result of step S405, the contents of register U are subtracted from register V (step S406), and register V is shifted right by one bit (step S407). Is added to the contents of the register T (step 408), and the register T is shifted one bit to the left (step S409). Then, in step S410, the value of k is increased by 1, and the process returns to step S402.

【0089】以上のループを繰り返し、ステップS40
2にてレジスタVが0になった場合、ステップS419
に移る。そして、まず、レジスタUの内容が1かどうか
をチェックする。レジスタUの内容は入力Aと法pの最
大公約数になるので、もしUが1でなければAとpは互
いに素でないことになるので、Aの逆元は存在しない。
そのため、ステップS423でエラー処理をして終了す
る。
The above loop is repeated, and step S40
If the value of the register V becomes 0 in Step 2, the process proceeds to Step S419.
Move on to Then, first, it is checked whether or not the content of the register U is 1. Since the contents of register U are the greatest common divisor of input A and modulus p, if U is not 1, A and p are not disjoint, and there is no inverse of A.
Therefore, error processing is performed in step S423, and the process ends.

【0090】エラーでない場合、すなわちステップS4
19にてレジスタUの内容が1である場合、ステップS
420でTとpの大小比較を行ない、もしTがp以上で
あれば、Tからpを引き(ステップS421)、Tがp
以下の整数になるようにする。そして、ステップS42
2でpからTの内容を引いた結果をTに格納して処理を
終了する。
If it is not an error, that is, step S4
If the content of the register U is 1 in step 19, step S
At 420, a comparison is made between T and p. If T is greater than or equal to p, p is subtracted from T (step S421), and T becomes p.
It should be the following integer. Then, step S42
The result obtained by subtracting the contents of T from p in step 2 is stored in T, and the process ends.

【0091】以上の処理により、Tの内容にはA-1・2
k mod pの計算結果が格納される。
By the above processing, the content of T is A −1 · 2
The calculation result of k mod p is stored.

【0092】次に、このT=A-1・2k mod pと
kの値を逆元補正部302に入力して、モンゴメリ逆元
値を計算する。
Next, the values of T = A −1 .2 k mod p and k are input to the inverse correction unit 302 to calculate the Montgomery inverse value.

【0093】図5に、逆元補正部302の処理手順の一
例を示す。以下、図5の手順を流れを追って説明する。
FIG. 5 shows an example of the processing procedure of the inverse correction unit 302. Hereinafter, the procedure of FIG. 5 will be described following the flow.

【0094】まず、R=2n であるところのnを2倍し
た値をLにし、ループカウンタiを0に設定する(ステ
ップS501)。
First, a value obtained by doubling n where R = 2 n is set to L, and a loop counter i is set to 0 (step S501).

【0095】次に、ループの繰り返し回数としてL−k
の値を求め、mに設定する(ステップS502)。
Next, as the number of loop repetitions, L−k
Is obtained and set to m (step S502).

【0096】以降、ステップS503からステップS5
07の処理を、ループカウンタがmになるまで繰り返
す。
Thereafter, steps S503 to S5
Step 07 is repeated until the loop counter reaches m.

【0097】すなわち、ステップS503でiとmを比
較し、iがm未満の場合には、まず、レジスタTを1ビ
ット左シフトする(ステップS504)。次に、Tとp
の大小比較を行ない(ステップS505)、もしTがp
以上であればTからpを引く(ステップS506)。そ
して、ステップS507にてiの値を1増加し、ステッ
プS503に戻る。
That is, i and m are compared in step S503, and if i is less than m, the register T is first shifted left by one bit (step S504). Next, T and p
(Step S505), and if T is p
If so, p is subtracted from T (step S506). Then, the value of i is increased by 1 in step S507, and the process returns to step S503.

【0098】ステップS503でi=mの場合には、上
記の処理ループを抜ける。このループを抜けた時点での
Tの値がモンゴメリ逆元値である。最後に、ステップS
508で逆元の値Tを出力して処理を終了する。
If i = m in step S503, the process exits the above processing loop. The value of T at the time of exiting this loop is the Montgomery inverse value. Finally, step S
In step 508, the inverse value T is output, and the process ends.

【0099】以上に示した図3、図4、図5の手順はレ
ジスタの加減算とビットシフトのみで実現されるため、
効率的な装置化が可能である。
Since the procedures of FIGS. 3, 4 and 5 described above are realized only by addition and subtraction and bit shift of a register,
Efficient deviceization is possible.

【0100】以下では、具体例を用いて、本実施形態の
モンゴメリ逆元計算装置(または除算装置200のモン
ゴメリ逆元計算部)201の動作を説明する。
Hereinafter, the operation of the Montgomery inverse element calculation device 201 (or the Montgomery inverse element calculation unit of the division device 200) 201 of this embodiment will be described using a specific example.

【0101】ここでは、一例として、法の値p=23、
R=25 (n=5)としたときに、モンゴメリ演算域で
の元A=19の逆元を求める場合について示す。
Here, as an example, the modulus value p = 23,
The case where the inverse element of the element A = 19 in the Montgomery calculation area when R = 2 5 (n = 5) will be described.

【0102】図6(a)、(b)には、逆元計算部30
1における、Uレジスタ、Vレジスタ、Tレジスタ、S
レジスタのそれぞれの内容を2進数で表した値(ただ
し、TレジスタとSレジスタにおける上位側ビットの0
の表示は省略してある)と、ループカウンタkの内容を
10進数で表した値の変遷を、各処理ループについて示
す。
FIGS. 6A and 6B show the inverse element calculation unit 30.
1, U register, V register, T register, S register
The contents of each register are represented by binary numbers (however, the upper bits of the T register and the S register are 0 bits).
Is omitted) and the transition of the value of the content of the loop counter k expressed in decimal notation is shown for each processing loop.

【0103】また、図6(c)には、逆元補正部302
における、Tレジスタの内容を2進数で表した値(ただ
し、上位側ビットの0の表示は省略してある)の変遷
を、各処理ループについて示す。
FIG. 6C shows the inverse correction unit 302.
Shows the transition of the value of the T register expressed in binary number (however, the display of 0 of the upper bit is omitted) for each processing loop.

【0104】まず、逆元計算部301において、初期化
処理の結果、Uレジスタ=p=10111、Vレジスタ
=A=10011、Tレジスタ=0、Sレジスタ=1、
k=0が設定される。
First, in the inverse element calculation unit 301, as a result of the initialization processing, U register = p = 1111, V register = A = 10011, T register = 0, S register = 1,
k = 0 is set.

【0105】1回目のループでは、U>Vからステップ
S405にてYesとなり、ステップS415〜S41
8とS410が実行される。この結果、Uレジスタ=0
0010、Vレジスタ=10011、Tレジスタ=1、
Sレジスタ=10、k=1となる。
In the first loop, since U> V, the result of step S405 is Yes, and steps S415 to S41
8 and S410 are executed. As a result, U register = 0
0010, V register = 10011, T register = 1,
S register = 10 and k = 1.

【0106】2回目のループでは、LSB(U)=0か
らステップS403にてYesとなり、ステップS41
1とS412とS410が実行される。この結果、Uレ
ジスタ=00001、Vレジスタ=10011、Tレジ
スタ=10、Sレジスタ=100、k=2となる。
In the second loop, since LSB (U) = 0, the result is Yes in step S403, and step S41
1, S412 and S410 are executed. As a result, U register = 00001, V register = 10011, T register = 10, S register = 100, and k = 2.

【0107】3回目のループでは、U<Vからステップ
S405にてNoとなり、ステップS406〜S409
とS410が実行される。この結果、Uレジスタ=00
001、Vレジスタ=01001、Tレジスタ=10、
Sレジスタ=101、k=3となる。
In the third loop, No is determined in step S405 from U <V, and steps S406 to S409 are performed.
And S410 are executed. As a result, U register = 00
001, V register = 01001, T register = 10,
S register = 101 and k = 3.

【0108】以上のようにして処理を繰り返した結果、
7回目のループの実行後、Uレジスタ=00001、V
レジスタ=00000、Tレジスタ=100000、S
レジスタ=10111、k=7となり、Vレジスタ=0
0000となったので、処理ループを抜ける。
As a result of repeating the processing as described above,
After execution of the seventh loop, U register = 00001, V
Register = 000000, T register = 100000, S
Register = 10111, k = 7, V register = 0
Since it is 0000, the process exits the processing loop.

【0109】次に、U=1であるからステップS419
にてyesとなり、T>pであるからステップS420
にYesとなり、この結果、ステップS421にてT=
T−P=100000−10111=1001となり、
最後にステップS422にてT=p−T=10111−
1001=1110となる。
Next, since U = 1, step S419
At step S420 because T> p.
At step S421. As a result, at step S421, T =
TP = 100000-10111 = 11001, and
Finally, at step S422, T = p−T = 10111−
1001 = 1110.

【0110】従って、逆元計算部301の出力は、T=
1110(=10進数表現で14)、k=7となる。
Therefore, the output of the inverse calculation unit 301 is T =
1110 (= 14 in decimal notation), and k = 7.

【0111】次に、逆元補正部302において、初期状
態として、T=1110、i=0、m=3に設定される
(iとmの値は10進数で表す)。
Next, in the inverse correction unit 302, T = 1110, i = 0, and m = 3 are set as initial states (the values of i and m are represented by decimal numbers).

【0112】1回目のループでは、Tレジスタが左シフ
トされてT=11100となり、ステップS505でY
esとなるためステップS506にてT=101とな
り、そしてi=1となる。
In the first loop, the T register is shifted to the left to reach T = 11100, and Y is determined in step S505.
Because of es, T = 101 in step S506, and i = 1.

【0113】2回目のループでは、Tレジスタが左シフ
トされてT=1010となり、ステップS505でNo
となるためステップS506は実行されず、i=2とな
る。
In the second loop, the T register is shifted leftward to T = 1010, and the result in step S505 is No.
Therefore, step S506 is not executed, and i = 2.

【0114】3回目のループでは、Tレジスタが左シフ
トされてT=10100となり、ステップS505でN
oとなるためステップS506は実行されず、i=3=
mとなり、処理ループを抜ける。
In the third loop, the T register is shifted leftward to T = 10100, and N is determined in step S505.
o, the step S506 is not executed, and i = 3 =
m, and exits the processing loop.

【0115】この結果、出力T=10100=10進数
表現で20となる。
As a result, the output T = 10100 = 20 in decimal notation.

【0116】このようにして、法の値p=23、R=2
5 (n=5)としたときにおける、モンゴメリ演算域で
の元A=19の逆元X=20を得ることができる。
In this way, the modulus value p = 23 and R = 2
5 (n = 5), the inverse element X = 20 of the element A = 19 in the Montgomery operation area can be obtained.

【0117】なお、モンゴメリ演算域での元19と20
にそれぞれ対応する、剰余系Zpでも元を求めると、2
0と15になる。すなわち、剰余系Zpでの元20の逆
元として、15が得られたことになる。
The elements 19 and 20 in the Montgomery operation area
, And the elements are also found in the residual system Zp,
It becomes 0 and 15. That is, 15 is obtained as the inverse of the element 20 in the remainder system Zp.

【0118】以下では、前述した逆元計算部301や逆
元補正部302における処理の他の例をそれぞれ示す。
Hereinafter, other examples of the processing in the inverse element calculation unit 301 and the inverse element correction unit 302 will be described.

【0119】まず、図7および図8に逆元計算部301
の処理手順の他の例を示す。この手順は図3および図4
に示した処理手順と原理的には同じであるが、図3およ
び図4の手順においてステップS403とステップS4
04でそれぞれ多倍長レジスタUとVの最下位ビットだ
けを判定の基準に用い、最下位ビットが0の場合に後続
の手順であるステップS411およびステップS41
2、ステップS413およびステップS414で1ビッ
トだけレジスタのシフトを行っていたものを、最下位ビ
ットから0が複数連続する場合には一度に複数ビットの
シフトを可能とするように改良したものである。このよ
うに、一度に複数ビットをまとめて処理する方が有利な
場合は多く、特にソフトウェア実装において高速とな
る。
First, FIG. 7 and FIG.
5 shows another example of the processing procedure. This procedure is shown in FIGS.
Is basically the same as the processing procedure shown in FIG. 3, but in steps S403 and S4 in the procedures of FIG. 3 and FIG.
At step 04, only the least significant bits of the multiple length registers U and V are used as criteria for determination, and if the least significant bit is 0, the subsequent steps S411 and S41
2. The register is shifted by one bit in step S413 and step S414, but is improved so that a plurality of bits can be shifted at a time when a plurality of zeros continue from the least significant bit. . As described above, it is often advantageous to collectively process a plurality of bits at a time, and the speed is high particularly in software implementation.

【0120】以下、図7および図8の手順を流れを追っ
て説明する。
Hereinafter, the procedures in FIGS. 7 and 8 will be described with reference to the flow.

【0121】まず、入力として与えられた法pをレジス
タUに、p以下の正の整数AをレジスタVに設定する。
また、レジスタTに0、レジスタSに1、レジスタkに
0をそれぞれ設定する(ステップS601)。
First, a modulus p given as an input is set in a register U, and a positive integer A equal to or smaller than p is set in a register V.
Further, 0 is set in the register T, 1 is set in the register S, and 0 is set in the register k (step S601).

【0122】以降、ステップS602からステップS6
12の処理を、レジスタVが正の値である間(0になる
まで)、繰り返す。
Thereafter, steps S602 to S6
Step 12 is repeated while the register V is a positive value (until it becomes 0).

【0123】ステップS602でレジスタVが0でなけ
れば、まず、レジスタUの最下位ビットからの“0”の
連長をカウントしてこの値をwとする(ステップS60
3)。次にwが0か否かを判定し(ステップS60
4)、もし0でなければ、レジスタUをwビットだけ右
シフトし(ステップS613)、レジスタSをwビット
だけ左シフトし(ステップS614)、ループカウンタ
Kにwを加え(ステップS615)、ステップS602
へとぶ。
If the register V is not 0 in step S602, first, the run length of "0" from the least significant bit of the register U is counted and this value is set to w (step S60).
3). Next, it is determined whether w is 0 (step S60).
4) If not 0, register U is shifted right by w bits (step S613), register S is shifted left by w bits (step S614), and w is added to loop counter K (step S615). S602
Hetobu.

【0124】ステップS604でwが0ならば、レジス
タVの最下位ビットからの“0”の連長をカウントして
この値をwとする(ステップ605)。次にwが0かど
うかを判定し(ステップS606)、もし0でなけれ
ば、レジスタVをwビットだけ右シフトし(ステップS
616)、レジスタTをwビットだけ左シフトし(ステ
ップS617)、ループカウンタKにwを加え(ステッ
プS618)、ステップS602へとぶ。
If w is 0 in step S604, the run length of "0" from the least significant bit of the register V is counted and this value is set to w (step 605). Next, it is determined whether or not w is 0 (step S606). If not, the register V is shifted right by w bits (step S606).
616), the register T is shifted leftward by w bits (step S617), w is added to the loop counter K (step S618), and the process proceeds to step S602.

【0125】ステップS606でwが0ならば、レジス
タUとVの大小比較をし(ステップS607)、もしU
>Vならば、レジスタUからレジスタVの内容を引き
(ステップS619)、レジスタUを右に1ビットシフ
トし(ステップS620)、レジスタTにレジスタSの
内容を加算し(ステップS621)、レジスタSを左に
1ビットシフトし(ステップS622)、ループカウン
タKに1を加え(ステップS623)、ステップS60
2へとぶ。
If w is 0 in step S606, the values of registers U and V are compared (step S607).
If> V, the contents of the register V are subtracted from the register U (step S619), the register U is shifted right by one bit (step S620), and the contents of the register S are added to the register T (step S621). Is shifted to the left by 1 bit (step S622), 1 is added to the loop counter K (step S623), and step S60 is performed.
Jump to 2.

【0126】もしステップS607の結果、U<Vもし
くはU=Vの場合は、レジスタVからレジスタUの内容
を引き(ステップS608)、レジスタVを右に1ビッ
トシフトし(ステップS609)、レジスタSにレジス
タTの内容を加算し(ステップS610)、レジスタT
を左に1ビットシフトし(ステップS811)、ループ
カウンタKに1を加え(ステップS623)、ステップ
S602へもどる。
If U <V or U = V as a result of step S607, the contents of register U are subtracted from register V (step S608), and register V is shifted right by one bit (step S609). Is added to the contents of the register T (step S610).
Is shifted one bit to the left (step S811), 1 is added to the loop counter K (step S623), and the process returns to step S602.

【0127】以上のループを繰り返し、ステップS60
2でレジスタVが0になった場合、処理ループを抜け、
まず、レジスタUの内容が1かどうかをチェックする
(ステップS624)。レジスタUの内容は入力Aと法
pの最大公約数になるので、もしUが1でなければステ
ップS628でエラー処理をして終了する。
The above loop is repeated, and step S60
When the register V becomes 0 at 2, the processing loop is exited,
First, it is checked whether the content of the register U is 1 (step S624). Since the contents of the register U are the greatest common divisor of the input A and the modulus p, if U is not 1, error processing is performed in step S628 and the processing is terminated.

【0128】エラーでない場合、すなわちステップS6
24にてレジスタUの内容が1である場合、レジスタT
とpの大小比較をし(ステップS625)、もしTがp
以上であれば、Tからpを引き(ステップS626)、
Tがp以下の整数になるようにする。そして、ステップ
S627でpからTの内容を引いた結果をTに格納して
処理を終了する。
If it is not an error, that is, step S6
24, if the contents of the register U are 1, the register T
And p are compared (step S625), and if T is p
If so, subtract p from T (step S626),
Let T be an integer less than or equal to p. Then, in step S627, the result of subtracting the contents of T from p is stored in T, and the process ends.

【0129】以上の処理により、Tの内容としてA-1
k mod pが計算される。
According to the above processing, the content of T is A −1.
2 k mod p is calculated.

【0130】次に、逆元補正部302の処理の流れの別
の一例を図9、図10に示す。
Next, another example of the processing flow of the inverse correction unit 302 is shown in FIGS.

【0131】この手順も図5に示した処理手順と原理的
には同じであるが、図5の手順においてステップS50
4で多倍長レジスタTを1ビットだけ左シフトを行うこ
とを繰り返していたものを、一度に複数ビットのシフト
を可能とするように改良したものである。このように、
一度に複数ビットをまとめて処理する方が有利な場合は
多く、特にソフトウェア実装において高速となる。
This procedure is also the same in principle as the processing procedure shown in FIG. 5, but in the procedure of FIG.
4 is repeated to shift the multiple length register T leftward by one bit, but is improved so that multiple bits can be shifted at a time. in this way,
In many cases, it is advantageous to process a plurality of bits at a time, especially in software implementation.

【0132】以下、図9、図10の手順を流れを追って
説明する。
Hereinafter, the procedures of FIG. 9 and FIG. 10 will be described following the flow.

【0133】まず、R=2n であるところのnを2倍し
た値をLにし、ループカウンタiを0に設定する(ステ
ップS701)。
First, a value obtained by doubling n where R = 2 n is set to L, and the loop counter i is set to 0 (step S701).

【0134】次に、ループの繰り返し回数としてL−k
の値を求め、mに設定する(ステップS702)。
Next, L−k is calculated as the number of loop repetitions.
Is obtained and set to m (step S702).

【0135】以降、ステップS703からステップS7
10の処理を、ループカウンタiがmになるまで繰り返
す。
Hereinafter, steps S703 to S7
Step 10 is repeated until the loop counter i reaches m.

【0136】ステップS703でiとmを比較し、iが
m未満の場合には、まず、レジスタTを法pと同じサイ
ズの2進数と見たときに最上位ビットからの“0”の連
長をカウントしてこの値をwとする(ステップS70
4)。
In step S703, i and m are compared. If i is less than m, first, when the register T is viewed as a binary number having the same size as the modulus p, a sequence of "0" from the most significant bit is read. The length is counted and this value is set to w (step S70)
4).

【0137】次に、wが0かどうかを判定し(ステップ
S705)、もし0ならばレジスタTを1ビットだけ左
シフトする(ステップS712)。この結果、Tの値は
pより大きくなるのでステップS713でレジスタTか
らpの値を減ずる。そして、ループカウンタiに1を加
え(ステップS714)、ステップS703へとぶ。ス
テップS705でwが0でなければ、次にi+wを計算
し、この値とmの大小比較を行う(ステップS70
6)。もしi+w>mならば、wをm−iとし(ステッ
プS715)、レジスタTをwビットだけ左シフトする
(ステップS716)。ループカウンタはmとする(ス
テップS717)。ここではステップS716の左シフ
トの結果は必ずpよりも小さいため、補正は不要であ
り、ステップS703へとぶ。
Next, it is determined whether w is 0 or not (step S705). If w is 0, the register T is shifted left by one bit (step S712). As a result, the value of T becomes larger than p, so the value of p is subtracted from the register T in step S713. Then, 1 is added to the loop counter i (step S714), and the process proceeds to step S703. If w is not 0 in step S705, then i + w is calculated, and this value is compared with m in magnitude (step S70).
6). If i + w> m, w is set to mi (step S715), and the register T is shifted leftward by w bits (step S716). The loop counter is set to m (step S717). Here, since the result of the left shift in step S716 is always smaller than p, no correction is necessary, and the process jumps to step S703.

【0138】ステップS706でi+w<mもしくはi
+w=mの場合には、レジスタTをwビットだけ左シフ
トする(ステップS707)。この結果、Tの値はpよ
り大きくなる可能性があるので、ステップS708でT
とpの大小比較を行い、Tがp以上の場合はTからpの
値を減ずる(ステップS709)。最後にループカウン
タiにwを加え(ステップS710)、ステップS70
3に戻る。
In step S706, i + w <m or i
If + w = m, the register T is shifted leftward by w bits (step S707). As a result, the value of T may be larger than p.
And p are compared, and if T is greater than or equal to p, the value of p is subtracted from T (step S709). Finally, w is added to the loop counter i (Step S710), and Step S70
Return to 3.

【0139】以上のループを繰り返し、ステップS70
3でi=mになった場合、処理ループを抜ける。このル
ープを抜けた時点でのTの値がモンゴメリ逆元値であ
り、この値を出力して(ステップS711)、処理を終
了する。
The above loop is repeated, and step S70
When i = m in 3, the processing exits the processing loop. The value of T at the time of exiting this loop is the Montgomery inverse value, and this value is output (step S711), and the process ends.

【0140】以上に示した図7と図8、図9と図10の
手順もレジスタの加減算とビットシフトのみで実現され
る。
The procedures of FIGS. 7 and 8 and FIGS. 9 and 10 described above are also realized only by addition / subtraction of registers and bit shift.

【0141】なお、図2のモンゴメリ逆元計算装置や図
1のモンゴメリ除算装置のモンゴメリ逆元計算部におい
て、逆元計算部301としては、図3と図4、図7およ
び図8のいずれかを、また、逆元補正部302として
は、図5、図9と図10のいずれかを、それぞれ任意に
組み合わせて利用可能である。
In the Montgomery inverse element calculation unit of the Montgomery inverse element calculation device of FIG. 2 or the Montgomery division device of FIG. 1, the inverse element calculation unit 301 may be any one of FIG. 3, FIG. 4, FIG. 7, and FIG. As the inverse correction unit 302, any one of FIGS. 5, 9, and 10 can be used in any combination.

【0142】ところで、本モンゴメリ除算装置は、図1
で例示した構成に限定されず、他の構成も可能である。
図16に、本実施形態に係るモンゴメリ除算装置の基本
構成の他の例を示す。
Incidentally, the present Montgomery division device is similar to that shown in FIG.
The present invention is not limited to the configuration exemplified in the above, and other configurations are possible.
FIG. 16 shows another example of the basic configuration of the Montgomery division device according to the present embodiment.

【0143】図2に例示したようにモンゴメリ逆元計算
機装置は、一例として、逆元計算部301と逆元補正部
302に分割できるが、図16では、この逆元計算部3
01をモンゴメリ乗算部202の前段に、また、逆元補
正部302をモンゴメリ乗算部202の後段に配置した
構成となっている。これは、逆元計算部301の出力C
に対しては、逆元補正部302の演算も、モンゴメリ乗
算部202の演算も共に乗算であることから、その順序
に対する可換性が成立することに基づいている。これを
数式で表現すると以下のようになる。
As illustrated in FIG. 2, the Montgomery inverse element computer can be divided into an inverse element calculation section 301 and an inverse element correction section 302 as an example. In FIG.
01 is arranged before the Montgomery multiplication unit 202, and the inverse correction unit 302 is arranged after the Montgomery multiplication unit 202. This is the output C of the inverse calculation unit 301.
Is based on the fact that commutability with respect to the order is established because both the operation of the inverse correction unit 302 and the operation of the Montgomery multiplication unit 202 are multiplications. This is represented by the following equation.

【0144】 Y=B・A-1・R mod p =B・(A-1K )2-K・(R-12 ) mod p =B・(A-1K mod p)・R-1(R2 ・2-K) mod p =(B・C・R-1 mod p)・22n-K mod p =D・22n-K mod p このようにモンゴメリ除算装置は必ずしもモンゴメリ逆
元計算部とモンゴメリ乗算部をシーケンシャルに利用し
なくても構成できる。重要なことは、モンゴメリ除算で
あるY=B(A-1)R mod pを効率的に計算する
ことであり、そのためにモンゴメリ逆元計算装置の構成
部品(モジュール)である逆元計算部と逆元補正部を分
離して用いることもできる。
Y = B · A −1 · R mod p = B · (A −12 K ) 2 -K · (R −1 R 2 ) mod p = B · (A −12 K mod p) · R -1 (R 2 · 2 -K ) mod p = (B · C · R -1 mod p) · 2 2n-K mod p = D · 2 2n-K mod p Thus Montgomery division device necessarily Montgomery It can be configured without using the inverse element calculation unit and the Montgomery multiplication unit sequentially. What is important is to efficiently calculate the Montgomery division Y = B (A -1 ) R mod p. For this purpose, an inverse element calculation unit which is a component (module) of the Montgomery inverse element calculation device is used. The inverse correction unit can be used separately.

【0145】以上のように本実施形態によれば、楕円曲
線暗号など多倍長の四則演算の繰り返し処理を高速に処
理する場合に、モンゴメリ演算域での元を入力として、
モンゴメリ逆元計算やモンゴメリ除算を実行することが
できる。したがって、最初に元の剰余系からモンゴメリ
演算域に元を変換した後は、モンゴメリ演算域のままで
繰り返し処理を実行できる。最後にモンゴメリ演算域か
ら元の剰余系に逆変換すれば良いので全体としてのモン
ゴメリ変換・逆変換のオーバーヘッドを小さくできる。
また、本実施形態のモンゴメリ逆元計算およびモンゴメ
リ除算は多倍長レジスタの加減算とビットシフトのみで
実現できるため、ソフトウェア・ハードウェアのどちら
でも効率良く実現できる。
As described above, according to the present embodiment, when the iterative processing of multi-length arithmetic operations such as elliptic curve cryptography is performed at high speed, an element in the Montgomery operation area is used as an input.
Montgomery inverse calculation and Montgomery division can be performed. Therefore, after the element is first converted from the original remainder system to the Montgomery operation area, the repetitive processing can be executed in the Montgomery operation area. Finally, since the inverse transformation from the Montgomery operation area to the original remainder system may be performed, the overhead of the Montgomery transformation / inverse transformation as a whole can be reduced.
Further, the Montgomery inverse element calculation and the Montgomery division of the present embodiment can be realized only by addition / subtraction and bit shift of the multiple-length register, and therefore can be efficiently realized by either software or hardware.

【0146】以下では、本実施形態に係るモンゴメリ演
算域での逆元計算装置のハードウェア構成について説明
する。
The hardware configuration of the inverse computing device in the Montgomery operation area according to the present embodiment will be described below.

【0147】図11に、本逆元計算装置の一構成例をブ
ロック図で示す。
FIG. 11 is a block diagram showing an example of the configuration of the inverse calculation device.

【0148】本逆元計算装置は、多倍長レジスタU(8
01)、多倍長レジスタV(802)、多倍長レジスタ
S(803)、多倍長レジスタT(804)とループカ
ウンタとなる単精度のレジスタK(805)、演算部と
して加減算器806とビットシフタ807、加減算器8
06の出力を格納する多倍長のレジスタ808とビット
シフタ807の出力を格納する多倍長のレジスタ80
9、そして全体の動作を制御する制御部(図示せず)を
構成要素として持つ。これらの各構成要素は、データ・
バス810に結線されており、相互にデータの転送が可
能である。制御部では、前述したような処理手順に従い
レジスタの特定ビットの0/1判定やレジスタの特定部
分の0の連長の検査なども行う。
This inverse element calculation device uses a multiple length register U (8
01), a multiple-precision register V (802), a multiple-precision register S (803), a multiple-precision register T (804), a single-precision register K (805) serving as a loop counter, and an adder / subtractor 806 as an arithmetic unit. Bit shifter 807, adder / subtractor 8
A multiple-length register 808 storing the output of the bit-shifter 806 and a multiple-length register 80 storing the output of the bit shifter 807
9, and a control unit (not shown) for controlling the entire operation as components. Each of these components is
It is connected to the bus 810 and can transfer data mutually. The control unit also performs 0/1 determination of a specific bit of the register and checks a consecutive length of 0 of a specific part of the register in accordance with the processing procedure described above.

【0149】図2における逆元計算部301は、この構
成要素を図3および図4、もしくは図7および図8に従
う動作を行うように制御することによって実現され、図
2における逆元補正部302は、法pを空いているレジ
スタ(例えばUレジスタ)に設定し、図5もしくは図9
および図10に従う動作を行うように制御することによ
って実現される。
The inverse calculation unit 301 in FIG. 2 is realized by controlling these constituent elements to perform operations according to FIGS. 3 and 4, or FIGS. 7 and 8, and the inverse correction unit 302 in FIG. Sets the modulus p to an empty register (eg, U register) and
And control is performed so as to perform the operation according to FIG.

【0150】なお、以上の各機能は、ソフトウェアとし
ても実現可能である。
Each of the above functions can be implemented as software.

【0151】また、本実施形態は、コンピュータに所定
の手順を実行させるための(あるいはコンピュータを所
定の手段として機能させるための、あるいはコンピュー
タに所定の機能を実現させるための)プログラムを記録
したコンピュータ読取り可能な記録媒体として実施する
こともできる。
The present embodiment is also directed to a computer which records a program for causing a computer to execute a predetermined procedure (or for causing the computer to function as predetermined means, or for causing the computer to realize a predetermined function). It can also be implemented as a readable recording medium.

【0152】本発明は、上述した実施の形態に限定され
るものではなく、その技術的範囲において種々変形して
実施することができる。
The present invention is not limited to the above-described embodiments, but can be implemented with various modifications within the technical scope.

【0153】[0153]

【発明の効果】本発明によれば、モンゴメリ演算域での
逆元計算と乗算を行って除算結果を得るので、モンゴメ
リ演算域の元を入力として、モンゴメリ演算域での除算
結果を直接求めることができる。この結果、モンゴメリ
演算域と元の剰余系との変換・逆変換のオーバーヘッド
がないため、モンゴメリ演算域での除算が高速に実現で
きる。
According to the present invention, since the division result is obtained by performing the inverse element calculation and multiplication in the Montgomery operation area, it is possible to directly obtain the division result in the Montgomery operation area using the element of the Montgomery operation area as an input. Can be. As a result, since there is no overhead of conversion and inverse conversion between the Montgomery operation area and the original remainder system, division in the Montgomery operation area can be realized at high speed.

【0154】また、本発明によれば、モンゴメリ演算域
のままモンゴメリ逆元計算を行なうことができ、モンゴ
メリ演算域と元の剰余系との変換・逆変換のオーバーヘ
ッドがないため、モンゴメリ演算域での逆元計算が高速
に実現できる。
Also, according to the present invention, the Montgomery inverse element calculation can be performed in the Montgomery operation area, and there is no overhead of conversion and inverse conversion between the Montgomery operation area and the original remainder system. Can be realized at high speed.

【0155】また、本発明によれば、モンゴメリ演算域
での逆元計算が多倍長レジスタの加減算とビットシフト
で実現できるため、ソフトウェア実装・ハードウェア実
装のどちらでも高速な装置構成が可能となる。さらに、
モンゴメリ演算域での除算も高速な装置構成が実現でき
る。
Further, according to the present invention, the inverse calculation in the Montgomery operation area can be realized by addition / subtraction of a multiple-precision register and bit shift, so that a high-speed device configuration can be realized by either software implementation or hardware implementation. Become. further,
A high-speed device configuration can also be realized for division in the Montgomery operation area.

【0156】したがって、楕円曲線暗号などのように剰
余系での乗算と除算を含む演算の繰り返し処理を基本演
算とする暗号において、全体としての処理時間を高速化
することができる。
Therefore, in an encryption such as an elliptic curve encryption which uses a repetition of an operation including multiplication and division in a remainder system as a basic operation, the processing time as a whole can be shortened.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明に係るモンゴメリ演算域での除算計算装
置の一構成例を示す図
FIG. 1 is a diagram showing a configuration example of a division calculation device in a Montgomery operation area according to the present invention.

【図2】本発明に係るモンゴメリ演算域での逆元計算装
置の一構成例を示す図
FIG. 2 is a diagram showing a configuration example of an inverse element calculation device in a Montgomery operation area according to the present invention;

【図3】図2の逆元計算部での処理手順の一例を示すフ
ローチャート
FIG. 3 is a flowchart illustrating an example of a processing procedure in an inverse element calculation unit in FIG. 2;

【図4】図2の逆元計算部での処理手順の一例を示すフ
ローチャート
FIG. 4 is a flowchart illustrating an example of a processing procedure in an inverse element calculation unit in FIG. 2;

【図5】図2の逆元補正部での処理手順の一例を示すフ
ローチャート
FIG. 5 is a flowchart illustrating an example of a processing procedure in an inverse correction unit in FIG. 2;

【図6】図2の逆元計算装置の具体的な動作例を説明す
るための図
FIG. 6 is a diagram for explaining a specific operation example of the inverse calculation device of FIG. 2;

【図7】図2の逆元計算部での処理手順の他の例を示す
フローチャート
FIG. 7 is a flowchart showing another example of the processing procedure in the inverse calculation unit of FIG. 2;

【図8】図2の逆元計算部での処理手順の他の例を示す
フローチャート
FIG. 8 is a flowchart showing another example of the processing procedure in the inverse calculation unit of FIG. 2;

【図9】図2の逆元補正部での処理手順の他の例を示す
フローチャート
FIG. 9 is a flowchart illustrating another example of the processing procedure in the inverse correction unit of FIG. 2;

【図10】図2の逆元補正部での処理手順の他の例を示
すフローチャート
10 is a flowchart showing another example of the processing procedure in the inverse correction unit in FIG. 2;

【図11】本発明に係るモンゴメリ演算域での逆元計算
装置のハードウェア構成を示すブロック図
FIG. 11 is a block diagram showing a hardware configuration of an inverse computing device in the Montgomery operation area according to the present invention;

【図12】モンゴメリ演算域と剰余系Zpの演算の対応
を示す図
FIG. 12 is a diagram showing the correspondence between the Montgomery operation area and the operation of the remainder system Zp.

【図13】モンゴメリ演算域と剰余系Zpの元および逆
元の具体例を示す図
FIG. 13 is a diagram showing a specific example of the Montgomery operation area and the elements and inverse elements of the remainder system Zp.

【図14】図1のモンゴメリ乗算部での処理の一例を示
すフローチャート
FIG. 14 is a flowchart illustrating an example of processing in the Montgomery multiplication unit in FIG. 1;

【図15】図1のモンゴメリ乗算部での処理の他の例を
示すフローチャート
FIG. 15 is a flowchart showing another example of the processing in the Montgomery multiplication unit in FIG. 1;

【図16】本発明に係るモンゴメリ演算域での除算計算
装置の他の構成例を示す図
FIG. 16 is a diagram showing another configuration example of the division calculation device in the Montgomery operation area according to the present invention.

【符号の説明】[Explanation of symbols]

200…モンゴメリ除算装置 201…モンゴメリ逆元計算装置(モンゴメリ逆元計算
部) 202…モンゴメリ乗算部 301…逆元計算部 302…逆元補正部 801,802,803,804,805,808,8
09…レジスタ 806…加減算器 807…ビットシフタ
Reference numeral 200: Montgomery division device 201: Montgomery inverse element calculation device (Montgomery inverse element calculation unit) 202: Montgomery multiplication unit 301: Inverse element calculation unit 302: Inverse element correction unit 801,802,803,804,805,808,8
09 Register 806 Adder / subtractor 807 Bit shifter

Claims (12)

【特許請求の範囲】[Claims] 【請求項1】正の整数N、正の整数A(0≦A<N、A
とNは互いに素)、正の整数Bについて、Nを2進表現
したときのビット長をLとして、n≧Lなる整数nに対
して、Y=B・A-1・2n mod Nなるモンゴメリ
演算域での除算結果Yを求めるモンゴメリ除算装置であ
って、 整数Aと法Nを入力として逆元X=A-1・22n mod
Nを求めるモンゴメリ逆元計算手段と、 求められた逆元Xと法NとBを入力として除算結果Y=
B・X・2-n modNを求めるモンゴメリ乗算手段と
を備えたことを特徴とするモンゴメリ除算装置。
A positive integer N, a positive integer A (0 ≦ A <N, A
And N are relatively prime), and for a positive integer B, let L be the bit length when N is represented in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n mod N A Montgomery division device for obtaining a division result Y in a Montgomery operation area, wherein an inverse element X = A −1 · 2 2n mod using an integer A and a modulus N as inputs.
Montgomery inverse element calculating means for obtaining N, the obtained inverse element X, modulo N and B are input, and the division result Y =
A Montgomery division device comprising: a Montgomery multiplication means for obtaining BX2- n modN.
【請求項2】前記モンゴメリ逆元計算手段は、 整数Aと法Nを入力として中間結果C=A-1・2k
od Nとパラメータk(L≦k≦2L)を求める逆元
計算手段と、 求められた中間結果Cとパラメータkと法Nを入力とし
て逆元X=C・22n-kmod Nを求める逆元補正手段
とを有することを特徴とする請求項1に記載のモンゴメ
リ除算装置。
2. The Montgomery inverse element calculating means receives an integer A and a modulus N as inputs and obtains an intermediate result C = A −1 · 2 km
an inverse element calculating means for obtaining an odd N and a parameter k (L ≦ k ≦ 2L); and an inverse element for obtaining an inverse element X = C · 2 2n−k mod N using the obtained intermediate result C, the parameter k, and the modulus N as inputs. The Montgomery division device according to claim 1, further comprising a source correction unit.
【請求項3】正の整数N、正の整数A(0≦A<N、A
とNは互いに素)、正の整数Bについて、Nを2進表現
したときのビット長をLとして、n≧Lなる整数nに対
して、Y=B・A-1・2n mod Nなるモンゴメリ
演算域での除算結果Yを求めるモンゴメリ除算装置であ
って、 整数Aと法Nを入力として第1の中間結果C=A-1・2
k mod Nとパラメータk(L≦k≦2L)を求め
る逆元計算手段と、 求められた第1の中間結果Cと法NとBを入力として第
2の中間結果D=B・C・2-n mod Nを求めるモ
ンゴメリ乗算手段と、 このモンゴメリ乗算手段により求められた第2の中間結
果Dと前記逆元計算手段により求められたパラメータk
と法Nを入力として除算結果Y=D・22n-Kmod N
を求める逆元補正手段とを備えたことを特徴とするモン
ゴメリ除算装置。
3. A positive integer N, a positive integer A (0 ≦ A <N, A
And N are relatively prime), and for a positive integer B, let L be the bit length when N is represented in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n mod N A Montgomery division apparatus for obtaining a division result Y in a Montgomery operation area, wherein an integer A and a modulus N are input and a first intermediate result C = A −1 · 2
Inverse element calculating means for calculating k mod N and parameter k (L ≦ k ≦ 2L); second intermediate result D = B · C · 2 with the obtained first intermediate result C, modulus N and B as inputs -n mod N, a second intermediate result D obtained by the Montgomery multiplication means, and a parameter k obtained by the inverse element calculation means.
And the modulus N as input, the division result Y = D 2 2n-K mod N
A Montgomery division device comprising:
【請求項4】正の奇整数N、正の整数A(0≦A<N、
AとNは互いに素)について、Nを2進表現したときの
ビット長をLとして、n≧Lなる整数nに対して、X=
-1・22n mod Nなるモンゴメリ演算域での逆元
Xを求めるモンゴメリ逆元計算装置であって、 整数Aと法Nを入力として中間結果C=A-1・2k
od Nとパラメータk(L≦k≦2L)を求める逆元
計算手段と、 求められた中間結果Cとパラメータkと法Nを入力とし
て逆元X=C・22n-kmod Nを求める逆元補正手段
とを備えたことを特徴とするモンゴメリ逆元計算装置。
4. A positive odd integer N and a positive integer A (0 ≦ A <N,
(A and N are mutually prime), and let L be the bit length when N is expressed in binary, and for an integer n where n ≧ L, X =
A Montgomery inverse element calculation apparatus for obtaining an inverse element X in a Montgomery operation area of A −1 · 2 2n mod N, wherein an intermediate result C = A −1 · 2 km with an integer A and a modulus N as inputs
an inverse element calculating means for obtaining an odd N and a parameter k (L ≦ k ≦ 2L); and an inverse element for obtaining an inverse element X = C · 2 2n−k mod N using the obtained intermediate result C, the parameter k, and the modulus N as inputs. A Montgomery inverse element calculation device comprising: element correction means.
【請求項5】内部に中間変数を記憶する複数のレジスタ
と、 前記レジスタを右または左にシフトするビットシフト器
と、 2つのレジスタの内容の加算または減算を行う加減算器
と、 2つのレジスタの内容の大小比較およびレジスタ内部の
所定のビット位置の値の判定を行う判定器とを用いて前
記逆元計算部および前記逆元補正部を構成することを特
徴とする請求項4に記載のモンゴメリ逆元計算装置。
5. A plurality of registers for storing intermediate variables therein; a bit shifter for shifting the register right or left; an adder / subtractor for adding or subtracting the contents of two registers; 5. The Montgomery according to claim 4, wherein the inverse element calculation unit and the inverse element correction unit are configured by using a determiner for comparing the magnitude of contents and determining a value of a predetermined bit position in a register. Inverse computing device.
【請求項6】正の奇整数N、正の整数A(0≦A<N、
AとNは互いに素)について、Nを2進表現したときの
ビット長をLとして、n≧Lなる整数nに対して、X=
-1・22n mod Nなるモンゴメリ演算域での逆元
Xを求めるモンゴメリ逆元計算装置であって、 初期状態を2進表現にてU=N、V=A、T=0、S=
1、k=0とし、 Uの最下位ビットが0ならば、Uを右シフトし、Sを左
シフトし、kを1増加するとともに、Vの最下位ビット
が0ならば、Vを右シフトし、Tを左シフトし、kを1
増加する処理と、 Uの最下位ビットが1かつVの最下位ビットが1で、U
>Vならば、UからVを減じ、Uを右シフトし、TにS
を加え、Sを左シフトし、kを1増加する処理と、 Uの最下位ビットが1かつVの最下位ビットが1で、U
≦Vならば、VからUを減じ、Vを右シフトし、SにT
を加え、Tを左シフトし、kを1増加する処理からなる
一連のループ処理を、V>0の間、繰り返し、 V=0になった場合、T≧NならばTからNを減じた後
に、NからTを減じた値をTとし、T<NならばNから
Tを減じた値をTとする逆元計算手段と、 初期状態をi=0とし、 前記逆元計算手段により求められたTを左シフトした
後、T≧NならばTからNを減じてiを1増加し、T<
Nならばiを1増加するループ処理を、i<2n−kの
間、繰り返し、 i=2n−kになったときのTを逆元Xとする逆元補正
手段とを備えたことを特徴とするモンゴメリ逆元計算装
置。
6. A positive odd integer N and a positive integer A (0 ≦ A <N,
(A and N are mutually prime), and let L be the bit length when N is expressed in binary, and for an integer n where n ≧ L, X =
A Montgomery inverse element calculation apparatus for calculating an inverse element X in a Montgomery operation area of A −1 · 2 2n mod N, wherein U = N, V = A, T = 0, S =
1, k = 0, if the least significant bit of U is 0, right shift U, shift left S, increase k by 1, and if the least significant bit of V is 0, shift V right Then shift T to the left and set k to 1
Increasing processing, the least significant bit of U is 1 and the least significant bit of V is 1,
If> V, subtract V from U, shift U right, and add S to T
, S is shifted to the left and k is increased by one, and the least significant bit of U is one and the least significant bit of V is one,
If ≤V, subtract U from V, shift V to the right, and add T to S
, And a series of loop processing consisting of shifting T to the left and increasing k by 1 is repeated while V> 0. When V = 0, if T ≧ N, N is subtracted from T. Later, T is the value obtained by subtracting T from N, and T is the value obtained by subtracting T from N if T <N, and the initial state is i = 0. After T is shifted to the left, if T ≧ N, N is subtracted from T, i is increased by 1, and T <
Inversely, loop processing for increasing i by 1 if N is repeated for i <2n−k, and inverting element T as an inverse element X when i = 2n−k is provided. Montgomery inverse element calculator.
【請求項7】初期状態としてNが設定されるUレジスタ
と、 初期状態としてAが設定されるVレジスタと、 初期状態として0が設定されるTレジスタと、 初期状態として1が設定されるSレジスタと、 初期状態として0が設定されるkレジスタと、 Uレジスタの右シフト、Vレジスタの右シフト、Tレジ
スタの左シフト、およびSレジスタの左シフトのうち指
定されたものを実行するビットシフト器と、 UレジスタからVレジスタの内容を減じる処理、Vレジ
スタからUレジスタの内容を減じる処理、Tレジスタに
Sレジスタの内容を加える処理、SレジスタにTレジス
タの内容を加える処理、TレジスタからNを減じる処
理、NからTレジスタの内容を減じる処理、およびkレ
ジスタに1を加える処理のうち指定されたものを実行す
る加減算器と、 Uレジスタの最下位ビットが0であるか否か、Vレジス
タの最下位ビットが0であるか否か、Vレジスタの値が
0になったか否か、およびTレジスタの値がN以上であ
るか否かを判断する判定器と、 前記ビットシフト器、前記加減算器および前記判定器を
制御する制御部を備えたことを特徴とする請求項6に記
載のモンゴメリ逆元計算装置。
7. A U register in which N is set as an initial state, a V register in which A is set as an initial state, a T register in which 0 is set as an initial state, and S in which 1 is set as an initial state. A register, a k register in which 0 is set as an initial state, a bit shift for executing a specified one of a right shift of a U register, a right shift of a V register, a left shift of a T register, and a left shift of an S register. A process of subtracting the contents of the V register from the U register, a process of subtracting the contents of the U register from the V register, a process of adding the contents of the S register to the T register, a process of adding the contents of the T register to the S register, The designated one of the process of subtracting N, the process of subtracting the contents of the T register from N, and the process of adding 1 to the k register is executed. A subtractor, whether the least significant bit of the U register is 0, whether the least significant bit of the V register is 0, whether the value of the V register is 0, and the value of the T register The Montgomery inverse element calculation apparatus according to claim 6, further comprising: a determination unit that determines whether the number is equal to or greater than N; and a control unit that controls the bit shifter, the addition / subtraction unit, and the determination unit. .
【請求項8】正の整数N、正の整数A(0≦A<N、A
とNは互いに素)、正の整数Bについて、Nを2進表現
したときのビット長をLとして、n≧Lなる整数nに対
して、Y=B・A-1・2n mod Nなるモンゴメリ
演算域での除算結果Yを求めるモンゴメリ除算方法であ
って、 整数Aと法Nを入力として逆元X=A-1・22n mod
Nを求める第1のステップと、 求められた逆元Xと法NとBを入力として除算結果Y=
B・X・2-n modNを求める第2のステップとを有
することを特徴とするモンゴメリ除算方法。
8. A positive integer N, a positive integer A (0 ≦ A <N, A
And N are relatively prime), and for a positive integer B, let L be the bit length when N is represented in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n mod N A Montgomery division method for obtaining a division result Y in a Montgomery operation area, wherein an inverse element X = A −1 · 2 2n mod using an integer A and a modulus N as inputs.
A first step of obtaining N, and a division result Y =
And a second step of obtaining B.X.2- n mod N. A Montgomery division method.
【請求項9】前記第1のステップは、 整数Aと法Nを入力として中間結果C=A-1・2k
od Nとパラメータk(L≦k≦2L)を求め、 求められた中間結果Cとパラメータkと法Nを入力とし
て逆元X=C・22n-kmod Nを求めるものであるこ
とを特徴とする請求項8に記載のモンゴメリ除算方法。
9. The method according to claim 1, wherein the first step is to input an integer A and a modulus N as input and obtain an intermediate result C = A −1 · 2 km
o N and a parameter k (L ≦ k ≦ 2L) are obtained, and an inverse element X = C · 2 2n−k mod N is obtained by inputting the obtained intermediate result C, the parameter k, and the modulus N. The Montgomery division method according to claim 8, wherein
【請求項10】正の整数N、正の整数A(0≦A<N、
AとNは互いに素)、正の整数Bについて、Nを2進表
現したときのビット長をLとして、n≧Lなる整数nに
対して、Y=B・A-1・2n mod Nなるモンゴメ
リ演算域での除算結果Yを求めるモンゴメリ除算方法で
あって、 整数Aと法Nを入力として第1の中間結果C=A-1・2
k mod Nとパラメータk(L≦k≦2L)を求め
る第1のステップと、 この第1のステップにより求められた第1の中間結果C
と法NとBを入力として第2の中間結果D=B・C・2
-n mod Nを求める第2のステップと、 この第2のステップにより求められた第2の中間結果D
と前記第1のステップにより求められたパラメータkと
法Nを入力として除算結果Y=D・22n-K mod N
を求める第3のステップとを有することを特徴とするモ
ンゴメリ除算方法。
10. A positive integer N, a positive integer A (0 ≦ A <N,
A and N are mutually prime), and for a positive integer B, let L be the bit length when N is expressed in binary, and for an integer n where n ≧ L, Y = B · A −1 · 2 n mod N A Montgomery division method for obtaining a division result Y in a Montgomery operation area, wherein an integer A and a modulus N are input and a first intermediate result C = A −1 · 2
a first step of calculating k mod N and a parameter k (L ≦ k ≦ 2L), and a first intermediate result C obtained by the first step
And the second intermediate result D = B · C · 2 by using
-n mod N, and a second intermediate result D obtained by the second step.
And the parameter k and the modulus N obtained in the first step as inputs, the division result Y = DD2 2n−K mod N
And a third step of obtaining the Montgomery division formula.
【請求項11】正の奇整数N、正の整数A(0≦A<
N、AとNは互いに素)について、Nを2進表現したと
きのビット長をLとして、n≧Lなる整数nに対して、
X=A-1・22n mod Nなるモンゴメリ演算域での
逆元Xを求めるモンゴメリ逆元計算方法であって、 整数Aと法Nを入力として中間結果C=A-1・2k
od Nとパラメータk(L≦k≦2L)を求め、 求められた中間結果Cとパラメータkと法Nを入力とし
て逆元X=C・22n-kmod Nを求めることを特徴と
するモンゴメリ逆元計算方法。
11. A positive odd integer N and a positive integer A (0 ≦ A <
N, A and N are relatively prime), where L is the bit length when N is expressed in binary, and for an integer n such that n ≧ L,
A Montgomery inverse element calculation method for obtaining an inverse element X in a Montgomery operation area of X = A −12n mod N, wherein an intermediate result C = A −1・ 2 km using an integer A and a modulus N as input.
od N and a parameter k (L ≦ k ≦ 2L) are obtained, and an inverse element X = C · 2 2n−k mod N is obtained by using the obtained intermediate result C, parameter k and modulus N as inputs. Inverse calculation method.
【請求項12】正の奇整数N、正の整数A(0≦A<
N、AとNは互いに素)について、Nを2進表現したと
きのビット長をLとして、n≧Lなる整数nに対して、
X=A-1・22n mod Nなるモンゴメリ演算域での
逆元Xを求めるモンゴメリ逆元計算方法であって、 初期状態を2進表現にてU=N、V=A、T=0、S=
1、k=0とし、 Uの最下位ビットが0ならば、Uを右シフトし、Sを左
シフトし、kを1増加するとともに、Vの最下位ビット
が0ならば、Vを右シフトし、Tを左シフトし、kを1
増加する処理と、 Uの最下位ビットが1かつVの最下位ビットが1で、U
>Vならば、UからVを減じ、Uを右シフトし、TにS
を加え、Sを左シフトし、kを1増加する処理と、 Uの最下位ビットが1かつVの最下位ビットが1で、U
≦Vならば、VからUを減じ、Vを右シフトし、SにT
を加え、Tを左シフトし、kを1増加する処理からなる
一連のループ処理を、V>0の間、繰り返し、 V=0になった場合、T≧NならばTからNを減じた後
に、NからTを減じた値をTとし、T<NならばNから
Tを減じた値をTとする第1のステップと、 初期状態をi=0とし、 前記第1のステップにより求められたTを左シフトした
後、T≧NならばTからNを減じてiを1増加し、T<
Nならばiを1増加するループ処理を、i<2n−kの
間、繰り返し、 i=2n−kになったときのTを逆元Xとする第2のス
テップとを有することを特徴とするモンゴメリ逆元計算
方法。
12. A positive odd integer N and a positive integer A (0 ≦ A <
N, A and N are relatively prime), where L is the bit length when N is expressed in binary, and for an integer n such that n ≧ L,
A Montgomery inverse element calculation method for calculating an inverse element X in a Montgomery operation area of X = A −1 · 2 2n mod N, wherein U = N, V = A, T = 0, S =
1, k = 0, if the least significant bit of U is 0, right shift U, shift left S, increase k by 1, and if the least significant bit of V is 0, shift V right Then shift T to the left and set k to 1
Increasing processing, the least significant bit of U is 1 and the least significant bit of V is 1,
If> V, subtract V from U, shift U right, and add S to T
, S is shifted to the left and k is increased by one, and the least significant bit of U is one and the least significant bit of V is one,
If ≤V, subtract U from V, shift V to the right, and add T to S
, And a series of loop processing consisting of shifting T to the left and increasing k by 1 is repeated while V> 0. When V = 0, if T ≧ N, N is subtracted from T. Later, a first step in which the value obtained by subtracting T from N is T, and a value obtained by subtracting T from N if T <N is T, and the initial state is i = 0. After T is shifted to the left, if T ≧ N, N is subtracted from T, i is increased by 1, and T <
A second step of repeating a loop process of increasing i by 1 if N, while i <2n−k, and setting T as an inverse element X when i = 2n−k. Montgomery inverse element calculation method.
JP10014250A 1997-01-27 1998-01-27 Montgomery division apparatus, Montgomery inverse element calculation apparatus, Montgomery division method, and Montgomery inverse element calculation method Expired - Lifetime JP2937982B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10014250A JP2937982B2 (en) 1997-01-27 1998-01-27 Montgomery division apparatus, Montgomery inverse element calculation apparatus, Montgomery division method, and Montgomery inverse element calculation method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP1266797 1997-01-27
JP9-12667 1997-01-27
JP10014250A JP2937982B2 (en) 1997-01-27 1998-01-27 Montgomery division apparatus, Montgomery inverse element calculation apparatus, Montgomery division method, and Montgomery inverse element calculation method

Publications (2)

Publication Number Publication Date
JPH10269060A true JPH10269060A (en) 1998-10-09
JP2937982B2 JP2937982B2 (en) 1999-08-23

Family

ID=26348307

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10014250A Expired - Lifetime JP2937982B2 (en) 1997-01-27 1998-01-27 Montgomery division apparatus, Montgomery inverse element calculation apparatus, Montgomery division method, and Montgomery inverse element calculation method

Country Status (1)

Country Link
JP (1) JP2937982B2 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002515614A (en) * 1998-05-08 2002-05-28 ギーゼッケ ウント デフリエント ゲーエムベーハー Software secret distribution method
JP2005221830A (en) * 2004-02-06 2005-08-18 Sanyo Electric Co Ltd Inverse element arithmetic unit, arithmetic processing unit, and arithmetic processing method
US7171437B2 (en) 2002-09-30 2007-01-30 Renesas Technology Corp. Residue calculating unit immune to power analysis
US7471789B2 (en) 2002-10-24 2008-12-30 Renesas Technology Corp. Encryption circuit achieving higher operation speed
KR20190022023A (en) * 2017-08-25 2019-03-06 국방과학연구소 Hardware-implemented modular inversion module
CN112805770A (en) * 2018-10-10 2021-05-14 日本电信电话株式会社 Secret right shift operation system, secret division operation system, methods thereof, secret calculation device, and program
CN115276960A (en) * 2022-08-02 2022-11-01 山东大学 Device and method for realizing fast modular inversion chip on SM2 Montgomery domain

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002515614A (en) * 1998-05-08 2002-05-28 ギーゼッケ ウント デフリエント ゲーエムベーハー Software secret distribution method
JP4708565B2 (en) * 1998-05-08 2011-06-22 ギーゼッケ ウント デフリエント ゲーエムベーハー Software secret distribution method
US7171437B2 (en) 2002-09-30 2007-01-30 Renesas Technology Corp. Residue calculating unit immune to power analysis
US7471789B2 (en) 2002-10-24 2008-12-30 Renesas Technology Corp. Encryption circuit achieving higher operation speed
JP2005221830A (en) * 2004-02-06 2005-08-18 Sanyo Electric Co Ltd Inverse element arithmetic unit, arithmetic processing unit, and arithmetic processing method
KR20190022023A (en) * 2017-08-25 2019-03-06 국방과학연구소 Hardware-implemented modular inversion module
CN112805770A (en) * 2018-10-10 2021-05-14 日本电信电话株式会社 Secret right shift operation system, secret division operation system, methods thereof, secret calculation device, and program
CN112805770B (en) * 2018-10-10 2023-10-03 日本电信电话株式会社 Secret right shift operation system and method, secret division operation system and method, secret calculation device, and recording medium
CN115276960A (en) * 2022-08-02 2022-11-01 山东大学 Device and method for realizing fast modular inversion chip on SM2 Montgomery domain
CN115276960B (en) * 2022-08-02 2024-03-15 山东大学 Device and method for realizing fast modular inverse chip on SM2 Montgomery domain

Also Published As

Publication number Publication date
JP2937982B2 (en) 1999-08-23

Similar Documents

Publication Publication Date Title
US6088453A (en) Scheme for computing Montgomery division and Montgomery inverse realizing fast implementation
Knezevic et al. Faster interleaved modular multiplication based on Barrett and Montgomery reduction methods
Marzouqi et al. A high-speed FPGA implementation of an RSD-based ECC processor
Erdem et al. A general digit-serial architecture for montgomery modular multiplication
US8862651B2 (en) Method and apparatus for modulus reduction
Kaihara et al. A hardware algorithm for modular multiplication/division
US9268564B2 (en) Vector and scalar based modular exponentiation
CN109814838B (en) Method, hardware device and system for obtaining intermediate result set in encryption and decryption operation
JP5182364B2 (en) Cryptographic processing method with tamper resistance against side channel attack
KR100591761B1 (en) Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition
Dimitrov et al. Area-efficient multipliers based on multiple-radix representations
JP3542278B2 (en) Montgomery reduction device and recording medium
US8781112B2 (en) Signed montgomery arithmetic
JP2937982B2 (en) Montgomery division apparatus, Montgomery inverse element calculation apparatus, Montgomery division method, and Montgomery inverse element calculation method
KR100508092B1 (en) Modular multiplication circuit with low power
Abdulrahman et al. High-speed hybrid-double multiplication architectures using new serial-out bit-level mastrovito multipliers
Vollala et al. Efficient modular exponential algorithms compatible with hardware implementation of public‐key cryptography
CN115270155A (en) Method for obtaining maximum common divisor of big number expansion and hardware architecture
van Wamelen Jacobi sums over finite fields
Cho et al. High-speed modular multiplication algorithm for RSA cryptosystem
Wu An efficient common-multiplicand-multiplication method to the Montgomery algorithm for speeding up exponentiation
CN113467752B (en) Division operation device, data processing system and method for private calculation
KR100322740B1 (en) Modular computing apparatus and method thereof
JP3626315B2 (en) Remainder calculation apparatus, information processing apparatus, and remainder calculation method
JP3842641B2 (en) Arithmetic apparatus and method using coprocessor using Montgomery multiplication

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090611

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090611

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100611

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100611

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110611

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120611

Year of fee payment: 13

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120611

Year of fee payment: 13

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130611

Year of fee payment: 14

EXPY Cancellation because of completion of term