JP2010008883A - Arithmetic device for cipher, arithmetic method for cipher, and program - Google Patents

Arithmetic device for cipher, arithmetic method for cipher, and program Download PDF

Info

Publication number
JP2010008883A
JP2010008883A JP2008170432A JP2008170432A JP2010008883A JP 2010008883 A JP2010008883 A JP 2010008883A JP 2008170432 A JP2008170432 A JP 2008170432A JP 2008170432 A JP2008170432 A JP 2008170432A JP 2010008883 A JP2010008883 A JP 2010008883A
Authority
JP
Japan
Prior art keywords
calculation
cryptographic
unit
computation
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008170432A
Other languages
Japanese (ja)
Inventor
Atsushi Shinpo
淳 新保
Hideo Shimizu
秀夫 清水
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 JP2008170432A priority Critical patent/JP2010008883A/en
Publication of JP2010008883A publication Critical patent/JP2010008883A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an arithmetic device for cipher that has resistance to simple electric power analysis of selection document type of (n-1) input type, and has high arithmetic efficiency. <P>SOLUTION: An input section 11 inputs a message M as the base of modulo exponentiation calculation, private power (d), and modulus (n). A preprocessing section 12 multiplies the message M itself to determine conversion data. An arithmetic section 2 for cipher sets the conversion data as an arithmetic object, and performs the modulo exponentiation calculation under the modulus (n) by right-face arithmetic procedure based on the power (d) except the lowest bit. A post-processing section 13 performs modulo multiplication calculation of the arithmetic result and the message M under the modulus (n) when LSB of the (d) is 1, and performs the same modulo multiplication calculation as a dummy calculation when the LSB of the (d) is 0. An output section 14 outputs, as a final result, the arithmetic result of the post-processing section 13 (when the LSB of the (d) is 1) or the arithmetic result of the arithmetic section 2 for cipher (when the LSB of the (d) is 0). <P>COPYRIGHT: (C)2010,JPO&amp;INPIT

Description

本発明は、べき乗剰余計算や楕円曲線上のスカラー倍算などの暗号用演算を行う暗号用演算装置、暗号用演算方法及びプログラムに関する。   The present invention relates to a cryptographic calculation device, a cryptographic calculation method, and a program for performing cryptographic calculations such as power-residue calculation and scalar multiplication on an elliptic curve.

ICカードに代表される小規模なデバイスは、携帯可能で、情報セキュリティの核となる利用者の認証や、決済データの認証などに利用される。ICカード上のLSIに搭載されている暗号機能には一般に耐タンパー対策が施され、LSI内部に記憶されている秘密鍵の漏洩が生じないように実装される。耐タンパー対策としては、LSIの消費電力の変動を観測して秘密鍵の推定を容易にする電力解析などのサイドチャネル攻撃に対しても、演算上の工夫により防御する手法が知られている。   A small device represented by an IC card is portable and is used for authentication of a user who is the core of information security, authentication of payment data, and the like. The encryption function mounted on the LSI on the IC card is generally provided with a tamper resistance measure and is mounted so that the secret key stored in the LSI does not leak. As a tamper resistant measure, a technique is known that protects against side channel attacks such as power analysis that makes it easy to estimate a secret key by observing fluctuations in power consumption of an LSI by means of computation.

RSA暗号や楕円曲線暗号などの公開鍵暗号は、べき乗剰余演算あるいは楕円曲線上のスカラー倍算と呼ばれる基本演算を利用して構成される。これらの基本演算に対する電力解析攻撃の対策手法として、秘密鍵のパターンに依存せずに規則的に行う演算手法が、単純電力解析(SPA(Simple Power Analysis))と呼ばれる攻撃に有効であることが知られている。こうしたSPA攻撃に耐性のある、べき乗剰余演算(あるいはスカラー倍算)として、Add-and-Double-Always法(非特許文献1)や、モンゴメリ・ラダー法(非特許文献2)がある。   Public key cryptography such as RSA cryptography and elliptic curve cryptography is configured using a basic operation called exponentiation remainder computation or scalar multiplication on an elliptic curve. As a countermeasure against power analysis attacks against these basic operations, a regular operation method that does not depend on the secret key pattern is effective for attacks called simple power analysis (SPA). Are known. As a power-residue operation (or scalar multiplication) that is resistant to such SPA attacks, there are an Add-and-Double-Always method (Non-patent Document 1) and a Montgomery Ladder method (Non-Patent Document 2).

しかし、最近、従来のSPA耐性のあるべき乗剰余演算に対する新たな攻撃手法が見出されてきており、例えば、非特許文献3では、選択文書型のSPAが示されている。特に、RSA暗号や楕円曲線暗号におけるSPA対策として有名な、右向きバイナリ型のAdd-and-Double-Always演算手法に対し、モジュラスをnとして、(n−1)を入力に与える単純な手法で、従来のSPA対策が破られることが示されている。   However, recently, a new attack technique for a power-residue calculation with a conventional SPA tolerance has been found. For example, Non-Patent Document 3 shows a SPA of a selected document type. In particular, it is a simple method of giving (n-1) to the input with n as the modulus for the right-pointing binary type Add-and-Double-Always calculation method, which is well-known as a countermeasure against SPA in RSA encryption and elliptic curve encryption. It has been shown that conventional SPA measures are broken.

また、発明者の検討により、モンゴメリ・ラダー法に対しても、Yenらの(n−1)入力型SPAによりSPA対策を無効化できることが判明した。   Further, the inventors' investigation has revealed that the SPA countermeasure can be nullified by the (n-1) input SPA of Yen et al. For the Montgomery ladder method.

選択文書型のSPAに対する汎用的で強力な対策に、入力メッセージに対してランダムなマスクをかけて演算を行うメッセージ・ブラインディング法の適用がある。しかし、同対策手法では、演算コストの小さくない逆元計算が必要であるという問題や、通常のべき乗計算に比べて2倍の演算コストがかかる場合があるという問題などがある。
J.S.Coron, ”Resistance against differential power analysis for elliptic curve”, CHES ’99. M.Joye and S.-M. Yen, ”The Montgomery Powering Ladder”, CHES 2002. S.-M. Yen et al., ”Power Analysis by Exploiting Chosen Message and Internal Collisions”, Mycrypt 2005.
As a general and powerful countermeasure against the SPA of the selected document type, there is an application of a message blinding method that performs an operation by applying a random mask to an input message. However, the countermeasure method has a problem that an inverse element calculation with a low calculation cost is necessary, and a problem that the calculation cost may be twice as high as that of a normal power calculation.
JSCoron, “Resistance against differential power analysis for elliptic curve”, CHES '99. M.Joye and S.-M. Yen, “The Montgomery Powering Ladder”, CHES 2002. S.-M. Yen et al., “Power Analysis by Exploiting Chosen Message and Internal Collisions”, Mycrypt 2005.

RSA暗号や楕円曲線暗号の実装モジュールにおいて、選択文書型のSPA攻撃により、従来の対策演算法が無効化されてしまうことが判明している。選択文書型の電力解析攻撃の中では、ある入力に対する暗号処理の1回の実行波形だけで秘密鍵の多くのビットパターンを推定可能とする(n−1)入力型SPAや、その拡張攻撃が特に脅威となる。しかし、それら脅威に対する対策演算法は知られていない。   It has been found that, in the implementation module of the RSA encryption or elliptic curve encryption, the conventional countermeasure calculation method is invalidated by the SPA attack of the selected document type. Among the selected document type power analysis attacks, there are (n-1) input type SPA and its extended attack that can estimate many bit patterns of a secret key with only one execution waveform of cryptographic processing for a certain input. Especially a threat. However, there is no known countermeasure calculation method for these threats.

本発明は、上記事情を考慮してなされたもので、右向き型のバイナリべき乗算やモンゴメリ・ラダー算法における(n−1)入力型SPAやその拡張攻撃手法に対する効率的な対策演算法を実現した暗号用演算装置、暗号用演算方法及びプログラムを提供することを目的とする。   The present invention has been made in consideration of the above circumstances, and has realized an efficient countermeasure calculation method for (n-1) input SPA and its extended attack technique in right-pointing type binary power multiplication and Montgomery ladder arithmetic. It is an object to provide a cryptographic computing device, a cryptographic computing method, and a program.

本発明は、2進数からなる秘密のパラメータの上位ビットから下位ビットに向けて計算を進める手順である右向き型演算手順を用いて、特定の暗号用演算を行う暗号用演算装置であって、前記暗号用演算の対象となるデータと、前記演算に用いる前記秘密のパラメータと、前記演算に用いる他のパラメータとを入力する入力部と、前記データに対して、特定の変換を施して、変換データを求める前処理部と、前記変換データと、前記秘密のパラメータの全部又は一部と、前記他のパラメータとを入力として、該秘密のパラメータの全部又は一部を用いた前記右向き型演算手順により、前記暗号用演算を行って、その演算結果を求める暗号用演算部と、前記暗号用演算部が求めた前記演算結果をもとにして、前記データと前記秘密のパラメータの全部と前記他のパラメータとを入力とした場合の前記暗号用演算の演算結果を求める後処理を行う後処理部と、前記暗号用演算部が求めた前記演算結果又は前記後処理部が求めた前記演算結果を、最終的な演算結果として出力する出力部とを備えたことを特徴とする。   The present invention is a cryptographic operation device that performs a specific cryptographic operation using a right-pointed operation procedure, which is a procedure for calculating from a higher bit to a lower bit of a secret parameter consisting of a binary number, An input unit for inputting data to be subjected to cryptographic calculation, the secret parameter used for the calculation, and other parameters used for the calculation, and performing specific conversion on the data to convert the data The pre-processing unit for obtaining the conversion data, the whole or part of the secret parameter, and the other parameter, and the right-type calculation procedure using the whole or part of the secret parameter. , Performing the cryptographic computation and obtaining the computation result, and the data and the secret parameter based on the computation result obtained by the cryptographic computation portion A post-processing unit that performs post-processing for obtaining the computation result of the cryptographic computation when all and the other parameters are input, and the computation result obtained by the cryptographic computation unit or the post-processing unit And an output unit that outputs the calculation result as a final calculation result.

本発明によれば、右向き型のバイナリべき乗算やモンゴメリ・ラダー算法における(n−1)入力型SPAやその拡張攻撃手法に対する効率的な対策演算法を実現することができる。   According to the present invention, it is possible to realize an efficient countermeasure calculation method for (n-1) input SPA and its extended attack technique in right-pointing binary power multiplication and Montgomery ladder arithmetic.

以下、図面を参照しながら本発明の実施形態について説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

まず、本実施形態に係る暗号用演算装置について説明するのに先立って、本実施形態において考慮する選択入力型SPAについて説明する。なお、以下で扱う暗号用演算は、べき乗剰余計算や楕円曲線上のスカラー倍算である。   First, prior to the description of the cryptographic operation device according to the present embodiment, the selective input SPA considered in the present embodiment will be described. The cryptographic operations handled below are power-residue calculations and scalar multiplication on elliptic curves.

べき乗剰余計算の計算手順として、大きく、右向き型演算手順(指数の上位ビットから下位ビットに向けて計算を進める演算手順)と、左向き型演算手順(指数の下位ビットから上位ビットに向けて計算を進める演算手順)とがある。これらのうち、本実施形態で考慮する選択入力型SPAが脅威となるのは、右向き型演算手順のべき乗剰余計算である。   The power-residue calculation procedure is largely divided into a right-handed operation procedure (a calculation procedure that advances the calculation from the high-order bit of the exponent to the low-order bit), and a left-type calculation procedure (a calculation from the low-order bit of the exponent to the high-order bit) Calculation procedure). Among these, the selection input type SPA considered in the present embodiment is a threat in the power-residue calculation of the right-direction type calculation procedure.

右向き型べき乗剰余計算は、指数をw(複数)ビットずつまとめて処理を行うwビットウィンドウ法に拡張できることや、演算途中の計算結果の記憶量が削減できる場合があることなどの利点があり、実装上利用される場面が多い。右向き型べき乗剰余計算法の具体例に、右向きバイナリ法とモンゴメリ・ラダー法とがある。   The right-handed modular exponentiation has the advantage that it can be expanded to the w-bit window method in which exponents are processed in units of w (plural) bits, and the storage amount of calculation results during computation may be reduced. Many scenes are used for implementation. Specific examples of the right-handed modular exponentiation method include the right-pointing binary method and the Montgomery ladder method.

右向きバイナリ法は、そのままの実装では指数ビットによる剰余乗算の処理分岐があるため、通常のSPAに弱く、SPA対策を考慮してダミー処理を追加した手順が利用される場面が多い。以降の説明では、SPA対策を考慮した右向きバイナリ法を例として非特許文献3で示された選択入力型SPAを説明する。   The right-facing binary method has a processing branch of remainder multiplication by exponent bits in the implementation as it is, and is therefore weak to normal SPA, and in many cases, a procedure in which dummy processing is added in consideration of SPA countermeasures is used. In the following description, the selective input type SPA shown in Non-Patent Document 3 will be described by taking the right-pointing binary method considering SPA countermeasures as an example.

非特許文献3の選択入力型SPAは、1回もしくは2回のべき乗剰余計算の実行波形から、特定のビットを除くほぼ全ての指数ビットを推定可能とする、非常に脅威となる攻撃である。非特許文献3では、法nに対して、(n−1)を入力とする(−1)入力SPA、xと−xの1組を入力とする(x,−x)入力SPAの2種類が示されている。   The selective input type SPA of Non-Patent Document 3 is a very threatening attack that makes it possible to estimate almost all exponent bits except specific bits from the execution waveform of one or two exponentiation remainder calculations. In Non-Patent Document 3, two types of (n-1) are input to (modulus n), (-1) input SPA, and (x, -x) input SPA is input with one set of x and -x. It is shown.

まず、右向きバイナリ法に対して(−1)入力SPAを適用した場合について説明する。   First, a case where (−1) input SPA is applied to the right-facing binary method will be described.

図14に、この場合における演算経過の一例を示す。   FIG. 14 shows an example of calculation progress in this case.

この場合、指数ビットを1ビット処理する度に2乗剰余処理と乗算剰余処理とが繰り返されるが、登場する演算パターンは、
1*1 mod n,
(-1)*(-1) mod n,
1*(-1) mod n
の3種類にすぎず、更に、2乗剰余処理部では、1*1 mod n又は(-1)*(-1) mod nのいずれかが実行される。
In this case, every time an exponent bit is processed by 1 bit, the square remainder process and the multiplication remainder process are repeated.
1 * 1 mod n,
(-1) * (-1) mod n,
1 * (-1) mod n
In addition, the square remainder processing unit executes either 1 * 1 mod n or (−1) * (− 1) mod n.

ここで、あるビットd(i)における2乗剰余処理部の演算内容と、1つ前に処理したビットd(i−1)の値との関係に着目すると、2乗剰余処理部で上記のいずれの演算が実行されるかは、1つ前に処理したビットd(i−1)が0であるか又は1であるかに依存していることが分る。すなわち、あるビットd(i)について2乗剰余処理部で1*1 mod n又は(-1)*(-1) mod nのいずれが実行されたかが分かれば、1つ前のビットd(i−1)が0であるか又は1であるかが特定できることになる。   Here, paying attention to the relation between the operation content of the square remainder processing unit at a certain bit d (i) and the value of the bit d (i-1) processed one time before, the above-mentioned square remainder processing unit It can be seen that which operation is executed depends on whether the bit d (i−1) processed immediately before is 0 or 1. That is, if it is known which one of 1 * 1 mod n or (−1) * (− 1) mod n is executed in a square remainder processing unit for a certain bit d (i), the previous bit d (i− Whether 1) is 0 or 1 can be specified.

2乗剰余処理は規則的なタイミングで発生するため、SPAによりこの2種類の波形の区別さえできれば、指数dのLSBを除く全てのビットパターンが判明する。   Since the square remainder process occurs at regular timing, all the bit patterns except for the LSB of the index d are found as long as the two types of waveforms can be distinguished by SPA.

実際、この2種類の波形の区別が可能であることを実験により確認した結果も報告されており、(−1)入力SPAへの対策は必須となる。   In fact, the result of confirming by experiment that these two types of waveforms can be distinguished has been reported, and (-1) a countermeasure for the input SPA is essential.

この攻撃への対策として、入力が(−1)であるかどうかを検査し、もしそうであれば、指数のLSBの0/1に応じて、べき乗剰余結果として(実際に演算を進めることなく)0/1を出力する方法で対処できる。しかし、非特許文献3では、(−1)入力SPAを拡張した(x,−x)入力SPAも提示されている。   As a countermeasure against this attack, it is checked whether or not the input is (−1). If so, according to 0/1 of the LSB of the exponent, as a power residue result (without actually proceeding with the calculation) This can be dealt with by outputting 0/1. However, Non-Patent Document 3 also presents (-1) input SPA that is an extension of (-1) input SPA.

次に、右向きバイナリ法に対して(x,−x)入力SPAを適用した場合について説明する。   Next, a case where (x, −x) input SPA is applied to the rightward binary method will be described.

図15に、この場合の演算経過の一例を示す。   FIG. 15 shows an example of the calculation process in this case.

この場合、入力xでの演算経過と入力(−x)での演算経過とを比較すると、乗算剰余処理部での(−x)入力時の結果は、常に、x入力時の演算結果に(−1)を乗じた値になっていることが分る。   In this case, when the calculation process at the input x is compared with the calculation process at the input (−x), the result at the (−x) input in the multiplication remainder processing unit is always the calculation result at the x input ( It can be seen that the value is multiplied by -1).

従って、2乗剰余処理部に着目すると、x入力時と(−x)入力時とで全く同じ演算が行われるのは、1つ前に処理したビットd(i−1)が0のときに限られ、この性質から、SPAで2乗剰余処理に着目して2波形を比較することにより、LSBを除く指数のビットパターンが判明することが分る。   Therefore, focusing on the square remainder processing unit, the same calculation is performed when x is input and when (−x) is input when the bit d (i−1) processed immediately before is 0. From this property, it can be seen that the bit pattern of the exponent excluding the LSB can be found by comparing two waveforms while paying attention to the square remainder processing in SPA.

次に、モンゴメリ・ラダー算法に対して(−1)入力SPAを適用した場合について説明する。   Next, a case where (-1) input SPA is applied to Montgomery-Ladder algorithm will be described.

モンゴメリ・ラダー算法は次の通りである。   The Montgomery Ladder algorithm is as follows.

(1)べき指数d=[d(m-1),..,di,..,d1,d0]_2の上位ビットからdiまでを処理した中間結果として、(Li,Ri)なる組が得られる。ここで、Di=[d/2^i](ここで、[x]はx以下の最大の整数を表す。)として、Li=M^Di (mod n),Ri=M^(Di+1) (mod n)である。初期値を(Lm,Rm)=(M^0,M^1)=(1,M)とする。   (1) A pair of (Li, Ri) is obtained as an intermediate result of processing from the higher bits of the exponent d = [d (m-1), .., di, .., d1, d0] _2 to di. It is done. Here, Di = [d / 2 ^ i] (where [x] represents the maximum integer less than or equal to x), Li = M ^ Di (mod n), Ri = M ^ (Di + 1 ) (mod n). The initial value is (Lm, Rm) = (M ^ 0, M ^ 1) = (1, M).

(2)着目する指数ビットd(i−1)に応じて、図16に示す計算を実行する。ここで、L0が最終結果を与える。   (2) The calculation shown in FIG. 16 is executed according to the exponent bit d (i−1) of interest. Here, L0 gives the final result.

上記算法では、Liが本来の中間結果、Riが補助的な中間値である。指数部の差が1であることに注意して指数部に着目すると、必ず一方は奇数、他方は偶数になる。   In the above algorithm, Li is the original intermediate result and Ri is the auxiliary intermediate value. When attention is paid to the exponent part by paying attention to the difference between the exponent parts being 1, one is always odd and the other is even.

(−1)を入力Mとして与えたとき、(-1)^(2k)=1,(-1)^(2k+1)=-1であり、LiとRiは、指数の偶数・奇数に応じて、1か(−1)の組しかとり得ない。   When (-1) is given as an input M, (-1) ^ (2k) = 1, (-1) ^ (2k + 1) =-1, and Li and Ri are set to an even number and an odd number of exponents. Accordingly, only 1 or (-1) pairs can be taken.

従って、Li,Riの計算時に登場するパターンも、
1*1,
(-1)*(-1),
1*(-1),
(-1)*1
の4種類のみであり、これらのパターンはSPAでの判別が容易である。
Therefore, the pattern that appears when calculating Li and Ri is
1 * 1,
(-1) * (-1),
1 * (-1),
(-1) * 1
These patterns are only four types, and these patterns are easily discriminated by SPA.

これらのうち、(-1)*(-1)の計算が登場する場合に着目すると、D(i+1)が偶数でDiが奇数(すなわちd(i+1)=0かつdi=1)のケースと、D(i+1)が奇数でDiが偶数(すなわちd(i+1)=1かつdi=0)のケースとに限られる。このことは、べき指数の上位から順にSPAで指数値を順次決定できることを表している。   Of these, focusing on the case where calculation of (-1) * (-1) appears, D (i + 1) is an even number and Di is an odd number (that is, d (i + 1) = 0 and di = 1) And D (i + 1) is an odd number and Di is an even number (that is, d (i + 1) = 1 and di = 0). This indicates that the index value can be sequentially determined by SPA in order from the top of the power index.

図17に、モンゴメリ・ラダー算法に対して(−1)入力SPAを適用した場合の演算経過の一例を示す。   FIG. 17 shows an example of calculation progress when (-1) input SPA is applied to the Montgomery-Ladder algorithm.

図17の例では、(-1)*(-1) mod nの計算は、指数ビットが下位から5番目、3番目、1番目の計算においてであり、これらのビットが一つ上位のビットと0/1が反転した関係になっていることを利用して、LSBを除く全てのビットを推定できる。   In the example of FIG. 17, the calculation of (-1) * (-1) mod n is in the fifth, third, and first calculations from the lower order, and these bits are the one higher order bit. All bits except for the LSB can be estimated by utilizing the fact that 0/1 is inverted.

次に、モンゴメリ・ラダー算法に対して(x,−x)入力SPAを適用した場合について説明する。   Next, a case where the (x, −x) input SPA is applied to the Montgomery ladder algorithm will be described.

図18に、この場合における演算経過の一例を示す。   FIG. 18 shows an example of calculation progress in this case.

この場合、モンゴメリ・ラダー算法での中間レジスタに記憶される値の指数に着目すると、必ず一方は奇数、他方は偶数になることから、(−x)入力時には、L*R mod nの計算結果は必ず-x^y mod nとなる。   In this case, paying attention to the exponent of the value stored in the intermediate register in the Montgomery-Ladder algorithm, one is always an odd number and the other is an even number. Therefore, at the time of (−x) input, the calculation result of L * R mod n Is always -x ^ y mod n.

従って、R←L*R mod nとL←L*R mod nの演算結果を、x入力時の同じタイミングでの演算と比較すると、必ず符号反転した結果となる。   Therefore, when the calculation result of R ← L * R mod n and L ← L * R mod n is compared with the calculation at the same timing when x is input, the result is always the result of sign inversion.

指数ビットとして0もしくは1が連続した場合には、それぞれL←L*L mod n、R←R*R mod nの計算が繰り返され、その場合に限って、x入力時の演算と全く同じ演算が同じタイミングで出現することが分る。   When 0 or 1 continues as an exponent bit, the calculation of L ← L * L mod n and R ← R * R mod n is repeated, and only in that case, exactly the same operation as when x is input Can be seen at the same time.

この性質から、SPAでx入力時と(−x)入力時との2波形の差分を解析することにより、指数のビットパターンが判明することが分る。   From this property, it can be seen that the bit pattern of the exponent can be determined by analyzing the difference between the two waveforms when x is input and when (−x) is input by SPA.

以上で説明したように、SPAに対して耐性があると考えられてきた右向きバイナリ型算法やモンゴメリ・ラダー算法において、(−1)入力SPAや(x,−x)入力SPAにより秘密指数のパターンが判明する可能性が高いことが明らかとなった。   As described above, in the right-pointing binary type algorithm or Montgomery ladder algorithm which has been considered to be resistant to SPA, the secret exponent pattern is obtained by (-1) input SPA or (x, -x) input SPA. It became clear that there is a high possibility that

以下、本実施形態では、これらの選択入力型SPAに対する耐性を備えた本実施形態に係る暗号用演算装置について説明する。   Hereinafter, in the present embodiment, a cryptographic operation device according to the present embodiment having resistance against these selective input SPAs will be described.

図1に、本実施形態の暗号用演算装置の構成例を示す。   FIG. 1 shows an example of the configuration of the cryptographic operation device of this embodiment.

図1に示されるように、本実施形態の暗号用演算装置は、攻撃無効化処理部1と暗号用演算部2とを備えている。   As shown in FIG. 1, the cryptographic operation device of this embodiment includes an attack invalidation processing unit 1 and a cryptographic calculation unit 2.

暗号用演算部2は、既存の所定の暗号用演算を行う。所定の暗号用演算は、例えば、べき乗剰余計算や楕円曲線上のスカラー倍算である。   The cryptographic calculation unit 2 performs an existing predetermined cryptographic calculation. The predetermined cryptographic operation is, for example, power residue calculation or scalar multiplication on an elliptic curve.

攻撃無効化処理部1は、上記選択文書型SPA攻撃に対する耐性を暗号用演算装置に付与するために、該攻撃を無効化するための処理を行う。   The attack invalidation processing unit 1 performs a process for invalidating the attack in order to provide the cryptographic computing device with resistance against the selected document type SPA attack.

攻撃無効化処理部1は、入力部11、前処理部12、後処理部13、出力部14を備えている。   The attack invalidation processing unit 1 includes an input unit 11, a preprocessing unit 12, a postprocessing unit 13, and an output unit 14.

攻撃無効化処理部1と暗号用演算部2とをハードウェアにより構成するかソフトウェアにより構成するかについては、例えば次のようなバリエーションがある。
(1)攻撃無効化処理部1と暗号用演算部2とをすべてハードウェアにより構成する。
(2)攻撃無効化処理部1と暗号用演算部2とをすべてソフトウェアにより構成する。
(3)攻撃無効化処理部1をソフトウェア(ファームウェア)により構成し、暗号用演算部2をハードウェアにより構成する。
For example, there are variations as to whether the attack invalidation processing unit 1 and the cryptographic operation unit 2 are configured by hardware or software.
(1) The attack invalidation processing unit 1 and the cryptographic operation unit 2 are all configured by hardware.
(2) The attack invalidation processing unit 1 and the cryptographic operation unit 2 are all configured by software.
(3) The attack invalidation processing unit 1 is configured by software (firmware), and the cryptographic operation unit 2 is configured by hardware.

なお、暗号用演算部2は、既存のもので構わないので、既存の暗号用演算部2に、新たに攻撃無効化処理部1を追加して、本実施形態の暗号用演算装置を実現することが可能である。   Note that since the cryptographic computation unit 2 may be an existing one, the attack invalidation processing unit 1 is newly added to the existing cryptographic computation unit 2 to realize the cryptographic computation device of the present embodiment. It is possible.

図2に、本実施形態の暗号用演算装置の動作手順の一例を示す。   FIG. 2 shows an example of the operation procedure of the cryptographic operation device of this embodiment.

ステップS1で、入力部11は、当該暗号用演算の対象となるデータ(べき乗剰余計算の場合のメッセージM、楕円曲線上のスカラー倍算の場合のP)、該演算に用いる秘密のパラメータd=[d(m-1),..,di,..,d1,d0]_2(ただし、[]_2は2進数展開を意味する)、該演算に用いるその他のパラメータを入力する。   In step S1, the input unit 11 receives the data to be subjected to the cryptographic operation (message M in the case of exponentiation remainder calculation, P in the case of scalar multiplication on an elliptic curve), and a secret parameter d = [d (m-1), .., di, .., d1, d0] _2 (where [] _2 means binary expansion) and other parameters used for the calculation are input.

なお、所定の暗号用演算が、べき乗剰余計算である場合、dは、(秘密の)指数であり、その他のパラメータには、べき乗剰余計算の法nが該当する。また、所定の暗号用演算が、楕円曲線上のスカラー倍算である場合、dは、(秘密の)スカラー値であり、その他のパラメータには、楕円曲線ドメインパラメータEが該当する。   When the predetermined cryptographic operation is power residue calculation, d is a (secret) exponent, and the exponent n of power residue calculation corresponds to the other parameters. Further, when the predetermined cryptographic operation is scalar multiplication on an elliptic curve, d is a (secret) scalar value, and the elliptic curve domain parameter E corresponds to the other parameters.

なお、入力部11は、それらデータを、どのような方法で入力するものであっても良い。例えば、入力デバイスや通信デバイスやメモリデバイスなどから入力しても良いし、他のプロセスから入力しても良い。   The input unit 11 may input the data by any method. For example, it may be input from an input device, a communication device, a memory device, or the like, or may be input from another process.

ステップS2で、前処理部12は、(暗号用演算部2に対する)上記攻撃を無効化するために、演算対象となるデータに対して所定の変換を施して変換データを生成する処理を含む前処理を行う。より具体的には後述するが、演算対象となるデータの変換については、所定の暗号用演算が、べき乗剰余計算である場合に、例えば、M’←M^2 mod nなどを行い、所定の暗号用演算が、楕円曲線上のスカラー倍算である場合に、例えば、P’←2*Pなどを行う。生成された変換データ(例えば、M’やP’)は、暗号用演算部2に与えられる。   In step S2, the preprocessing unit 12 includes a process of performing predetermined conversion on the data to be calculated to generate conversion data in order to invalidate the attack (for the cryptographic calculation unit 2). Process. More specifically, as will be described later, with regard to the conversion of the data to be calculated, when the predetermined cryptographic operation is a power-residue calculation, for example, M ′ ← M ^ 2 mod n is performed, If the cryptographic operation is scalar multiplication on an elliptic curve, for example, P ′ ← 2 * P is performed. The generated conversion data (for example, M ′ or P ′) is given to the cryptographic operation unit 2.

また、より具体的には後述するが、入力されたdの全部又は一部のビット(例えば、最下位ビットを除いたd’=[d(m-1),..,di,..,d1]_2)が暗号用演算部2に与えられる。また、入力された、その他のパラメータが、暗号用演算部2に与えられる。更に、それら以外の情報が暗号用演算部2に与えられる場合もある。   More specifically, as will be described later, all or a part of the input d (for example, d ′ = [d (m−1),.., Di,... d1] _2) is given to the cryptographic operation unit 2. Further, the input other parameters are given to the cryptographic operation unit 2. Furthermore, information other than these may be given to the cryptographic operation unit 2.

ステップS3で、暗号用演算部2は、与えられた、生成された変換データ(例えば、M’やP’)と、秘密のパラメータd’の全部又は一部のビットと、その他のパラメータとを入力として、当該所定の暗号用演算を行う。   In step S3, the cryptographic operation unit 2 obtains the generated converted data (for example, M ′ or P ′), all or some bits of the secret parameter d ′, and other parameters. The predetermined cryptographic operation is performed as an input.

なお、この暗号用演算部2により得られる演算結果は、求めるべき最終的な演算結果ではない(あるいは、条件に応じて、最終的な演算結果になることもある)。   The calculation result obtained by the cryptographic calculation unit 2 is not the final calculation result to be obtained (or may be the final calculation result depending on conditions).

ステップS4で、後処理部13は、暗号用演算部2の計算結果をもとに、最終的な演算結果を生成する。より具体的には後述するが、所定の暗号用演算が、べき乗剰余計算である場合に、例えば、S←S*M mod n(暗号用演算部2の計算結果に更にMを乗算)などを行い、所定の暗号用演算が、楕円曲線上のスカラー倍算である場合に、例えば、Q←Q+P(暗号用演算部2の計算結果に更にPを加算)などを行う。なお、その際、より具体的には後述するが、所定の暗号用演算によっては、攻撃を無効化するために、ダミー演算を行うことがある。   In step S4, the post-processing unit 13 generates a final calculation result based on the calculation result of the cryptographic calculation unit 2. More specifically, as described later, when the predetermined cryptographic operation is a power-residue calculation, for example, S ← S * M mod n (the calculation result of the cryptographic operation unit 2 is further multiplied by M) When the predetermined cryptographic operation is scalar multiplication on an elliptic curve, for example, Q ← Q + P (addition of P to the calculation result of the cryptographic operation unit 2) is performed. In this case, as will be described in more detail later, depending on a predetermined cryptographic operation, a dummy operation may be performed in order to invalidate the attack.

ステップS5で、出力部14は、後処理部13により得られた計算結果(条件に応じて、暗号用演算部2により得られた計算結果)を出力する。例えば、所定の暗号用演算が、べき乗剰余計算である場合に、S=M^d mod nを出力し、所定の暗号用演算が、楕円曲線上のスカラー倍算である場合に、Q=d*Pを出力する。   In step S5, the output unit 14 outputs the calculation result obtained by the post-processing unit 13 (the calculation result obtained by the cryptographic operation unit 2 according to the conditions). For example, when the predetermined cryptographic operation is power-residue calculation, S = M ^ d mod n is output, and when the predetermined cryptographic operation is scalar multiplication on an elliptic curve, Q = d * P is output.

なお、出力部14は、最終的な計算結果を、どのような方法で出力するものであっても良い。例えば、出力デバイスや通信デバイスやメモリデバイスなどへ出力しても良いし、他のプロセスへ出力しても良い。   The output unit 14 may output the final calculation result by any method. For example, the data may be output to an output device, a communication device, a memory device, or the like, or may be output to another process.

以下、暗号用演算装置のより具体的な構成例について説明する。   Hereinafter, a more specific configuration example of the cryptographic operation device will be described.

以下説明する第1〜第3の実施形態は、暗号用演算として、べき乗剰余計算を例にとったものであり、第4,5の実施形態は、暗号用演算として、楕円曲線上でのスカラー倍算を例にとったものである。   In the first to third embodiments described below, power-residue calculation is taken as an example of cryptographic operations, and the fourth and fifth embodiments are scalars on an elliptic curve as cryptographic operations. This is an example of multiplication.

<べき乗剰余演算>
図3に、図1を「べき乗剰余計算」用に記述した構成例を示す。
<Power residue calculation>
FIG. 3 shows a configuration example in which FIG. 1 is described for “power residue calculation”.

第1〜第3の実施形態では、暗号用演算装置は「べき乗剰余計算装置」、暗号用演算部は「べき乗剰余計算部」と呼ぶ。   In the first to third embodiments, the cryptographic calculation device is referred to as a “power residue calculation device”, and the cryptographic calculation unit is referred to as a “power residue calculation unit”.

(第1の実施形態)
本発明の第1の実施形態に係るべき乗剰余演算装置について説明する。本実施形態では、べき乗剰余演算の3つの演算手順例を示す。
(First embodiment)
A power residue calculation apparatus according to the first embodiment of the present invention will be described. In the present embodiment, three calculation procedure examples of power-residue calculation are shown.

最初に、右向きバイナリ型算法によるべき乗剰余演算に対する、(−1)入力SPA攻撃と(x,−x)入力SPA攻撃を無効化できるようにした例について説明する。   First, an example in which the (-1) input SPA attack and the (x, -x) input SPA attack can be invalidated with respect to the power-residue calculation by the rightward binary type arithmetic will be described.

図4に、この場合のべき乗剰余演算の演算手順の一例を示す。   FIG. 4 shows an example of the calculation procedure of the power-residue calculation in this case.

まず、ステップS10で、入力部11は、べき乗剰余計算の底であるメッセージMと、秘密のべき指数d=[d(m-1),..,di,..,d1,d0]_2と、法nとを入力する。   First, in step S10, the input unit 11 determines that the message M, which is the base of the power-residue calculation, and the secret power exponent d = [d (m−1), .., di, .., d1, d0] _2 , Input the modulus n.

ステップS11で、前処理部12は、Mを2乗剰余計算(M^2 mod n)し、その計算結果をM’とする。   In step S11, the preprocessing unit 12 performs a square remainder calculation (M ^ 2 mod n) on M, and sets the calculation result as M '.

上記のM’を底、入力されたdのうち最下位ビットを除いたd’(d’=[d/2])をべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Based on the above M ′, d ′ (d ′ = [d / 2]) excluding the least significant bit out of the input d is a power exponent, and the input n is a modulus, and they are attack invalidation processing units 1 is given to the power residue calculation unit 2.

ステップS12で、べき乗剰余計算部2は、それらをもとに、(右向き型の)べき乗剰余計算(M’^d’ mod n)を行い、その計算結果Sを求める。   In step S12, the power-residue calculating unit 2 performs (right-facing) power-residue calculation (M ′ ^ d ′ mod n) based on them, and obtains the calculation result S.

このSは、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   This S is returned from the exponentiation remainder calculation unit 2 to the attack invalidation processing unit 1.

ステップS13で、後処理部13は、入力されたdの最下位ビット(LSB)d0が1かどうか調べ、d0が1である場合には、ステップS14に進んで、後処理部13は、上記計算結果SとMを法nで乗算剰余計算(S*M mod n)し、この計算結果で、Sを更新する。この(更新後の)Sが、最終的なべき乗剰余演算結果(M^d mod n)になる。   In step S13, the post-processing unit 13 checks whether or not the least significant bit (LSB) d0 of the input d is 1. If d0 is 1, the process proceeds to step S14, where the post-processing unit 13 The calculation results S and M are multiplied by a modulus n (S * M mod n), and S is updated with the calculation results. This (after update) S becomes the final power residue calculation result (M ^ d mod n).

一方、d0が0である場合には、ステップS15に進んで、後処理部13は、ダミー処理として、ステップS14と同じ計算(S*M mod n)を行い、その結果は、本来の出力と異なる領域S’に保存する。この場合、べき乗剰余計算部2により求められたSが、最終的なべき乗剰余演算結果(M^d mod n)になる。   On the other hand, if d0 is 0, the process proceeds to step S15, and the post-processing unit 13 performs the same calculation (S * M mod n) as step S14 as a dummy process, and the result is the original output. Save in a different area S ′. In this case, S obtained by the power-residue calculation unit 2 becomes the final power-residue calculation result (M ^ d mod n).

ステップS16で、出力部14は、べき乗剰余演算結果S=M^d mod nを出力する。   In step S16, the output unit 14 outputs the power residue calculation result S = M ^ d mod n.

なお、上記演算手順例において、ステップS15のダミー処理は、べき指数dのLSBの0/1の判別をタイミング攻撃により防ぐ目的で追加しているが、暗号の演算では、べき指数のLSBは1であることが、暗号アルゴリズムの性質から事前に判明している場合もある。よって、べき指数のLSBの0/1の判別をサイドチャネル攻撃から防御する必要がない場合には、ステップS15のダミー処理は省略しても良い。   In the above calculation procedure example, the dummy process in step S15 is added for the purpose of preventing 0/1 discrimination of the LSB of the power exponent d by a timing attack, but in the cryptographic operation, the LSB of the power exponent is 1. In some cases, it is known in advance from the nature of the cryptographic algorithm. Therefore, when it is not necessary to protect the 0/1 discrimination of the LSB of the exponent from the side channel attack, the dummy process in step S15 may be omitted.

また、べき乗剰余計算部2と攻撃無効化処理部1との間でSをやり取りする方法としては、Sをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSを転送しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSの記憶場所を示すポインタを転送しても良い。   As a method of exchanging S between the power residue calculation unit 2 and the attack invalidation processing unit 1, S is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. S may be transferred between the power-residue calculation unit 2 and the attack invalidation processing unit 1, and the storage location of S may be set between the power-residue calculation unit 2 and the attack invalidation processing unit 1. The indicated pointer may be transferred.

さて、この計算手順例によれば、ステップS11により得られるM’は、x入力時と−x入力時で常にx^2となる。従って、ステップS12でのべき乗計算時には、xと−xのいずれの入力でも常に同じ演算が行われ、ステップS13以降の処理で符号により異なる処理が行われる。このため、(x、−x)入力SPAで指数ビットが判明する可能性があるのは、指数dのLSBのみであり、それ以外のビットは、判別することが不可能になる。また、(−1)入力SPAでも、同様の性質から、指数dのLSBを除く指数ビットが保護できる。   Now, according to this calculation procedure example, M ′ obtained in step S11 is always x ^ 2 when x is input and when −x is input. Therefore, at the time of power calculation in step S12, the same calculation is always performed for both inputs x and -x, and different processing is performed depending on the sign in the processing after step S13. For this reason, only the LSB of the exponent d can be identified by the (x, -x) input SPA, and the other bits cannot be discriminated. Also, (-1) the input SPA can protect the exponent bits excluding the LSB of the exponent d from the same property.

次に、モンゴメリ・ラダー算法によるべき乗剰余演算に対する、(−1)入力SPA攻撃と(x,−x)入力SPA攻撃を無効化できるようにした例について説明する。   Next, an example in which the (−1) input SPA attack and the (x, −x) input SPA attack can be invalidated with respect to the power-residue calculation by the Montgomery ladder algorithm will be described.

図5に、この場合のべき乗剰余演算の演算手順の一例を示す。   FIG. 5 shows an example of the calculation procedure of the power-residue calculation in this case.

まず、ステップS20で、入力部11は、べき乗剰余計算の底であるMと、秘密のべき指数d=[d(m-1),..,di,..,d1,d0]_2と、法nとを入力する。   First, in step S20, the input unit 11 determines that M is a base of power-residue calculation and a secret power exponent d = [d (m-1), .., di, .., d1, d0] _2, Enter the modulus n.

ステップS21で、前処理部12は、Mを2乗剰余計算し、その計算結果(M^2 mod n)をM’とする。   In step S21, the preprocessing unit 12 calculates a square remainder of M, and sets the calculation result (M ^ 2 mod n) as M '.

上記のM’を底、入力されたdをべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Based on the above M ', the input d is a power exponent, and the input n is a modulus, and these are given from the attack invalidation processing unit 1 to the power residue calculation unit 2.

ステップS22で、べき乗剰余計算部2は、参照する指数ビットを表すインデックスiをmにセットし、中間レジスタLに1をセットし、中間レジスタRに、与えられたM’をセットする。   In step S22, the power-residue calculating unit 2 sets an index i representing an index bit to be referred to m, sets 1 to the intermediate register L, and sets a given M ′ to the intermediate register R.

以降、ステップS23からステップS27までの処理ループで、べき乗剰余計算部2は、指数ビットd(m−1)からd1までのべき指数に対応したべき乗計算を行う。   Thereafter, in the processing loop from step S23 to step S27, the power-residue calculating unit 2 performs a power calculation corresponding to the exponents from the exponent bits d (m−1) to d1.

ステップS23で、インデックスiをデクリメントし、ステップS24で、iが0より大きいかどうか調べる。   In step S23, the index i is decremented, and in step S24, it is checked whether i is greater than zero.

iが0より大きい場合には、ステップS25で、指数ビットdiが1であるかどうか調べ、diが1ならば、ステップS26に進んで、L←L*R mod nとR←R*R mod nの計算を行い、diが0ならば、ステップS27に進んで、R←L*R mod nとL←L*L mod nの計算を行う。そして、ステップS23に戻って、次の処理ループに移る。   If i is larger than 0, it is checked in step S25 whether the exponent bit di is 1. If di is 1, the process proceeds to step S26, where L ← L * R mod n and R ← R * R mod. If n is calculated and di is 0, the process proceeds to step S27, and R ← L * R mod n and L ← L * L mod n are calculated. And it returns to step S23 and moves to the next processing loop.

以上の処理ループが繰り返された結果、ステップS23でi=0になると、ステップS24で、iが0より大きくないので、この処理ループを抜けて、ステップS28へ分岐することになる。   As a result of repeating the above processing loop, if i = 0 in step S23, i is not greater than 0 in step S24, so that the processing loop is exited and the process branches to step S28.

ここで、べき乗剰余計算部2による計算は終了となり、このときの(R,L)が、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   Here, the calculation by the power-residue calculating unit 2 ends, and (R, L) at this time is returned from the power-residue calculating unit 2 to the attack invalidation processing unit 1.

ステップS28で、後処理部13が、入力されたdの最下位ビット(LSB)d0が1かどうか調べ、d0が1である場合には、ステップS29に進んで、後処理部13が、上記計算結果LとMを法nで乗算剰余計算(L*M mod n)し、この計算結果で、Lを更新する。この(更新後の)Lが、最終的なべき乗剰余演算結果(M^d mod n)になる。   In step S28, the post-processing unit 13 checks whether or not the least significant bit (LSB) d0 of the input d is 1. If d0 is 1, the process proceeds to step S29, where the post-processing unit 13 The calculation results L and M are subjected to multiplication remainder calculation (L * M mod n) by modulus n, and L is updated with this calculation result. This (updated) L becomes the final power residue calculation result (M ^ d mod n).

一方、d0が0である場合には、ステップS30に進んで、後処理部13が、ダミー処理として、ステップS29と同じ計算(L*M mod n)を行い、その結果は、本来の出力と異なる領域R(他の領域でも構わない。)に保存する。この場合、べき乗剰余計算部2により求められたLが、最終的なべき乗剰余演算結果(M^d mod n)になる。   On the other hand, if d0 is 0, the process proceeds to step S30, and the post-processing unit 13 performs the same calculation (L * M mod n) as step S29 as a dummy process, and the result is the original output. Save in a different area R (other areas may be used). In this case, L obtained by the power-residue calculating unit 2 is the final power-residue calculation result (M ^ d mod n).

ステップS31で、出力部14が、べき乗剰余演算結果L =M^d mod nを出力する。   In step S31, the output unit 14 outputs the power residue calculation result L = M ^ d mod n.

なお、べき乗剰余計算部2と攻撃無効化処理部1との間でLをやり取りする方法としては、Lをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でLを転送しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でLの記憶場所を示すポインタを転送しても良い。なお、Lをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶する場合に、Rもべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良い。   As a method of exchanging L between the power residue calculation unit 2 and the attack invalidation processing unit 1, L is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. Alternatively, L may be transferred between the power-residue calculation unit 2 and the attack invalidation processing unit 1, and the storage location of L may be set between the power-residue calculation unit 2 and the attack invalidation processing unit 1. The indicated pointer may be transferred. When L is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1, R is also stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. You may do it.

また、上記では、攻撃無効化処理部1からべき乗剰余計算部2へ、d=[d(m-1),..,di,..,d1,d0]_2を与えたが、その代わりに、dのうち最下位ビットを除いたd’(d’=[d/2])を与えるようにしても良い(この場合、ステップS22でi=m−1となり、ステップS24でiが負になったら処理ループを抜けるようになれば良い)。   In the above, d = [d (m-1), .., di, .., d1, d0] _2 is given from the attack invalidation processing unit 1 to the power residue calculation unit 2, but instead, , D ′ (d ′ = [d / 2]) excluding the least significant bit may be given (in this case, i = m−1 in step S22 and i becomes negative in step S24). If it becomes, it is good to come out of the processing loop).

次に、右向きバイナリ型算法によるべき乗剰余演算に対する、(−1)入力SPA攻撃と(x,−x)入力SPA攻撃を無効化できるようにした例について説明する。   Next, an example in which the (−1) input SPA attack and the (x, −x) input SPA attack for the power-residue calculation by the rightward binary type algorithm can be invalidated will be described.

図6に、この場合のべき乗剰余演算の演算手順の一例を示す。   FIG. 6 shows an example of the calculation procedure of the power-residue calculation in this case.

まず、ステップS40で、入力部11は、べき乗剰余計算の底であるMと、秘密のべき指数d=[d(m-1),..,di,..,d1,d0]_2と、法nとを入力する。   First, in step S40, the input unit 11 determines that M is the base of the modular exponentiation and the secret power exponent d = [d (m-1), .., di, .., d1, d0] _2, Enter the modulus n.

ステップS41で、前処理部12は、Mを2乗剰余計算(M^2 mod n)し、その計算結果をM’とする。   In step S41, the preprocessing unit 12 performs a square remainder calculation (M ^ 2 mod n) on M, and sets the calculation result as M '.

上記のM’を底、入力されたdをべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Based on the above M ', the input d is a power exponent, and the input n is a modulus, and these are given from the attack invalidation processing unit 1 to the power residue calculation unit 2.

ステップS42で、べき乗剰余計算部2は、参照する指数ビットを表すインデックスiをmにセットし、中間レジスタSに1をセットする。   In step S42, the power-residue calculating unit 2 sets an index i representing an index bit to be referred to m, and sets 1 to the intermediate register S.

以降、ステップS43からステップS48までの処理ループで、べき乗剰余計算部2は、指数ビットd(m−1)からd1までのべき指数に対応したべき乗計算を行う。   Thereafter, in the processing loop from step S43 to step S48, the power-residue calculating unit 2 performs a power calculation corresponding to the exponents from the exponent bits d (m−1) to d1.

ステップS43で、インデックスiをデクリメントし、ステップS44で、iが0より大きいかどうか調べる。   In step S43, the index i is decremented. In step S44, it is checked whether i is larger than zero.

iが0より大きい場合には、ステップS45に進んで、Sを2乗剰余計算(S^2 mod n)し、その計算結果でSを更新した後に、ステップS46で、指数ビットdiが1であるかどうか調べ、diが1ならば、ステップS47に進んで、S←S*M’ mod nの計算を行い、diが0ならば、ステップS48に進んで、ダミー処理として、S’←S*M’ mod nの計算を行う。ここで、S’はダミー処理の結果を保存するレジスタである。そして、ステップS43に戻って、次の処理ループに移る。   If i is larger than 0, the process proceeds to step S45, S is squared remainder calculation (S ^ 2 mod n), S is updated with the calculation result, and then the exponent bit di is 1 in step S46. If di is 1, the process proceeds to step S47 and S ← S * M ′ mod n is calculated. If di is 0, the process proceeds to step S48 and S ′ ← S * M 'mod n is calculated. Here, S ′ is a register for storing the result of dummy processing. And it returns to step S43 and moves to the next processing loop.

以上の処理ループが繰り返された結果、ステップS43でi=0になると、ステップS44で、iが0より大きくないので、この処理ループを抜けて、ステップS49へ分岐することになる。   As a result of the repetition of the above processing loop, if i = 0 in step S43, i is not greater than 0 in step S44, so that the processing loop is exited and the process branches to step S49.

ここで、べき乗剰余計算部2による計算は終了となり、このときのSが、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   Here, the calculation by the power-residue calculating unit 2 ends, and S at this time is returned from the power-residue calculating unit 2 to the attack invalidation processing unit 1.

ステップS49で、後処理部13は、入力されたdの最下位ビット(LSB)d0が1かどうか調べ、d0が1である場合には、ステップS50に進んで、後処理部13は、上記計算結果SとMを法nで乗算剰余計算(S*M mod n)し、この計算結果で、Sを更新する。この(更新後の)Sが、最終的なべき乗剰余演算結果(M^d mod n)になる。   In step S49, the post-processing unit 13 checks whether or not the least significant bit (LSB) d0 of the input d is 1. If d0 is 1, the process proceeds to step S50, where the post-processing unit 13 The calculation results S and M are multiplied by a modulus n (S * M mod n), and S is updated with the calculation results. This (after update) S becomes the final power residue calculation result (M ^ d mod n).

一方、d0が0である場合には、ステップS51に進んで、後処理部13は、ダミー処理として、ステップS50と同じ計算(S*M mod n)を行い、その結果は、本来の出力と異なる領域S’に保存する。この場合、べき乗剰余計算部2により求められたSが、最終的なべき乗剰余演算結果(M^d mod n)になる。   On the other hand, if d0 is 0, the process proceeds to step S51 where the post-processing unit 13 performs the same calculation (S * M mod n) as in step S50 as a dummy process, and the result is the original output. Save in a different area S ′. In this case, S obtained by the power-residue calculation unit 2 becomes the final power-residue calculation result (M ^ d mod n).

ステップS52で、出力部14は、べき乗剰余演算結果S=M^d mod nを出力する。   In step S52, the output unit 14 outputs the power residue calculation result S = M ^ d mod n.

なお、べき乗剰余計算部2と攻撃無効化処理部1との間でSをやり取りする方法としては、Sをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSを転送しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSの記憶場所を示すポインタを転送しても良い。なお、Sをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶する場合に、S’もべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良い。   As a method of exchanging S between the power residue calculation unit 2 and the attack invalidation processing unit 1, S is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. S may be transferred between the power-residue calculation unit 2 and the attack invalidation processing unit 1, and the storage location of S may be set between the power-residue calculation unit 2 and the attack invalidation processing unit 1. The indicated pointer may be transferred. When S is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1, S ′ is also stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. You may remember.

また、上記では、攻撃無効化処理部1からべき乗剰余計算部2へ、d=[d(m-1),..,di,..,d1,d0]_2を与えたが、その代わりに、dのうち最下位ビットを除いたd’(d’=[d/2])を与えるようにしても良い(この場合、ステップS32でi=m−1となり、ステップS34でiが負になったら処理ループを抜けるようになれば良い)。   In the above, d = [d (m-1), .., di, .., d1, d0] _2 is given from the attack invalidation processing unit 1 to the power residue calculation unit 2, but instead, , D ′ (d ′ = [d / 2]) excluding the least significant bit may be given (in this case, i = m−1 in step S32 and i becomes negative in step S34). If it becomes, it is good to come out of the processing loop).

本発明によれば、RSA暗号や楕円曲線暗号に対する選択入力型SPAで脅威となる(n−1)攻撃を無効化することができる。また、本対策による演算手法での処理量の増加はほとんどない。さらに、(n−1)攻撃の拡張として、入力xと−xの1組を与え、それぞれの電力波形の差分を解析して内部状態の差異から秘密指数を推定する攻撃も無効化することができる。   ADVANTAGE OF THE INVENTION According to this invention, the (n-1) attack which becomes a threat can be nullified by the selective input type SPA with respect to RSA encryption or elliptic curve encryption. In addition, there is almost no increase in the amount of processing by the calculation method by this countermeasure. Further, as an extension of the (n-1) attack, a pair of inputs x and -x is given, and the attack that estimates the secret exponent from the difference in the internal state by analyzing the difference between the power waveforms can be invalidated. it can.

(第2の実施形態)
本発明の第2の実施形態に係るべき乗剰余演算装置について説明する。
(Second Embodiment)
A power residue calculation apparatus according to the second embodiment of the present invention will be described.

ここでは、(−1)入力SPAを拡張した攻撃とその対策について説明する。   Here, (-1) an attack that expands the input SPA and countermeasures will be described.

(−1)は乗法に関する単位元である1の平方根(位数2)である。べき乗の右向きバイナリ計算法で、入力をMとし、指数d=[d(m-1),..,dj,..,d1,d0]_2の最上位からdjまでを処理した中間値をSjとする。Dj=[d(m-1),…,dj]_2とおくと、Sj=M^Dj mod nである。従って、Mとして位数2の値である(−1)を入力すると、Djの最下位ビットであるdjの0/1に依存して、Sj=1(dj=0のとき)、Sj=−1(dj=1のとき)となる。この後、指数d(j−1)ビットの処理に移り、最初にSj^2 mod nの計算が行われ、この処理がdjの値に依存した2通りしかないことが、攻撃に利用されている。   (-1) is a square root of 1 (order 2) which is a unit element related to multiplication. Sj is an intermediate value obtained by processing powers from the top to dj of exponent d = [d (m−1),..., Dj,. And If Dj = [d (m−1),..., Dj] _2, Sj = M ^ Dj mod n. Therefore, when (-1) which is a value of order 2 is input as M, Sj = 1 (when dj = 0), Sj = −, depending on 0/1 of dj which is the least significant bit of Dj. 1 (when dj = 1). Thereafter, the process moves to exponent d (j-1) bit processing, Sj ^ 2 mod n is calculated first, and there are only two types of processing depending on the value of dj. Yes.

この原理を拡張すると、位数2^t(tは1以上の整数)の元を入力とする攻撃が考えられる。位数2^tの元は、乗法群の位数λ(元の個数)に依存して存在する場合と存在しない場合とがある。実際に、λ mod 2^tが0となる場合には、位数2^tの元が存在し、λが判明している場合には、多項式時間のアルゴリズムで求めることができる。   If this principle is expanded, an attack with an element of order 2 ^ t (t is an integer of 1 or more) as an input can be considered. The element of order 2 ^ t may or may not exist depending on the order λ (number of elements) of the multiplicative group. Actually, when λ mod 2 ^ t is 0, there is an element of order 2 ^ t, and when λ is known, it can be obtained by a polynomial time algorithm.

例えば、位数2^2=4の元αをべき乗の右向きバイナリ計算法に入力すると、指数dの最上位からdjビットまでを処理した中間値Sj(=M^Dj mod n)は、Dj mod (2^2)の値(すなわち、d(j+1)とdjの2ビット)に依存して決まる。すなわち、
[d(j+1),dj]=[0,0]のとき、Sj=1、
[d(j+1),dj]=[0,1]のとき、Sj=α、
[d(j+1),dj]=[1,0]のとき、Sj=α^2=−1、
[d(j+1),dj]=[1,1]のとき、Sj=α^3=−α
となる。
For example, when an element α of order 2 ^ 2 = 4 is input to a power-right binary calculation method, an intermediate value Sj (= M ^ Dj mod n) obtained by processing from the most significant digit of the exponent d to dj bits is expressed as Dj mod It depends on the value of (2 ^ 2) (that is, 2 bits of d (j + 1) and dj). That is,
When [d (j + 1), dj] = [0, 0], Sj = 1,
When [d (j + 1), dj] = [0, 1], Sj = α,
When [d (j + 1), dj] = [1, 0], Sj = α ^ 2 = −1,
When [d (j + 1), dj] = [1, 1], Sj = α ^ 3 = −α
It becomes.

次に、隣のd(j−1)ビットの処理に移り、最初の2乗処理では、
[d(j+1),dj]=[0,0]の場合には、1^2 mod n=1の計算が行われ、
[d(j+1),dj]=[0,1]の場合には、α^2 mod n=-1の計算が行われ、
[d(j+1),dj]=[1,0]の場合には、(-1)^2 mod n=1の計算が行われ、
[d(j+1),dj]=[1,1]の場合には、(-α)^2=-1の計算が行われる。
Next, it moves to the processing of the adjacent d (j−1) bits, and in the first squaring process,
In the case of [d (j + 1), dj] = [0, 0], 1 ^ 2 mod n = 1 is calculated,
When [d (j + 1), dj] = [0, 1], α ^ 2 mod n = −1 is calculated,
When [d (j + 1), dj] = [1, 0], calculation of (−1) ^ 2 mod n = 1 is performed.
When [d (j + 1), dj] = [1, 1], the calculation of (−α) ^ 2 = −1 is performed.

また、その次の乗算では、
[d(j+1),dj]=[0,0]の場合には、1×α mod nの計算が行われ、
[d(j+1),dj]=[1,0]の場合には、1×α mod nの計算が行われ、
[d(j+1),dj]=[0,1]の場合には、(-1)×α mod nの計算が行われ、
[d(j+1),dj]=[1,1]の場合には、(-1)×α mod nの計算が行われる。
In the next multiplication,
When [d (j + 1), dj] = [0, 0], 1 × α mod n is calculated,
In the case of [d (j + 1), dj] = [1, 0], 1 × α mod n is calculated,
In the case of [d (j + 1), dj] = [0, 1], (−1) × α mod n is calculated,
When [d (j + 1), dj] = [1, 1], calculation of (−1) × α mod n is performed.

このように、2乗処理部では4通り、乗算処理部では2通りの計算しか現れず、これらの計算は、指数ビット[d(j+1),dj]の2ビットに依存して、パターンが分かれることから、SPAによって攻撃が容易となる可能性が高い。   Thus, only four types of calculations appear in the square processing unit and two types of calculation appear in the multiplication processing unit, and these calculations depend on two bits of the exponent bits [d (j + 1), dj], Therefore, there is a high possibility that an attack will be facilitated by SPA.

この位数4の元αを利用したSPAは、wビットウィンドウ法(例えば、2ビットウィンドウ法)によるべき乗計算にも適用することができる。2ビットウィンドウ法で指数のdjビットまで処理した中間結果をSjとすると、Sjの値も指数[d(j+1),dj]の2ビットに依存して、上記と同じ値となる。この後、指数d(j−1)とd(j−2)の2ビットの処理に移り、最初の2乗処理は、上記と同じ分岐となる。   The SPA using the element α of order 4 can be applied to a power calculation by a w-bit window method (for example, a 2-bit window method). Assuming that an intermediate result obtained by processing up to the dj bits of the exponent by the 2-bit window method is Sj, the value of Sj also becomes the same value as described above depending on the two bits of the exponent [d (j + 1), dj]. Thereafter, the process proceeds to 2-bit processing of exponents d (j-1) and d (j-2), and the first squaring processing is the same branch as described above.

それに続く2乗処理では、
[d(j+1),dj]=[0,0]の場合には、1^2 mod nの計算が行われ、
[d(j+1),dj]=[1,0]の場合には、1^2 mod nの計算が行われ、
[d(j+1),dj]=[0,1]の場合には、(-1)^2 mod nの計算が行われ、
[d(j+1),dj]=[1,1]の場合には、(-1)^2 mod nの計算が行われる。
In the subsequent square process,
In the case of [d (j + 1), dj] = [0, 0], 1 ^ 2 mod n is calculated,
In the case of [d (j + 1), dj] = [1, 0], 1 ^ 2 mod n is calculated,
In the case of [d (j + 1), dj] = [0, 1], (−1) ^ 2 mod n is calculated,
When [d (j + 1), dj] = [1, 1], calculation of (−1) ^ 2 mod n is performed.

この後、指数[d(j−1),d(j−2)]の値に依存して、
[0,0]の場合には、1×1の計算が行われ、
[0,1]の場合には、1×αの計算が行われ、
[1,0]の場合には、1×(−1)の計算が行われ、
[1,1]の場合には、1×(−α)の計算が行われる。
After this, depending on the value of the exponent [d (j-1), d (j-2)],
In the case of [0,0], a 1 × 1 calculation is performed,
In the case of [0, 1], 1 × α is calculated,
In the case of [1, 0], 1 × (−1) calculation is performed,
In the case of [1, 1], 1 × (−α) is calculated.

このように、2回連続する2乗処理において、最初の2乗処理では4通り、次の2乗処理では2通りの処理が、[d(j+1),dj]の値に依存して行われる。また、乗算処理では、4通りの処理が[d(j−1),d(j−2)]の値に依存して行われる。   As described above, in the square process that is performed twice, four processes are performed in the first square process and two processes are performed in the next square process, depending on the value of [d (j + 1), dj]. . In the multiplication process, four processes are performed depending on the value of [d (j−1), d (j−2)].

同様の攻撃は、位数2^tの元を入力とした場合にも適用できる。   A similar attack can be applied to the case where the element of order 2 ^ t is used as an input.

以下、位数2^tの元を入力とするSPAを無効化できるようにした例について説明する。   Hereinafter, an example will be described in which SPA that uses an element of order 2 ^ t as an input can be invalidated.

図7に、この場合のべき乗剰余演算の演算手順の一例を示す。   FIG. 7 shows an example of the calculation procedure of the power-residue calculation in this case.

まず、ステップS60で、入力部11は、べき乗剰余計算の底であるMと、秘密のべき指数d=[d(m-1),..,di,..,d1,d0]_2と、法nとを入力する。   First, in step S60, the input unit 11 determines that M is a base of power-residue calculation and a secret power exponent d = [d (m−1), .., di, .., d1, d0] _2, Enter the modulus n.

ステップS61で、前処理部12は、Mに対して2乗剰余計算をt回繰り返し(M^(2^t) mod n)、その結果をM’とする。   In step S61, the preprocessing unit 12 repeats the square remainder calculation with respect to M t times (M ^ (2 ^ t) mod n), and sets the result as M '.

次に、上記のM’を底、入力されたdのうち最下位ビットからtビット分を除いた値(最上位ビットから最下位から(t+1)ビット目までの部分)d’(d’=[d/(2^t)]=[d(m-1),..,dt])をべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Next, the value obtained by subtracting t bits from the least significant bit of the input d (the portion from the most significant bit to the (t + 1) th bit from the least significant bit) d ′ (d ′ = [d / (2 ^ t)] = [d (m-1), .., dt]) is a power exponent and the input n is used as a modulus to calculate the exponentiation remainder calculation unit 2 from the attack invalidation processing unit 1 Given to.

ステップS62で、べき乗剰余計算部2は、それらをもとに、(右向き型の)べき乗剰余計算(M’^d’ mod n)を行い、その計算結果S1を求める。   In step S62, the power-residue calculating unit 2 performs (right-facing) power-residue calculation (M ′ ^ d ′ mod n) based on them, and obtains the calculation result S1.

このS1は、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   This S1 is returned from the exponentiation remainder calculation unit 2 to the attack invalidation processing unit 1.

ステップS63で、後処理部13は、入力されたMを底、入力されたdのうちLSBからtビット分を取り出した値(tビット目から最下位ビット目までの部分)dL=[d(t-1),…,d0]をべき指数、入力されたnを法として、べき乗剰余計算(M^dL mod n)を行い、その計算結果S2を求める。なお、このステップS63のべき乗剰余計算は、右向き型でも左向き型でも任意のべき乗計算法を利用することができる。   In step S63, the post-processing unit 13 bases the inputted M and takes the t bits from the LSB out of the inputted d (the portion from the t-th bit to the least significant bit) dL = [d ( t-1),..., d0] are exponents and the input n is a modulus to perform power-residue calculation (M ^ dL mod n) and obtain the calculation result S2. The power-residue calculation in step S63 can use any power calculation method for both the right-facing type and the left-facing type.

なお、ステップS63のべき乗剰余計算は、べき乗剰余計算部2に実行させても良い。この場合、まず、入力されたMを底、入力されたdのうちLSBからtビット分を取り出した値dL=[d(t-1),…,d0]をべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。そして、べき乗剰余計算部2は、それらをもとに、べき乗剰余計算(M^dL mod n)を行い、その計算結果S2を求める。このS2は、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   The power residue calculation in step S63 may be executed by the power residue calculation unit 2. In this case, first, the input M is the base, the value dL = [d (t−1),..., D0] obtained by extracting t bits from the LSB out of the input d is the exponent, and the input n is As a method, they are given from the attack invalidation processing unit 1 to the power residue calculation unit 2. The power-residue calculating unit 2 performs power-residue calculation (M ^ dL mod n) based on them, and obtains the calculation result S2. This S2 is returned from the exponentiation remainder calculation unit 2 to the attack invalidation processing unit 1.

ステップS64で、後処理部13は、S1とS2の2つの値を剰余乗算(S←S1×S2 mod n)して、最終結果Sを求める。   In step S64, the post-processing unit 13 obtains a final result S by performing a modular multiplication (S ← S1 × S2 mod n) on the two values S1 and S2.

ステップS65で、出力部14は、べき乗剰余演算結果S=M^d mod nを出力する。   In step S65, the output unit 14 outputs the power residue calculation result S = M ^ d mod n.

ここで、上記計算の正当性は、d=d’*(2^t)+dLと分解し、
S=M^d
=M^(d’*(2^t)+dL)
={(M^(2^t))^d’}×(M^dL)
=(M’^d’)×(M^dL) mod n
であることから確認できる。
Here, the validity of the above calculation is decomposed into d = d '* (2 ^ t) + dL,
S = M ^ d
= M ^ (d '* (2 ^ t) + dL)
= {(M ^ (2 ^ t)) ^ d '} × (M ^ dL)
= (M '^ d') × (M ^ dL) mod n
This can be confirmed.

この計算手順では、ステップS61での処理により、位数2^t’(t’≦t)なる入力に対してM’=1となることから、このような入力を与えたとしても、ステップS62の右向きべき乗計算では、処理の分岐は起こらない。このことから、位数2^t’なる入力を利用したSPAを無効化することができる。   In this calculation procedure, M ′ = 1 with respect to an input of order 2 ^ t ′ (t ′ ≦ t) by the processing in step S61. Even if such an input is given, step S62 is performed. In the right power calculation of, no processing branch occurs. From this, it is possible to invalidate SPA using an input of order 2 ^ t '.

なお、上記のステップS62のべき乗剰余計算とステップS63のべき乗剰余計算とは、上記とは逆の順番で実行しても構わない。   The power residue calculation in step S62 and the power residue calculation in step S63 may be performed in the reverse order.

また、ステップS62,S63のべき乗剰余計算をいずれもべき乗剰余計算部2に実行させる代わりに、例えば図8のようにべき乗剰余計算部2の他にべき乗剰余計算部3を備え、ステップS62のべき乗剰余計算をべき乗剰余計算部2に実行させ、ステップS63のべき乗剰余計算をべき乗剰余計算部3に実行させるようにしても良い。この場合に、ステップS62のべき乗剰余計算とステップS63のべき乗剰余計算とを同時に実行するようにしても良い。   Further, instead of causing the power residue calculation unit 2 to execute both the power residue calculation in steps S62 and S63, for example, the power residue calculation unit 3 is provided in addition to the power residue calculation unit 2 as shown in FIG. It is also possible to cause the power residue calculation unit 2 to execute the remainder calculation and to cause the power residue calculation unit 3 to execute the power residue calculation in step S63. In this case, the power residue calculation in step S62 and the power residue calculation in step S63 may be executed simultaneously.

また、ステップS62のべき乗剰余計算に必要な(M’,d’,n)と、ステップS63のべき乗剰余計算に必要な(M,dL,n)とは、攻撃無効化処理部1からべき乗剰余計算部2へ順次与えても良いし、同時に与えても良い。   Further, (M ′, d ′, n) required for the power residue calculation in step S62 and (M, dL, n) required for the power residue calculation in step S63 are the power residue from the attack invalidation processing unit 1. You may give to the calculation part 2 sequentially, and may give simultaneously.

また、ステップS62のべき乗剰余計算の結果S1と、ステップS63のべき乗剰余計算の結果S2とは、べき乗剰余計算部2から攻撃無効化処理部1へ順次与えても良いし、同時に与えても良い。   The power residue calculation result S1 in step S62 and the power residue calculation result S2 in step S63 may be sequentially given from the power remainder calculation unit 2 to the attack invalidation processing unit 1 or may be given simultaneously. .

また、べき乗剰余計算部2と攻撃無効化処理部1との間でS1,S2をやり取りする方法としては、S1,S2をべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でS1,S2を転送しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でS1,S2の記憶場所を示すポインタを転送しても良い。   As a method for exchanging S1 and S2 between the power residue calculation unit 2 and the attack invalidation processing unit 1, a storage area in which S1 and S2 are shared by the power residue calculation unit 2 and the attack invalidation processing unit 1 Or S1 and S2 may be transferred between the power-residue calculation unit 2 and the attack invalidation processing unit 1, or between the power-residue calculation unit 2 and the attack invalidation processing unit 1. The pointer indicating the storage location of S1 and S2 may be transferred.

なお、本実施形態は、右向き型のバイナリ法にもモンゴメリ・ラダー法にも適用可能である。   Note that this embodiment can be applied to the right-pointing binary method and the Montgomery ladder method.

本発明によれば、(n−1)の高次の根(位数2^tの元)を入力として利用する攻撃も無効化することができる。   According to the present invention, it is also possible to invalidate an attack that uses a higher-order root of (n−1) (element of order 2 ^ t) as an input.

(第3の実施形態)
本発明の第3の実施形態に係るべき乗剰余演算装置について説明する。
(Third embodiment)
A modular exponentiation apparatus according to the third embodiment of the present invention will be described.

ここで、対象とする選択入力型SPAは、(−1)入力と(x,−x)入力の2つの攻撃である。本対策演算は、入力集合を、正の数のグループGpと、負の数のグループGnとに等分して扱うことを、ポイントとする。入力xと−xは、一方がGpに属し、他方がGnに属する。また、(−1)はGnに属し、1はGpに属する。   Here, the target selective input SPA is two attacks of (−1) input and (x, −x) input. The point of this countermeasure operation is that the input set is equally divided into a positive group Gp and a negative group Gn. One of the inputs x and -x belongs to Gp, and the other belongs to Gn. Further, (-1) belongs to Gn, and 1 belongs to Gp.

このように入力集合を分け、Gpに属する入力に対しては、通常通りに、べき乗剰余計算を行い、Gnに属する入力(−y)に対しては、符号を反転してGpに属するyを求めた上で、yに対してべき乗計算を行い、最後に、べき指数の奇数/偶数に応じて、符号の反転処理を行うか(奇数の場合)、あるいは、符号の反転処理を行わない(偶数の場合)。   In this way, the input set is divided, and for the input belonging to Gp, the power-residue calculation is performed as usual. After obtaining, a power calculation is performed on y, and finally, the sign inversion process is performed according to the odd / even power exponent (in the case of an odd number) or the sign inversion process is not performed ( If even).

すなわち、
S=y^d
={(-1)*(-y)}^d
=(-1)^d×(-y)^d mod n
となる性質を利用する。
That is,
S = y ^ d
= {(-1) * (-y)} ^ d
= (-1) ^ d × (-y) ^ d mod n
Take advantage of the property.

このとき、(x,−x)入力SPAは、いずれの入力を与えてもべき乗部分は全く同じ計算が行われるために、無効化される。また、(−1)入力SPAも、符号反転されて1に対するべき乗が行われるために、特徴的な中間データの分岐が現れず、無効化される。   At this time, the (x, −x) input SPA is invalidated because the same calculation is performed on the power part regardless of which input is given. Further, (-1) the input SPA is also inverted because the sign is inverted and a power of 1 is performed, so that a characteristic branch of intermediate data does not appear and is invalidated.

図9に、この場合のべき乗剰余演算の演算手順の一例を示す。   FIG. 9 shows an example of the calculation procedure of the power-residue calculation in this case.

まず、ステップS70で、入力部11は、べき乗剰余計算の底であるMと、秘密のべき指数d=[d(m-1),..,di,..,d1,d0]_2と、法nとを入力する。   First, in step S70, the input unit 11 sets M, which is the base of power-residue calculation, and a secret power exponent d = [d (m-1), .., di, .., d1, d0] _2, Enter the modulus n.

ステップS71で、前処理部12は、入力Mに対する符号ビットsgnを求める。   In step S <b> 71, the preprocessing unit 12 calculates a sign bit sgn for the input M.

ここで、sgn=1ならば、入力Mは負の数のグループGnに属し、sgn=0ならば、Mは正の数のグループGpに属することを表すものとする。   Here, if sgn = 1, the input M belongs to a negative number group Gn, and if sgn = 0, it means that M belongs to a positive number group Gp.

符号ビットの具体的な計算法としては、例えば次の2種類がある。   For example, the following two types of code bit calculation methods are available.

第1の方法は、Gp={0,1,2,...,(n-1)/2}、Gn={(n+1)/2,(n+3)/2,…,n-2,n-1}とし、入力Mと(n−1)/2との大小を比較するものである。M>(n−1)/2ならば、sgn=1、そうでなければ、sgn=0とする。   The first method is Gp = {0,1,2, ..., (n-1) / 2}, Gn = {(n + 1) / 2, (n + 3) / 2, ..., n −2, n−1}, and the magnitude of the input M and (n−1) / 2 are compared. If M> (n-1) / 2, sgn = 1, otherwise sgn = 0.

第2の方法は、Gp={x|x=0もしくはxのLSB=1}、Gn={x|x≠0かつxのLSB=0}と分けるものである。このグループ区分は、x=0を除いて、xと−xの両方のLSBが0もしくは1に揃うことはなく、(n−1)のLSB=0である性質を利用している。この方法では、x=0の場合を除いて入力xのLSBを反転した値を符号sgnとする。   In the second method, Gp = {x | x = 0 or LSB of x = 1}, Gn = {x | x ≠ 0 and LSB of x = 0}. This group division uses the property that the LSBs of both x and −x are not equal to 0 or 1, except for x = 0, and LSB = 0 of (n−1). In this method, except for the case of x = 0, a value obtained by inverting the LSB of the input x is set as a code sgn.

ステップS72で、前処理部12は、上記で求められた符号sgn=1ならば、ステップS73に進んで、入力Mの符号を反転したM’の計算(M’←-M mod n)を行う。   In step S72, if the code sgn = 1 obtained above, the preprocessing unit 12 proceeds to step S73 and calculates M ′ (M ′ ← −M mod n) by inverting the sign of the input M. .

そして、上記のM’を底、入力されたdをべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Then, they are given from the attack invalidation processing unit 1 to the power-residue calculating unit 2 with the above M ′ as the base, the input d as the exponent, and the input n as the modulus.

ステップS74で、べき乗剰余計算部2は、それらをもとに、べき乗剰余計算(M’^d mod n)を行い、その計算結果Sを求める。   In step S74, the power-residue calculating unit 2 performs power-residue calculation (M ′ ^ d mod n) based on them, and obtains the calculation result S.

このSは、べき乗剰余計算部2から攻撃無効化処理部1へ返される。   This S is returned from the exponentiation remainder calculation unit 2 to the attack invalidation processing unit 1.

ステップS75で、後処理部13は、符号ビットの処理として(−1)^dを求めて上記Sに掛ける計算((-1)^d×S mod n)を行い、この計算結果で、Sを更新する。この(更新後の)Sが、最終的なべき乗剰余演算結果(M^d mod n)になる。   In step S75, the post-processing unit 13 obtains (−1) ^ d as the processing of the sign bit and performs a calculation ((−1) ^ d × S mod n) by multiplying the above S by the calculation result. Update. This (after update) S becomes the final power residue calculation result (M ^ d mod n).

一方、ステップS72で、上記で求められた符号sgn=0ならば、前処理部12はM’の計算は行わない。   On the other hand, if the code sgn = 0 obtained above in step S72, the preprocessing unit 12 does not calculate M '.

そして、入力されたMを底、入力されたdをべき指数、入力されたnを法として、それらが攻撃無効化処理部1からべき乗剰余計算部2へ与えられる。   Then, they are given from the attack invalidation processing unit 1 to the power residue calculation unit 2 with the input M as the base, the input d as the exponent, and the input n as the modulus.

ステップS76で、べき乗剰余計算部2は、それらをもとに、べき乗剰余計算(M^d mod n)を行い、その計算結果Sを求める。このSが、最終的なべき乗剰余演算結果(M^d mod n)になる。なお、符号sgn=0の場合、後処理部13は、Sの更新演算は行わない。   In step S76, the power-residue calculating unit 2 performs a power-residue calculation (M ^ d mod n) based on them, and obtains the calculation result S. This S becomes the final power residue calculation result (M ^ d mod n). When the code sgn = 0, the post-processing unit 13 does not perform the S update calculation.

ステップ77で、出力部14は、べき乗剰余演算結果S=M^d mod nを出力する。   In step 77, the output unit 14 outputs the power residue calculation result S = M ^ d mod n.

なお、ステップS73は、M’=n−Mの減算で計算でき、ステップS75は、先に説明したようにdが奇数の場合には、S=n−Sの減算を行い、そうでない場合には、何もせずにSを出力すればよい。   Step S73 can be calculated by subtraction of M ′ = n−M, and step S75 performs S = n−S subtraction when d is an odd number as described above, and otherwise. May output S without doing anything.

また、べき乗剰余計算部2と攻撃無効化処理部1との間でSをやり取りする方法としては、Sをべき乗剰余計算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSを転送しても良いし、べき乗剰余計算部2と攻撃無効化処理部1との間でSの記憶場所を示すポインタを転送しても良い。   As a method of exchanging S between the power residue calculation unit 2 and the attack invalidation processing unit 1, S is stored in a storage area shared by the power residue calculation unit 2 and the attack invalidation processing unit 1. S may be transferred between the power-residue calculation unit 2 and the attack invalidation processing unit 1, and the storage location of S may be set between the power-residue calculation unit 2 and the attack invalidation processing unit 1. The indicated pointer may be transferred.

なお、本実施形態は、右向き型のバイナリ法にもモンゴメリ・ラダー法にも適用可能である。   Note that this embodiment can be applied to the right-pointing binary method and the Montgomery ladder method.

以上、第1〜第3の実施形態では、法nでのべき乗剰余計算を対象として計算方法を説明したが、法nが複数の素数の積である場合には、nを互いに素な因子に分解し、そのぞれの因子をモジュラスとしたべき乗剰余計算を行い、最後に複数の因子でのべき乗剰余計算結果を中国剰余定理により合成する演算が利用される場合が多い。この場合に、個々の因子でのべき乗剰余計算に各実施形態の計算手法を適用することができる。   As described above, in the first to third embodiments, the calculation method has been described for the power-residue calculation in the modulus n. However, when the modulus n is a product of a plurality of prime numbers, n is a relatively prime factor. In many cases, an operation is performed in which a power residue calculation is performed with each factor as a modulus, and a power residue calculation result with a plurality of factors is combined by a Chinese remainder theorem. In this case, the calculation method of each embodiment can be applied to the modular exponentiation calculation with individual factors.

例えば、RSA暗号における中国剰余定理を利用した復号演算に対する選択入力型SPAの対策計算法として、これらの算法を利用することができる。   For example, these arithmetic methods can be used as a countermeasure calculation method of the selective input SPA for a decryption operation using the Chinese remainder theorem in RSA cryptography.

この場合、例えば、第1、第2又は第3の実施形態の乗剰余演算装置において、(法nが互いに素な複数の素数の積である場合に)法nを互いに素な因子に分解し、個々の因子を法として前記前処理部、前記暗号用演算部及び前記後処理部を用いてそれぞれ前記最終的な演算結果を求め、求めた複数の前記最終的な演算結果を中国剰余定理で合成する処理部を設ければ良い。   In this case, for example, in the modular multiplication unit of the first, second, or third embodiment, the modulus n is decomposed into relatively prime factors (when the modulus n is a product of a plurality of prime numbers that are relatively prime). , Using the pre-processing unit, the cryptographic operation unit, and the post-processing unit as the modulo of each factor, respectively, to determine the final calculation result, and the obtained plurality of final calculation results by the Chinese remainder theorem What is necessary is just to provide the process part to synthesize | combine.

<楕円曲線上でのスカラー倍算>
さて、ここに示した計算アルゴリズムは、楕円曲線上でのスカラー倍算にも適用できるものが多い。具体的には、第1、第2の実施形態として示した手法は、次のように利用すれば、楕円曲線上のスカラー倍算における選択入力型SPAに対して効果がある。
<Scalar multiplication on elliptic curve>
Many of the calculation algorithms shown here can also be applied to scalar multiplication on an elliptic curve. Specifically, the methods shown as the first and second embodiments are effective for the selective input SPA in scalar multiplication on an elliptic curve when used as follows.

まず、(RSA暗号のような)有限体上のべき乗算M^d mod pと楕円曲線上のスカラー倍算dP(over E/Fq)とは、次のように対応している。すなわち、有限体(Z/pZ)上の乗法(a*b mod p)は、楕円曲線(E/Fq)上の加法(A+B over E/Fq)に対応し、有限体上の元のd乗は、楕円曲線上の元のd倍に対応する。   First, power multiplication M ^ d mod p on a finite field (such as RSA cipher) and scalar multiplication dP (over E / Fq) on an elliptic curve correspond as follows. That is, the multiplication (a * b mod p) on the finite field (Z / pZ) corresponds to the addition (A + B over E / Fq) on the elliptic curve (E / Fq), and the original on the finite field The d-th power corresponds to the original d times on the elliptic curve.

第1の実施形態で考慮した攻撃は、有限体Fq上の楕円曲線の元が構成する有限可換群E(Fq)における位数2の元P_2を入力とする攻撃と、元Yと元P_2+Yの2点を入力する攻撃に相当する。   The attack considered in the first embodiment is an attack that uses as input an element P_2 of order 2 in the finite commutative group E (Fq) formed by elements of the elliptic curve on the finite field Fq, and an element Y and an element P_2 + Y. This is equivalent to an attack that inputs two points.

同様に、第2の実施形態で考慮した攻撃は、位数2^t(t>1)の元P_{2^t}を入力とする攻撃に相当する。   Similarly, the attack considered in the second embodiment corresponds to an attack that uses an element P_ {2 ^ t} of order 2 ^ t (t> 1) as an input.

楕円曲線上での位数2の元P_2は、2*P_2=O(Oは無限遠点を表す)であり、位数2^tの元P_{2^t}は、(2^t)*P_{2^t}=Oとなる元である。   The element P_2 of order 2 on the elliptic curve is 2 * P_2 = O (O represents the point at infinity), and the element P_ {2 ^ t} of order 2 ^ t is (2 ^ t) * P_ {2 ^ t} = O.

位数2の元P_2を右向きスカラー倍算の入力点とすると、点2倍算の処理は、2*P_2(=O)か2*O(=O)のどちらかの処理が、スカラー値のビットパターンに応じて繰り返される。位数2^tの元を入力点とした場合にも、点2倍算の処理が2^t通りに限定され、それらがスカラー値の連続するtビットの中間ビットパターンに依存して行われることから、SPAでのスカラー値の判別が容易となる。   Assuming that the element P_2 of order 2 is an input point for scalar multiplication to the right, the point doubling process is performed by either 2 * P_2 (= O) or 2 * O (= O). Repeated according to the bit pattern. Even when the element of order 2 ^ t is used as an input point, the point doubling process is limited to 2 ^ t, and they are performed depending on the t-bit intermediate bit pattern of continuous scalar values. Therefore, it is easy to determine the scalar value in SPA.

また、Yを任意の点として、点(P_2+Y)を入力としてスカラー倍算を行った場合、2倍算の処理では、2*(kY)(=(2k)*Y)もしくは2*(kY+P_2)(=(2k)*Y)のどちらかが行われる。ここで、前者の計算が行われるのは、kが偶数のときであり、後者の計算が行われるのは、kが奇数のときとなる。右向き計算法の性質から、kは、それまでに処理したスカラー値のMSBから中間ビットまでの値に相当することから、スカラー値の中間ビットの0/1に対応して、上記の2通りの計算が行われる。   Further, when scalar multiplication is performed using Y as an arbitrary point and a point (P_2 + Y) as an input, 2 * (kY) (= (2k) * Y) or 2 * (kY + P_2) in the doubling process Either (= (2k) * Y) is performed. Here, the former calculation is performed when k is an even number, and the latter calculation is performed when k is an odd number. Since k corresponds to the value from the MSB to the intermediate bit of the scalar value processed so far due to the nature of the rightward calculation method, the above two types correspond to 0/1 of the intermediate bit of the scalar value. Calculation is performed.

さらに、同じスカラー倍算においてYを入力した場合には、2倍算において2*(kY)の計算が行われることに着目すれば、点Yと点(Y+P_2)とを入力した場合の電力波形の差分に着目すれば、スカラー値が推定できることが分る。   Further, if Y is input in the same scalar multiplication, it is noted that calculation of 2 * (kY) is performed in doubling, and the power waveform when point Y and point (Y + P_2) are input. From this difference, it can be seen that the scalar value can be estimated.

以下、暗号用演算として楕円曲線上でのスカラー倍算が用いられた場合の暗号用演算装置の構成例について説明する。   Hereinafter, a configuration example of the cryptographic operation device when scalar multiplication on an elliptic curve is used as the cryptographic calculation will be described.

図10に、図1を「楕円曲線上のスカラー倍算」用に記述した構成例を示す。   FIG. 10 shows a configuration example in which FIG. 1 is described for “scalar multiplication on an elliptic curve”.

第4,5の実施形態では、暗号用演算装置は「(楕円曲線上の)スカラー倍算装置」、暗号用演算部は「(楕円曲線上の)スカラー倍算部」と呼ぶ。   In the fourth and fifth embodiments, the cryptographic operation device is referred to as “scalar multiplication device (on elliptic curve)”, and the cryptographic operation unit is referred to as “scalar multiplication unit (on elliptic curve)”.

(第4の実施形態)
最初に、第1の実施形態を楕円曲線暗号でのスカラー倍算に適用して攻撃を無効化できるようにした例について説明する。
(Fourth embodiment)
First, an example in which an attack can be invalidated by applying the first embodiment to scalar multiplication in elliptic curve cryptography will be described.

図11に、この場合の楕円曲線上でのスカラー倍算の演算手順の一例を示す。   FIG. 11 shows an example of a procedure for scalar multiplication on the elliptic curve in this case.

この手順により、位数2の元P_2入力SPAと(Y,P_2+Y)の2点入力SPAを無効化することができる。   By this procedure, the original P_2 input SPA of order 2 and the 2-point input SPA of (Y, P_2 + Y) can be invalidated.

まず、ステップS80で、入力部11は、スカラー倍算の対象である点Pと、秘密のスカラー値d=[d(m-1),..,di,..,d1,d0]_2と、楕円曲線のドメインパラメータEとを入力する。   First, in step S80, the input unit 11 sets a point P to be subjected to scalar multiplication and a secret scalar value d = [d (m-1), .., di, .., d1, d0] _2. The domain parameter E of the elliptic curve is input.

ここで、楕円曲線のドメインパラメータとは、楕円曲線の定義体や楕円曲線の係数、楕円曲線の位数やベースポイントなど、スカラー倍算を定義する楕円曲線のパラメータ群を指す。   Here, the domain parameter of the elliptic curve refers to a parameter group of the elliptic curve that defines the scalar multiplication, such as the elliptic curve definition body, the coefficient of the elliptic curve, the order of the elliptic curve, and the base point.

ステップS81で、前処理部12は、Pを2倍し(2*P)、その計算結果をP’とする。   In step S81, the preprocessing unit 12 doubles P (2 * P), and sets the calculation result as P ′.

上記のP’をスカラー倍算の対象である点、入力されたdのうち最下位ビットを除いたd’(d’=[d/2])をスカラー値、入力されたEを楕円曲線のドメインパラメータとして、それらが攻撃無効化処理部1からスカラー倍算部2へ与えられる。   The above P ′ is the target of scalar multiplication, d ′ (d ′ = [d / 2]) excluding the least significant bit of the input d is the scalar value, and the input E is the elliptic curve As domain parameters, they are given from the attack invalidation processing unit 1 to the scalar multiplication unit 2.

ステップS82で、スカラー倍算部2は、それらをもとに、(右向き型の)スカラー倍算(d’*P’)を行い、その計算結果Qを求める。   In step S82, the scalar multiplication unit 2 performs (right-facing) scalar multiplication (d '* P') based on them, and obtains the calculation result Q.

このQは、スカラー倍算部2から攻撃無効化処理部1へ返される。   This Q is returned from the scalar multiplication unit 2 to the attack invalidation processing unit 1.

ステップS83で、後処理部13は、入力されたdの最下位ビット(LSB)d0が1かどうか調べ、d0が1である場合には、ステップS84に進んで、後処理部13は、上記計算結果QとPを点加算(Q+P)し、この計算結果で、Qを更新する。この(更新後の)Qが、最終的なスカラー倍算結果(d*P)になる。   In step S83, the post-processing unit 13 checks whether or not the least significant bit (LSB) d0 of the input d is 1. If d0 is 1, the process proceeds to step S84, where the post-processing unit 13 Point addition (Q + P) is made between the calculation results Q and P, and Q is updated with this calculation result. This (updated) Q is the final scalar multiplication result (d * P).

一方、d0が0である場合には、ステップS85に進んで、後処理部13は、ダミー処理として、ステップS84と同じ計算(Q+P)を行い、その結果は、本来の出力と異なる領域Q’に保存する。この場合、スカラー倍算部2により求められたQが、最終的なべき乗剰余演算結果(d*P)になる。   On the other hand, when d0 is 0, the process proceeds to step S85, and the post-processing unit 13 performs the same calculation (Q + P) as step S84 as a dummy process, and the result is an area different from the original output. Save to Q '. In this case, Q obtained by the scalar multiplication unit 2 becomes the final power residue calculation result (d * P).

ステップS86で、出力部14は、スカラー倍算結果Q= d*P を出力する。   In step S86, the output unit 14 outputs the scalar multiplication result Q = d * P.

なお、スカラー倍算部2と攻撃無効化処理部1との間でQをやり取りする方法としては、Qをスカラー倍算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、スカラー倍算部2と攻撃無効化処理部1との間でQを転送しても良いし、スカラー倍算部2と攻撃無効化処理部1との間でQの記憶場所を示すポインタを転送しても良い。   As a method of exchanging Q between the scalar multiplication unit 2 and the attack invalidation processing unit 1, Q is stored in a storage area shared by the scalar multiplication unit 2 and the attack invalidation processing unit 1. Alternatively, Q may be transferred between the scalar multiplication unit 2 and the attack invalidation processing unit 1, or the storage location of the Q between the scalar multiplication unit 2 and the attack invalidation processing unit 1 The indicated pointer may be transferred.

なお、本実施形態は、右向き型のバイナリ法にもモンゴメリ・ラダー法にも適用可能である。   Note that this embodiment can be applied to the right-pointing binary method and the Montgomery ladder method.

(第5の実施形態)
次に、第2の実施形態を楕円曲線暗号でのスカラー倍算に適用して攻撃を無効化できるようにした例について説明する。
(Fifth embodiment)
Next, an example in which the attack can be invalidated by applying the second embodiment to scalar multiplication in elliptic curve cryptography will be described.

図12に、この場合の楕円曲線上でのスカラー倍算の演算手順の一例を示す。   FIG. 12 shows an example of a procedure for scalar multiplication on the elliptic curve in this case.

まず、ステップS90で、入力部11は、スカラー倍算の対象である点Pと、秘密のスカラー値d=[d(m-1),..,di,..,d1,d0]_2と、楕円曲線のドメインパラメータEとを入力する。   First, in step S90, the input unit 11 determines that the point P to be subjected to scalar multiplication and the secret scalar value d = [d (m-1), .., di, .., d1, d0] _2. The domain parameter E of the elliptic curve is input.

ステップS91で、前処理部12は、点Pに対して点2倍算をt回繰り返し((2^t)*P)、その計算結果をP’とする。   In step S91, the preprocessing unit 12 repeats the point doubling for the point P t times ((2 ^ t) * P), and sets the calculation result as P '.

次に、上記のP’をスカラー倍算の対象である点、入力されたdの最下位ビットのうちtビット分を除いた値(最上位ビットから最下位から(t+1)ビット目までの部分)d’(d’=[d/(2^t)] =[d(m-1),..,dt])をスカラー値、入力されたEを楕円曲線のドメインパラメータとして、それらが攻撃無効化処理部1からスカラー倍算部2へ与えられる。   Next, the above P ′ is a target of scalar multiplication, and the value obtained by removing t bits from the least significant bits of the input d (part from the most significant bit to the (t + 1) th bit) ) D '(d' = [d / (2 ^ t)] = [d (m-1), .., dt]) is a scalar value, and the input E is an elliptic curve domain parameter. It is given from the invalidation processing unit 1 to the scalar multiplication unit 2.

ステップS92で、スカラー倍算部2は、それらをもとに、(右向き型の)スカラー倍算(d’*P’)を行い、その計算結果Q1を求める。   In step S92, the scalar multiplication unit 2 performs (right-facing) scalar multiplication (d '* P') based on them, and obtains the calculation result Q1.

このQ1は、スカラー倍算部2から攻撃無効化処理部1へ返される。   This Q1 is returned from the scalar multiplication unit 2 to the attack invalidation processing unit 1.

ステップS93で、後処理部13は、入力されたPをスカラー倍算の対象である点、入力されたdのうちLSBからtビット分を取り出した値(tビット目から最下位ビット目までの部分)dL=[d(t-1),…,d0]をスカラー値、入力されたEを楕円曲線のドメインパラメータとして、スカラー倍算(dL*P)を行い、その計算結果Q2を求める。なお、このステップS93の計算は、右向き型でも左向き型でも任意のスカラー倍計算法を利用することができる。   In step S93, the post-processing unit 13 sets the input P to be subject to scalar multiplication, a value obtained by extracting t bits from the LSB of the input d (from the t bit to the least significant bit) Part) Scalar multiplication (dL * P) is performed by using dL = [d (t−1),..., D0] as a scalar value and the input E as a domain parameter of the elliptic curve, and a calculation result Q2 is obtained. In addition, the calculation of this step S93 can use any scalar multiplication method for the right-facing type and the left-facing type.

なお、ステップS93のスカラー倍算は、スカラー倍算部2に実行させても良い。この場合、まず、入力されたPをスカラー倍算の対象である点、入力されたdのうちLSBからtビット分を取り出した値dL=[d(t-1),…,d0]をスカラー値、入力されたEを楕円曲線のドメインパラメータとして、それらが攻撃無効化処理部1からスカラー倍算部2へ与えられる。そして、スカラー倍算部2は、それらをもとに、(右向き型の)スカラー倍算(dL*P)を行い、その計算結果Q2を求める。このQ2は、スカラー倍算部2から攻撃無効化処理部1へ返される。   The scalar multiplication in step S93 may be executed by the scalar multiplication unit 2. In this case, first, the input P is a target of scalar multiplication, and the value dL = [d (t−1),..., D0] obtained by extracting t bits from the LSB of the input d is a scalar. The value and input E are used as domain parameters of the elliptic curve, and are given from the attack invalidation processing unit 1 to the scalar multiplication unit 2. Then, the scalar multiplication unit 2 performs (right-facing) scalar multiplication (dL * P) based on them, and obtains the calculation result Q2. This Q2 is returned from the scalar multiplication unit 2 to the attack invalidation processing unit 1.

ステップS94で、後処理部13は、Q1とQ2の2つの点を点加算して(Q1+Q2)、最終結果Qを求める。   In step S94, the post-processing unit 13 adds the two points Q1 and Q2 (Q1 + Q2) to obtain the final result Q.

ステップS95で、出力部14は、スカラー倍算結果Q= d*P を出力する。   In step S95, the output unit 14 outputs the scalar multiplication result Q = d * P.

ここで、上記計算の正当性は、d=d’*(2^t)+dLと分解し、
Q=d*P
=(d’*(2^t)+dL)*P
={(d’*(2^t))*P}+(dL)*P
=d’*P’+(dL)*P
であることから確認できる。
Here, the validity of the above calculation is decomposed into d = d '* (2 ^ t) + dL,
Q = d * P
= (d '* (2 ^ t) + dL) * P
= {(d '* (2 ^ t)) * P} + (dL) * P
= d '* P' + (dL) * P
This can be confirmed.

なお、上記のステップS92のスカラー倍算とステップS93のスカラー倍算とは、上記とは逆の順番で実行しても構わない。   Note that the scalar multiplication in step S92 and the scalar multiplication in step S93 may be executed in the reverse order.

また、ステップS92,S93のスカラー倍算をいずれもスカラー倍算部2に実行させる代わりに、例えば図13のようにスカラー倍算部2の他にスカラー倍算部3を備え、ステップS92のスカラー倍算をスカラー倍算部2に実行させ、ステップS63のスカラー倍算をスカラー倍算部3に実行させるようにしても良い。この場合に、ステップS9のスカラー倍算とステップS93のスカラー倍算とを同時に実行するようにしても良い。   Further, instead of causing the scalar multiplication unit 2 to execute the scalar multiplication in steps S92 and S93, for example, as shown in FIG. 13, a scalar multiplication unit 3 is provided in addition to the scalar multiplication unit 2, and the scalar multiplication in step S92 is performed. The multiplication may be executed by the scalar multiplication unit 2 and the scalar multiplication of step S63 may be executed by the scalar multiplication unit 3. In this case, the scalar multiplication in step S9 and the scalar multiplication in step S93 may be executed simultaneously.

また、ステップS92のスカラー倍算に必要な(P’,d’,E)と、ステップS93のスカラー倍算に必要な(P,dL,E)とは、攻撃無効化処理部1からスカラー倍算部2へ順次与えても良いし、同時に与えても良い。   Further, (P ′, d ′, E) necessary for the scalar multiplication in step S92 and (P, dL, E) necessary for the scalar multiplication in step S93 are scalar multiplications from the attack invalidation processing unit 1. You may give to the calculating part 2 sequentially, and may give simultaneously.

また、ステップS92のスカラー倍算の結果Q1と、ステップS93のスカラー倍算の結果Q2とは、スカラー倍算部2から攻撃無効化処理部1へ順次与えても良いし、同時に与えても良い。   Further, the result Q1 of the scalar multiplication in step S92 and the result Q2 of the scalar multiplication in step S93 may be sequentially given from the scalar multiplication unit 2 to the attack invalidation processing unit 1 or may be given simultaneously. .

また、スカラー倍算部2と攻撃無効化処理部1との間でQ1,Q2をやり取りする方法としては、Q1,Q2をスカラー倍算部2と攻撃無効化処理部1とで共有する記憶領域に記憶しても良いし、スカラー倍算部2と攻撃無効化処理部1との間でQ1,Q2を転送しても良いし、スカラー倍算部2と攻撃無効化処理部1との間でQ1,Q2の記憶場所を示すポインタを転送しても良い。   As a method for exchanging Q1 and Q2 between the scalar multiplication unit 2 and the attack invalidation processing unit 1, Q1 and Q2 are shared by the scalar multiplication unit 2 and the attack invalidation processing unit 1. Q1 and Q2 may be transferred between the scalar multiplication unit 2 and the attack invalidation processing unit 1, or between the scalar multiplication unit 2 and the attack invalidation processing unit 1. The pointer indicating the storage location of Q1 and Q2 may be transferred.

なお、本実施形態は、右向き型のバイナリ法にもモンゴメリ・ラダー法にも適用可能である。   Note that this embodiment can be applied to the right-pointing binary method and the Montgomery ladder method.

なお、以上の各機能は、ソフトウェアとして記述し適当な機構をもったコンピュータに処理させても実現可能である。
また、本実施形態は、コンピュータに所定の手順を実行させるための、あるいはコンピュータを所定の手段として機能させるための、あるいはコンピュータに所定の機能を実現させるためのプログラムとして実施することもできる。加えて該プログラムを記録したコンピュータ読取り可能な記録媒体として実施することもできる。
Each of the above functions can be realized even if it is described as software and processed by a computer having an appropriate mechanism.
The present embodiment can also be implemented as a program for causing a computer to execute a predetermined procedure, causing a computer to function as a predetermined means, or causing a computer to realize a predetermined function. In addition, the present invention can be implemented as a computer-readable recording medium on which the program is recorded.

なお、本発明は上記実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、上記実施形態に開示されている複数の構成要素の適宜な組み合わせにより、種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。さらに、異なる実施形態にわたる構成要素を適宜組み合わせてもよい。   Note that the present invention is not limited to the above-described embodiment as it is, and can be embodied by modifying the constituent elements without departing from the scope of the invention in the implementation stage. In addition, various inventions can be formed by appropriately combining a plurality of components disclosed in the embodiment. For example, some components may be deleted from all the components shown in the embodiment. Furthermore, constituent elements over different embodiments may be appropriately combined.

本発明の実施形態に係る暗号用演算装置の構成例を示す図The figure which shows the structural example of the arithmetic unit for encryption concerning embodiment of this invention 同実施形態に係る暗号用演算装置の動作手順の一例を示すフローチャートThe flowchart which shows an example of the operation | movement procedure of the arithmetic unit for encryption concerning the embodiment 同実施形態に係るべき乗剰余計算を行う暗号用演算装置(べき乗剰余計算装置)の構成例を示す図The figure which shows the structural example of the arithmetic unit for encryption (power remainder calculation apparatus) which performs the power-residue calculation concerning the embodiment 同実施形態におけるべき乗剰余計算の処理手順の第1の例を示すフローチャートThe flowchart which shows the 1st example of the process procedure of the power-residue calculation in the embodiment 同実施形態におけるべき乗剰余計算の処理手順の第2の例を示すフローチャートThe flowchart which shows the 2nd example of the process procedure of the power-residue calculation in the embodiment 同実施形態におけるべき乗剰余計算の処理手順の第3の例を示すフローチャートThe flowchart which shows the 3rd example of the process procedure of the power-residue calculation in the embodiment 同実施形態におけるべき乗剰余計算の処理手順の第4の例を示すフローチャートThe flowchart which shows the 4th example of the process procedure of the power-residue calculation in the embodiment 同実施形態に係るべき乗剰余計算を行う暗号用演算装置(べき乗剰余計算装置)の他の構成例を示す図The figure which shows the other structural example of the arithmetic unit for encryption (power remainder calculation apparatus) which performs the power-residue calculation concerning the embodiment 同実施形態におけるべき乗剰余計算手順の第5の例を示すフローチャートThe flowchart which shows the 5th example of the power-residue calculation procedure in the embodiment 同実施形態に係る楕円曲線上のスカラー倍算を行う暗号用演算装置(スカラー倍算装置)の構成例を示す図The figure which shows the structural example of the arithmetic unit for encryption (scalar multiplication apparatus) which performs the scalar multiplication on the elliptic curve based on the embodiment 同実施形態における楕円曲線上のスカラー倍算の処理手順の第1の例を示すフローチャートThe flowchart which shows the 1st example of the processing procedure of the scalar multiplication on the elliptic curve in the embodiment 同実施形態における楕円曲線上のスカラー倍算の処理手順の第2の例を示すフローチャートThe flowchart which shows the 2nd example of the processing procedure of the scalar multiplication on the elliptic curve in the same embodiment 同実施形態に係る楕円曲線上のスカラー倍算を行う暗号用演算装置(スカラー倍算装置)の他の構成例を示す図The figure which shows the other structural example of the arithmetic unit for encryption (scalar multiplication apparatus) which performs the scalar multiplication on the elliptic curve based on the embodiment 右向きバイナリ算法に対する(−1)入力SPA攻撃について説明するための図The figure for demonstrating the (-1) input SPA attack with respect to rightward binary arithmetic 右向きバイナリ算法に対する(x、−x)入力SPA攻撃について説明するための図The figure for demonstrating the (x, -x) input SPA attack with respect to rightward binary arithmetic モンゴメリ・ラダー算法について説明するための図Illustration for explaining Montgomery Ladder algorithm モンゴメリ・ラダー算法に対する(−1)入力SPA攻撃について説明するための図The figure for demonstrating the (-1) input SPA attack with respect to Montgomery ladder algorithm モンゴメリ・ラダー算法に対する(x、−x)入力SPA攻撃について説明するための図Diagram for explaining (x, -x) input SPA attack for Montgomery Ladder algorithm

符号の説明Explanation of symbols

1…攻撃無効化処理部、2,3…暗号用演算部(べき乗剰余計算部、スカラー倍算部)、11…入力部、12…前処理部、13…後処理部、14…出力部   DESCRIPTION OF SYMBOLS 1 ... Attack invalidation process part, 2, 3 ... Operation part for encryption (Power remainder calculation part, scalar multiplication part), 11 ... Input part, 12 ... Pre-processing part, 13 ... Post-processing part, 14 ... Output part

Claims (20)

2進数からなる秘密のパラメータの上位ビットから下位ビットに向けて計算を進める手順である右向き型演算手順を用いて、特定の暗号用演算を行う暗号用演算装置であって、
前記暗号用演算の対象となるデータと、前記演算に用いる前記秘密のパラメータと、前記演算に用いる他のパラメータとを入力する入力部と、
前記データに対して、特定の変換を施して、変換データを求める前処理部と、
前記変換データと、前記秘密のパラメータの全部又は一部と、前記他のパラメータとを入力として、該秘密のパラメータの全部又は一部を用いた前記右向き型演算手順により、前記暗号用演算を行って、その演算結果を求める暗号用演算部と、
前記暗号用演算部が求めた前記演算結果をもとにして、前記データと前記秘密のパラメータの全部と前記他のパラメータとを入力とした場合の前記暗号用演算の演算結果を求める後処理を行う後処理部と、
前記暗号用演算部が求めた前記演算結果又は前記後処理部が求めた前記演算結果を、最終的な演算結果として出力する出力部とを備えたことを特徴とする暗号用演算装置。
A cryptographic calculation device that performs a specific cryptographic calculation using a right-pointed calculation procedure, which is a procedure for calculating from a high-order bit to a low-order bit of a secret parameter consisting of a binary number,
An input unit for inputting the data to be subjected to the operation for encryption, the secret parameter used for the operation, and other parameters used for the operation;
A pre-processing unit that performs specific conversion on the data to obtain conversion data;
Using the converted data, all or a part of the secret parameter, and the other parameter as input, performing the cryptographic operation according to the rightward operation procedure using all or a part of the secret parameter. A cryptographic computation unit for obtaining the computation result,
Based on the calculation result obtained by the cryptographic calculation unit, post-processing for obtaining the calculation result of the cryptographic calculation when the data, all of the secret parameters, and the other parameters are input. A post-processing section to perform,
An encryption operation apparatus comprising: an output unit that outputs the operation result obtained by the encryption operation unit or the operation result obtained by the post-processing unit as a final operation result.
前記所定の暗号用演算は、べき乗剰余計算であり、
前記データは、べき乗剰余計算の底であるメッセージMであり、
前記秘密のパラメータは、べき指数dであり、
前記他のパラメータは、法nであり、
前記最終的な演算結果は、べき乗剰余計算結果M^d mod nであることを特徴とする請求項1に記載の暗号用演算装置。
The predetermined cryptographic operation is a power residue calculation;
The data is a message M that is the base of the modular exponentiation,
The secret parameter is a power index d;
The other parameter is modulus n,
The cryptographic operation device according to claim 1, wherein the final calculation result is a power residue calculation result M ^ d mod n.
前記前処理部は、法nの下で、前記メッセージMを2乗して、前記変換データを求め、
前記暗号用演算部は、前記変換データを演算対象とし、法nの下で、前記べき指数dのうち最下位ビットを除いたものに基づく前記右向き型演算手順により、べき乗剰余計算を行い、
前記後処理部は、前記べき指数dの最下位ビットが1である場合には、法nの下で、前記暗号用演算部の演算結果と前記メッセージMとの乗算剰余計算を行って、前記最終的な演算結果を求めることを特徴とする請求項2に記載の暗号用演算装置。
The preprocessing unit squares the message M under the modulus n to obtain the conversion data,
The cryptographic operation unit performs the power-residue calculation according to the right-pointed operation procedure based on the power exponent d excluding the least significant bit under the modulus n, with the conversion data as an operation target,
The post-processing unit, when the least significant bit of the power exponent d is 1, performs a multiplication remainder calculation of the operation result of the cryptographic operation unit and the message M under the modulus n, and 3. The cryptographic computation device according to claim 2, wherein a final computation result is obtained.
前記後処理部は、前記べき指数dの最下位ビットが0である場合には、ダミー計算として、前記べき指数dの最下位ビットが1である場合と同一の演算を行い、
前記暗号用演算部の演算結果を、前記最終的な演算結果とすることを特徴とする請求項3に記載の暗号用演算装置。
The post-processing unit performs the same operation as the case where the least significant bit of the power exponent d is 1 as a dummy calculation when the least significant bit of the power exponent d is 0,
4. The cryptographic computation device according to claim 3, wherein the computation result of the cryptographic computation unit is the final computation result.
前記前処理部は、法nの下で、前記メッセージMに対して2乗演算をt回繰り返して、前記変換データを求め、
前記暗号用演算部は、前記変換データを演算対象とし、法nの下で、前記べき指数dのうち最下位ビットからtビット分を除いたものに基づく前記右向き型演算手順により、第1のべき乗剰余計算を行って、第1の演算結果を求め、
前記後処理部は、前記メッセージMを演算対象とし、法nの下で、前記べき指数dのうち最下位ビットからtビット分を取り出したものに基づく任意の演算手順により、第2のべき乗剰余計算を行って、第2の演算結果を求め、
前記後処理部は、法nの下で、第1の演算結果と第2の演算結果との乗算剰余計算を行って、前記最終的な演算結果を求めることを特徴とする請求項2に記載の暗号用演算装置。
The pre-processing unit obtains the conversion data by repeating a square operation t times for the message M under modulus n,
The cryptographic operation unit operates on the converted data, and performs the first-direction operation procedure based on the power exponent d obtained by subtracting t bits from the least significant bit under the modulus n. Perform a power-residue calculation to obtain the first calculation result,
The post-processing unit uses the message M as a calculation target, and performs a second power residue by an arbitrary calculation procedure based on a power index d obtained by extracting t bits from the least significant bit under the modulus n. Perform the calculation to obtain the second calculation result,
The post-processing unit calculates the final calculation result by performing a multiplication remainder calculation of the first calculation result and the second calculation result under the modulus n. Cryptographic operation unit.
前記後処理部が第2のべき乗剰余計算を行って前記第2の演算結果を求める代わりに、前記暗号用演算部又は前記暗号用演算部とは別に設けられた暗号用演算部が第2のべき乗剰余計算を行って前記第2の演算結果を求めることを特徴とする請求項5に記載の暗号用演算装置。   Instead of the post-processing unit performing a second power residue calculation to obtain the second calculation result, a cryptographic calculation unit provided separately from the cryptographic calculation unit or the cryptographic calculation unit is a second 6. The cryptographic operation device according to claim 5, wherein a power residue calculation is performed to obtain the second calculation result. 前記前処理部は、入力メッセージの空間を正のメッセージ空間と負のメッセージ空間とに2分して定義した際に、前記メッセージMが正のメッセージ空間に属するか又は負のメッセージ空間に属するかを調べ、前記メッセージMが負のメッセージ空間に属する場合には、法nの下で、前記メッセージMの符号を反転して、前記変換データを求め、
前記暗号用演算部は、前記メッセージMが負のメッセージ空間に属する場合には、前記変換データを演算対象とし、法nの下で、前記べき指数dに基づく前記右向き型演算手順により、べき乗剰余計算を行い、前記メッセージMが正のメッセージ空間に属する場合には、前記メッセージMを演算対象とし、法nの下で、前記べき指数dに基づく前記右向き型演算手順により、べき乗剰余計算を行い、
前記後処理部は、前記メッセージMが負のメッセージ空間に属する場合には、法nの下で、(−1)^dと前記暗号用演算部の演算結果との乗算剰余計算を行って、前記最終的な演算結果を求めることを特徴とする請求項2に記載の暗号用演算装置。
Whether the message M belongs to a positive message space or a negative message space when the input message space is defined by dividing the input message space into a positive message space and a negative message space. If the message M belongs to a negative message space, the sign of the message M is inverted under the modulus n to obtain the converted data,
When the message M belongs to a negative message space, the cryptographic calculation unit uses the converted data as a calculation target, and performs a power-residue according to the rightward-type calculation procedure based on the power exponent d under the modulus n If the message M belongs to the positive message space, the power of the message M is calculated, and a power-residue calculation is performed under the modulus n by the right-pointed operation procedure based on the exponent d. ,
When the message M belongs to a negative message space, the post-processing unit performs a modular multiplication of (−1) ^ d and the operation result of the cryptographic operation unit under the modulus n, The cryptographic computation device according to claim 2, wherein the final computation result is obtained.
前記データMが正のメッセージ空間に属する場合には、前記暗号用演算部の演算結果を、前記最終的な演算結果とすることを特徴とする請求項2に記載の暗号用演算装置。   3. The cryptographic computation device according to claim 2, wherein when the data M belongs to a positive message space, the computation result of the cryptographic computation unit is the final computation result. 法nが互いに素な複数の素数の積である場合に、法nを互いに素な因子に分解し、個々の因子を法として前記前処理部、前記暗号用演算部及び前記後処理部を用いてそれぞれ前記最終的な演算結果を求め、求めた複数の前記最終的な演算結果を中国剰余定理で合成する手段を更に備えたことを特徴とする請求項1ないし8のいずれか1項に記載の暗号用演算装置。   When the modulus n is a product of a plurality of prime numbers that are relatively prime, the modulus n is decomposed into relatively prime factors, and each factor is used as a modulus to use the preprocessing unit, the cryptographic operation unit, and the postprocessing unit. 9. The method according to claim 1, further comprising means for obtaining each final computation result and combining the obtained plurality of final computation results with a Chinese remainder theorem. Cryptographic operation unit. 前記所定の暗号用演算は、楕円曲線上のスカラー倍算であり、
前記データは、スカラー倍算の対象である点Pであり、
前記秘密のパラメータは、秘密のスカラー値dであり、
前記他のパラメータは、楕円曲線のドメインパラメータEであり、
前記最終的な演算結果は、楕円曲線上のスカラー倍算結果d*Pであることを特徴とする請求項1に記載の暗号用演算装置。
The predetermined cryptographic operation is a scalar multiplication on an elliptic curve,
The data is a point P that is subject to scalar multiplication,
The secret parameter is a secret scalar value d;
The other parameter is a domain parameter E of an elliptic curve,
2. The cryptographic operation device according to claim 1, wherein the final calculation result is a scalar multiplication result d * P on an elliptic curve.
前記前処理部は、楕円曲線のドメインパラメータEの下で、前記点Pを2倍して、前記変換データを求め、
前記暗号用演算部は、前記変換データを演算対象とし、楕円曲線のドメインパラメータEの下で、前記スカラー値dのうち最下位ビットを除いたものに基づく前記右向き型演算手順により、楕円曲線上のスカラー倍算を行い、
前記後処理部は、前記スカラー値dの最下位ビットが1である場合には、楕円曲線のドメインパラメータEの下で、前記暗号用演算部の演算結果と前記点Pとの点加算を行って、前記最終的な演算結果を求めることを特徴とする請求項10に記載の暗号用演算装置。
The preprocessing unit obtains the conversion data by doubling the point P under the domain parameter E of the elliptic curve,
The cryptographic operation unit operates on the conversion data, and performs an elliptic curve on the elliptic curve by the right-direction calculation procedure based on the scalar parameter d except for the least significant bit under the domain parameter E of the elliptic curve. Scalar multiplication of
When the least significant bit of the scalar value d is 1, the post-processing unit performs point addition of the calculation result of the cryptographic calculation unit and the point P under the domain parameter E of the elliptic curve. The cryptographic calculation device according to claim 10, wherein the final calculation result is obtained.
前記後処理部は、前記スカラー値dの最下位ビットが0である場合には、ダミー計算として、前記スカラー値dの最下位ビットが1である場合と同一の演算を行い、
前記暗号用演算部の演算結果を、前記最終的な演算結果とすることを特徴とする請求項11に記載の暗号用演算装置。
When the least significant bit of the scalar value d is 0, the post-processing unit performs the same operation as the case where the least significant bit of the scalar value d is 1 as a dummy calculation,
12. The cryptographic computation device according to claim 11, wherein the computation result of the cryptographic computation unit is the final computation result.
前記前処理部は、楕円曲線のドメインパラメータEの下で、前記点Pに対して点2倍算をt回繰り返して、前記変換データを求め、
前記暗号用演算部は、前記変換データを演算対象とし、楕円曲線のドメインパラメータEの下で、前記スカラー値dのうち最下位ビットからtビット分を除いたものに基づく前記右向き型演算手順により、第1の楕円曲線上のスカラー倍算を行って、第1の演算結果を求め、
前記後処理部は、前記データを演算対象とし、楕円曲線のドメインパラメータEの下で、前記スカラー値dのうち最下位ビットからtビット分を取り出したものに基づく任意の演算手順により、第2の楕円曲線上のスカラー倍算を行って、第2の演算結果を求め、
前記後処理部は、楕円曲線のドメインパラメータEの下で、第1の演算結果と第2の演算結果との点加算を行って、最終的なスカラー倍算結果を求めることを特徴とする請求項10に記載の暗号用演算装置。
The preprocessing unit obtains the conversion data by repeating point doubling for the point P t times under the domain parameter E of the elliptic curve,
The cryptographic operation unit is configured to operate on the converted data, under the elliptic curve domain parameter E, according to the right-direction operation procedure based on the scalar value d obtained by removing t bits from the least significant bit. The scalar multiplication on the first elliptic curve is performed to obtain the first calculation result,
The post-processing unit uses the data as a calculation target, and performs a second calculation procedure based on an arbitrary calculation procedure based on a value obtained by extracting t bits from the least significant bit of the scalar value d under the domain parameter E of the elliptic curve. A scalar multiplication on the elliptic curve is obtained to obtain the second calculation result,
The post-processing unit performs point addition of the first calculation result and the second calculation result under the domain parameter E of the elliptic curve to obtain a final scalar multiplication result. Item 11. The cryptographic operation device according to Item 10.
前記後処理部が第2の楕円曲線上のスカラー倍算を行って前記第2の演算結果を求める代わりに、前記暗号用演算部又は前記暗号用演算部とは別に設けられた暗号用演算部が第2の楕円曲線上のスカラー倍算を行って前記第2の演算結果を求めることを特徴とする請求項13に記載の暗号用演算装置。   Instead of the post-processing unit performing scalar multiplication on the second elliptic curve to obtain the second calculation result, the cryptographic calculation unit or the cryptographic calculation unit provided separately from the cryptographic calculation unit 14. The cryptographic operation device according to claim 13, wherein the second arithmetic result is obtained by performing scalar multiplication on the second elliptic curve. 前記暗号用演算部は、右向き型のバイナリ法又はモンゴメリ・ラダー法により、べき乗剰余計算を行うものであることを特徴とする請求項3、4、5、6、7または8に記載の暗号用演算装置。   The cryptographic operation unit according to claim 3, 4, 5, 6, 7 or 8, wherein the cryptographic operation unit performs a power-residue calculation by a right-pointing binary method or Montgomery ladder method. Arithmetic unit. 前記暗号用演算部は、右向き型のバイナリ法又はモンゴメリ・ラダー法により、楕円曲線上のスカラー倍算を行うものであることを特徴とする請求項11、12、13または14に記載の暗号用演算装置。   The cryptographic operation unit according to claim 11, 12, 13, or 14, wherein the cryptographic operation unit performs scalar multiplication on an elliptic curve by a right-pointing binary method or Montgomery ladder method. Arithmetic unit. 前記暗号用演算部は、右向き型のwビットウィンドウ法により、べき乗剰余計算を行うものであることを特徴とする請求項5または6に記載の暗号用演算装置。   7. The cryptographic operation device according to claim 5, wherein the cryptographic operation unit performs a power-residue calculation by a right-pointing w-bit window method. 前記暗号用演算部は、右向き型のwビットウィンドウ法により、楕円曲線上のスカラー倍算を行うものであることを特徴とする請求項13または14に記載の暗号用演算装置。   15. The cryptographic computation device according to claim 13 or 14, wherein the cryptographic computation unit performs scalar multiplication on an elliptic curve by a right-facing w-bit window method. 2進数からなる秘密のパラメータの上位ビットから下位ビットに向けて計算を進める手順である右向き型演算手順を用いて、特定の暗号用演算を行う暗号用演算装置であって、
前記暗号用演算装置の備える入力部が、前記暗号用演算の対象となるデータと、前記演算に用いる前記秘密のパラメータと、前記演算に用いる他のパラメータとを入力するステップと、
前記暗号用演算装置の備える前処理部が、前記データに対して、特定の変換を施して、変換データを求めるステップと、
前記暗号用演算装置の備える暗号用演算部が、前記変換データと、前記秘密のパラメータの全部又は一部と、前記他のパラメータとを入力として、該秘密のパラメータの全部又は一部を用いた前記右向き型演算手順により、前記暗号用演算を行って、その演算結果を求めるステップと、
前記暗号用演算装置の備える後処理部が、前記暗号用演算部が求めた前記演算結果をもとにして、前記データと前記秘密のパラメータの全部と前記他のパラメータとを入力とした場合の前記暗号用演算の演算結果を求める後処理を行うステップと、
前記暗号用演算装置の備える出力部が、前記暗号用演算部が求めた前記演算結果又は前記後処理部が求めた前記演算結果を、最終的な演算結果として出力するステップとを有することを特徴とする暗号用演算装置。
A cryptographic calculation device that performs a specific cryptographic calculation using a right-pointed calculation procedure, which is a procedure for calculating from a high-order bit to a low-order bit of a secret parameter consisting of a binary number,
An input unit included in the cryptographic computation device inputs data to be subject to the cryptographic computation, the secret parameter used for the computation, and other parameters used for the computation;
A preprocessing unit included in the cryptographic operation device performs specific conversion on the data to obtain converted data;
The cryptographic calculation unit included in the cryptographic calculation device uses the conversion data, all or part of the secret parameter, and the other parameter as input, and uses all or part of the secret parameter. Performing the cryptographic computation by the right-facing computation procedure and obtaining the computation result;
When the post-processing unit included in the cryptographic computation device receives the data, all of the secret parameters, and the other parameters based on the computation result obtained by the cryptographic computation unit. Performing post-processing to obtain a computation result of the cryptographic computation;
The output unit included in the cryptographic computation device includes a step of outputting the computation result obtained by the cryptographic computation unit or the computation result obtained by the post-processing unit as a final computation result. An arithmetic unit for encryption.
2進数からなる秘密のパラメータの上位ビットから下位ビットに向けて計算を進める手順である右向き型演算手順を用いて、特定の暗号用演算を行う暗号用演算装置としてコンピュータを機能させるためのプログラムであって、
前記暗号用演算装置の備える入力部が、前記暗号用演算の対象となるデータと、前記演算に用いる前記秘密のパラメータと、前記演算に用いる他のパラメータとを入力するステップと、
前記暗号用演算装置の備える前処理部が、前記データに対して、特定の変換を施して、変換データを求めるステップと、
前記暗号用演算装置の備える暗号用演算部が、前記変換データと、前記秘密のパラメータの全部又は一部と、前記他のパラメータとを入力として、該秘密のパラメータの全部又は一部を用いた前記右向き型演算手順により、前記暗号用演算を行って、その演算結果を求めるステップと、
前記暗号用演算装置の備える後処理部が、前記暗号用演算部が求めた前記演算結果をもとにして、前記データと前記秘密のパラメータの全部と前記他のパラメータとを入力とした場合の前記暗号用演算の演算結果を求める後処理を行うステップと、
前記暗号用演算装置の備える出力部が、前記暗号用演算部が求めた前記演算結果又は前記後処理部が求めた前記演算結果を、最終的な演算結果として出力するステップとをコンピュータに実行させるためのプログラム。
A program for causing a computer to function as a cryptographic operation device that performs a specific cryptographic operation using a right-pointing arithmetic procedure that is a procedure for proceeding calculation from an upper bit to a lower bit of a secret parameter consisting of a binary number. There,
An input unit included in the cryptographic computation device inputs data to be subject to the cryptographic computation, the secret parameter used for the computation, and other parameters used for the computation;
A preprocessing unit included in the cryptographic operation device performs specific conversion on the data to obtain converted data;
The cryptographic calculation unit included in the cryptographic calculation device uses the conversion data, all or part of the secret parameter, and the other parameter as input, and uses all or part of the secret parameter. Performing the cryptographic computation by the right-facing computation procedure and obtaining the computation result;
When the post-processing unit included in the cryptographic computation device receives the data, all of the secret parameters, and the other parameters based on the computation result obtained by the cryptographic computation unit. Performing post-processing to obtain a computation result of the cryptographic computation;
An output unit included in the cryptographic operation device causes the computer to execute a step of outputting the calculation result obtained by the cryptographic calculation unit or the calculation result obtained by the post-processing unit as a final calculation result. Program for.
JP2008170432A 2008-06-30 2008-06-30 Arithmetic device for cipher, arithmetic method for cipher, and program Pending JP2010008883A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008170432A JP2010008883A (en) 2008-06-30 2008-06-30 Arithmetic device for cipher, arithmetic method for cipher, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008170432A JP2010008883A (en) 2008-06-30 2008-06-30 Arithmetic device for cipher, arithmetic method for cipher, and program

Publications (1)

Publication Number Publication Date
JP2010008883A true JP2010008883A (en) 2010-01-14

Family

ID=41589436

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008170432A Pending JP2010008883A (en) 2008-06-30 2008-06-30 Arithmetic device for cipher, arithmetic method for cipher, and program

Country Status (1)

Country Link
JP (1) JP2010008883A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016510914A (en) * 2013-03-15 2016-04-11 クリプトグラフィ リサーチ, インコーポレイテッド Asymmetric masked multiplication
JP2016126211A (en) * 2015-01-06 2016-07-11 Kddi株式会社 Decryption device, method, and program

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000165375A (en) * 1998-11-30 2000-06-16 Hitachi Ltd Information processor and ic card
JP2003029630A (en) * 2001-07-12 2003-01-31 Toshiba Corp Exponential remainder arithmetic unit
JP2003208097A (en) * 2002-01-15 2003-07-25 Fujitsu Ltd Cipher operation device and method having side channel attack resistance
JP2003233307A (en) * 2001-12-04 2003-08-22 Fujitsu Ltd Tamper-resistant encryption processing using secret key
WO2004055756A1 (en) * 2002-12-18 2004-07-01 Fujitsu Limited Tamper-resistant elliptical curve encryption using secret key
JP2005346373A (en) * 2004-06-02 2005-12-15 Renesas Technology Corp Arithmetic circuit, logical circuit, read-only memory, register, and semiconductor circuit
JP2008146384A (en) * 2006-12-11 2008-06-26 Nec Electronics Corp Information processor and instruction fetch control method
WO2009122461A1 (en) * 2008-03-31 2009-10-08 富士通株式会社 Encrypting method having countermeasure function against power analyzing attacks

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000165375A (en) * 1998-11-30 2000-06-16 Hitachi Ltd Information processor and ic card
JP2003029630A (en) * 2001-07-12 2003-01-31 Toshiba Corp Exponential remainder arithmetic unit
JP2003233307A (en) * 2001-12-04 2003-08-22 Fujitsu Ltd Tamper-resistant encryption processing using secret key
JP2003208097A (en) * 2002-01-15 2003-07-25 Fujitsu Ltd Cipher operation device and method having side channel attack resistance
WO2004055756A1 (en) * 2002-12-18 2004-07-01 Fujitsu Limited Tamper-resistant elliptical curve encryption using secret key
JP2005346373A (en) * 2004-06-02 2005-12-15 Renesas Technology Corp Arithmetic circuit, logical circuit, read-only memory, register, and semiconductor circuit
JP2008146384A (en) * 2006-12-11 2008-06-26 Nec Electronics Corp Information processor and instruction fetch control method
WO2009122461A1 (en) * 2008-03-31 2009-10-08 富士通株式会社 Encrypting method having countermeasure function against power analyzing attacks

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016510914A (en) * 2013-03-15 2016-04-11 クリプトグラフィ リサーチ, インコーポレイテッド Asymmetric masked multiplication
US9959429B2 (en) 2013-03-15 2018-05-01 Cryptography Research, Inc. Asymmetrically masked multiplication
US10423807B2 (en) 2013-03-15 2019-09-24 Cryptography Research, Inc. Asymmetrically masked multiplication
US10902156B2 (en) 2013-03-15 2021-01-26 Rambus Inc. Asymmetrically masked multiplication
JP2016126211A (en) * 2015-01-06 2016-07-11 Kddi株式会社 Decryption device, method, and program

Similar Documents

Publication Publication Date Title
US7639808B2 (en) Elliptic curve cryptosystem apparatus, elliptic curve cryptosystem method, elliptic curve cryptosystem program and computer readable recording medium storing the elliptic curve cryptosystem program
JP5412274B2 (en) Protection from side channel attacks
JP4668931B2 (en) Encryption processor with tamper resistance against power analysis attacks
CA2614120C (en) Elliptic curve point multiplication
JP3821631B2 (en) Method and apparatus for scalar multiplication in elliptic curve cryptography, and storage medium
WO2006054559A1 (en) Encryption computing device
JP5365624B2 (en) Embedded device apparatus incorporating a decoding device, a program, and a recovery device having a countermeasure function against a power analysis attack
JP5182364B2 (en) Cryptographic processing method with tamper resistance against side channel attack
KR20100113130A (en) Countermeasure method and devices for asymmetric cryptography
KR20100117589A (en) Countermeasure method and devices for asymmetrical cryptography with signature diagram
JP5977996B2 (en) Modular power method and apparatus resistant to side channel attacks
WO2007080825A1 (en) Encryption processing device, encryption processing method, and computer program
CN101213512A (en) Arrangement for and method of protecting a data processing device against an attack or analysis
JP2010164904A (en) Elliptic curve arithmetic processing unit and elliptic curve arithmetic processing program and method
JP5553773B2 (en) Apparatus and method for calculating scalar multiple of points on elliptic curve
KR20040067779A (en) Information processing means
JP2010008883A (en) Arithmetic device for cipher, arithmetic method for cipher, and program
US8744072B2 (en) Exponentiation method resistant against side-channel and safe-error attacks
JP2004163687A (en) Device and program for elliptic curve ciphering
WO2005013243A1 (en) Calculator, method, and program for calculating conversion parameter of montgomery multiplication remainder
Yen et al. Improvement on Ha-Moon randomized exponentiation algorithm
KR20090004626A (en) Altering the size of windows in public key cryptographic computations
JP4772081B2 (en) Tamper resistant elliptic curve cryptography using secret key
Yakymenko et al. Sustainability and Time Complexity Estimation of Сryptographic Algorithms Main Operations on Elliptic Curves
JP2006201641A (en) Nonlinear arithmetic unit, encryption processor, nonlinear arithmetic method, and nonlinear arithmetic program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110323

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130201

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130219

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130419

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20130528