JP2016008994A - Modular exponentiation arithmetic unit, ic card, modular exponentiation arithmetic method, and modular exponentiation arithmetic program - Google Patents
Modular exponentiation arithmetic unit, ic card, modular exponentiation arithmetic method, and modular exponentiation arithmetic program Download PDFInfo
- Publication number
- JP2016008994A JP2016008994A JP2014127864A JP2014127864A JP2016008994A JP 2016008994 A JP2016008994 A JP 2016008994A JP 2014127864 A JP2014127864 A JP 2014127864A JP 2014127864 A JP2014127864 A JP 2014127864A JP 2016008994 A JP2016008994 A JP 2016008994A
- Authority
- JP
- Japan
- Prior art keywords
- calculation
- remainder
- residue
- bits
- multiplication
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Abstract
Description
本発明は、RSA(Rivest Shamir Adleman scheme)暗号や、Diffie−Hellman鍵共有(Key Agreement)等の公開鍵暗号方式の実装に用いられるべき乗剰余演算装置等の技術分野に関する。 The present invention relates to a technical field such as a residue arithmetic apparatus to be used for implementation of public key cryptosystems such as RSA (Rivest Shamir Adleman scheme) cryptography and Diffie-Hellman key agreement (Key Agreement).
従来から、ICチップ等が搭載されるICカードや携帯型情報端末においては、当該ICチップに格納される個人情報等は、一般に、RSA(Rivest Shamir Adleman scheme)暗号方式により暗号化されて不揮発性メモリに書き込まれ、暗号化された個人情報等が読み出される際には復号されて出力されるようになっている。RSA暗号では、べき乗剰余演算によって、下記(1)式に基づき暗号化処理が行われ、下記(2)式に基づき復号処理が行われる。 Conventionally, in an IC card or a portable information terminal on which an IC chip or the like is mounted, personal information stored in the IC chip is generally encrypted by a RSA (Rivest Shamir Adleman scheme) encryption method and is nonvolatile. When personal information or the like written in the memory and encrypted is read out, it is decrypted and output. In the RSA encryption, encryption processing is performed based on the following equation (1) by power-residue calculation, and decryption processing is performed based on the following equation (2).
C=Mdmodn ・・・(1)
M=Cemodn ・・・(2)
C = M d modn (1)
M = C e modn (2)
ここで、M は暗号化の対象となる平文、Cは暗号化された平文(つまり、暗号文)、d(べき値)は秘密鍵(プライベート鍵)指数、e(べき値)は公開鍵指数、nは公開鍵モジュラスである。また、公開鍵モジュラスnは、素数pとqの積である。 Where M is the plaintext to be encrypted, C is the encrypted plaintext (ie, ciphertext), d (power value) is the private key (private key) index, and e (power value) is the public key index. , N is the public key modulus. The public key modulus n is a product of prime numbers p and q.
上述した暗号化処理及び復号処理におけるべき乗剰余演算では、一般に、バイナリ法(繰り返し二乗法)が用いられる。このバイナリ法を用いた暗号化処理におけるべき乗剰余演算アルゴリズムを以下に示す。
S=1
for(j=k−1 to 0)
S=S2modn
if(di=1) then
S=S*Mmodn
end if
end for
In the power-residue calculation in the above-described encryption process and decryption process, a binary method (iterative square method) is generally used. A power-residue calculation algorithm in encryption processing using this binary method is shown below.
S = 1
for (j = k-1 to 0)
S = S 2 modn
if (d i = 1) then
S = S * Mmodn
end if
end for
ここで、kはdのビット長であり、diはdの2進数表現である。暗号化処理におけるべき乗剰余演算アルゴリズムでは、Sの初期値を“1”とする二乗剰余演算(S2modn)と、di=1となるビットの数と等しい回数の乗算剰余演算(S*Mmodn)との繰返し演算が行われる。 Here, k is the bit length of d, and d i is the binary representation of d. In the power-residue calculation algorithm in the encryption process, a square-residue calculation (S 2 modn) with an initial value of S being “1” and a multiplication-residue calculation (S * Mmodn) equal to the number of bits with d i = 1. ) Is repeated.
また、バイナリ法を用いた復号処理におけるべき乗剰余演算アルゴリズムを以下に示す。
S=1
for(j=k−1 to 0)
S=S2modn
if(ei=1) then
S=S*Cmodn
end if
end for
A power-residue calculation algorithm in the decoding process using the binary method is shown below.
S = 1
for (j = k-1 to 0)
S = S 2 modn
if (e i = 1) then
S = S * Cmodn
end if
end for
ここで、kはeのビット長であり、eiはeの2進数表現である。復号処理におけるべき乗剰余演算アルゴリズムでは、Sの初期値を“1”とする二乗剰余演算(S2modn)と、ei=1となるビットの数と等しい回数の乗算剰余演算(S*Cmodn)との繰返し演算が行われる。 Here, k is the bit length of e, and e i is a binary representation of e. In the power-residue algorithm in the decoding process, a square-residue operation (S 2 modn) with an initial value of S being “1” and a multiplication-residue operation (S * Cmodn) equal to the number of bits for which e i = 1. Is repeated.
ところで、上述したように、べき乗剰余演算においてバイナリ法を用いる場合、diやeiが1であるか0であるかによって演算方法が異なる(つまり、乗算剰余演算が行われるか否かが異なる)。このため、べき乗剰余演算中の消費電力の変動を観測して秘密鍵の導出を試みるSPA(Simple Power Analysis)やDPA(Differential Power Analysis)等のサイドチャネル攻撃がなされるという問題があった。また、消費電力の代わりに電磁界の変動を観測するSEMA(Simple ElectroMagnetic Analysis)やDEMA(Differential ElectroMagnetic Analysis)と呼ばれる攻撃手法も知られている。このようなサイドチャネル攻撃に対する対策として、例えば秘密鍵を用いた演算中のデータを乱数などでマスク(ブラインディング)することによって演算中のデータと秘密鍵を無相関にする対策が知られている。例えば、特許文献1には、秘密鍵指数を、乱数を用いてブラインディングする技術が開示されている。
By the way, as described above, when the binary method is used in the power-residue calculation, the calculation method differs depending on whether d i and e i are 1 or 0 (that is, whether the multiplication remainder calculation is performed or not). ). For this reason, there has been a problem that side channel attacks such as SPA (Simple Power Analysis) and DPA (Differential Power Analysis) which attempt to derive a secret key by observing fluctuations in power consumption during power-residue calculation. Also known are attack techniques called SEMA (Simple ElectroMagnetic Analysis) and DEMA (Differential ElectroMagnetic Analysis) that observe fluctuations in the electromagnetic field instead of power consumption. As a countermeasure against such a side channel attack, for example, a countermeasure for making the data being calculated and the secret key uncorrelated by masking (blinding) the data being calculated using the secret key with a random number or the like is known. . For example,
ところで、非特許文献1では、Dr. Jean-Pierre Seifertらにより、署名検証時の「べき乗剰余演算」のタイミングを狙って故障利用攻撃を実行し、ニセの署名であっても署名検証に成功させる攻撃“Bypass Fault Attack”が報告されている。例えば、秘密鍵dを知らない攻撃者は、署名検証に成功できる正しい署名値(暗号文)Cを作れないため、元の平文Mを署名検証ステップの入力として与える。そして、当該攻撃者は、上述した乗算剰余演算を1回だけ行われたタイミングで攻撃することで、指数eをe=1とさせた演算結果(すなわち、Mの1乗なのでMのまま)を、署名検証判断ルーチンに与え、署名検証をすりぬける。この手法により、攻撃者は、例えばCA局の正しい署名が付いていないニセの公開鍵証明書であっても、署名検証を成功させて受け容れさせることができる。従来、このような“Bypass Fault Attack”に対して有効な対策は知られていなかった。
By the way, in Non-Patent
そこで、本発明は、上記点等に鑑みてなされたものであり、“Bypass Fault Attack”等の攻撃に対して有効に対応することが可能な、べき乗剰余演算装置、ICカード、べき乗剰余演算方法、及び、べき乗剰余演算プログラムを提供することを目的とする。 Therefore, the present invention has been made in view of the above points and the like, and a power residue calculation device, an IC card, and a power residue calculation method capable of effectively responding to attacks such as “Bypass Fault Attack” An object of the present invention is to provide a modular exponentiation operation program.
上記課題を解決するために、請求項1に記載の発明は、バイナリ法を用いてS=Cemodnの演算を行う、べき乗剰余演算装置において、複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするカウント手段と、前記カウント手段によりカウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定手段と、前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、を備えることを特徴とする。
In order to solve the above problem, the invention according to
請求項2に記載の発明は、請求項1に記載のべき乗剰余演算装置において、前記設定回数は、1に設定され、前記判定手段は、前記演算回数が前記設定回数である場合に異常であると判定することを特徴とする。 According to a second aspect of the present invention, in the power-residue calculating device according to the first aspect, the set number of times is set to 1, and the determination unit is abnormal when the number of times of the calculation is the set number of times. It is characterized by determining.
請求項3に記載の発明は、請求項1に記載のべき乗剰余演算装置において、前記設定回数は、ei=1となるビットの数に設定され、前記判定手段は、前記乗算剰余演算の前記演算回数が前記設定回数でない場合に異常であると判定することを特徴とする。 According to a third aspect of the present invention, in the power-residue calculating apparatus according to the first aspect, the set number of times is set to the number of bits where e i = 1, and the determination unit is configured to perform the multiplication remainder calculation. When the number of calculations is not the set number, it is determined to be abnormal.
請求項4に記載の発明は、請求項1乃至3の何れか一項に記載のべき乗剰余演算装置において、前記Cは検証対象データ、前記eは公開鍵指数、前記nは公開鍵モジュラスであり、前記判定手段により異常でないと判定された場合において前記繰り返し演算により算出された前記Sと、べき乗剰余演算による暗号化の対象となる平文データとが一致するか否かを判定することにより前記Cの検証を行う検証手段を更に備えることを特徴とする。 According to a fourth aspect of the present invention, in the power-residue calculating device according to any one of the first to third aspects, the C is data to be verified, the e is a public key exponent, and the n is a public key modulus. When it is determined by the determination means that there is no abnormality, it is determined whether the S calculated by the iterative calculation matches the plaintext data to be encrypted by the power-residue calculation. It is further characterized by further comprising verification means for performing the verification.
請求項5に記載の発明は、バイナリ法を用いてS=Cemodnの演算を行うICカードにおいて、複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするカウント手段と、前記カウント手段によりカウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定手段と、前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、を備えることを特徴とする。 According to the fifth aspect of the present invention, there is provided an input means for inputting C, e, and n, which are positive integers expressed by a plurality of bits, in an IC card that performs an operation of S = C e modn using a binary method. , When e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times of modular multiplication and the number of multiplication remainders equal to the number of bits where e i = 1 Comparing the calculation means for performing calculation with the calculation, the counting means for counting the number of times of the square remainder calculation or the multiplication remainder calculation, and the number of calculations counted by the counting means and a preset set number of times And determining means for determining whether or not there is an abnormality based on the comparison result, and processing means for performing error processing when the determination means determines that there is an abnormality.
請求項6に記載の発明は、バイナリ法を用いてS=Cemodnの演算を行うコンピュータにより実行されるべき乗剰余演算方法であって、複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするステップと、前記カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定ステップと、前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、を含むことを特徴とする。
The invention according to
請求項7に記載の発明は、バイナリ法を用いてS=Cemodnの演算を行うコンピュータに、複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするステップと、前記カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定ステップと、前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、を実行させることを特徴とする。
The invention according to
本発明によれば、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントし、カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定し、異常であると判定された場合、エラー処理を行うので、“Bypass Fault Attack”等の攻撃等による異常を迅速に検知して有効に対応することができる。 According to the present invention, the number of operations of the square remainder operation or the multiplication residue operation is counted, the counted number of operations is compared with a preset number of times, and whether or not there is an abnormality based on the comparison result If it is determined whether or not there is an abnormality, error processing is performed, so that an abnormality caused by an attack such as “Bypass Fault Attack” can be quickly detected and dealt with effectively.
以下、図面を参照して本発明の実施形態について詳細に説明する。なお、以下に説明する実施形態は、ICチップに対して本発明を適用した場合の実施の形態である。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The embodiment described below is an embodiment when the present invention is applied to an IC chip.
先ず、図1を参照して、ICカード1の概要構成及び機能について説明する。図1は、ICカード1の概要構成例を示す図である。なお、ICカード1は、キャッシュカード、クレジットカード、社員カード等として使用される。或いは、ICカード1は、スマートフォンや携帯電話機等の通信機器に組み込まれる。なお、ICチップ1aは、通信機器の回路基板上に直接組み込んで構成するようにしてもよい。
First, the schematic configuration and functions of the
図1に示すように、ICカード1に搭載されるICチップ1aは、CPU(Central Processing Unit)10、コプロセッサ11、ROM(Read Only Memory)12、RAM(Random Access Memory)13、不揮発性メモリ14、及びI/O回路15を備えて構成される。コプロセッサ11は、本発明のべき乗剰余演算装置及びコンピュータの一例であり、主に、CPU10の補助する検証処理を行うものである。また、本実施形態において、コプロセッサ11は、検証装置の一例である。不揮発性メモリ14としては、例えば、フラッシュメモリが適用される。或いは「Electrically Erasable Programmable Read-Only Memory」が適用されてもよい。I/O回路15は、外部端末2とのインターフェイスを担う。接触式のICチップ1aの場合、I/O回路15には、例えば、C1〜C8の8個の端子が備えられている。例えば、C1端子は電源端子、C2端子はリセット端子、C3端子はクロック端子、C5端子はグランド端子、C7端子は外部端末2との間で通信を行うための端子である。一方、非接触式のICチップ1aの場合、I/O回路15には、例えば、アンテナ、及び変復調回路が備えられている。なお、外部端末2の例としては、ICカード発行機、ATM、改札機、認証用ゲート等が挙げられる。或いは、ICチップ1aが通信機器に組み込まれる場合、外部端末2には通信機器の機能を担う制御部が該当する。
As shown in FIG. 1, an IC chip 1a mounted on an
ROM12または不揮発性メモリ14には、CPU10、及びコプロセッサ11に実行させるプログラム、及び各種データが記憶されている。不揮発性メモリ14に記憶されるプログラムには、CPU10に実行させるコマンド処理を規定するコマンド処理プログラムが含まれる。また、不揮発性メモリ14に記憶されるプログラムには、コプロセッサ11に実行させる暗号化処理を規定する暗号化処理プログラム、及びコプロセッサ11に実行させる復号処理を規定する復号処理プログラム(本発明のべき乗剰余演算プログラムを含む)が含まれる。また、不揮発性メモリ14には、セキュアな記憶領域が設けられており、この記憶領域には、暗号化処理で用いられる秘密鍵d、復号処理で用いられる公開鍵(a,n)等が記憶される。
The
CPU10は、外部端末2から送信されたコマンドを受信すると、コマンド処理プログラムに従って当該コマンドに応じたコマンド処理を実行する。特に、コマンド処理が、データの暗号化、またはデータの復号を伴う場合、CPU10は、暗号化処理、または復号処理をコプロセッサ11に実行させる。コプロセッサ11は、本発明における入力手段、演算手段、カウント手段、判定手段、処理手段、検証手段の一例である。コプロセッサ11は、例えば、べき乗剰余演算部、カウンタ、検証部、及び複数のレジスタ等を備え、暗号化処理プログラム、または復号処理プログラムに従って、暗号化処理、または復号処理を実行する。この復号処理において、コプロセッサ11は、バイナリ法を用いたS=Cemodnの演算を行う。なお、CPU10が、コプロセッサ11の代わりに、本発明におけるカウント手段、判定手段、処理手段、及び検証手段として機能してもよい。この場合、CPU10は、例えば、カウンタ、及び検証部を備える。
When receiving a command transmitted from the
具体的には、コプロセッサ11は、複数ビットで表現される正の整数であるC(検証対象データ)、e(公開鍵指数)、及びn(公開鍵モジュラス)を、RAM13または不揮発性メモリ14から入力する(読み込む)。コプロセッサ11は、入力したeを2進数表現eiとしたとき、k回の二乗剰余演算(S2modn)と、ei=1となるビットの数と等しい回数の乗算剰余演算(S*Cmodn)との繰り返し演算を行う。ここで、kはeのビット長であり、eiはeの2進数表現である(k>i≧0)。また、2進数表現したeの各ビットをE[j]と表記すると、eは、下記(3)式で表すことができる。
Specifically, the
e=2k-1E[k-1] + 2k-2E[k-2] + ・・・ + 22E[2] + 2E[1] + E[0]・・・(3) e = 2 k-1 E [k-1] + 2 k-2 E [k-2] + ... + 2 2 E [2] + 2E [1] + E [0] (3)
繰り返し演算は、乗算と除算(mod算)から構成される。乗算は、初期値を1とするSの値に対してS*S、またはS*Mを行う部分である。除算は、それぞれの乗算で得られた値に対してmodn(nで割ったときの余りを求める演算)を行う部分である。繰返し演算では、乗算と除算を1対の演算として、eのビット値に従って行なわれる。すなわち、eの最上位ビットから最下位ビットまでの各ビットの内容によって乗算と除算が行なわれる。 The repetitive calculation is composed of multiplication and division (mod calculation). Multiplication is a part that performs S * S or S * M on the value of S, which has an initial value of 1. The division is a part for performing modn (operation for obtaining a remainder when dividing by n) on the value obtained by each multiplication. In the repetitive operation, multiplication and division are performed as a pair of operations according to the bit value of e. That is, multiplication and division are performed according to the contents of each bit from the most significant bit to the least significant bit of e.
コプロセッサ11、またはCPU10は、上記繰り返し演算において、二乗剰余演算または乗算剰余演算の演算回数をカウントする。そして、コプロセッサ11は、カウントされた上記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定し、異常であると判定した場合、エラー処理を行う。また、コプロセッサ11は、異常でないと判定した場合において上記繰り返し演算により算出されたSと、べき乗剰余演算による暗号化の対象となるM(平文データ)とが一致するか否かを判定することによりCの検証を行う。
The
次に、図2及び図3を参照して、コプロセッサ11により実行される復号処理の具体例を説明する。図2及び図3は、コプロセッサ11により実行される復号処理の一例を示すフローチャートである。なお、以下の説明では、コプロセッサ11が、二乗剰余演算または乗算剰余演算の演算回数をカウントし、カウントされた演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定し、異常であると判定した場合、エラー処理を行うものとしているが、このような一連の処理は、CPU10により行われるように構成してもよい。
Next, a specific example of the decoding process executed by the
(実施例1)
先ず、図2を参照して、コプロセッサ11により実行される復号処理を説明する。図2に示す復号処理は、繰り返し演算において乗算剰余演算の演算回数が“1”である場合に異常であると判定する例である。
Example 1
First, the decoding process executed by the
図2に示す処理は、例えば、CPU10から、署名検証指令があった場合に開始される。なお、図2に示す処理の前提として、上記設定回数が“1”に設定される。図2に示す処理が開始されると、コプロセッサ11は、M(平文データ)、C(検証対象データ)、e(公開鍵指数)、及びn(公開鍵モジュラス)を、例えば、RAM13または不揮発性メモリ14から入力し、MをMレジスタに格納し、CをCレジスタに格納し、eをEレジスタに格納し、nをNレジスタに格納する。なお、Eレジスタには、eを2進数で表現した各ビットの値が格納される。そして、コプロセッサ11は、kを“eのビット長”とし、Sを“1”(初期値)とし、ctを“0”とする(ステップS1)。例えば、Kレジスタに“eのビット長”が格納され、Sレジスタに“1”が格納され、CTレジスタに“0”が格納される。
The process illustrated in FIG. 2 is started when a signature verification command is received from the
次いで、コプロセッサ11は、ビットの位置(最上位から最下位まで)を示すjを“k−1”とする(ステップS2)。例えば、Jレジスタに“k−1”が格納される。次いで、コプロセッサ11は、べき乗剰余演算部により、二乗剰余演算(S2modn)を行ってSを算出する(ステップS3)。こうして算出されたSによりSレジスタに格納されている値が更新される。次いで、コプロセッサ11は、Eレジスタを参照して、ejが“1”であるか否かを判定する(ステップS4)。コプロセッサ11は、ejが“1”であると判定した場合(ステップS4:YES)、ステップS5へ進む。一方、コプロセッサ11は、ejが“1”でない(つまり、ejが“0”である)と判定した場合(ステップS4:NO)、ステップS7へ進む。
Next, the
ステップS5では、コプロセッサ11は、べき乗剰余演算部により、乗算剰余演算(S*Cmodn)を行ってSを算出する。こうして算出されたSによりSレジスタに格納されている値が更新される。次いで、コプロセッサ11は、カウンタにより、ctの値(乗算剰余演算のカウント値)に“1”を加算(1カウントアップ)する(ステップS6)。これにより、CTレジスタに格納されている値が更新される。
In step S <b> 5, the
ステップS7では、コプロセッサ11は、jの値から“1”を減算する。これにより、Jレジスタに格納されている値が更新される。次いで、コプロセッサ11は、Jレジスタを参照して、jの値が“0”以上であるか否かを判定する(ステップS8)。コプロセッサ11は、jの値が“0”以上であると判定した場合(ステップS8:YES)、ステップS3に戻り、ステップS3以降の処理を繰り返す。一方、コプロセッサ11は、jの値が“0”以上でない(つまり、繰り返し演算が、k回行われた)と判定した場合(ステップS8:NO)、ステップS9へ進む。
In step S7, the
ステップS9では、コプロセッサ11は、CTレジスタを参照して、ctが“1”(設定回数)であるか(つまり、カウントされた乗算剰余演算の演算回数と、設定回数とを比較し、当該比較結果に基づいて異常であるか)否かを判定する。つまり、図2の例では、乗算剰余演算の演算回数が“1”であるか否かが判定される。コプロセッサ11は、ctが“1”であると判定した場合(ステップS9:YES)、異常があったと判断(異常検知)して、エラー処理を行う(ステップS10)。つまり、乗算剰余演算の演算回数が“1”である場合、乗算剰余演算が1回だけ行われたタイミングで攻撃されたことが想定されるため、エラー処理を行うのである。このエラー処理では、コプロセッサ11は、例えばCPU10へ警報出力(例えば、攻撃等の異常があったことを示すメッセージを出力)して、図2に示す処理を終了する(つまり、警告終了でリターン)。或いは、エラー処理では、コプロセッサ11は、動作を停止してもよい。
In step S9, the
CPU10は、コプロセッサ11からの警報出力を入力した場合、ICチップ1aの動作を停止、またはICチップ1aにおいて起動中の特定のプログラムの動作を停止する。或いは、この場合、CPU10は、外部端末2へエラー応答を送信する。エラー応答は、ICチップ1a内でエラーが発生したことを示す。なお、CPU10は、ICチップ1aまたは上記特定のプログラムの動作を停止すると共に、外部端末2へエラー応答を送信してもよい。
When the alarm output from the
一方、ステップS9において、コプロセッサ11は、ctが“1”でないと判定した場合(ステップS9:NO)、繰り返し演算により算出されたS(Sレジスタに最終的に格納されている値)と、べき乗剰余演算による暗号化の対象となるM(Mレジスタに格納されている値)とが一致するか否かを検証部により判定する(ステップS11)。これにより、入力されたCの検証が行われる。コプロセッサ11は、SとMとが一致すると判定した場合(ステップS11:YES)、検証成功を示すメッセージをCPU10へ出力し(ステップS12)、図2に示す処理を終了する。一方、コプロセッサ11は、SとMとが一致しないと判定した場合(ステップS11:NO)、検証失敗を示すメッセージをCPU10へ出力し(ステップS13)、図2に示す処理を終了する。CPU10は、コプロセッサ11からの検証成功、または検証失敗に応じた処理を行うことになる。なお、ステップS11の処理は、CPU10が行うように構成してもよい。この場合、コプロセッサ11は、ctが“1”でないと判定した場合(ステップS9:NO)、繰り返し演算により算出されたS(Sレジスタに最終的に格納されている値)をCPU10へ出力することになる。
On the other hand, when the
以上説明したように、上記実施例1によれば、例えば、検証対象データ(本来、暗号文C)としてMが入力され、上記乗算剰余演算が1回だけ行われたタイミングで攻撃された場合であっても、この攻撃による異常を検知して、エラー処理を行うことができる。よって、“Bypass Fault Attack”等の攻撃等による異常を迅速に検知して有効に対応することができる。 As described above, according to the first embodiment, for example, when M is input as the verification target data (originally ciphertext C) and the attack is performed at the timing when the above modular multiplication is performed only once. Even if it exists, an abnormality due to this attack can be detected and error processing can be performed. Therefore, it is possible to quickly detect an abnormality due to an attack such as “Bypass Fault Attack” and effectively deal with it.
なお、ctの値に“1”を加算する処理は、ステップS5の直後ではなく、例えば、ステップS3とステップS4の間で行われるように構成してもよい。この場合、二乗剰余演算の演算回数がカウントされることになる。この場合も、上記設定回数が“1”であってもよいが、正常な繰り返し演算(二乗剰余演算)はk回行われる。そのため、上記設定回数をkとし、ステップS9では、コプロセッサ11は、ctがk未満であるか否かを判定し、ctがk未満ある場合、エラー処理を行うように構成してもよい。この構成により、べき乗剰余演算においてバイナリ法を用いる場合の反復演算が実行された回数を把握することができるので、演算中に攻撃を受けた可能性を検知することができる。
Note that the process of adding “1” to the value of ct may be configured not to be performed immediately after step S5 but between, for example, step S3 and step S4. In this case, the number of square remainder calculations is counted. In this case as well, the set number of times may be “1”, but normal repetitive calculation (square remainder calculation) is performed k times. Therefore, the set number of times may be set to k, and in step S9, the
(実施例2)
次に、図3を参照して、コプロセッサ11により実行される復号処理を説明する。図2に示す復号処理は、繰り返し演算において乗算剰余演算の演算回数が“ej=1となるビットの数”でない場合に異常であると判定する例である。なお、図3に示すステップS29以外の処理は、図2に示す処理と同様であるので、重複する説明を省略する。ステップS29では、コプロセッサ11は、ctが“ej=1となるビットの数”であるか否かを判定する。そして、コプロセッサ11は、ctが“ej=1となるビットの数”であると判定した場合(ステップS29:YES)、ステップS31へ進んで、検証を行う。一方、コプロセッサ11は、ctが“ej=1となるビットの数”でないと判定した場合(ステップS29:NO)、ステップS30へ進んで、エラー処理を行う。例えば、公開鍵指数e=65537である場合、この2進数表現は、“10000000000000001”となり、17ビットのうち、2ビットに“1”が立っているので、正常な繰り返し演算(二乗剰余演算)が行われた場合、ステップS29において、ctの値は“2”となっているはずである。このため、もし、ctが“2”でなければ、コプロセッサ11は、異常があったと判断(異常検知)して、エラー処理を行う。
(Example 2)
Next, a decoding process executed by the
以上説明したように、上記実施例2によれば、“Bypass Fault Attack”等の攻撃を、より精度良く検知して、エラー処理を行うことができる。よって、“Bypass Fault Attack”等の攻撃等による異常を精度良く検知して有効に対応することができる。更に、上記実施例2によれば、“Bypass Fault Attack”に限らず、現時点で未知の攻撃によって、バイナリ法の反復演算が攪乱された場合でも、異常を検出することができる。 As described above, according to the second embodiment, it is possible to detect an attack such as “Bypass Fault Attack” with higher accuracy and perform error processing. Therefore, it is possible to detect an abnormality caused by an attack such as “Bypass Fault Attack” with high accuracy and effectively deal with it. Furthermore, according to the second embodiment, not only “Bypass Fault Attack”, but also an abnormality can be detected even when the binary computation is disturbed by an unknown attack at the present time.
なお、上記実施形態においては、ICチップに対して本発明を適用した場合の例であるが、本発明は、ICチップ以外の組込み型のマイクロプロセッサ等に対して適用可能である。また、上記実施形態においては、本発明の各手段がソフトウェアにより構成する場合の例を説明したが、本発明の各手段はハードウェアにより構成されてもよい。 In the above embodiment, the present invention is applied to an IC chip. However, the present invention can be applied to an embedded microprocessor other than the IC chip. In the above embodiment, an example in which each unit of the present invention is configured by software has been described. However, each unit of the present invention may be configured by hardware.
1 ICカード
1a ICチップ
10 CPU
11 コプロセッサ
12 ROM
13 RAM
14 不揮発性メモリ
15 I/O回路
1 IC card
11
13 RAM
14 Nonvolatile memory 15 I / O circuit
Claims (7)
複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、
前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、
前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするカウント手段と、
前記カウント手段によりカウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定手段と、
前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、
を備えることを特徴とする、べき乗剰余演算装置。 In a power-residue computing device that performs S = C e modn using a binary method,
Input means for inputting C, e, and n, which are positive integers expressed by a plurality of bits;
When e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times of a modular remainder operation and a number of multiplication remainder operations equal to the number of bits where e i = 1. An arithmetic means for repeatedly calculating
A counting means for counting the number of times of the square remainder calculation or the multiplication remainder calculation;
A determination unit that compares the number of operations counted by the counting unit with a preset number of times, and determines whether or not there is an abnormality based on the comparison result;
Processing means for performing error processing when it is determined that the determination means is abnormal;
A power-residue calculating device comprising:
前記判定手段は、前記演算回数が前記設定回数である場合に異常であると判定することを特徴とする請求項1に記載のべき乗剰余演算装置。 The set number of times is set to 1,
2. The modular exponentiation operation apparatus according to claim 1, wherein the determination unit determines that there is an abnormality when the number of calculations is the set number.
前記判定手段は、前記乗算剰余演算の前記演算回数が前記設定回数でない場合に異常であると判定することを特徴とする請求項1に記載のべき乗剰余演算装置。 The set number of times is set to the number of bits where e i = 1.
2. The power residue calculation apparatus according to claim 1, wherein the determination unit determines that the operation is abnormal when the number of times of the multiplication remainder calculation is not the set number of times.
前記判定手段により異常でないと判定された場合において前記繰り返し演算により算出された前記Sと、べき乗剰余演算による暗号化の対象となる平文データとが一致するか否かを判定することにより前記Cの検証を行う検証手段を更に備えることを特徴とする請求項1乃至3の何れか一項に記載のべき乗剰余演算装置。 C is data to be verified, e is a public key index, and n is a public key modulus.
When it is determined by the determination means that there is no abnormality, it is determined whether or not the S calculated by the repetitive calculation matches the plaintext data to be encrypted by the power-residue calculation. The power-residue calculating apparatus according to claim 1, further comprising verification means for performing verification.
複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、
前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、
前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするカウント手段と、
前記カウント手段によりカウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定手段と、
前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、
を備えることを特徴とするICカード。 In an IC card that performs a calculation of S = C e modn using a binary method,
Input means for inputting C, e, and n, which are positive integers expressed by a plurality of bits;
When e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times of a modular remainder operation and a number of multiplication remainder operations equal to the number of bits where e i = 1. An arithmetic means for repeatedly calculating
A counting means for counting the number of times of the square remainder calculation or the multiplication remainder calculation;
A determination unit that compares the number of operations counted by the counting unit with a preset number of times, and determines whether or not there is an abnormality based on the comparison result;
Processing means for performing error processing when it is determined that the determination means is abnormal;
An IC card comprising:
複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、
前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、
前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするステップと、
前記カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定ステップと、
前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、
を含むことを特徴とする、べき乗剰余演算方法。 A modular exponentiation method to be executed by a computer that performs a computation of S = C e modn using a binary method,
Inputting positive integers C, e, and n expressed in multiple bits;
When e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times of a modular remainder operation and a number of multiplication remainder operations equal to the number of bits where e i = 1. A step of repeatedly calculating with
Counting the number of operations of the square remainder operation or the multiplication residue operation;
A determination step of comparing the counted number of calculations with a preset number of times and determining whether or not it is abnormal based on the comparison result;
A step of performing error processing when it is determined in the determination step that there is an abnormality;
A power-residue calculation method comprising:
複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、
前記eを2進数表現ei(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、ei=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、
前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントするステップと、
前記カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定する判定ステップと、
前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、
を実行させることを特徴とする、べき乗剰余演算プログラム。 To a computer that performs S = C e modn using a binary method,
Inputting positive integers C, e, and n expressed in multiple bits;
When e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times of a modular remainder operation and a number of multiplication remainder operations equal to the number of bits where e i = 1. A step of repeatedly calculating with
Counting the number of operations of the square remainder operation or the multiplication residue operation;
A determination step of comparing the counted number of calculations with a preset number of times and determining whether or not it is abnormal based on the comparison result;
A step of performing error processing when it is determined in the determination step that there is an abnormality;
A power-residue calculation program, characterized in that
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014127864A JP6354376B2 (en) | 2014-06-23 | 2014-06-23 | Power residue calculation device, IC card, power residue calculation method, and power residue calculation program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014127864A JP6354376B2 (en) | 2014-06-23 | 2014-06-23 | Power residue calculation device, IC card, power residue calculation method, and power residue calculation program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2016008994A true JP2016008994A (en) | 2016-01-18 |
JP6354376B2 JP6354376B2 (en) | 2018-07-11 |
Family
ID=55226604
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014127864A Active JP6354376B2 (en) | 2014-06-23 | 2014-06-23 | Power residue calculation device, IC card, power residue calculation method, and power residue calculation program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6354376B2 (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10154976A (en) * | 1996-11-22 | 1998-06-09 | Toshiba Corp | Tamper-free system |
JPH118616A (en) * | 1997-06-17 | 1999-01-12 | Dainippon Printing Co Ltd | Ic card having provision against attack taking advantage of failure |
US20040125950A1 (en) * | 2002-12-27 | 2004-07-01 | Sung-Ming Yen | Method for protecting public key schemes from timing, power and fault attacks |
JP2005165290A (en) * | 2003-11-12 | 2005-06-23 | Matsushita Electric Ind Co Ltd | Rsa public key generation apparatus, rsa decryption apparatus, and rsa signature apparatus |
US20060029224A1 (en) * | 2004-08-06 | 2006-02-09 | Yoo-Jin Baek | System and recording medium for securing data and methods thereof |
JP2010068135A (en) * | 2008-09-09 | 2010-03-25 | Fujitsu Ltd | Fraudulent operation detection circuit, apparatus having the same, and fraudulent operation detection method |
JP2010193447A (en) * | 2009-02-19 | 2010-09-02 | Thomson Licensing | Method and apparatus for coping with defect attack |
JP2014174556A (en) * | 2013-03-11 | 2014-09-22 | Thomson Licensing | Method and device for fault-resistant exponentiation in cryptographic systems |
-
2014
- 2014-06-23 JP JP2014127864A patent/JP6354376B2/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10154976A (en) * | 1996-11-22 | 1998-06-09 | Toshiba Corp | Tamper-free system |
JPH118616A (en) * | 1997-06-17 | 1999-01-12 | Dainippon Printing Co Ltd | Ic card having provision against attack taking advantage of failure |
US20040125950A1 (en) * | 2002-12-27 | 2004-07-01 | Sung-Ming Yen | Method for protecting public key schemes from timing, power and fault attacks |
JP2005165290A (en) * | 2003-11-12 | 2005-06-23 | Matsushita Electric Ind Co Ltd | Rsa public key generation apparatus, rsa decryption apparatus, and rsa signature apparatus |
US20060029224A1 (en) * | 2004-08-06 | 2006-02-09 | Yoo-Jin Baek | System and recording medium for securing data and methods thereof |
JP2010068135A (en) * | 2008-09-09 | 2010-03-25 | Fujitsu Ltd | Fraudulent operation detection circuit, apparatus having the same, and fraudulent operation detection method |
JP2010193447A (en) * | 2009-02-19 | 2010-09-02 | Thomson Licensing | Method and apparatus for coping with defect attack |
JP2014174556A (en) * | 2013-03-11 | 2014-09-22 | Thomson Licensing | Method and device for fault-resistant exponentiation in cryptographic systems |
Non-Patent Citations (1)
Title |
---|
楠田 浩二: "公開鍵暗号方式の安全性評価に関する現状と課題", 日本銀行金融研究所ディスカッション・ペーパー・シリーズ(1997年収録分) [ONLINE], JPN6018006170, 1 April 1998 (1998-04-01), pages 30 - 31, ISSN: 0003794742 * |
Also Published As
Publication number | Publication date |
---|---|
JP6354376B2 (en) | 2018-07-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8402287B2 (en) | Protection against side channel attacks | |
US8065531B2 (en) | Decryption method | |
CN112002210B (en) | Method for testing and reinforcing software applications | |
US8391477B2 (en) | Cryptographic device having tamper resistance to power analysis attack | |
EP1134653B1 (en) | Information processing device, information processing method and smartcard | |
EP2211265B1 (en) | Elliptic curve arithmetic processing unit and elliptic curve arithmetic processing program and method | |
EP2332040B1 (en) | Countermeasure securing exponentiation based cryptography | |
KR101787672B1 (en) | Elliptic curve point multiplication procedure resistant to side-channel information leakage | |
US10721056B2 (en) | Key processing method and device | |
CN105991292A (en) | Systems and methods for operating secure elliptic curve cryptosystems | |
EP3191936B1 (en) | System and method for one-time chinese-remainder-theorem exponentiation for cryptographic algorythms | |
KR20100113130A (en) | Countermeasure method and devices for asymmetric cryptography | |
WO2018019233A1 (en) | Operation method and security chip | |
TWI512610B (en) | Modular reduction using a special form of the modulus | |
US9780946B2 (en) | Elliptic curve encryption method comprising an error detection | |
Kaminaga et al. | Double Counting in $2^{t} $-ary RSA Precomputation Reveals the Secret Exponent | |
KR20080012634A (en) | Method and apparatus of adding points in binary finite field for implementation of fault detecting operation used in fast montgomery power ladder algorithm | |
JP6354376B2 (en) | Power residue calculation device, IC card, power residue calculation method, and power residue calculation program | |
EP3461053A1 (en) | Fault attacks counter-measures for eddsa | |
Le et al. | On double exponentiation for securing RSA against fault analysis | |
Clavier et al. | Updated recommendations for blinded exponentiation vs. single trace analysis | |
JP3952304B2 (en) | How to implement a cryptographic algorithm for finding public exponents in electronic components | |
Hanley et al. | Exploiting collisions in addition chain-based exponentiation algorithms using a single trace | |
Wang et al. | A new SPA attack on ECC with regular point multiplication | |
EP4372548A1 (en) | Protecting cryptographic operations againt horizontal side-channel analysis attacks |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170425 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20180208 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20180227 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20180427 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20180515 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180528 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6354376 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |