JPH0786822B2 - Power residue arithmetic circuit - Google Patents
Power residue arithmetic circuitInfo
- Publication number
- JPH0786822B2 JPH0786822B2 JP63163761A JP16376188A JPH0786822B2 JP H0786822 B2 JPH0786822 B2 JP H0786822B2 JP 63163761 A JP63163761 A JP 63163761A JP 16376188 A JP16376188 A JP 16376188A JP H0786822 B2 JPH0786822 B2 JP H0786822B2
- Authority
- JP
- Japan
- Prior art keywords
- register
- remainder
- value
- output
- bit
- 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 - Lifetime
Links
- 238000004364 calculation method Methods 0.000 claims description 23
- 238000000034 method Methods 0.000 claims description 18
- 238000009825 accumulation Methods 0.000 claims description 5
- 230000001186 cumulative effect Effects 0.000 description 21
- 230000000295 complement effect Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 2
- PEDCQBHIVMGVHV-UHFFFAOYSA-N Glycerine Chemical compound OCC(O)CO PEDCQBHIVMGVHV-UHFFFAOYSA-N 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
Description
【発明の詳細な説明】 (産業上の利用分野) 本発明はべき乗剰余演算回路に係り、特に公開鍵暗号化
方式で用いるべき乗剰余演算回路に関する。Description: TECHNICAL FIELD The present invention relates to a modular exponentiation arithmetic circuit, and more particularly to a modular exponentiation arithmetic circuit to be used in a public key cryptosystem.
(従来の技術) 周知のように、データ通信システムや計算機システムで
は、扱う情報の安全確保の手段が種々検討されている
が、その1つの手段として情報を暗号化する方式があ
る。(Prior Art) As is well known, various means for ensuring the security of information to be handled have been studied in data communication systems and computer systems, and one method is to encrypt information.
暗号化方式には、鍵の管理法や使用法の観点から、暗号
化鍵と復号化鍵に同一のものを用いる慣用暗号化方式
と、公開された暗号化鍵と秘密の復号鍵を用いる公開鍵
暗号化方式とがある。公開鍵暗号化方式は慣用暗号化方
式の欠点を解消したもので、代表的なアルゴリズムには
Rivest、Shamir、Adlemanらによって提案されたRSA方式
がある。From the viewpoint of key management and usage, conventional encryption methods that use the same encryption key and decryption key and public methods that use a public encryption key and a secret decryption key There is a key encryption method. Public-key cryptography eliminates the drawbacks of conventional cryptography, and typical algorithms include
There is an RSA method proposed by Rivest, Shamir, Adleman and others.
RSA暗号方式は0<M<nおよび0<e<nなる関係に
あり、かつそれぞれ等しいビット長で示される整数M,同
eおよび同nを用いて Memod n=C ……(1) なる「べき乗剰余演算」を行い剰余Cを求め暗号化する
方式であり、十分な安全性を確保するためには整数M,同
eおよび同nはそれぞれ2進数で400ビット以上必要で
あるとされる。The RSA cryptosystems have a relationship of 0 <M <n and 0 <e <n, and M e mod n = C (1) using integers M, e and n, which are represented by equal bit lengths. This is a method of performing a modular exponentiation operation to obtain a remainder C and encrypting it. It is said that the integers M, e and n each require 400 bits or more in binary in order to secure sufficient security. It
このRSA暗号方式で用いる「べき乗剰余演算回路」とし
ては、従来、例えば加納等の提案に係る「高次の拡張Bo
othアルゴリズムを用いたべき乗剰余演算LSI」(暗号と
情報セキュリティワークショップ講演論文集,1987年7
月、pp.133−142)が知られている。このものは、前記
式(1)の演算が、 a×b mod n ……(2) なる剰余乗算の繰り返しに帰着することに鑑み剰余テー
ブルを設け、被乗数が除数のビット長を越える部分にお
ける剰余計算を剰余テーブルで行い、その結果と除数の
ビット長を越えなかった部分の被乗数の値との加算を行
い、その加算結果に乗数を掛けて積を求めそれを次の被
乗数とする操作を繰り返し行うことによって所望の剰余
Cを得ようとするものである。As a “power-residue arithmetic circuit” used in this RSA cryptosystem, for example, “high-order extended Bo
Exponentiation modular arithmetic LSI using oth algorithm ”(Proceedings of the Workshop on Cryptography and Information Security, 1987 7
Moon, pp.133-142) is known. This is provided with a residue table in view of the fact that the operation of the above formula (1) results in the repetition of the residue multiplication of a × b mod n (2), and the remainder in the part where the multiplicand exceeds the bit length of the divisor. The calculation is performed in the remainder table, the result is added to the value of the multiplicand that does not exceed the bit length of the divisor, the multiplication result is multiplied to obtain the product, and the operation is repeated as the next multiplicand. By doing so, the desired remainder C is to be obtained.
(発明が解決しようとする課題) しかし、前述した従来のべき乗剰余演算回路にあって
は、次のような理由から回路構成が大規模なものになる
という問題がある。(Problems to be Solved by the Invention) However, the above-described conventional modular exponentiation operation circuit has a problem that the circuit configuration becomes large for the following reason.
まず、RAM等からなる剰余テーブルを用いて剰余計算を
行っているが、この剰余テーブルは剰余計算を行う乗算
結果の積のビット長が除数のビット長よりも大きくなれ
ばなる程それに応じて容量を増加する必要がある。First, the remainder calculation is performed using a remainder table composed of RAM, etc. This remainder table has a capacity that increases as the bit length of the product of the multiplication results of the remainder calculation becomes larger than the bit length of the divisor. Need to increase.
また、回路内で扱うビット長は乗算を行うことによって
べき乗を行う数値のビット長の最大2倍程度となること
が考えられる。その結果、乗算のためのビットシフト部
や加算器等が増長するのである。Further, it is conceivable that the bit length handled in the circuit will be up to about twice the bit length of the numerical value that is raised to the power by multiplication. As a result, the number of bit shift units and adders for multiplication increases.
本発明は、このような問題に鑑みなされたもので、その
目的は、回路規模の縮小化を図り得るべき乗剰余演算回
路を提供することにある。The present invention has been made in view of such a problem, and an object thereof is to provide a modular exponentiation arithmetic circuit capable of reducing the circuit scale.
(課題を解決するための手段) 前記目的を達成するために、本発明のべき乗剰余演算回
路は次の如き構成を有する。(Means for Solving the Problem) In order to achieve the above object, a power-residue arithmetic circuit of the present invention has the following configuration.
即ち、本発明のべき乗剰余演算回路は、0<M<nおよ
び0<e<nなる関係にあり、かつそれぞれ等しいビッ
ト長で示される整数M,同eおよび同nを用いてMemod n
=Cなるべき乗剰余演算を行い剰余Cを求めるべき乗剰
余演算回路であって;このべき乗剰余演算回路は、外部
からビット直列で入力される数値Mが被乗数として初期
設定されるとともに、その後の演算過程で生成された剰
余値と累算剰余値のいずれかが被乗数として格納される
被乗数レジスタと;外部からビット直列で入力される数
値nを除数として格納する除数レジスタと;前記被乗数
レジスタの出力を前記除数レジスタの出力で除算して剰
余を求める剰余演算器と;外部からビット直列で入力さ
れた数値eをべき乗の指数として格納する指数レジスタ
と;外部からビット直列で入力される前記数値Mを格納
する入力レジスタと;前記指数レジスタの最上位ビット
から最下位ビットに至る各ビット出力に順次応答してそ
の論理状態に応じて前記入力レジスタと前記累算剰余値
のいずれかを選択出力する乗数セレクタと;前記乗数セ
レクタの出力を乗数として格納する乗数レジスタと;前
記乗数レジスタの最下位ビットから最上位ビットに至る
各ビット出力に順次応答してその論理値が“1"のときは
前記剰余演算器の出力を選択出力し“0"のときは0値入
力を選択出力する剰余セレクタと;前記剰余セレクタの
出力と前記累算剰余値を加算したものを前記除数レジス
タの出力で除算して剰余を求める累算剰余演算器と;前
記累算剰余演算器の出力を格納しそれを前記累算剰余値
として出力する累算剰余レジスタと;前記剰余演算器の
出力である前記剰余値を前記被乗数レジスタに対し出力
するとともに、前記乗数レジスタの最上位ビットについ
ての演算が終了する度に前記累算剰余値を被乗数レジス
タに対し出力する被乗数セレクタと;前記指数レジスタ
の最下位ビットについての演算が終了した時の前記累算
剰余値を最終演算結果値として外部へ出力する出力レジ
スタと;を備えていることを特徴とするものである。That is, the modular exponentiation operation circuit of the present invention has a relationship of 0 <M <n and 0 <e <n, and uses M e, n e and n, which are represented by equal bit lengths, respectively.
A power-residue calculation circuit that performs a power-residue calculation to obtain C = C; the power-residue calculation circuit initializes a numerical value M externally input in bit serial as a multiplicand and the subsequent calculation process. A multiplicand register in which either the remainder value or the cumulative remainder value generated in step 1 is stored as a multiplicand; a divisor register in which a numerical value n input from outside in bit serial is stored as a divisor; and an output of the multiplicand register A remainder calculator for dividing the output by the divisor register to obtain a remainder; an exponent register for storing a numerical value e input from the outside in bit serial as an exponent of a power; storing the numerical value M input from the outside in bit serial An input register that responds to each bit output from the most significant bit to the least significant bit of the exponent register in accordance with its logical state A multiplier selector that selectively outputs either the input register or the accumulated remainder value; a multiplier register that stores the output of the multiplier selector as a multiplier; each bit output from the least significant bit to the most significant bit of the multiplier register In response to the logical value "1", the remainder selector selects and outputs the output of the remainder operator, and when "0", the remainder selector selects and outputs a zero value input; A cumulative remainder calculator for obtaining a remainder by dividing the sum of the remainder values by the output of the divisor register; and a storage for storing the output of the cumulative remainder calculator and outputting it as the accumulated remainder value. A remainder register; outputs the remainder value output from the remainder operator to the multiplicand register, and outputs the accumulated remainder each time the operation of the most significant bit of the multiplier register is completed. A multiplicand selector for outputting to the multiplicand register; and an output register for outputting the accumulated remainder value when the operation of the least significant bit of the exponent register is finished to the outside as a final operation result value. It is characterized by.
なお、前記入力レジスタと前記乗数セレクタとの間にバ
ッファとして機能する置数レジスタを配置し、前記入力
レジスタにビット直列で入力された前記数値Mをビット
並列にして前記置数レジスタに設定することができる。A number register functioning as a buffer is arranged between the input register and the multiplier selector, and the numerical value M input in bit serial to the input register is set in the number register in bit parallel. You can
(作 用) 次に、前記の如く構成される本発明のべき乗剰余演算回
路の作用を説明する。(Operation) Next, the operation of the modular exponentiation operation circuit of the present invention configured as described above will be described.
前記式(1)で示す(Memod n)の演算を行うことは、
基本的には(M2mod n)、即ち(M×M mod n)を求める
ことである。そこで、C、M、nをQビットの2進数で
示される正の整数とし、かつ、n>Mであるとき、C=
M×M mod nは次のようにして求める。The operation of (M e mod n) shown in the above equation (1) is
Basically, it is to obtain (M 2 mod n), that is, (M × M mod n). Therefore, when C, M, and n are positive integers represented by Q-bit binary numbers and n> M, C =
M × M mod n is obtained as follows.
miをMのi(iは0以上の整数)ビット目の数とすれ
ば、M×Mの部分積mi×Mの剰余Miを求めるには 2iM mod n=Mi ……(3) の演算を行う必要があるが、この式(3)は 2Mi-1 mod n=Mi ……(4) と示すことができる。従って、 と展開でき、剰余Cを求めることができる。本発明は式
(5)で示される順次乗除方式に基づき所望の剰余を取
得しようとするものであって、従来例において検討され
た逐次乗除方式とは全く異なるものである。If m i is the number of the i-th (i is an integer of 0 or more) bit of M, 2 i M mod n = M i to obtain the remainder M i of the M × M partial product m i × M. Although it is necessary to perform the operation of (3), this expression (3) can be expressed as 2M i-1 mod n = M i (4). Therefore, And the remainder C can be obtained. The present invention seeks to obtain a desired residue based on the sequential multiplication / division method shown in the equation (5), which is completely different from the sequential multiplication / division method studied in the conventional example.
剰余演算器において被乗数レジスタの出力を除数レジス
タの出力で除算して剰余を求め、それを被乗数セレクタ
を介して被乗数レジスタに設定して同様に剰余を求め、
これを繰り返す演算ループでは前記式(3)の演算を実
行しているのである。In the remainder calculator, the output of the multiplicand register is divided by the output of the divisor register to obtain the remainder, and the remainder is set in the multiplicand register via the multiplicand selector, and the remainder is similarly obtained.
In the calculation loop that repeats this, the calculation of the above formula (3) is executed.
そして、この演算ループから剰余セレクタへ逐一出力さ
れる剰余値は剰余セレクタにおいて乗数レジスタの対応
するビット(前記mi)との積(mi×2iM mod n)がとら
れ、これと累算剰余レジスタに格納されている前回の累
算剰余値Si-1との和について除数レジスタの出力で除算
することが累算剰余演算器で行われ、その演算結果であ
る今回の累算剰余値Siが累算剰余レジスタに格納され
る。即ち、累算剰余演算器は次の式(6)の演算を実行
しているのである。Then, the remainder value output one by one from this operation loop to the remainder selector is taken as a product (m i × 2 i M mod n) with the corresponding bit (the above m i ) of the multiplier register in the remainder selector, and this is accumulated. The sum of the previous accumulated remainder value S i-1 stored in the arithmetic remainder register is divided by the output of the divisor register in the accumulation remainder calculator, and the result of this calculation is the current accumulation remainder. The value S i is stored in the cumulative remainder register. That is, the cumulative remainder calculator executes the calculation of the following formula (6).
Si=(Si-1+2imiM mod n)mod n ……(6) なお、剰余演算器および累算剰余演算器における剰余計
算は除数の2の補数を加算することによって行われる。S i = (S i-1 +2 i m i M mod n) mod n (6) The remainder calculation in the remainder calculator and the cumulative remainder calculator is performed by adding the two's complement of the divisor. .
乗数レジスタには、まず入力レジスタに格納された数値
Mが乗数セレクタを介して入力しそれが乗数として設定
されるから、乗数レジスタの全ビットについて式(6)
の演算が行われると、それは式(5)の演算が終了した
ことを示し、その演算結果である累算剰余値が被乗数セ
レクタを介して被乗数レジスタに設定される。指数レジ
スタに設定される数値eが値2であるときは、出力レジ
スタからM2mod nの演算結果が出力されることになる
が、一般に式(1)の演算を行う場合には、数値eの各
ビットの論理状態に応じて乗数レジスタの内容が変更操
作される。First, the numerical value M stored in the input register is input to the multiplier register via the multiplier selector and set as the multiplier. Therefore, for all bits of the multiplier register, the equation (6)
When the calculation is performed, it indicates that the calculation of the equation (5) is completed, and the cumulative remainder value as the calculation result is set in the multiplicand register via the multiplicand selector. When the numerical value e set in the exponent register is the value 2, the operation result of M 2 mod n is output from the output register. Generally, when the operation of the formula (1) is performed, the numerical value e The contents of the multiplier register are changed and operated according to the logical state of each bit of.
即ち、べき乗演算では、乗数セレクタが指数レジスタの
最上位ビットから最下位ビットに至る各ビット出力に順
次応答してその論理値が“0"のときは累算剰余レジスタ
に格納されている前回の累算剰余値S(これが被乗数レ
ジスタに設定されている)を乗数レジスタに設定する。
その結果、S×S mod nの処理が実行される。また、論
理値が“1"のときは、まず前回の累算剰余値Sを乗数レ
ジスタに設定してS×S mod nを求め、次いで入力レジ
スタの内容である数値Mを乗数レジスタに設定して {(S×S mod n)×M}mod n を求める。この乗数セレクタの操作は、指数である数値
eの最上位ビットから下位ビットに向かうビット配列に
おいて、そのビットの論理値が“0"であるときは前回の
値を単に2乗すれば良く、論理値が“1"であるときは前
回の値を2乗してMをかければ良いという特性に基づく
ものである。That is, in the exponentiation operation, the multiplier selector sequentially responds to each bit output from the most significant bit to the least significant bit of the exponent register, and when the logical value is “0”, it is stored in the cumulative remainder register. The accumulated remainder value S (which is set in the multiplicand register) is set in the multiplier register.
As a result, S × S mod n processing is executed. When the logical value is "1", the previous accumulated remainder value S is first set in the multiplier register to obtain S × S mod n, and then the numerical value M which is the contents of the input register is set in the multiplier register. Then, {(S × S mod n) × M} mod n is obtained. In the operation of this multiplier selector, in the bit array from the most significant bit to the lower bit of the numerical value e which is the exponent, when the logical value of the bit is “0”, the previous value may be simply squared. This is based on the characteristic that when the value is "1", the previous value is squared and M is multiplied.
以上のように、本発明のべき乗剰余演算回路によれば、
従来例の如き剰余テーブルを使用せずに所望の剰余演算
が行える。また、剰余計算は単純な加算処理によって行
う回路内部で扱うビット長は除数のビット長よりもLビ
ット(Lは2よりも大きな整数)だけ長いだけで済む。
従って、従来例回路よりも大幅に回路規模を縮小するこ
とができる。As described above, according to the modular exponentiation arithmetic circuit of the present invention,
A desired remainder calculation can be performed without using the remainder table as in the conventional example. Further, the remainder calculation is performed by a simple addition process. The bit length handled inside the circuit is only L bits (L is an integer larger than 2) longer than the bit length of the divisor.
Therefore, the circuit scale can be significantly reduced as compared with the conventional circuit.
(実 施 例) 以下、本発明の実施例を図面を参照して説明する。(Examples) Examples of the present invention will be described below with reference to the drawings.
第1図は、本発明の一実施例に係るべき乗剰余演算回路
を示す。FIG. 1 shows a modular exponentiation arithmetic circuit according to an embodiment of the present invention.
前記式(1)において、M,e,nおよびCはそれぞれQビ
ットの2進数で示される正の整数であって、RSA暗号化
方式の定義からM<nである。In the above formula (1), M, e, n and C are respectively positive integers represented by Q-bit binary numbers, and M <n from the definition of the RSA encryption method.
被乗数レジスタ1と入力レジスタ7には、外部から数値
Mが初期設定される。また、除数レジスタ2には数値n
が、指数レジスタ6には数値eがそれぞれ外部から供給
され数値設定がなされる。Numerical value M is initially set in the multiplicand register 1 and the input register 7. In addition, the divisor register 2 has a numerical value n
However, the numerical value e is supplied to the exponent register 6 from the outside and the numerical value is set.
これら外部から供給される数値はピン数削減の趣旨から
ビット直列で供給される。なお、本実施例では入力レジ
スタ7と乗数セレクタ9間にバッファとして機能する置
数レジスタ8を設けてある。即ち、入力レジスタ7では
ビット直列で入力した数値Mをビット並列にして置数レ
ジスタに設定し、入力レジスタ7は新たな演算に必要な
数値入力に備え得るようにしてある。Numerical values supplied from the outside are supplied in bit series in order to reduce the number of pins. In this embodiment, a register number 8 which functions as a buffer is provided between the input register 7 and the multiplier selector 9. That is, in the input register 7, the numerical value M input in bit serial is set in bit parallel and set in the numerical register so that the input register 7 can be prepared for the numerical value input required for a new operation.
まず、被乗数レジスタ1、除数レジスタ2、剰余演算器
3および被乗数セレクタ11からなる演算部では次の如き
処理が行われる。前記式(3)と同(4)において、n
>Mに注意すると、M mod n=M0はM mod n=M0=Mであ
る。また、2M0 mod n=M1はM0=Mから2M mod n=M1と
表され、2M<2nである。以下同様に、2Mi-1<2nであ
る。故に、式(3)、同(4)で示されるmod nの処理
を行うことは2Mi-1からnを減算することに等しいとい
うことが理解できる。このとき、2Mi-1からnを減算で
きればその答えをMiとし、減算できなければ2Mi-1をそ
のままMiとするのである。この処理を剰余演算器3が行
っているのである。First, the following processing is performed in the arithmetic unit including the multiplicand register 1, the divisor register 2, the remainder arithmetic unit 3, and the multiplicand selector 11. In the equation (3) and the equation (4), n
Note that> M, M mod n = M 0 is M mod n = M 0 = M. Further, 2M 0 mod n = M 1 is expressed as 2M mod n = M 1 from M 0 = M, and 2M <2n. Similarly, 2M i-1 <2n. Therefore, it can be understood that performing mod n processing represented by equations (3) and (4) is equivalent to subtracting n from 2M i-1 . At this time, if n can be subtracted from 2M i-1, the answer is M i, and if it cannot be subtracted, 2M i-1 is directly used as M i . The remainder calculator 3 performs this processing.
即ち、剰余演算器3には被乗数レジスタ1に格納される
Qビットの被乗数が入力する。また、除数レジスタ2に
格納される除数nは2の補数に変換される。そこで、最
初に、数値Mと数値nの2の補数との加算を行ってM mo
d nを実行する。That is, the Q-bit multiplicand stored in the multiplicand register 1 is input to the remainder calculator 3. Further, the divisor n stored in the divisor register 2 is converted into a two's complement. Therefore, first, the addition of the numerical value M and the two's complement of the numerical value n is performed to obtain M mo
run dn
その結果、最上位ビットが“1"であればMからnを減算
できたので、M0が減算結果となる。逆に、最上位ビット
が“0"であれば減算できなかったことになり、Mが減算
結果となる。剰余演算器3はこのようにして剰余値M0ま
たは同Mを得、それを左へ1ビットシフトした形で剰余
セレクタ11を介して被乗数レジスタ1へ出力し新たな被
乗数の設定を行う。これにより、2M mod nの演算が引き
続いて実行される。以後同様の演算が繰り返し実行され
る。斯くして、前記式(3)において、20M〜2Q-1Mまで
の剰余値が連続して求められ、それらは剰余セレクタ12
へ逐一出力される。As a result, if the most significant bit is “1”, n can be subtracted from M, so M 0 is the subtraction result. On the contrary, if the most significant bit is “0”, it means that the subtraction could not be performed, and M is the subtraction result. In this way, the remainder calculator 3 obtains the remainder value M 0 or the same M and outputs it to the multiplicand register 1 via the remainder selector 11 in the form of shifting it by 1 bit to the left to set a new multiplicand. As a result, the operation of 2M mod n is continuously executed. After that, the same calculation is repeatedly executed. Thus to, in the formula (3), 2 0 M~2 remainder value to Q-1 M is determined continuously, they remainder selector 12
Is output one by one.
剰余セレクタ12では、乗数レジスタ10の最下位ビットか
ら最上位ビットに至る各ビット出力に順次応答してその
論理値が“1"のときは剰余演算器3の出力を選択出力し
“0"のときは0値入力を選択出力する。つまり、剰余演
算器3から逐一出力される剰余値と乗数レジスタ10の対
応するビット(mi)との積(mi×2iM mod n)がとら
れ、それが累算剰余演算器4へ入力する。The remainder selector 12 sequentially responds to each bit output from the least significant bit to the most significant bit of the multiplier register 10, and when the logical value is “1”, selectively outputs the output of the remainder arithmetic unit 3 and outputs “0”. In this case, 0 value input is selected and output. That is, the product (m i × 2 i M mod n) of the remainder value output from the remainder calculator 3 and the corresponding bit (m i ) of the multiplier register 10 is obtained, and this is the accumulated remainder calculator 4 To enter.
累算剰余演算器4では、この積(mi×2iM mod n)と累
算剰余レジスタ5に格納されている前回の累算剰余値S
i-1との和(Si-1+2imiM mod n)を求め、これに除数レ
ジスタ2の出力である数値nの2の補数を加算し、その
結果最上位ビットの論理値が“1"ならば加算結果を今回
の累算剰余値Siとし、また最上位ビットの論理値が“0"
ならば前記和を今回の累算剰余値Siとする。これらは累
算剰余レジスタに逐一格納される。即ち、前記式(6)
の処理が乗数レジスタ10のQビットの全てについて行わ
れ、1回分のa×b mod n(前記式(2))の処理が完
了し、これにより被乗数セレクタ11が制御される。その
結果、この完了時点の累算剰余値Sが被乗数セレクタ11
を介して被乗数レジスタ1へ出力されるとともに、乗数
セレクタ9にも出力される。In the cumulative remainder calculator 4, this product (m i × 2 i M mod n) and the previous cumulative remainder value S stored in the cumulative remainder register 5 are stored.
The sum of i-1 and (S i-1 +2 i m i M mod n) is obtained, and the 2's complement of the numerical value n output from the divisor register 2 is added to the result, and the result is that the logical value of the most significant bit is If it is "1", the addition result is the cumulative remainder value S i of this time, and the logical value of the most significant bit is "0".
Then, the sum is set as the cumulative remainder value S i of this time. These are stored one by one in the cumulative remainder register. That is, the above formula (6)
Is performed for all the Q bits of the multiplier register 10, and the process of a.times.b mod n (Equation (2)) for one time is completed, whereby the multiplicand selector 11 is controlled. As a result, the accumulated remainder value S at the time of completion is the multiplicand selector 11
It is output to the multiplicand register 1 via the and also to the multiplier selector 9.
次に、「べき乗」の処理を示す。乗数セレクタ9は、指
数レジスタ6の最上位ビット(MSB)から最下位ビット
(LSB)に至る各ビット出力に応答してその論理状態に
応じて置数レジスタ8の出力と累算剰余レジスタ5の出
力のいずれかを選択しそれを乗数レジスタ10へ出力す
る。Next, the process of "exponentiation" is shown. The multiplier selector 9 responds to each bit output from the most significant bit (MSB) to the least significant bit (LSB) of the exponent register 6 in accordance with the logical state of the output of the number register 8 and the cumulative remainder register 5. Select one of the outputs and output it to the multiplier register 10.
具体的には次の通りである。今、Mを733乗することを
考えると、 となるが、733を2進数で表すと 733=(1011011101)2 ……(8) となる。すると、式(7)と同(8)の関係から次のこ
とが判明する。即ち、最上位ビットから下位ビットに向
かうビット配列において、そのビットの論理値が“0"で
あるときは前回の値を単に2乗すれば良く、論理値が
“1"であるときは前回の値を2乗してMをかければ良い
ということが理解できる。従って、乗数セレクタ9は、
指数レジスタ6の出力ビットの論理値が“0"であるとき
は累算剰余レジスタ5の出力を選択し、また論理値が
“1"であるときはまず累算剰余レジスタ5の出力を選択
し次いで置数レジスタ8の出力を選択することを行う。
なお、指数レジスタ6の最上位ビット出力は常に“1"で
あるが、第1回目の処理では累算剰余レジスタ5には累
算剰余値は存在せず、かつ第1回目の処理はM×M mod
nである。従って、第1回目の処理では最上位ビットに
ついての処理を省略し、置数レジスタ8の出力、即ち数
値Mが乗数レジスタ10に設定されることになる。Specifically, it is as follows. Now, considering that M is raised to the power of 733, However, if 733 is expressed in a binary number, then 733 = (1011011101) 2 (8). Then, the following is found from the relationship of equation (7) and equation (8). That is, in the bit array from the most significant bit to the least significant bit, when the logical value of that bit is "0", the previous value is simply squared, and when the logical value is "1", the previous value is It can be understood that it suffices to square the value and calculate M. Therefore, the multiplier selector 9
When the logical value of the output bit of the exponent register 6 is “0”, the output of the cumulative remainder register 5 is selected. When the logical value of the output bit is “1”, the output of the cumulative remainder register 5 is selected first. Then, the output of the number register 8 is selected.
Although the most significant bit output of the exponent register 6 is always "1", there is no cumulative remainder value in the cumulative remainder register 5 in the first processing, and M × in the first processing. M mod
n. Therefore, in the first processing, the processing for the most significant bit is omitted and the output of the number register 8, that is, the numerical value M is set in the multiplier register 10.
斯くして、べき乗演算では、乗数セレクタ9が指数レジ
スタ6の最上位ビットから最下位ビットに至る各ビット
出力に順次応答してその論理値が“0"のときは累算剰余
レジスタ5に格納されている前回の累算剰余値Sを乗数
レジスタ10に設定する。その結果、S×S mod nの処理
が実行される。また、論理値が“1"のときは、まず前回
の累算剰余値Sを乗数レジスタ10に設定してS×S mod
nを求め、次いで置数レジスタ8の内容である数値Mを
乗数レジスタ10に設定して {(S×S mod n)×M}mod n を求める。そして、指数レジスタ6の最下位ビットにつ
いての処理が終了すると、出力レジスタ13から所望の演
算結果が出力される。Thus, in the exponentiation operation, the multiplier selector 9 sequentially responds to each bit output from the most significant bit to the least significant bit of the exponent register 6 and stores it in the cumulative remainder register 5 when its logical value is “0”. The previous accumulated remainder value S that has been set is set in the multiplier register 10. As a result, S × S mod n processing is executed. When the logical value is "1", first, the previous accumulated remainder value S is set in the multiplier register 10 and S × S mod
Then, n is obtained, and then the numerical value M which is the contents of the number register 8 is set in the multiplier register 10 to obtain {(S × S mod n) × M} mod n. Then, when the process for the least significant bit of the exponent register 6 is completed, the desired calculation result is output from the output register 13.
なお、Qビットについてのべき乗演算では、最上位ビッ
トについての処理は省略できるので、Q−1ビット分の
処理を行えば良いことになる。In the exponentiation operation for Q bits, the processing for the most significant bit can be omitted, so that it is sufficient to perform the processing for Q-1 bits.
そして、ビットの論理値が“1"のときは「2乗してMを
かける」という2回の処理を行うので、全ビットが“1"
である場合が最大演算回数となる。(Q−1)×2=2
(Q−1)回である。また、1回のべき乗剰余演算はQ
回の剰余演算からなる。従って、Qビットからなる1つ
のMについては最大2(Q−1)×Q=2Q(Q−1)回
の剰余演算が行われることになる。しかし、全て加算処
理であるから、演算器やレジスタ等が扱うビット数はそ
れ程大きくはならない。除数のビット長よりも高々L
(Lは2よりも大きい整数)ビット長くなるだけであ
り、従来例回路の如く回路規模が増大することはなく、
縮小化を図ることができる。When the logical value of the bit is "1", the processing of "square and multiply by M" is performed twice, so all bits are "1".
Is the maximum number of calculations. (Q-1) × 2 = 2
(Q-1) times. In addition, one modular exponentiation operation is Q
It consists of a remainder operation. Therefore, a maximum of 2 (Q-1) * Q = 2Q (Q-1) remainder operations are performed on one M consisting of Q bits. However, since all of them are addition processes, the number of bits handled by the arithmetic units, registers, etc. does not become so large. At most L than the bit length of the divisor
(L is an integer greater than 2) It is only bit longer, and the circuit scale does not increase unlike the conventional example circuit.
It is possible to reduce the size.
(発明の効果) 以上説明したように、本発明のべき乗剰余演算回路によ
れば、RSA暗号化方式であるという特徴、即ちべき乗さ
れる数値は除数よりも小さいことに着目し、乗数となる
数値の各ビットに対応した部分積の剰余を剰余演算器に
おいて単純な加算によって計算して出力し、また累算剰
余演算部においても、剰余演算器から出力された剰余を
順次加算して累算値の剰余を求める処理を行うようにし
たので、従来例の如き剰余テーブルを使用せずに所望の
剰余演算が行える。また、剰余計算は単純な加算処理に
よって行うので回路内部で扱うビット長は除数のビット
長よりもLビット(Lは2よりも大きな整数)だけ長い
だけで済む。従って、従来例回路よりも大幅に回路規模
を縮小することができ、本回路を実装する装置の小型化
が図れるという効果がある。(Effects of the Invention) As described above, according to the modular exponentiation arithmetic circuit of the present invention, the characteristic that the RSA encryption method is used, that is, the value to be exponentiated is smaller than the divisor, The remainder of the partial product corresponding to each bit of is calculated and output by simple addition in the remainder calculator, and also in the cumulative remainder calculator, the remainder output from the remainder calculator is sequentially added to obtain the accumulated value. Since the processing for obtaining the remainder of is performed, the desired remainder calculation can be performed without using the remainder table as in the conventional example. Since the remainder calculation is performed by a simple addition process, the bit length handled inside the circuit need only be L bits (L is an integer greater than 2) longer than the bit length of the divisor. Therefore, there is an effect that the circuit scale can be significantly reduced as compared with the conventional example circuit, and the device in which the present circuit is mounted can be downsized.
第1図は本発明の一実施例に係るべき乗剰余演算回路の
構成ブロック図である。 1……被乗数レジスタ、2……除数レジスタ、3……剰
余演算器、4……累算剰余演算器、5……累算剰余レジ
スタ、6……指数レジスタ、7……入力レジスタ、8…
…置数レジスタ、9……乗数セレクタ、10……乗数レジ
スタ、11……被乗数セレクタ、12……剰余セレクタ、13
……出力レジスタ。FIG. 1 is a configuration block diagram of a modular exponentiation arithmetic circuit according to an embodiment of the present invention. 1 ... Multiplicand register, 2 ... Divisor register, 3 ... Remainder calculator, 4 ... Accumulation remainder calculator, 5 ... Accumulation remainder register, 6 ... Exponent register, 7 ... Input register, 8 ...
… Numeric register, 9 …… Multiplier selector, 10 …… Multiplier register, 11 …… Multiplicand selector, 12 …… Remainder selector, 13
...... Output register.
Claims (2)
り、かつそれぞれ等しいビット長で示される整数M,同e
および同nを用いてMemod n=Cなるべき乗剰余演算を
行い剰余Cを求めるべき乗剰余演算回路であって;この
べき乗剰余演算回路は、外部からビット直列で入力され
る数値Mが被乗数として初期設定されるとともに、その
後の演算過程で生成された剰余値と累算剰余値のいずれ
かが被乗数として格納される被乗数レジスタと;外部か
らビット直列で入力される数値nを除数として格納する
除数レジスタと;前記被乗数レジスタの出力を前記除数
レジスタの出力で除算して剰余を求める剰余演算器と;
外部からビット直列で入力された数値eをべき乗の指数
として格納する指数レジスタと;外部からビット直列で
入力される前記数値Mを格納する入力レジスタと;前記
指数レジスタの最上位ビットから最下位ビットに至る各
ビット出力に順次応答してその論理状態に応じて前記入
力レジスタと前記累算剰余値のいずれかを選択出力する
乗数セレクタと;前記乗数セレクタの出力を乗数として
格納する乗数レジスタと;前記乗数レジスタの最下位ビ
ットから最上位ビットに至る各ビット出力に順次応答し
てその論理値が“1"のときは前記剰余演算器の出力を選
択出力し“0"のときは0値入力を選択出力する剰余セレ
クタと;前記剰余セレクタの出力と前記累算剰余値を加
算したものを前記除数レジスタの出力で除算して剰余を
求める累算剰余演算器と;前記累算剰余演算器の出力を
格納しそれを前記累算剰余値として出力する累算剰余レ
ジスタと;前記剰余演算器の出力である前記剰余値を前
記被乗数レジスタに対し出力するとともに、前記乗数レ
ジスタの最上位ビットについての演算が終了する度に前
記累算剰余値を被乗数レジスタに対し出力する被乗数セ
レクタと;前記指数レジスタの最下位ビットについての
演算が終了した時の前記累算剰余値を最終演算結果値と
して外部へ出力する出力レジスタと;を備えていること
を特徴とするべき乗剰余演算回路。1. An integer M and an e which have a relation of 0 <M <n and 0 <e <n and are represented by equal bit lengths.
And a power-residue arithmetic circuit that obtains a remainder C by performing a power-residue calculation such that M e mod n = C; the power-residue arithmetic circuit uses a numerical value M input from outside in bit serial as a multiplicand. A multiplicand register that is initialized and stores either a remainder value or an accumulated remainder value generated in the subsequent arithmetic process as a multiplicand; a divisor that stores a numerical value n input from outside in bit serial as a divisor A register; and a remainder calculator for dividing the output of the multiplicand register by the output of the divisor register to obtain a remainder;
An exponent register for storing the numerical value e input from the outside in bit serial as an exponent of an exponent; An input register for storing the numerical value M input from the outside in bit serial; the most significant bit to the least significant bit of the exponent register A multiplier selector that sequentially responds to each bit output up to and outputs either the input register or the accumulated remainder value according to its logical state; a multiplier register that stores the output of the multiplier selector as a multiplier; In response to each bit output from the least significant bit to the most significant bit of the multiplier register, when the logical value is "1", the output of the remainder arithmetic unit is selectively output, and when it is "0", the zero value input is performed. A remainder selector that selectively outputs the output of the remainder selector and the accumulated remainder value are divided by the output of the divisor register to obtain a remainder. An accumulator residue register for storing the output of the accumulative residue calculator and outputting it as the accumulated residue value; and outputting the residue value output from the residue calculator to the multiplicand register. A multiplicand selector that outputs the accumulated remainder value to the multiplicand register each time the operation on the most significant bit of the multiplier register is completed; and the accumulation when the operation on the least significant bit of the exponent register is completed. A modular exponentiation arithmetic circuit, comprising: an output register for outputting a remainder value as a final operation result value to the outside;
間にバッファとして機能する置数レジスタを配置し、前
記入力レジスタにビット直列で入力された前記数値Mを
ビット並列にして前記置数レジスタに設定することを特
徴とする請求項1に記載のべき乗剰余演算回路。2. A number register functioning as a buffer is arranged between the input register and the multiplier selector, and the numerical value M input in bit serial to the input register is bit parallel to the number register. The modular exponentiation arithmetic circuit according to claim 1, which is set.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63163761A JPH0786822B2 (en) | 1988-06-30 | 1988-06-30 | Power residue arithmetic circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63163761A JPH0786822B2 (en) | 1988-06-30 | 1988-06-30 | Power residue arithmetic circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH0212290A JPH0212290A (en) | 1990-01-17 |
| JPH0786822B2 true JPH0786822B2 (en) | 1995-09-20 |
Family
ID=15780203
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP63163761A Expired - Lifetime JPH0786822B2 (en) | 1988-06-30 | 1988-06-30 | Power residue arithmetic circuit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0786822B2 (en) |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS57206964A (en) * | 1981-06-16 | 1982-12-18 | Nec Corp | Multiplier/divider |
| JPS6034131A (en) * | 1983-08-04 | 1985-02-21 | Tokiwadou Seika Kk | Making method of "karinto" (fried dough cake) containing aloe |
-
1988
- 1988-06-30 JP JP63163761A patent/JPH0786822B2/en not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JPH0212290A (en) | 1990-01-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7277540B1 (en) | Arithmetic method and apparatus and crypto processing apparatus for performing multiple types of cryptography | |
| JP3784156B2 (en) | Modular multiplication method | |
| JP3939658B2 (en) | Apparatus for performing modular multiplication, and arithmetic unit for performing modular multiplication | |
| US6209016B1 (en) | Co-processor for performing modular multiplication | |
| KR100591761B1 (en) | Montgomery Modular Multiplication Method Using Montgomery Modular Multiplier and Carry Store Addition | |
| US5261001A (en) | Microcircuit for the implementation of RSA algorithm and ordinary and modular arithmetic, in particular exponentiation, with large operands | |
| US5121429A (en) | Digital signal processing | |
| JP3532860B2 (en) | Arithmetic device, method, and program using remainder representation | |
| US7412474B2 (en) | Montgomery modular multiplier using a compressor and multiplication method | |
| JP3302043B2 (en) | Encryption communication method and system | |
| Arazi et al. | On calculating multiplicative inverses modulo $2^{m} $ | |
| KR100480997B1 (en) | APPARATUS OF FIELD MULTIPLICATION OVER GF(p) AND GF(2^m) | |
| KR20060037941A (en) | Hybrid Multiplication Computing Device and Method in Finite Field | |
| JPH0786822B2 (en) | Power residue arithmetic circuit | |
| KR100486697B1 (en) | Modular arithmetic apparatus and method thereof | |
| Alkar et al. | A hardware version of the RSA using the Montgomery's algorithm with systolic arrays | |
| KR100322740B1 (en) | Modular computing apparatus and method thereof | |
| Tynymbayev et al. | Devices for Modular Multiplication of Numbers with Analysis of Two Least Significant Bits of the Multiplier. | |
| JP4223819B2 (en) | Power residue calculation apparatus and program | |
| JP3332270B2 (en) | Exponentiation unit | |
| JP3210420B2 (en) | Multiplication circuit over integers | |
| JPH0326114A (en) | Multiplication remainder operator | |
| US20260058793A1 (en) | Montgomery multiplier architecture | |
| JP2553548B2 (en) | Multiplicative residue computing device | |
| JP4080754B2 (en) | Remainder calculation apparatus and method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| S533 | Written request for registration of change of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313533 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080920 Year of fee payment: 13 |
|
| EXPY | Cancellation because of completion of term | ||
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080920 Year of fee payment: 13 |