JP4080754B2 - Remainder calculation apparatus and method - Google Patents

Remainder calculation apparatus and method Download PDF

Info

Publication number
JP4080754B2
JP4080754B2 JP2002017285A JP2002017285A JP4080754B2 JP 4080754 B2 JP4080754 B2 JP 4080754B2 JP 2002017285 A JP2002017285 A JP 2002017285A JP 2002017285 A JP2002017285 A JP 2002017285A JP 4080754 B2 JP4080754 B2 JP 4080754B2
Authority
JP
Japan
Prior art keywords
remainder
multiplication
control means
base element
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2002017285A
Other languages
Japanese (ja)
Other versions
JP2003216032A (en
Inventor
正修 小池
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 JP2002017285A priority Critical patent/JP4080754B2/en
Publication of JP2003216032A publication Critical patent/JP2003216032A/en
Application granted granted Critical
Publication of JP4080754B2 publication Critical patent/JP4080754B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、剰余演算系に基づき、大きな整数の演算を並列処理により高速に計算する剰余演算装置及び方法に関する。
【0002】
【従来の技術】
公開鍵暗号の重要性が増すにつれて、大きな整数の剰余演算を効率よく行うための方法及び装置への要望が高まっている。例えば現在事実上の標準(デファクトスタンダード)であるRSA(Rivest−Shamir−Adleman)方式では、1,024ビットの整数による剰余演算を高速に行う必要がある。
【0003】
このための高速演算方法の一つとして、剰余演算系(Residue Number Systems)が知られている。この剰余演算系は、互いに素な比較的小さな整数の組{a,a,…,a}を用意し、演算対象の大きな整数をこれらの整数で割った余りの組で表現する手法である。以後、この余りの組{a,a,…,a}を剰余演算系の基底と呼び、基底を構成する要素の個数nを基底のサイズと呼ぶ。また、基底の集合をa={a,a,…,a}で表す。
【0004】
例えば、整数xと基底{a,a,…,a}が与えられたとき、整数xを基底要素a(i=1,2,…,n)で割った余りxの組(x,x,…,x)がxの剰余演算系表現である。なお、x=x mod aである。ここで、整数xは、基底の全要素の積A=a…aを法として一意的に表現できる。すなわち、xがA未満の正整数のとき、xとその剰余演算系表現(x,x,…,x)は一対一に対応する。なお、この一対一の対応関係は、中国剰余定理により保証されている。
【0005】
係る剰余演算系表現では、2つの整数x,yの積を計算する際に、各要素毎の積(x・y,…,x・y)を求め、得られた積を、対応する基底aで除した余り(x・y mod a,…,x・y mod a)を求める。
【0006】
この演算は、一般的に言い換えると、各要素毎に、対応する基底aを法とする積を計算することにより、基底要素の積Aを法とする積が求められることと表現される。加算及び減算についても同様であり、基底aに対応する要素x,yについて、aを法とする加算あるいは減算をすればよい。
【0007】
このような剰余演算系における乗算、加算、減算は、各要素毎に独立に対応する基底を法とする演算を行えばよいので、例えば基底として計算機のワード長以内の値を採用することにより、非常に大きな整数の演算を単精度の演算の繰り返しによって実現できる。
【0008】
また、それらの単精度演算は、基底毎に独立して実行可能なので、複数の演算器による並列処理が可能になる。例えば、基底サイズがnの場合、剰余演算機能付のn個の乗算器を並列に動作させることにより、1回の単精度剰余付き乗算と同じ時間内で基底要素の積Aを法とする乗算を終了できる。
【0009】
現在の計算機内では、通常、2進数表現が用いられている。2進数表現に基づく大きな整数の演算では、LSB(Least Significant Bit)からMSB(Most Significant Bit)に向けて桁上がりが伝播し、大きな整数の全桁数(あるいはビット長)に比例した処理時間がかかる。従って、2進数表現による演算は、剰余演算系による並列処理に比べ、処理速度の点で不利である。
【0010】
一方、剰余演算系による演算は、ワード間の桁上がりが生じないので、2進数表現に代表される基数法に比べ、大きい整数の乗算、加算、減算を効率よく行う方式として古くから知られてきている。
【0011】
しかしながら、剰余演算系では、除算や2数の大小比較については基数法に比べ、効率よく行う手段が知られていない。このため、剰余演算系は、公開鍵暗号のような大きな整数の演算を高速に行う応用に適していると考えられながら、剰余算への適用の仕方が知られていない。
【0012】
一方、剰余演算系表現した数値同士による剰余乗算の方法がポッシュ(Posch)ら(IEEE Transaction on Parallel and Distributed Systems, Vol.6, No.5, May 1995, pp.449-454に掲載された“Modulo Reduction in Residue Number Systems”、及びComputer & Security誌Vol.17, pp.637-650, 1998に掲載された“RNS−Modulo Reduction Upon a Restricted Base Value Set and its Applicability to RSA Cryptography”)、川村(特開2001−194993)によって提案されている。
【0013】
これらの方法は、剰余演算系表現での演算において不利な除算を避けるために、モンゴメリ(Montgomery)がMathematics of Computation, Vol.44, No.170, pp.519-521, April, 1985に掲載された“Modular Multiplication without Trial Division”で提案した剰余乗算方法(以下、モンゴメリ乗算と呼ぶ)を利用することで、剰余演算系における除算を行わずに剰余乗算を実現している。
【0014】
しかし、モンゴメリ乗算は、整数にモンゴメリ定数と呼ばれる定数を乗じる必要があるが、このモンゴメリ定数の計算には除算が必要であり、この除算を剰余演算系で行う効率的な方法が知られていないため、モンゴメリ定数を基数表現で計算している。
【0015】
ここでは、モンゴメリ乗算を例に挙げたが、モンゴメリ乗算に限らず、剰余算を行うアルゴリズムにおいては除算を行う必要性が生じる。
【0016】
【発明が解決しようとする課題】
以上説明したように、剰余演算系における除算の効率的なアルゴリズムが要望されるものの、未だにその要望を満たせない状況にある。
【0017】
本発明は上記実情を考慮してなされたもので、剰余演算系で除算を効率的に実行し得る剰余演算装置及び方法を提供することを目的とする。
【0018】
また、本発明の他の目的は、特に、剰余演算系の基底の幾つかの要素の積が除算の法の場合に、剰余演算系で除算を効率的に実行し得ることにある。
【0019】
【課題を解決するための手段】
第1の発明は、剰余演算系の基底を{a,a,…,a}(nは整数)とし且つA=a…aとした際に、{a,a,…,a}から任意に1つの基底要素a(1≦i≦n)を選択し、このaの選択情報及びA未満の正の整数xが入力されたとき、前記xをaで除した商zを出力可能な、剰余演算機能を有する複数の演算ユニットを備えた剰余演算装置において、前記選択情報に基づいて、前記xの剰余演算系表現の各値x,…,xから前記基底要素aに対応する値xを減じるように、前記各演算ユニットを制御する減算制御手段と、前記減算制御手段により得られた各値(x−x),…,(x−x)(但し、(x−x)を除く)に対し、前記基底要素aの乗法逆元a -1を乗じるように、前記各演算ユニットを制御する乗算制御手段と、前記乗算制御手段により得られた乗算結果を商zとして出力する出力手段と、を備えた剰余演算装置である。
【0020】
このように、減算制御手段の制御により、各演算ユニットがxの剰余演算系表現の各値からxi(=x mod a)を減じてaの倍数としておき、乗算制御手段の制御により、各演算ユニットが減算結果に乗法逆元を乗算して除算結果を得るので、剰余演算系で除算を効率的に実行することができる。
【0021】
なお、第1の発明は、「装置」として表現したが、「システム」、「方法」、「プログラム」又は「記憶媒体」等として表現してもよいことは言うまでもない。
【0022】
【発明の実施の形態】
以下、本発明の各実施形態について図面を参照して説明する。
(第1の実施形態)
図1は本発明の第1の実施形態に係る剰余演算装置の主要部分の構成を示す模式図である。この剰余演算装置10は、n個の演算ユニット20〜20が制御装置30に接続されている。
【0023】
ここで、各演算ユニット20〜20は、それぞれ対応する添字のROM21〜21、RAM22〜22及び積和回路23〜23を備えている。
【0024】
ROM21〜21は、制御装置30により読出制御される読出専用メモリであり、対応する積和回路23〜23で用いる剰余演算系の基底要素a,…,a、及び他の基底要素a(j≠1,…,n)の乗法逆元値a -1を保持し、保持内容を制御装置30からの制御により、対応する積和回路23〜23に転送可能となっている。
【0025】
なお、剰余演算系のn個の基底要素a,…,aは、どの2つ同士も互いに素な正の整数が使用されている。また、一般には剰余演算系の基底要素a,…,aの個数と、積和回路23〜23の個数とは一致しなくてよいが、ここでは簡単のため、共にn個とする。また、基底としては、2のべき又は2のべきに近接する値が用いられる。
【0026】
乗法逆元値a -1は、剰余演算系の基底が定まれば決まる値なので、事前計算して格納するが、ROM21〜21に限らず、RAM22〜22や図示しない他のメモリ(例えばEEPROM)に格納されていてもよい。
【0027】
RAM22〜22は、制御装置30により読出/書込制御される随時書込読出メモリであり、積和回路23〜23への入力データや、積和回路23〜23からの演算の中間結果データ、及び演算ユニット20〜20外部への出力データ、といった各データを保持するために用いられる。
【0028】
制御装置30は、図2に示す除算アルゴリズムに基づいて、各演算ユニット20〜20や入出力データを制御することにより、所定の演算を実行させる機能をもっている。
【0029】
なお、以上のような各ユニット20〜20及び装置30はそれぞれハードウェア、ソフトウェア又はその組合せにより構成可能となっている。ここで、各ユニット20〜20及び装置30がソフトウェアにより構成される場合、後述する各機能を実現させるための剰余演算プログラムが予め剰余演算装置10のコンピュータにインストールされている。なお、ハードウェア及び/又はソフトウェアにより各ユニット20〜20及び装置30を個別に構成可能な旨の説明は、以下の各実施形態にも適用される。
【0030】
次に、以上のように構成された剰余演算装置の除算動作を図2及び図3を用いて説明する。始めに、図2を用いて原理的に述べ、その後、図3を用いて計算例を述べる。
【0031】
剰余演算装置10は、図2の左側に示すように、剰余演算系での除算を行う。なお、図2の右側は、説明の便宜上、対応する基数表現を示している。例えばStep1では、剰余演算系の表現が(x,x,…,x,…,xn-1,x)であり、これに対応する基数表現がxであることを示している。なお、従来の技術で述べたように、x=x mod a(j=1,2,…,n)の関係がある。この関係は、基数表現の正の整数xが剰余演算系の全ての基底要素の積A=a…aより小さいとき(x<A)、一対一の対応関係となる。
【0032】
続いて、入力(x<A)と、任意に選んだ1つの基底要素aからx/aの商を求める方法を図2の各ステップST1〜ST5に沿って述べる。
【0033】
(ST1) 制御装置30は、入力データx〜xを対応する各RAM22〜22に書込む。
【0034】
(ST2) 制御装置30は、選択した基底要素aに基づいて、対応するRAM22内の値xを調べ、各積和回路23〜23に対応するRAM22〜23内の値x〜xからxを減じるように命令する。
【0035】
(ST3) 各積和回路23(j=1,2,…,n)は、y=xj−mod aを実行し、結果yを各RAM22jに格納する。基数表現での対応する演算はy=x−xである。
【0036】
(ST4) 制御装置30は、n−1個の積和回路23j(j=1,2,…,n、j≠i)に対して、RAM22j内の値yにaの乗法逆元a -1 mod aを乗じるように命令する。但し、この命令は、xに対応する積和回路23iには与えない。なお、剰余演算系における乗法逆元の乗算は、基数表現における除算に相当する。
【0037】
(ST5) 各積和回路23j(j=1,2,…,n、j≠i)は、z=y×a -1 mod aを実行し、結果zを各RAM12jに格納する。なお、yは、前述した通り、xからx(=x mod a)を減じた値であるのでaの倍数である。このため、除算の商y/aは整数となる。従って、z=y/aが対応する基数表現での演算となる。
【0038】
この5ステップの結果、RAM22j(j=1,2,…,n、j≠i)に格納された計算結果zが商zの剰余演算系表現となっている。但し、基底要素aに対応するzの成分(z)が未計算のため(図2のステップST5では未計算を示すため、zの箇所に×という印をつけている)、zで表現できる最大の数はA/aとなる。しかしながら、商z=y/a≦x/a<A/aであるので、この計算結果zは、商zの正しい値を表現している。
【0039】
以上により、x/aを剰余演算装置10で計算することができる。
【0040】
次に、選ばれた基底要素が2個以上の場合について説明する。この場合も上述した5つのステップを選ばれた基底要素の個数分だけ繰り返すことで実現できる。以下、図3を用いて具体例で説明する。
図3に示すように、剰余演算系の基底の要素数n=4とし、各要素a,a,a,aの値をそれぞれ7、11、13、17としている。
この例は、入力x=4567<a=17017であり、基底要素からa,aを選んで商4567/(7×17)=38を剰余演算系で求める手順を表している。
【0041】
(ST1’) 制御装置30は、入力データ3,2,4,11を各RAM22〜22に書込む。なお、各入力データ3,2,4,11は、入力x=4567を剰余演算系で表したものである。例えばx=4567 mod7=3なので、a=7の下に3と記述されている。
【0042】
(ST2’) 制御装置30は、選択した基底要素a,aのうち、まず、一方の基底要素aに基づき、対応するRAM22内の値x=3を読出し、各積和回路23〜23に、対応するRAM22〜22内の値3,2,4,11から3を減じるように命令する。
【0043】
(ST3’) その結果、各成分の値はステップST3’に示した値0,10,1,8になる。対応する基数表現での値は、4567−3=4564である。
【0044】
(ST4’) 制御装置30は、3個の積和回路23〜23に対し、RAM22〜22の値10,1,8にその基底要素を法とするaの乗法逆元7-1を乗じるように命令する。例えばa -1 mod a=8であるから、aの成分は10×8 mod 11=3となる。但し基底要素aに対してはaの乗法逆元が存在しないので、aの成分に対応する積和回路23には命令を出さない。
【0045】
(ST5’) aの乗法逆元a -1の乗算の結果、各成分の値はステップST5’で表示した値×,3,2,6になる。但しaの成分×は無視する。この場合、剰余演算系で一意的に表示できる数はa=2431までという制約がつくが、元の入力x<aであったので、a=7での除算結果x/a<aとなり、正しく表現できている。対応する基数表現での値は4564/7=652である。無視したaの成分は、以下では演算を行わない。
【0046】
さて図2の説明では選択した基底要素が1個だけだったのでこれで除算が終了したが、図3の例では基底要素を2個選択しているので、2個目の選択した基底要素aに対しても図2と同じ演算を行う。但し1個目で選択した基底要素aで表現している値は、ステップST5’終了時では計算されていないので、以下ではこの基底要素aに対応する演算を行わない。
【0047】
(ST2”) 次に選んだ基底要素a=17に注目する。aの成分は6であるから、各成分から6を減じる。
【0048】
(ST3”)その結果、各成分の値はステップST3”に表示した値になる。対応する基数表現での値は、652−6=646である。
【0049】
(ST4”) ステップST3”の値に対し、a=17の乗法逆元17-1を乗算する。但し基底要素aに対してはaの乗法逆元が存在しないのでaの成分に対する演算を行わない。
【0050】
(ST5”) aの乗法逆元17-1の乗算の結果、各成分の値はステップST5”で表示した値になる。但しaの値は無視する。剰余演算系で一意的に表示できる数はaまでだが、ステップST5’で述べた理由と同じ理由により、この2つの基底での表現で正しく表現できている。対応する基数表現での値は646/17=38である。
【0051】
以上で選んだ基底要素a,aについて全て演算が終わったので、基底要素aとaに保持している値(5及び12)が求めたい商の基底{a,a}の下での剰余演算系表現となる。
【0052】
上述したように本実施形態によれば、剰余演算系の基底のいくつかの要素の積が除算の法の場合に、剰余演算系で除算を効率的に行うことができる。
【0053】
また、剰余演算系表現で演算を行う場合、途中で除算処理が生じても基数表現に変更することなく、そのまま剰余演算系表現で処理を行えるため、処理の高速化を期待することができる。
【0054】
(第2の実施形態)
図4は本発明の第2の実施形態に係る剰余演算装置の主要部分の構成を示す模式図であり、図1と同一部分には同一符号を付し、変形した部分には記号(’)を付して重複した説明を省略し、ここでは異なる部分について主に述べる。なお、以下の各実施形態も同様にして重複した説明を省略する。
【0055】
すなわち、本実施形態は、第1の実施形態の変形例であり、バレット・リダクションアルゴリズムへの適用を図るものであって、具体的には、図4に示すように、制御装置30に代えて、バレット・リダクションアルゴリズム及び川村の手法(特開2001−194993)を利用可能な制御装置30’を設け、また川村の手法に述べられるビット選択部41及び補正項演算ユニット42を備えている。また、各積和回路23’〜23’は、補正項演算ユニット42から制御可能なものとなっている。
【0056】
まず、基数表現(b進数、bは正の整数)におけるバレット・リダクションアルゴリズムを説明する(P. D. Barrett, “Implementing the Rivest, Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor”, Advances in Cryptology, Proc. Crypto ’86, pp.311-323, 1987.)。
【0057】
なお、以下の説明では、正の整数sのb進数での表現をs=(sk-1 …sと表す。これはs=sk-1k-1+…+sb+sである旨を意味している。
【0058】
バレット・リダクションは、剰余算を、試行割算を用いずに加算と乗算のみで行なうアルゴリズムであり、x mod Nの計算において、Nの倍数でxを近似する際に、上位桁で近似するという特色がある。
具体的にはバレット・リダクションは、x=(x2k-1…x、N=(Nk-1…N、Nk-1≠0を入力としたとき、z=x mod Nを出力するもので、次の8ステップST11〜ST18からなる。
【0059】
事前計算:μ= Quot(b2k/N)
(ST11) q← Quot(x/bk-1
(ST12) q←q・μ
(ST13) q← Quot(q/bk+1
(ST14) r← x mod bk+1
(ST15) r ← q・m mod bk+1
(ST16) z ← r−r
(ST17) もしz<0ならz←z+bk+1
(ST18) z≧Nである間、z←z−N
ここで、Quot(s/t)はsをtで割ったときの商を表す。
【0060】
これを剰余演算系で行うために、以下のように若干変更する。
【0061】
まず{b,b,…,b,bk+1,…,b2k,b2k+1}を剰余演算系の基底とし、b<b2k+1とする。Nをb…bk-1<N<b…bを満たす整数とする。このときx<Nなるxに対して、z=x mod Nは次の6ステップST21〜ST26で計算される。
【0062】
事前計算:μ= Quot(b…b2k/N)
(ST21) q← Quot(x/b…bk-1
(ST22) q←q・μ
(ST23) q← Quot(q/bk+1…b2k
(ST24) r← q・N
(ST25) z ← x−r
(ST26) z≧Nである間、z←z−N
基数表現でのバレット・リダクションと比較すると、基数bを剰余演算系の基底要素に置き換えているのが大きな違いである。基数表現では、基数bが一定であるためステップST11などではbのべき乗が使われていたが、剰余演算系では基底の要素が互いに異なるため、ステップST21のように基底要素の積に置き換わっている。
【0063】
その点を考慮すると、上のアルゴリズムの事前計算、ステップST21〜ST23は、基数表現でのバレット・リダクションに対応した演算となっている。ステップST24,ST25は、基数表現でのステップST14〜ST16に対応しているが、剰余演算系では大小関係の比較が困難なため、基数表現におけるmod bk+1に対応する演算を省略している。
【0064】
本実施形態は、このような演算により、基数表現でのステップST17での比較操作を回避できる。なぜなら、qは本来の商をQ= Quot(x/N)としたとき、Q−2≦q≦Qの範囲にあるので、ステップST25の減算結果の出力zが必ず正になるからである。
【0065】
またqのこの評価式より、ステップST25の出力は、本来のx mod NをRとしたとき、R、R+N、R+2Nのいずれかとなる。R+N、R+2Nだったときの場合のため、ステップST26で正しいRの値に調節する。
【0066】
また、演算の途中結果は全て基底の積b…b2k2k+1以下になっている必要があるが、b<b2k+1となるようにb2k+1を選んであるので、これを満たしていることも確認できる。
【0067】
上で説明した剰余演算系でのバレット・リダクションを剰余演算装置10’を用いて行う手法について説明する。ここで図4における積和回路23’〜23’の個数nと、剰余演算系の基底要素の個数2k+1とは、一般には一致しなくてよいが、ここでは簡単のためn=2k+1とする。
【0068】
また、整数x<Nの剰余演算系の表現をx=(x,x,…,x2k,x2k+1)とする。ここでx=x mod bであるのは前述の通りである。
【0069】
(事前計算) μ= Quot(b…b2k/N)は、基数表現の下での除算を行うことで実現する。この結果を剰余演算系表現した(μ,μ,…,μ2k,μ2k+1)をそれぞれ図4の対応するRAM22に格納する。
【0070】
(ST21) 商qを求める計算は、第1の実施形態で説明した手法により行う。入力は、x及び、基底要素としてb,b,…,bk-1のk−1個を選んだという情報である。この商計算の結果qとして、各RAM22に格納された値qを図5のST21に示す。
【0071】
選択した基底要素がb,b,…,bk-1であったので、前述同様に、対応する剰余演算系表現の値が未計算となる。換言すると、qの剰余演算系表示は、基底{b,bk+1,…,b2k+1 }の下で(q _ ,q _(k+1),…,q _(2k+1))と表現され、基底要素b,b,…,bk-1にはqの剰余演算系表現の値が格納されない。
【0072】
そこで、川村の基底拡張の手法により、(q _ ,q _(k+1),…,q _(2k+1))から図5のST21−2に示すように、qを全ての基底{b,b,…,b,bk+1,…,b2k,b2k+1}に拡張した剰余演算系表現を求める。
【0073】
(ST22) このようにして拡張された商qにμを乗じる。この乗算は各積和回路23’〜23’での並列乗算で実現できる。
【0074】
(ST23) 再び第1の実施形態で説明した手法により、入力q及び基底要素としてb,bk+1,…,b2kのk+1個を選んだという選択情報で商qを求める。求められた商q3は、図6のST23に示すように、基底{b,b,…,b -1,b2k+1}の下での表現なので、ST21と同様に基底拡張を用いて全ての基底{b,b,…,b,bk+1,…,b2k,b2k+1}を用いた剰余演算系表現にする(図6:ST23−2)。
【0075】
(ST24) このように拡張されたqにNを乗じる。この乗算は各積和回路23’〜23’での並列乗算で実現できる。
【0076】
(ST25) 各積和回路23’〜23’での並列減算で実現できる。
【0077】
(ST26) この演算は大小比較があるので、ステップST25で得られたzを基数表現に戻してから行う。
【0078】
上述したように本実施形態によれば、x mod Nを求めるバレット・リダクションを剰余演算系表現で並列処理することができ、基数表現で行う場合よりも処理の高速化を期待することができる。
【0079】
(第3の実施形態)
次に、本発明の第3の実施形態に係る剰余演算装置について図4を参照しながら図7を用いて説明する。この剰余演算装置は、図4と同一要素からなる装置であって、バレット・リダクションを用いてRSA暗号などに用いられる,べき乗剰余算を行うものである。
【0080】
べき乗剰余算は、C=ME mod N という式で表される。この演算は一般に次の5つのステップST31〜ST35のように行われる。
【0081】
Eの2進数での表現をE=(Em-1、Em-1≠0とするとき、
(ST31) C ← 1
(ST32) i=m−1から0まで以下のST33とST34をループ
(ST33) C ← C mod N
(ST34) もしE=1ならC ← C×M mod N
(ST35) Cを出力
本実施形態は、ステップST33,ST34の演算を剰余演算系で行うものである。ステップST33,ST34の剰余乗算は、乗算後にNでの剰余を求めるという手法を用いる。乗算は、剰余演算系で並列乗算で実現できる。Nでの剰余を求める際に、第2の実施形態で説明したバレット・リダクションアルゴリズムST21〜ST26を利用する。
【0082】
(ST30) 図7ではまず、べき指数Eと剰余演算系表示したM=(M,M,…,M2k+1)を入力する。
【0083】
(ST31) 次に(C,C,…,C2k+1)を全て1に初期化する。
【0084】
(ST32) ステップST31の初期設定のもと、i=m−1から0までループを行う。
【0085】
(ST33−1) 2乗算(C,C,…,C2k+1)←(C,C,…,C2k+1)×(C,C,…,C2k+1)を行なう。これは剰余演算系で並列乗算で実現できる。2乗算の結果をmod Nするためにバレット・リダクションBRを行なう(ST33−2)。
【0086】
(ST34−0) E=1である場合に演算を行なう。
【0087】
(ST34−1) 乗算(C,C,…,C2k+1)←(C,C,…,C2k+1)×(M,M,…,M2k+1)は、剰余演算系で並列乗算で実現できる。乗算結果をバレット・リダクションでmod Nする(ST34−2)。
【0088】
(ST35) ループが終了したら、そのときの(C,C,…,C2k+1)を出力する。
【0089】
但し、べき乗剰余算で第2の実施例で説明したバレット・リダクションを用いると、バレット・リダクションの最後のステップST26で一旦基数表現に戻して大小比較を行い、剰余を決定するため、剰余演算系での並列計算による処理速度向上の長所を生かしきれていない。
【0090】
そのため、第2の実施形態で説明した剰余演算系でのバレット・リダクションアルゴリズムのST25で終了するようにする。この場合、出力zがNより大きい可能性があるので、バレット・リダクションアルゴリズムを次のように行うことにする。
【0091】
すなわち、{b,b,…,b,bk+1,…,b2k,b2k+1}を剰余演算系の基底とする。法Nは、b…bk-1<N、9N<b…bを満たす整数とする。
【0092】
このとき、入力xが0<x<9N<b…b2kを満たせば、下のアルゴリズムで出力されるzは、z=x mod N、0≦z<3Nを満たす。
【0093】
事前計算:μ= Quot(b…b2k/N)
(ST21) q← Quot(x/b…bk-1
(ST22) q←q・μ
(ST23) q← Quot(q/bk+1…b2k
(ST24) r← q・N
(ST25) z ← x−r
このアルゴリズムにより、剰余乗算z=xy mod Nを剰余演算系の乗算とバレット・リダクションを組合せて実行すると、x<3N,y<3Nであればxy<9Nであるのでz<3Nという出力が得られる。ここで、入力と出力の範囲が同じであるので、べき乗剰余算において繰り返し剰余乗算を行うことができる。
【0094】
また、べき乗剰余算アルゴリズムのステップST35で最終的なCを出力するとき、最後のバレット・リダクションではC<3Nにしかサイズが抑えられていないので、基数表現に変換して必要な回数だけNを減じることにより、C<Nなる出力を得ることができる。
【0095】
上述したように本実施形態によれば、ST30〜ST35に示すように、バレット・リダクションを利用したべき乗剰余算を、剰余演算系で並列処理することができ、基数表現で行う場合よりも処理の高速化が期待できる。
【0096】
また、基数表現で行っていたバレット・リダクションを、剰余演算系で並列計算することによる効果は、次のように見積られる。
【0097】
まず、剰余乗算1回あたりの演算量を考える。最初の乗算で、1回の並列乗算が必要である。その後のバレット・リダクションにより剰余を求める。
【0098】
(ST21) 商を求めるのに、並列乗算がk−1回、並列加算がk−1回必要である。また、基底拡張に並列乗算がk+2回、並列加算が2(k+1)回必要である。
【0099】
(ST22) 並列乗算が1回必要である。
【0100】
(ST23) 商を求めるのに、並列乗算がk+1回、並列加算がk+1回必要であり、さらに基底拡張に並列乗算がk回、並列加算が2(k−1)回必要である。
【0101】
(ST24) 並列乗算が1回必要である。
【0102】
(ST25) 並列加算が1回必要である。
【0103】
以上をまとめると、剰余乗算1回あたり、並列乗算が4k+4回、並列加算が6k+1回必要である。
【0104】
ここで、Nのビット数を、現在のRSA暗号で用いられている1,024とし、剰余演算系の基底要素の大きさを32ビットとする。このとき、k=33と取れば1,024ビットの数が表現でき、また表現するための最小のkであることが分かる。この値を上の式に代入すると、1回の剰余乗算あたり、並列乗算が137回、並列加算が199回必要であることが分かる。
【0105】
一般に乗算は、オペランドのビット長の2乗に比例する時間がかかるので、32ビットの乗算は1,024ビットの乗算の1/32=1/1,024の時間で処理できる。そのため、1,024ビットの乗算に比べて剰余演算系でのバレット・リダクションを用いた剰余乗算は約137/1,024=0.13の時間で処理できる。
【0106】
ここで、加算は、乗算に比べて処理量が少ないので無視した。また、この比較には1,024ビットでの剰余算の時間は含まれていないので、ここで見積もった0.13よりさらに小さな割合の時間で処理できることが期待できる。
【0107】
なお、上記各実施形態に記載した手法は、コンピュータに実行させることのできるプログラムとして、磁気ディスク(フロッピー(登録商標)ディスク、ハードディスクなど)、光ディスク(CD−ROM、DVDなど)、光磁気ディスク(MO)、半導体メモリなどの記憶媒体に格納して頒布することもできる。
【0108】
また、この記憶媒体としては、プログラムを記憶でき、かつコンピュータが読み取り可能な記憶媒体であれば、その記憶形式は何れの形態であっても良い。
【0109】
また、記憶媒体からコンピュータにインストールされたプログラムの指示に基づきコンピュータ上で稼働しているOS(オペレーティングシステム)や、データベース管理ソフト、ネットワークソフト等のMW(ミドルウェア)等が本実施形態を実現するための各処理の一部を実行しても良い。
【0110】
さらに、本発明における記憶媒体は、コンピュータと独立した媒体に限らず、LANやインターネット等により伝送されたプログラムをダウンロードして記憶または一時記憶した記憶媒体も含まれる。
【0111】
また、記憶媒体は1つに限らず、複数の媒体から本実施形態における処理が実行される場合も本発明における記憶媒体に含まれ、媒体構成は何れの構成であっても良い。
【0112】
尚、本発明におけるコンピュータは、記憶媒体に記憶されたプログラムに基づき、本実施形態における各処理を実行するものであって、パソコン等の1つからなる装置、複数の装置がネットワーク接続されたシステム等の何れの構成であっても良い。
【0113】
また、本発明におけるコンピュータとは、パソコンに限らず、情報処理機器に含まれる演算処理装置、マイコン等も含み、プログラムによって本発明の機能を実現することが可能な機器、装置を総称している。
【0114】
なお、本願発明は、上記各実施形態に限定されるものでなく、実施段階ではその要旨を逸脱しない範囲で種々に変形することが可能である。また、各実施形態は可能な限り適宜組み合わせて実施してもよく、その場合、組み合わされた効果が得られる。さらに、上記各実施形態には種々の段階の発明が含まれており、開示される複数の構成用件における適宜な組み合わせにより種々の発明が抽出され得る。例えば実施形態に示される全構成要件から幾つかの構成要件が省略されることで発明が抽出された場合には、その抽出された発明を実施する場合には省略部分が周知慣用技術で適宜補われるものである。
【0115】
その他、本発明はその要旨を逸脱しない範囲で種々変形して実施できる。
【0116】
【発明の効果】
以上説明したように本発明によれば、剰余演算系の基底の幾つかの要素の積が除算対象の場合に、剰余演算系で除算を効率的に実行できる。
【図面の簡単な説明】
【図1】本発明の第1の実施形態に係る剰余演算装置の主要部分の構成を示す模式図。
【図2】同実施形態における動作を説明するための模式図。
【図3】同実施形態における動作の具体例を説明するための模式図。
【図4】本発明の第2の実施形態に係る剰余演算装置の主要部分の構成を示す模式図。
【図5】同実施形態における基底拡張の適用を示す模式図。
【図6】同実施形態における基底拡張の適用を示す模式図。
【図7】本発明の第3の実施形態に係る剰余演算装置の動作を説明するためのフローチャート。
【符号の説明】
10,10’…剰余演算装置
20〜20…演算ユニット
21〜21…ROM
22〜22…RAM
23〜23,23’〜23’…積和回路
30,30’…制御装置
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a residue calculation apparatus and method for calculating a large integer operation at high speed by parallel processing based on a residue calculation system.
[0002]
[Prior art]
As the importance of public key cryptography increases, there is an increasing demand for methods and apparatus for efficiently performing large integer remainder operations. For example, in the RSA (Rivest-Shamir-Adleman) system, which is currently the de facto standard, it is necessary to perform a remainder operation with an integer of 1,024 bits at high speed.
[0003]
As one of high-speed calculation methods for this purpose, a residue calculation system (Residue Number Systems) is known. This remainder operation system is a relatively small pair of integers {a1, A2, ..., an} And a large integer to be calculated is represented by a remainder set by dividing these integers. Thereafter, the remainder {a1, A2, ..., an} Is called the base of the remainder calculation system, and the number n of elements constituting the base is called the size of the base. The set of bases is a = {a1, A2, ..., an}.
[0004]
For example, integer x and base {a1, A2, ..., an} Is given the integer x as the base element aiRemainder x divided by (i = 1, 2,..., N)iPair (x1, X2, ..., xn) Is a remainder calculation system expression of x. Xi= X mod aiIt is. Here, the integer x is the product of all base elements A = a1a2... anCan be uniquely expressed as a law. That is, when x is a positive integer less than A, x and its remainder arithmetic expression (x1, X2, ..., xn) Corresponds one to one. This one-to-one correspondence is guaranteed by the Chinese remainder theorem.
[0005]
In such a remainder calculation system expression, when calculating the product of two integers x and y, the product (x1・ Y1, ..., xn・ Yn) And the product obtained is the corresponding basis aiRemainder (x)1・ Y1 mod a1, ..., xn・ Yn mod an)
[0006]
In general, this operation is the corresponding basis a for each element.iIt is expressed that a product modulo the product A of the base elements is obtained by calculating a product modulo. The same applies to addition and subtraction, and the basis aiElement x corresponding toi, YiAbout aiAddition or subtraction modulo.
[0007]
Multiplication, addition, and subtraction in such a remainder calculation system may be performed by modulo the basis corresponding to each element independently.For example, by adopting a value within the word length of the computer as the basis, Very large integer operations can be realized by repeating single-precision operations.
[0008]
In addition, since these single precision operations can be executed independently for each base, parallel processing by a plurality of arithmetic units becomes possible. For example, when the base size is n, by multiplying n multipliers with a remainder calculation function in parallel, the multiplication of the base element product A is performed in the same time as one multiplication with a single precision remainder. Can be terminated.
[0009]
In current computers, binary representation is usually used. In the calculation of large integers based on binary representation, a carry propagates from LSB (Least Significant Bit) to MSB (Most Significant Bit), and the processing time is proportional to the total number of digits (or bit length) of the large integer. Take it. Therefore, the calculation by the binary number expression is disadvantageous in terms of processing speed as compared with the parallel processing by the remainder calculation system.
[0010]
On the other hand, since arithmetic operations using a residue arithmetic system do not cause carry between words, it has long been known as a method for efficiently performing multiplication, addition, and subtraction of large integers compared to the radix method represented by binary representation. ing.
[0011]
However, in the remainder calculation system, means for efficiently performing division and comparison of two numbers compared to the radix method is not known. For this reason, the remainder calculation system is considered suitable for an application that performs a large integer operation at high speed, such as public key cryptography, but the method of application to the remainder calculation is not known.
[0012]
On the other hand, a method of residue multiplication by numerical values expressed in a residue operation system was published in Posch et al. (IEEE Transaction on Parallel and Distributed Systems, Vol. 6, No. 5, May 1995, pp.449-454). Modulo Reduction in Residue Number Systems ”and“ RNS-Modulo Reduction Upon a Restricted Base Value Set and its Applicability to RSA Cryptography ”published in Computer & Security Vol.17, pp.637-650, 1998), Kawamura ( Japanese Patent Laid-Open No. 2001-194993).
[0013]
These methods have been published by Montgomery in Mathematics of Computation, Vol. 44, No. 170, pp. 519-521, April, 1985, in order to avoid unfavorable division in operations in the modular arithmetic representation. In addition, by using the modular multiplication method proposed by “Modular Multiplication without Trial Division” (hereinafter referred to as Montgomery multiplication), modular multiplication is realized without performing division in the modular arithmetic system.
[0014]
However, Montgomery multiplication needs to multiply an integer by a constant called Montgomery constant. However, the calculation of this Montgomery constant requires division, and there is no known efficient method for performing this division in a remainder operation system. Therefore, the Montgomery constant is calculated in radix representation.
[0015]
Here, Montgomery multiplication is taken as an example. However, the present invention is not limited to Montgomery multiplication, and there is a need to perform division in an algorithm that performs remainder calculation.
[0016]
[Problems to be solved by the invention]
As described above, although an efficient algorithm for division in the remainder calculation system is desired, the demand is still not satisfied.
[0017]
The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a residue calculation apparatus and method capable of efficiently executing division in a residue calculation system.
[0018]
Another object of the present invention is to perform division efficiently in the remainder calculation system, particularly when the product of several elements of the basis of the remainder calculation system is a division method.
[0019]
[Means for Solving the Problems]
In the first invention, the basis of the remainder calculation system is represented by {a1, A2, ..., an} (N is an integer) and A = a1a2... anWhen {a1, A2, ..., an} To any one base element ai(1 ≦ i ≦ n) is selected and this aiAnd a positive integer x less than A is input, the x is aiIn the remainder computation apparatus having a plurality of computation units having a remainder computation function capable of outputting the quotient z divided by x, each value x of the remainder computation system expression of x based on the selection information1, ..., xnTo the base element aiValue x corresponding toiSubtracting control means for controlling each arithmetic unit and each value (x1-Xi), ..., (xn-Xi) (However, (xi-Xi) Except for))iMultiplicative inverse ai -1The multiplication unit includes a multiplication control unit that controls each of the calculation units, and an output unit that outputs a multiplication result obtained by the multiplication control unit as a quotient z.
[0020]
In this manner, each arithmetic unit is controlled by xi (= x mod a a)i)iSince each arithmetic unit multiplies the subtraction result by the multiplication inverse element to obtain a division result under the control of the multiplication control means, division can be efficiently executed in the remainder arithmetic system.
[0021]
Although the first invention is expressed as “device”, it is needless to say that it may be expressed as “system”, “method”, “program” or “storage medium”.
[0022]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described below with reference to the drawings.
(First embodiment)
FIG. 1 is a schematic diagram showing the configuration of the main part of the remainder calculation apparatus according to the first embodiment of the present invention. The remainder arithmetic apparatus 10 includes n arithmetic units 20.1~ 20nIs connected to the control device 30.
[0023]
Here, each arithmetic unit 201~ 20nAre the corresponding subscript ROMs 21 respectively.1~ 21n, RAM221~ 22nAnd product-sum circuit 231~ 23nIt has.
[0024]
ROM211~ 21nIs a read-only memory that is read-controlled by the control device 30, and the corresponding product-sum circuit 231~ 23nBase element a of the remainder calculation system used in1, ..., an, And other base elements ajMultiplicative inverse value a of (j ≠ 1,..., N)j -1And the stored contents are controlled by the control device 30 to correspond to the product-sum circuits 23.1~ 23nCan be transferred to.
[0025]
Note that n basis elements a of the remainder calculation system1, ..., anAre positive integers that are relatively prime to each other. In general, the base element a of the remainder calculation system1, ..., anAnd the product-sum circuit 231~ 23nHowever, for simplicity, both are assumed to be n. As the base, a power of 2 or a value close to power of 2 is used.
[0026]
Multiplicative inverse value aj -1Is a value determined when the basis of the remainder calculation system is determined, and is calculated and stored in advance.1~ 21nNot only the RAM 221~ 22nOr other memory (not shown) (for example, EEPROM).
[0027]
RAM221~ 22nIs a read / write memory that is read / write controlled by the control device 30, and is a product-sum circuit 231~ 23nInput data to the product-sum circuit 231~ 23nIntermediate result data of the operation from, and the arithmetic unit 201~ 20nUsed to hold data such as output data to the outside.
[0028]
Based on the division algorithm shown in FIG.1~ 20nIn addition, it has a function of executing predetermined calculations by controlling input / output data.
[0029]
Each unit 20 as described above1~ 20nThe apparatus 30 can be configured by hardware, software, or a combination thereof. Here, each unit 201~ 20nAnd when the apparatus 30 is comprised by software, the remainder calculation program for implement | achieving each function mentioned later is installed in the computer of the remainder calculation apparatus 10 previously. Note that each unit 20 is made of hardware and / or software.1~ 20nThe description that the apparatus 30 can be configured individually also applies to the following embodiments.
[0030]
Next, the division operation of the remainder arithmetic apparatus configured as described above will be described with reference to FIGS. First, the principle will be described with reference to FIG. 2, and then a calculation example will be described with reference to FIG.
[0031]
As shown on the left side of FIG. 2, the remainder calculation device 10 performs division in the remainder calculation system. The right side of FIG. 2 shows a corresponding radix expression for convenience of explanation. For example, in Step 1, the expression of the remainder calculation system is (x1, X2, ..., xi, ..., xn-1, Xn), And the corresponding radix representation is x. As described in the prior art, xj= X mod aj(J = 1, 2,..., N). This relationship is expressed by the fact that the positive integer x in the radix representation is the product A = a of all the base elements of the remainder calculation system.1a2... anWhen it is smaller (x <A), there is a one-to-one correspondence.
[0032]
Subsequently, input (x <A) and one arbitrarily selected base element aiTo x / aiA method for obtaining the quotient of is described along steps ST1 to ST5 in FIG.
[0033]
(ST1) The control device 30 receives the input data x1~ XnCorresponding RAM 221~ 22nWrite to.
[0034]
(ST2) The control device 30 selects the selected base element aiCorresponding RAM 22iValue x iniEach product-sum circuit 231~ 23nRAM 22 corresponding to1~ 23nValue x in1~ XnTo xiOrder to reduce.
[0035]
(ST3) Each product-sum circuit 23j(J = 1, 2,..., N) is yj= Xj-ximod ajAnd the result yjAre stored in each RAM 22j. The corresponding operation in radix representation is y = xxiIt is.
[0036]
(ST4) The control device 30 determines the value y in the RAM 22j for the n-1 product-sum circuits 23j (j = 1, 2,..., N, j ≠ i).jAiMultiplicative inverse ai -1 mod ajTo be multiplied by. However, this instruction is xiIs not given to the product-sum circuit 23i corresponding to. Note that multiplication of multiplication inverse elements in the remainder calculation system corresponds to division in radix representation.
[0037]
(ST5) Each product-sum circuit 23j (j = 1, 2,..., N, j ≠ i)j= YjXai -1 mod ajAnd the result zjAre stored in each RAM 12j. Y is x to x as described above.i(= X mod ai) Is a value obtained by subtracting a)iIs a multiple of. Therefore, the division quotient y / aiIs an integer. Therefore, z = y / aiIs the operation in the corresponding radix representation.
[0038]
As a result of these five steps, the calculation result z stored in the RAM 22j (j = 1, 2,..., N, j ≠ i)jIs the remainder calculation system representation of the quotient z. However, the base element aiComponent of z corresponding to (zi) Is not calculated (in step ST5 in FIG.i), ZjThe maximum number that can be expressed by A / aiIt becomes. However, the quotient z = y / ai≦ x / ai<A / aiTherefore, the calculation result zjRepresents the correct value of the quotient z.
[0039]
From the above, x / aiCan be calculated by the remainder calculation device 10.
[0040]
Next, a case where there are two or more selected base elements will be described. This case can also be realized by repeating the above five steps for the number of selected base elements. Hereinafter, a specific example will be described with reference to FIG.
As shown in FIG. 3, the number of base elements of the remainder calculation system is n = 4, and each element a1, A2, A3, A4Are set to 7, 11, 13, and 17, respectively.
In this example, the input x = 4567 <a1a2a3a4= 17017, from the base element a1, A4Represents a procedure for obtaining the quotient 4567 / (7 × 17) = 38 by the remainder calculation system.
[0041]
(ST1 ') The control device 30 stores the input data 3, 2, 4, 11 in each RAM 221~ 224Write to. Each of the input data 3, 2, 4, and 11 represents the input x = 4567 in a remainder calculation system. For example x1= 4567 mod7 = 3, so a1= 3 is described as 3.
[0042]
(ST2 ') The control device 30 selects the selected base element a.1, A4First, one base element a1Corresponding RAM 221Value x in1= 3 is read, and each product-sum circuit 231~ 234And the corresponding RAM 221~ 224Command to subtract 3 from the values 3, 2, 4, 11
[0043]
(ST3 ') As a result, the value of each component becomes the value 0, 10, 1, 8 shown in step ST3'. The value in the corresponding radix representation is 4567-3 = 4564.
[0044]
(ST4 ') The control device 30 includes three product-sum circuits 23.2~ 234In contrast, the RAM 222~ 224Modulo its base element to values 10, 1, and 8 of a1Multiplicative inverse 7-1To be multiplied by. For example, a1 -1 mod a2= 8, so a2The component is 10 × 8 mod 11 = 3. However, the base element a1For a1Since there is no multiplicative inverse of1Product-sum circuit 23 corresponding to the components of1Do not give orders.
[0045]
(ST5 ') a1Multiplicative inverse a1 -1As a result of multiplication, the value of each component becomes the value x, 3, 2, 6 displayed in step ST5 '. However, a1Ignore the component x. In this case, the number that can be uniquely displayed by the remainder calculation system is a2a3a4= 2431, but the original input x <a1a2a3a4Because a1= X / a divided by 71<A2a3a4It is expressed correctly. The corresponding value in radix representation is 4564/7 = 652. I ignored1In the following, no calculation is performed on the components of.
[0046]
In the description of FIG. 2, since only one base element is selected, the division is completed. However, in the example of FIG. 3, since two base elements are selected, the second selected base element a is selected.4The same calculation as in FIG. However, the first selected base element a1Since the value represented by is not calculated at the end of step ST5 ', the basis element a will be described below.1The operation corresponding to is not performed.
[0047]
(ST2 ″) Next selected base element a4Note = 17. a4Since the number of components is 6, subtract 6 from each component.
[0048]
(ST3 ″) As a result, the value of each component becomes the value displayed in step ST3 ″. The corresponding value in radix representation is 652-6 = 646.
[0049]
(ST4 ″) For the value of step ST3 ″, a4= 17 Multiplicative inverse 17-1Multiply However, the base element a4For a4Since there is no multiplicative inverse of4The operation is not performed on the component of.
[0050]
(ST5 ") a4Multiplicative inverse 17-1As a result of multiplication, the value of each component becomes the value indicated in step ST5 ″.4Ignore the value of. The number that can be uniquely displayed in the remainder calculation system is a2a3However, for the same reason as described in step ST5 ', it is possible to correctly express the two bases. The corresponding radix value is 646/17 = 38.
[0051]
Base element a selected above1, A4Since all operations have been completed, the base element a2And a3The quotient base {a2, A3} Is a remainder calculation system expression.
[0052]
As described above, according to the present embodiment, when the product of several elements of the basis of the remainder operation system is a division method, division can be efficiently performed in the remainder operation system.
[0053]
Further, in the case of performing an arithmetic operation using a remainder operation system expression, even if a division process occurs in the middle, the process can be performed using the remainder operation system expression as it is without changing to the radix expression.
[0054]
(Second Embodiment)
FIG. 4 is a schematic diagram showing the configuration of the main part of the remainder calculation apparatus according to the second embodiment of the present invention. The same reference numerals are given to the same parts as in FIG. A duplicate description is omitted, and different parts are mainly described here. In the following embodiments, the same description is omitted.
[0055]
That is, the present embodiment is a modification of the first embodiment and is intended to be applied to a bullet reduction algorithm. Specifically, as shown in FIG. , A control device 30 ′ that can use the Barret reduction algorithm and the Kawamura technique (Japanese Patent Laid-Open No. 2001-194993) is provided, and a bit selection unit 41 and a correction term calculation unit 42 described in the Kawamura technique are provided. Each product-sum circuit 231'-23n'Is controllable from the correction term calculation unit 42.
[0056]
First, the Barrett reduction algorithm in radix representation (b base, b is a positive integer) will be described (PD Barrett, “Implementing the Rivest, Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor”, Advances in Cryptology, Proc. Crypto '86, pp.311-323, 1987.).
[0057]
In the following description, the expression of the positive integer s in the b base number is expressed as s = (sk-1... s1s0)bIt expresses. This is s = sk-1bk-1+ ... + s1b + s0It means that.
[0058]
Bullet reduction is an algorithm that performs remainder calculation only by addition and multiplication without using trial division, and in the calculation of x mod N, when approximating x by a multiple of N, it is approximated by the upper digit. There is a special feature.
Specifically, the bullet reduction is x = (x2k-1... x1x0)b, N = (Nk-1... N1N0)b, Nk-1When ≠ 0 is input, z = x mod N is output, and includes the following eight steps ST11 to ST18.
[0059]
Pre-calculation: μ = Quot (b2k/ N)
(ST11) q1← Quot (x / bk-1)
(ST12) q2← q1・ Μ
(ST13) q3← Quot (q2/ Bk + 1)
(ST14) r1← x mod bk + 1
(ST15) r2 ← q3・ M mod bk + 1
(ST16) z ← r1-R2
(ST17) If z <0, z ← z + bk + 1
(ST18) While z ≧ N, z ← z−N
Here, Quot (s / t) represents a quotient when s is divided by t.
[0060]
In order to perform this in the remainder calculation system, the following changes are made slightly.
[0061]
First, {b1, B2, ..., bk, Bk + 1, ..., b2k, B2k + 1} Is the base of the remainder calculation system, and bk<B2k + 1And N for b1b2... bk-1<N <b1b2... bkAn integer that satisfies At this time, x <N2For x, z = x mod N is calculated in the following six steps ST21 to ST26.
[0062]
Pre-calculation: μ = Quot (b1b2... b2k/ N)
(ST21) q1← Quot (x / b1b2... bk-1)
(ST22) q2← q1・ Μ
(ST23) q3← Quot (q2/ Bkbk + 1... b2k)
(ST24) r2← q3・ N
(ST25) z ← xr2
(ST26) While z ≧ N, z ← z−N
Compared with valet reduction in radix representation, the major difference is that the radix b is replaced with the base element of the remainder calculation system. In the radix representation, since the radix b is constant, the power of b is used in step ST11 and the like. However, since the base elements are different from each other in the remainder calculation system, they are replaced with products of base elements as in step ST21. .
[0063]
Considering this point, the pre-calculation of the above algorithm, steps ST21 to ST23, are operations corresponding to bullet reduction in radix representation. Steps ST24 and ST25 correspond to steps ST14 to ST16 in the radix expression, but since it is difficult to compare the magnitude relation in the remainder calculation system, mod b in the radix expression.k + 1The operation corresponding to is omitted.
[0064]
This embodiment can avoid the comparison operation in step ST17 in the radix expression by such calculation. Because q3Is Q-2 ≦ q, where Q = Quot (x / N) is the original quotient3This is because the output z of the subtraction result in step ST25 is always positive because it is in the range of ≦ Q.
[0065]
Q3From this evaluation formula, the output of step ST25 is any one of R, R + N, and R + 2N, where R is the original x mod N. For the case of R + N and R + 2N, the value of R is adjusted to the correct value in step ST26.
[0066]
In addition, all intermediate results are the product of the basis b1b2... b2kb2k + 1It must be as follows, but bk<B2k + 1B to be2k + 1You can confirm that this is satisfied.
[0067]
A method for performing bullet reduction in the remainder computation system described above using the remainder computation apparatus 10 'will be described. Here, the product-sum circuit 23 in FIG.1'-23nThe number n of ′ and the number 2k + 1 of base elements of the remainder calculation system generally do not need to match, but here, n = 2k + 1 for simplicity.
[0068]
An integer x <N2X = (x1, X2, ..., x2k, X2k + 1). Where xi= X mod biIs as described above.
[0069]
(Advance calculation) μ = Quot (b1b2... b2k/ N) is realized by performing division under the radix representation. This result is expressed as a remainder calculation system (μ1, Μ2, ..., μ2k, Μ2k + 1) Respectively in the corresponding RAM 22 in FIG.iTo store.
[0070]
(ST21) quotient q1The calculation for obtaining is performed by the method described in the first embodiment. The input is x and b as the base element1, B2, ..., bk-1It is the information that k-1 pieces were selected. The result q of this quotient calculation1Each RAM 22iThe value q stored in1Is shown in ST21 of FIG.
[0071]
The selected base element is b1, B2, ..., bk-1Therefore, as described above, the value of the corresponding remainder calculation system expression is not calculated. In other words, q1The remainder calculation system representation of the basis {bk, Bk + 1, ..., b2k + 1} (Q1 _ k, Q1 _ (k + 1), ..., q1 _ (2k + 1)) And the base element b1, B2, ..., bk-1Q1The value of the remainder calculation system expression is not stored.
[0072]
Therefore, Kawamura's method of base extension (q1 _ k, Q1 _ (k + 1), ..., q1 _ (2k + 1)) To ST21-2 in FIG.1To all bases {b1, B2, ..., bk, Bk + 1, ..., b2k, B2k + 1} Is used to obtain a remainder calculation system expression.
[0073]
(ST22) The quotient q expanded in this way1Multiply by. This multiplication is performed by each product-sum circuit 23.1'-23nIt can be realized by parallel multiplication with ′.
[0074]
(ST23) By the method described in the first embodiment again, the input q2And b as the base elementk, Bk + 1, ..., b2kQuotient q with selection information that k + 1 of3Ask for. The obtained quotient q3 is the basis {b as shown in ST23 of FIG.1, B2, ..., bk -1, B2k + 1}, All the bases {b1, B2, ..., bk, Bk + 1, ..., b2k, B2k + 1} Is used as a remainder calculation system expression (FIG. 6: ST23-2).
[0075]
(ST24) q extended in this way3Multiply N by N. This multiplication is performed by each product-sum circuit 23.1'-23nIt can be realized by parallel multiplication with ′.
[0076]
(ST25) Each product-sum circuit 231'-23nIt can be realized by parallel subtraction with ′.
[0077]
(ST26) Since this operation has a magnitude comparison, it is performed after returning z obtained in step ST25 to the radix representation.
[0078]
As described above, according to the present embodiment, the bullet reduction for obtaining x mod N can be performed in parallel with the remainder calculation system expression, and the processing speed can be expected to be higher than that performed with the radix expression.
[0079]
(Third embodiment)
Next, a remainder calculation apparatus according to the third embodiment of the present invention will be described with reference to FIG. This remainder calculation apparatus is an apparatus composed of the same elements as in FIG. 4, and performs exponentiation remainder calculation used for RSA encryption or the like by using Barret reduction.
[0080]
The modular exponentiation is C = ME It is represented by the formula mod N. This calculation is generally performed as the following five steps ST31 to ST35.
[0081]
E = (Em-1E1E0)2, Em-1When ≠ 0,
(ST31) C ← 1
(ST32) The following ST33 and ST34 are looped from i = m−1 to 0.
(ST33) C ← C2 mod N
(ST34) If Ei= 1 if C ← C × M mod N
(ST35) Output C
In the present embodiment, the calculations in steps ST33 and ST34 are performed by a remainder calculation system. For the remainder multiplication in steps ST33 and ST34, a method of obtaining a remainder at N after multiplication is used. Multiplication can be realized by parallel multiplication in a remainder calculation system. When calculating the remainder at N, the bullet reduction algorithms ST21 to ST26 described in the second embodiment are used.
[0082]
(ST30) In FIG. 7, first, the power exponent E and the remainder calculation system display M = (M1, M2, ..., M2k + 1).
[0083]
(ST31) Next (C1, C2, ..., C2k + 1) Are all initialized to 1.
[0084]
(ST32) A loop is performed from i = m−1 to 0 under the initial setting of step ST31.
[0085]
(ST33-1) 2 multiplication (C1, C2, ..., C2k + 1) ← (C1, C2, ..., C2k + 1) X (C1, C2, ..., C2k + 1). This can be realized by a parallel multiplication in a remainder calculation system. Bullet reduction BR is performed to mod N the result of the multiplication (ST33-2).
[0086]
(ST34-0) EiCalculation is performed when = 1.
[0087]
(ST34-1) Multiplication (C1, C2, ..., C2k + 1) ← (C1, C2, ..., C2k + 1) X (M1, M2, ..., M2k + 1) Can be realized by parallel multiplication in a remainder calculation system. The multiplication result is mod N by bullet reduction (ST34-2).
[0088]
(ST35) When the loop is finished, (C1, C2, ..., C2k + 1) Is output.
[0089]
However, when the bullet reduction described in the second embodiment is used in the power-residue calculation, it is returned to the radix representation in the last step ST26 of the bullet reduction, and the magnitude comparison is performed to determine the remainder. It does not take full advantage of the processing speed improvement due to parallel computing.
[0090]
Therefore, the process ends at ST25 of the bullet reduction algorithm in the remainder calculation system described in the second embodiment. In this case, since the output z may be larger than N, the bullet reduction algorithm is performed as follows.
[0091]
That is, {b1, B2, ..., bk, Bk + 1, ..., b2k, B2k + 1} Is the basis of the remainder calculation system. Law N is b1b2... bk-1<N, 9N <b1b2... bkAn integer that satisfies
[0092]
At this time, the input x is 0 <x <9N2<B1b2... b2kIf z is satisfied, z output by the lower algorithm satisfies z = x mod N and 0 ≦ z <3N.
[0093]
Pre-calculation: μ = Quot (b1b2... b2k/ N)
(ST21) q1← Quot (x / b1b2... bk-1)
(ST22) q2← q1・ Μ
(ST23) q3← Quot (q2/ Bkbk + 1... b2k)
(ST24) r2← q3・ N
(ST25) z ← xr2
According to this algorithm, when the remainder multiplication z = xy mod N is executed in combination with the multiplication of the remainder calculation system and the bullet reduction, xy <9N if x <3N and y <3N.2Therefore, an output of z <3N is obtained. Here, since the input and output ranges are the same, it is possible to perform iterative modular multiplication in the modular exponentiation.
[0094]
Also, when the final C is output in step ST35 of the power-residue algorithm, since the size is limited only to C <3N in the last bullet reduction, N is converted as many times as necessary by converting to the radix representation. By subtracting, an output of C <N can be obtained.
[0095]
As described above, according to the present embodiment, as shown in ST30 to ST35, the power-residue calculation using the bullet reduction can be performed in parallel in the remainder calculation system, and processing is performed more than in the case of performing the radix representation. High speed can be expected.
[0096]
In addition, the effect of parallel calculation of the bullet reduction performed in the radix representation by the remainder calculation system is estimated as follows.
[0097]
First, consider the amount of computation per one residue multiplication. The first multiplication requires one parallel multiplication. The remainder is obtained by the subsequent bullet reduction.
[0098]
(ST21) To obtain the quotient, parallel multiplication is required k-1 times and parallel addition is required k-1 times. Further, the base extension requires k + 2 times of parallel multiplication and 2 (k + 1) times of parallel addition.
[0099]
(ST22) One parallel multiplication is required.
[0100]
(ST23) To obtain the quotient, parallel multiplication is required k + 1 times and parallel addition is required k + 1 times, and further parallel multiplication is required k times and parallel addition is required 2 (k-1) times for the base extension.
[0101]
(ST24) One parallel multiplication is required.
[0102]
(ST25) One parallel addition is required.
[0103]
In summary, 4k + 4 times of parallel multiplication and 6k + 1 times of parallel addition are required for each remainder multiplication.
[0104]
Here, the number of bits of N is 1,024 used in the current RSA encryption, and the size of the base element of the remainder calculation system is 32 bits. At this time, if k = 33, the number of 1,024 bits can be expressed, and it is understood that the minimum k for expression is obtained. If this value is substituted into the above equation, it can be seen that parallel multiplication is required 137 times and parallel addition is required 199 times per one remainder multiplication.
[0105]
Since multiplication generally takes time proportional to the square of the bit length of the operand, 32-bit multiplication is 1/32 of 1,024-bit multiplication.2= 1 / 1,024 time can be processed. Therefore, the remainder multiplication using the bullet reduction in the remainder calculation system can be processed in a time of about 137 / 1,024 = 0.13 compared to the 1,024-bit multiplication.
[0106]
Here, addition is neglected because the processing amount is smaller than multiplication. In addition, since this comparison does not include the time required for the remainder calculation with 1,024 bits, it can be expected that the processing can be performed in a time ratio smaller than 0.13 estimated here.
[0107]
The method described in each of the above embodiments is a program that can be executed by a computer, such as a magnetic disk (floppy (registered trademark) disk, hard disk, etc.), an optical disk (CD-ROM, DVD, etc.), a magneto-optical disk ( MO), and can be stored and distributed in a storage medium such as a semiconductor memory.
[0108]
In addition, as long as the storage medium can store a program and can be read by a computer, the storage format may be any form.
[0109]
In addition, an OS (operating system) operating on the computer based on an instruction of a program installed in the computer from the storage medium, MW (middleware) such as database management software, network software, and the like implement the present embodiment. A part of each process may be executed.
[0110]
Furthermore, the storage medium in the present invention is not limited to a medium independent of a computer, but also includes a storage medium in which a program transmitted via a LAN, the Internet, or the like is downloaded and stored or temporarily stored.
[0111]
Further, the number of storage media is not limited to one, and the case where the processing in the present embodiment is executed from a plurality of media is also included in the storage media in the present invention, and the media configuration may be any configuration.
[0112]
The computer according to the present invention executes each process according to the present embodiment based on a program stored in a storage medium, and includes a single device such as a personal computer or a system in which a plurality of devices are connected to a network. Any configuration may be used.
[0113]
In addition, the computer in the present invention is not limited to a personal computer, but includes an arithmetic processing device, a microcomputer, and the like included in an information processing device, and is a generic term for devices and devices that can realize the functions of the present invention by a program. .
[0114]
Note that the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the scope of the invention at the stage of implementation. In addition, the embodiments may be appropriately combined as much as possible, and in that case, combined effects can be obtained. Furthermore, the above embodiments include inventions at various stages, and various inventions can be extracted by appropriate combinations of a plurality of disclosed configuration requirements. For example, when an invention is extracted by omitting some constituent elements from all the constituent elements shown in the embodiment, when the extracted invention is implemented, the omitted part is appropriately supplemented by a well-known common technique. It is what is said.
[0115]
In addition, the present invention can be implemented with various modifications without departing from the gist thereof.
[0116]
【The invention's effect】
As described above, according to the present invention, when the product of several elements of the basis of the remainder calculation system is a division target, division can be efficiently executed in the remainder calculation system.
[Brief description of the drawings]
FIG. 1 is a schematic diagram showing a configuration of a main part of a remainder arithmetic apparatus according to a first embodiment of the present invention.
FIG. 2 is a schematic diagram for explaining an operation in the embodiment.
FIG. 3 is a schematic diagram for explaining a specific example of an operation in the embodiment.
FIG. 4 is a schematic diagram showing a configuration of a main part of a remainder arithmetic apparatus according to a second embodiment of the present invention.
FIG. 5 is a schematic diagram showing application of base extension in the same embodiment;
FIG. 6 is a schematic diagram showing application of base expansion in the embodiment.
FIG. 7 is a flowchart for explaining the operation of the remainder calculation apparatus according to the third embodiment of the present invention.
[Explanation of symbols]
10, 10 '... residue calculation device
201~ 20n... Calculation unit
211~ 21n... ROM
221~ 22n... RAM
231~ 23n, 231'-23n′… Product sum circuit
30, 30 '... control device

Claims (16)

剰余演算系の基底を{a,a,…,a}(nは整数)とし且つA=a…aとした際に、{a,a,…,a}から任意に1つの基底要素a(1≦i≦n)を選択し、このaの選択情報及びA未満の正の整数xが入力されたとき、前記xをaで除した商zを出力可能な、剰余演算機能を有する複数の演算ユニットを備えた剰余演算装置において、
前記選択情報に基づいて、前記xの剰余演算系表現の各値x,…,xから前記基底要素aに対応する値xを減じるように、前記各演算ユニットを制御する減算制御手段と、
前記減算制御手段により得られた各値(x−x),…,(x−x)(但し、(x−x)を除く)に対し、前記基底要素aの乗法逆元a -1を乗じるように、前記各演算ユニットを制御する乗算制御手段と、
前記乗算制御手段により得られた乗算結果を商zとして出力する出力手段と、
を備えたことを特徴とする剰余演算装置。
The underlying remainder operation based {a 1, a 2, ... , a n} (n is an integer) upon a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., a n }, Arbitrarily select one base element a i (1 ≦ i ≦ n), and when the selection information of this a i and a positive integer x less than A are input, the quotient obtained by dividing the x by a i In a residue calculation device including a plurality of calculation units having a residue calculation function capable of outputting z,
Subtraction control for controlling each arithmetic unit so as to subtract the value x i corresponding to the base element a i from each value x 1 ,..., X n of the remainder arithmetic system representation of x based on the selection information. Means,
Multiplication of the base element a i for each value (x 1 −x i ),..., (X n −x i ) (excluding (x i −x i )) obtained by the subtraction control means. Multiplication control means for controlling each arithmetic unit so as to multiply the inverse element a i −1 ;
Output means for outputting the multiplication result obtained by the multiplication control means as a quotient z;
A remainder calculation device comprising:
剰余演算系の基底を{a,a,…,a}(nは整数)とし且つA=a…aとした際に、{a,a,…,a}から任意にk個(2≦k≦n)の基底要素a,a,…を選択し、これらの基底要素a,a,…の選択情報及びA未満の正の整数xが入力されたとき、前記xをa・a・…で除した商zを出力可能な、剰余演算機能を有する複数の演算ユニットを備えた剰余演算装置において、
前記選択された基底要素a,a,…のうち、いずれか1個の基底要素aを再選択する再選択手段と、
前記再選択手段により再選択された基底要素aに対応する値xを、前記xの剰余演算系表現の各値x,…,xから減じるように、前記各演算ユニットを制御する減算制御手段と、
前記減算制御手段により得られた各値(x−x),…,(x−x)(但し、(x−x)を除く)に対し、前記再選択された基底要素aの乗法逆元a -1を乗じるように、前記各演算ユニットを制御する乗算制御手段と、
前記選択された基底要素a,a,…の全てが前記再選択手段、前記減算制御手段及び前記乗算制御手段により順次処理されたとき、最後に再選択された基底要素に関して前記乗算制御手段の制御により得られた乗算結果を商zとして出力する出力手段と、
を備えたことを特徴とする剰余演算装置。
The underlying remainder operation based {a 1, a 2, ... , a n} (n is an integer) upon a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., a n base element a i of an arbitrary into k from} (2 ≦ k ≦ n) , a j, select ..., these base element a i, a j, ... positive integer x is less than the selection information and a A remainder computation device comprising a plurality of computation units having a remainder computation function capable of outputting a quotient z obtained by dividing x by a i , a j ,.
Reselecting means for reselecting any one base element a h among the selected base elements a i , a j,.
Each arithmetic unit is controlled so that a value x h corresponding to the base element a h reselected by the reselecting means is subtracted from each value x 1 ,..., X n of the remainder arithmetic system representation of x. Subtraction control means;
For each value (x 1 −x i ),..., (X n −x i ) (excluding (x h −x h )) obtained by the subtraction control means, the reselected base element as multiplying the multiplicative inverse a h -1 of a h, a multiplier controlling means for controlling the respective operation units,
When all of the selected base elements a i , a j ,... Are sequentially processed by the reselection means, the subtraction control means, and the multiplication control means, the multiplication control means for the last reselected base element. Output means for outputting the multiplication result obtained by the control as quotient z;
A remainder calculation device comprising:
請求項1又は請求項2に記載の剰余演算装置において、
前記基底は、2のべき又は2のべきに近接する値を用いることを特徴とする剰余演算装置。
In the remainder calculation apparatus according to claim 1 or 2,
The base uses a power of 2 or a value close to power of 2.
請求項1乃至請求項3のいずれか1項に記載の剰余演算装置において、
前記商を、基底拡張によりn個の基底で表現するための基底拡張手段を備えたことを特徴とする剰余演算装置。
In the remainder calculation apparatus of any one of Claim 1 thru | or 3,
A remainder calculation device comprising base extension means for expressing the quotient with n bases by base extension.
請求項1乃至請求項4のいずれか1項に記載の剰余演算装置において、
正の整数N及びx<Nを満たす整数xを入力としたとき、x mod Nを出力するバレット・リダクションを行うように、前記各演算ユニットを制御するバレット・リダクション制御手段を備えたことを特徴とする剰余演算装置。
In the remainder calculation apparatus of any one of Claim 1 thru | or 4,
When a positive integer N and an integer x satisfying x <N 2 are input, a bullet reduction control means for controlling each arithmetic unit is provided so as to perform bullet reduction that outputs x mod N. A characteristic remainder calculation device.
請求項1乃至請求項4のいずれか1項に記載の剰余演算装置において、
正の整数N及びx<9Nを満たす整数xを入力としたとき、x mod N、x mod N+N、またはx mod N+2Nを出力するバレット・リダクションを行うように、前記各演算ユニットを制御するバレット・リダクション制御手段を備えたことを特徴とする剰余演算装置。
In the remainder calculation apparatus of any one of Claim 1 thru | or 4,
When a positive integer N and an integer x satisfying x <9N 2 are input, a bullet for controlling each arithmetic unit to perform bullet reduction that outputs x mod N, x mod N + N, or x mod N + 2N A remainder calculation device comprising reduction control means.
請求項6に記載の剰余演算装置において、
前記バレット・リダクション制御手段は、前記バレット・リダクションのアルゴリズムが含まれる剰余乗算を行うときに前記減算制御手段及び前記乗算制御手段を用いて前記各演算ユニットを制御することを特徴とする剰余演算装置。
The remainder calculation device according to claim 6,
The bullet reduction control means controls the respective arithmetic units using the subtraction control means and the multiplication control means when performing a modular multiplication including the bullet reduction algorithm. .
請求項6に記載の剰余演算装置において、
前記バレット・リダクション制御手段は、前記バレット・リダクションのアルゴリズムが含まれる,べき乗剰余算を行うときに前記減算制御手段及び前記乗算制御手段を用いて前記各演算ユニットを制御することを特徴とする剰余演算装置。
The remainder calculation device according to claim 6,
The bullet reduction control means includes the algorithm of the bullet reduction, and controls each arithmetic unit using the subtraction control means and the multiplication control means when performing power-residue calculation. Arithmetic unit.
剰余演算系の基底を{a,a,…,a}(nは整数)とし且つA=a…aとした際に、{a,a,…,a}から任意に1つの基底要素a(1≦i≦n)を選択し、このaの選択情報及びA未満の正の整数xが入力されたとき、前記xをaで除した商zを出力可能な、剰余演算機能を有する複数の演算ユニット、減算制御手段、乗算制御手段及び出力手段を備えた剰余演算装置が実行する剰余演算方法において、
前記減算制御手段が、前記選択情報に基づいて、前記xの剰余演算系表現の各値x,…,xから前記基底要素aに対応する値xを減じるように、前記各演算ユニットを制御する減算制御工程と、
前記乗算制御手段が、前記減算制御工程により得られた各値(x−x),…,(x−x)(但し、(x−x)を除く)に対し、前記基底要素aの乗法逆元a -1を乗じるように、前記各演算ユニットを制御する乗算制御工程と、
前記出力手段が、前記乗算制御工程により得られた乗算結果を商zとして出力する出力工程と、
を含んでいることを特徴とする剰余演算方法。
The underlying remainder operation based {a 1, a 2, ... , a n} (n is an integer) upon a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., a n }, Arbitrarily select one base element a i (1 ≦ i ≦ n), and when the selection information of this a i and a positive integer x less than A are input, the quotient obtained by dividing the x by a i In a residue calculation method executed by a residue calculation apparatus including a plurality of calculation units having a residue calculation function capable of outputting z , a subtraction control unit, a multiplication control unit, and an output unit ,
Based on the selection information , the subtraction control means subtracts the value x i corresponding to the base element a i from each value x 1 ,..., X n of the remainder arithmetic system representation of x. A subtraction control process for controlling the unit;
For each value (x 1 −x i ),..., (X n −x i ) (excluding (x i −x i )) obtained by the subtraction control step, A multiplication control step of controlling each of the arithmetic units so as to multiply the multiplicative inverse element a i −1 of the base element a i ;
An output step in which the output means outputs the multiplication result obtained by the multiplication control step as a quotient z;
The remainder calculation method characterized by including.
剰余演算系の基底を{a,a,…,a}(nは整数)とし且つA=a…aとした際に、{a,a,…,a}から任意にk個(2≦k≦n)の基底要素a,a,…を選択し、これらの基底要素a,a,…の選択情報及びA未満の正の整数xが入力されたとき、前記xをa・a・…で除した商zを出力可能な、剰余演算機能を有する複数の演算ユニット、再選択手段、減算制御手段、乗算制御手段及び出力手段を備えた剰余演算装置が実行する剰余演算方法において、
前記再選択手段が、前記選択された基底要素a,a,…のうち、いずれか1個の基底要素aを再選択する再選択工程と、
前記減算制御手段が、前記再選択工程により再選択された基底要素aに対応する値xを、前記xの剰余演算系表現の各値x,…,xから減じるように、前記各演算ユニットを制御する減算制御工程と、
前記出力手段が、前記減算制御工程により得られた各値(x−x),…,(x−x)(但し、(x−x)を除く)に対し、前記再選択された基底要素aの乗法逆元a -1を乗じるように、前記各演算ユニットを制御する乗算制御工程と、
前記選択された基底要素a,a,…の全てが前記再選択工程、前記減算制御工程及び前記乗算制御工程により順次処理されたとき、最後に再選択された基底要素に関して前記乗算制御工程の制御により得られた乗算結果を商zとして出力する出力工程と、
を含んでいることを特徴とする剰余演算方法。
The underlying remainder operation based {a 1, a 2, ... , a n} (n is an integer) upon a and A = a 1 a 2 ... a n and, {a 1, a 2, ..., a n base element a i of an arbitrary into k from} (2 ≦ k ≦ n) , a j, select ..., these base element a i, a j, ... positive integer x is less than the selection information and a A plurality of arithmetic units having a remainder operation function, a reselection unit, a subtraction control unit, a multiplication control unit and an output unit, which can output a quotient z obtained by dividing x by a i , a j ,. In the remainder calculation method executed by the provided remainder calculation apparatus ,
The reselection means, the selected base element a i, a j, ... of the reselection process to re-select any one of the base element a h,
The subtracting control means reduces the value x h corresponding to the base element a h reselected by the reselection step from each value x 1 ,..., X n of the remainder arithmetic system representation of x. A subtraction control process for controlling each arithmetic unit;
For each value (x 1 −x i ),..., (X n −x i ) (excluding (x h −x h )) obtained by the subtraction control step, A multiplication control step of controlling each of the arithmetic units so as to multiply the multiplicative inverse element a h −1 of the selected base element a h ;
When all of the selected base elements a i , a j ,... Are sequentially processed by the reselection step, the subtraction control step, and the multiplication control step, the multiplication control step with respect to the last reselected base element. An output step of outputting the multiplication result obtained by the control as a quotient z;
The remainder calculation method characterized by including.
請求項9又は請求項10に記載の剰余演算方法において、前記基底は、2のべき又は2のべきに近接する値を用いることを特徴とする剰余演算方法。11. The residue calculation method according to claim 9, wherein the base uses a power of 2 or a value close to a power of 2. 請求項9乃至請求項11のいずれか1項に記載の剰余演算方法において、
前記剰余演算装置は基底拡張手段を備えており、
前記基底拡張手段が、前記商を、基底拡張によりn個の基底で表現するための基底拡張工程を含んでいることを特徴とする剰余演算方法。
The residue calculation method according to any one of claims 9 to 11,
The remainder calculation device includes a base extension means,
A residue calculation method , wherein the base extension means includes a base extension step for expressing the quotient with n bases by base extension.
請求項9乃至請求項12のいずれか1項に記載の剰余演算方法において、
前記剰余演算装置はバレット・リダクション制御手段を備えており、
前記バレット・リダクション制御手段が、正の整数N及びx<Nを満たす整数xを入力としたとき、x mod Nを出力するバレット・リダクションを行うように、前記各演算ユニットを制御するバレット・リダクション制御工程を含んでいることを特徴とする剰余演算方法。
The remainder calculation method according to any one of claims 9 to 12,
The remainder calculation device includes a bullet reduction control means,
When the bullet reduction control means inputs a positive integer N and an integer x satisfying x <N 2 , the bullet reduction control unit controls each arithmetic unit so as to perform bullet reduction that outputs x mod N. A remainder calculation method characterized by including a reduction control step.
請求項9乃至請求項12のいずれか1項に記載の剰余演算方法において、
前記剰余演算装置はバレット・リダクション制御手段を備えており、
前記バレット・リダクション制御手段が、正の整数N及びx<9Nを満たす整数xを入力としたとき、x mod N、x mod N+N、またはx mod N+2Nを出力するバレット・リダクションを行うように、前記各演算ユニットを制御するバレット・リダクション制御工程を含んでいることを特徴とする剰余演算方法。
The remainder calculation method according to any one of claims 9 to 12,
The remainder calculation device includes a bullet reduction control means,
When the bullet reduction control means receives a positive integer N and an integer x satisfying x <9N 2 , the bullet reduction control means performs bullet reduction that outputs x mod N, x mod N + N, or x mod N + 2N. A remainder calculation method comprising a bullet reduction control step for controlling each of the calculation units.
請求項14に記載の剰余演算方法において、
前記バレット・リダクション制御工程は、前記バレット・リダクションのアルゴリズムが含まれる剰余乗算を行うときに前記減算制御工程及び前記乗算制御工程を用いて前記各演算ユニットを制御することを特徴とする剰余演算方法。
The remainder calculation method according to claim 14,
In the bullet reduction control step, when performing a modular multiplication including the bullet reduction algorithm, the arithmetic unit is controlled using the subtraction control step and the multiplication control step. .
請求項14に記載の剰余演算方法において、
前記バレット・リダクション制御工程は、前記バレット・リダクションのアルゴリズムが含まれる,べき乗剰余算を行うときに前記減算制御工程及び前記乗算制御工程を用いて前記各演算ユニットを制御することを特徴とする剰余演算方法。
The remainder calculation method according to claim 14,
The bullet reduction control step includes the algorithm of the bullet reduction, and controls each arithmetic unit using the subtraction control step and the multiplication control step when performing power-residue calculation. Calculation method.
JP2002017285A 2002-01-25 2002-01-25 Remainder calculation apparatus and method Expired - Fee Related JP4080754B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002017285A JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002017285A JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Publications (2)

Publication Number Publication Date
JP2003216032A JP2003216032A (en) 2003-07-30
JP4080754B2 true JP4080754B2 (en) 2008-04-23

Family

ID=27653032

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002017285A Expired - Fee Related JP4080754B2 (en) 2002-01-25 2002-01-25 Remainder calculation apparatus and method

Country Status (1)

Country Link
JP (1) JP4080754B2 (en)

Also Published As

Publication number Publication date
JP2003216032A (en) 2003-07-30

Similar Documents

Publication Publication Date Title
EP0801345B1 (en) Circuit for modulo multiplication and exponentiation arithmetic
US6920473B2 (en) Method and apparatus for modular multiplying and calculating unit for modular multiplying
KR100756137B1 (en) Division and square root arithmetic unit
Patronik et al. Design of Reverse Converters for General RNS Moduli Sets $\{2^{k}, 2^{n}-1, 2^{n}+ 1, 2^{n+ 1}-1\} $ and $\{2^{k}, 2^{n}-1, 2^{n}+ 1, 2^{n-1}-1\} $($ n $ even)
KR100591761B1 (en) Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition
JP2004326112A (en) Multiple modulus selector, accumulator, montgomery multiplier, method of generating multiple modulus, method of producing partial product, accumulating method, method of performing montgomery multiplication, modulus selector, and booth recorder
KR100744216B1 (en) Device and method for calculating a multiplication involving a shifting of the multiplicand
JP3532860B2 (en) Arithmetic device, method, and program using remainder representation
Großschädl A bit-serial unified multiplier architecture for finite fields GF (p) and GF (2 m)
KR20040060445A (en) Montgomery modular multiplier by 4 to 2 compressor and multiplication method thereof
JP2004519017A (en) Method and apparatus for multiplying coefficients
JP2001222410A (en) Divider
JP4080754B2 (en) Remainder calculation apparatus and method
JP3660075B2 (en) Dividing device
JP4202701B2 (en) Polynomial residue arithmetic unit, method and program
Arazi et al. On calculating multiplicative inverses modulo $2^{m} $
Wu et al. Improved RNS Montgomery modular multiplication with residue recovery
WO2003096182A1 (en) “emod” a fast modulus calculation for computer systems
JPH11282351A (en) Inverse element computing method in security technique, computing device using the method and recording medium recording program for executing the method
JP3563043B2 (en) Method for calculating reciprocal of square root, calculation circuit, and program
JP3332270B2 (en) Exponentiation unit
JP3515462B2 (en) Remainder arithmetic device and method
JP3742293B2 (en) Residue arithmetic unit
JP2004226516A (en) Power remainder computing method and program for the same
Nibouche et al. New iterative algorithms and architectures of modular multiplication for cryptography

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050114

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071218

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20080205

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080207

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

Free format text: PAYMENT UNTIL: 20110215

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110215

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees