JP6354376B2 - Power residue calculation device, IC card, power residue calculation method, and power residue calculation program - Google Patents

Power residue calculation device, IC card, power residue calculation method, and power residue calculation program Download PDF

Info

Publication number
JP6354376B2
JP6354376B2 JP2014127864A JP2014127864A JP6354376B2 JP 6354376 B2 JP6354376 B2 JP 6354376B2 JP 2014127864 A JP2014127864 A JP 2014127864A JP 2014127864 A JP2014127864 A JP 2014127864A JP 6354376 B2 JP6354376 B2 JP 6354376B2
Authority
JP
Japan
Prior art keywords
operations
bits
power
multiplication
binary
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.)
Active
Application number
JP2014127864A
Other languages
Japanese (ja)
Other versions
JP2016008994A (en
Inventor
半田 富己男
富己男 半田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
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 Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2014127864A priority Critical patent/JP6354376B2/en
Publication of JP2016008994A publication Critical patent/JP2016008994A/en
Application granted granted Critical
Publication of JP6354376B2 publication Critical patent/JP6354376B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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=Mmodn ・・・(1)
M=Cmodn ・・・(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=Smodn
if(d=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のビット長であり、dはdの2進数表現である。暗号化処理におけるべき乗剰余演算アルゴリズムでは、Sの初期値を“1”とする二乗剰余演算(Smodn)と、d=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=Smodn
if(e=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のビット長であり、eはeの2進数表現である。復号処理におけるべき乗剰余演算アルゴリズムでは、Sの初期値を“1”とする二乗剰余演算(Smodn)と、e=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.

ところで、上述したように、べき乗剰余演算においてバイナリ法を用いる場合、dやeが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, Patent Document 1 discloses a technique for blinding secret key exponents using random numbers.

特許5412274号Patent 5412274 Shay Gueron, Jean-Pierre Seifert,"Is It Wise to Publish Your Public RSA Keys?",Fault Diagnosis and Tolerance in Cryptography (FDTC 2006), Lecture Notes in Computer Science Volume 4236, 2006, pp.1-12Shay Gueron, Jean-Pierre Seifert, "Is It Wise to Publish Your Public RSA Keys?", Fault Diagnosis and Tolerance in Cryptography (FDTC 2006), Lecture Notes in Computer Science Volume 4236, 2006, pp.1-12

ところで、非特許文献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 Document 1, by Dr. Jean-Pierre Seifert et al., A failure use attack is executed aiming at the timing of “power residue calculation” at the time of signature verification, and signature verification succeeds even for fake signatures. The attack “Bypass Fault Attack” has been reported. For example, an attacker who does not know the secret key d cannot create a correct signature value (ciphertext) C that can be successfully verified, and therefore provides the original plaintext M as an input for the signature verification step. Then, the attacker attacks the result of the above-mentioned multiplication residue calculation at the timing when it is performed only once, so that the calculation result in which the index e is set to e = 1 (that is, M is the power of M and remains M). The signature verification judgment routine is given and the signature verification is skipped. By this method, the attacker can successfully accept the signature even if it is a fake public key certificate without the correct signature of the CA station. Conventionally, an effective measure against such “Bypass Fault Attack” has not been known.

そこで、本発明は、上記点等に鑑みてなされたものであり、“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=Cmodnの演算を行う、べき乗剰余演算装置において、複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、記乗算剰余演算の演算回数をカウントするカウント手段と、前記カウント手段によりカウントされた前記演算回数と、e =1となるビットの数に設定された設定回数とを比較し、当該比較結果に基づいて前記演算回数が前記設定回数でない場合に異常であると判定する判定手段と、前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、を備えることを特徴とする。 In order to solve the above problem, the invention according to claim 1 is a positive integer represented by a plurality of bits in a power-residue arithmetic unit that performs an operation of S = C e modn using a binary method. , E, and n, and when e is a binary number expression e i (k (bit length of e)> i ≧ 0), k times square remainder operation and e i = 1 and calculating means for performing a repetitive operation of modular multiplication of times equal to the number of bits comprising a counting means for counting the number of operations before Symbol modular multiplication, and counted the number of operations by said counting means, e a determination unit that compares a set number of times set to the number of bits for which i = 1 and determines that the calculation is not abnormal when the number of calculations is not the set number of times based on the comparison result; Determined to be If it, characterized in that it comprises a processing means for performing an error process.

請求項に記載の発明は、請求項1に記載のべき乗剰余演算装置において、前記Cは検証対象データ、前記eは公開鍵指数、前記nは公開鍵モジュラスであり、前記判定手段により異常でないと判定された場合において前記繰り返し演算により算出された前記Sと、べき乗剰余演算による暗号化の対象となる平文データとが一致するか否かを判定することにより前記Cの検証を行う検証手段を更に備えることを特徴とする。 According to a second aspect of the invention, the modular exponentiation operation apparatus according to claim 1, wherein C is verified data, wherein e is the public key exponent, wherein n is a public key modulus, not abnormal by the determining means Verifying means for verifying the C by determining whether or not the S calculated by the iterative calculation and the plaintext data to be encrypted by the power-residue calculation match. It is further provided with the feature.

請求項に記載の発明は、バイナリ法を用いてS=Cmodnの演算を行うICカードにおいて、複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、記乗算剰余演算の演算回数をカウントするカウント手段と、前記カウント手段によりカウントされた前記演算回数と、e =1となるビットの数に設定された設定回数とを比較し、当該比較結果に基づいて前記演算回数が前記設定回数でない場合に異常であると判定する判定手段と、前記判定手段により異常であると判定された場合、エラー処理を行う処理手段と、を備えることを特徴とする。 According to a third 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 calculating means for performing a repeated operation of the operation, a count means for counting the number of operations before Symbol modular multiplication, and counted the number of operations by the counting means is set to the number of bits to be e i = 1 A determination unit that determines that the number of calculations is abnormal based on the comparison result, and that determines that the determination unit is abnormal. Processing means to perform , Characterized in that it comprises a.

請求項に記載の発明は、バイナリ法を用いてS=Cmodnの演算を行うコンピュータにより実行されるべき乗剰余演算方法であって、複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、記乗算剰余演算の演算回数をカウントするステップと、前記カウントされた前記演算回数と、e =1となるビットの数に設定された設定回数とを比較し、当該比較結果に基づいて前記演算回数が前記設定回数でない場合に異常であると判定する判定ステップと、前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、を含むことを特徴とする。 The invention according to claim 4 is a modular multiplication method to be executed by a computer that performs a calculation of S = C e modn using a binary method, and is a positive integer expressed by a plurality of bits, C, e , And n, and when e is a binary expression e i (k (bit length of e)> i ≧ 0), k square remainder operations and bits where e i = 1 performing a repetitive operation number and the number of modular multiplication equal, the steps of counting the number of operations before Symbol modular multiplication, and the counted the number of calculations, the number of bits to be e i = 1 If compared with the set predetermined number of times, it is determined and a determination step and the number of calculations on the basis of the comparison result is abnormal if not the set number, to be abnormal in the determination step, Characterized in that it comprises a step of performing error processing, the.

請求項記載の発明は、バイナリ法を用いてS=Cmodnの演算を行うコンピュータに、複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、記乗算剰余演算の演算回数をカウントするステップと、前記カウントされた前記演算回数と、e =1となるビットの数に設定された設定回数とを比較し、当該比較結果に基づいて前記演算回数が前記設定回数でない場合に異常であると判定する判定ステップと、前記判定ステップにおいて異常であると判定された場合、エラー処理を行うステップと、を実行させることを特徴とする。 According to a fifth aspect of the present invention, a step of inputting positive integers C, e, and n expressed by a plurality of bits to a computer that performs an operation of S = C e modn using a binary method; Is expressed as a binary number e i (k (bit length of e)> i ≧ 0), and k times the square remainder operation and the number of multiplication remainder operations equal to the number of bits where e i = 1. comparing performing a repetitive operation, the steps of counting the number of operations before Symbol modular multiplication, and the counted the number of operations, and a set number of times set to the number of bits to be e i = 1, a determination step and the number of calculations on the basis of the comparison result is abnormal if not the set number, if it is determined that the abnormality in the determining step, this to execute the steps of performing error processing The features.

本発明によれば、前記二乗剰余演算または前記乗算剰余演算の演算回数をカウントし、カウントされた前記演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定し、異常であると判定された場合、エラー処理を行うので、“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カード1の概要構成例を示す図である。1 is a diagram illustrating a schematic configuration example of an IC card 1. FIG. コプロセッサ11により実行される復号処理の一例を示すフローチャートである。5 is a flowchart illustrating an example of a decoding process executed by a coprocessor 11. コプロセッサ11により実行される復号処理の一例を示すフローチャートである。5 is a flowchart illustrating an example of a decoding process executed by a coprocessor 11.

以下、図面を参照して本発明の実施形態について詳細に説明する。なお、以下に説明する実施形態は、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 IC card 1 will be described with reference to FIG. FIG. 1 is a diagram illustrating a schematic configuration example of the IC card 1. The IC card 1 is used as a cash card, credit card, employee card or the like. Alternatively, the IC card 1 is incorporated into a communication device such as a smartphone or a mobile phone. The IC chip 1a may be configured by being directly incorporated on a circuit board of a communication device.

図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 IC card 1 includes a CPU (Central Processing Unit) 10, a coprocessor 11, a ROM (Read Only Memory) 12, a RAM (Random Access Memory) 13, and a nonvolatile memory. 14 and an I / O circuit 15. The coprocessor 11 is an example of a power residue calculation apparatus and a computer according to the present invention, and mainly performs verification processing assisted by the CPU 10. In the present embodiment, the coprocessor 11 is an example of a verification device. For example, a flash memory is applied as the nonvolatile memory 14. Alternatively, “Electrically Erasable Programmable Read-Only Memory” may be applied. The I / O circuit 15 serves as an interface with the external terminal 2. In the case of the contact type IC chip 1a, the I / O circuit 15 includes, for example, eight terminals C1 to C8. For example, the C1 terminal is a power supply terminal, the C2 terminal is a reset terminal, the C3 terminal is a clock terminal, the C5 terminal is a ground terminal, and the C7 terminal is a terminal for communicating with the external terminal 2. On the other hand, in the case of the non-contact type IC chip 1a, the I / O circuit 15 includes, for example, an antenna and a modulation / demodulation circuit. Examples of the external terminal 2 include an IC card issuing machine, ATM, ticket gate, authentication gate, and the like. Alternatively, when the IC chip 1a is incorporated in a communication device, the external terminal 2 corresponds to a control unit responsible for the function of the communication device.

ROM12または不揮発性メモリ14には、CPU10、及びコプロセッサ11に実行させるプログラム、及び各種データが記憶されている。不揮発性メモリ14に記憶されるプログラムには、CPU10に実行させるコマンド処理を規定するコマンド処理プログラムが含まれる。また、不揮発性メモリ14に記憶されるプログラムには、コプロセッサ11に実行させる暗号化処理を規定する暗号化処理プログラム、及びコプロセッサ11に実行させる復号処理を規定する復号処理プログラム(本発明のべき乗剰余演算プログラムを含む)が含まれる。また、不揮発性メモリ14には、セキュアな記憶領域が設けられており、この記憶領域には、暗号化処理で用いられる秘密鍵d、復号処理で用いられる公開鍵(a,n)等が記憶される。   The ROM 12 or the nonvolatile memory 14 stores programs executed by the CPU 10 and the coprocessor 11 and various data. The program stored in the nonvolatile memory 14 includes a command processing program that defines command processing to be executed by the CPU 10. The program stored in the non-volatile memory 14 includes an encryption processing program that defines the encryption processing to be executed by the coprocessor 11 and a decryption processing program that specifies the decryption processing to be executed by the coprocessor 11 (of the present invention). Including a power residue calculation program). The non-volatile memory 14 is provided with a secure storage area in which a secret key d used in the encryption process, a public key (a, n) used in the decryption process, and the like are stored. Is done.

CPU10は、外部端末2から送信されたコマンドを受信すると、コマンド処理プログラムに従って当該コマンドに応じたコマンド処理を実行する。特に、コマンド処理が、データの暗号化、またはデータの復号を伴う場合、CPU10は、暗号化処理、または復号処理をコプロセッサ11に実行させる。コプロセッサ11は、本発明における入力手段、演算手段、カウント手段、判定手段、処理手段、検証手段の一例である。コプロセッサ11は、例えば、べき乗剰余演算部、カウンタ、検証部、及び複数のレジスタ等を備え、暗号化処理プログラム、または復号処理プログラムに従って、暗号化処理、または復号処理を実行する。この復号処理において、コプロセッサ11は、バイナリ法を用いたS=Cmodnの演算を行う。なお、CPU10が、コプロセッサ11の代わりに、本発明におけるカウント手段、判定手段、処理手段、及び検証手段として機能してもよい。この場合、CPU10は、例えば、カウンタ、及び検証部を備える。 When receiving a command transmitted from the external terminal 2, the CPU 10 executes command processing according to the command in accordance with the command processing program. In particular, when the command processing involves data encryption or data decryption, the CPU 10 causes the coprocessor 11 to execute the encryption processing or decryption processing. The coprocessor 11 is an example of an input unit, a calculation unit, a count unit, a determination unit, a processing unit, and a verification unit in the present invention. The coprocessor 11 includes, for example, a power residue calculation unit, a counter, a verification unit, a plurality of registers, and the like, and executes encryption processing or decryption processing according to the encryption processing program or the decryption processing program. In this decoding process, the coprocessor 11 performs an operation of S = C e modn using the binary method. The CPU 10 may function as a counting unit, a determining unit, a processing unit, and a verification unit in the present invention instead of the coprocessor 11. In this case, the CPU 10 includes, for example, a counter and a verification unit.

具体的には、コプロセッサ11は、複数ビットで表現される正の整数であるC(検証対象データ)、e(公開鍵指数)、及びn(公開鍵モジュラス)を、RAM13または不揮発性メモリ14から入力する(読み込む)。コプロセッサ11は、入力したeを2進数表現eとしたとき、k回の二乗剰余演算(Smodn)と、e=1となるビットの数と等しい回数の乗算剰余演算(S*Cmodn)との繰り返し演算を行う。ここで、kはeのビット長であり、eはeの2進数表現である(k>i≧0)。また、2進数表現したeの各ビットをE[j]と表記すると、eは、下記(3)式で表すことができる。 Specifically, the coprocessor 11 converts C (data to be verified), e (public key index), and n (public key modulus), which are positive integers expressed by a plurality of bits, into the RAM 13 or the nonvolatile memory 14. Input from (read). When the input e is represented by a binary number e i , the coprocessor 11 performs k square remainder operations (S 2 modn) and multiplication remainder operations (S *) equal to the number of bits where e i = 1. Cmodn) is repeated. Here, k is the bit length of e, and e i is a binary representation of e (k> i ≧ 0). If each bit of e expressed in binary notation is expressed as E [j], e can be expressed by the following equation (3).

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 coprocessor 11 or the CPU 10 counts the number of times of the square remainder calculation or the multiplication remainder calculation in the above repeated calculation. Then, the coprocessor 11 compares the counted number of calculations with a preset number of times, determines whether or not it is abnormal based on the comparison result, and if it is determined that there is an error, Process. When the coprocessor 11 determines that there is no abnormality, the coprocessor 11 determines whether S calculated by the repetitive calculation matches M (plaintext data) to be encrypted by the power-residue calculation. To verify C.

次に、図2及び図3を参照して、コプロセッサ11により実行される復号処理の具体例を説明する。図2及び図3は、コプロセッサ11により実行される復号処理の一例を示すフローチャートである。なお、以下の説明では、コプロセッサ11が、二乗剰余演算または乗算剰余演算の演算回数をカウントし、カウントされた演算回数と予め設定された設定回数とを比較し、当該比較結果に基づいて異常であるか否かを判定し、異常であると判定した場合、エラー処理を行うものとしているが、このような一連の処理は、CPU10により行われるように構成してもよい。   Next, a specific example of the decoding process executed by the coprocessor 11 will be described with reference to FIGS. 2 and 3. 2 and 3 are flowcharts illustrating an example of the decoding process executed by the coprocessor 11. In the following description, the coprocessor 11 counts the number of times of the square remainder calculation or multiplication remainder calculation, compares the counted number of times with a preset number of times, and performs an abnormality based on the comparison result. If it is determined whether or not it is abnormal, it is assumed that error processing is performed. However, such a series of processing may be performed by the CPU 10.

(実施例1)
先ず、図2を参照して、コプロセッサ11により実行される復号処理を説明する。図2に示す復号処理は、繰り返し演算において乗算剰余演算の演算回数が“1”である場合に異常であると判定する例である。
Example 1
First, the decoding process executed by the coprocessor 11 will be described with reference to FIG. The decoding process shown in FIG. 2 is an example in which it is determined that there is an abnormality when the number of operations of the modular multiplication is “1” in the iterative calculation.

図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 CPU 10, for example. As a premise of the processing shown in FIG. 2, the set number of times is set to “1”. When the processing shown in FIG. 2 is started, the coprocessor 11 sets M (plain text data), C (data to be verified), e (public key index), and n (public key modulus) to, for example, the RAM 13 or nonvolatile memory. From the memory 14, M is stored in the M register, C is stored in the C register, e is stored in the E register, and n is stored in the N register. The E register stores the value of each bit in which e is expressed in binary. Then, the coprocessor 11 sets k to “bit length of e”, sets S to “1” (initial value), and sets ct to “0” (step S1). For example, “bit length of e” is stored in the K register, “1” is stored in the S register, and “0” is stored in the CT register.

次いで、コプロセッサ11は、ビットの位置(最上位から最下位まで)を示すjを“k−1”とする(ステップS2)。例えば、Jレジスタに“k−1”が格納される。次いで、コプロセッサ11は、べき乗剰余演算部により、二乗剰余演算(Smodn)を行ってSを算出する(ステップS3)。こうして算出されたSによりSレジスタに格納されている値が更新される。次いで、コプロセッサ11は、Eレジスタを参照して、eが“1”であるか否かを判定する(ステップS4)。コプロセッサ11は、eが“1”であると判定した場合(ステップS4:YES)、ステップS5へ進む。一方、コプロセッサ11は、eが“1”でない(つまり、eが“0”である)と判定した場合(ステップS4:NO)、ステップS7へ進む。 Next, the coprocessor 11 sets j indicating the bit position (from the most significant to the least significant) as “k−1” (step S2). For example, “k−1” is stored in the J register. Next, the coprocessor 11 calculates S by performing a square remainder calculation (S 2 modn) by the power-residue calculation unit (step S3). The value stored in the S register is updated by the S thus calculated. Then, the coprocessor 11 refers to the E register, determines whether e j is "1" (step S4). Coprocessor 11, when judging that e j is "1" (step S4: YES), the process proceeds to step S5. On the other hand, co-processor 11, e j is not "1" (i.e., e j is "0") when it is determined that (Step S4: NO), the process proceeds to step S7.

ステップS5では、コプロセッサ11は、べき乗剰余演算部により、乗算剰余演算(S*Cmodn)を行ってSを算出する。こうして算出されたSによりSレジスタに格納されている値が更新される。次いで、コプロセッサ11は、カウンタにより、ctの値(乗算剰余演算のカウント値)に“1”を加算(1カウントアップ)する(ステップS6)。これにより、CTレジスタに格納されている値が更新される。   In step S <b> 5, the coprocessor 11 calculates S by performing a modular multiplication (S * Cmodn) by a power modular arithmetic unit. The value stored in the S register is updated by the S thus calculated. Next, the coprocessor 11 adds “1” to the value of ct (count value of the modular multiplication operation) by the counter (1 count up) (step S6). As a result, the value stored in the CT register is updated.

ステップ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 coprocessor 11 subtracts “1” from the value of j. As a result, the value stored in the J register is updated. Next, the coprocessor 11 refers to the J register and determines whether or not the value of j is “0” or more (step S8). If the coprocessor 11 determines that the value of j is greater than or equal to “0” (step S8: YES), the coprocessor 11 returns to step S3 and repeats the processing after step S3. On the other hand, if the coprocessor 11 determines that the value of j is not greater than or equal to “0” (that is, the repetitive calculation has been performed k times) (step S8: NO), the process proceeds to step S9.

ステップS9では、コプロセッサ11は、CTレジスタを参照して、ctが“1”(設定回数)であるか(つまり、カウントされた乗算剰余演算の演算回数と、設定回数とを比較し、当該比較結果に基づいて異常であるか)否かを判定する。つまり、図2の例では、乗算剰余演算の演算回数が“1”であるか否かが判定される。コプロセッサ11は、ctが“1”であると判定した場合(ステップS9:YES)、異常があったと判断(異常検知)して、エラー処理を行う(ステップS10)。つまり、乗算剰余演算の演算回数が“1”である場合、乗算剰余演算が1回だけ行われたタイミングで攻撃されたことが想定されるため、エラー処理を行うのである。このエラー処理では、コプロセッサ11は、例えばCPU10へ警報出力(例えば、攻撃等の異常があったことを示すメッセージを出力)して、図2に示す処理を終了する(つまり、警告終了でリターン)。或いは、エラー処理では、コプロセッサ11は、動作を停止してもよい。   In step S9, the coprocessor 11 refers to the CT register and compares ct with “1” (the set number of times) (that is, compares the counted number of multiplication remainder operations with the set number of times, It is determined whether or not it is abnormal based on the comparison result. That is, in the example of FIG. 2, it is determined whether or not the number of operations of modular multiplication is “1”. When the coprocessor 11 determines that ct is “1” (step S9: YES), the coprocessor 11 determines that there is an abnormality (abnormality detection) and performs error processing (step S10). That is, when the number of operations of the modular multiplication operation is “1”, it is assumed that the attack is performed at the timing when the modular multiplication operation is performed only once, and thus error processing is performed. In this error processing, for example, the coprocessor 11 outputs an alarm to the CPU 10 (for example, outputs a message indicating that an abnormality such as an attack has occurred), and ends the processing shown in FIG. ). Alternatively, in error processing, the coprocessor 11 may stop the operation.

CPU10は、コプロセッサ11からの警報出力を入力した場合、ICチップ1aの動作を停止、またはICチップ1aにおいて起動中の特定のプログラムの動作を停止する。或いは、この場合、CPU10は、外部端末2へエラー応答を送信する。エラー応答は、ICチップ1a内でエラーが発生したことを示す。なお、CPU10は、ICチップ1aまたは上記特定のプログラムの動作を停止すると共に、外部端末2へエラー応答を送信してもよい。   When the alarm output from the coprocessor 11 is input, the CPU 10 stops the operation of the IC chip 1a, or stops the operation of a specific program being activated in the IC chip 1a. Alternatively, in this case, the CPU 10 transmits an error response to the external terminal 2. The error response indicates that an error has occurred in the IC chip 1a. The CPU 10 may stop the operation of the IC chip 1a or the specific program and transmit an error response to the external terminal 2.

一方、ステップ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 coprocessor 11 determines in step S9 that ct is not “1” (step S9: NO), S (the value finally stored in the S register) calculated by repetitive calculation; The verification unit determines whether or not M (a value stored in the M register) to be encrypted by the power-residue calculation matches (step S11). Thereby, the input C is verified. If the coprocessor 11 determines that S and M match (step S11: YES), the coprocessor 11 outputs a message indicating the verification success to the CPU 10 (step S12), and ends the processing shown in FIG. On the other hand, if the coprocessor 11 determines that S and M do not match (step S11: NO), the coprocessor 11 outputs a message indicating a verification failure to the CPU 10 (step S13), and ends the process shown in FIG. The CPU 10 performs processing according to the verification success or the verification failure from the coprocessor 11. In addition, you may comprise so that CPU10 may perform the process of step S11. In this case, when the coprocessor 11 determines that ct is not “1” (step S9: NO), the coprocessor 11 outputs S (the value finally stored in the S register) calculated by the repetitive calculation to the CPU 10. It will be.

以上説明したように、上記実施例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 coprocessor 11 may determine whether or not ct is less than k. If ct is less than k, error processing may be performed. With this configuration, it is possible to grasp the number of times that an iterative operation has been performed when the binary method is used in the power-residue operation, so that it is possible to detect the possibility of being attacked during the operation.

(実施例2)
次に、図3を参照して、コプロセッサ11により実行される復号処理を説明する。図2に示す復号処理は、繰り返し演算において乗算剰余演算の演算回数が“e=1となるビットの数”でない場合に異常であると判定する例である。なお、図3に示すステップS29以外の処理は、図2に示す処理と同様であるので、重複する説明を省略する。ステップS29では、コプロセッサ11は、ctが“e=1となるビットの数”であるか否かを判定する。そして、コプロセッサ11は、ctが“e=1となるビットの数”であると判定した場合(ステップS29:YES)、ステップS31へ進んで、検証を行う。一方、コプロセッサ11は、ctが“e=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 coprocessor 11 will be described with reference to FIG. The decoding process shown in FIG. 2 is an example in which it is determined that there is an abnormality when the number of operations of the modular multiplication is not “the number of bits where e j = 1” in the iterative operation. Note that the processes other than step S29 shown in FIG. 3 are the same as the processes shown in FIG. In step S29, the coprocessor 11 determines whether or not ct is “the number of bits for which e j = 1”. If the coprocessor 11 determines that ct is “the number of bits for which e j = 1” (step S29: YES), the coprocessor 11 proceeds to step S31 and performs verification. On the other hand, if the coprocessor 11 determines that ct is not “the number of bits for which e j = 1” (step S29: NO), the coprocessor 11 proceeds to step S30 and performs error processing. For example, when the public key exponent e = 65537, this binary number representation is “10000000000000000001”, and “1” is set in 2 bits out of 17 bits. If so, the value of ct should be “2” in step S29. Therefore, if ct is not “2”, the coprocessor 11 determines that there is an abnormality (abnormality detection) and performs error processing.

以上説明したように、上記実施例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 1a IC chip 10 CPU
11 Coprocessor 12 ROM
13 RAM
14 Nonvolatile memory 15 I / O circuit

Claims (5)

バイナリ法を用いてS=Cmodnの演算を行う、べき乗剰余演算装置において、
複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、
前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、
記乗算剰余演算の演算回数をカウントするカウント手段と、
前記カウント手段によりカウントされた前記演算回数と、e =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
Counting means for counting the number of operations before Symbol modular multiplication,
The number of operations counted by the counting means is compared with the number of times set to the number of bits where e i = 1, and it is abnormal if the number of operations is not the set number of times based on the comparison result. determination means that there is,
Processing means for performing error processing when it is determined that the determination means is abnormal;
A power-residue calculating device comprising:
前記Cは検証対象データ、前記eは公開鍵指数、前記nは公開鍵モジュラスであり、
前記判定手段により異常でないと判定された場合において前記繰り返し演算により算出された前記Sと、べき乗剰余演算による暗号化の対象となる平文データとが一致するか否かを判定することにより前記Cの検証を行う検証手段を更に備えることを特徴とする請求項1に記載のべき乗剰余演算装置。
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.
バイナリ法を用いてS=Cmodnの演算を行うICカードにおいて、
複数ビットで表現される正の整数であるC、e、及びnを入力する入力手段と、
前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行う演算手段と、
記乗算剰余演算の演算回数をカウントするカウント手段と、
前記カウント手段によりカウントされた前記演算回数と、e =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
Counting means for counting the number of operations before Symbol modular multiplication,
The number of operations counted by the counting means is compared with the number of times set to the number of bits where e i = 1, and it is abnormal if the number of operations is not the set number of times based on the comparison result. determination means that there is,
Processing means for performing error processing when it is determined that the determination means is abnormal;
An IC card comprising:
バイナリ法を用いてS=Cmodnの演算を行うコンピュータにより実行されるべき乗剰余演算方法であって、
複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、
前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、
記乗算剰余演算の演算回数をカウントするステップと、
前記カウントされた前記演算回数と、e =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
A step of counting the number of operations before Symbol modular multiplication,
The counted number of operations is compared with the set number of times set to the number of bits where e i = 1, and it is determined that there is an abnormality when the number of operations is not the set number of times based on the comparison result A determination step to:
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:
バイナリ法を用いてS=Cmodnの演算を行うコンピュータに、
複数ビットで表現される正の整数であるC、e、及びnを入力するステップと、
前記eを2進数表現e(k(eのビット長)>i≧0)としたときに、k回の二乗剰余演算と、e=1となるビットの数と等しい回数の乗算剰余演算との繰り返し演算を行うステップと、
記乗算剰余演算の演算回数をカウントするステップと、
前記カウントされた前記演算回数と、e =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
A step of counting the number of operations before Symbol modular multiplication,
The counted number of operations is compared with the set number of times set to the number of bits where e i = 1, and it is determined that there is an abnormality when the number of operations is not the set number of times based on the comparison result A determination step to:
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
JP2014127864A 2014-06-23 2014-06-23 Power residue calculation device, IC card, power residue calculation method, and power residue calculation program Active JP6354376B2 (en)

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 JP2016008994A (en) 2016-01-18
JP6354376B2 true 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)

Family Cites Families (8)

* Cited by examiner, † Cited by third party
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
TW586086B (en) * 2002-12-27 2004-05-01 Ind Tech Res Inst Method and apparatus 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
KR100652377B1 (en) * 2004-08-06 2007-02-28 삼성전자주식회사 A modular exponentiation algorithm, a record device including the algorithm and a system using the algorithm
JP5261088B2 (en) * 2008-09-09 2013-08-14 富士通株式会社 Unauthorized operation detection circuit, device provided with unauthorized operation detection circuit, and unauthorized operation detection method
EP2222013A1 (en) * 2009-02-19 2010-08-25 Thomson Licensing Method and device for countering fault attacks
EP2779519A1 (en) * 2013-03-11 2014-09-17 Thomson Licensing A method and a device for fault-resistant exponentiation in cryptographic systems

Also Published As

Publication number Publication date
JP2016008994A (en) 2016-01-18

Similar Documents

Publication Publication Date Title
US8402287B2 (en) Protection against side channel attacks
US8065531B2 (en) Decryption method
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
US10721056B2 (en) Key processing method and device
CN105991292A (en) Systems and methods for operating secure elliptic curve cryptosystems
JP4568886B2 (en) Method for securely implementing an RSA type cryptographic algorithm and corresponding components
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
EP1237322A2 (en) Fault detection method for cryptographic process
JP5261088B2 (en) Unauthorized operation detection circuit, device provided with unauthorized operation detection circuit, and unauthorized operation detection method
EP2996033A1 (en) System and method for one-time Chinese-remainder-theorem exponentiation for cryptographic algorithms
EP3503459B1 (en) Device and method for protecting execution of a cryptographic operation
US8744074B2 (en) Method and device for countering fault attacks
Kaminaga et al. Double Counting in $2^{t} $-ary RSA Precomputation Reveals the Secret Exponent
JP6354376B2 (en) Power residue calculation device, IC card, power residue calculation method, and power residue calculation program
Le et al. On double exponentiation for securing RSA against fault analysis
EP3461053A1 (en) Fault attacks counter-measures for eddsa
US7174016B2 (en) Modular exponentiation algorithm in an electronic component using a public key encryption algorithm
JP3952304B2 (en) How to implement a cryptographic algorithm for finding public exponents in electronic components
Sun et al. An efficient modular exponentiation algorithm against simple power analysis attacks
US10305678B2 (en) Imbalanced montgomery ladder
Feix et al. Recovering CRT-RSA secret keys from message reduced values with side-channel analysis

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 Written amendment

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