JP2010034682A - Encryption processor - Google Patents

Encryption processor Download PDF

Info

Publication number
JP2010034682A
JP2010034682A JP2008192356A JP2008192356A JP2010034682A JP 2010034682 A JP2010034682 A JP 2010034682A JP 2008192356 A JP2008192356 A JP 2008192356A JP 2008192356 A JP2008192356 A JP 2008192356A JP 2010034682 A JP2010034682 A JP 2010034682A
Authority
JP
Japan
Prior art keywords
numerical value
digit
data
cryptographic processing
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2008192356A
Other languages
Japanese (ja)
Other versions
JP5233473B2 (en
Inventor
Shuichi Oki
秀一 沖
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 JP2008192356A priority Critical patent/JP5233473B2/en
Publication of JP2010034682A publication Critical patent/JP2010034682A/en
Application granted granted Critical
Publication of JP5233473B2 publication Critical patent/JP5233473B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/723Modular exponentiation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/72Indexing scheme relating to groups G06F7/72 - G06F7/729
    • G06F2207/7219Countermeasures against side channel or fault attacks

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To prevent any side channel attack without altering the arithmetic formula itself of encryption. <P>SOLUTION: A numerical value M is applied to an input part 110, a numerical value C is determined by performing an exponentiation remainder operation using a secret key D by an arithmetic execution part 130, and the numerical value C is output from an output part 120. The secret key D expressed by binary digits is read from a storage part 150, and a numerical value d of one digit is re-encoded into a redundant k-order digit which becomes a value within the range of "0≤d≤dmax (dmax>k-1)" by a re-encoding part 140. In this case, since re-encoding using a random number R generated by a random number generation part 160 is performed, the numerical value of each digit configuring the secret key D to be used for an actual arithmetic operation by an arithmetic execution part 130 is selected at random each time. Even when an arithmetic operation based on the same arithmetic formula is performed by using the same numerical value D to the same numerical value M by the arithmetic execution part 130, a power consumption pattern is made different each time, and analysis based on power consumption is invalidated. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、暗号処理装置に関し、特に、外部から与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算を行うことにより第2の数値Cを生成し、これを外部へ出力する処理を行う暗号処理装置に関する。   The present invention relates to a cryptographic processing apparatus, and in particular, generates a second numerical value C by performing an operation using a numerical value D serving as a secret key on the first numerical value M given from the outside. The present invention relates to an encryption processing apparatus that performs processing to be output to the outside.

暗号は、通信の秘密性を確保するために古くから利用されてきた技術であり、近年では、デジタル機器同士の交信を行う際に不可欠の技術になりつつある。たとえば、現在、様々な用途で利用されているICカードの多くには、秘密鍵を用いた暗号化プロセスが組み込まれており、外部から与えられたデータに対して、内部で暗号化もしくは復号化を行う機能が備わっている。   Encryption is a technique that has been used for a long time in order to ensure the confidentiality of communication. In recent years, encryption is becoming an indispensable technique for communication between digital devices. For example, many of the IC cards that are currently used for various purposes have an encryption process using a secret key, and the data given from the outside is encrypted or decrypted internally. It has a function to do.

ICカードなどで、現在、最も普及している暗号化方式の一つとして、公開鍵暗号方式の代表格であるRSA暗号方式がある。このRSA暗号方式による暗号化もしくは復号化のプロセスには、指数関数を含む剰余演算が含まれており、この演算の繁雑さにより安全性の確保が図られている。たとえば、下記の特許文献1および2には、このRSA暗号方式による暗号化もしくは復号化の演算を高速化する技術が開示されている。   One of the most widely used encryption methods for IC cards and the like at present is the RSA encryption method, which is a typical public key encryption method. The process of encryption or decryption by the RSA encryption method includes a remainder operation including an exponential function, and safety is ensured by the complexity of this operation. For example, Patent Documents 1 and 2 below disclose a technique for speeding up the encryption or decryption operation by the RSA encryption method.

一方、このような暗号方式に基づくセキュリティを脅かす「サイドチャネル攻撃」と呼ばれているセキュリティに対する脅威となる技術の存在も確認されている。一般に、ICカード等のデジタル機器に組み込まれているICチップは、多数のトランジスタ回路で構成されており、上述した指数関数を含む繁雑な剰余演算は、このトランジスタ回路によって実行されることになる。このため、ICカード等のデジタル機器が、暗号化もしくは復号化のプロセスを実行している最中に、当該機器の消費電力を外部からモニタすることにより、内部で行われている処理を統計的な手法で推定することが可能になる。このような不正な解析方法として、単純電力解析(SPA:Simple Power Analysis)や電力差分解析(DPA:Differential Power Analysis)などの方法が知られている。これらの方法を用いると、不正に入手したICカードに対する統計的な解析を行うことにより、内蔵されている秘密鍵の値を推定することが可能になる。   On the other hand, the existence of a technology that is a threat to security called “side channel attack” that threatens security based on such an encryption method has also been confirmed. In general, an IC chip incorporated in a digital device such as an IC card is composed of a large number of transistor circuits, and the complicated remainder calculation including the exponential function described above is executed by the transistor circuits. For this reason, while a digital device such as an IC card is executing an encryption or decryption process, the power consumption of the device is monitored from the outside to statistically analyze the processing performed internally. It becomes possible to estimate by a simple method. As such illegal analysis methods, methods such as simple power analysis (SPA) and differential power analysis (DPA) are known. By using these methods, it is possible to estimate the value of the built-in secret key by performing a statistical analysis on an illegally obtained IC card.

このようなサイドチャネル攻撃に対抗する方法として、たとえば、下記の特許文献3には、演算に乱数を組み込む手法が開示されており、下記の特許文献4には、より複雑な剰余演算の組み合わせを行う手法が開示されている。また、下記の特許文献5には、本来は必要のないダミー乗算を付加するとともに、乗数をべき乗の途中で更新することにより、ダミー乗算か否かの区別をしにくくする手法が開示されている。
特開平7−129085号公報 特開平8−254949号公報 特表2002−519722号公報 特開2006−217193号公報 特開2007−316491号公報
As a method against such a side channel attack, for example, the following Patent Document 3 discloses a method of incorporating a random number into an operation, and the following Patent Document 4 includes a more complicated combination of remainder operations. The technique to do is disclosed. Patent Document 5 below discloses a technique that makes it difficult to distinguish whether or not a dummy multiplication is performed by adding a dummy multiplication that is not originally necessary and updating the multiplier in the middle of a power. .
Japanese Unexamined Patent Publication No. 7-129085 JP-A-8-254949 JP-T-2002-519722 JP 2006-217193 A JP 2007-316491 A

上述したように、サイドチャネル攻撃に対抗する方法として、従来、暗号化や復号化に用いる演算式に工夫を施し、より複雑な演算式を用いる様々な方法が提案されている。しかしながら、複雑な演算式を用いるようにすればするほど、演算負担が重くなるという弊害が生じる。   As described above, as a method against the side channel attack, conventionally, various methods using more complicated arithmetic expressions have been proposed by devising arithmetic expressions used for encryption and decryption. However, the more complicated arithmetic expressions are used, the more harmful the calculation burden becomes.

そこで本発明は、暗号化もしくは復号化に用いる演算式自体に改変を加えることなしに、サイドチャネル攻撃を防ぐことができる暗号処理装置を提供することを目的とする。   Therefore, an object of the present invention is to provide an encryption processing apparatus that can prevent a side channel attack without modifying the arithmetic expression itself used for encryption or decryption.

(1) 本発明の第1の態様は、外部から与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算を行うことにより第2の数値Cを生成し、これを外部へ出力する処理を行う暗号処理装置において、
第1の数値Mを外部から入力する入力部と、
秘密鍵となる数値Dを格納する秘密鍵格納部と、
乱数Rを発生させる乱数発生部と、
発生させた乱数Rを用いて、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムなn桁のデータに再符号化する再符号化部と、
少なくとも数値Mと再符号化された数値Dとを用いた所定の演算を行うことにより、第2の数値Cを求める演算実行部と、
演算実行部が求めた第2の数値Cを外部へ出力する出力部と、
を設けるようにしたものである。
(1) The first aspect of the present invention generates a second numerical value C by performing an operation using a numerical value D as a secret key on the first numerical value M given from the outside, In the cryptographic processing device that performs processing to output to the outside,
An input unit for inputting the first numerical value M from outside;
A secret key storage unit for storing a numerical value D as a secret key;
A random number generator for generating a random number R;
Using the generated random number R, the numerical value D is expressed by a redundant k-ary number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. A re-encoding unit for re-encoding into random n-digit data;
An operation execution unit for obtaining a second numerical value C by performing a predetermined operation using at least the numerical value M and the re-encoded numerical value D;
An output unit for outputting the second numerical value C obtained by the calculation execution unit to the outside;
Is provided.

(2) 本発明の第2の態様は、上述した第1の態様に係る暗号処理装置において、
演算実行部が、Mの項を含む所定の演算式もしくはMに基づいて定まる有理点Pをスカラー値Dでスカラー倍する楕円曲線暗号の演算式に基づく演算を行うことにより、第2の数値Cを求めるようにしたものである。
(2) According to a second aspect of the present invention, in the cryptographic processing device according to the first aspect described above,
Arithmetic execution unit, by performing a calculation based on the arithmetic expression of the scalar multiplication to elliptic curve cryptography scalar value D the rational point P that is determined based on a predetermined arithmetic expression or M includes a term of M D, second numerical C is obtained.

(3) 本発明の第3の態様は、上述した第2の態様に係る暗号処理装置において、
演算実行部が、Mを所定の数値Zで除したときのべき乗剰余を示す演算式C=MmodZに基づく演算を行うことにより、第2の数値Cを求めるようにしたものである。
(3) According to a third aspect of the present invention, in the cryptographic processing device according to the second aspect described above,
Arithmetic execution unit, by performing a calculation based on the arithmetic expression C = M D modZ indicating the modular exponentiation of time obtained by dividing the M D at a predetermined numerical Z, is obtained so as to obtain a second numeric C.

(4) 本発明の第4の態様は、上述した第3の態様に係る暗号処理装置において、
再符号化部が、数値Dを、上位桁側から順に、d[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]なるn桁のデータに再符号化する処理を行い、
演算実行部が、演算式C=MmodZに基づく演算を、
C=(( .....(((1*Md[n−1]
*Md[n−2]modZ)
*Md[n−3]modZ)
.....
*Md[2]modZ)
*Md[1]modZ)
*Md[0]modZ
なる等価演算式を用いて、括弧の内側の演算から順番に実行するようにしたものである。
(4) According to a fourth aspect of the present invention, in the cryptographic processing device according to the third aspect described above,
The re-encoding unit sequentially converts the numerical value D into d [n−1], d [n−2], d [n−3],..., D [2], d [1] in order from the upper digit side. , D [0] to perform re-encoding into n-digit data,
The calculation execution unit performs a calculation based on the calculation formula C = M D modZ.
C = ((... (((1 * M d [n−1] ) k
* M d [n-2] modZ) k
* M d [n-3] modZ) k
.....
* M d [2] modZ) k
* M d [1] modZ) k
* M d [0] modZ
Is executed in order from the operation inside the parentheses.

(5) 本発明の第5の態様は、上述した第1の態様に係る暗号処理装置において、
演算実行部が、RSA暗号、Diffie Hellman暗号、EL Gamal暗号、もしくは楕円曲線暗号を生成するための演算を行うことにより、第2の数値Cを求めるようにしたものである。
(5) According to a fifth aspect of the present invention, in the cryptographic processing device according to the first aspect described above,
The operation execution unit obtains the second numerical value C by performing an operation for generating RSA encryption, Diffie Hellman encryption, EL Gamal encryption, or elliptic curve encryption.

(6) 本発明の第6の態様は、上述した第1〜第5の態様に係る暗号処理装置において、
演算実行部が、再符号化部によって再符号化されたn桁のデータの中から1桁の数値dを抽出して用いる演算を、順番に繰り返し実行することにより第2の数値Cを求めるようにしたものである。
(6) According to a sixth aspect of the present invention, in the cryptographic processing device according to the first to fifth aspects described above,
The arithmetic execution unit obtains the second numerical value C by repeatedly executing in order an operation that extracts and uses a single-digit numerical value d from the n-digit data re-encoded by the re-encoding unit. It is a thing.

(7) 本発明の第7の態様は、上述した第1〜第6の態様に係る暗号処理装置において、
入力部が第1の数値Mを外部から入力するたびに、乱数発生部が新たな乱数Rを発生させ、再符号化部が新たな再符号化を行い、演算実行部が新たに再符号化された数値Dを用いて第2の数値Cを求める演算を行うようにしたものである。
(7) According to a seventh aspect of the present invention, in the cryptographic processing device according to the first to sixth aspects described above,
Each time the input unit inputs the first numerical value M from the outside, the random number generation unit generates a new random number R, the re-encoding unit performs new re-encoding, and the operation execution unit newly re-encodes The calculation for obtaining the second numerical value C is performed using the numerical value D.

(8) 本発明の第8の態様は、上述した第1〜第7の態様に係る暗号処理装置において、
再符号化部を、
乱数Rを用いて「0≦d≦dmax」の範囲内の値を発生させる処理をn回繰り返すことによりn桁のランダムデータを生成するランダムデータ生成要素と、
生成されたランダムデータが数値Dに等しいか否かを判断する数値確認要素と、
数値確認要素が等しいとの判断を行うまで、ランダムデータ生成要素にランダムデータの生成を繰り返し実行させ、数値確認要素が等しいとの判断を行った際のランダムデータを再符号化したデータとして出力する制御要素と、
によって構成したものである。
(8) According to an eighth aspect of the present invention, in the cryptographic processing device according to the first to seventh aspects described above,
Re-encoding unit
A random data generation element that generates n-digit random data by repeating a process of generating a value within a range of “0 ≦ d ≦ dmax” using the random number R n times;
A numerical confirmation element for determining whether or not the generated random data is equal to the numerical value D;
Random data generation element repeatedly executes random data generation until it is determined that the numerical confirmation elements are equal, and the random data when the numerical confirmation elements are equal is output as re-encoded data A control element;
It is constituted by.

(9) 本発明の第9の態様は、上述した第1〜第7の態様に係る暗号処理装置において、
再符号化部を、
n桁のデータを保持するレジスタと、
秘密鍵となる数値Dを、1つの桁の数値dが「0≦d≦k−1」の範囲内の値をとる通常のk進数で表現することにより、n桁からなるデータを用意し、用意したデータを初期データとしてレジスタに設定する初期データ設定要素と、
発生させた乱数Rを用いて、レジスタのn桁のうちの任意の1桁を選択桁として選択する桁選択要素と、
発生させた乱数Rを用いて、増加補正もしくは減少補正のいずれかを決定する増減決定要素と、
増減決定要素により増加補正が決定された場合には、選択桁の数値dについてd<dmaxが満たされ、かつ、他の桁の調整によって所定の増加補正分δ(但し、δ≦dmax−d)を相殺することが可能であることを条件として、選択桁に増加補正分δを加え、他の桁を調整して増加補正分δを相殺する補正を行う増加補正実行要素と、
増減決定要素により減少補正が決定された場合には、選択桁の数値dについてd≠0が満たされ、かつ、他の桁の調整によって所定の減少補正分δ(但し、δ≦d)を相殺することが可能であることを条件として、選択桁から減少補正分δを減じ、他の桁を調整して減少補正分δを相殺する補正を行う減少補正実行要素と、
所定の条件が満たされるまで、桁選択要素による桁選択、増減決定要素による増減決定、増加補正実行要素もしくは減少補正実行要素による補正を繰り返し実行し、所定の条件が満たされたときのレジスタ内のn桁のデータを再符号化したデータとして出力する制御要素と、
によって構成したものである。
(9) According to a ninth aspect of the present invention, in the cryptographic processing device according to the first to seventh aspects described above,
Re-encoding unit
a register holding n digits of data;
By expressing a numerical value D as a secret key with a normal k-adic number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ k−1”, n-digit data is prepared, An initial data setting element for setting the prepared data in the register as initial data;
A digit selection element for selecting any one digit among n digits of the register as a selection digit using the generated random number R;
An increase / decrease determination element that determines either increase correction or decrease correction using the generated random number R;
When increase correction is determined by the increase / decrease determination factor, d <dmax is satisfied for the numerical value d of the selected digit, and a predetermined increase correction amount δ (where δ ≦ dmax−d) is obtained by adjusting other digits. On the condition that it is possible to cancel out, an increase correction execution element for adding an increase correction amount δ to the selected digit and adjusting other digits to cancel the increase correction amount δ,
When the decrease correction is determined by the increase / decrease determining element, d ≠ 0 is satisfied for the numerical value d of the selected digit, and a predetermined decrease correction amount δ (where δ ≦ d) is canceled by adjusting other digits. A reduction correction execution element that performs a correction that subtracts the decrease correction amount δ by adjusting the other digits by subtracting the decrease correction amount δ from the selected digit on the condition that it is possible to
Until the predetermined condition is satisfied, the digit selection by the digit selection element, the increase / decrease determination by the increase / decrease determination element, the correction by the increase correction execution element or the decrease correction execution element are repeatedly executed, and the register in the register when the predetermined condition is satisfied a control element that outputs n-digit data as re-encoded data;
It is constituted by.

(10) 本発明の第10の態様は、上述した第1〜第7の態様に係る暗号処理装置において、
再符号化部を、
数値Dをm×nビット(m,nは整数)の2進数として保持する数値D保持要素と、
乱数Rを用いて、「E<D」を満足する任意の数値Eをm×nビットの2進数として生成する数値E生成要素と、
数値Eの下位mビットを0に置換することにより、新たな数値Aを生成する数値A生成要素と、
B=D−Aなる演算により、m×nビットの2進数からなる数値Bを生成する数値B生成要素と、
数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータを生成し、これを冗長な2進数で表現した数値Dを示すデータとして出力する冗長データ生成要素と、
によって構成したものである。
(10) According to a tenth aspect of the present invention, in the cryptographic processing device according to the first to seventh aspects described above,
Re-encoding unit
A numerical value D holding element for holding the numerical value D as a binary number of m × n bits (m and n are integers);
A numerical value E generation element for generating an arbitrary numerical value E satisfying “E <D” as a binary number of m × n bits using the random number R;
A numerical value A generation element for generating a new numerical value A by replacing the lower m bits of the numerical value E with 0;
A numerical value B generating element for generating a numerical value B consisting of an m × n-bit binary number by an operation of B = D−A;
Counting m bits of consecutive numbers from the (m × (i + 1)) th bit down to the lower order of the bits constituting the numerical value A, from the lower bits of the bits constituting the numerical value B A numerical value consisting of 2m bits in which the numerical value for m bits continuous from the (m × i) -th bit to the lower order is the lower bit (provided that i = 1 to n, and for numerical value A, m the a supplement) 0 bits, to generate a n-digit data to the i-th digit as counted from the lower side, the redundant data generation output as data indicating the numerical D expressing this in redundant 2 m ary Elements and
It is constituted by.

(11) 本発明の第11の態様は、上述した第1〜第10の態様に係る暗号処理装置をICカードに内蔵させるようにしたものである。   (11) According to an eleventh aspect of the present invention, the cryptographic processing apparatus according to the first to tenth aspects described above is built in an IC card.

(12) 本発明の第12の態様は、上述した第1〜第10の態様に係る暗号処理装置を、コンピュータに専用のプログラムを組み込むことにより構成したものである。   (12) In a twelfth aspect of the present invention, the cryptographic processing apparatus according to the first to tenth aspects described above is configured by incorporating a dedicated program into a computer.

(13) 本発明の第13の態様は、秘密鍵となる数値Dを内蔵している演算処理装置に対して、外部から第1の数値Mを与え、演算処理装置の内部で、少なくとも数値Mと数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、
演算処理装置の内部で、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させるようにしたものである。
(13) According to a thirteenth aspect of the present invention, a first numerical value M is given from the outside to an arithmetic processing unit having a numerical value D as a secret key, and at least the numerical value M is provided inside the arithmetic processing unit. In a cryptographic processing method for generating a second numerical value C by executing an operation using a numerical value D and a numerical value D, and outputting the second numerical value C to the outside,
Random data in which the numerical value D is expressed by a redundant k-ary number in which the numerical value d takes a value in the range of “0 ≦ d ≦ dmax (where dmax> k−1)” within the arithmetic processing unit. Is generated, and an operation for generating the second numerical value C is executed using the random data.

(14) 本発明の第14の態様は、秘密鍵となる数値Dを内蔵し、演算処理機能および乱数発生機能を有するICカードに対して、外部から第1の数値Mを与え、ICカードの内部で、少なくとも数値Mと数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、
ICカードの内部で、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを、乱数発生機能を用いて生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させるようにしたものである。
(14) In the fourteenth aspect of the present invention, a first numerical value M is given from the outside to an IC card having a numerical value D as a secret key and having an arithmetic processing function and a random number generation function. In the cryptographic processing method for generating a second numerical value C by executing an operation using at least the numerical value M and the numerical value D and outputting the same to the outside,
Inside the IC card, random data expressing a numerical value D in redundant k-ary numbers in which a numerical value d of one digit takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. The random number generation function is used to generate the second numerical value C using this random data.

本発明によれば、秘密鍵となる数値Dは、冗長なk進数で表現したランダムなn桁のデータに再符号化された上で、暗号化もしくは復号化に用いる演算式に適用される。冗長なk進数を用いれば、同じ数値Dを複数通りの表記方法で表現することができるので、同じ数値Dを用いて同じ演算式に基づく演算を繰り返し行ったとしても、トランジスタ回路によって行われる具体的な演算プロセスは、毎回、異なることになる。このため、SPAやDPAといった電力解析による統計的手法を施しても、秘密鍵となる数値Dを推定することは困難になる。したがって、暗号化もしくは復号化に用いる演算式自体に改変を加えることなしに、サイドチャネル攻撃を防ぐことができる。   According to the present invention, the numerical value D serving as a secret key is re-encoded into random n-digit data expressed in redundant k-adic numbers and then applied to an arithmetic expression used for encryption or decryption. If redundant k-adic numbers are used, the same numerical value D can be expressed by a plurality of notation methods. Therefore, even if the operation based on the same arithmetic expression is repeated using the same numerical value D, a specific example performed by the transistor circuit is performed. The typical computation process will be different each time. For this reason, even if a statistical method based on power analysis such as SPA or DPA is applied, it is difficult to estimate the numerical value D that is a secret key. Therefore, a side channel attack can be prevented without modifying the arithmetic expression itself used for encryption or decryption.

以下、本発明を図示する実施形態に基づいて説明する。   Hereinafter, the present invention will be described based on the illustrated embodiments.

<<< §1.一般的なRSA暗号演算 >>>
はじめに、説明の便宜上、一般的なRSA暗号演算を例にとって、ICカード内部で行われる暗号処理を説明する。RSA暗号は、桁数が大きい合成数の素因数分解問題が困難であることを安全性の根拠とした公開鍵暗号の一つである。図1に、一般的な公開鍵暗号方式を用いた暗号化および復号化のプロセスを示すブロック図を示す。図示のとおり、暗号化の対象となる平文Mは、鍵Dを用いて暗号化され暗号文Cに変換される。一方、この暗号文Cは別な鍵Eを用いて復号化され平文Mに戻される。通常、鍵D,Eの一方を公開鍵、他方を秘密鍵として用いる。
<<< §1. General RSA cryptographic operations >>>
First, for convenience of explanation, cipher processing performed inside the IC card will be described using a general RSA cipher operation as an example. The RSA cipher is one of the public key ciphers based on the fact that the problem of prime factorization of a composite number with a large number of digits is difficult. FIG. 1 is a block diagram showing an encryption and decryption process using a general public key cryptosystem. As shown in the figure, the plaintext M to be encrypted is encrypted using the key D and converted into a ciphertext C. On the other hand, the ciphertext C is decrypted using another key E and returned to the plaintext M. Usually, one of the keys D and E is used as a public key and the other as a secret key.

図2は、一般的なRSA暗号方式で利用されているべき乗剰余演算式を示す図である。式(1)は、平文Mを暗号化して暗号文Cを生成するための演算式を示している。平文Mも暗号文Cも実際には何らかの数値として与えられる。数値Dは暗号化のための鍵であり、Zは所定の定数である。一方、式(2)は、暗号文Cを復号化して平文Mを生成するための演算式を示している。数値Eは復号化のための鍵であり、数値Dに応じて一義的に定まる値になる。Zは式(1)で用いた定数である。   FIG. 2 is a diagram showing a modular exponentiation expression that should be used in a general RSA encryption method. Expression (1) shows an arithmetic expression for generating the ciphertext C by encrypting the plaintext M. Both plaintext M and ciphertext C are actually given as some numerical values. A numerical value D is a key for encryption, and Z is a predetermined constant. On the other hand, Expression (2) represents an arithmetic expression for decrypting the ciphertext C to generate plaintext M. The numerical value E is a key for decryption, and is a value uniquely determined according to the numerical value D. Z is a constant used in the formula (1).

なお、平文Mと暗号文Cという区別や、暗号化や復号化という区別は、利用者サイドから見た便宜上の区別であって、数学的には、両者は全く対等である。図2の式(1)は、単に、数値Mに対する演算により数値Cが得られることを示すものであり、図2の式(2)は、単に、数値Cに対する演算により数値Mが得られることを示すものである。数値C,Mのいずれを平文、いずれを暗号文と呼ぶかは、利用者側の便宜であり、式(1),(2)のいずれを暗号化、いずれを復号化と呼ぶかも、利用者側の便宜である。したがって、本願明細書では、以下、便宜上、式(1)を利用して「平文Mを暗号化して暗号文Cを得る」例を述べることにするが、もちろん本発明は、式(2)を利用して「暗号文Cを復号化して平文Mを得る」例にも適用可能である。   Note that the distinction between plaintext M and ciphertext C and the distinction between encryption and decryption are distinctions for convenience from the user's side, and are mathematically equivalent. The expression (1) in FIG. 2 simply indicates that the numerical value C can be obtained by the operation on the numerical value M, and the expression (2) in FIG. 2 simply indicates that the numerical value M can be obtained by the operation on the numerical value C. Is shown. Which of the numerical values C and M is called plaintext and which is called ciphertext is convenient for the user, and which of formulas (1) and (2) is called encryption and which is called decryption? It is convenience on the side. Therefore, in the present specification, for the sake of convenience, an example of “encrypting plaintext M to obtain ciphertext C” will be described below using formula (1). Of course, the present invention expresses formula (2) as follows. It can also be applied to an example of “decrypting ciphertext C to obtain plaintext M”.

図3は、ICカード10と外部装置20との間の認証にRSA暗号方式を利用した一般的なシステムを示すブロック図である。図示のとおり、ICカード10内には、制御ユニット11と暗号処理装置12とが設けられており、外部装置20内には、認証処理部21と暗号処理装置22とが設けられている。ICカード10が接触型の場合は、表面に設けられた接触端子を介して外部装置20に対して電気的な接続が行われ、両者間での交信が行われる。また、ICカード10が非接触型の場合は、外部装置20の交信範囲内に入れることにより、両者間で無線交信が行われる。   FIG. 3 is a block diagram showing a general system using the RSA encryption method for authentication between the IC card 10 and the external device 20. As shown in the drawing, a control unit 11 and a cryptographic processing device 12 are provided in the IC card 10, and an authentication processing unit 21 and a cryptographic processing device 22 are provided in the external device 20. When the IC card 10 is a contact type, an electrical connection is made to the external device 20 via a contact terminal provided on the surface, and communication between the two is performed. In addition, when the IC card 10 is a non-contact type, wireless communication is performed between the two by placing the IC card 10 within the communication range of the external device 20.

なお、実際には、ICカード10や外部装置20には、図3に示されている構成要素の他にも、様々な要素が組み込まれている。図3にブロックとして示した構成要素は、外部装置20によってICカード10の認証処理を行うのに必要な構成要素のみである。   Actually, the IC card 10 and the external device 20 incorporate various elements in addition to the components shown in FIG. The components shown as blocks in FIG. 3 are only the components necessary for performing the authentication process of the IC card 10 by the external device 20.

外部装置20は、ICカード10と交信を開始すると、ICカード10が正規のデバイスであるか否かの認証を行う。具体的には、まず、外部装置20側の認証処理部21によって、第1の数値Mを発生させ(通常は、乱数が用いられる)、これを所定の認証コマンドとともにICカード10側に送信する。この認証コマンドおよび数値Mを受信した制御ユニット11は、暗号処理装置12に数値Mを引き渡し、暗号化の処理を実行させる。暗号処理装置12は、与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算(この例では、図2の式(1)に示す演算)を実行して第2の数値Cを生成する。制御ユニット11は、外部装置20へ、生成された数値Cを認証コマンドに対するレスポンスとして送信する。   When the external device 20 starts communication with the IC card 10, the external device 20 authenticates whether or not the IC card 10 is a legitimate device. Specifically, first, the first numerical value M is generated by the authentication processing unit 21 on the external device 20 side (usually a random number is used), and this is transmitted to the IC card 10 side together with a predetermined authentication command. . The control unit 11 that has received the authentication command and the numerical value M hands over the numerical value M to the cryptographic processing device 12 to execute encryption processing. The cryptographic processing device 12 executes a calculation (in this example, the calculation shown in the equation (1) in FIG. 2) using the numerical value D that is the secret key for the given first numerical value M to obtain the second value. The numerical value C is generated. The control unit 11 transmits the generated numerical value C to the external device 20 as a response to the authentication command.

一方、外部装置20は、発生させた第1の数値Mを暗号処理装置22に引き渡し、暗号化の処理を実行させる。暗号処理装置22は、与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算(この例では、やはり図2の式(1)に示す演算)を実行して第2の数値Cを生成する。認証処理部21は、ICカード10側から送信されてきた数値Cと、暗号処理装置22によって生成された数値Cとを比較し、両者が一致すれば、ICカード10を正規のデバイスであると認証することができる。あるいは、ICカード10側から送信されてきた数値Cについて、暗号処理装置22に、図2の式(2)に示す復号化の演算を実行させて数値Mを生成させ、この数値Mが、認証処理部21が最初に生成した数値Mに一致することを確認してもよい。   On the other hand, the external device 20 passes the generated first numerical value M to the cryptographic processing device 22 to execute encryption processing. The cryptographic processing device 22 performs an operation using the numerical value D that is a secret key on the given first numerical value M (in this example, the operation that is also represented by the equation (1) in FIG. 2). A numerical value C of 2 is generated. The authentication processing unit 21 compares the numerical value C transmitted from the IC card 10 side with the numerical value C generated by the cryptographic processing device 22, and if both match, the IC card 10 is regarded as a legitimate device. It can be authenticated. Alternatively, for the numerical value C transmitted from the IC card 10 side, the cryptographic processing device 22 is caused to execute the decryption operation shown in the equation (2) in FIG. 2 to generate the numerical value M, and this numerical value M is authenticated. You may confirm that the process part 21 corresponds with the numerical value M produced | generated initially.

同様の方法で、ICカード10側が、現在交信中の外部装置20を正規の装置であると認証することもできる。こうして、両者間で互いに交信相手が正規の相手であることが認証できれば、両者間で様々な処理のための交信が行われる。その際、必要に応じて、交信対象となるデータに対して、秘密鍵となる数値Dを用いた暗号化や復号化を行うことができる。   By the same method, the IC card 10 side can also authenticate that the external device 20 currently in communication is a legitimate device. Thus, if it is possible to authenticate that the other party is a legitimate party, communication for various processes is performed between the two. At this time, encryption or decryption using the numerical value D as a secret key can be performed on the data to be communicated as necessary.

上述した認証処理や暗号化/復号化処理は、既にICカードを利用したシステムにおいて広く利用されている処理である。秘密鍵となる数値Dは、ICカード10内の暗号処理装置12内に格納されており、通常、外部には決して読み出されることがない仕様になっている。したがって、たとえICカード10が不正者の手元に渡ったとしても、秘密鍵Dが不正者に知られることはないはずである。しかしながら、実際には、既に述べたように、単純電力解析(SPA)や電力差分解析(DPA)といった「サイドチャネル攻撃」により、秘密鍵Dの値を推定されてしまう可能性がある。   The authentication process and the encryption / decryption process described above are processes that are already widely used in systems that already use IC cards. The numerical value D serving as a secret key is stored in the cryptographic processing device 12 in the IC card 10 and normally has a specification that is never read out to the outside. Therefore, even if the IC card 10 reaches the unauthorized person, the secret key D should not be known to the unauthorized person. However, in practice, as described above, the value of the secret key D may be estimated by a “side channel attack” such as simple power analysis (SPA) or power difference analysis (DPA).

特に、暗号処理装置12の内部で行われる演算が、第1の数値Mに対する秘密鍵Dのべき乗「M」の項を含む演算の場合、秘密鍵Dの値が推定される危険性が高くなる。これは、Mの項を含む所定の演算式に基づく演算が、実際には、数値Dの各桁を用いた繰り返し演算によって実行されるため、ICカード10の消費電力の時間変化を統計的に解析することにより、数値Dの各桁の値の推定を許してしまうためである。 In particular, when the calculation performed inside the cryptographic processing device 12 is a calculation including a term “M D ” that is a power of the secret key D with respect to the first numerical value M, there is a high risk that the value of the secret key D is estimated. Become. This calculation based on a predetermined arithmetic expression including a term of M D, in fact, to be performed by repeated calculation using the digits of numbers D, statistical time change in power consumption of the IC card 10 This is because the estimation of the value of each digit of the numerical value D is permitted.

たとえば、前述したRSA暗号方式の場合、暗号処理装置12の内部では、図2の式(1)に示す演算、すなわち、Mを所定の数値Zで除したときのべき乗剰余を示す演算式C=MmodZに基づく演算を実行する必要がある。ところが、このようなべき乗剰余演算をコンピュータで実行するには、実際には、図4に示すような等価演算式を用いた演算を行う必要がある。すなわち、演算式C=MmodZに基づく数値Cは、実際には、
C=(( .....(((1*Md[n−1]
*Md[n−2]modZ)
*Md[n−3]modZ)
.....
*Md[2]modZ)
*Md[1]modZ)
*Md[0]modZ
なる等価演算式を用いて、括弧の内側の演算から順番に実行することによって得られる。ここで、べき乗項として記載されているd[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]は、数値Dを2進表現したときのn桁の各ビット(上位桁側から順に並べたもの)であり、「*」は乗算記号である。
For example, if the RSA cryptosystem described above, inside the cryptographic processing unit 12, calculation shown in the equation of FIG. 2 (1), i.e., calculation formula C indicating the modular exponentiation of time obtained by dividing the M D at a predetermined numerical Z = it is necessary to perform a calculation based on the M D modZ. However, in order to execute such a modular exponentiation with a computer, it is actually necessary to perform an arithmetic operation using an equivalent arithmetic expression as shown in FIG. That is, the numerical value C based on the arithmetic expression C = M D modZ is actually
C = ((... (((1 * M d [n−1] ) 2
* M d [n-2] modZ) 2
* M d [n-3] modZ) 2
.....
* M d [2] modZ) 2
* M d [1] modZ) 2
* M d [0] modZ
It is obtained by executing in order from the operation inside the parentheses using the equivalent operation expression. Here, d [n−1], d [n−2], d [n−3],..., D [2], d [1], d [0] described as power terms are , Each digit of n digits when the numerical value D is expressed in binary (arranged in order from the upper digit side), and “*” is a multiplication symbol.

図5は、図4に示す演算式おいて、22[10進]なる秘密鍵Dを2進表記にして適用した場合の具体的な演算手順を示す図である。すなわち、22[10進]を2進表記すれば、「10110」となるので、上の等価演算式により数値Cの値を求めるには、n=5として、d[4]=1,d[3]=0,d[2]=1,d[1]=1,d[0]=0を代入すればよい。   FIG. 5 is a diagram showing a specific calculation procedure when the secret key D of 22 [decimal] is applied in binary notation in the calculation formula shown in FIG. That is, if 22 [decimal] is expressed in binary, “10110” is obtained. Therefore, in order to obtain the value of the numerical value C by the above equivalent arithmetic expression, n = 5, d [4] = 1, d [ 3] = 0, d [2] = 1, d [1] = 1, d [0] = 0.

図5の下段に示す等価演算式は、このような代入を行った例である。括弧の内側の演算から順番に実行すれば、まず、(1*Mが実行され、続いて、その演算結果をXとして、(X*MmodZ)が実行され、続いて、その演算結果をXとして、(X*MmodZ)が実行され、続いて、その演算結果をXとして、(X*MmodZ)が実行され、最後に、その演算結果をXとして、(X*MmodZ)が実行される。但し、M=Mであるのに対して、M=1であるから、(X*MmodZ)を演算するときと、(X*MmodZ)を演算するときとでは、演算負担が大きく異なり、消費電力に差が生じることになる。したがって、「サイドチャネル攻撃」により、ICカード内部の消費電力をモニタし、これを統計的に解析すれば、秘密鍵Dを構成するビットの0と1の並び順を推定されてしまう可能性がある。 The equivalent arithmetic expression shown in the lower part of FIG. 5 is an example in which such substitution is performed. If executed in order from the operation inside the parentheses, first, (1 * M 1 ) 2 is executed, then, with the operation result as X, (X * M 0 modZ) 2 is executed, then (X * M 1 modZ) 2 is executed with the operation result as X, then (X * M 1 modZ) 2 is executed with the operation result as X, and finally, the operation result as X , (X * M 0 modZ) is executed. However, since M 0 = 1 while M 1 = M, when calculating (X * M 0 modZ) 2 and when calculating (X * M 1 modZ) 2 , The calculation burden is greatly different, resulting in a difference in power consumption. Therefore, if the power consumption inside the IC card is monitored by “side channel attack” and is statistically analyzed, the arrangement order of the bits 0 and 1 constituting the secret key D may be estimated. is there.

一方、数値Dを2進数以外の数値表記で取り扱った演算も可能であるが、「サイドチャネル攻撃」に対して脆弱性を有することに変わりはない。たとえば、図6は、4進数の秘密鍵Dを用いたべき乗剰余演算を暗号処理装置の内部で実行する際の実際の演算式の一例を示す図である。すなわち、数値Dを4進表現したときの全n桁の数値列を、d[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]とすれば、演算式C=MmodZに基づく数値Cは、実際には、
C=(( .....(((1*Md[n−1]
*Md[n−2]modZ)
*Md[n−3]modZ)
.....
*Md[2]modZ)
*Md[1]modZ)
*Md[0]modZ
なる等価演算式を用いて、括弧の内側の演算から順番に実行することによって得られる。
On the other hand, an operation in which the numerical value D is handled in numerical notation other than binary numbers is possible, but it is still vulnerable to the “side channel attack”. For example, FIG. 6 is a diagram illustrating an example of an actual arithmetic expression when a power-residue operation using the quaternary secret key D is executed inside the cryptographic processing apparatus. That is, a numerical sequence of all n digits when the numerical value D is expressed in quaternary is expressed as d [n-1], d [n-2], d [n-3], ..., d [2], d. If [1] and d [0], the numerical value C based on the arithmetic expression C = M D modZ is actually
C = ((... (((1 * M d [n−1] ) 4
* M d [n-2] modZ) 4
* M d [n-3] modZ) 4
.....
* M d [2] modZ) 4
* M d [1] modZ) 4
* M d [0] modZ
It is obtained by executing in order from the operation inside the parentheses using the equivalent operation expression.

図7は、図6に示す演算式おいて、22[10進]なる秘密鍵Dを4進表記にして適用した場合の具体的な演算手順を示す図である。すなわち、22[10進]を4進表記すれば、「112」となるので、上の等価演算式により数値Cの値を求めるには、n=3として、d[2]=1,d[1]=1,d[0]=2を代入すればよい。   FIG. 7 is a diagram showing a specific calculation procedure when the secret key D of 22 [decimal] is applied in the quaternary notation in the calculation formula shown in FIG. That is, if 22 [decimal] is expressed in quaternary form, it becomes “112”. Therefore, in order to obtain the value of the numerical value C by the above equivalent arithmetic expression, n = 3, d [2] = 1, d [ 1] = 1, d [0] = 2 may be substituted.

図7の下段に示す等価演算式は、このような代入を行った例である。括弧の内側の演算から順番に実行すれば、まず、(1*Mが実行され、続いて、その演算結果をXとして、(X*MmodZ)が実行され、最後に、その演算結果をXとして、(X*MmodZ)が実行される。4進表記の場合、秘密鍵Dを構成する各桁は、0〜3のいずれかの数値をとることになるが、M=M*M*M、M=M*M、M=M、M=1であるから、各桁のとる数値に応じて消費電力に差が生じることになり、やはり「サイドチャネル攻撃」により、秘密鍵Dを構成する各桁が、0〜3のいずれであるかを推定されてしまう可能性がある。 The equivalent arithmetic expression shown in the lower part of FIG. 7 is an example in which such substitution is performed. If the operations inside the parentheses are executed in order, first, (1 * M 1 ) 4 is executed, then, (X * M 1 modZ) 4 is executed with the operation result as X, and finally, The calculation result is X, and (X * M 2 modZ) is executed. In the case of quaternary notation, each digit constituting the secret key D takes a numerical value of 0 to 3, but M 3 = M * M * M, M 2 = M * M, M 1 = Since M and M 0 = 1, there will be a difference in power consumption depending on the numerical value taken by each digit, and each digit constituting the secret key D is 0-3 by the “side channel attack”. There is a possibility that it is estimated.

このような「サイドチャネル攻撃」に対する脆弱性は、数値Dを何進法で表記したとしても、根本的には解消することはできない。図8は、一般にk進数の秘密鍵Dを用いたべき乗剰余演算を暗号処理装置の内部で実行する際の実際の演算式の一例を示す図である。すなわち、数値Dをk進表現したときの全n桁の数値列を、d[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]とすれば、演算式C=MmodZに基づく数値Cは、実際には、
C=(( .....(((1*Md[n−1]
*Md[n−2]modZ)
*Md[n−3]modZ)
.....
*Md[2]modZ)
*Md[1]modZ)
*Md[0]modZ
なる等価演算式を用いて、括弧の内側の演算から順番に実行することによって得られるが、各桁のとる数値に応じて消費電力に差が生じることに変わりはなく、「サイドチャネル攻撃」により、秘密鍵Dを構成する各桁が推定されてしまう可能性がある。
Such vulnerability to the “side channel attack” cannot be fundamentally eliminated even if the numerical value D is expressed in any number system. FIG. 8 is a diagram illustrating an example of an actual arithmetic expression when a power-residue operation using a secret key D in k-decimal is generally executed inside the cryptographic processing apparatus. That is, the numerical sequence of all n digits when the numerical value D is expressed in k is represented by d [n-1], d [n-2], d [n-3], ..., d [2], d. If [1] and d [0], the numerical value C based on the arithmetic expression C = M D modZ is actually
C = ((... (((1 * M d [n−1] ) k
* M d [n-2] modZ) k
* M d [n-3] modZ) k
.....
* M d [2] modZ) k
* M d [1] modZ) k
* M d [0] modZ
It is obtained by executing in order from the operation inside the parenthesis using the equivalent arithmetic expression as follows, but there is no change in the power consumption depending on the numerical value taken by each digit, and by `` side channel attack '' Each digit constituting the secret key D may be estimated.

以上、一般的なRSA暗号方式によるべき乗剰余演算を実行する場合に、「サイドチャネル攻撃」による脆弱性が生じることを説明したが、このような問題は、Diffie Hellman暗号方式、EL Gamal暗号方式など、他のべき乗剰余演算を利用する暗号方式にも共通した問題である。また、最近では、楕円曲線暗号方式も利用されているが、この楕円曲線暗号方式に対しても、「サイドチャネル攻撃」による脆弱性が生じることに変わりはない。本発明は、このような様々な暗号方式における「サイドチャネル攻撃」に対処することが可能な新たな手法を提案するものである。   As described above, it has been explained that when performing power-residue calculation by a general RSA encryption method, a vulnerability due to “side channel attack” occurs. However, such problems include Diffie Hellman encryption method, EL Gamal encryption method, etc. This is a problem common to other cryptosystems that use exponentiation. Recently, the elliptic curve cryptosystem is also used, but the elliptic curve cryptosystem is still vulnerable to the “side channel attack”. The present invention proposes a new technique capable of dealing with such “side channel attacks” in various cryptographic schemes.

<<< §2.本発明の基本概念 >>>
本発明の重要な特徴は、秘密鍵となる数値Dを、冗長なk進数で表現した上で、実際の演算に利用する点にある。いま、図9に示すように、数値Dを任意のk進数で表現することを考えよう。図において、d[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]は、それぞれ数値Dをk進表現したときの全n桁の数値列であり、この全n桁の数値列として表現される数値Dの値は、図示のとおり、
D=d[n−1]*kn−1
+d[n−2]*kn−2
+d[n−3]*kn−3
.....
+d[2]*k
+d[1]*k
+d[0]*k
となる。
<<< §2. Basic concept of the present invention >>
An important feature of the present invention resides in that a numerical value D serving as a secret key is expressed in redundant k-adic numbers and used for actual calculation. Now, let us consider expressing the numerical value D in an arbitrary k-ary number as shown in FIG. In the figure, d [n-1], d [n-2], d [n-3],..., D [2], d [1], d [0] This is a numerical sequence of all n digits when expressed, and the value of the numerical value D expressed as this all n-digit numerical sequence is as shown in the figure:
D = d [n−1] * k n−1
+ D [n-2] * k n-2
+ D [n-3] * k n-3
.....
+ D [2] * k 2
+ D [1] * k 1
+ D [0] * k 0
It becomes.

ここで、第i桁目の数値をd[i]とすれば、
0≦d[i]≦dmax
であり、通常のk進表現の場合は、dmax=k−1に設定される。たとえば、2進表現の場合であれば、dmax=1に設定されるので、各桁の数値d[i]は0または1のいずれかである。4進表現の場合は、dmax=3に設定されるので、各桁の数値d[i]は0〜3のいずれかになり、7進表現の場合は、dmax=6に設定されるので、各桁の数値d[i]は0〜6のいずれかになる。
Here, if the value of the i-th digit is d [i],
0 ≦ d [i] ≦ dmax
In the case of normal k-ary representation, dmax = k−1 is set. For example, in the case of binary representation, since dmax = 1 is set, the numerical value d [i] of each digit is either 0 or 1. In the case of the quaternary representation, dmax = 3 is set, so that the numerical value d [i] of each digit is 0 to 3, and in the case of the hexadecimal representation, dmax = 6 is set. The numerical value d [i] of each digit is one of 0-6.

これに対して、冗長k進表現の場合は、dmax>k−1に設定される。たとえば、冗長2進表現の場合であれば、dmax=2以上に設定されることになる。図10(a) に示すとおり、通常2進表現の場合、dmax=1であるから、各桁の数値d[i]は、
0≦d[i]≦1(各桁の値は0〜1)
であるが、冗長2進表現の場合、dmax=3に設定すれば、図10(a) に示すとおり、
0≦d[i]≦3(各桁の値は0〜3)
となる。
On the other hand, in the case of redundant k-ary representation, dmax> k−1 is set. For example, in the case of redundant binary representation, dmax = 2 or more is set. As shown in FIG. 10 (a), in the case of normal binary representation, dmax = 1, so the numerical value d [i] of each digit is
0 ≦ d [i] ≦ 1 (value of each digit is 0 to 1)
However, in the case of redundant binary representation, if dmax = 3 is set, as shown in FIG.
0 ≦ d [i] ≦ 3 (value of each digit is 0-3)
It becomes.

もちろん、冗長2進表現におけるdmaxは2以上であればいくつに設定してもよい。dmax=5に設定すれば、各桁の数値d[i]は0〜5のいずれかになる。同様に、冗長4進表現の場合であれば、dmax=4以上に設定すればよいので、たとえば、dmax=7に設定すれば、各桁の数値d[i]は0〜7のいずれかになり、dmax=9に設定すれば、各桁の数値d[i]は0〜9のいずれかになる。   Of course, dmax in the redundant binary representation may be set to any number as long as it is 2 or more. If dmax = 5 is set, the numerical value d [i] of each digit is 0 to 5. Similarly, in the case of redundant quaternary representation, dmax = 4 or more may be set. For example, when dmax = 7, the numerical value d [i] of each digit is set to any one of 0-7. Thus, if dmax = 9 is set, the numerical value d [i] of each digit is one of 0-9.

ここで重要な点は、冗長k進表現を用いると、同じ数値Dを複数通りの表記方法で表現することができる点である。図11は、数値D=22[10進]を、通常2進表現および冗長2進表現で表した例を示す図である。図11(a) の「10110」が、通常2進表現による表記方法を示しているのに対して、図11(b1)の「10022」、図11(b2)の「01222」、図11(b3)の「02030」は、いずれも冗長2進表現による表記方法を示している(この他にも、数値D=22[10進]の冗長2進表記方法は存在する。もちろん、図11(a) の「10110」も、冗長2進表現の一形態に含まれることになる)。各表記方法を比較すると、5桁の数字の構成は互いに異なっているが、右側の計算結果を見れば明らかなように、いずれも同一の数値D=22[10進]を示す点では共通している。   The important point here is that the same numerical value D can be expressed by a plurality of notation methods using redundant k-ary representation. FIG. 11 is a diagram illustrating an example in which the numerical value D = 22 [decimal] is represented by a normal binary expression and a redundant binary expression. “10110” in FIG. 11 (a) normally indicates a notation method in binary representation, whereas “10022” in FIG. 11 (b1), “01222” in FIG. 11 (b2), and FIG. “02030” of b3) indicates a redundant binary representation method (in addition to this, there is a redundant binary representation method of numerical value D = 22 [decimal]. Of course, FIG. a) “10110” is also included in one form of redundant binary representation). Comparing the notation methods, the five-digit numbers are different from each other. However, as is apparent from the calculation result on the right side, they all have the same numerical value D = 22 [decimal]. ing.

図12は、4進数の例である。図12(a) に示すとおり、通常4進表現の場合、dmax=3であるから、各桁の数値d[i]は、
0≦d[i]≦3(各桁の値は0〜3)
であるが、冗長4進表現の場合、たとえばdmax=7に設定すれば、図12(b) に示すとおり、
0≦d[i]≦7(各桁の値は0〜7)
となる。
FIG. 12 is an example of a quaternary number. As shown in FIG. 12 (a), in the case of normal quaternary expression, dmax = 3, so the numerical value d [i] of each digit is
0 ≦ d [i] ≦ 3 (value of each digit is 0-3)
However, in the case of redundant quaternary representation, for example, if dmax = 7 is set, as shown in FIG.
0 ≦ d [i] ≦ 7 (value of each digit is 0-7)
It becomes.

図13は、数値D=22[10進]を、通常4進表現および冗長4進表現で表した例を示す図である。図13(a) の「112」が、通常4進表現による表記方法を示しているのに対して、図13(b1)の「106」、図13(b2)の「052」は、いずれも冗長4進表現による表記方法を示している(この他にも、数値D=22[10進]の冗長4進表記方法は存在する。もちろん、図13(a) の「112」も、冗長4進表現の一形態に含まれることになる)。各表記方法を比較すると、3桁の数字の構成は互いに異なっているが、右側の計算結果を見れば明らかなように、いずれも同一の数値D=22[10進]を示す点では共通している。   FIG. 13 is a diagram illustrating an example in which the numerical value D = 22 [decimal] is represented by a normal quaternary expression and a redundant quaternary expression. “112” in FIG. 13 (a) usually indicates a notation method in quaternary expression, whereas “106” in FIG. 13 (b1) and “052” in FIG. 13 (b2) are both. A notation method using a redundant quaternary representation is shown (in addition to this, there is a redundant quaternary notation method with a numerical value D = 22 [decimal]. Of course, “112” in FIG. (It will be included in a form of decimal expression). When the notation methods are compared, the configuration of the three-digit numbers is different from each other. However, as is apparent from the calculation result on the right side, they are common in that they all show the same numerical value D = 22 [decimal]. ing.

このように、同一の数値D=22[10進]であっても、冗長k進数を用いた表記を行えば、複数通りの表記方法で表現することができるので、演算を行う際に、複数通りの表記方法のいずれかを選択して用いるようにすれば、同じ数値Dを用いて同じ演算式に基づく演算を繰り返し行ったとしても、トランジスタ回路によって行われる具体的な演算プロセスは、毎回、異なることになる。このため、SPAやDPAといった電力解析による統計的手法を施しても、秘密鍵となる数値Dを推定することは困難になる。これが本発明の基本原理である。   In this way, even if the same numerical value D = 22 [decimal], if it is expressed using a redundant k-decimal number, it can be expressed by a plurality of notation methods. If any one of the notation methods is selected and used, even if the calculation based on the same arithmetic expression is repeated using the same numerical value D, the specific calculation process performed by the transistor circuit is Will be different. For this reason, even if a statistical method based on power analysis such as SPA or DPA is applied, it is difficult to estimate the numerical value D that is a secret key. This is the basic principle of the present invention.

§1で述べたとおり、図5は、22[10進]なる秘密鍵Dの通常2進表記「10110」を用いて、数値Cを求める演算を行う手順を示す図である。これに対して、図14は、22[10進]なる秘密鍵Dの冗長2進表記の1つである「10022」を用いて、数値Cを求める演算を行う手順を示す図である。両者は、全く同じ演算式であり、秘密鍵Dの数値も全く同一であるから、得られる数値Cの演算結果も両者では全く同じになる。したがって、図5に示す演算の代わりに、図14に示す演算を実行しても、暗号処理演算としては何ら支障は生じない。   As described in §1, FIG. 5 is a diagram illustrating a procedure for performing an operation for obtaining the numerical value C using the normal binary notation “10110” of the secret key D of 22 [decimal]. On the other hand, FIG. 14 is a diagram showing a procedure for performing an operation for obtaining a numerical value C using “10022” which is one of redundant binary representations of the secret key D of 22 [decimal]. Since both are the same arithmetic expression and the numerical value of the secret key D is exactly the same, the calculation result of the numerical value C obtained is exactly the same in both cases. Therefore, even if the calculation shown in FIG. 14 is executed instead of the calculation shown in FIG. 5, there is no problem as a cryptographic processing calculation.

ところが、全く同じ数値M,D,Zを与えて、全く同じ演算式に基づく演算を実行しているにもかかわらず、図5に示す演算と図14に示す演算とでは、個々の括弧内の演算時の消費電力は異なってくる。すなわち、図5の場合、(1*Mが実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行されるのに対して、図14の場合、(1*Mが実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行される。 However, although the same numerical values M, D, and Z are given and the calculation based on the same calculation formula is executed, the calculation shown in FIG. 5 and the calculation shown in FIG. The power consumption during the calculation is different. That is, in the case of FIG. 5, (1 * M 1 ) 2 is executed, and (X * M 0 modZ) 2 is executed with the operation result as X, and (X * M 1 modZ) 2 with the operation result as X. And (X * M 1 modZ) 2 is executed with the operation result as X, and (X * M 0 modZ) is executed with the operation result as X. In the case of FIG. 1 * M 1 ) 2 is executed, (X * M 0 modZ) 2 is executed with the operation result as X, and (X * M 0 modZ) 2 is executed with the operation result as X. (X * M 2 modZ) 2 is executed as X, and (X * M 2 modZ) is executed with the operation result as X.

もちろん、22[10進]なる秘密鍵Dの冗長2進表記は、図11に示すとおり、他にも「01222」,「02030」等があるので、これら複数の冗長2進表記をランダムに選択して演算に利用するようにすれば、全く同じ数値M,D,Zを与えて、全く同じ演算式に基づく演算を実行しているにもかかわらず、消費電力のパターンは毎回異なることになる。したがって、ICカード内部の消費電力をモニタし、これを統計的に解析する手法を採る「サイドチャネル攻撃」が行われたとしても、得られる消費電力のパターンには画一性が失われるため、統計的な解析によって数値Dの値を推定することは困難になる。   Of course, as shown in FIG. 11, there are “01222”, “02030”, etc., as redundant binary representations of the secret key D of 22 [decimal], so these multiple redundant binary representations are selected at random. If the calculation is used for the calculation, the power consumption pattern will be different every time even though the same numerical values M, D, and Z are given and the calculation based on the same calculation formula is executed. . Therefore, even if a “side channel attack” is performed in which the power consumption inside the IC card is monitored and statistically analyzed, the uniformity of the obtained power consumption pattern is lost. It becomes difficult to estimate the value D by statistical analysis.

もちろん、本発明は冗長2進表記を用いる例に限定されるものではない。§1で述べたとおり、図7には、22[10進]なる秘密鍵Dの通常4進表記「112」を用いて、数値Cを求める演算を行う手順が示されている。これに対して、図15は、22[10進]なる秘密鍵Dの冗長4進表記の1つである「106」を用いて、数値Cを求める演算を行う手順を示す図である。両者は、全く同じ演算式であり、秘密鍵Dの数値も全く同一であるから、得られる数値Cの演算結果も両者では全く同じになる。したがって、図7に示す演算の代わりに、図15に示す演算を実行しても、暗号処理演算としては何ら支障は生じない。   Of course, the present invention is not limited to the example using redundant binary notation. As described in §1, FIG. 7 shows a procedure for performing an operation for obtaining the numerical value C using the normal quaternary notation “112” of the secret key D of 22 [decimal]. On the other hand, FIG. 15 is a diagram showing a procedure for performing an operation for obtaining the numerical value C using “106” which is one of the redundant quaternary representations of the secret key D of 22 [decimal]. Since both are the same arithmetic expression and the numerical value of the secret key D is exactly the same, the calculation result of the numerical value C obtained is exactly the same in both cases. Therefore, even if the calculation shown in FIG. 15 is executed instead of the calculation shown in FIG. 7, there is no problem as a cryptographic processing calculation.

ところが、全く同じ数値M,D,Zを与えて、全く同じ演算式に基づく演算を実行しているにもかかわらず、図7に示す演算と図15に示す演算とでは、個々の括弧内の演算時の消費電力は異なってくる。すなわち、図7の場合、(1*Mが実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行されるのに対して、図15の場合、(1*Mが実行され、その演算結果をXとして(X*MmodZ)が実行され、その演算結果をXとして(X*MmodZ)が実行される。 However, although the same numerical values M, D, and Z are given and the calculation based on the same calculation formula is executed, the calculation shown in FIG. 7 and the calculation shown in FIG. The power consumption during the calculation is different. That is, in the case of FIG. 7, (1 * M 1 ) 4 is executed, and (X * M 1 modZ) 4 is executed with the operation result as X, and (X * M 2 modZ) 2 with the operation result as X. In the case of FIG. 15, (1 * M 1 ) 4 is executed, and the operation result is executed as X (X * M 0 modZ) 4 and the operation result is set as X ( X * M 6 modZ) 2 is executed.

もちろん、22[10進]なる秘密鍵Dの冗長4進表記は、図13に示すとおり、他にも「106」,「052」等があるので、これら複数の冗長4進表記をランダムに選択して演算に利用するようにすれば、全く同じ数値M,D,Zを与えて、全く同じ演算式に基づく演算を実行しているにもかかわらず、消費電力のパターンは毎回異なることになり、「サイドチャネル攻撃」への対策は有効になる。しかも、暗号処理に用いる演算式は、あくまでも「C=MmodZ」という同一の演算式ですむ。このように、暗号化もしくは復号化に用いる演算式自体に改変を加えることなしに、サイドチャネル攻撃を防ぐことができる点が、本発明の重要な特徴である。 Of course, the redundant quaternary representation of the secret key D of 22 [decimal] is “106”, “052”, etc. as shown in FIG. If it is used for the calculation, the power consumption pattern will be different every time even though the same numerical values M, D, and Z are given and the calculation based on the same calculation formula is executed. , Measures against “side channel attacks” are effective. In addition, the arithmetic expression used for the encryption process can be the same arithmetic expression “C = M D modZ”. Thus, an important feature of the present invention is that a side channel attack can be prevented without modifying the arithmetic expression itself used for encryption or decryption.

結局、本発明の本質的な技術思想は、秘密鍵となる数値Dを内蔵している演算処理装置に対して、外部から第1の数値Mを与え、当該演算処理装置の内部で、少なくとも数値Mと数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、当該演算処理装置の内部で、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させる点にある。   After all, the essential technical idea of the present invention is that a first numerical value M is given from the outside to an arithmetic processing device having a numerical value D as a secret key, and at least the numerical value is given inside the arithmetic processing device. In the cryptographic processing method for generating a second numerical value C by executing an operation using M and the numerical value D and outputting the second numerical value C to the outside, the numerical value D is converted into one digit within the arithmetic processing unit. Random data expressed in redundant k-adic numbers in which the numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)” is generated, and the second numerical value C is generated using this random data. The point is to execute the operation to generate.

特に、演算処理装置としてICカードを用いる場合であれば、秘密鍵となる数値Dを内蔵し、演算処理機能および乱数発生機能を有するICカードに対して、外部から第1の数値Mを与え、当該ICカードの内部で、少なくとも数値Mと数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、当該ICカードの内部で、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを、乱数発生機能を用いて生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させるようにすればよい。   In particular, if an IC card is used as an arithmetic processing unit, a numerical value D as a secret key is built in, and a first numerical value M is given from the outside to the IC card having an arithmetic processing function and a random number generation function. In an encryption processing method for generating a second numerical value C by executing an operation using at least the numerical value M and the numerical value D inside the IC card, and outputting the second numerical value C to the outside, Using random number generation function, random data expressing a numerical value D in redundant k-ary numbers in which a numerical value d of one digit takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)” And generating the second numerical value C using this random data.

<<< §3.本発明に係る暗号処理装置 >>>
図16は、本発明に係る暗号処理装置100の構成を示すブロック図である。この暗号処理装置100は、たとえば、図3に示す暗号処理装置12としてICカード10に組み込むことができる。もっとも、この図16に示す個々のブロックは、実際には、コンピュータ用のハードウエアおよびこのコンピュータに組み込まれたプログラムによって実現可能な構成要素であり、たとえば、ICカード10に、OSプログラムやアプリケーションプログラムを組み込むことによって実現されることになる。
<<< §3. Cryptographic processing apparatus according to the present invention >>
FIG. 16 is a block diagram showing the configuration of the cryptographic processing apparatus 100 according to the present invention. This cryptographic processing apparatus 100 can be incorporated in the IC card 10 as the cryptographic processing apparatus 12 shown in FIG. 3, for example. However, each block shown in FIG. 16 is actually a component that can be realized by hardware for a computer and a program incorporated in the computer. For example, an OS program or an application program is stored in the IC card 10. It will be realized by incorporating.

この図3に示す暗号処理装置100の基本機能は、外部から与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算を行うことにより第2の数値Cを生成し、これを外部へ出力する処理を行うことである。そのため、この暗号処理装置100は、図示のとおり、第1の数値Mを外部から入力する入力部110と、生成した第2の数値Cを外部へ出力する出力部120と、第2の数値Cを生成する演算実行部130と、再符号化部140と、秘密鍵となる数値Dを格納する秘密鍵格納部150と、乱数Rを発生させる乱数発生部160と、を有している。   The basic function of the cryptographic processing apparatus 100 shown in FIG. 3 is to generate a second numerical value C by performing an operation using a numerical value D as a secret key on the first numerical value M given from the outside. The process of outputting this to the outside is performed. Therefore, as illustrated, the cryptographic processing apparatus 100 includes an input unit 110 that inputs the first numerical value M from the outside, an output unit 120 that outputs the generated second numerical value C to the outside, and a second numerical value C. And a re-encoding unit 140, a secret key storage unit 150 that stores a numerical value D as a secret key, and a random number generation unit 160 that generates a random number R.

ここで、再符号化部140は、乱数発生部160が発生させた乱数Rを用いて、秘密鍵格納部150に格納されている数値Dを再符号化する構成要素である。再符号化は、数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムなn桁のデータとして表現することによって行われる。   Here, the re-encoding unit 140 is a component that re-encodes the numerical value D stored in the secret key storage unit 150 using the random number R generated by the random number generation unit 160. Re-encoding is a random n-digit number in which a numerical value D is represented by a redundant k-ary number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. It is done by expressing it as data.

たとえば、秘密鍵格納部150に格納されている数値Dが、D=22[10進]であり(図示の例では、通常の2進数「10110」の形で、秘密鍵格納部150に格納されていることになる)、これを冗長な2進数で表現した形に再符号化する場合(演算実行部130が、2進表記された秘密鍵Dを用いて演算を行う場合)であれば、再符号化部140は、乱数Rを利用して、図11(b1)の「10022」、図11(b2)の「01222」、図11(b3)の「02030」等の複数通りの「D=22[10進]に対応する冗長2進表記」(通常2進表記の「10110」を含む)の中の1つをランダムに選択することにより、冗長2進表記されたn桁の数値からなるデータを生成する処理を行う。このような再符号化の具体的な方法については、§4で述べる。   For example, the numerical value D stored in the private key storage unit 150 is D = 22 [decimal] (in the illustrated example, the numerical value D is stored in the private key storage unit 150 in the form of a normal binary number “10110”). If this is re-encoded into a form expressed in a redundant binary number (when the operation execution unit 130 performs an operation using the secret key D expressed in binary), Using the random number R, the re-encoding unit 140 uses “10022” in FIG. 11 (b1), “01222” in FIG. 11 (b2), “02030” in FIG. By randomly selecting one of “redundant binary notation corresponding to 22 [decimal]” (normally including “10110” in binary notation), an n-digit numerical value expressed in redundant binary notation is used. The process which produces | generates this data is performed. A specific method of such re-encoding will be described in §4.

演算実行部130は、少なくとも、入力部110が入力した数値Mと、再符号化部140によって再符号化された数値D(冗長k進表記されたn桁の数値)と、を用いた所定の演算を行うことにより、第2の数値Cを生成する構成要素である。ここでは、前述したとおり、RSA暗号方式の実施例が示されているので、演算実行部130は、予め設定されている所定の定数Zを用いて、演算式C=MmodZに基づく演算を行うことにより、第2の数値Cを求めることになる。 The operation execution unit 130 uses a predetermined value at least using the numerical value M input by the input unit 110 and the numerical value D (n-digit numerical value expressed in redundant k-ary notation) re-encoded by the re-encoding unit 140. It is a component that generates the second numerical value C by performing an operation. Here, as described above, since the embodiment of the RSA encryption method is shown, the calculation execution unit 130 uses the predetermined constant Z set in advance to perform the calculation based on the calculation formula C = M D modZ. By doing so, the second numerical value C is obtained.

既に述べたとおり、この演算は、実際には、図8に示すような等価演算式を用いた繰り返し演算によって行われる。すなわち、演算実行部130は、再符号化部140によって再符号化されたn桁のデータの中から1桁の数値dを抽出して用いる演算を、順番に繰り返し実行することにより第2の数値Cを求めることになる。   As already described, this calculation is actually performed by iterative calculation using an equivalent calculation formula as shown in FIG. That is, the arithmetic execution unit 130 extracts the second numerical value by sequentially performing operations that extract and use the single-digit numerical value d from the n-digit data re-encoded by the re-encoding unit 140. C will be calculated.

なお、ここに示す実施形態の場合、入力部110が第1の数値Mを外部から入力するたびに、乱数発生部160が新たな乱数Rを発生させ、再符号化部140が新たな再符号化を行い、演算実行部130が新たに再符号化された数値Dを用いて第2の数値Cを求める演算を行うようにしている。したがって、第1の数値Mが与えられるたびに、数値Dを構成するn桁の数値の組み合わせは一新されることになり、演算実行部130は、この一新された数値Dを用いて演算を行うことになる。   In the embodiment shown here, each time the input unit 110 inputs the first numerical value M from the outside, the random number generation unit 160 generates a new random number R, and the re-encoding unit 140 generates a new re-encoding. The calculation execution unit 130 performs a calculation to obtain the second numerical value C using the newly re-encoded numerical value D. Therefore, each time the first numerical value M is given, the combination of the n-digit numerical values constituting the numerical value D is renewed, and the operation execution unit 130 performs an operation using the renewed numerical value D. Will do.

もちろん、数値Dを構成するn桁の数値の組み合わせは、必ずしも第1の数値Mを外部から入力するたびに毎回更新する必要はなく、たとえば、第1の数値Mを3回入力する度に一新する、という方法を採ってもかまわないが、「サイドチャネル攻撃」への対策を効果的にする上では、上述したように、第1の数値Mを外部から入力するたびに毎回更新するのが好ましい。   Of course, the combination of the n-digit numerical values constituting the numerical value D does not necessarily need to be updated every time the first numerical value M is input from the outside. For example, every time the first numerical value M is input three times. However, in order to effectively take measures against the “side channel attack”, as described above, the first numerical value M is updated every time it is input from the outside. Is preferred.

<<< §4.再符号化の具体的な方法 >>>
最後に、図16に示す再符号化部140の具体的な構成例をいくつか示すことにより、再符号化処理の具体的な手順を例示する。もっとも、以下に述べる具体例は、あくまでも実施例として示すものであり、本発明に用いる再符号化部140の構成は、これらの実施例に限定されるものではない。
<<< §4. Specific method of re-encoding >>>
Finally, a specific procedure of the re-encoding process is illustrated by showing some specific configuration examples of the re-encoding unit 140 shown in FIG. However, the specific examples described below are merely examples, and the configuration of the re-encoding unit 140 used in the present invention is not limited to these examples.

<実施例1>
図17は、図16に示す暗号処理装置の再符号化部140の第1の構成例を示すブロック図である。図示のとおり、この例の場合、再符号化部140Aは、制御要素141A、数値確認要素142A、ランダムデータ生成要素143Aによって構成されている。
<Example 1>
FIG. 17 is a block diagram illustrating a first configuration example of the re-encoding unit 140 of the cryptographic processing device illustrated in FIG. 16. As illustrated, in this example, the re-encoding unit 140A includes a control element 141A, a numerical value confirmation element 142A, and a random data generation element 143A.

ランダムデータ生成要素143Aは、乱数発生部160から与えられる乱数Rを用いて「0≦d≦dmax」の範囲内の値を発生させる処理をn回繰り返すことによりn桁のランダムデータを生成する機能を果たす。ここで生成されたランダムデータは、数値確認要素142Aに与えられる。数値確認要素142Aは、ランダムデータ生成要素143Aが生成したランダムデータが、秘密鍵格納部150から読み出された数値Dと等しいか否かの判定を行い、その結果を制御要素141Aに報告する。制御要素141Aは、数値確認要素142Aが等しいとの判断を行うまで、ランダムデータ生成要素143Aにランダムデータの生成を繰り返し実行させ、数値確認要素142Aが等しいとの判断を行った際のランダムデータを再符号化したデータ(数値Dを冗長k進表記したn桁の数値)として出力する。   The random data generation element 143A has a function of generating n-digit random data by repeating the process of generating a value within the range of “0 ≦ d ≦ dmax” n times using the random number R given from the random number generation unit 160. Fulfill. The random data generated here is given to the numerical confirmation element 142A. The numerical value confirmation element 142A determines whether or not the random data generated by the random data generation element 143A is equal to the numerical value D read from the secret key storage unit 150, and reports the result to the control element 141A. The control element 141A causes the random data generation element 143A to repeatedly generate random data until it is determined that the numerical value confirmation element 142A is equal, and the random data when the numerical value confirmation element 142A is determined to be equal is determined. The data is output as re-encoded data (the numerical value D is an n-digit numerical value in redundant k-ary notation).

図18は、図17に示す再符号化部140Aの動作を説明する流れ図である。まず、ステップS11において、ランダムデータ生成要素143Aによるn桁のランダムデータ生成処理が行われる。たとえば、図11に示すように、各桁の数値が0〜3の範囲をとる5桁の数値からなるランダムデータを生成するのであれば、0〜3の範囲内の整数値をとる乱数を発生させる処理を5回繰り返して実行し、発生させた5つの整数を並べ、これをランダムデータとして出力すればよい。いわば、0〜dmaxまでの整数の目をもつn個のサイコロを振って、出た目をそのまま並べることにより、ランダムデータが生成されることになる。   18 is a flowchart for explaining the operation of the re-encoding unit 140A shown in FIG. First, in step S11, an n-digit random data generation process is performed by the random data generation element 143A. For example, as shown in FIG. 11, if random data consisting of a 5-digit number in which each numerical value ranges from 0 to 3 is generated, a random number having an integer value in the range from 0 to 3 is generated. This process is repeated five times, and the generated five integers are arranged and output as random data. In other words, random data is generated by rolling n dice having integer eyes from 0 to dmax and arranging the exited eyes as they are.

続いて、ステップS12では、数値確認要素142による比較処理が行われる。すなわち、生成されたランダムデータが示す数値と、秘密鍵格納部150から読み出された数値Dとが比較される(図9に示す加算によって値が決定される)。そして、制御要素141Aが、ステップS13において等しいと判断されるまで、ステップS11の処理が繰り返されるような制御を行い、等しいと判断されたときには、ステップS14へと進み、そのときのランダムデータを、再符号化データとして出力することになる。   Subsequently, in step S12, a comparison process by the numerical value confirmation element 142 is performed. That is, the numerical value indicated by the generated random data is compared with the numerical value D read from the secret key storage unit 150 (the value is determined by the addition shown in FIG. 9). Then, the control element 141A performs control such that the process of step S11 is repeated until it is determined to be equal in step S13. When it is determined that the control element 141A is equal, the process proceeds to step S14. It is output as re-encoded data.

要するに、この実施例1として例示する方法は、所望の数値Dと等しくなるランダムデータが得られるまで、繰り返しサイコロを振り続ける方法ということができる。この方法は、非常に単純な方法であるが、桁数nの値やkの値が大きい場合には、数値Dに等しくなるランダムデータが得られるまで長時間を要することになるため、あまり好ましくない。   In short, the method exemplified as the first embodiment can be said to be a method of continuously rolling the dice until random data equal to the desired numerical value D is obtained. This method is a very simple method. However, when the value of the number of digits n or the value of k is large, it takes a long time until random data equal to the numerical value D is obtained. Absent.

<実施例2>
図19は、図16に示す暗号処理装置の再符号化部140の第2の構成例を示すブロック図である。図示のとおり、この例の場合、再符号化部140Bは、制御要素141B、レジスタ142B、初期データ設定要素143B、増加補正実行要素144B、減少補正実行要素145B、桁選択要素146B、増減決定要素147Bによって構成されている。
<Example 2>
FIG. 19 is a block diagram illustrating a second configuration example of the re-encoding unit 140 of the cryptographic processing device illustrated in FIG. 16. As illustrated, in this example, the re-encoding unit 140B includes the control element 141B, the register 142B, the initial data setting element 143B, the increase correction execution element 144B, the decrease correction execution element 145B, the digit selection element 146B, and the increase / decrease determination element 147B. It is constituted by.

レジスタ142Bは、再符号化プロセスの対象となるk進n桁からなるデータを一時的に保持するための構成要素である。このレジスタ142Bには、初期データ設定要素143Bによって初期値の設定が行われる。すなわち、初期データ設定要素143Bは、秘密鍵格納部150から読み出した秘密鍵D(図示の例では、2進数の数値D)を、1つの桁の数値dが「0≦d≦k−1」の範囲内の値をとる通常のk進数で表現することにより、n桁からなるデータを用意し、用意したデータを初期データとしてレジスタ142Bに設定する機能を果たす。   The register 142B is a component for temporarily holding data consisting of k-ary n digits, which is a target of the re-encoding process. An initial value is set in the register 142B by an initial data setting element 143B. That is, the initial data setting element 143B uses the secret key D read out from the secret key storage unit 150 (in the illustrated example, the binary numeric value D), and the single digit numeric value d is “0 ≦ d ≦ k−1”. In this case, n-digit data is prepared, and the prepared data is set in the register 142B as initial data.

一方、桁選択要素146Bは、乱数発生部160が発生させた乱数Rを用いて、レジスタ142Bのn桁のうちの任意の1桁を選択桁として選択する機能を果たす。乱数Rを用いているため、n桁のうちの任意の1桁がランダムに選択されることになる。また、増減決定要素147Bは、乱数発生部160が発生させた乱数Rを用いて、増加補正もしくは減少補正のいずれかを決定する機能を果たす。こちらも乱数Rを用いているため、増加補正もしくは減少補正がランダムに選択されることになる。増加補正と減少補正との選択比率は、1:1にする必要はない。実用上は、増加補正の選択頻度が減少補正の選択頻度より高くなるような設定を行うのが好ましい。   On the other hand, the digit selection element 146B functions to select any one digit among the n digits of the register 142B as a selected digit using the random number R generated by the random number generator 160. Since the random number R is used, any one digit out of n digits is selected at random. The increase / decrease determination element 147B functions to determine either increase correction or decrease correction using the random number R generated by the random number generator 160. Since the random number R is also used here, increase correction or decrease correction is selected at random. The selection ratio between the increase correction and the decrease correction need not be 1: 1. Practically, it is preferable to set so that the selection frequency of increase correction is higher than the selection frequency of decrease correction.

増加補正実行要素144Bは、増減決定要素147Bにより増加補正が決定された場合に、桁選択要素146Bが選択した選択桁の数値dについてd<dmaxが満たされ、かつ、他の桁の調整によって所定の増加補正分δ(但し、δ≦dmax−d)を相殺することが可能であることを条件として、選択桁に増加補正分δを加え、他の桁を調整して増加補正分δを相殺する補正を行う構成要素である。   When the increase correction is determined by the increase / decrease determination element 147B, the increase correction execution element 144B satisfies d <dmax with respect to the numerical value d of the selected digit selected by the digit selection element 146B, and is determined by adjustment of other digits. Assuming that it is possible to cancel the increase correction amount δ (where δ ≦ dmax−d), the increase correction amount δ is added to the selected digit and the other digits are adjusted to cancel the increase correction amount δ. This is a component that performs correction.

これに対して、減少補正実行要素145Bは、増減決定要素147Bにより減少補正が決定された場合に、桁選択要素146Bが選択した選択桁の数値dについてd≠0が満たされ、かつ、他の桁の調整によって所定の減少補正分δ(但し、δ≦d)を相殺することが可能であることを条件として、選択桁から減少補正分δを減じ、他の桁を調整して減少補正分δを相殺する補正を行う構成要素である。   On the other hand, when the decrease correction is determined by the increase / decrease determination element 147B, the decrease correction execution element 145B satisfies d ≠ 0 for the numerical value d of the selected digit selected by the digit selection element 146B and On the condition that the predetermined reduction correction amount δ (where δ ≦ d) can be canceled by adjusting the digit, the reduction correction amount δ is subtracted from the selected digit, and the other digits are adjusted to decrease the correction correction amount. This is a component that performs correction to cancel δ.

そして、制御要素141Bは、所定の条件が満たされるまで、桁選択要素146Bによる桁選択、増減決定要素147Bによる増減決定、増加補正実行要素144Bもしくは減少補正実行要素145Bによる補正を繰り返し実行し、上記所定の条件が満たされたときのレジスタ142B内のn桁のデータを、再符号化したデータとして出力する構成要素である。   The control element 141B repeatedly executes the digit selection by the digit selection element 146B, the increase / decrease determination by the increase / decrease determination element 147B, and the correction by the increase correction execution element 144B or the decrease correction execution element 145B until a predetermined condition is satisfied. This is a component that outputs n-digit data in the register 142B when a predetermined condition is satisfied as re-encoded data.

ここに示す再符号化部140Bによる再符号化処理の基本方針は、まず、通常のk進数で数値Dを表現したn桁のデータをレジスタ142Bに用意し、このレジスタ内のランダムに選択された桁の数値を、冗長k進表現で許容可能な範囲内で増減補正し、当該増減分を別な桁の数値の増減で相殺するような調整を繰り返し実行する、というものである。選択桁の数値の増減は、別な桁の数値の増減で相殺されるため、レジスタ内に保持されているデータの値は常に数値Dに維持される。   The basic policy of the re-encoding process performed by the re-encoding unit 140B shown here is that n-digit data representing a numerical value D in a normal k-ary number is first prepared in the register 142B, and is randomly selected in this register. The numerical value of the digit is corrected to increase / decrease within an allowable range in the redundant k-ary representation, and the adjustment is repeatedly executed so that the increase / decrease is offset by the increase / decrease of the numerical value of another digit. Since the increase / decrease in the value of the selected digit is offset by the increase / decrease in the value of another digit, the value of the data held in the register is always maintained at the value D.

図20は、図19に示す再符号化部140Bの動作を説明する流れ図である。まず、ステップS21では、初期データ設定要素143Bによって初期値の設定が行われる。すなわち、秘密鍵としての数値Dに対応する通常k進表現によるn桁のデータがレジスタ142Bに設定される。   FIG. 20 is a flowchart for explaining the operation of the re-encoding unit 140B shown in FIG. First, in step S21, an initial value is set by the initial data setting element 143B. That is, n-digit data in normal k-ary notation corresponding to the numerical value D as the secret key is set in the register 142B.

続いて、ステップS22では、桁選択要素146Bによる桁選択が行われ、続くステップS23では、増減決定要素147Bによって、増加補正もしくは減少補正のいずれかが決定される。増加補正が決定された場合は、増加補正実行要素144Bによって、ステップS24〜S26の処理が実行され、減少補正が決定された場合は、減少補正実行要素145Bによって、ステップS27〜S29の処理が実行される。   Subsequently, in step S22, digit selection is performed by the digit selection element 146B. In subsequent step S23, either increase correction or decrease correction is determined by the increase / decrease determination element 147B. When the increase correction is determined, the processes of steps S24 to S26 are executed by the increase correction execution element 144B. When the decrease correction is determined, the processes of steps S27 to S29 are executed by the decrease correction execution element 145B. Is done.

すなわち、増加補正が決定された場合は、ステップS24において、増加補正が可能か否かの条件判断が行われ、可能と判断された場合には、ステップS25を経てステップS26へと進み増加補正が実行される。不可能と判断された場合には、ステップS25を経て増加補正を実行せずにステップS30へ進むことになる。一方、減少補正が決定された場合は、ステップS27において、減少補正が可能か否かの条件判断が行われ、可能と判断された場合には、ステップS28を経てステップS29へと進み減少補正が実行される。不可能と判断された場合には、ステップS28を経て減少補正を実行せずにステップS30へ進むことになる。   That is, when increase correction is determined, a condition determination is made in step S24 as to whether or not increase correction is possible. Executed. If it is determined to be impossible, the process proceeds to step S30 without executing the increase correction through step S25. On the other hand, when the reduction correction is determined, in step S27, a condition judgment is made as to whether or not the reduction correction is possible. Executed. If it is determined that it is impossible, the process proceeds to step S30 without executing the decrease correction through step S28.

ステップS30では、この手順をここで終了するか否かの判断がなされる。すなわち、予め設定しておいた所定の終了条件が満たされたときには、手順終了との判断がなされ、ステップS31へと進むことになる。終了条件が満たされていないときには、再びステップS22からの手順が繰り返し実行される。終了条件としては、たとえば、「ステップS22からの手順が、Q回繰り返して行われること」という繰り返し回数に基づく条件を設定しておくことができる。この場合、ステップS22を実行するたびにカウンタの計数値を更新してゆき、カウンタの値がQに等しくなったら、「終了条件を満足した」との判断がなされることになる。終了条件を満足してステップS31へと進んだ場合には、その時点でレジスタに格納されているn桁の数値が、再符号化した数値D(冗長k進表記)を示すデータとして出力されることになる。   In step S30, it is determined whether or not to end this procedure. That is, when a predetermined end condition set in advance is satisfied, it is determined that the procedure is ended, and the process proceeds to step S31. When the end condition is not satisfied, the procedure from step S22 is repeated. As the termination condition, for example, a condition based on the number of repetitions “the procedure from step S22 is repeated Q times” can be set. In this case, the count value of the counter is updated each time step S22 is executed, and when the value of the counter becomes equal to Q, it is determined that “the end condition is satisfied”. If the end condition is satisfied and the process proceeds to step S31, the n-digit numerical value stored in the register at that time is output as data indicating the re-encoded numerical value D (redundant k-ary notation). It will be.

これに対して、ステップS24における条件判断はやや複雑である。基本的には、選択桁の数値dについてd<dmaxが満たされ、かつ、他の桁の調整によって所定の増加補正分δ(但し、δ≦dmax−d)を相殺することが可能である、との判断を行えばよい。前者の条件は、選択桁の数値を増加させることが可能か否かを判定するための条件である。1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長k進表現を行う場合、d<dmaxでなければ、選択桁の数値をこれ以上増加させることはできない。一方、後者の条件は、選択桁の数値をδだけ増加させた場合、当該増加補正分δに対応する値を、他の桁に対する減少補正で相殺するための条件である。   On the other hand, the condition determination in step S24 is somewhat complicated. Basically, d <dmax is satisfied for the numerical value d of the selected digit, and a predetermined increase correction amount δ (where δ ≦ dmax−d) can be canceled by adjusting other digits. Judgment may be made. The former condition is a condition for determining whether or not the value of the selected digit can be increased. When performing a redundant k-ary expression in which the numerical value d of one digit takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”, the numerical value of the selected digit is determined unless d <dmax. It cannot be increased any further. On the other hand, the latter condition is a condition for canceling the value corresponding to the increase correction amount δ with the decrease correction for other digits when the numerical value of the selected digit is increased by δ.

図20の流れ図には、このような条件判断のより具体的な一例が示されている。すなわち、図示の例では、常に増加補正分δ=kに設定する単純な例であり、選択桁の数値dについては、d+k≦dmaxというより厳しい条件を課している。これは、選択桁の数値に増加補正分kを加えても、dmaxを越えないようにするための条件である。一方、「他の桁の調整によって増加補正分kを相殺することが可能であるか否か」という条件判断については、「選択桁の上位に0でない桁があるか否か」という条件判断を代用している。これは、k進表記されたデータの場合、選択桁の数値にkを加算する補正は、選択桁のすぐ上位の桁(隣接上位桁)の数値から1を減じる補正によって必ず相殺できるためである(k進表記では、選択桁の数値kは、隣接上位桁の数値1に対応する)。   A more specific example of such condition determination is shown in the flowchart of FIG. In other words, the illustrated example is a simple example in which the increase correction amount δ = k is always set, and the numerical value d of the selected digit imposes a stricter condition of d + k ≦ dmax. This is a condition for preventing dmax from being exceeded even if an increase correction amount k is added to the numerical value of the selected digit. On the other hand, with regard to the condition determination “whether or not the increase correction k can be canceled by adjusting other digits”, the condition determination “whether there is a non-zero digit in the upper part of the selected digit” is made. Substituting. This is because, in the case of data expressed in k-adic, the correction for adding k to the numerical value of the selected digit can be surely canceled by the correction of subtracting 1 from the numerical value of the immediately higher digit (adjacent upper digit) of the selected digit. (In k-ary notation, the numerical value k of the selected digit corresponds to the numerical value 1 of the adjacent upper digit).

このような条件を満足していると判断された場合には、ステップS26に示す増加補正が実行される。具体的には、選択桁にkを加える増加補正が行われ、隣接上位桁から1を減じる相殺処理が行われることになる(隣接上位桁が0の場合でも、更にその上位に存在する0でない桁を利用した減算が行われる)。   If it is determined that such a condition is satisfied, the increase correction shown in step S26 is executed. Specifically, an increase correction that adds k to the selected digit is performed, and an offset process is performed to subtract 1 from the adjacent upper digit (even if the adjacent upper digit is 0, it is not a 0 that exists further above it) Subtraction using digits).

一方、ステップS27における条件判断は、基本的には、選択桁の数値dについてd≠0が満たされ、かつ、他の桁の調整によって所定の減少補正分δ(但し、δ≦d)を相殺することが可能である、との判断を行えばよい。前者の条件は、選択桁の数値を減少させることが可能か否かを判定するための条件である。選択桁の数値dが0である場合には、更に減少させることはできない。一方、後者の条件は、選択桁の数値をδだけ減少させた場合、当該減少補正分δに対応する値を、他の桁に対する増加補正で相殺するための条件である。   On the other hand, in the condition determination in step S27, basically, d ≠ 0 is satisfied for the numerical value d of the selected digit, and a predetermined decrease correction amount δ (where δ ≦ d) is canceled by adjusting other digits. What is necessary is just to judge that it is possible to do. The former condition is a condition for determining whether or not the numerical value of the selected digit can be decreased. When the numerical value d of the selected digit is 0, it cannot be further reduced. On the other hand, the latter condition is a condition for canceling the value corresponding to the decrease correction amount δ by increasing correction for other digits when the numerical value of the selected digit is decreased by δ.

図20の流れ図には、減少補正に関する条件判断の具体的な一例が示されている。すなわち、図示の例では、常に減少補正分δ=1に設定する単純な例であり、「他の桁の調整によって減少補正分1を相殺することが可能であるか否か」という条件判断については、「隣接下位桁について、d+k≦dmax」という条件判断を代用している。これは、k進表記されたデータの場合、選択桁の数値から1を減じる補正は、選択桁のすぐ下位の桁(隣接下位桁)の数値にkを加える補正によって必ず相殺できるためである(k進表記では、選択桁の数値1は、隣接下位桁の数値kに対応する)。   The flowchart of FIG. 20 shows a specific example of condition determination regarding the reduction correction. That is, the example shown in the drawing is a simple example in which the decrease correction amount δ = 1 is always set, and the condition judgment “whether or not the decrease correction amount 1 can be offset by adjusting other digits” is determined. Substitutes the condition judgment “d + k ≦ dmax for adjacent lower digits”. This is because, in the case of data expressed in the k-ary notation, the correction of subtracting 1 from the numerical value of the selected digit can always be canceled by the correction of adding k to the numerical value of the digit immediately below the selected digit (adjacent lower digit) ( In k-ary notation, the numerical value 1 of the selected digit corresponds to the numerical value k of the adjacent lower digit).

このような条件を満足していると判断された場合には、ステップS29に示す減少補正が実行される。具体的には、選択桁から1を減じる減少補正が行われ、隣接下位桁にkを加える相殺処理が行われることになる。   If it is determined that such a condition is satisfied, the reduction correction shown in step S29 is executed. Specifically, a decrease correction for subtracting 1 from the selected digit is performed, and an offset process for adding k to the adjacent lower digits is performed.

図21は、図20の流れ図に基づく2進データの再符号化処理の一例を示す変遷図である。ここでは、1行目に示すとおり、D=22[10進]を通常2進表記した「10110」なるデータが初期データとしてレジスタに設定されているものとし、dmax=3に設定して、1つの桁の数値dが「0≦d≦3」の範囲内の値をとる冗長な2進数で表現したランダムな5桁のデータに再符号化する場合を考えてみる。なお、図において、特定桁の上に示す(+)は、当該桁が増加補正の対象となる選択桁であることを示し、特定桁の上に示す(−)は、当該桁が減少補正の対象となる選択桁であることを示すものとする。   FIG. 21 is a transition diagram showing an example of re-encoding processing of binary data based on the flowchart of FIG. Here, as shown in the first line, it is assumed that data “10110” in which D = 22 [decimal] is normally expressed in binary is set in the register as initial data, dmax = 3 is set, and 1 Consider a case where re-encoding is performed to random five-digit data represented by a redundant binary number in which a numerical value d of one digit takes a value in a range of “0 ≦ d ≦ 3”. In the figure, (+) indicated above a specific digit indicates that the digit is a selected digit to be subject to increase correction, and (-) indicated above the specific digit indicates that the digit is reduced correction. It shall indicate that the selected digit is the target.

いま、図の2行目に示すように、右から2桁目について増加補正を行う選択が行われたとすると、当該選択は、図20のステップS24の条件を満たしている。すなわち、選択桁の数値dは1であり、k=2、dmax=3であるから、「d+k≦dmax」なる条件を満たし、しかも選択桁の上位には、0でない桁が存在している。そこで、ステップS26の増加補正が実行され、図の3行目に示すように、第1回目の変遷が生じる。レジスタに得られている「10030」は、冗長2進数であり、その値はD=22[10進]のまま変わりない。   Now, as shown in the second line of the figure, if the selection for increasing correction is performed for the second digit from the right, the selection satisfies the condition of step S24 in FIG. That is, since the numerical value d of the selected digit is 1, k = 2, and dmax = 3, the condition “d + k ≦ dmax” is satisfied, and there is a non-zero digit above the selected digit. Therefore, the increase correction in step S26 is executed, and the first transition occurs as shown in the third line of the figure. “10030” obtained in the register is a redundant binary number, and its value remains D = 22 [decimal].

次に、図の4行目に示すように、右から4桁目について増加補正を行う選択が行われたとすると、当該選択も、図20のステップS24の条件を満たしている。すなわち、選択桁の数値dは0であり、k=2、dmax=3であるから、「d+k≦dmax」なる条件を満たし、しかも選択桁の上位には、0でない桁が存在している。そこで、ステップS26の増加補正が実行され、図の5行目に示すように、第2回目の変遷が生じる。レジスタに得られている「02030」は、冗長2進数であり、その値はD=22[10進]のまま変わりない。   Next, as shown in the fourth line in the figure, if the selection for increasing correction is performed for the fourth digit from the right, the selection also satisfies the condition of step S24 in FIG. That is, the numerical value d of the selected digit is 0, and k = 2 and dmax = 3. Therefore, the condition “d + k ≦ dmax” is satisfied, and there is a non-zero digit above the selected digit. Therefore, the increase correction in step S26 is executed, and the second transition occurs as shown in the fifth line of the figure. “02030” obtained in the register is a redundant binary number, and its value remains D = 22 [decimal].

続いて、図の6行目に示すように、右から5桁目について増加補正を行う選択が行われたとすると、当該選択は、図20のステップS24の条件を満たさない。すなわち、選択桁の数値dは0であり、k=2、dmax=3であるから、「d+k≦dmax」なる条件を満たすものの、選択桁の上位には、0でない桁は1つも存在しない。そこで、ステップS25からステップS30を経てステップS22へと戻り、再度の選択が行われる。ここでは、図の7行目に示すように、右から4桁目について増加補正を行う選択が行われたとすると、当該選択は、やはり図20のステップS24の条件を満たさない。すなわち、選択桁の数値dは2であり、k=2、dmax=3であるから、「d+k≦dmax」なる条件を満たさず、また、選択桁の上位には、0でない桁は1つも存在しない。そこで、ステップS25からステップS30を経てステップS22へと戻り、再度の選択が行われる。   Subsequently, as shown in the sixth line of the figure, if the selection for increasing correction is performed for the fifth digit from the right, the selection does not satisfy the condition of step S24 in FIG. That is, since the numerical value d of the selected digit is 0, and k = 2 and dmax = 3, the condition “d + k ≦ dmax” is satisfied. However, no digit other than 0 exists in the upper part of the selected digit. Therefore, the process returns from step S25 to step S22 via step S30, and selection is performed again. Here, as shown in the seventh line of the figure, if the selection for increasing correction is performed for the fourth digit from the right, the selection still does not satisfy the condition of step S24 in FIG. That is, since the value d of the selected digit is 2, k = 2, and dmax = 3, the condition “d + k ≦ dmax” is not satisfied, and there is one non-zero digit in the upper part of the selected digit. do not do. Therefore, the process returns from step S25 to step S22 via step S30, and selection is performed again.

そこで、図の8行目に示すように、右から1桁目について増加補正を行う選択が行われたとすると、当該選択は、図20のステップS24の条件を満たしている。すなわち、選択桁の数値dは0であり、k=2、dmax=3であるから、「d+k≦dmax」なる条件を満たし、しかも選択桁の上位には、0でない桁が存在している。そこで、ステップS26の増加補正が実行され、図の9行目に示すように、第3回目の変遷が生じる。レジスタに得られている「02022」は、冗長2進数であり、その値はD=22[10進]のまま変わりない。   Therefore, as shown in the eighth line in the figure, if the selection for increasing correction is performed for the first digit from the right, the selection satisfies the condition of step S24 in FIG. That is, the numerical value d of the selected digit is 0, and k = 2 and dmax = 3. Therefore, the condition “d + k ≦ dmax” is satisfied, and there is a non-zero digit above the selected digit. Therefore, the increase correction in step S26 is executed, and the third transition occurs as shown in the ninth line of the figure. “0202” obtained in the register is a redundant binary number, and its value remains D = 22 [decimal].

次に、図の10行目に示すように、右から3桁目について減少補正を行う選択が行われたとすると、選択桁の数値dは0であるから、当該選択は、図20のステップS27の条件を満たさない。そこで、ステップS28からステップS30を経てステップS22へと戻り、再度の選択が行われる。ここでは、図の11行目に示すように、右から2桁目について減少補正を行う選択が行われたとすると、当該選択は、やはり図20のステップS27の条件を満たさない。すなわち、選択桁の数値dは2であるから、d≠0という条件を満たすものの、隣接下位桁(すなわち、右から1桁目)の数値d=2であるあるから、隣接下位桁について「d+k≦dmax」なる条件を満たさないことになる。そこで、ステップS28からステップS30を経てステップS22へと戻り、再度の選択が行われる。   Next, as shown in the 10th line in the figure, if the selection for performing the reduction correction is performed for the third digit from the right, the numerical value d of the selected digit is 0, so that the selection is performed in step S27 in FIG. Does not meet the conditions. Therefore, the process returns from step S28 to step S22 through step S30, and selection is performed again. Here, as shown in the eleventh line in the figure, if the selection for performing the reduction correction is performed for the second digit from the right, the selection still does not satisfy the condition of step S27 in FIG. That is, since the numerical value d of the selected digit is 2, although the condition of d ≠ 0 is satisfied, the numerical value d = 2 of the adjacent lower digit (that is, the first digit from the right) is “d + k” for the adjacent lower digit. The condition “≦ dmax” is not satisfied. Therefore, the process returns from step S28 to step S22 through step S30, and selection is performed again.

今度は、図の12行目に示すように、右から4桁目について減少補正を行う選択が行われたとすると、当該選択は、図20のステップS27の条件を満たしている。すなわち、選択桁の数値dは2であるから、d≠0という条件を満たし、隣接下位桁(すなわち、右から3桁目)の数値d=0であるあるから、隣接下位桁について「d+k≦dmax」なる条件も満たしている。そこで、ステップS29の減少補正が実行され、図の13行目に示すように、第4回目の変遷が生じる。レジスタに得られている「01222」は、冗長2進数であり、その値はD=22[10進]のまま変わりない。   In this case, as shown in the twelfth line of the figure, if the selection for performing the reduction correction is performed for the fourth digit from the right, the selection satisfies the condition of step S27 in FIG. That is, since the numerical value d of the selected digit is 2, the condition that d ≠ 0 is satisfied, and the numerical value d = 0 of the adjacent lower digit (that is, the third digit from the right) is “d + k ≦ The condition “dmax” is also satisfied. Therefore, the decrease correction in step S29 is executed, and the fourth transition occurs as shown in the thirteenth line of the figure. “01222” obtained in the register is a redundant binary number, and its value remains D = 22 [decimal].

このような変遷プロセスを実行してゆき、ステップS30の終了条件が満足された時点でレジスタに格納されていた5桁の数値が、再符号化した数値D(冗長2進表記)を示すデータとして出力されることになる。いずれの場合も、その値はD=22[10進]のまま変わりない。   By executing such a transition process, the 5-digit numerical value stored in the register at the time when the termination condition in step S30 is satisfied is re-encoded as data indicating the numerical value D (redundant binary notation). Will be output. In either case, the value remains unchanged at D = 22 [decimal].

もうひとつ、4進の場合の実例を提示しておく。図22は、図20の流れ図に基づく4進データの再符号化処理の一例を示す変遷図である。ここでは、1行目に示すとおり、D=22[10進]を通常4進表記した「112」なるデータが初期データとしてレジスタに設定されているものとし、dmax=7に設定して、1つの桁の数値dが「0≦d≦7」の範囲内の値をとる冗長な4進数で表現したランダムな3桁のデータに再符号化する場合を考えてみる。   Here is another example of quaternary cases. FIG. 22 is a transition diagram showing an example of quaternary data re-encoding processing based on the flowchart of FIG. Here, as shown in the first line, it is assumed that data “112” in which D = 22 [decimal] is normally expressed in a quaternary notation is set in the register as initial data, dmax = 7 is set, and 1 Consider a case where re-encoding is performed to random three-digit data expressed by a redundant quaternary number in which a numerical value d of one digit takes a value in a range of “0 ≦ d ≦ 7”.

まず、図の2行目に示すように、右から2桁目について減少補正を行う選択が行われたとすると、当該選択は、図20のステップS27の条件を満たしている。すなわち、選択桁の数値dは1であるから、d≠0という条件を満たし、隣接下位桁(すなわち、右から1桁目)の数値d=2であるあるから、隣接下位桁について「d+k≦dmax」なる条件も満たしている。そこで、ステップS29の減少補正が実行され、図の3行目に示すように、第1回目の変遷が生じる。レジスタに得られている「106」は、冗長4進数であり、その値はD=22[10進]のまま変わりない。   First, as shown in the second line of the figure, if the selection for performing the reduction correction is performed for the second digit from the right, the selection satisfies the condition of step S27 in FIG. That is, since the numerical value d of the selected digit is 1, the condition that d ≠ 0 is satisfied, and the numerical value d = 2 of the adjacent lower digit (that is, the first digit from the right) is “d + k ≦ The condition “dmax” is also satisfied. Therefore, the decrease correction in step S29 is executed, and the first transition occurs as shown in the third line of the figure. “106” obtained in the register is a redundant quaternary number, and its value remains D = 22 [decimal].

次に、図の4行目に示すように、再び右から2桁目について減少補正を行う選択が行われたとすると、選択桁の数値dは0であるから、当該選択は、図20のステップS27の条件を満たさない。そこで、ステップS28からステップS30を経てステップS22へと戻り、再度の選択が行われる。ここでは、図の5行目に示すように、右から3桁目について増加補正を行う選択が行われたとすると、当該選択は、図20のステップS24の条件を満たさない。すなわち、選択桁の数値dは1であり、k=4、dmax=7であるから、「d+k≦dmax」なる条件を満たすものの、選択桁の上位には、0でない桁は1つも存在しない。そこで、ステップS25からステップS30を経てステップS22へと戻り、再度の選択が行われる。   Next, as shown in the fourth line of FIG. 20, if the selection for reducing the second digit from the right is performed again, the numerical value d of the selected digit is 0. The condition of S27 is not satisfied. Therefore, the process returns from step S28 to step S22 through step S30, and selection is performed again. Here, as shown in the fifth line in the figure, if the selection for increasing correction is performed for the third digit from the right, the selection does not satisfy the condition of step S24 in FIG. That is, the numerical value d of the selected digit is 1, and k = 4 and dmax = 7. Therefore, although the condition “d + k ≦ dmax” is satisfied, no digit other than 0 exists in the upper part of the selected digit. Therefore, the process returns from step S25 to step S22 via step S30, and selection is performed again.

今度は、図の6行目に示すように、右から3桁目について減少補正を行う選択が行われたとすると、当該選択は、図20のステップS27の条件を満たしている。すなわち、選択桁の数値dは1であるから、d≠0という条件を満たし、隣接下位桁(すなわち、右から2桁目)の数値d=0であるあるから、隣接下位桁について「d+k≦dmax」なる条件も満たしている。そこで、ステップS29の減少補正が実行され、図の7行目に示すように、第2回目の変遷が生じる。レジスタに得られている「046」は、冗長4進数であり、その値はD=22[10進]のまま変わりない。   Now, as shown in the sixth line of the figure, if the selection for performing the reduction correction is performed for the third digit from the right, the selection satisfies the condition of step S27 in FIG. That is, since the numerical value d of the selected digit is 1, the condition that d ≠ 0 is satisfied, and the numerical value d = 0 of the adjacent lower digit (that is, the second digit from the right) is “d + k ≦ The condition “dmax” is also satisfied. Therefore, the reduction correction in step S29 is executed, and the second transition occurs as shown in the seventh line of the figure. “046” obtained in the register is a redundant quaternary number, and its value remains D = 22 [decimal].

このような変遷プロセスを実行してゆき、ステップS30の終了条件が満足された時点でレジスタに格納されていた3桁の数値が、再符号化した数値D(冗長4進表記)を示すデータとして出力されることになる。いずれの場合も、その値はD=22[10進]のまま変わりない。   By executing such a transition process, the three-digit numerical value stored in the register at the time when the termination condition in step S30 is satisfied is re-encoded as data indicating the numerical value D (redundant quaternary notation). Will be output. In either case, the value remains unchanged at D = 22 [decimal].

以上、図20のステップS24,S27に例示された条件を用いた例を述べたが、前述したとおり、この例は、増加補正の場合の増加補正量δを常にkとし、減少補正の場合の減少補正量δを常に1とし、しかも、隣接上位桁もしくは隣接下位桁の数値を調整することによってのみ、増減量の相殺を行う、というかなり限定的な運用を行う例である。したがって、実用上は、より柔軟な条件設定を行えば、より柔軟な増減補正を行うことも可能である。   The example using the conditions exemplified in steps S24 and S27 of FIG. 20 has been described above. As described above, in this example, the increase correction amount δ in the case of the increase correction is always set to k, and the case of the decrease correction is performed. In this example, the reduction correction amount δ is always set to 1, and the amount of increase / decrease is canceled only by adjusting the numerical value of the adjacent upper digit or the adjacent lower digit. Therefore, practically, more flexible increase / decrease correction can be performed by setting more flexible conditions.

図22の8行目以下に示す例は、このように、より柔軟な増減補正を行った例である。たとえば、8行目には、右から2桁目について、増加補正量δ=1とする増加補正を行う選択が行われた例が示されている。第3回目の変遷結果として9行目に示されているとおり、このような増加補正は、実際に可能である。この例では、選択桁の数値を1だけ増加させ、これを相殺するために、隣接下位桁(右から1桁目)の数値から4を減じる調整が行われている。レジスタに得られている「052」は、冗長4進数であり、その値はD=22[10進]のまま変わりない。   The example shown in the eighth and subsequent lines in FIG. 22 is an example in which more flexible increase / decrease correction is performed in this way. For example, the eighth line shows an example in which selection for increasing correction with an increasing correction amount δ = 1 is performed for the second digit from the right. As shown in the 9th line as a result of the third transition, such an increase correction is actually possible. In this example, in order to increase the numerical value of the selected digit by 1 and cancel this, adjustment is performed by subtracting 4 from the numerical value of the adjacent lower digit (first digit from the right). “052” obtained in the register is a redundant quaternary number, and its value remains D = 22 [decimal].

続く10行目には、右から3桁目について、増加補正量δ=1とする増加補正を行う選択が行われた例が示されている。第4回目の変遷結果として11行目に示されているとおり、このような増加補正は、実際に可能である。この例では、選択桁の数値を1だけ増加させ、これを相殺するために、隣接下位桁(右から2桁目)の数値から4を減じる調整が行われている。レジスタに得られている「112」は、初期データと同一のデータであり、通常4進の形式をとっているが、これも冗長4進数の表現形態の1つであることに変わりはない。   In the following 10th line, an example is shown in which the selection for performing the increase correction with the increase correction amount δ = 1 is performed for the third digit from the right. As shown in the eleventh line as a result of the fourth transition, such an increase correction is actually possible. In this example, in order to increase the numerical value of the selected digit by 1 and cancel this, adjustment is performed by subtracting 4 from the numerical value of the adjacent lower digit (second digit from the right). “112” obtained in the register is the same data as the initial data, and normally takes a quaternary form, but this is still one of the representation forms of redundant quaternary numbers.

次の12行目には、右から1桁目について、増加補正量δ=4とする増加補正を行う選択が行われた例が示されており、第5回目の変遷結果として13行目に示されているとおり、選択桁の数値を4だけ増加させ、これを相殺するために、隣接上位桁(右から2桁目)の数値から1を減じる調整が行われている。レジスタに得られている「106」は、第1回目の変遷結果と同一のデータである。ただ、第1回目の変遷結果は、右から2桁目についての減少補正の結果として得られたデータであったのに対し、第5回目の変遷結果は、右から1桁目についての増加補正の結果として得られたデータである。   The next 12th line shows an example in which the increase correction amount δ = 4 is selected for the first digit from the right, and the 13th line is shown as the fifth transition result. As shown, in order to increase the numerical value of the selected digit by 4 and cancel this, adjustment is performed by subtracting 1 from the numerical value of the adjacent upper digit (second digit from the right). “106” obtained in the register is the same data as the first transition result. However, the results of the first transition were data obtained as a result of the decrease correction for the second digit from the right, whereas the results of the fifth transition were an increase correction for the first digit from the right. It is the data obtained as a result of.

<実施例3>
図23は、図16に示す暗号処理装置の再符号化部140の第3の構成例を示すブロック図である。図示のとおり、この例の場合、再符号化部140Cは、冗長データ生成要素141C、数値B生成要素142C、数値A生成要素143C、数値D保持要素144C、数値E生成要素145Cによって構成されている。
<Example 3>
FIG. 23 is a block diagram illustrating a third configuration example of the re-encoding unit 140 of the cryptographic processing device illustrated in FIG. 16. As illustrated, in this example, the re-encoding unit 140C includes a redundant data generation element 141C, a numerical value B generation element 142C, a numerical value A generation element 143C, a numerical value D holding element 144C, and a numerical value E generation element 145C. .

ここに示す再符号化部140Cによる再符号化処理の基本方針は、まず、数値Dを、D=A+Bを満たすような2つの数値A,Bに分け、これら数値A,Bを通常2進表記し、数値Aの特定ビット部分と数値Bの特定ビット部分とを、桁を若干ずらして加え合わせることにより、冗長データの1桁の数値を決定する、というものである。   The basic policy of the re-encoding process by the re-encoding unit 140C shown here is that the numerical value D is first divided into two numerical values A and B that satisfy D = A + B, and these numerical values A and B are usually expressed in binary notation. Then, the specific bit part of the numerical value A and the specific bit part of the numerical value B are added with the digits slightly shifted to determine the one-digit numerical value of the redundant data.

サイドチャネル攻撃を防ぐためには、統計的な解析を行っても、秘密鍵Dに関する手掛かりが得られないようにするのが最も効果的である。そのためには、冗長k進表現によって再符号化したデータを構成するn桁の数値が、完全にランダムに選択された数値になるようにするのが好ましい。別言すれば、n桁の数値のそれぞれについて、0〜dmaxの間の数値の出現頻度が一様になるようにするのが理想的である。上述した実施例2の方法は、変遷プロセスの出発点となる初期データとして、通常のk進データを用いているため、0〜dmaxの間の数値の出現頻度に偏りが生じやすい。   In order to prevent side channel attacks, it is most effective to prevent clues relating to the secret key D from being obtained even if statistical analysis is performed. For this purpose, it is preferable that the n-digit numerical value constituting the data re-encoded by the redundant k-ary representation is a numerical value selected completely at random. In other words, it is ideal to make the appearance frequency of numerical values between 0 and dmax uniform for each of n-digit numerical values. In the method of the second embodiment described above, normal k-ary data is used as initial data that is the starting point of the transition process, and therefore, the appearance frequency of numerical values between 0 and dmax tends to be biased.

これに対して、ここで述べる実施例3の方法によれば、0〜dmaxの間の数値の出現頻度を一様にできるメリットが得られる。この点において、ここで述べる実施例3の方法は、本願発明者が最も好ましい実施例と考えている方法である。但し、この方法は、任意の整数mについて、k=2、dmax=22m−1という条件下での再符号化が前提となるので、冗長2進数において、各桁の数値が0〜22m−1の範囲の値をとる、という前提条件が必要になる。たとえば、m=1に設定した場合、各桁の数値が0〜3の範囲の値をとる冗長2進数による再符号化を前提としたものになり、m=2に設定した場合、各桁の数値が0〜15の範囲の値をとる冗長4進数による再符号化を前提としたものになる。 On the other hand, according to the method of the third embodiment described here, there is an advantage that the appearance frequency of the numerical value between 0 and dmax can be made uniform. In this regard, the method of the third embodiment described here is a method that the inventor considers the most preferable embodiment. However, since this method is premised on re-encoding for an arbitrary integer m under the conditions of k = 2 m and dmax = 2 2m −1, the numerical value of each digit is 0 to 0 in the redundant 2 m- ary number. The precondition that it takes a value in the range of 2 2 m −1 is required. For example, when m = 1 is set, re-encoding with a redundant binary number in which the numerical value of each digit takes a value in the range of 0 to 3 is assumed. When m = 2 is set, This is premised on re-encoding with a redundant quaternary number in which a numerical value is in a range of 0 to 15.

図23において、数値D保持要素144Cは、秘密鍵格納部150から読み出した数値Dを、m×nビット(m,nは整数)の2進数として保持する構成要素であり、数値E生成要素145Cは、乱数発生部160が発生した乱数Rを用いて、「E<D」を満足する任意の数値Eをm×nビットの2進数として生成する構成要素である。また、数値A生成要素143Cは、数値Eの下位mビット(最下位側のmビット)を0に置換することにより、新たな数値Aを生成する構成要素であり、数値B生成要素142Cは、B=D−Aなる演算により、m×nビットの2進数からなる数値Bを生成する構成要素である。   In FIG. 23, a numerical value D holding element 144C is a component that holds the numerical value D read from the secret key storage unit 150 as a binary number of m × n bits (m and n are integers), and a numerical value E generation element 145C. Is a component that generates an arbitrary numerical value E satisfying “E <D” as an m × n-bit binary number using the random number R generated by the random number generation unit 160. Also, the numerical value A generation element 143C is a component that generates a new numerical value A by replacing the lower m bits (m bits on the least significant side) of the numerical value E with 0, and the numerical value B generation element 142C is It is a component that generates a numerical value B consisting of an m × n-bit binary number by an operation of B = DA.

一方、冗長データ生成要素141Cは、数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータを生成し、これを冗長な2進数で表現した数値Dを示すデータとして出力する構成要素である。 On the other hand, the redundant data generation element 141C counts a numerical value for m bits continuous from the (m × (i + 1))-th bit to the lower order when counting from the lower order side of the bits constituting the numerical value A, and the numerical value B A numerical value consisting of 2 m bits in which the numerical value for m bits continuous from the (m × i) -th bit toward the lower side counted from the lower side of the constituting bits is a lower bit (where i = 1 to n, For the numerical value A, the upper digit is supplemented with m bits of 0), the n-th digit data is generated as the i-th digit counted from the lower side, and this is a numerical value D expressed in redundant 2 m base numbers. This is a component that is output as data indicating.

図24は、図23に示す再符号化部140Cの動作を説明する流れ図である。ステップS41は、数値D保持要素144Cが行う処理を示しており、数値Dが、m×nビット(m,nは整数)の2進数として用意される。ステップS42は、数値E生成要素145Cが行う処理を示しており、乱数Rを用いて、「E<D」を満足する任意の数値Eが、m×nビットの2進数として生成される。なお、ここに示す数値Eと、図1,図2に示す鍵Eとは、たまたま同じ符号を用いているが、両者は全く無関係な値である。ステップS43は、数値A生成要素143Cが行う処理を示しており、数値Eの下位mビット(最下位側のmビット)を0に置換することにより、新たな数値Aが生成される。ステップS44は、数値B生成要素142Cが行う処理を示しており、B=D−Aなる演算により、m×nビットの2進数からなる数値Bが生成される。   FIG. 24 is a flowchart for explaining the operation of the re-encoding unit 140C shown in FIG. Step S41 shows processing performed by the numerical value D holding element 144C, and the numerical value D is prepared as a binary number of m × n bits (m and n are integers). Step S42 shows processing performed by the numerical value E generation element 145C, and an arbitrary numerical value E satisfying “E <D” is generated as a m × n-bit binary number using the random number R. The numerical value E shown here and the key E shown in FIGS. 1 and 2 happen to use the same sign, but they are completely irrelevant values. Step S43 shows processing performed by the numerical value A generation element 143C, and a new numerical value A is generated by replacing the lower m bits (the lowest m bits) of the numerical value E with 0. Step S44 shows processing performed by the numerical value B generation element 142C, and a numerical value B composed of an m × n-bit binary number is generated by an operation of B = DA.

更に、ステップS45は、冗長データ生成要素141Cが行う処理を示しており、数値A,Bの各ビットを組み合わせることにより、n桁の冗長2進数からなるデータが生成される。具体的には、上述したとおり、数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータが生成される。 Further, step S45 are executed by the redundant data generation element 141C is carried out by combining each bit of the numerical A, B, data consisting of n-digit redundant 2 m binary numbers is generated. Specifically, as described above, a numerical value for m bits consecutive from the (m × (i + 1))-th bit to the lower order counted from the lower order side of the bits constituting the numerical value A is the upper bit, and the numerical value B is A numerical value consisting of 2 m bits in which the numerical value for m bits continuous from the (m × i) -th bit toward the lower side counted from the lower side of the constituting bits is a lower bit (where i = 1 to n, As for the numerical value A, n-digit data is generated in which the upper side is supplemented with m bits of 0) and the i-th digit is counted from the lower side.

以上、一般論として、図23に示す再符号化部140Cの動作を説明したが、続いて、具体的な数値Dを例示して、この動作を詳細に説明する。   As described above, the operation of the re-encoding unit 140C illustrated in FIG. 23 has been described as a general theory. Next, the operation will be described in detail by exemplifying a specific numerical value D.

図25は、図24の流れ図に基づく2進データの再符号化処理の一例を示す変遷図である。ここでは、m=1,n=4に設定した例が示されている。m=1の例であるため、k=2、dmax=3という設定が前提となる(すなわち、各桁が0〜3の値をとる冗長2進表記による再符号化が前提となる)。   FIG. 25 is a transition diagram showing an example of re-encoding processing of binary data based on the flowchart of FIG. In this example, m = 1 and n = 4 are set. Since this is an example of m = 1, it is assumed that k = 2 and dmax = 3 are set (that is, re-encoding in redundant binary notation in which each digit takes a value of 0 to 3 is assumed).

まず、ステップS41では、数値Dが、m×nビットの2進数として用意される。ここでは、D=11[10進]なる数値が、「1011」という4ビットの通常2進数で用意されている場合を考える。続くステップS42では、乱数Rを用いて、「E<D」を満足するm×nビットの2進数として、数値Eが生成される。ここでは、図示のとおり、「0111」なる通常2進数で表現された数値Eが生成されたものとしよう。次のステップS43では、数値Eの下位mビットを0に置換することにより、新たな数値Aが生成される。この例では、m=1であるから、数値E「0111」の下位1ビットを0に置換することにより、数値A「0110」が生成されることになる。そして、ステップS44では、B=D−Aなる演算により、m×nビットの2進数からなる数値Bが生成される。この例では、B=D−Aなる演算により、4ビットの2進数からなる数値B「0101」が生成されることになる。   First, in step S41, the numerical value D is prepared as an m × n-bit binary number. Here, a case where a numerical value of D = 11 [decimal] is prepared as a 4-bit normal binary number “1011” is considered. In the subsequent step S42, a numerical value E is generated as a m × n-bit binary number satisfying “E <D” using the random number R. Here, as shown in the figure, it is assumed that a numerical value E represented by a normal binary number “0111” is generated. In the next step S43, a new numerical value A is generated by replacing the lower m bits of the numerical value E with 0. In this example, since m = 1, the numerical value A “0110” is generated by replacing the lower 1 bit of the numerical value E “0111” with 0. In step S44, a numerical value B consisting of an m × n-bit binary number is generated by an operation of B = DA. In this example, a numerical value B “0101” composed of a 4-bit binary number is generated by the operation of B = DA.

かくして、2つの数値A「0110」,数値B「0101」が生成されたが、これら2つの数値A,Bは、元の数値Dを2つに分割した値になっている。別言すれば、A+B=Dである。また、数値Aの下位mビット(1ビット)が0である点も留意すべきである。   Thus, two numerical values A “0110” and numerical value B “0101” are generated, and these two numerical values A and B are values obtained by dividing the original numerical value D into two. In other words, A + B = D. It should also be noted that the lower m bits (1 bit) of the numerical value A are 0.

図25の下段には、このような具体的な数値A「0110」,数値B「0101」を用いた場合のステップS45の処理が模式的に示されている。ステップS45の処理は、前述したとおり、数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータを生成する、というものである。   The lower part of FIG. 25 schematically shows the process of step S45 in the case where such specific numerical values A “0110” and numerical values B “0101” are used. As described above, the processing in step S45 is performed by using m bits of numerical values that are consecutive from the (m × (i + 1))-th bit as counted from the lower order side of the bits constituting the numerical value A to the upper bits and the numerical value B. A numerical value consisting of 2 m bits, where m is a numerical value for m bits continuous from the (m × i) -th bit to the lower order, counting from the lower side of the bits constituting i (where i = 1 to n) The numerical value A is supplemented with m bits of 0 on the upper side), and n-digit data is generated as the i-th digit counted from the lower side.

この処理を、m=1,i=1という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第2ビット目から下位に向かって連続する1ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第1ビット目から下位に向かって連続する1ビット分の数値を下位ビット、とする2ビットからなる数値を、下位側から数えて第1番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは「1」、下位ビットは「1」となるので、「11」なる2ビットからなる数値「3」が、下位側から数えて第1番目の桁の数値になる。   If this process is applied to a specific case of m = 1 and i = 1, a numerical value for 1 bit continuous from the second bit toward the lower side counted from the lower side of the bits constituting the numerical value A is obtained. The upper bit and the numerical value consisting of 2 bits counting from the lower side of the bits constituting the numerical value B, starting from the first bit and continuing to the lower bit, are the lower bits. It will be the first digit. As shown in the figure, in this case, since the upper bit is “1” and the lower bit is “1”, the numerical value “3” consisting of two bits “11” is the numerical value of the first digit counted from the lower side. become.

同様に、m=1,i=2という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第3ビット目から下位に向かって連続する1ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第2ビット目から下位に向かって連続する1ビット分の数値を下位ビット、とする2ビットからなる数値を、下位側から数えて第2番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは「1」、下位ビットは「0」となるので、「10」なる2ビットからなる数値「2」が、下位側から数えて第2番目の桁の数値になる。   Similarly, if applied to a specific case where m = 1 and i = 2, the numerical value for one bit continuous from the third bit toward the lower side counted from the lower side of the bits constituting the numerical value A A numerical value consisting of 2 bits, counting from the lower side of the bit and the bit constituting the numerical value B, with the lower bit being a numerical value for one bit continuous from the second bit toward the lower side, is counted second. This is the second digit. As shown in the figure, in this case, since the upper bit is “1” and the lower bit is “0”, the numerical value “2” consisting of 2 bits “10” is the numerical value of the second digit counted from the lower side. become.

更に、m=1,i=3という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第4ビット目から下位に向かって連続する1ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第3ビット目から下位に向かって連続する1ビット分の数値を下位ビット、とする2ビットからなる数値を、下位側から数えて第3番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは「0」、下位ビットは「1」となるので、「01」なる2ビットからなる数値「1」が、下位側から数えて第3番目の桁の数値になる。   Further, if applied to a specific case where m = 1 and i = 3, the numerical value for one bit continuous from the fourth bit toward the lower order when counted from the lower order side of the bits constituting the numerical value A is the upper bit. , Counting from the lower side of the bits that make up the numerical value B, the third bit counting from the lower side is a numerical value consisting of 2 bits, with the lower bit being the numerical value for one bit continuous from the third bit toward the lower side. It will be a digit. As shown in the figure, in this case, the upper bit is “0” and the lower bit is “1”, so the numerical value “1” consisting of 2 bits “01” is the numerical value of the third digit counted from the lower side. become.

最後に、m=1,i=4という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第5ビット目(数値Aについては、上位側に1ビット分の0を補う)から下位に向かって連続する1ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第4ビット目から下位に向かって連続する1ビット分の数値を下位ビット、とする2ビットからなる数値を、下位側から数えて第4番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは補われた「0」、下位ビットは「0」となるので、「00」なる2ビットからなる数値「0」が、下位側から数えて第4番目の桁の数値になる。   Finally, if applied to a specific case of m = 1 and i = 4, the fifth bit counted from the low order side of the bits constituting the numerical value A (the numerical value A is 0 for 1 bit on the high order side). The numerical value for one bit that continues from the bottom to the lower bit is counted from the lower side of the bits that make up the numerical value B, and the numerical value that continues from the fourth bit toward the lower is the lower bit. , A 2-bit numerical value is counted as the fourth digit from the lower order side. As shown in the figure, in this case, the upper bits are supplemented “0” and the lower bits are “0”, so the numerical value “0” consisting of two bits “00” is counted from the lower side to the fourth. It becomes a numerical value of digits.

かくして、ステップS45の処理では、「0123」という冗長2進データが生成されることになる。このデータの値は、D=11[10進]に一致する。これは、図25の下段に示されているとおり、「0123」という冗長2進データが、数値Aと数値Bとの加算(ビットをずらした合成加算)によって得られたデータであることを考えれば当然のことである。なお、数値Aの一番右のビットは加算には利用されないが、もともと数値Aの下位1ビットは0になるように設定されているので、このビットは加算対象にならなくても問題はない(ステップS43で、下位mビットを0に置換するのは、このためである)。   Thus, in the process of step S45, redundant binary data “0123” is generated. The value of this data matches D = 11 [decimal]. This is because, as shown in the lower part of FIG. 25, the redundant binary data “0123” is data obtained by addition of numerical value A and numerical value B (combined addition by shifting bits). Naturally. Although the rightmost bit of the numerical value A is not used for addition, since the lower 1 bit of the numerical value A is originally set to be 0, there is no problem even if this bit is not subject to addition. (This is why the lower m bits are replaced with 0 in step S43).

図26は、図24の流れ図に基づく2進データの再符号化処理の別な一例を示す変遷図である。ここでも、m=1,n=4に設定した例が示されており、k=2、dmax=3という設定が前提となる。   FIG. 26 is a transition diagram showing another example of binary data re-encoding processing based on the flowchart of FIG. Here, an example in which m = 1 and n = 4 is shown, and the setting of k = 2 and dmax = 3 is assumed.

この例では、D=5[10進]なる数値が、「0101」という4ビットの通常2進数で用意され、「0010」なる通常2進数で表現された数値Eが生成された場合が例示されている。この場合、数値Eの下位1ビットを0に置換することにより、数値A「0010」が生成されることになる。もっとも、数値Eの下位1ビットは、もともと0であったため、実際には、数値Aは数値Eと変わりない。一方、B=D−Aなる演算により、数値B「0011」が生成されることになる。かくして、2つの数値A「0010」,数値B「0011」が生成されたが、A+B=Dになっている。   In this example, a case where a numerical value D = 5 [decimal] is prepared as a 4-bit normal binary number “0101” and a numerical value E expressed by a normal binary number “0010” is generated is illustrated. ing. In this case, the numerical value A “0010” is generated by replacing the lower 1 bit of the numerical value E with 0. However, since the lower 1 bit of the numerical value E was originally 0, the numerical value A is not different from the numerical value E in practice. On the other hand, the numerical value B “0011” is generated by the calculation of B = DA. Thus, two numerical values A “0010” and numerical value B “0011” are generated, and A + B = D.

図26の下段には、このような具体的な数値A「0010」,数値B「0011」を用いた場合のステップS45の処理が模式的に示されている。最終的に、「0013」という冗長2進データが生成されることになる。このデータの値は、もとの数値D=5[10進]に一致する。   The lower part of FIG. 26 schematically shows the process of step S45 when using such specific numerical values A “0010” and B “0011”. Eventually, redundant binary data “0013” is generated. The value of this data matches the original numerical value D = 5 [decimal].

図27は、図24の流れ図に基づく4進データの再符号化処理の一例を示す変遷図である。ここでは、m=2,n=3に設定した例が示されている。m=2の例であるため、k=4、dmax=15という設定が前提となる(すなわち、各桁が0〜15の値をとる冗長4進表記による再符号化が前提となる)。   FIG. 27 is a transition diagram showing an example of re-encoding processing of quaternary data based on the flowchart of FIG. In this example, m = 2 and n = 3 are set. Since it is an example of m = 2, it is assumed that k = 4 and dmax = 15 are set (that is, re-encoding by redundant quaternary notation in which each digit takes a value of 0 to 15 is assumed).

まず、ステップS41では、数値Dが、m×nビットの2進数として用意される。ここでは、D=53[10進]なる数値が、「110101」という6ビットの通常2進数で用意されている場合を考える。続くステップS42では、乱数Rを用いて、「E<D」を満足するm×nビットの2進数として、数値Eが生成される。ここでは、図示のとおり、「011010」なる通常2進数で表現された数値Eが生成されたものとしよう。次のステップS43では、数値Eの下位mビットを0に置換することにより、新たな数値Aが生成される。この例では、m=2であるから、数値E「011010」の下位2ビットを0に置換することにより、数値A「011000」が生成されることになる。そして、ステップS44では、B=D−Aなる演算により、m×nビットの2進数からなる数値Bが生成される。この例では、B=D−Aなる演算により、6ビットの2進数からなる数値B「011101」が生成されることになる。   First, in step S41, the numerical value D is prepared as an m × n-bit binary number. Here, consider a case where a numerical value of D = 53 [decimal] is prepared as a 6-bit normal binary number “110101”. In the subsequent step S42, a numerical value E is generated as a m × n-bit binary number satisfying “E <D” using the random number R. Here, as shown in the figure, it is assumed that a numerical value E represented by a normal binary number “011010” is generated. In the next step S43, a new numerical value A is generated by replacing the lower m bits of the numerical value E with 0. In this example, since m = 2, the numerical value A “011000” is generated by replacing the lower 2 bits of the numerical value E “011010” with 0. In step S44, a numerical value B consisting of an m × n-bit binary number is generated by an operation of B = DA. In this example, a numerical value B “011101” composed of a 6-bit binary number is generated by the operation of B = DA.

かくして、2つの数値A「011000」,数値B「011101」が生成される。ここでも、やはりA+B=Dである。また、数値Aの下位mビット(2ビット)が0である点も留意すべきである。   Thus, two numerical values A “011000” and numerical value B “011101” are generated. Again, A + B = D. It should also be noted that the lower m bits (2 bits) of the numerical value A are 0.

図27の下段には、このような具体的な数値A「011000」,数値B「011101」を用いた場合のステップS45の処理が模式的に示されている。ステップS45の処理は、前述したとおり、数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータを生成する、というものである。   The lower part of FIG. 27 schematically shows the process of step S45 in the case where such specific numerical values A “011000” and numerical values B “011101” are used. As described above, the processing in step S45 is performed by using m bits of numerical values that are consecutive from the (m × (i + 1))-th bit as counted from the lower order side of the bits constituting the numerical value A to the upper bits and the numerical value B. A numerical value consisting of 2 m bits, where m is a numerical value for m bits continuous from the (m × i) -th bit toward the lower side, counting from the lower side of the bits constituting i (where i = 1 to n) The numerical value A is supplemented with m bits of 0 on the upper side), and n-digit data is generated as the i-th digit counted from the lower side.

この処理を、m=2,i=1という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第4ビット目から下位に向かって連続する2ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第2ビット目から下位に向かって連続する2ビット分の数値を下位ビット、とする4ビットからなる数値を、下位側から数えて第1番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは「10」、下位ビットは「01」となるので、「1001」なる4ビットからなる数値「9」が、下位側から数えて第1番目の桁の数値になる。   If this process is applied to a specific case of m = 2 and i = 1, a numerical value for 2 bits continuous from the fourth bit toward the lower side counted from the lower side of the bits constituting the numerical value A is obtained. Counting from the low order side, a 4-bit numerical value, starting from the low order side of the 2nd bit starting from the 2nd bit, counting from the low order side of the high-order bits and the bits constituting the numerical value B It will be the first digit. As shown in the figure, in this case, the upper bit is “10” and the lower bit is “01”, so the numerical value “9” consisting of 4 bits “1001” is the numerical value of the first digit counted from the lower side. become.

同様に、m=1,i=2という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第6ビット目から下位に向かって連続する2ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第4ビット目から下位に向かって連続する2ビット分の数値を下位ビット、とする4ビットからなる数値を、下位側から数えて第2番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは「01」、下位ビットは「11」となるので、「0111」なる4ビットからなる数値「7」が、下位側から数えて第2番目の桁の数値になる。   Similarly, if applied to a specific case where m = 1 and i = 2, the numerical value for 2 bits continuous from the sixth bit toward the lower side counted from the lower side of the bits constituting the numerical value A A numerical value consisting of 4 bits, in which the numerical value of 2 bits continuous from the 4th bit toward the lower side is counted as the lower bit from the lower side of the bits constituting the bit and the numerical value B, is counted from the lower side. This is the second digit. As shown in the figure, in this case, since the upper bits are “01” and the lower bits are “11”, the numerical value “7” consisting of 4 bits “0111” is the numerical value of the second digit counted from the lower side. become.

最後に、m=1,i=3という具体的な事例に適用すれば、数値Aを構成するビットの下位側から数えて第8ビット目(数値Aについては、上位側に2ビット分の0を補う)から下位に向かって連続する2ビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第6ビット目から下位に向かって連続する2ビット分の数値を下位ビット、とする4ビットからなる数値を、下位側から数えて第3番目の桁とする、ことになる。図示のとおり、この場合、上位ビットは補われた「00」、下位ビットは「01」となるので、「0001」なる4ビットからなる数値「1」が、下位側から数えて第3番目の桁の数値になる。   Finally, if applied to a specific case of m = 1, i = 3, the eighth bit counted from the lower side of the bits constituting the numerical value A (the numerical value A is 0 for 2 bits on the upper side). 2 bits continuous from the 6th bit to the lower order, counting from the lower order side of the bits that make up the numerical value B. , A numerical value consisting of 4 bits is counted as the third digit from the lower side. As shown in the figure, in this case, the upper bits are supplemented “00” and the lower bits are “01”, so the numerical value “1” consisting of 4 bits “0001” is the third number counted from the lower side. It becomes a numerical value of digits.

かくして、ステップS45の処理では、「179」という冗長4進データが生成されることになる。このデータの値は、D=53[10進]に一致する。これは、図27の下段に示されているとおり、「179」という冗長4進データが、数値Aと数値Bとの加算(ビットをずらした合成加算)によって得られたデータであることを考えれば当然のことである。なお、数値Aの下位2ビットは加算には利用されないが、もともと数値Aの下位2ビットは0になるように設定されているので、このビットは加算対象にならなくても問題はない(ステップS43で、下位mビットを0に置換するのは、このためである)。   Thus, in the process of step S45, redundant quaternary data “179” is generated. The value of this data matches D = 53 [decimal]. This is because, as shown in the lower part of FIG. 27, the redundant quaternary data “179” is data obtained by the addition of numerical value A and numerical value B (combined addition with shifted bits). Naturally. Although the lower 2 bits of the numerical value A are not used for addition, since the lower 2 bits of the numerical value A are originally set to be 0, there is no problem even if these bits are not to be added (step). This is why the lower m bits are replaced with 0 in S43).

<その他の実施例>
以上、図16に示す再符号化部140の具体的な構成例をいくつか例示したが、本発明に用いる再符号化部140の構成は、これらの実施例に限定されるものではなく、この他にも様々な構成例を利用することが可能である。
<Other examples>
As described above, some specific configuration examples of the re-encoding unit 140 illustrated in FIG. 16 have been illustrated. However, the configuration of the re-encoding unit 140 used in the present invention is not limited to these examples. Various other configuration examples can be used.

また、これまで述べた構成例は、その都度、新たな再符号化処理を実行する例であったが、冗長k進法で秘密鍵Dを表記する複数通りのバリエーションを事前にリストとして保管しておき、乱数を用いて、このリストの中からランダムに1つを選択して用いるようなことも可能である。たとえば、冗長2進法でD=22[10進]を表現する形態は、図11に一例が示されているとおり、「10110」,「10022」,「01222」,「02030」,... など、いくつかのバリエーションが存在するので、秘密鍵Dとして、D=22[10進]なる値を格納している暗号処理装置の場合、上記バリエーションに対応するデータをリストとして格納しておき、再符号化部140では、乱数Rに基づいて、リスト上のいずれか1つのデータをランダムに選択して演算実行部130に引き渡す処理を行えばよい。   In the configuration examples described so far, a new re-encoding process is executed each time. However, a plurality of variations in which the secret key D is written in a redundant k-ary system is stored in advance as a list. It is also possible to use a random number by selecting one from the list at random. For example, the form of expressing D = 22 [decimal] in the redundant binary system is “10110”, “10022”, “01222”, “02030”,... As shown in FIG. For example, in the case of a cryptographic processing apparatus storing a value D = 22 [decimal] as a secret key D, data corresponding to the above variations is stored as a list. The re-encoding unit 140 may perform a process of randomly selecting any one piece of data on the list based on the random number R and delivering it to the operation execution unit 130.

ただ、サイドチャネル攻撃の1つとして、暗号処理装置の内部で行われているアドレッシング処理を統計的に解析する手法が知られている。すなわち、CPUがメモリをアクセスする際に、アドレス値が異なると消費電力も異なる現象を利用し、消費電力を統計的に解析することによって、アクセスしたアドレスを推定することが可能になる。したがって、上述したように、冗長k進法で秘密鍵Dを表記する複数通りのバリエーションを事前にリストとして保管しておき、このリストの中からランダムに1つを選択して用いる方法をとると、リスト上のどのデータが用いられたかという情報が、消費電力の統計的解析によって推定されてしまう可能性がある。このようなサイドチャネル攻撃にも対抗するためには、これまで述べた実施例のように、その都度、新たな再符号化処理を実行するのが好ましい。   However, as one of the side channel attacks, a technique for statistically analyzing the addressing process performed inside the cryptographic processing apparatus is known. In other words, when the CPU accesses the memory, it is possible to estimate the accessed address by statistically analyzing the power consumption using a phenomenon in which the power consumption varies depending on the address value. Therefore, as described above, a plurality of variations representing the secret key D in redundant k-ary notation are stored in advance as a list, and one is randomly selected from this list and used. Information on which data on the list was used may be estimated by statistical analysis of power consumption. In order to counter such a side channel attack, it is preferable to execute a new re-encoding process each time as in the embodiments described above.

<<< §5.様々な変形例 >>>
以上、本発明をいくつかの具体的な実施例に基づいて説明したが、もちろん、本発明はこれらの実施例に限定されるものではない。たとえば、§1,§2で説明したべき乗剰余演算の方法は、一般に「Left to Right Exponentiation」と呼ばれている演算方法(指数を左から右へと順々に処理してゆく演算方法)であるが、この方法の代りに、指数を右から左へと順々に処理してゆく「Right to Left Exponentiation」と呼ばれる演算方法を採ることも可能である。更に、これまで述べた実施例では、MのD乗の項を含むべき乗剰余演算式に本発明を適用した例を述べたが、もちろん、本発明に係る暗号処理装置は、実施例で述べた具体的な演算式への適用に限定されるものではなく、数値Mおよび数値Dが含まれるいかなる演算式にも適用可能である。
<<< §5. Various modifications >>
As mentioned above, although this invention was demonstrated based on some specific Examples, of course, this invention is not limited to these Examples. For example, the modular exponentiation method described in §1 and §2 is an arithmetic method generally called “Left to Right Exponentiation” (an arithmetic method that processes exponents sequentially from left to right). However, instead of this method, it is also possible to adopt a calculation method called “Right to Left Exponentiation” in which exponents are processed sequentially from right to left. Further, in the embodiments described so far, the example in which the present invention is applied to the power-residue calculation expression including the term of M raised to the D power has been described. Of course, the cryptographic processing apparatus according to the present invention has been described in the embodiments. The present invention is not limited to application to a specific arithmetic expression, and can be applied to any arithmetic expression including a numerical value M and a numerical value D.

たとえば、本発明は、楕円曲線暗号の演算にも適応可能である。楕円曲線暗号は、次世代公開鍵暗号として最近注目を浴びている暗号であり、「楕円曲線」という2変数の3次方程式を満たす数字(x,y)(「有理点」と呼ぶ)の集合を扱う演算式で実現できる多種多様な暗号すべてのことを指す(ただし、この式の数字x,yの部分には、実数ではなく、ガロアー体GF(p)という離散的な数字が入る)。有理点を扱うこの演算式では、二つの有理点を入力とし一つの別の有理点を出力する「点加算」が定義され、また、一つの有理点を複数回点加算する「有理点のスカラー倍算」という処理が含まれる。   For example, the present invention can be applied to the calculation of elliptic curve cryptography. Elliptic curve cryptography is recently attracting attention as the next-generation public key cryptosystem, and is a set of numbers (x, y) (referred to as “rational points”) that satisfy a three-variable cubic equation called “elliptic curve”. All the various ciphers that can be realized with an arithmetic expression that handles (note that the numbers x and y in this expression are not real numbers but discrete numbers such as Galois field GF (p)). In this arithmetic expression that handles rational points, “point addition” is defined, in which two rational points are input and one other rational point is output, and one rational point is added multiple times. The process of “multiplication” is included.

有理点のスカラー倍算は、全ての楕円曲線暗号に使われている基本的な処理であり、楕円曲線暗号では、スカラー倍算を実施する際、有理点を何個加算するか決定するスカラー数が秘密情報となる。この観点では、スカラー数は、RSA暗号などべき乗剰余を行う際の指数に相当する秘密情報である。   Scalar multiplication of rational points is a basic process used in all elliptic curve cryptography. In elliptic curve cryptography, the number of scalars that determines how many rational points are added when performing scalar multiplication. Becomes secret information. From this point of view, the scalar number is secret information corresponding to an index for performing a power residue such as RSA encryption.

本発明は、上述した楕円曲線暗号の演算における秘密情報であるスカラー数を、電力解析から守るのにも有効である。この楕円曲線暗号の演算におけるスカラー倍算の処理は、前述したべき乗剰余を求める演算処理と極めて類似しており、その根本的な考え方は共通する。すなわち、本発明を楕円曲線暗号に適応する場合は、まず、数値Mに基づいて定まる入力点(有理点)をPとし、スカラー数をDとし、前述した再符号化方法をスカラー数Dに適用し、スカラー倍算演算の入力として利用すればよい。   The present invention is also effective for protecting the scalar number, which is secret information in the above-described elliptic curve cryptography calculation, from power analysis. The scalar multiplication process in this elliptic curve encryption calculation is very similar to the above-described calculation process for calculating the power residue, and the fundamental idea is common. That is, when the present invention is applied to elliptic curve cryptography, first, the input point (rational point) determined based on the numerical value M is set to P, the scalar number is set to D, and the re-encoding method described above is applied to the scalar number D. However, it may be used as an input for a scalar multiplication operation.

一般に、有理点Pをスカラー値[D]でスカラー倍する演算は、
[D]*P=P+P+ ... +P(但し、右辺のPはD個)
なる式により、有理点PをD個複写して点加算することによって行われる。具体的には、スカラー値[D]を(n+1)ビットの2進数を用いて、
[D]=d[n]*2+d[n−1]*2(n−1)+ ...
+d[1]*2+d[0]
なる形で表現し(iビット目の数値d[i]は、0もしくは1)、d[n]=1とし、前述したRSAと類似した方法を採用すれば、
[D]*P=[2]*([2] ... *([2]*([2]*([2]*P
+d[n−1]*P)
+d[n−2]*P)
+d[n−3]*P)
+ ........................
+d[1]*P)
+d[0]*P
なる繰り返し演算によって、有理点PをD倍するスカラー倍算が実行できる。
In general, the operation of multiplying a rational point P by a scalar value [D] is
[D] * P = P + P +... + P (However, D on the right side is D)
This is done by copying D rational points P and adding the points. Specifically, the scalar value [D] is expressed using a binary number of (n + 1) bits,
[D] = d [n] * 2 n + d [n-1] * 2 (n-1) + ...
+ D [1] * 2 + d [0]
(The numerical value d [i] of the i-th bit is 0 or 1), d [n] = 1, and adopting a method similar to the RSA described above,
[D] * P = [2] * ([2] ... * ([2] * ([2] * ([2] * P
+ D [n-1] * P)
+ D [n-2] * P)
+ D [n-3] * P)
+ ..................
+ D [1] * P)
+ D [0] * P
The scalar multiplication that multiplies the rational point P by D can be executed by the repeated calculation.

そこで、上記繰り返し演算に、本発明を適用するのであれば、スカラー値[D]を冗長k進数で再符号化する方法を採ればよい。冗長2進数を用いるのであれば、[D]を示す第i番目のビットをd[i]として、たとえば、d[i]∈0,1,2,3となるような再符号化を行えばよい。この場合、[2]*P,[3]*P等の値を予め演算によって求めておき、保存しておくようにすれば、実際の演算時には、これらの保存値を利用することができる。   Therefore, if the present invention is applied to the above repetitive calculation, a method of re-encoding the scalar value [D] with a redundant k-adic number may be employed. If redundant binary numbers are used, the ith bit indicating [D] is set to d [i], and for example, re-encoding is performed so that d [i] ε0, 1, 2, 3 Good. In this case, if values such as [2] * P, [3] * P are previously obtained by calculation and stored, these stored values can be used in actual calculation.

なお、有理点Pの2倍を求める処理や、異なる二つの有理点を加算する処理には様々な演算方法が知られている。たとえば、第1の有理点PをP=(x,y)とし、第2の有理点QをQ=(x,y)とし、両者の和を(x,y)とすれば、次のような演算により、和「P+Q」=(x,y)が得られることが知られている。
=λ−x−x
=λ(x−x)−y
λ=(y−y)/(x−x) (P≠Qのとき)
λ=(3x +a)/(2y) (P=Qのとき)
xi,yi,a∈GF(p) (但し、i=1,2,or 3)
Char(GF(p))≠2,3
このような楕円曲線暗号の具体的な演算方法としては、この他にも種々の方法が知られているが、ここでは詳しい説明は省略する。
Various calculation methods are known for the process of obtaining twice the rational point P and the process of adding two different rational points. For example, the first rational point P is P = (x 1 , y 1 ), the second rational point Q is Q = (x 2 , y 2 ), and the sum of the two is (x 3 , y 3 ) Then, it is known that the sum “P + Q” = (x 3 , y 3 ) can be obtained by the following calculation.
x 3 = λ 2 -x 1 -x 2
y 3 = λ (x 1 −x 3 ) −y 1
λ = (y 2 −y 1 ) / (x 2 −x 1 ) (when P ≠ Q)
λ = (3 × 1 2 + a) / (2y 1 ) (when P = Q)
xi, yi, a∈GF (p) (where i = 1, 2, or 3)
Char (GF (p)) ≠ 2,3
Various other methods are known as specific calculation methods for such elliptic curve cryptography, but detailed description thereof is omitted here.

楕円曲線暗号に本発明を適用する上で重要な点は、スカラー値[D]を冗長k進数で再符号化した後、再符号化された[D]を構成する各ビットd[i]についての演算を繰り返し実行してゆく点にある。したがって、具体的な演算式は、上例に限定されるものではない。   An important point in applying the present invention to elliptic curve cryptography is that the scalar value [D] is re-encoded with a redundant k-ary number and then each bit d [i] constituting the re-encoded [D] is used. The point is that the above operation is repeatedly executed. Therefore, a specific arithmetic expression is not limited to the above example.

もちろん、本発明は、いわゆる暗号化や復号化の処理への利用に限定されるものではなく、たとえば、DSA(Digital Signature Algorithm)などにも利用することが可能である。   Of course, the present invention is not limited to use for so-called encryption and decryption processing, and can be used for, for example, DSA (Digital Signature Algorithm).

本発明では、乱数Rを用いて数値Dを冗長なk進数で表現することが非常に重要な概念になる。ここで、冗長なk進数とは、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる数であるが、数値dの候補は、必ずしも0〜dmaxの範囲内の全整数である必要はなく、当該範囲内の一部の整数のみに制限してもかまわない。たとえば、冗長4進数において、dmax=19に設定した場合、1つの桁の数値dは、0〜19の範囲内の値をとる整数になり、この範囲内の全整数を候補として用いるのであれば、数値dは、0〜19の20通りの整数のうちのいずれかになる。このとき、たとえば、「4〜15は使用しない」というような取り決めをしておくことも可能であり、その場合は、数値dが、0,1,2,3,16,17,18,19という8通りの整数のうちのいずれかになるような再符号化が行われることになる。具体的には、10進数の「181」を上記8通りの整数を用いた冗長4進数で表現すれば、「1/2/17/17」なる4桁の数値になる。このように、本発明にいう「冗長なk進数」とは、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる数である必要があるが、数値dの候補は、必ずしも0〜dmaxの範囲内の全整数である必要はなく、当該範囲内の一部の整数であってもかまわない。   In the present invention, it is a very important concept to express the numerical value D in a redundant k-adic number using the random number R. Here, the redundant k-adic number is a number in which the numerical value d of one digit takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. However, it is not always necessary to use all integers in the range of 0 to dmax, and only a part of the integers in the range may be limited. For example, in a redundant quaternary number, when dmax = 19 is set, the numerical value d of one digit is an integer that takes a value in the range of 0 to 19, and all integers in this range are used as candidates. The numerical value d is one of 20 integers from 0 to 19. At this time, for example, it is possible to make an arrangement such as “4 to 15 are not used”, in which case the numerical value d is 0, 1, 2, 3, 16, 17, 18, 19 Thus, re-encoding is performed so as to be one of the eight kinds of integers. Specifically, if the decimal number “181” is expressed by a redundant quaternary number using the above eight integers, it becomes a 4-digit numerical value of “1/2/17/17”. Thus, the “redundant k-ary number” referred to in the present invention is a number in which the numerical value d of one digit takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. Although it is necessary, the candidates for the numerical value d are not necessarily all integers in the range of 0 to dmax, and may be partial integers in the range.

一般的な公開鍵暗号方式を用いた暗号化および復号化のプロセスを示すブロック図である。It is a block diagram which shows the process of the encryption and decoding using a general public key encryption system. 一般的なRSA暗号方式で利用されているべき乗剰余演算式を示す図である。It is a figure which shows the modular multiplication formula which should be utilized with the general RSA encryption system. ICカード10と外部装置20との間の認証にRSA暗号方式を利用した一般的なシステムを示すブロック図である。1 is a block diagram showing a general system using an RSA encryption method for authentication between an IC card 10 and an external device 20. FIG. 2進数の秘密鍵Dを用いたべき乗剰余演算を暗号処理装置の内部で実行する際の実際の演算式の一例を示す図である。It is a figure which shows an example of the actual arithmetic expression at the time of performing the power-residue calculation using the binary secret key D inside a cryptographic processing apparatus. 図4に示す演算式おいて、22[10進]なる秘密鍵Dを2進表記にして適用した場合の具体的な演算手順を示す図である。FIG. 5 is a diagram illustrating a specific calculation procedure when the secret key D of 22 [decimal] is applied in binary notation in the calculation formula illustrated in FIG. 4. 4進数の秘密鍵Dを用いたべき乗剰余演算を暗号処理装置の内部で実行する際の実際の演算式の一例を示す図である。It is a figure which shows an example of the actual arithmetic expression at the time of performing the power-residue calculation using the secret key D of a quaternion number inside a cryptographic processing apparatus. 図6に示す演算式おいて、22[10進]なる秘密鍵Dを4進表記にして適用した場合の具体的な演算手順を示す図である。FIG. 7 is a diagram illustrating a specific calculation procedure when the secret key D of 22 [decimal] is applied in the quaternary notation in the calculation formula illustrated in FIG. 6. k進数の秘密鍵Dを用いたべき乗剰余演算を暗号処理装置の内部で実行する際の実際の演算式の一例を示す図である。It is a figure which shows an example of the actual arithmetic expression at the time of performing the power-residue calculation using the secret key D of the k-ary number inside the encryption processing apparatus. 数値Dをk進表現した場合の各桁の構成を示す図である。It is a figure which shows the structure of each digit at the time of expressing numerical value D in k notation. 通常2進表現と冗長2進表現との相違を示す図である。It is a figure which shows the difference between normal binary expression and redundant binary expression. 数値D=22[10進]を、通常2進表現および冗長2進表現で表した例を示す図である。It is a figure which shows the example which represented numerical value D = 22 [decimal] by normal binary expression and redundant binary expression. 通常4進表現と冗長4進表現との相違を示す図である。It is a figure which shows the difference with normal quaternary expression and redundant quaternary expression. 数値D=22[10進]を、通常4進表現および冗長4進表現で表した例を示す図である。It is a figure which shows the example which represented numerical value D = 22 [decimal] by normal quaternary expression and redundant quaternary expression. 図4に示す演算式おいて、22[10進]なる秘密鍵Dを冗長2進表記にして適用した場合の具体的な演算手順を示す図である。FIG. 5 is a diagram showing a specific calculation procedure when the secret key D of 22 [decimal] is applied in redundant binary notation in the calculation formula shown in FIG. 4. 図6に示す演算式おいて、22[10進]なる秘密鍵Dを冗長4進表記にして適用した場合の具体的な演算手順を示す図である。FIG. 7 is a diagram illustrating a specific calculation procedure when the secret key D of 22 [decimal] is applied in redundant quaternary notation in the calculation formula illustrated in FIG. 6. 本発明に係る暗号処理装置の構成を示すブロック図である。It is a block diagram which shows the structure of the encryption processing apparatus which concerns on this invention. 図16に示す暗号処理装置の再符号化部140の第1の構成例を示すブロック図である。It is a block diagram which shows the 1st structural example of the re-encoding part 140 of the encryption processing apparatus shown in FIG. 図17に示す再符号化部140Aの動作を説明する流れ図である。18 is a flowchart illustrating an operation of a re-encoding unit 140A illustrated in FIG. 図16に示す暗号処理装置の再符号化部140の第2の構成例を示すブロック図である。It is a block diagram which shows the 2nd structural example of the re-encoding part 140 of the encryption processing apparatus shown in FIG. 図19に示す再符号化部140Bの動作を説明する流れ図である。20 is a flowchart for explaining the operation of a re-encoding unit 140B shown in FIG. 図20の流れ図に基づく2進データの再符号化処理の一例を示す変遷図である。FIG. 21 is a transition diagram illustrating an example of re-encoding processing of binary data based on the flowchart of FIG. 20. 図20の流れ図に基づく4進データの再符号化処理の一例を示す変遷図である。FIG. 21 is a transition diagram illustrating an example of quaternary data re-encoding processing based on the flowchart of FIG. 20. 図16に示す暗号処理装置の再符号化部140の第3の構成例を示すブロック図である。It is a block diagram which shows the 3rd structural example of the re-encoding part 140 of the encryption processing apparatus shown in FIG. 図23に示す再符号化部140Cの動作を説明する流れ図である。It is a flowchart explaining the operation | movement of the re-encoding part 140C shown in FIG. 図24の流れ図に基づく2進データの再符号化処理の一例を示す変遷図である。FIG. 25 is a transition diagram illustrating an example of re-encoding processing of binary data based on the flowchart of FIG. 24. 図24の流れ図に基づく2進データの再符号化処理の別な一例を示す変遷図である。It is a transition diagram which shows another example of the re-encoding process of binary data based on the flowchart of FIG. 図24の流れ図に基づく4進データの再符号化処理の一例を示す変遷図である。FIG. 25 is a transition diagram illustrating an example of re-encoding processing of quaternary data based on the flowchart of FIG. 24.

符号の説明Explanation of symbols

10:ICカード
11:制御ユニット
12:暗号処理装置
20:外部装置
21:認証処理部
22:暗号処理装置
100:暗号処理装置
110:入力部
120:出力部
130:演算実行部
140:再符号化部
140A:再符号化部
141A:制御要素
142A:数値確認要素
143A:ランダムデータ生成要素
140B:再符号化部
141B:制御要素
142B:レジスタ
143B:初期データ設定要素
144B:増加補正実行要素
145B:減少補正実行要素
146B:桁選択要素
147B:増減決定要素
140C:再符号化部
141C:冗長データ生成要素
142C:数値B生成要素
143C:数値A生成要素
144C:数値D保持要素
145C:数値E生成要素
150:秘密鍵格納部
160:乱数発生部
A:再符号化に用いる数値
B:再符号化に用いる数値
C:第2の数値(暗号文)
D:秘密鍵
d:秘密鍵の各桁
dmax:dの最大値
E:公開鍵
M:第1の数値(平文)
R:乱数
S11〜S45:流れ図の各ステップ
Z:定数
10: IC card 11: control unit 12: cryptographic processing device 20: external device 21: authentication processing unit 22: cryptographic processing device 100: cryptographic processing device 110: input unit 120: output unit 130: calculation execution unit 140: re-encoding Unit 140A: Re-encoding unit 141A: Control element 142A: Numerical value confirmation element 143A: Random data generation element 140B: Re-encoding unit 141B: Control element 142B: Register 143B: Initial data setting element 144B: Increase correction execution element 145B: Decrease Correction execution element 146B: Digit selection element 147B: Increase / decrease determination element 140C: Re-encoding unit 141C: Redundant data generation element 142C: Numerical value B generation element 143C: Numerical value A generation element 144C: Numerical value D holding element 145C: Numerical value E generation element 150 : Secret key storage unit 160: random number generation unit A: numerical value B used for re-encoding Value C used in the No. of: second numerical (ciphertext)
D: Secret key d: Each digit of the secret key dmax: Maximum value of d E: Public key M: First numerical value (plain text)
R: random numbers S11 to S45: each step in the flowchart Z: constant

Claims (14)

外部から与えられた第1の数値Mに対して、秘密鍵となる数値Dを用いた演算を行うことにより第2の数値Cを生成し、これを外部へ出力する処理を行う暗号処理装置であって、
第1の数値Mを外部から入力する入力部と、
秘密鍵となる数値Dを格納する秘密鍵格納部と、
乱数Rを発生させる乱数発生部と、
発生させた乱数Rを用いて、前記数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムなn桁のデータに再符号化する再符号化部と、
少なくとも前記数値Mと再符号化された数値Dとを用いた所定の演算を行うことにより、第2の数値Cを求める演算実行部と、
前記演算実行部が求めた第2の数値Cを外部へ出力する出力部と、
を備えることを特徴とする暗号処理装置。
An encryption processing device that performs processing using a numerical value D serving as a secret key on a first numerical value M given from outside to generate a second numerical value C and output it to the outside. There,
An input unit for inputting the first numerical value M from outside;
A secret key storage unit for storing a numerical value D as a secret key;
A random number generator for generating a random number R;
Using the generated random number R, the numerical value D is expressed by a redundant k-ary number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. A re-encoding unit that re-encodes the generated random n-digit data;
An operation execution unit for obtaining a second numerical value C by performing a predetermined operation using at least the numerical value M and the re-encoded numerical value D;
An output unit for outputting the second numerical value C obtained by the calculation execution unit to the outside;
A cryptographic processing apparatus comprising:
請求項1に記載の暗号処理装置において、
演算実行部が、Mの項を含む所定の演算式もしくはMに基づいて定まる有理点Pをスカラー値Dでスカラー倍する楕円曲線暗号の演算式に基づく演算を行うことにより、第2の数値Cを求めることを特徴とする暗号処理装置。
The cryptographic processing device according to claim 1,
Arithmetic execution unit, by performing a calculation based on the arithmetic expression of the scalar multiplication to elliptic curve cryptography scalar values D a rational point P determined based on a predetermined arithmetic expression or M includes a term of M D, second numerical A cryptographic processing device characterized by obtaining C.
請求項2に記載の暗号処理装置において、
演算実行部が、Mを所定の数値Zで除したときのべき乗剰余を示す演算式C=MmodZに基づく演算を行うことにより、第2の数値Cを求めることを特徴とする暗号処理装置。
The cryptographic processing device according to claim 2,
Arithmetic execution unit, by performing a calculation based on the arithmetic expression C = M D modZ indicating the modular exponentiation of time obtained by dividing the M D at a predetermined numerical Z, encryption processing and obtaining a second value C apparatus.
請求項3に記載の暗号処理装置において、
再符号化部が、数値Dを、上位桁側から順に、d[n−1],d[n−2],d[n−3],... ,d[2],d[1],d[0]なるn桁のデータに再符号化する処理を行い、
演算実行部が、演算式C=MmodZに基づく演算を、
C=(( .....(((1*Md[n−1]
*Md[n−2]modZ)
*Md[n−3]modZ)
.....
*Md[2]modZ)
*Md[1]modZ)
*Md[0]modZ
なる等価演算式を用いて、括弧の内側の演算から順番に実行することを特徴とする暗号処理装置。
The cryptographic processing device according to claim 3,
The re-encoding unit sequentially converts the numerical value D into d [n−1], d [n−2], d [n−3],..., D [2], d [1] in order from the upper digit side. , D [0] to perform re-encoding into n-digit data,
The calculation execution unit performs a calculation based on the calculation formula C = M D modZ.
C = ((... (((1 * M d [n−1] ) k
* M d [n-2] modZ) k
* M d [n-3] modZ) k
.....
* M d [2] modZ) k
* M d [1] modZ) k
* M d [0] modZ
An encryption processing apparatus that executes in order from an operation inside a parenthesis using an equivalent operation expression.
請求項1に記載の暗号処理装置において、
演算実行部が、RSA暗号、Diffie Hellman暗号、EL Gamal暗号、もしくは楕円曲線暗号を生成するための演算を行うことにより、第2の数値Cを求めることを特徴とする暗号処理装置。
The cryptographic processing device according to claim 1,
An encryption processing apparatus, wherein the operation execution unit obtains the second numerical value C by performing an operation for generating RSA encryption, Diffie Hellman encryption, EL Gamal encryption, or elliptic curve encryption.
請求項1〜5のいずれかに記載の暗号処理装置において、
演算実行部が、再符号化部によって再符号化されたn桁のデータの中から1桁の数値dを抽出して用いる演算を、順番に繰り返し実行することにより第2の数値Cを求めることを特徴とする暗号処理装置。
In the cryptographic processing device according to any one of claims 1 to 5,
The calculation execution unit obtains the second numerical value C by repeatedly executing in order the calculation using the single-digit numerical value d extracted from the n-digit data re-encoded by the re-encoding unit. A cryptographic processing device characterized by the above.
請求項1〜6のいずれかに記載の暗号処理装置において、
入力部が第1の数値Mを外部から入力するたびに、乱数発生部が新たな乱数Rを発生させ、再符号化部が新たな再符号化を行い、演算実行部が新たに再符号化された数値Dを用いて第2の数値Cを求める演算を行うことを特徴とする暗号処理装置。
The cryptographic processing device according to any one of claims 1 to 6,
Each time the input unit inputs the first numerical value M from the outside, the random number generation unit generates a new random number R, the re-encoding unit performs new re-encoding, and the operation execution unit newly re-encodes A cryptographic processing apparatus that performs an operation for obtaining a second numerical value C using the numerical value D.
請求項1〜7のいずれかに記載の暗号処理装置において、
再符号化部が、
乱数Rを用いて「0≦d≦dmax」の範囲内の値を発生させる処理をn回繰り返すことによりn桁のランダムデータを生成するランダムデータ生成要素と、
生成されたランダムデータが数値Dに等しいか否かを判断する数値確認要素と、
前記数値確認要素が等しいとの判断を行うまで、前記ランダムデータ生成要素にランダムデータの生成を繰り返し実行させ、前記数値確認要素が等しいとの判断を行った際のランダムデータを再符号化したデータとして出力する制御要素と、
を有することを特徴とする暗号処理装置。
In the cryptographic processing device according to any one of claims 1 to 7,
The re-encoding unit
A random data generation element that generates n-digit random data by repeating a process of generating a value within a range of “0 ≦ d ≦ dmax” using the random number R n times;
A numerical confirmation element for determining whether or not the generated random data is equal to the numerical value D;
Data obtained by re-encoding the random data when the random number generation element is repeatedly determined to determine that the numerical value confirmation elements are equal, and the random data generation element repeatedly generates random data. A control element to output as
A cryptographic processing device comprising:
請求項1〜7のいずれかに記載の暗号処理装置において、
再符号化部が、
n桁のデータを保持するレジスタと、
秘密鍵となる数値Dを、1つの桁の数値dが「0≦d≦k−1」の範囲内の値をとる通常のk進数で表現することにより、n桁からなるデータを用意し、用意したデータを初期データとして前記レジスタに設定する初期データ設定要素と、
発生させた乱数Rを用いて、前記レジスタのn桁のうちの任意の1桁を選択桁として選択する桁選択要素と、
発生させた乱数Rを用いて、増加補正もしくは減少補正のいずれかを決定する増減決定要素と、
前記増減決定要素により増加補正が決定された場合には、前記選択桁の数値dについてd<dmaxが満たされ、かつ、他の桁の調整によって所定の増加補正分δ(但し、δ≦dmax−d)を相殺することが可能であることを条件として、前記選択桁に前記増加補正分δを加え、他の桁を調整して前記増加補正分δを相殺する補正を行う増加補正実行要素と、
前記増減決定要素により減少補正が決定された場合には、前記選択桁の数値dについてd≠0が満たされ、かつ、他の桁の調整によって所定の減少補正分δ(但し、δ≦d)を相殺することが可能であることを条件として、前記選択桁から前記減少補正分δを減じ、他の桁を調整して前記減少補正分δを相殺する補正を行う減少補正実行要素と、
所定の条件が満たされるまで、桁選択要素による桁選択、増減決定要素による増減決定、増加補正実行要素もしくは減少補正実行要素による補正を繰り返し実行し、前記所定の条件が満たされたときの前記レジスタ内のn桁のデータを再符号化したデータとして出力する制御要素と、
を有することを特徴とする暗号処理装置。
In the cryptographic processing device according to any one of claims 1 to 7,
The re-encoding unit
a register holding n digits of data;
By expressing a numerical value D as a secret key with a normal k-adic number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ k−1”, n-digit data is prepared, An initial data setting element for setting the prepared data in the register as initial data;
A digit selection element that selects any one digit among the n digits of the register as a selection digit using the generated random number R;
An increase / decrease determination element that determines either increase correction or decrease correction using the generated random number R;
When the increase correction is determined by the increase / decrease determination element, d <dmax is satisfied for the numerical value d of the selected digit, and a predetermined increase correction amount δ (where δ ≦ dmax− an increase correction execution element for performing correction for adding the increase correction amount δ to the selected digit and adjusting the other digits to cancel the increase correction amount δ on the condition that d) can be canceled ,
When the decrease correction is determined by the increase / decrease determining element, d ≠ 0 is satisfied for the numerical value d of the selected digit, and a predetermined decrease correction amount δ (where δ ≦ d) is obtained by adjusting other digits. On the condition that it is possible to cancel out, the reduction correction execution element that performs the correction to subtract the decrease correction amount δ by adjusting the other digit by subtracting the decrease correction amount δ from the selected digit,
Until the predetermined condition is satisfied, the digit selection by the digit selection element, the increase / decrease determination by the increase / decrease determination element, the correction by the increase correction execution element or the decrease correction execution element are repeatedly executed, and the register when the predetermined condition is satisfied A control element that outputs n-digit data as re-encoded data,
A cryptographic processing device comprising:
請求項1〜7のいずれかに記載の暗号処理装置において、
再符号化部が、
数値Dをm×nビット(m,nは整数)の2進数として保持する数値D保持要素と、
乱数Rを用いて、「E<D」を満足する任意の数値Eをm×nビットの2進数として生成する数値E生成要素と、
前記数値Eの下位mビットを0に置換することにより、新たな数値Aを生成する数値A生成要素と、
B=D−Aなる演算により、m×nビットの2進数からなる数値Bを生成する数値B生成要素と、
数値Aを構成するビットの下位側から数えて第(m×(i+1))ビット目から下位に向かって連続するmビット分の数値を上位ビット、数値Bを構成するビットの下位側から数えて第(m×i)ビット目から下位に向かって連続するmビット分の数値を下位ビット、とする2mビットからなる数値(但し、i=1〜nとし、数値Aについては、上位側にmビット分の0を補う)を、下位側から数えて第i番目の桁とするn桁のデータを生成し、これを冗長な2進数で表現した数値Dを示すデータとして出力する冗長データ生成要素と、
を有することを特徴とする暗号処理装置。
In the cryptographic processing device according to any one of claims 1 to 7,
The re-encoding unit
A numerical value D holding element for holding the numerical value D as a binary number of m × n bits (m and n are integers);
A numerical value E generation element for generating an arbitrary numerical value E satisfying “E <D” as a binary number of m × n bits using the random number R;
A numerical value A generation element for generating a new numerical value A by replacing the lower m bits of the numerical value E with 0;
A numerical value B generating element for generating a numerical value B consisting of an m × n-bit binary number by an operation of B = D−A;
Counting m bits of consecutive numbers from the (m × (i + 1)) th bit down to the lower order of the bits constituting the numerical value A, from the lower bits of the bits constituting the numerical value B A numerical value consisting of 2m bits in which the numerical value for m bits continuous from the (m × i) -th bit to the lower order is the lower bit (provided that i = 1 to n, and for numerical value A, m the a supplement) 0 bits, to generate a n-digit data to the i-th digit as counted from the lower side, the redundant data generation output as data indicating the numerical D expressing this in redundant 2 m ary Elements and
A cryptographic processing device comprising:
請求項1〜10のいずれかに記載の暗号処理装置を内蔵したICカード。   An IC card incorporating the cryptographic processing device according to claim 1. 請求項1〜10のいずれかに記載の暗号処理装置としてコンピュータを機能させるためのプログラム。   A program for causing a computer to function as the cryptographic processing apparatus according to claim 1. 秘密鍵となる数値Dを内蔵している演算処理装置に対して、外部から第1の数値Mを与え、前記演算処理装置の内部で、少なくとも前記数値Mと前記数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、
前記演算処理装置の内部で、前記数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させることを特徴とする暗号処理方法。
A first numerical value M is given from the outside to an arithmetic processing unit having a numerical value D serving as a secret key, and an arithmetic operation using at least the numerical value M and the numerical value D is performed inside the arithmetic processing unit. In the cryptographic processing method for generating the second numerical value C by executing it and outputting it to the outside,
Inside the arithmetic processing unit, the numerical value D is expressed by a redundant k-ary number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. A cryptographic processing method characterized by generating random data and executing an operation for generating a second numerical value C using the random data.
秘密鍵となる数値Dを内蔵し、演算処理機能および乱数発生機能を有するICカードに対して、外部から第1の数値Mを与え、前記ICカードの内部で、少なくとも前記数値Mと前記数値Dとを用いた演算を実行させることにより第2の数値Cを生成させ、これを外部へ出力させる暗号処理方法において、
前記ICカードの内部で、前記数値Dを、1つの桁の数値dが「0≦d≦dmax(但し、dmax>k−1)」の範囲内の値をとる冗長なk進数で表現したランダムデータを、前記乱数発生機能を用いて生成させ、このランダムデータを用いて第2の数値Cを生成する演算を実行させることを特徴とする暗号処理方法。
A numerical value D serving as a secret key is incorporated, and a first numerical value M is given from the outside to an IC card having an arithmetic processing function and a random number generation function, and at least the numerical value M and the numerical value D are provided inside the IC card. In a cryptographic processing method for generating a second numerical value C by performing an operation using and outputting this to the outside,
Inside the IC card, the numerical value D is represented by a random k-ary number in which a single-digit numerical value d takes a value within the range of “0 ≦ d ≦ dmax (where dmax> k−1)”. A cryptographic processing method, wherein data is generated using the random number generation function, and an operation for generating a second numerical value C using the random data is executed.
JP2008192356A 2008-07-25 2008-07-25 Cryptographic processing device Active JP5233473B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008192356A JP5233473B2 (en) 2008-07-25 2008-07-25 Cryptographic processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008192356A JP5233473B2 (en) 2008-07-25 2008-07-25 Cryptographic processing device

Publications (2)

Publication Number Publication Date
JP2010034682A true JP2010034682A (en) 2010-02-12
JP5233473B2 JP5233473B2 (en) 2013-07-10

Family

ID=41738702

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008192356A Active JP5233473B2 (en) 2008-07-25 2008-07-25 Cryptographic processing device

Country Status (1)

Country Link
JP (1) JP5233473B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013014778A1 (en) * 2011-07-27 2013-01-31 富士通株式会社 Encryption processing apparatus and certification method
CN117330941A (en) * 2023-11-29 2024-01-02 珠海智锐科技有限公司 Performance test method and related device for new energy BMS printed circuit board

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10133857A (en) * 1996-11-01 1998-05-22 Mitsubishi Electric Corp Division device
JPH113210A (en) * 1997-06-12 1999-01-06 Sony Corp 3-input comparator, saturation arithmetic unit using the same and arithmetic method therefor
JPH11330978A (en) * 1998-05-15 1999-11-30 Hiroyuki Kawasaki Digital data conversion method and compression method, digital arithmetic processor and digital electronic computer
WO2001024439A1 (en) * 1999-09-29 2001-04-05 Hitachi, Ltd. Device, program or system for processing secret information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10133857A (en) * 1996-11-01 1998-05-22 Mitsubishi Electric Corp Division device
JPH113210A (en) * 1997-06-12 1999-01-06 Sony Corp 3-input comparator, saturation arithmetic unit using the same and arithmetic method therefor
JPH11330978A (en) * 1998-05-15 1999-11-30 Hiroyuki Kawasaki Digital data conversion method and compression method, digital arithmetic processor and digital electronic computer
WO2001024439A1 (en) * 1999-09-29 2001-04-05 Hitachi, Ltd. Device, program or system for processing secret information

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSNG199800957002; 川人 祥二 他: '冗長正ディジット数表現に基づく多値電流モード高速並列乗算器' 電子情報通信学会論文誌 第J75-D-I巻 第5号, 19920525, p.270〜279, 社団法人電子情報通信学会 *
JPN6012060747; 黒澤 馨,尾形 わかは: 現代暗号の基礎数理 初版, 20040331, p.64〜66, 株式会社コロナ社発行 *
JPN6012060748; 岡本 栄司: 暗号理論入門 初版, 19930225, p.94, 共立出版株式会社発行 *
JPN6012060749; 川人 祥二 他: '冗長正ディジット数表現に基づく多値電流モード高速並列乗算器' 電子情報通信学会論文誌 第J75-D-I巻 第5号, 19920525, p.270〜279, 社団法人電子情報通信学会 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013014778A1 (en) * 2011-07-27 2013-01-31 富士通株式会社 Encryption processing apparatus and certification method
JPWO2013014778A1 (en) * 2011-07-27 2015-02-23 富士通株式会社 Encryption processing apparatus and authentication method
US9330270B2 (en) 2011-07-27 2016-05-03 Fujitsu Limited Encryption processing device and authentication method
CN117330941A (en) * 2023-11-29 2024-01-02 珠海智锐科技有限公司 Performance test method and related device for new energy BMS printed circuit board
CN117330941B (en) * 2023-11-29 2024-02-02 珠海智锐科技有限公司 Performance test method and related device for new energy BMS printed circuit board

Also Published As

Publication number Publication date
JP5233473B2 (en) 2013-07-10

Similar Documents

Publication Publication Date Title
JP5412274B2 (en) Protection from side channel attacks
CN109791517B (en) Protecting parallel multiplication operations from external monitoring attacks
JP5488718B2 (en) Cryptographic processing apparatus, cryptographic processing method, and program
JP5229315B2 (en) Encryption device and built-in device equipped with a common key encryption function
US8422671B2 (en) Methods of encryption and decryption using operand ordering and encryption systems using the same
JP2008252299A (en) Encryption processing system and encryption processing method
US7020281B2 (en) Timing attack resistant cryptographic system
JP4662802B2 (en) Calculation method, calculation apparatus, and computer program
US20150215117A1 (en) White box encryption apparatus and method
JP2008293034A (en) Method and device for executing decrypting mechanism through calculating standardized modular exponentiation for thwarting timing attack
JPWO2006077651A1 (en) Encryption processor with tamper resistance against power analysis attacks
JP2010277085A (en) Protection of prime number generation in rsa algorithm
JP5573964B2 (en) Cryptographic processing apparatus and method
US20130243191A1 (en) Encryption key generating apparatus
US6480606B1 (en) Elliptic curve encryption method and system
EP3698262B1 (en) Protecting modular inversion operation from external monitoring attacks
US7903814B2 (en) Enhancing the security of public key cryptosystem implementations
KR20040067779A (en) Information processing means
EP2738973A1 (en) System and method for cryptography using multiplicative masking using simultaneous exponentiation techniques
JP5233473B2 (en) Cryptographic processing device
JP2010139544A (en) Apparatus and method for calculating remainder
US7974409B2 (en) Changing the order of public key cryptographic computations
JPWO2005013243A1 (en) Apparatus, method and program for calculating conversion parameter in Montgomery modular multiplication
RU2188513C2 (en) Method for cryptographic conversion of l-bit digital-data input blocks into l-bit output blocks
JP2021502743A (en) Computational devices and methods

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110520

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121115

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121127

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130122

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130311

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 5233473

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20160405

Year of fee payment: 3