JP5214317B2 - Cryptographic processing apparatus, cryptographic processing method, and computer program - Google Patents

Cryptographic processing apparatus, cryptographic processing method, and computer program Download PDF

Info

Publication number
JP5214317B2
JP5214317B2 JP2008116189A JP2008116189A JP5214317B2 JP 5214317 B2 JP5214317 B2 JP 5214317B2 JP 2008116189 A JP2008116189 A JP 2008116189A JP 2008116189 A JP2008116189 A JP 2008116189A JP 5214317 B2 JP5214317 B2 JP 5214317B2
Authority
JP
Japan
Prior art keywords
processing
numerical data
physical quantity
unit
updating
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
JP2008116189A
Other languages
Japanese (ja)
Other versions
JP2009267839A (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.)
NTT Data Corp
Original Assignee
NTT Data 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 NTT Data Corp filed Critical NTT Data Corp
Priority to JP2008116189A priority Critical patent/JP5214317B2/en
Publication of JP2009267839A publication Critical patent/JP2009267839A/en
Application granted granted Critical
Publication of JP5214317B2 publication Critical patent/JP5214317B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、暗号処理の際のセキュリティ技術に関し、特にサイドチャネル攻撃により秘密情報が漏洩することを防止する暗号処理技術に関する。   The present invention relates to a security technique at the time of cryptographic processing, and more particularly to a cryptographic processing technique for preventing secret information from leaking due to a side channel attack.

ICカードのように高度なセキュリティ性が要求される暗号モジュールは、所要の処理を実行するときの消費電力や電磁波のような物理量の変化パタン(以下、「サイドチャネル情報」という。)の解析により、秘密鍵が漏洩する(以下、「サイドチャネル攻撃」という。)ことが知られている。
そのため、サイドチャネル攻撃への対処が重要になってくる。例えば、RSA(ISO/IEC 18033-2などで標準化)やDSA(FIPS PUB 186-2で規定)のようなデジタル署名アルゴリズムを実装する際には、鍵生成処理や署名生成処理などにおいて、べき乗剰余演算(Modular exponentiation)が行われるが、このべき乗剰余演算処理の過程から、サイドチャネル攻撃によって秘密鍵が漏洩する可能性があることが知られている。
An encryption module such as an IC card that requires a high level of security is based on an analysis of power consumption and a change pattern of a physical quantity such as an electromagnetic wave (hereinafter referred to as “side channel information”) when executing a required process. It is known that the secret key is leaked (hereinafter referred to as “side channel attack”).
Therefore, it is important to deal with side channel attacks. For example, when a digital signature algorithm such as RSA (standardized by ISO / IEC 18033-2) or DSA (specified by FIPS PUB 186-2) is implemented, a power residue is used in key generation processing or signature generation processing. Although computation (Modular exponentiation) is performed, it is known that there is a possibility that a secret key may be leaked by a side channel attack from the process of power residue computation.

べき乗剰余演算は、「t=g^k mod p」で表され、「g」をk乗した結果を「p」で除算したときの剰余を算出する演算である。べき乗剰余演算の処理過程からサイドチャネル攻撃による秘密鍵の漏洩を防止する方法として、擬似演算処理(以下、擬似乗算の処理を「ダミー乗算処理」、擬似減算の処理を「ダミー減算処理」、これらの処理を区別する必要のない場合は「ダミー演算処理」と称する。)を行う方法、「g」のスクランブル(BlindingやDuplicate Method)、「p」の変換、べき数「k」のスクランブル、エンコードなどが知られている。   The power-residue operation is represented by “t = g ^ k mod p”, and is an operation for calculating a remainder when the result of “g” raised to the power of k is divided by “p”. As a method of preventing leakage of a secret key due to side channel attack from the process of power-residue calculation, pseudo arithmetic processing (hereinafter referred to as “dummy multiplication processing” as pseudo multiplication processing and “dummy subtraction processing” as pseudo subtraction processing, these If it is not necessary to distinguish between the processes, it is called “dummy operation process”), “g” scrambling (Blinding or Duplicate Method), “p” conversion, power “k” scrambling, encoding Etc. are known.

ダミー演算処理、例えばダミー乗算処理を用いる方法は、べき乗剰余演算の途中に本来は不要な乗算処理を実行して、べき乗剰余演算の実行過程を観察することで得られるサイドチャネル情報を、対策を施さない場合の処理のときと異なるものとすることで、べき数kの漏洩を防止する。
特許文献1は、このようなダミー乗算を用いてサイドチャネル攻撃による秘密鍵の漏洩を防止する例である。
特開2007−316491号公報
A method using a dummy arithmetic process, for example, a dummy multiplication process, takes measures against side channel information obtained by executing a multiplication process that is originally unnecessary in the middle of a power-residue operation and observing the execution process of the power-residue operation. By making it different from the case of processing when not applied, leakage of an exponent of k is prevented.
Patent Document 1 is an example in which leakage of a secret key due to a side channel attack is prevented using such dummy multiplication.
JP 2007-316491 A

「g」のスクランブルには、べき乗剰余演算を2つの演算処理に分けて実行する方式(Duplicate Method)がある。この方式は、「g=g1*g2 mod p」となるランダムに定めた2つベースg1、g2について、それぞれ「t1=g1^k mod p」と「t2=g2^k mod p」とを求め、最後に「t=t1*t2 mod p」とする。   For scrambling “g”, there is a method (Duplicate Method) in which the power-residue operation is divided into two operation processes. This method obtains “t1 = g1 ^ k mod p” and “t2 = g2 ^ k mod p” for two randomly defined bases g1 and g2, which are “g = g1 * g2 mod p”. Finally, “t = t1 * t2 mod p”.

「p」の変換とは、「p'=R*p」として、「t'=g^k mod p'」を求めた後に、「t=t' mod p」とする手法である。Rは乱数である。また、「k」のスクランブルは,乱数Rによって、「k'=k+R(p-1)」として,「t=g^k' mod p」とする手法である。   The conversion of “p” is a method of “t = t ′ mod p” after obtaining “t ′ = g ^ k mod p ′” as “p ′ = R * p”. R is a random number. The scrambling of “k” is a method of setting “t = g ^ k ′ mod p” as “k ′ = k + R (p−1)” by the random number R.

このように、べき乗剰余演算に対するサイドチャネル攻撃への対策は、従来から多々講じられてきた。これは、べき乗剰余演算をよく知られたバイナリ法などで実装するとその実行過程を物理的に観察することで得られるサイドチャネル情報からダイレクトにべき数kを得ることができると知られていて、さらに、良く知られたRSAやDSAなどにおいては、べき数が得られることは、秘密鍵そのものが得られることと等価である。そのために、従来から、べき乗剰余演算に対するサイドチャネル攻撃への対策は、非常に重要であった。   As described above, many countermeasures against the side channel attack for the modular exponentiation have been conventionally taken. It is known that when the power-residue operation is implemented by a well-known binary method or the like, the exponent k can be obtained directly from the side channel information obtained by physically observing the execution process. Further, in well-known RSA, DSA, etc., obtaining a power number is equivalent to obtaining the secret key itself. For this reason, conventionally, countermeasures against side channel attacks against power-residue calculations have been very important.

その一方で、RSA鍵生成処理やDSA署名生成処理で実行される逆元演算については、実行過程から得られるサイドチャネル情報と秘密情報との関係が不明であったために、これまでは処理速度や実装面積などについての工夫しか施されておらず、秘密情報の漏洩防止の議論がなされていなかった。しかし、最近、発明者らの研究によって、逆元演算の入力データが漏洩することがわかった。   On the other hand, the inverse operation executed in the RSA key generation process and the DSA signature generation process is unknown because the relationship between the side channel information obtained from the execution process and the secret information is unknown. Only the device area was devised, and there was no discussion on how to prevent leakage of confidential information. However, recently, the inventors' research has revealed that the input data of the inverse operation is leaked.

逆元演算は、数値データa,b(aとbとは互いに素)を入力データとし、数値データvを出力データとして、「v=1/a mod b」で表すことができる。拡張2進GCD法による逆元演算は、主に、加減算処理とシフト処理(例えば「2」による除算)や「2」による乗算)との組み合わせで行われる。
以下、説明の便宜上、入力データbを奇数とする。
The inverse element calculation can be expressed as “v = 1 / a mod b” with numerical data a and b (a and b are relatively prime) as input data and numerical data v as output data. The inverse element calculation by the extended binary GCD method is mainly performed by a combination of addition / subtraction processing and shift processing (for example, division by “2” or multiplication by “2”).
Hereinafter, for convenience of explanation, it is assumed that the input data b is an odd number.

まず、入力データである数値データa,bの初期値をa0,b0とする。数値データa,bの少なくとも一方が偶数であれば偶数である方の数値データにシフト処理(2による除算)を行って数値データa,bを更新する。数値データa,bの両方が奇数ならば、大きい数値データから小さい数値データを減算して大きい数値データを更新する。その際、初期値である下記の2行2列の行列データGと、初期値0である数値データgに数値データa,bに行った更新に対応する演算を行う。   First, initial values of numerical data a and b as input data are set to a0 and b0. If at least one of the numerical data a and b is an even number, the even numerical data is shifted (division by 2) to update the numerical data a and b. If both the numerical data a and b are odd numbers, the large numerical data is updated by subtracting the small numerical data from the large numerical data. At this time, an operation corresponding to the update performed on the numerical data a and b is performed on the matrix data G of the following 2 rows and 2 columns as the initial value and the numerical data g which is the initial value 0.

Figure 0005214317

なお、説明の便宜上、上記の行列を[1,0;0,1]と表現する。例えば、行列[a;b]は下記のような2行1列の行列である。
Figure 0005214317

For convenience of explanation, the above matrix is expressed as [1,0; 0,1]. For example, the matrix [a; b] is a matrix with 2 rows and 1 column as follows.

Figure 0005214317
Figure 0005214317

数値データの更新は、次のように行う。但し、a,b,gは、数値データa,b,g、Gは行列データGである(以下、本明細書において同じ)。
aをシフトする場合は、G=[1,0;0,2]*Gとg=g+1、
bをシフトする場合は、G=[2,0;0,1]*Gとg=g+1、
a=a−bを行う場合は、G=[1,-1;0,1]*G、
b=b−aを行う場合は、G=[1,0;-1,1]*G。
これにより、a,b,G,gとの間には、下記の関係が保たれる。
「a*2^g=G[1,1]*a0+G[1,2]*b0」
「b*2^g=G[2,1]*a0+G[2,2]*b0」
この2つの式は、行列表現すると、下記のようになる。
[a;b]*2^g=G*[a0;b0]。
The numerical data is updated as follows. However, a, b, and g are numerical data a, b, g, and G are matrix data G (hereinafter the same in this specification).
When shifting a, G = [1,0; 0,2] * G and g = g + 1,
When shifting b, G = [2,0; 0,1] * G and g = g + 1,
When performing a = a−b, G = [1, -1; 0,1] * G,
When performing b = ba, G = [1,0; -1,1] * G.
Thereby, the following relationship is maintained between a, b, G, and g.
“A * 2 ^ g = G [1,1] * a0 + G [1,2] * b0”
“B * 2 ^ g = G [2,1] * a0 + G [2,2] * b0”
These two expressions can be expressed as a matrix as follows.
[a; b] * 2 ^ g = G * [a0; b0].

このようなシフト処理と減算処理との組み合わせを数値データbが「0」になるまで続ける。そのとき、aはa0とb0の最大公約数である「1」となる。その後、出力データvの初期値としてG[1,1]を設定しておき、このvをg回「2」除算し、「2」で割り切れない場合には数値データbの初期値であるb0を加算する。
このようにして求めた出力データvが、「1/a mod b」となる値である。
Such a combination of shift processing and subtraction processing is continued until the numerical data b becomes “0”. At that time, a becomes “1” which is the greatest common divisor of a0 and b0. Thereafter, G [1,1] is set as the initial value of the output data v, and when v is divided by “2” g times and cannot be divided by “2”, b0 which is the initial value of the numerical data b Is added.
The output data v obtained in this way is a value that is “1 / a mod b”.

逆元2進GCD法の主たる演算である減算処理とシフト処理とでは、処理の中味が異なるため,この違いが処理時間あるいは消費電力など何かしらの物理量の変化パターンの違いとなって観察できる場合がある。図7aは消費電力の時間変化を表したグラフで、処理時間は同じだが消費電力が異なる場合の例である。減算処理時の消費電力がシフト処理時の消費電力よりも大きいために、消費電力の変化パタンから、減算処理とシフト処理とを区別することができ、サイドチャネル情報が得られる。このサイドチャネル情報に所定の変換アルゴリズムを適用すれば、数値データaなどの逆元の入力データを得ることができる。そして、べき乗剰余演算のべき数kと同様に、RSAの鍵生成処理やDSAの署名生成処理において逆元演算の入力データが得られることは秘密鍵そのものが得られることと等価である。   The subtraction process and the shift process, which are the main operations of the inverse binary GCD method, differ in the contents of the process, so this difference may be observed as a change pattern of some physical quantity such as processing time or power consumption. is there. FIG. 7a is a graph showing the change in power consumption over time, and is an example in which the processing time is the same but the power consumption is different. Since the power consumption during the subtraction process is larger than the power consumption during the shift process, the subtraction process and the shift process can be distinguished from the power consumption change pattern, and side channel information can be obtained. If a predetermined conversion algorithm is applied to this side channel information, inverse original input data such as numerical data a can be obtained. Similarly to the exponent k of the power-residue operation, obtaining the input data of the inverse operation in the RSA key generation processing or the DSA signature generation processing is equivalent to obtaining the secret key itself.

本発明は、上記の問題に鑑み、逆元演算を実行する際に表れるサイドチャネル情報から秘密情報が漏洩されることを防止する新規な暗号処理技術を提供することを、その課題とするものである。   In view of the above problems, an object of the present invention is to provide a new cryptographic processing technique for preventing secret information from being leaked from side channel information that appears when performing an inverse element operation. is there.

本発明は、上記の課題を解決するために、暗号処理装置、暗号処理方法及びコンピュータプログラムを提供する。
本発明の暗号処理装置は、メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら逆元演算を実行する暗号処理装置において、前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しない擬似演算処理を少なくとも1つ付加的に実行する冗長処理手段を設けたことを特徴とする。
この暗号処理装置では、逆元演算の実行過程で、冗長処理が付加的に実行されるので通常処理により得られる物理量の変化パタンとは異なる変化パタンが生じる。サイドチャネル情報から秘密情報を得ようとする者は、この変化パタンからサイドチャネル情報を得ることになるが、サイドチャネル情報に冗長処理による情報が含まれるため、物理量の変化パタンを観測するだけでは秘密情報を得ることができなくなる。
The present invention provides a cryptographic processing apparatus, a cryptographic processing method, and a computer program in order to solve the above-described problems.
Cryptographic processing apparatus of the present invention, the numerical data stored in the memory, the outside of the apparatus from the perceptible physical quantity different kinds of change patterns each other arithmetic processing by updating encryption process to run the inverse operation with device in, before or after the at least one processing of a series of processing for updating the numerical data by the inverse operation to be executed pseudo processing without updating the results of those該演 calculation processing at least one additionally Redundant processing means is provided.
In this cryptographic processing apparatus, a redundant pattern is additionally executed in the course of executing the inverse operation, so that a change pattern different from the change pattern of the physical quantity obtained by the normal process occurs. A person who wants to obtain secret information from side channel information will obtain side channel information from this change pattern, but since side channel information includes information by redundant processing, simply observing the change pattern of physical quantity Confidential information cannot be obtained.

また、ダミー演算処理は、数値データを更新しないので、逆元演算の最終処理結果に影響を与えることなく、つまり、最終処理結果を有効なものとしつつ、実行過程で生じる物理量の変化を通常処理時と異なるパタンに変容させることができる。更新しない複数種類の演算処理のいずれかにより生じる物理量の変化パタンを、通常処理時の物理量の変化と同じにすれば、ダミー演算処理による変化パタンか、通常処理による変化パタンかの区別がつかなくなるため、変化パタンから秘密情報が漏洩する可能性をより低くすることができる。 In addition, since the dummy calculation processing does not update the numerical data, it does not affect the final processing result of the inverse operation, that is, the normal processing of changes in physical quantities that occur during the execution process while making the final processing result effective. It can be transformed into a different pattern. If the change pattern of the physical quantity caused by one of the multiple types of computation processing that is not updated is the same as the change of the physical quantity during normal processing, it will not be possible to distinguish between the change pattern of the dummy computation processing and the change pattern of the normal processing. Therefore, the possibility that secret information is leaked from the change pattern can be further reduced.

第1の態様での冗長処理手段は、また、2つの前記数値データの大小を判別する大小判別手段と、前記2つの数値データのそれぞれが奇数か偶数かを判別する奇数・偶数判別手段とを備え、前記大小判別手段による判別結果及び前記奇数・偶数判別手段による判別結果の組み合わせが所定の条件を満たすときに前記ダミー演算処理の実行を開始するものであって、前記所定の条件とは、前記装置外部から認知可能な物理量の変化パタンが所定のパタンになるような条件であるように構成することができる。これにより、ダミー演算処理が付加的に実行されるタイミングを適切に定めることができる。 The redundancy processing means in the first aspect further comprises: a magnitude discrimination means for discriminating the magnitude of the two numeric data; and an odd / even discrimination means for discriminating whether each of the two numeric data is odd or even. The dummy calculation process is started when a combination of the determination result by the magnitude determination unit and the determination result by the odd / even determination unit satisfies a predetermined condition, and the predetermined condition is: The physical quantity change pattern recognizable from the outside of the apparatus can be configured to be a predetermined pattern . Thereby, it is possible to appropriately determine the timing at which the dummy arithmetic processing is additionally executed.

発明の暗号処理方法は、メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理によって更新しながら逆元演算を実行する装置が行う暗号処理方法であって、前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しないダミー演算処理を少なくとも1つ付加的に実行することを特徴とする。 The cryptographic processing method according to the present invention is a cryptographic process performed by a device that performs inverse element computation while updating numerical data recorded in a memory by a plurality of types of computation processing having different physical quantity change patterns that can be recognized from outside the device. a method, before or after a series of at least one arithmetic processing of the arithmetic processing for updating the numerical data by the inverse operation, at least one additional dummy operation processing without updating the results of those該演 calculation process It is characterized by being executed.

本発明のコンピュータプログラムは、メモリを有するコンピュータを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら逆元演算を実行する暗号処理装置として動作させるためのコンピュータプログラムであって、前記コンピュータを、前記メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら実行し、前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しない擬似演算処理を少なくとも1つ付加的に実行する冗長処理手段として機能させる、コンピュータプログラムである。
Computer program of the present invention, a computer having a memory, for operating a perceptible physical quantity plurality of types change patterns are different from each other in the processing by the update cryptographic processing apparatus that perform inverse operation while from outside the device The computer program is executed while updating the numerical data recorded in the memory by a plurality of types of arithmetic processes having different physical quantity change patterns that can be recognized from outside the apparatus , and the inverse element calculation before or after the at least one processing of a series of processing for updating the numeric data by, to function pseudo processing without updating the results of those該演 calculation processing as a redundant processing unit for executing at least one additionally A computer program.

本発明によれば、冗長処理を付加的に実行しつつ逆元演算による最終実行結果を有効なものとすることで、逆元演算の実行過程で生じる物理量の変化パタンが、冗長処理が存在しない場合の処理(以下、冗長処理が存在する場合と区別するために「通常処理」と称する場合がある。)と異なるパタンに変容するので、この変化パタンが外部に認知されても、逆元演算がどのように行われたかを解析することができなくなるという特有の効果が得られる。   According to the present invention, by making the final execution result by the inverse element operation effective while additionally executing the redundancy process, the change pattern of the physical quantity generated in the execution process of the inverse element operation has no redundancy process. Change to a different pattern from the process in the case (hereinafter, sometimes referred to as “normal process” in order to distinguish it from the case where the redundant process exists), so that the inverse operation is performed even if this changed pattern is recognized externally. A unique effect is obtained in that it is impossible to analyze how the process is performed.

以下、本発明を、高セキュリティ性のICカードなどの暗号モジュールに適用した場合の実施の形態例を、図面を参照して説明する。
図1は、この実施形態による暗号モジュールのハードウェア構成図である。この暗号モジュール1は、CPU(Central Processing Unit)10と、I/Oインタフェース20と、CPU10で実行される各種プログラムを格納するプログラムメモリ31及びプログラムの実行時に用いられるデータが格納されるデータメモリ32を含むメモリ30とをハードウエア資源として含み、I/Oインタフェース20を介して、図示しない外部装置と通信できるように構成される。暗号モジュール1は,外部装置との間で通信して,RSAやDSAなどのデジタル署名アルゴリズムで使用するパラメータやメッセージを受信し,処理結果を送信する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiments of the present invention applied to a cryptographic module such as a high security IC card will be described below with reference to the drawings.
FIG. 1 is a hardware configuration diagram of a cryptographic module according to this embodiment. The cryptographic module 1 includes a CPU (Central Processing Unit) 10, an I / O interface 20, a program memory 31 that stores various programs executed by the CPU 10, and a data memory 32 that stores data used when the programs are executed. And a memory 30 including hardware as a hardware resource, and configured to be able to communicate with an external device (not shown) via the I / O interface 20. The cryptographic module 1 communicates with an external device, receives parameters and messages used in digital signature algorithms such as RSA and DSA, and transmits processing results.

暗号モジュール1は、上記のハードウエア資源とプログラムメモリ31に格納された本発明のコンピュータプログラムとの協働により、特徴的な暗号処理を行うための種々の機能を実現する。図2は、このようにして実現される暗号モジュール1の機能ブロック図である。暗号モジュール1は、べき乗剰余演算部11、逆元演算部12、素数生成部13、乱数生成部14、RSA鍵生成部15、DSA署名生成部16、及び記憶部17の機能を実現する。   The cryptographic module 1 realizes various functions for performing characteristic cryptographic processing in cooperation with the above hardware resources and the computer program of the present invention stored in the program memory 31. FIG. 2 is a functional block diagram of the cryptographic module 1 realized in this way. The cryptographic module 1 realizes the functions of a power-residue calculation unit 11, an inverse element calculation unit 12, a prime number generation unit 13, a random number generation unit 14, an RSA key generation unit 15, a DSA signature generation unit 16, and a storage unit 17.

べき乗剰余演算部11は、「t=g^k mod p」で表されるべき乗剰余演算処理を行う。べき乗剰余演算部11は、従来と同様のサイドチャネル攻撃に対する対策が施されており、ダミー乗算、「g」のスクランブル、「p」の変換、「k」のスクランブル、エンコードなどを行う。   The power residue calculation unit 11 performs power residue calculation processing represented by “t = g ^ k mod p”. The power-residue calculating unit 11 is provided with countermeasures against side-channel attacks similar to those in the past, and performs dummy multiplication, “g” scrambling, “p” conversion, “k” scrambling, encoding, and the like.

逆元演算部12は、「v=1/k mod p」で表される逆元演算を行う。逆元演算部12は、判別部121、加減算処理部122、シフト処理部123、スクランブル部124、及び制御部125の機能ブロックを有する。
判別部121は、数値データの大小判別、数値データを「2」で除算したときの剰余の大小判別及び当該剰余による数値データの偶数、奇数の判別、数値データの符号の判別など、特徴的な逆元演算を実行する上で必要となる各種の判別を行う。判別部121は、この判別結果を制御部125に送る。
The inverse element calculation unit 12 performs an inverse element calculation represented by “v = 1 / k mod p”. The inverse element calculation unit 12 includes functional blocks of a determination unit 121, an addition / subtraction processing unit 122, a shift processing unit 123, a scramble unit 124, and a control unit 125.
The discriminating unit 121 has distinctive features such as the discrimination of the numeric data, the discrimination of the remainder when the numeric data is divided by “2”, the discrimination of the even and odd numbers of the numeric data based on the remainder, and the discrimination of the sign of the numeric data. Various determinations necessary for executing the inverse operation are performed. The determination unit 121 sends the determination result to the control unit 125.

加減算処理部122は、数値データの加算処理及び減算処理を行う。シフト処理部123は、数値データを「2」で除算及び乗算(シフト処理)する。スクランブル部124は、乱数生成部14で生成された乱数を用いて数値データのスクランブルを行う。制御部125は、判別部121の判別結果に応じて加減算処理部122及びシフト処理部123に加減算処理及びシフト処理を実行させる。制御部125は、判別結果により、減算処理のときは、どの数値データからどの数値データを減算するかを指示し、加算処理のときはどの数値データを用いた加算であるかを指示し、シフト処理のときは、どの数値データのシフト処理を行うかを指示する。   The addition / subtraction processing unit 122 performs addition processing and subtraction processing of numerical data. The shift processing unit 123 divides and multiplies numerical data by “2” (shift processing). The scrambler 124 scrambles the numerical data using the random number generated by the random number generator 14. The control unit 125 causes the addition / subtraction processing unit 122 and the shift processing unit 123 to perform addition / subtraction processing and shift processing according to the determination result of the determination unit 121. Based on the determination result, the control unit 125 instructs which numerical data is subtracted from which numerical data during the subtraction process, and indicates which numerical data is used for addition during the addition process. At the time of processing, it is instructed which numerical data to shift.

逆元演算部12は、上記の機能ブロックにより、逆元演算のサイドチャネル攻撃に対する種々の対策を実現する。例えば、判別部121、加減算処理部122、シフト処理部123、及び制御部125によるダミー演算処理(第1の対策)、スクランブル部125による数値データのスクランブルとその逆の手順による逆スクランブル(第2の対策)、及び、判別部121、加減算処理部122、シフト処理部123、及び制御部125による演算過程における大小判別のランダムなエラー又はノイズの混入とそのリカバリ(第3の対策)、の3つの対策を実現する。
逆元演算部12では、これら3つの対策の少なくとも1つにより(好適には、3つを組み合わせて)、サイドチャネル情報による秘密情報の漏洩を効果的に防止する。これらの詳細については、後述する。
The inverse element calculation unit 12 implements various countermeasures against the side channel attack of the inverse element calculation by the above-described functional blocks. For example, dummy calculation processing (first countermeasure) by the determination unit 121, addition / subtraction processing unit 122, shift processing unit 123, and control unit 125, scrambling of numerical data by the scramble unit 125, and descrambling by the reverse procedure (second) 3), and random error or noise mixing and recovery (third countermeasure) of the magnitude discrimination in the calculation process by the discrimination unit 121, the addition / subtraction processing unit 122, the shift processing unit 123, and the control unit 125 Realize one measure.
The inverse element calculation unit 12 effectively prevents leakage of secret information due to side channel information by using at least one of these three measures (preferably by combining three). Details of these will be described later.

素数生成部13は、RSA鍵生成処理のときに用いる素数を生成し、乱数生成部14は、DSA署名処理のときに用いる乱数を生成する。   The prime number generation unit 13 generates a prime number used in the RSA key generation process, and the random number generation unit 14 generates a random number used in the DSA signature process.

RSA鍵生成部15は、べき乗剰余演算部11、逆元演算部12、及び素数生成部13を用いてRSA鍵を生成する。このRSA鍵の生成処理は、例えば図3の処理手順で行われる。まず、パラメータとして「e」及び素数p、qのサイズを、I/Oインタフェース20を介して外部装置から取得する(ステップS100)。「e」は、システムの固定値の場合が多い。代表的な例として「e=2^16+1」である。
次に、パラメータとして取得したサイズを満たす素数p、qを、素数生成部13で生成する(ステップS110)。素数p、qは、「gcd(e,p-1)=1」、「gcd(e,q-1)」を満たす。これらを用いて逆元演算部12で、「d=1/e mod lcm(p-1,q-1))」を行い、「d」を求める(ステップS120)。また、素数p、qの積nを算出する。これにより、公開鍵(e,n)、秘密鍵(d,p,q)が得られる(ステップS130)。
The RSA key generation unit 15 generates an RSA key using the power-residue calculation unit 11, the inverse element calculation unit 12, and the prime number generation unit 13. This RSA key generation processing is performed, for example, according to the processing procedure of FIG. First, “e” as a parameter and sizes of prime numbers p and q are acquired from the external device via the I / O interface 20 (step S100). “E” is often a fixed value of the system. A typical example is “e = 2 ^ 16 + 1”.
Next, prime numbers p and q satisfying the size acquired as a parameter are generated by the prime number generation unit 13 (step S110). The prime numbers p and q satisfy “gcd (e, p−1) = 1” and “gcd (e, q−1)”. Using these, the inverse element calculation unit 12 performs “d = 1 / e mod lcm (p−1, q−1))” to obtain “d” (step S120). Further, the product n of the prime numbers p and q is calculated. Thereby, the public key (e, n) and the secret key (d, p, q) are obtained (step S130).

DSA署名生成部16は、べき乗剰余演算部11、逆元演算部12、及び乱数生成部14によりDSA署名処理を行う。DSA署名生成処理は、例えば図4の処理手順で行われる。まず、メッセージMをI/Oインタフェース20を介して外部装置から取得する(ステップS200)。また、署名生成鍵(秘密鍵)xを取得する。公開パラメータを(g,p,q)とする。次に、べき数kを乱数発生部14で生成する(ステップS210)。べき数kは(0<k<q)の範囲にある乱数である。次に、べき乗剰余演算部11でべき乗剰余演算「(g^k mod p) mod q」を行い、署名データの一つである「r」を求める(ステップS220)。次に、べき数kの逆元k’を逆元演算部12で算出する「k'=1/k mod p)」(ステップS230)。次に署名sを求める。署名sは、「s=k'・(SHA1(M)+xr) mod q」により求められる(ステップS240)。以上の手順により、署名データ(r,s)を得る(ステップS250)。   The DSA signature generation unit 16 performs DSA signature processing using the power-residue calculation unit 11, the inverse element calculation unit 12, and the random number generation unit 14. The DSA signature generation process is performed, for example, according to the process procedure of FIG. First, the message M is acquired from an external device via the I / O interface 20 (step S200). Also, a signature generation key (secret key) x is acquired. The public parameter is (g, p, q). Next, the power k is generated by the random number generator 14 (step S210). The power number k is a random number in the range (0 <k <q). Next, the power-residue calculation unit 11 performs a power-residue calculation “(g ^ k mod p) mod q” to obtain “r” as one of the signature data (step S220). Next, the inverse element k ′ of the exponent k is calculated by the inverse element calculation unit 12 “k ′ = 1 / k mod p)” (step S230). Next, the signature s is obtained. The signature s is obtained by “s = k ′ · (SHA1 (M) + xr) mod q” (step S240). The signature data (r, s) is obtained by the above procedure (step S250).

記憶部17は、暗号モジュール1で実行する各種処理に用いる数値データ、メッセージ、パラメータなどを格納するメモリである。特に、この実施形態では、逆元演算部12により行われる逆元演算で更新の対象となる数値データ、逆元演算の実行過程で生成される一時データを格納する。   The storage unit 17 is a memory that stores numerical data, messages, parameters, and the like used for various processes executed by the cryptographic module 1. In particular, in this embodiment, numerical data to be updated by the inverse element calculation performed by the inverse element calculation unit 12 and temporary data generated during the execution of the inverse element calculation are stored.

RSA鍵生成部15で行うRSA鍵生成処理及びDSA署名生成部16で行うDSA署名生成処理は、いずれも逆元演算をその処理内容に含む。逆元演算では、上記の通り、サイドチャネル攻撃に対する第1〜第3の対策を施す。以下の説明では、逆元演算を拡張2進GCD法により実行する場合を例として、第1〜第3の対策について説明する。   The RSA key generation process performed by the RSA key generation unit 15 and the DSA signature generation process performed by the DSA signature generation unit 16 both include an inverse operation in its processing content. In the inverse operation, as described above, the first to third measures against the side channel attack are taken. In the following description, the first to third measures will be described by taking as an example the case where the inverse element operation is executed by the extended binary GCD method.

<第1の対策>
第1の対策としては、加減算処理部122による減算処理を、逆元演算に必要な通常処理の他にダミー演算処理、例えばダミー減算処理として周期的に行うことで、シフト処理部123によるシフト処理の連続実行回数を固定して行う。
ダミー減算処理も通常処理(ダミーでない通常の(減算)処理)と同じ処理内容なので、物理量の一例となる消費電力の変化パタンは同じである。判別部121が、数値データの大小判別結果及び数値データの偶数、奇数判別を行い、この判別結果により制御部125が加減算処理部122による減算処理とシフト処理部123によるシフト処理とを行うが、シフト処理を連続して決まった回数行わせた後に通常処理又はダミー減算処理を必ず行う。
通常処理もダミー減算処理も同じ消費電力となるので、サイドチャネル情報では、どちらの処理なのかは区別できない。そのために、サイドチャネル情報からの秘密鍵情報の漏洩を防止できる。例えば、シフト処理の連続実行回数を1回に固定して、シフト処理が終了する度に通常処理又はダミー減算処理を行う。
そのための最も安易な方法は、シフト処理が連続する場合には、連続するシフト処理の間に毎回ダミー減算処理を入れることである。
<First measure>
As a first countermeasure, the subtraction process by the addition / subtraction processing unit 122 is periodically performed as a dummy calculation process, for example, a dummy subtraction process in addition to the normal process necessary for the inverse element calculation, so that the shift process by the shift processing unit 123 is performed. This is done with a fixed number of consecutive executions.
Since the dummy subtraction processing is the same as the normal processing (normal (subtraction) processing that is not a dummy), the power consumption change pattern as an example of the physical quantity is the same. The determination unit 121 performs the numerical data size determination result and the numerical data even number and odd number determination, and the control unit 125 performs the subtraction processing by the addition / subtraction processing unit 122 and the shift processing by the shift processing unit 123 based on the determination result. The normal process or the dummy subtraction process is always performed after the shift process is continuously performed a predetermined number of times.
Since normal processing and dummy subtraction processing consume the same power, the side channel information cannot distinguish which processing. Therefore, leakage of secret key information from side channel information can be prevented. For example, the number of continuous executions of the shift process is fixed to 1 and the normal process or the dummy subtraction process is performed every time the shift process is completed.
The easiest method for this is to insert a dummy subtraction process every time between successive shift processes when the shift process is continued.

以下のアルゴリズムでは、シフト処理と、通常処理又はダミー減算処理とを交互に実行できる。図5は、このアルゴリズムのフローチャートである。これにより、通常処理又はダミー減算処理と、シフト処理とが交互に行われ、結果として、シフト処理の連続実行回数は1回に固定される。このアルゴリズムにおいて数値データaは、べき乗剰余演算のべき数kと同様に、漏洩すると秘密鍵の暴露につながる情報である。また、アルゴリズム中の「t=a-b」、「t=b-a」、及び「t=v+b0」がダミー減算処理である。   In the following algorithm, shift processing and normal processing or dummy subtraction processing can be executed alternately. FIG. 5 is a flowchart of this algorithm. As a result, the normal process or dummy subtraction process and the shift process are alternately performed. As a result, the number of continuous executions of the shift process is fixed to one. In this algorithm, the numerical data “a” is information that, if leaked, leads to the disclosure of the secret key, like the exponent k of the power-residue calculation. Further, “t = a−b”, “t = b−a”, and “t = v + b0” in the algorithm are dummy subtraction processes.

INPUT:(a,b), OUTPUT: v,
begin
b0=b; G=[1,0;0,1]; g=0;
while(b>0){
if(a>b){
if(a%2<b%2){ t=a-b; T=[1,-1;0,1]*G; }
else{ a=a-b; G=[1,-1;0,1]*G; }
if(a%2==0){ a=a/2; G=[1,0;0,2]*G; g=g+1; }else
if(b%2==0){ b=b/2; G=[2,0;0,1]*G; g=g+1; }
}else{
if(b%2<a%2){ t=b-a; T=[1,0;-1,1]*G; }
else{ b=b-a; G=[1,0;-1,1]*G; }
if(a%2==0){ a=a/2; G=[1,0;0,2]*G; g=g+1; }else
if(b%2==0){ b=b/2; G=[2,0;0,1]*G; g=g+1; }
}
}
v=G[1,1];
while(g>0){
if(v%2!=0){ v=v+b0; }else{ t=v+b0; } v=v/2; g=g-1;
}
return(v);
end;
INPUT: (a, b), OUTPUT: v,
begin
b0 = b; G = [1,0; 0,1]; g = 0;
while (b> 0) {
if (a> b) {
if (a% 2 <b% 2) {t = ab; T = [1, -1; 0,1] * G;}
else {a = ab; G = [1, -1; 0,1] * G;}
if (a% 2 == 0) {a = a / 2; G = [1,0; 0,2] * G; g = g + 1;} else
if (b% 2 == 0) {b = b / 2; G = [2,0; 0,1] * G; g = g + 1;}
} else {
if (b% 2 <a% 2) {t = ba; T = [1,0; -1,1] * G;}
else {b = ba; G = [1,0; -1,1] * G;}
if (a% 2 == 0) {a = a / 2; G = [1,0; 0,2] * G; g = g + 1;} else
if (b% 2 == 0) {b = b / 2; G = [2,0; 0,1] * G; g = g + 1;}
}
}
v = G [1,1];
while (g> 0) {
if (v% 2! = 0) {v = v + b0;} else {t = v + b0;} v = v / 2; g = g-1;
}
return (v);
end;

「/」は除算、「%」は剰余算である。「[]」は配列又は行列で、「[i11,i12; i21,i22]」ならば2行2列の行列を表す。「Y[i,j]」は行列Yのi行j列目の要素を表す。大文字と小文字は別変数である。   “/” Is division and “%” is remainder calculation. “[]” Is an array or matrix, and “[i11, i12; i21, i22]” represents a 2 × 2 matrix. “Y [i, j]” represents the element in the i-th row and j-th column of the matrix Y. Uppercase and lowercase letters are separate variables.

1つ目の「while」ループ(以下、「第1ループ」という。)の開始時の数値データa,bの値の状態、具体的には、数値データa,bの大小、数値データa,bのそれぞれが偶数か奇数かによって8個のルートに分岐する。このアルゴリズムであれば、どのルートであっても、加減算処理部122による減算処理とシフト処理部123によるシフト処理とが1回ずつ実行される。   The state of the numerical data a and b at the start of the first “while” loop (hereinafter referred to as “first loop”), specifically, the numerical data a and b, the numerical data a and b, Branches into 8 routes depending on whether each of b is even or odd. With this algorithm, subtraction processing by the addition / subtraction processing unit 122 and shift processing by the shift processing unit 123 are executed once for any route.

a>b, a%2=0, b%2=0 → a=a-b, a=a/2
a>b, a%2=0, b%2=1 → t=a-b, a=a/2(ダミー減算処理)
a>b, a%2=1, b%2=0 → a=a-b, b=b/2
a>b, a%2=1, b%2=1 → a=a-b, a=a/2
a<=b, a%2=0, b%2=0 → b=b-a, a=a/2
a<=b, a%2=0, b%2=1 → b=b-a, a=a/2
a<=b, a%2=1, b%2=0 → t=b-a, b=b/2(ダミー減算処理)
a<=b, a%2=1, b%2=1 → b=b-a, b=b/2
a> b, a% 2 = 0, b% 2 = 0 → a = ab, a = a / 2
a> b, a% 2 = 0, b% 2 = 1 → t = ab, a = a / 2 (dummy subtraction)
a> b, a% 2 = 1, b% 2 = 0 → a = ab, b = b / 2
a> b, a% 2 = 1, b% 2 = 1 → a = ab, a = a / 2
a <= b, a% 2 = 0, b% 2 = 0 → b = ba, a = a / 2
a <= b, a% 2 = 0, b% 2 = 1 → b = ba, a = a / 2
a <= b, a% 2 = 1, b% 2 = 0 → t = ba, b = b / 2 (dummy subtraction)
a <= b, a% 2 = 1, b% 2 = 1 → b = ba, b = b / 2

判別部121が、数値データaが数値データbよりも大きく且つ数値データaを「2」で除算したときの剰余(a%2)が「0」(数値データaが偶数)、剰余(b%2)が「1」(数値データbが奇数)であると判別したとき、あるいは数値データbが数値データa以上で数値データbを2で除算したときの剰余(b%2)が「0」(数値データbが偶数)、剰余(a%2)が「1」(数値データaが奇数)であると判別したときに、制御部125は、ダミー減算処理を実行する。すなわち、ダミー減算処理が実行されるのは、3つの条件がそろった場合( (a>b) & (a%2=0) & (b%2=1) )などのときである。
ダミー減算処理では、数値データa,bは更新されず、一時データtとして記憶部17に格納される。一時データtは逆元演算の通常処理には関与しないために、ダミー減算処理が通常処理の処理結果に影響を与えることはない。この場合、制御部125は、本発明のダミー演算処理手段の機能を有する。
When the determination unit 121 divides the numerical data a by “2” when the numerical data a is larger than the numerical data b, the remainder (a% 2) is “0” (the numerical data a is an even number), and the remainder (b% 2) is “1” (numeric data b is an odd number), or the remainder (b% 2) when the numeric data b is greater than or equal to the numeric data a and the numeric data b is divided by 2 is “0”. When determining that (numerical data b is an even number) and the remainder (a% 2) is “1” (numerical data a is an odd number), the control unit 125 executes a dummy subtraction process. That is, the dummy subtraction process is executed when three conditions are satisfied ((a> b) & (a% 2 = 0) & (b% 2 = 1)).
In the dummy subtraction process, the numerical data a and b are not updated, but are stored in the storage unit 17 as temporary data t. Since the temporary data t is not involved in the normal process of the inverse operation, the dummy subtraction process does not affect the process result of the normal process. In this case, the control unit 125 has the function of the dummy arithmetic processing means of the present invention.

このようなダミー演算処理(上記例では、ダミー減算処理)により、逆元演算の結果を有効にしつつ秘密情報の漏洩につながるサイドチャネル情報を外部で認知できなくする。また、通常処理の途中にダミー演算処理を実行するので、毎回ダミー演算処理を挿入するよりも効率がよい。例えば、a=10、b=23の場合は、第1ループが以下のような処理になる。この例では、最後から2番目にダミー減算処理が開始される。また、減算処理とシフト処理とが交互に行われるために、シフト処理の回数から秘密鍵が漏洩することはない。   By such dummy calculation processing (in the above example, dummy subtraction processing), the side channel information that leads to leakage of secret information cannot be recognized externally while validating the result of the inverse element calculation. Further, since the dummy calculation process is executed in the middle of the normal process, it is more efficient than inserting the dummy calculation process every time. For example, when a = 10 and b = 23, the first loop is processed as follows. In this example, the dummy subtraction process is started second from the end. In addition, since the subtraction process and the shift process are alternately performed, the secret key is not leaked from the number of shift processes.

処理 ; 処理後の値
b=b-a,a=a/2 ; a=5, b=13
b=b-a,b=b/2 ; a=5, b=4
a=a-b,b=b/2 ; a=1, b=2
t=b-a,b=b/2 ; a=1, b=1(ダミー減算処理)
b=b-a,b=b/2 ; a=1, b=0
Processing; processed value
b = ba, a = a / 2; a = 5, b = 13
b = ba, b = b / 2; a = 5, b = 4
a = ab, b = b / 2; a = 1, b = 2
t = ba, b = b / 2; a = 1, b = 1 (dummy subtraction processing)
b = ba, b = b / 2; a = 1, b = 0

図7bは、このような第1の対策により得られる消費電力の変化パタン(時間と共に変化するパタン)の例示図である。図7aに表す通常処理による消費電力の変化パタンは、サイドチャネル情報として有用である。しかし、図7bでは、減算処理とシフト処理とが交互に行われ、また、ダミー減算処理と通常処理による減算処理との区別がつかないので、サイドチャネル情報として用いることが困難になる。   FIG. 7B is an exemplary diagram of a power consumption change pattern (a pattern changing with time) obtained by the first countermeasure. The change pattern of power consumption by the normal processing shown in FIG. 7a is useful as side channel information. However, in FIG. 7b, the subtraction process and the shift process are alternately performed, and the dummy subtraction process and the subtraction process by the normal process cannot be distinguished from each other, so that it becomes difficult to use the side channel information.

<第2の対策>
第2の対策としては、数値データa,bを乱数などを用いてスクランブルし、逆元演算による数値データの最終更新前に逆スクランブルすることにより復元することにより、実際に逆元演算で処理される値をわかりづらくする。例えば、スクランブル部124が乱数生成部14から乱数R1とR2とを取得して、数値データaを「a'=a+R1*b」として変換し、数値データbを「b’=b*R2」と変換する。ここで、R2は奇数で、「gcd(a’,R2)=1」である乱数を使用する。
これにより剰余演算の性質から、「v' = 1/a' mod b'」とすると、「v' mod b= 1/(a+R*b) mod b=1/a mod b」となる。
最終更新前に逆スクランブルとして、「v=v'mod b」を行うことにより、正しい逆元演算処理結果を求めて出力する。
但し、R2=1にすれば最後の逆スクランブルは不要にできる。
<Second countermeasure>
As a second countermeasure, the numerical data a and b are scrambled using random numbers and the like, and are restored by descrambling before the final update of the numerical data by the inverse operation, so that it is actually processed by the inverse operation. It is difficult to understand the value. For example, the scramble unit 124 acquires the random numbers R1 and R2 from the random number generation unit 14, converts the numerical data a as “a ′ = a + R1 * b”, and converts the numerical data b to “b ′ = b * R2”. ". Here, R2 is an odd number, and a random number “gcd (a ′, R2) = 1” is used.
As a result, when “v ′ = 1 / a ′ mod b ′” is assumed, “v ′ mod b = 1 / (a + R * b) mod b = 1 / a mod b” due to the nature of the remainder operation.
By performing “v = v′mod b” as descrambling before the final update, a correct inverse element calculation processing result is obtained and output.
However, if R2 = 1, the last descrambling can be made unnecessary.

このように、実際に逆元演算で更新される数値データをスクランブル/逆スクランブルすることで、公開情報との関係を切断でき、サイドチャネル情報から秘密情報を求めることができなくなる。この対策は、数値データa,bに関する情報を利用した攻撃を阻止できる。第三者がサイドチャネル情報のみから数値データa,bを復元することが困難になる。   Thus, by scrambling / descrambling the numerical data that is actually updated by the inverse operation, the relationship with the public information can be disconnected, and the secret information cannot be obtained from the side channel information. This measure can prevent an attack using information on the numerical data a and b. It becomes difficult for a third party to restore the numerical data a and b only from the side channel information.

<第3の対策>
第3の対策としては、加減算処理部122による加減算処理の内容(数値データaを更新するか、数値データbを更新するか)を、ランダムに変更して行うことで、サイドチャネル情報に“不規則な要素”を含ませる。また、逆元演算による数値データの更新では、数値データa,bの条件と、その条件に対して正しい演算結果が得られる演算の組み合わせを複数用意し、ランダムに得られた不規則な要素にもとづいて、前記組み合わせを選択して演算することにより、有効な逆元演算の結果を得る。これによって数値データa,bの値の更新が不規則になり、観察したサイドチャネル情報から数値データa,bを復元することが困難になる。
<Third measure>
As a third countermeasure, the contents of the addition / subtraction processing by the addition / subtraction processing unit 122 (whether the numeric data a is updated or the numeric data b is updated) are changed at random, so that the side channel information is not changed. Include regular elements. Also, in updating numeric data by inverse element calculation, prepare multiple combinations of conditions for numerical data a and b and calculations that can obtain correct calculation results for those conditions, and use random elements obtained randomly. Based on the selection, the combination is selected and calculated to obtain an effective inverse element calculation result. This makes the updating of the values of the numerical data a and b irregular, and makes it difficult to restore the numerical data a and b from the observed side channel information.

以下のアルゴリズムは、「a=a-b」と「b=b-a」の処理分岐を乱数によって反転させる例である。図6は、このアルゴリズムのフローチャートである。この処理分岐は、判別部121による数値データa,bの偶数、奇数判別、数値データa,bの絶対値の差と乱数の乗算結果の正負判別、及び数値データa,bの乗算結果の正負判別により決まる。乱数部分が「random(100)-50)」であるので、この乱数は負の値をとり得る。乱数は、例えば乱数発生部14から取得する。   The following algorithm is an example in which the processing branch of “a = a-b” and “b = b-a” is inverted by a random number. FIG. 6 is a flowchart of this algorithm. This processing branch is performed by the determination unit 121 to determine whether the numerical data a and b are even or odd, to determine whether the difference between the absolute values of the numerical data a and b is multiplied by a random number, and to determine whether the numerical data a and b is multiplied. Determined by discrimination. Since the random number portion is “random (100) -50)”, this random number can take a negative value. The random number is acquired from the random number generator 14, for example.

INPUT:(a,b), OUTPUT: v,
begin
b0=b; G=[1,0;0,1]; g=0; s=0;
while(abs(b)>0){
if(a%2==0){ a=a/2; G=[1,0;0,2]*G; g=g+1; }else
if(b%2==0){ b=b/2; G=[2,0;0,1]*G; g=g+1; }else
if((abs(a)-abs(b))*(random(100)-50))>0){
if(a*b>0){ a=a-b; G=[1,-1;0,1]*G; }
else{ a=a+b; G=[1,+1;0,1]*G; }
}else{
if(a*b>0){ b=b-a; G=[1,0;-1,1]*G; }
else{ b=b+a; G=[1,0;+1,1]*G; }
}
}
if(a>0){ v=G[1,1]; }else{ v=-G[1,1]; }
while(g>0){
if(v%2!=0){ v=v+b0; }else{ t=v+b0; } v=v/2; g=g-1;
}
return(v) ;
end;
INPUT: (a, b), OUTPUT: v,
begin
b0 = b; G = [1,0; 0,1]; g = 0; s = 0;
while (abs (b)> 0) {
if (a% 2 == 0) {a = a / 2; G = [1,0; 0,2] * G; g = g + 1;} else
if (b% 2 == 0) {b = b / 2; G = [2,0; 0,1] * G; g = g + 1;} else
if ((abs (a) -abs (b)) * (random (100) -50))> 0) {
if (a * b> 0) {a = ab; G = [1, -1; 0,1] * G;}
else {a = a + b; G = [1, + 1; 0,1] * G;}
} else {
if (a * b> 0) {b = ba; G = [1,0; -1,1] * G;}
else {b = b + a; G = [1,0; +1,1] * G;}
}
}
if (a> 0) {v = G [1,1];} else {v = -G [1,1];}
while (g> 0) {
if (v% 2! = 0) {v = v + b0;} else {t = v + b0;} v = v / 2; g = g-1;
}
return (v);
end;

数値データa,bの符号が同じ場合には、max(|a|,|b|)>|a-b|が成立するため、「a=a-b」あるいは「b=b-a」という処理を行っても、max(|a|,|b|)は増加することはない。
|a|>|b|のときに「a=a-b」を行えば、max(|a|,|b|)は減少し、|a|>|b|のときに「b=b-a」を行えば、max(|a|,|b|)は不変である(|a|<|b|のときはその逆になる)。また、数値データa,bの符号が異なる場合には、max(|a|,|b|) > |a+b|が成立するため、「a=a+b」あるいは「b=b+a」という処理を行っても、max(|a|,|b|)は増加することはない。|a|>|b|のときに「a=a+b」を行えば、max(|a|,|b|)は減少し、|a|>|b|のときに「b=b+a」を行えば、max(|a|,|b|)は不変である。
よって圧倒的な確率で、max(|a|,|b|)は「0」に近づき、第1ループは収束する。例えば、「a=11、b=23」の場合は、第1ループは、以下のように収束する。
処理 ; 処理後の値
b=b-a ; a=11, b=12
b=b/2 ; a=11, b=6
b=b/2 ; a=11, b=3
b=b-a ; a=11, b=-8
b=b/2 ; a=11, b=-4
b=b/2 ; a=11, b=-2
b=b/2 ; a=11, b=-1
a=a+b ; a=10, b=-1
a=a/2 ; a=5, b=-1
b=b+a ; a=5, b=4
b=b/2 ; a=5, b=2
b=b/2 ; a=5, b=1
a=a-b ; a=4, b=1
a=a/2 ; a=2, b=1
a=a/2 ; a=1, b=1
b=b-a ; a=1, b=0
このように、制御部125は、本発明のリカバリ手段の機能を有する。
When the signs of the numerical data a and b are the same, max (| a |, | b |)> | ab | is established, so that even if the processing “a = ab” or “b = ba” is performed, max (| a |, | b |) never increases.
If "a = ab" is performed when | a |> | b |, max (| a |, | b |) decreases, and "b = ba" is performed when | a |> | b | For example, max (| a |, | b |) is invariant (the opposite is true when | a | <| b |). Further, when the signs of the numerical data a and b are different, max (| a |, | b |)> | a + b | is established, so that “a = a + b” or “b = b + a” ”Does not increase max (| a |, | b |). If "a = a + b" is performed when | a |> | b |, max (| a |, | b |) decreases, and if | a |> | b | If “a” is performed, max (| a |, | b |) is unchanged.
Therefore, max (| a |, | b |) approaches “0” with an overwhelming probability, and the first loop converges. For example, when “a = 11, b = 23”, the first loop converges as follows.
Processing; processed value
b = ba; a = 11, b = 12
b = b / 2; a = 11, b = 6
b = b / 2; a = 11, b = 3
b = ba; a = 11, b = -8
b = b / 2; a = 11, b = -4
b = b / 2; a = 11, b = -2
b = b / 2; a = 11, b = -1
a = a + b; a = 10, b = -1
a = a / 2; a = 5, b = -1
b = b + a; a = 5, b = 4
b = b / 2; a = 5, b = 2
b = b / 2; a = 5, b = 1
a = ab; a = 4, b = 1
a = a / 2; a = 2, b = 1
a = a / 2; a = 1, b = 1
b = ba; a = 1, b = 0
Thus, the control unit 125 has the function of the recovery means of the present invention.

また、「a=a-b」、「a=a+b」、「b=b-a」、「b=b+a」の4パターンにあわせてGの処理も用意する。すなわち、次のような処理を行う。
「a=a-b」の場合は、G=[1,-1;0,1]*G、
「a=a+b」の場合は、G=[1,+1;0,1]*G、
「b=b-a」の場合は、G=[1,0;-1,1]*G、
「b=b+a」の場合は、G=[1,0;+1,1]*G。
これにより、第1ループで不規則な要素を発生させても、a,b,Gの相互関係は正しく保持されるため、正しく逆元演算することができる。
Further, G processing is also prepared in accordance with the four patterns “a = ab”, “a = a + b”, “b = ba”, and “b = b + a”. That is, the following processing is performed.
If "a = ab", G = [1, -1; 0,1] * G,
If "a = a + b", then G = [1, + 1; 0,1] * G,
If b = ba, G = [1,0; -1,1] * G,
If b = b + a, G = [1,0; +1,1] * G.
Thereby, even if an irregular element is generated in the first loop, the mutual relationship between a, b, and G is correctly maintained, so that the inverse element calculation can be correctly performed.

図7cは、このような第3の対策により得られる消費電力の時間変化の例示図である。図7cでは、発生させた不規則な要素によってサイドチャネル情報が図7aとは異なる形になっている。また、「a=a-b」、「a=a+b」、「b=b-a」、「b=b+a」の4パターンは、加算か減算かという違いであり、加算も減算もどちらも消費電力はほとんど同一であるので、エラー又はノイズによって4パターンのどの処理を行ったかのを見分けることはできない。そのために、観察したサイドチャネル情報から数値データa,bを復元することが困難になる。   FIG. 7 c is an exemplary diagram of a time change of power consumption obtained by the third countermeasure. In FIG. 7c, the side channel information is different from FIG. 7a due to the generated irregular elements. The four patterns “a = ab”, “a = a + b”, “b = ba”, and “b = b + a” are the difference between addition and subtraction, and both addition and subtraction are consumed. Since the power is almost the same, it is impossible to distinguish which of the four patterns has been performed due to an error or noise. Therefore, it becomes difficult to restore the numerical data a and b from the observed side channel information.

このように、本実施形態による暗号モジュール1では、逆元演算に対するサイドチャネル攻撃への対策を種々講じることができる。逆元演算のサイドチャネル情報としては、図7aのような減算処理時とシフト処理時との消費電力の相違に基づくものがある。しかし、第1、第3の対策を施した逆元演算により得られるサイドチャネル情報は、ダミー演算処理である減算処理や処理分岐の判断を、乱数によりランダムに間違わせることで、分岐先を変えることで、図7b、図7cのように単調なもの、あるいはノイズを含むものとなり、そのままではサイドチャネル情報としては無用なものにする。そのため、悪意の第三者がRSA鍵生成やDSA署名生成などのデジタル署名アルゴリズムで行われる逆元演算からサイドチャネル情報を取得して、秘密情報を得ることが著しく困難になる。これにより秘密情報が漏洩しにくくなり、セキュリティ性が格段に向上する。   As described above, the cryptographic module 1 according to the present embodiment can take various measures against the side channel attack against the inverse element calculation. The side channel information of the inverse element calculation is based on the difference in power consumption between the subtraction process and the shift process as shown in FIG. 7a. However, the side channel information obtained by the inverse operation with the first and third countermeasures is used to change the branch destination by randomly determining the subtraction process and the process branch determination, which are dummy calculation processes, using random numbers. Thus, it becomes monotonous or includes noise as shown in FIGS. 7b and 7c, and is used as side channel information as it is. For this reason, it becomes extremely difficult for a malicious third party to obtain side channel information from an inverse element operation performed by a digital signature algorithm such as RSA key generation or DSA signature generation to obtain secret information. As a result, confidential information is less likely to be leaked, and security is greatly improved.

本発明を適用した暗号モジュールのハードウェア構成図。The hardware block diagram of the encryption module to which this invention is applied. 本実施形態による暗号モジュールの機能ブロック図。The functional block diagram of the encryption module by this embodiment. RSA鍵生成処理の処理手順図。The process sequence figure of RSA key generation processing. DSA署名生成処理の処理手順図。The process sequence figure of a DSA signature production | generation process. 第1の対策のフローチャート。The flowchart of a 1st countermeasure. 第3の対策のフローチャート。The flowchart of the 3rd countermeasure. 消費電力の変化パタン(時間変化)の例示図。The example figure of the change pattern (time change) of power consumption. 消費電力の変化パタン(時間変化)の例示図。The example figure of the change pattern (time change) of power consumption. 消費電力の変化パタン(時間変化)の例示図。The example figure of the change pattern (time change) of power consumption.

符号の説明Explanation of symbols

1…暗号モジュール、10…CPU、20…I/Oインタフェース、30…メモリ、31…プログラムメモリ、32…データメモリ、11…べき乗剰余演算部、12…逆元演算部、121…判別部、122…加減算処理部、123…シフト処理部、124…スクランブル部、125…制御部、13…素数生成部、14…乱数生成部、15…RSA鍵生成部、16…DSA署名生成部、17…記憶部。   DESCRIPTION OF SYMBOLS 1 ... Cryptographic module, 10 ... CPU, 20 ... I / O interface, 30 ... Memory, 31 ... Program memory, 32 ... Data memory, 11 ... Power residue calculation part, 12 ... Inverse element calculation part, 121 ... Discrimination part, 122 ... addition / subtraction processing unit, 123 ... shift processing unit, 124 ... scramble unit, 125 ... control unit, 13 ... prime number generation unit, 14 ... random number generation unit, 15 ... RSA key generation unit, 16 ... DSA signature generation unit, 17 ... storage Department.

Claims (5)

メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら逆元演算を実行する暗号処理装置において、
前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しない擬似演算処理を少なくとも1つ付加的に実行する冗長処理手段を設けたことを特徴とする、
暗号処理装置。
The numerical data stored in the memory, the cryptographic processing apparatus that perform inverse operation while changing pattern perceptible physical quantity is updated by processing of different types from each other from the outside of the apparatus,
At least one processing before or after, the redundancy process for performing pseudo processing without updating the results of those該演 calculation processing at least one additional in the series of processing for updating the numerical data by the inverse operation Characterized by providing means,
Cryptographic processing device.
前記擬似演算は、前記メモリに記録された数値データを前記擬似演算処理の入力データとし、更新しない複数種類の演算処理のいずれかにより生じる物理量の変化パタンを、前記更新を伴う複数種類の演算処理のいずれかにより生じる物理量の変化と同じにすることを特徴とする、
請求項1記載の暗号処理装置。
In the pseudo operation, numerical data recorded in the memory is used as input data for the pseudo operation processing, and a physical quantity change pattern caused by any of a plurality of types of arithmetic processing not to be updated is used as a plurality of types of arithmetic processing accompanied by the update. It is characterized by being the same as the change in physical quantity caused by any of
The cryptographic processing apparatus according to claim 1.
前記冗長処理手段は、
2つの前記数値データの大小を判別する大小判別手段と、
前記2つの数値データのそれぞれが奇数か偶数かを判別する奇数・偶数判別手段とを備え、前記大小判別手段による判別結果及び前記奇数・偶数判別手段による判別結果の組み合わせが所定の条件を満たすときに前記擬似演算処理の実行を開始するものであって、
前記所定の条件とは、前記装置外部から認知可能な物理量の変化パタンが所定のパタンになるような条件であることを特徴とする、
請求項2記載の暗号処理装置。
The redundant processing means includes
A magnitude discrimination means for discriminating the magnitude of the two numerical data;
An odd / even number discriminating unit that discriminates whether each of the two numerical data is odd or even, and a combination of the discrimination result by the magnitude discrimination unit and the discrimination result by the odd / even discrimination unit satisfies a predetermined condition The execution of the pseudo operation processing is started ,
The predetermined condition is a condition such that a change pattern of a physical quantity recognizable from the outside of the apparatus becomes a predetermined pattern .
The cryptographic processing apparatus according to claim 2.
メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理によって更新しながら逆元演算を実行する暗号処理方法であって、
前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しない擬似演算処理を少なくとも1つ付加的に実行することを特徴とする、
暗号処理方法。
The numerical data stored in the memory, a cryptographic processing method that perform inverse operation while updating the operation processing of a plurality of types of change patterns of perceptible physical quantity are different from each other from the outside of the apparatus,
Before or after the at least one processing of a series of processing for updating the numerical data by the inverse operation to, to perform the pseudo-arithmetic processing which does not update the results of those該演 calculation processing at least one additionally Features
Cryptographic processing method.
メモリを有するコンピュータを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら逆元演算を実行する暗号処理装置として動作させるためのコンピュータプログラムであって、
前記コンピュータを、
前記メモリに記録された数値データを、装置外部から認知可能な物理量の変化パタンが互いに異なる複数種類の演算処理により更新しながら実行し、前記逆元演算により数値データを更新するための一連の演算処理の少なくとも1つの演算処理の前または後に、当該演算処理の結果を更新しない擬似演算処理を少なくとも1つ付加的に実行する冗長処理手段として機能させる、
コンピュータプログラム。
A computer having a memory, a computer program for operating as a perceptible physical quantity plurality of types change patterns are different from each other in the processing by the update cryptographic processing apparatus that perform inverse operation while from outside the device,
The computer,
A series of operations for updating the numerical data by performing the inverse element operation while executing the numerical data recorded in the memory while updating the physical quantity change patterns that can be recognized from outside the device by a plurality of different types of arithmetic processing at least one processing before or after the treatment, the pseudo-arithmetic processing which does not update the results of those該演 calculation processing function as a redundant processing unit for executing at least one additionally,
Computer program.
JP2008116189A 2008-04-25 2008-04-25 Cryptographic processing apparatus, cryptographic processing method, and computer program Active JP5214317B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008116189A JP5214317B2 (en) 2008-04-25 2008-04-25 Cryptographic processing apparatus, cryptographic processing method, and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008116189A JP5214317B2 (en) 2008-04-25 2008-04-25 Cryptographic processing apparatus, cryptographic processing method, and computer program

Publications (2)

Publication Number Publication Date
JP2009267839A JP2009267839A (en) 2009-11-12
JP5214317B2 true JP5214317B2 (en) 2013-06-19

Family

ID=41393111

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008116189A Active JP5214317B2 (en) 2008-04-25 2008-04-25 Cryptographic processing apparatus, cryptographic processing method, and computer program

Country Status (1)

Country Link
JP (1) JP5214317B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11418334B2 (en) * 2017-10-18 2022-08-16 Cryptography Research, Inc. Protecting modular inversion operation from external monitoring attacks

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2790347B1 (en) * 1999-02-25 2001-10-05 St Microelectronics Sa METHOD FOR SECURING A CHAIN OF OPERATIONS CARRIED OUT BY AN ELECTRONIC CIRCUIT IN THE CONTEXT OF THE EXECUTION OF AN ALGORITHM
JP4019762B2 (en) * 2002-03-28 2007-12-12 松下電器産業株式会社 Inverse element operation apparatus, inverse element operation method, RSA key pair generation apparatus, RSA key pair generation method
US7907722B2 (en) * 2004-01-27 2011-03-15 Nxp B.V. Protection against power analysis attacks
JP2007187908A (en) * 2006-01-13 2007-07-26 Hitachi Ltd Modular exponentiation calculation device and method having tolerance to side-channel attack
JP4327169B2 (en) * 2006-03-15 2009-09-09 川崎マイクロエレクトロニクス株式会社 Encryption device

Also Published As

Publication number Publication date
JP2009267839A (en) 2009-11-12

Similar Documents

Publication Publication Date Title
Beirendonck et al. A side-channel-resistant implementation of SABER
JP4632950B2 (en) Tamper-resistant cryptographic processing using personal keys
CN109791517B (en) Protecting parallel multiplication operations from external monitoring attacks
US8472621B2 (en) Protection of a prime number generation for an RSA algorithm
US10361854B2 (en) Modular multiplication device and method
JP5401477B2 (en) Protecting electronic circuits from error-based attacks
US20100262840A1 (en) Method and devices for protecting a microcircuit from attacks for obtaining secret data
US20130279692A1 (en) Protecting modular exponentiation in cryptographic operations
JP4909403B2 (en) How to request data safely
JP2001337599A (en) Scalar-fold calculating method and device for elliptic curve cipher, and storage medium
US20080201398A1 (en) Determination of a Modular Inverse
KR20090006176A (en) Secure decryption method
KR20180137534A (en) Safeguarding against cryptographic power-law algorithms - Measures against error injection attacks
EP3698262B1 (en) Protecting modular inversion operation from external monitoring attacks
JP2011530093A (en) Solutions to protect power-based encryption
JP5261088B2 (en) Unauthorized operation detection circuit, device provided with unauthorized operation detection circuit, and unauthorized operation detection method
JP2011510579A (en) Countermeasure method and device for asymmetric cryptosystem using signature diagram
JP2010164904A (en) Elliptic curve arithmetic processing unit and elliptic curve arithmetic processing program and method
JP2004304800A (en) Protection of side channel for prevention of attack in data processing device
EP1646174A1 (en) Method and apparatus for generating cryptographic sets of instructions automatically and code generation
EP3891925B1 (en) A computation device using shared shares
US8150029B2 (en) Detection of a disturbance in a calculation performed by an integrated circuit
Blömer et al. Wagner’s Attack on a secure CRT-RSA Algorithm Reconsidered
JP4386766B2 (en) Error detection in data processing equipment.
US20100128869A1 (en) Method and device for executing a cryptographic calculation

Legal Events

Date Code Title Description
RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20100325

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20100402

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20101116

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120717

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120731

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121001

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20121023

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130123

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20130130

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: 20130219

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130227

R150 Certificate of patent or registration of utility model

Ref document number: 5214317

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20160308

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250