JP5818768B2 - Mask generation apparatus, information processing apparatus, method thereof, and program - Google Patents

Mask generation apparatus, information processing apparatus, method thereof, and program Download PDF

Info

Publication number
JP5818768B2
JP5818768B2 JP2012230803A JP2012230803A JP5818768B2 JP 5818768 B2 JP5818768 B2 JP 5818768B2 JP 2012230803 A JP2012230803 A JP 2012230803A JP 2012230803 A JP2012230803 A JP 2012230803A JP 5818768 B2 JP5818768 B2 JP 5818768B2
Authority
JP
Japan
Prior art keywords
mask
product
ntz
storage unit
mod
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2012230803A
Other languages
Japanese (ja)
Other versions
JP2014081569A (en
Inventor
和麻呂 青木
和麻呂 青木
幹 安田
幹 安田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2012230803A priority Critical patent/JP5818768B2/en
Publication of JP2014081569A publication Critical patent/JP2014081569A/en
Application granted granted Critical
Publication of JP5818768B2 publication Critical patent/JP5818768B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、グレイ符号を利用して暗号利用モードで用いるマスクを生成するマスク生成技術、及びそのマスク生成装置で生成されたマスクを用いる情報処理技術に関する。   The present invention relates to a mask generation technique for generating a mask to be used in a cipher use mode using a Gray code, and an information processing technique using a mask generated by the mask generation apparatus.

データの秘匿または改竄検知のためには暗号技術が有効である。暗号技術には、RSA暗号等を含む非対称鍵技術、及び、共通鍵暗号を利用したAES(Advanced Encryption Standard)暗号等を含む対称鍵技術が存在する。非対称鍵技術は、対称鍵技術と比べ、鍵の取扱が容易である。しかし、速度の面では、対称鍵技術が、圧倒的に有利である。そのため、実際、大量のデータの秘匿や改竄検知には、AES暗号等を利用した暗号利用モードが多く利用されており、SSL(Secure Sockets Layer)等で実用化されている。   Cryptographic technology is effective for data confidentiality or falsification detection. Encryption techniques include asymmetric key techniques including RSA encryption, and symmetric key techniques including AES (Advanced Encryption Standard) encryption using common key encryption. The asymmetric key technology is easier to handle keys than the symmetric key technology. However, in terms of speed, symmetric key technology is overwhelmingly advantageous. For this reason, in practice, a large number of cipher usage modes using AES ciphers and the like are used to conceal a large amount of data and detect tampering, and are practically used in SSL (Secure Sockets Layer) or the like.

もともとブロック暗号では1ブロック(AES暗号では128ビット)の暗号化しかできなかった。暗号利用モードは、ブロック暗号を単純な演算で組み合わせて、多ブロックの暗号化処理や改竄検知(メッセージ認証)等の機能を追加する方法である。   Originally, block ciphers could only encrypt one block (128 bits for AES ciphers). The cipher usage mode is a method of adding functions such as multi-block encryption processing and falsification detection (message authentication) by combining block ciphers with simple operations.

従来より、暗号利用モードとして、守秘機能を実現するCFB(Cipher Feed Back)モードや、メッセージ認証を実現するCBC−MAC(Cipher Block Chaining - Message Authentication Code)等が知られていた。しかし、これらの暗号利用モードは、高い安全性を示せないという問題があった。   Conventionally, CFB (Cipher Feed Back) mode for realizing a confidential function, CBC-MAC (Cipher Block Chaining-Message Authentication Code) for realizing message authentication, and the like have been known as encryption usage modes. However, these encryption usage modes have a problem that they cannot exhibit high security.

その後、認証暗号モードOCB(Offset CodeBook)、MACモードPMAC(Parallelizable Message Authentication Code)、ディスク暗号XTSといった暗号利用モードが提案され、高い安全性が示されるようになった。   Thereafter, encryption usage modes such as an authentication encryption mode OCB (Offset CodeBook), a MAC mode PMAC (Parallelizable Message Authentication Code), and a disk encryption XTS have been proposed, and high security has been shown.

高い安全性が示される暗号利用モードのいくつかでは、ガロア体GF(2)の演算が、使われている。f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は、 In some of the cryptographic usage modes where high security is shown, an operation of Galois field GF (2 n ) is used. Let f (x) be an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is

Figure 0005818768
Figure 0005818768

を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表す。ここで、x倍する演算を「2倍算」と呼び、上記暗号利用モードを含む多くの暗号利用モードで利用されている。また、秘密情報Lを用い、m個のマスクx・Lを利用した暗号利用モードが、多数発表されている。ただし、i=1,2,…,mであり、A・Bは、有限体上の元Aと元Bとの積を表し、以後、「・」を省略することもある。また、グレイ符号を利用した暗号利用モードも提案されている(非特許文献1及び2参照)。ここで、i番目のグレイ符号をG(i)とすると、G(i)=i xor (i>>1)と表せる。ただし、A xor Bはビット列Aとビット列Bのビット毎の排他的論理和を表し、A>>Bはビット列Aを右にBビットシフトすることを意味する。グレイ符号を利用した暗号利用モードにおけるi番目のマスクをG(i)Lとする。また、w(A)をビット列Aのハミング重み(2進数表現で1の数の合計)を返す関数とすると、グレイ符号には、
(G(i) xor G(i−1))=1
という性質があることから、i−1番目のマスクG(i−1)Lからi番目のマスクG(i)Lを以下のように生成することができる。
G(i)L←G(i−1)L xor x2^jL (1)
ただし、上付き添え字におけるA^BはAのB乗(つまり、A)を表し、j=1,…,n−1であり、jはiのビット表現の最下位から並んでいる0の個数と一致する。ここで、x2^jLは、0の個数jに応じて変化する。そのため、予めj=1,…,n−1におけるx2^jLを計算し、0の個数j毎にテーブルに記憶しておけば、iのビット表現の最下位から並んでいる0の個数jに基づき、iに対応するx2^jLをテーブルから検索し、i−1番目に求めたマスクG(i−1)Lとx2^jLとの排他的論理和を求めるだけで、i番目のマスクG(i)Lを求めることができる。
Is expressed by a polynomial of n−1 order or less, and the coefficient of the polynomial is expressed as an n-bit bit string. Here, the operation of multiplying by x is referred to as “doubling” and is used in many cipher use modes including the cipher use mode. A number of cipher usage modes using secret information L and m masks x i · L have been announced. However, i = 1, 2,..., M, and A · B represents the product of the element A and the element B on the finite field, and hereinafter “·” may be omitted. Also, an encryption usage mode using a Gray code has been proposed (see Non-Patent Documents 1 and 2). Here, if the i-th gray code is G (i), it can be expressed as G (i) = i xor (i >> 1 ). However, A xor B represents an exclusive OR for each bit of the bit string A and the bit string B, and A >> B means that the bit string A is shifted to the right by B bits. Let the i-th mask in the encryption usage mode using the Gray code be G (i) L. If w 2 (A) is a function that returns the Hamming weight of bit string A (the sum of the numbers of 1 in binary representation), the Gray code is
w 2 (G (i) xor G (i−1)) = 1
Therefore, the i-th mask G (i) L can be generated from the i-1th mask G (i-1) L as follows.
G (i) L ← G (i-1) L xor x 2 ^ j L (1)
However, A ^ B in the superscript represents A to the Bth power (that is, A B ), j = 1,..., N−1, and j is arranged from the least significant bit representation of i. Matches the number of Here, x 2 ^ j L changes according to the number j of 0. Therefore, if x 2 ^ j L at j = 1,..., N−1 is calculated in advance and stored in the table for each number j of 0s, the number of 0s arranged from the least significant bit representation of i. Based on j, x 2 ^ j L corresponding to i is searched from the table, and the exclusive OR of the mask G (i−1) L obtained in the (i−1) th and x 2 ^ j L is obtained. , I-th mask G (i) L can be obtained.

Ted Krovetz and Phillip Rogaway, "The Software Performance of Authenticated-Encryption Modes", FSE 2011, Springer, 2011, vol. 6733, pp. 306-327Ted Krovetz and Phillip Rogaway, "The Software Performance of Authenticated-Encryption Modes", FSE 2011, Springer, 2011, vol. 6733, pp. 306-327 Phillip Rogaway, "Authenticated-Encryption with Associated-Data", ACM Conference on Computer and Communications Security 2002 (CCS'02), ACM Press, September 2002, pp. 98-107Phillip Rogaway, "Authenticated-Encryption with Associated-Data", ACM Conference on Computer and Communications Security 2002 (CCS'02), ACM Press, September 2002, pp. 98-107

従来技術では、x2^jLを検索するために、マスク毎にiのビット表現の最下位から並んでいる0の個数jを計算する必要がある。iのビット表現の最下位から並んでいる0の個数を計算する処理、及び、処理の結果得られる0の個数をntz(i)と記載する。多数のマスクG(i)Lを生成する場合、この処理ntz(i)の処理量も大きなものとなる。 In the prior art, in order to search for x 2 ^ j L, it is necessary to calculate the number j of 0s arranged from the least significant bit representation of i for each mask. The process of calculating the number of 0s arranged in the lowest order of the bit representation of i and the number of 0s obtained as a result of the process are described as ntz (i). When a large number of masks G (i) L are generated, the processing amount of the processing ntz (i) is large.

本発明は、処理ntz(i)のいくつかを省略することにより、マスクG(i)Lを効率的に計算することができるマスク生成技術を提供することを目的とする。   An object of the present invention is to provide a mask generation technique capable of efficiently calculating the mask G (i) L by omitting some of the processes ntz (i).

上記の課題を解決するために、本発明の第一の態様によれば、マスク生成装置は、グレイ符号を利用して暗号利用モードで用いるマスクを生成する。マスク生成装置は、f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は In order to solve the above-described problem, according to the first aspect of the present invention, the mask generation device generates a mask to be used in the encryption usage mode using a Gray code. The mask generation device sets f (x) to an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is

Figure 0005818768
Figure 0005818768

を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表すものとし、floor(A)をA以下の最大の整数を返す関数とし、mを生成するマスクの個数とし、p=0,1,…,floor(log(m))における秘密情報Lとx2^pとの積L[p]を求める積算出部と、kを正整数とし、q=1,2,…,2−1における、qのビット表現の最下位から並んでいる0の個数N[q]を求める連続0ビット算出部と、(floor(log(m))+1)個の積L[p]と2−1個の0の個数N[q]とが格納される記憶部と、iが2の倍数であるときには、該iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数ntz(i)に応じた積L[ntz(i)]を記憶部から取り出し、iが2の倍数ではないときには、該iを2で割ったときの剰余i mod 2に基づき、その剰余i mod 2のビット表現の最下位から並んでいる0の個数N[i mod 2]を記憶部から取り出し、さらに、この個数N[i mod 2]に応じた積L[N[i mod 2]]を記憶部から取り出す積取得部と、i−1におけるマスクG(i−1)Lと積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め、iにおけるマスクG(i)Lとする排他的論理和算出部と、を含む。 Is expressed as a polynomial of n-1 order or lower, the coefficient of the polynomial is expressed as an n-bit bit string, floor (A) is a function that returns the largest integer less than or equal to A, and a mask for generating m A product calculation unit for obtaining a product L [p] of secret information L and x 2 ^ p in p = 0, 1,..., Floor (log 2 (m)), k is a positive integer, and q = A continuous 0-bit calculation unit for obtaining the number N [q] of 0s arranged from the least significant bit representation of q in 1, 2,..., 2 k −1, and (floor (log 2 (m)) + 1) A storage unit storing the number of products L [p] and 2 k −1 0 numbers N [q], and when i is a multiple of 2 k , they are arranged from the least significant bit representation of i. The number of zeros ntz (i) is obtained, and the product L [ntz corresponding to the number of zeros ntz (i) is obtained. (I)] was removed from the storage unit, when i is not a multiple of 2 k, based on the remainder i mod 2 k obtained by dividing the i in 2 k, the least significant bit representation of the remainder i mod 2 k The number N [i mod 2 k ] of 0 arranged from the memory unit is taken out from the storage unit, and the product L [N [i mod 2 k ]] corresponding to the number N [i mod 2 k ] is taken out from the storage unit. The product acquisition unit obtains an exclusive OR of the mask G (i−1) L in i−1 and the product L [ntz (i)] or L [N [i mod 2 k ]], and the mask G in i (I) an exclusive OR calculation unit that is L.

上記の課題を解決するために、本発明の第二の態様によれば、マスク生成方法は、グレイ符号を利用して暗号利用モードで用いるマスクを生成する。マスク生成方法は、f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は In order to solve the above-described problem, according to the second aspect of the present invention, the mask generation method generates a mask to be used in the encryption usage mode using a Gray code. In the mask generation method, f (x) is an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is

Figure 0005818768
Figure 0005818768

を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表すものとし、floor(A)をA以下の最大の整数を返す関数とし、mを生成するマスクの個数とし、p=0,1,…,floor(log(m))における秘密情報Lとx2^pとの積L[p]を求める積算出ステップと、kを正整数とし、q=1,2,…,2−1における、qのビット表現の最下位から並んでいる0の個数N[q]を求める連続0ビット算出ステップと、(floor(log(m))+1)個の積L[p]と2−1個の0の個数N[q]とを記憶部に格納する記憶ステップと、iが2の倍数であるときには、該iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数ntz(i)に応じた積L[ntz(i)]を記憶部から取り出し、iが2の倍数ではないときには、該iを2で割ったときの剰余i mod 2に基づき、その剰余i mod 2のビット表現の最下位から並んでいる0の個数N[i mod 2]を記憶部から取り出し、さらに、この個数N[i mod 2]に応じた積L[N[i mod 2]]を記憶部から取り出す積取得ステップと、i−1におけるマスクG(i−1)Lと積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め、iにおけるマスクG(i)Lとする排他的論理和算出ステップと、を含む。 Is expressed as a polynomial of n-1 order or lower, the coefficient of the polynomial is expressed as an n-bit bit string, floor (A) is a function that returns the largest integer less than or equal to A, and a mask for generating m A product calculation step for obtaining a product L [p] of secret information L and x 2 ^ p in p = 0, 1,..., Floor (log 2 (m)), k is a positive integer, and q = A continuous 0-bit calculation step for obtaining the number N [q] of 0 arranged from the least significant bit representation of q in 1, 2,..., 2 k −1, and (floor (log 2 (m)) + 1) A storage step for storing the number of products L [p] and the number of 2 k −1 0s N [q] in the storage unit, and when i is a multiple of 2 k , the least significant bit representation of i The number ntz (i) of 0s that are lined up is obtained, and the number ntz (0) of this 0 is obtained. product according to i) L [ntz (i) ] was removed from the storage unit, when i is not a multiple of 2 k, based on the remainder i mod 2 k obtained by dividing the i in 2 k, the remainder i the number of zeros are arranged from the least significant bit representation of mod 2 k N [i mod 2 k] is taken out from the storage unit, further, the product L [N [i mod in accordance with the number N [i mod 2 k] 2 k ]] from the storage unit and exclusive of the mask G (i−1) L and the product L [ntz (i)] or L [N [i mod 2 k ]] in i−1 An exclusive OR calculation step of obtaining a logical sum and setting a mask G (i) L in i.

本発明は、i≠c2(ただし、cは0以上の任意の整数であり、kは所定の正整数)のときに処理ntz(i)を省略することにより、マスクG(i)Lを効率的に計算することができるという効果を奏する。 The present invention eliminates the process ntz (i) when i ≠ c2 k (where c is an arbitrary integer greater than or equal to 0, and k is a predetermined positive integer), so that the mask G (i) L There exists an effect that it can calculate efficiently.

k=2におけるiと0の個数jとの関係を示す図。The figure which shows the relationship between i and the number j of 0 in k = 2. k=3におけるiと0の個数jとの関係を示す図。The figure which shows the relationship between i and the number j of 0 in k = 3. k=4におけるiと0の個数jとの関係を示す図。The figure which shows the relationship between i and the number j of 0 in k = 4. k=5におけるiと0の個数jとの関係を示す図。The figure which shows the relationship between i and the number j of 0 in k = 5. 第一実施形態に係るマスク生成装置100の機能ブロック図。The functional block diagram of the mask production | generation apparatus 100 which concerns on 1st embodiment. 第一実施形態に係るマスク生成装置100の処理フローを示す図。The figure which shows the processing flow of the mask production | generation apparatus 100 which concerns on 1st embodiment. 記憶部に格納される積L[p]のデータの例を示す図。The figure which shows the example of the data of the product L [p] stored in a memory | storage part. 記憶部に格納される0の個数N[q]のデータの例を示す図。The figure which shows the example of the data of the number N [q] of 0 stored in a memory | storage part. k=1における、第二実施形態に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part and exclusive OR calculation part of the mask generation apparatus which concerns on 2nd embodiment in k = 1. k=2における、第二実施形態に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part and exclusive OR calculation part of the mask generation apparatus which concerns on 2nd embodiment in k = 2. k=3における、第二実施形態に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part of the mask production | generation apparatus which concerns on 2nd embodiment, and an exclusive OR calculation part in k = 3. k=1における、第二実施形態の変形例に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part and exclusive OR calculation part of the mask generation apparatus which concerns on the modification of 2nd embodiment in k = 1. k=2における、第二実施形態の変形例に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part and exclusive OR calculation part of the mask generation apparatus which concerns on the modification of 2nd embodiment in k = 2. k=3における、第二実施形態の変形例に係るマスク生成装置の積取得部及び排他的論理和算出部の処理フローを示す図。The figure which shows the processing flow of the product acquisition part and exclusive OR calculation part of the mask generation apparatus which concerns on the modification of 2nd embodiment in k = 3. 第三実施形態に係る暗号システムの機能ブロック図。The functional block diagram of the encryption system which concerns on 3rd embodiment. 第三実施形態に係る情報処理装置(暗号化装置)の機能ブロック図。The functional block diagram of the information processing apparatus (encryption apparatus) which concerns on 3rd embodiment. 第三実施形態に係る情報処理装置(暗号化装置)の処理フローを示す図。The figure which shows the processing flow of the information processing apparatus (encryption apparatus) which concerns on 3rd embodiment. 第三実施形態に係る情報処理装置(復号装置)の機能ブロック図。The functional block diagram of the information processing apparatus (decoding apparatus) which concerns on 3rd embodiment. 第三実施形態に係る情報処理装置(復号装置)の処理フローを示す図。The figure which shows the processing flow of the information processing apparatus (decoding apparatus) which concerns on 3rd embodiment.

以下、本発明の実施形態について説明する。なお、以下の説明に用いる図面では、同じ機能を持つ構成部や同じ処理を行うステップには同一の符号を記し、重複説明を省略する。また、ベクトルや行列の各要素単位で行われる処理は、特に断りが無い限り、そのベクトルやその行列の全ての要素に対して適用されるものとする。   Hereinafter, embodiments of the present invention will be described. In the drawings used for the following description, constituent parts having the same function and steps for performing the same process are denoted by the same reference numerals, and redundant description is omitted. Further, the processing performed for each element of a vector or matrix is applied to all elements of the vector or matrix unless otherwise specified.

<第一実施形態>
<第一実施形態のポイント>
正整数kを1つ固定する。図1〜図4は、それぞれk=2〜5におけるiと0の個数jとの関係を示す。各図から明らかなように、任意の0以上の整数cに対し、0の個数j(=ntz(i)、i=c2,c2+1,…,(c+1)2−1)はi=c2の場合を除いて同じパターンとなる。各図において、同じパターンの部分を破線で囲んでいる。本実施形態では、i=1,2,…,2−1について、予めiのビット表現の最下位から並んでいる0の個数jを計算する処理ntz(i)を行い、各iに対する0の個数jを記憶部に記憶しておく。さらに、i≠c2の場合のi(=1,2,…,m)に対応する0の個数jを記憶部から取り出す構成とする。0の個数jは、cが異なっても同じパターンなので、使い回すことができる。よって、i=c2の場合にのみ0の個数jを計算する処理ntz(i)を行うことで、処理ntz(i)の回数を1/2とすることができる。
<First embodiment>
<Points of first embodiment>
One positive integer k is fixed. 1 to 4 show the relationship between i and the number j of 0 at k = 2 to 5, respectively. As seen from the figures, for any integer of 0 or more c, 0 of the number j (= ntz (i), i = c2 k, c2 k + 1, ..., (c + 1) 2 k -1) is i = C2 k except for the case of k . In each figure, the part of the same pattern is enclosed with the broken line. In the present embodiment, for i = 1, 2,..., 2 k −1, a process ntz (i) for calculating the number j of 0s arranged in advance from the least significant bit representation of i is performed, and 0 for each i is performed. Is stored in the storage unit. Further, the number j of 0 corresponding to i (= 1, 2,..., M) in the case of i ≠ c2 k is extracted from the storage unit. Since the number j of 0 is the same pattern even if c is different, it can be reused. Therefore, by performing i = c2 when k only for calculating the number j of 0 processing ntz (i), the number of processing ntz (i) may be a 1/2 k.

<第一実施形態に係るマスク生成装置100>
図5はマスク生成装置100の機能ブロック図を、図6はその処理フローを示す。なお、図6中、ループ端の上端には変数=初期値、終値、増分値を、下端には変数を記載している。
<Mask Generation Device 100 according to First Embodiment>
FIG. 5 is a functional block diagram of the mask generation apparatus 100, and FIG. In FIG. 6, variables = initial value, final value, and increment value are described at the upper end of the loop end, and variables are described at the lower end.

マスク生成装置100は、積算出部111、連続0ビット算出部113、記憶部115、積取得部117及び排他的論理和算出部119を含む。   The mask generation apparatus 100 includes a product calculation unit 111, a continuous 0-bit calculation unit 113, a storage unit 115, a product acquisition unit 117, and an exclusive OR calculation unit 119.

マスク生成装置100は、秘密情報L、正整数k及び利用者が所望するマスクの個数mを入力とし、グレイ符号を利用して暗号利用モードで用いるマスクG(i)Lをm個生成し、出力する。   The mask generation apparatus 100 receives the secret information L, the positive integer k, and the number m of masks desired by the user as input, and generates m masks G (i) L used in the encryption usage mode using the Gray code. Output.

なお、f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は Note that f (x) is an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is

Figure 0005818768
Figure 0005818768

を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表すものとする。以下、各部の詳細を説明する。 Is represented by a polynomial of n−1 order or less, and the coefficient of the polynomial is represented as an n-bit bit string. Details of each part will be described below.

<積算出部111>
積算出部111は、利用者が所望するマスクの個数m及び秘密情報Lを受け取り、p=0,1,…,floor(log(m))における秘密情報Lとx2^pとの積L[p]を求め(s111)、記憶部115に格納する。ただし、floor(A)をA以下の最大の整数を返す関数とする。図7は、記憶部115に格納される積L[p]のデータの例を示す。テーブル111A〜テーブル111Eはそれぞれm=16、32、64、128、256におけるデータの例を示す。なお、実際には、記憶部115にはx2^pLとして具体的な値が格納される。
<Product Calculation Unit 111>
The product calculation unit 111 receives the number m of masks desired by the user and the secret information L, and the product of the secret information L and x 2 ^ p in p = 0, 1,..., Floor (log 2 (m)). L [p] is obtained (s111) and stored in the storage unit 115. However, floor (A) is a function that returns the largest integer less than or equal to A. FIG. 7 shows an example of data of the product L [p] stored in the storage unit 115. Tables 111A to 111E show examples of data in m = 16, 32, 64, 128, and 256, respectively. Actually, the storage unit 115 stores a specific value as x 2 ^ p L.

<連続0ビット算出部113>
連続0ビット算出部113は、正整数kを受け取り、処理ntz(q)により、q=1,2,…,2−1における、qのビット表現の最下位から並んでいる0の個数N[q](=ntz(q))を求め(s113)、記憶部115に格納する。図8は、記憶部115に格納される0の個数N[q]のデータの例を示す。テーブル113A〜テーブル113Dはそれぞれk=2〜5におけるデータの例を示す。
<Continuous 0-bit calculation unit 113>
The continuous 0-bit calculation unit 113 receives a positive integer k, and the number n of 0s arranged from the least significant bit representation of q in q = 1, 2,..., 2 k −1 by processing ntz (q). [Q] (= ntz (q)) is obtained (s113) and stored in the storage unit 115. FIG. 8 shows an example of data of the number N [q] of 0 stored in the storage unit 115. Tables 113A to 113D show examples of data at k = 2 to 5, respectively.

<記憶部115>
記憶部115には、(floor(log(m))+1)個の積L[p]と2−1個の0の個数N[q]とが格納される(図7及び図8参照)。
<Storage unit 115>
The storage unit 115 stores (floor (log 2 (m)) + 1) products L [p] and 2 k −1 0 number N [q] (see FIGS. 7 and 8). ).

<積取得部117>
積取得部117は、iが2の倍数であるか否かを判定する(s117a)。
<Product acquisition unit 117>
The product acquisition unit 117 determines whether i is a multiple of 2 k (s117a).

さらに、積取得部117は、iが2の倍数であるときには、処理ntz(i)により、iのビット表現の最下位から並んでいる0の個数p(=ntz(i))を計算し、この0の個数pに応じた積L[p](=L[ntz(i)])を記憶部115から取り出し(s117b)、排他的論理和算出部119に出力する。 Furthermore, the product acquiring unit 117, when i is a multiple of 2 k, by the processing ntz (i), the number of zeros are arranged from the least significant bit representation of i p (= ntz (i) ) was calculated The product L [p] (= L [ntz (i)]) corresponding to the number p of 0 is extracted from the storage unit 115 (s117b) and output to the exclusive OR calculation unit 119.

積取得部117は、iが2の倍数ではないときには、iを2で割ったときの剰余q(=i mod 2)に基づき、その剰余q(=i mod 2)のビット表現の最下位から並んでいる0の個数p(=N[q]=N[i mod 2])を記憶部115から取り出し、さらに、この0の個数p(=N[q]=N[i mod 2])に応じた積L[p](=L[N[q]]=L[N[i mod 2]])を記憶部115から取り出し(s117c)、排他的論理和算出部119に出力する。 Product acquisition unit 117, when i is not a multiple of 2 k is based on the remainder q (= i mod 2 k) obtained by dividing the i in 2 k, bit representation of the remainder q (= i mod 2 k) The number of zeros p (= N [q] = N [i mod 2 k ]) arranged from the lowest order is taken out of the storage unit 115, and the number of zeros p (= N [q] = N [i mod 2 k ]) is taken out from the storage unit 115 (s117c), and the exclusive OR calculation unit is obtained from the product L [p] (= L [N [q]] = L [N [i mod 2 k ]]) It outputs to 119.

つまり、積取得部117は、iが2の倍数ではないときには、iのビット表現の最下位から並んでいる0の個数を計算するのではなく、iを2で割ったときの剰余i mod 2に基づき、記憶部115から0の個数N[i mod 2]を取り出す。なお、剰余i mod 2を求める処理は、ビット列iからkビット以下のビット列を取り出すことで求めることができ、処理ntz(i)よりも処理量が小さい。例えば、ビット列iに対し、kビットより大きい(左側)部分に0を、kビット以下(右側)に1を設定したビット列でマスクすることで、ビット列iからkビット以下のビット列を取り出す。取り出したビット列が0の場合にはs117bの処理を、0以外の場合にはs117cの処理を行う。 In other words, the product acquiring unit 117, when i is not a multiple of 2 k, instead of calculating the number of 0 in a row from the least significant bit representation of i, the remainder i obtained by dividing the i in 2 k Based on mod 2 k , the number N [i mod 2 k ] of 0 is extracted from the storage unit 115. The processing for obtaining the remainder i mod 2 k may be determined by extracting a bit string of the following k bits from the bit string i, is smaller amount of processing than the processing ntz (i). For example, a bit string of k bits or less is extracted from the bit string i by masking the bit string i with a bit string in which 0 is set to a portion greater than k bits (left side) and 1 is set to k bits or less (right side). If the extracted bit string is 0, the process of s117b is performed, and if it is not 0, the process of s117c is performed.

このような構成により、i≠c2のときに処理ntz(i)を省略することができる。 With this configuration, it is possible to omit the process ntz (i) when i ≠ c2 k.

<排他的論理和算出部119>
排他的論理和算出部119は、積L[ntz(i)]またはL[N[i mod 2]]を受け取り、i−1におけるマスクG(i−1)Lと積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め(s119)、求めた排他的論理和をi番目のマスクG(i)Lとして出力するとともに、i+1番目のマスクG(i+1)Lを求めるために記憶しておく。
<Exclusive OR Calculation Unit 119>
The exclusive OR calculator 119 receives the product L [ntz (i)] or L [N [i mod 2 k ]], and receives the mask G (i−1) L and the product L [ntz (i) in i−1. )] Or L [N [i mod 2 k ]] is obtained (s119), the obtained exclusive OR is output as the i-th mask G (i) L, and the i + 1-th mask. This is stored for obtaining G (i + 1) L.

<効果>
本実施形態では、2−1個の、qのビット表現の最下位から並んでいる0の個数N[q]からなるテーブルを用いることにより、i≠c2のときに計算コストの高い処理ntz(i)を省略することができ、マスクG(i)Lを効率的に計算することができる。また、グレイ符号を利用してマスクG(i)Lを生成するOCB等の暗号利用モードに実装することで、効率的に暗号化または復号する情報処理装置を実現できる。
<Effect>
In this embodiment, by using a table composed of 2 k −1, the number N [q] of 0s arranged from the least significant bit representation of q, processing with high calculation cost when i ≠ c2 k. ntz (i) can be omitted, and the mask G (i) L can be calculated efficiently. In addition, an information processing apparatus that efficiently performs encryption or decryption can be realized by mounting in an encryption use mode such as OCB that generates a mask G (i) L using a Gray code.

なお、kを大きく設定することで、積取得部117において処理ntz(i)を省略できる回数を増やすことができるが、連続0ビット算出部113における処理量が大きくなる。また、kを大きく設定すると、N[q]が多くなるとともに(メモリを多く使う、図8参照)、検索時の処理量が増加する。よって、利用者が所望するマスクの個数mに応じて、マスク生成装置100の処理量全体が最も小さくなるように1≦k<logmの範囲で正整数kを設定すればよい。 Note that by setting k large, it is possible to increase the number of times that the product ntz (i) can be omitted in the product acquisition unit 117, but the processing amount in the continuous 0-bit calculation unit 113 increases. If k is set large, N [q] increases (uses a lot of memory, see FIG. 8), and the processing amount at the time of search increases. Therefore, a positive integer k may be set in a range of 1 ≦ k <log 2 m so that the entire processing amount of the mask generation apparatus 100 is minimized according to the number m of masks desired by the user.

<第二実施形態>
<第二実施形態のポイント>
第二実施形態では、積取得部217において、iが2の倍数であるか否かを判定する処理(s117a)、及び、iを2で割ったときの剰余i mod 2を求める処理を省略することができる。
<Second embodiment>
<Points of second embodiment>
In the second embodiment, in the product-acquisition unit 217, i is determined whether or not a multiple of 2 k (s117a), and obtains a remainder i mod 2 k obtained by dividing the i in 2 k processing Can be omitted.

また、第二実施形態の積取得部217は、複数の積をオーバーラップさせて取得し、i≦2における処理に基づきi>2における分岐予測を行う。このような構成により、さらに処理を効率化することができる。例えば、積取得部217は分岐予測機能付きのCPU(Central Processing Unit)により実現される。 Moreover, the product acquiring unit 217 of the second embodiment is acquired a plurality of products are overlapped, performs i> branch prediction in 2 k based on the processing in the i ≦ 2 k. With such a configuration, the processing can be made more efficient. For example, the product acquisition unit 217 is realized by a CPU (Central Processing Unit) with a branch prediction function.

以下、第一実施形態と異なる部分についてのみ説明する。   Hereinafter, only different parts from the first embodiment will be described.

<第二実施形態に係るマスク生成装置200>
マスク生成装置200は、積取得部117に代えて、積取得部217を備える(図5参照)。
<Mask Generation Device 200 According to Second Embodiment>
The mask generation apparatus 200 includes a product acquisition unit 217 instead of the product acquisition unit 117 (see FIG. 5).

積取得部217及び排他的論理和算出部119は、2個のマスクを生成する処理を繰り返す(言い換えると、一回の繰り返し処理(ループ処理)の中で2個のマスクを生成する)。繰り返し処理の中で、1個のマスクを生成する毎に生成したマスクの個数がm以下か否かを判定する。このとき、i≦2のときの判定結果(例えば条件式、判定式(i≦m)を満たす)に基づき、i>2における判定結果(例えば条件式、判定式(i≦m)を満たす)を推定する。なお、繰り返し処理では、まず、iが2の倍数ではないときに行う処理として以下の処理を行う。iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で記憶部115から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を記憶部115からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出す。 Product acquisition unit 217 and an exclusive OR calculation unit 119, 2 k-number of repeats the process of generating a mask (in other words, to produce a 2 k-number of mask in one iteration (loop)) . In the iterative process, each time one mask is generated, it is determined whether the number of generated masks is m or less. At this time, based on the determination result when i ≦ 2 k (for example, satisfying the conditional expression and determination expression (i ≦ m)), the determination result (for example, the conditional expression and determination expression (i ≦ m)) of i> 2 k is obtained. Estimate). Incidentally, in the iteration, first, it executes the following process as the process performed at the time i is not a multiple of 2 k. Based on the remainder q when i is divided by 2 k , the number N [q] of 0s arranged from the least significant bit representation of the remainder q is changed to N [1], N [2],. k- 1] from the storage unit 115, and a product L [p] corresponding to the number N [1], N [2],..., N [ 2k- 1] is stored in the storage unit 115. [N [1]], L [N [2]],..., L [N [2 k −1]] are extracted in this order.

次に、iが2の倍数であるときに行う処理として以下の処理を行う。処理ntz(i)により、iのビット表現の最下位から並んでいる0の個数p(=ntz(i))を計算し、この0の個数pに応じた積L[p](=L[ntz(i)])を記憶部115から取り出す。 Next, the following processing is performed as processing performed when i is a multiple of 2 k . By the process ntz (i), the number of 0s p (= ntz (i)) arranged from the least significant bit representation of i is calculated, and the product L [p] (= L [ ntz (i)]) is taken out from the storage unit 115.

なお、i>2における繰り返し処理では、iが2の倍数ではない場合に、積取得部217において、個数N[1]、N[2]、…、N[2−1]及び積L[N[1]]、L[N[2]]、…、L[N[2−1]]を記憶部115から取り出す処理を省略し、i≦2において記憶部115から取り出した積L[N[1]]、L[N[2]]、…、L[N[2−1]]を再利用してもよい。 In the iterative process when i> 2 k , when i is not a multiple of 2 k , the product acquisition unit 217 determines the number N [1], N [2],..., N [2 k −1] and the product. The process of extracting L [N [1]], L [N [2]],..., L [N [2 k −1]] from the storage unit 115 is omitted, and is extracted from the storage unit 115 when i ≦ 2 k . The products L [N [1]], L [N [2]],..., L [N [2 k −1]] may be reused.

図9〜11は、それぞれk=1〜3における、積取得部217及び排他的論理和算出部119の処理フローを示す。なお、図9〜11中、ループ端の上端には継続条件式を記載している。具体的に図9を用いてk=1の場合について説明する。   9 to 11 show processing flows of the product acquisition unit 217 and the exclusive OR calculation unit 119 when k = 1 to 3, respectively. 9 to 11, the continuation conditional expression is described at the upper end of the loop end. The case where k = 1 will be specifically described with reference to FIG.

<k=1の場合>
まず、積取得部217は、初期設定を行う(s217a)。
<When k = 1>
First, the product acquisition unit 217 performs initial setting (s217a).

次に、積取得部217は、i≦mにおいて以下の処理を繰り返す。   Next, the product acquisition unit 217 repeats the following process when i ≦ m.

積取得部217は、iを2で割ったときの剰余q=1のビット表現の最下位から並んでいる0の個数N[1]=0を記憶部115から取り出し、N[1]=0に応じた積L[0]を記憶部115から取り出し(s217b)、排他的論理和算出部119に出力する。なお、k=1の場合には、s217bで求めるiを2で割ったときの剰余i mod 2は1に決まっているため、その処理を省略することができる。 Product acquisition unit 217 extracts the number N [1] = 0 of 0 in a row from the least significant bit representation of the remainder q = 1 when A is divided by i with 2 k from the storage unit 115, N [1] = The product L [0] corresponding to 0 is extracted from the storage unit 115 (s217b) and output to the exclusive OR calculation unit 119. In the case of k = 1, since the remainder i mod 2 k obtained by dividing the i calculated by the s217b with 2 k are determined in 1, it can be omitted from the processing.

次に、積取得部217は、iをインクリメントし(s217c)、インクリメント後のiがmより大きい場合(s217dにおいてnoの場合)、ループから脱出する。   Next, the product acquisition unit 217 increments i (s217c), and if i after the increment is larger than m (no in s217d), exits from the loop.

インクリメント後のiがm以下の場合(s217dにおいてyesの場合)、積取得部217は、処理ntz(i)により、iのビット表現の最下位から並んでいる0の個数p(=ntz(i))を計算し、この0の個数pに応じた積L[p](=L[ntz(i)])を記憶部115から取り出し(s217e)、排他的論理和算出部119に出力する。さらに、iをインクリメントし(s217f)、継続条件式(i≦m)が真の場合には、上記処理s217b〜s217fを繰り返す。   When i after the increment is less than or equal to m (in the case of yes in s217d), the product acquisition unit 217 performs the process ntz (i) to determine the number of zeros p (= ntz (i) arranged from the least significant bit representation of i. )), And the product L [p] (= L [ntz (i)]) corresponding to the number p of 0 is extracted from the storage unit 115 (s217e) and output to the exclusive OR calculation unit 119. Further, i is incremented (s217f), and when the continuation conditional expression (i ≦ m) is true, the above processing s217b to s217f is repeated.

このような構成により、s117a及びs117cの一部を省略することができる。   With such a configuration, part of s117a and s117c can be omitted.

また、積取得部217は、複数の積をオーバーラップさせて取得し、i≦2における処理に基づきi>2における分岐予測を行うため、i>2において以下のような処理が可能となる。 In addition, the product acquisition unit 217 acquires a plurality of products in an overlapping manner, and performs branch prediction when i> 2k based on the processing when i ≦ 2k . Therefore, the following processing is possible when i> 2k It becomes.

i≦2における処理に基づき、i>2において、ループの継続条件式やs217dにおける判定式において、判定結果を推測し、次の命令をフェッチし投機的に実行する。より詳しくいうと、k=1の場合、i=1、i=2のときの判定結果(例えば条件式、判定式(i≦m)を満たす)に基づき、i≧3における判定結果(例えば条件式、判定式(i≦m)を満たす)を推定し、判定結果が出る前に、次の処理(s217b、s119及びs217cやs217e、s119及びs217f)を始める。最後の一回(つまり、i>mとなったとき)以外は条件が成立するので、最後の一回以外は、分岐予測ミスとはならない。そのため、処理全体に対するペナルティの割合は非常に小さなものであり、マスク生成処理全体の効率化を実現することができる。 Based on the processing at i ≦ 2 k , when i> 2 k , the determination result is estimated in the loop continuation conditional expression or the determination expression at s217d, and the next instruction is fetched and speculatively executed. More specifically, when k = 1, based on the determination result when i = 1 and i = 2 (for example, the conditional expression and the determination expression (i ≦ m) are satisfied), the determination result when i ≧ 3 (for example, the condition The formula and the judgment formula (i ≦ m) are estimated, and the next processing (s217b, s119 and s217c, s217e, s119 and s217f) is started before the judgment result is obtained. Since the condition is satisfied except for the last one (that is, when i> m), a branch prediction error does not occur except for the last one. Therefore, the penalty ratio with respect to the entire process is very small, and the efficiency of the entire mask generation process can be realized.

k=2の場合(図10参照)、k=3の場合(図11参照)、k≧4の場合も同様である。   The same applies to the case of k = 2 (see FIG. 10), the case of k = 3 (see FIG. 11), and the case of k ≧ 4.

<効果>
このような構成とすることで、第一実施形態と同様の効果が得られるとともに、より効率的にマスクG(i)Lを生成することができる。
<Effect>
With such a configuration, the same effect as that of the first embodiment can be obtained, and the mask G (i) L can be generated more efficiently.

<変形例>
第二実施形態と異なる部分についてのみ説明する。
<Modification>
Only parts different from the second embodiment will be described.

<変形例のポイント>
1個のマスクを生成する毎ではなく、2個のマスクを生成する毎に、生成したマスクの個数がm’以下か否かを判定し、m’以下のときに2個のマスクを生成する処理を繰り返す。ただし、m’=2・floor(m/2)であり、m’はm以下の2の最大の倍数を表す。このような構成により、i≦m’において、判定回数を減らすことができ、処理を軽減できる。
<Points of modification>
Not for each generating one mask, each time generating the 2 k-number of mask, the number of the generated mask 'determines whether or less, m' m a 2 k-number of mask when: Repeat the generation process. However, m ′ = 2 k · floor (m / 2 k ), and m ′ represents the maximum multiple of 2 k that is less than or equal to m. With such a configuration, the number of determinations can be reduced and processing can be reduced when i ≦ m ′.

<変形例に係るマスク生成装置600>
マスク生成装置600は、積取得部217に代えて、積取得部617を備える(図5参照)。
<Mask Generation Device 600 According to Modification>
The mask generation apparatus 600 includes a product acquisition unit 617 instead of the product acquisition unit 217 (see FIG. 5).

積取得部617及び排他的論理和算出部119は、2個のマスクを生成する処理を繰り返す(言い換えると、一回の繰り返し処理(ループ処理)の中で2個のマスクを生成する)。繰り返し処理毎(2個のマスクを生成する毎)に生成したマスクの個数がm’以下か否かを判定し、m’より大きくなるまで処理を繰り返す。 Product acquisition unit 617 and an exclusive OR calculation unit 119, 2 k-number of repeats the process of generating a mask (in other words, to produce a 2 k-number of mask in one iteration (loop)) . It is determined whether or not the number of masks generated for each repetition process (every 2k masks are generated) is less than or equal to m ′, and the process is repeated until it becomes larger than m ′.

なお、繰り返し処理では、まず、iが2の倍数ではないときに行う処理として以下の処理を行う。積取得部617は、iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で記憶部115から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を記憶部115からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出す。 Incidentally, in the iteration, first, it executes the following process as the process performed at the time i is not a multiple of 2 k. Product acquisition unit 617, based on the i to the remainder q when divided by 2 k, the number of zeros are arranged from the least significant bit representation of the remainder q N [q] to N [1], N [2 ] , ..., is taken out from the forward in the storage unit 115 of the N [2 k -1], further, the number N [1], N [2 ], ..., a product corresponding to the N [2 k -1] L [ p] Are extracted from the storage unit 115 in the order of L [N [1]], L [N [2]],..., L [N [2 k −1]].

次に、iが2の倍数であるときに行う処理として以下の処理を行う。積取得部617は、処理ntz(i)により、iのビット表現の最下位から並んでいる0の個数p(=ntz(i))を計算し、この0の個数pに応じた積L[p](=L[ntz(i)])を記憶部115から取り出す。 Next, the following processing is performed as processing performed when i is a multiple of 2 k . The product acquisition unit 617 calculates the number of zeros p (= ntz (i)) arranged from the least significant bit representation of i by the process ntz (i), and the product L [ p] (= L [ntz (i)]) is taken out from the storage unit 115.

なお、i>2(より詳しく言うと2<i≦m’)における繰り返し処理では、iが2の倍数ではない場合に、積取得部617において、個数N[1]、N[2]、…、N[2−1]及び積L[N[1]]、L[N[2]]、…、L[N[2−1]]を記憶部115から取り出す処理を省略し、i≦2において記憶部115から取り出した積L[N[1]]、L[N[2]]、…、L[N[2−1]]を再利用してもよい。 Note that in the iterative process at i> 2 k (more specifically, 2 k <i ≦ m ′), when i is not a multiple of 2 k , the product acquisition unit 617 uses the number N [1], N [2 ], ..., N [2 k -1] and the products L [N [1]], L [N [2]], ..., L [N [2 k -1]] are omitted from the storage unit 115. and the product was taken out from the storage unit 115 in the i ≦ 2 k L [N [ 1]], L [N [2]], ..., L [N [2 k -1]] may be reused.

生成したマスクの個数がm’より大きい場合、生成したマスクの個数がm以下か否かを判定し、mより大きくなるまで以下の処理を繰り返す。   If the number of generated masks is larger than m ', it is determined whether or not the number of generated masks is less than or equal to m, and the following processing is repeated until it becomes larger than m.

積取得部617は、iを2で割ったときの剰余q(=i mod 2)に基づき、その剰余q(=i mod 2)のビット表現の最下位から並んでいる0の個数p(=N[q]=N[i mod 2])を記憶部115から取り出し、さらに、この0の個数p(=N[q]=N[i mod 2])に応じた積L[p](=L[N[q]]=L[N[i mod 2]])を記憶部115から取り出し、排他的論理和算出部119に出力する。 Product acquisition unit 617, based on the remainder q (= i mod 2 k) obtained by dividing the i in 2 k, the number of zeros are arranged from the least significant bit representation of the remainder q (= i mod 2 k) p (= N [q] = N [i mod 2 k ]) is taken out from the storage unit 115, and the product L corresponding to the number p of 0 (= N [q] = N [i mod 2 k ]) [P] (= L [N [q]] = L [N [i mod 2 k ]]) is extracted from the storage unit 115 and output to the exclusive OR calculation unit 119.

このような構成により、第二実施形態と同様の効果を得ることができる。m’はm以下の2の最大の倍数なので、前半の繰り返し処理では、1個のマスクを生成する毎に生成したマスクの個数がm以下か否かを判定する処理を省略することができ、繰り返し処理毎(2個のマスクを生成する毎)に生成したマスクの個数がm’以下か否かを判定すればよい。また、mが2の倍数の場合、m=m’となり、後半の繰り返し処理を一回も行わない構成となるので、iが2の倍数であるか否かを判定する処理を省略することができる。 With such a configuration, the same effect as that of the second embodiment can be obtained. Since m 'is the maximum multiple of the following 2 k m, in the iteration of the first half may be the number of generated mask for each generates one mask to omit a process of determining whether or not more than m It may be determined whether or not the number of masks generated for each repetition process (every 2 k masks are generated) is equal to or less than m ′. Further, when m is a multiple of 2 k, m = m 'becomes so the second half iteration becomes also not performed configuration once, i although not determined whether or not a multiple of 2 k be able to.

図12〜14は、それぞれk=1〜3における、積取得部617及び排他的論理和算出部119の処理フローを示す。なお、図12〜14中、ループ端の上端には継続条件式を記載している。具体的に図12を用いてk=1の場合について説明する。   12 to 14 show processing flows of the product acquisition unit 617 and the exclusive OR calculation unit 119 when k = 1 to 3, respectively. In addition, in FIGS. 12-14, the continuation conditional expression is described in the upper end of a loop end. Specifically, the case where k = 1 will be described with reference to FIG.

<k=1の場合>
まず、積取得部617は、初期設定を行う(s617a)。
<When k = 1>
First, the product acquisition unit 617 performs initial setting (s617a).

次に、積取得部617は、i≦m’において以下の処理を繰り返す。   Next, the product acquisition unit 617 repeats the following processing when i ≦ m ′.

積取得部617は、iを2で割ったときの剰余q=1のビット表現の最下位から並んでいる0の個数N[1]=0を記憶部115から取り出し、N[1]=0に応じた積L[0]を記憶部115から取り出し(s617b)、排他的論理和算出部119に出力する。なお、k=1の場合には、s617bで求めるiを2で割ったときの剰余i mod 2は1に決まっているため、その処理を省略することができる。 Product acquisition unit 617 extracts the number N [1] = 0 of 0 in a row from the least significant bit representation of the remainder q = 1 when A is divided by i with 2 k from the storage unit 115, N [1] = The product L [0] corresponding to 0 is extracted from the storage unit 115 (s617b) and output to the exclusive OR calculation unit 119. In the case of k = 1, since the remainder i mod 2 k obtained by dividing the i calculated by the s617b with 2 k are determined in 1, it can be omitted from the processing.

次に、積取得部617は、iをインクリメントする(s617c)。   Next, the product acquisition unit 617 increments i (s617c).

積取得部617は、処理ntz(i)により、iのビット表現の最下位から並んでいる0の個数p(=ntz(i))を計算し、この0の個数pに応じた積L[p](=L[ntz(i)])を記憶部115から取り出し(s617d)、排他的論理和算出部119に出力する。さらに、iをインクリメントし(s617e)、継続条件式(i≦m’)が真の場合には、上記処理s617b〜s617eを繰り返す。   The product acquisition unit 617 calculates the number of zeros p (= ntz (i)) arranged from the least significant bit representation of i by the process ntz (i), and the product L [ p] (= L [ntz (i)]) is extracted from the storage unit 115 (s617d) and output to the exclusive OR calculation unit 119. Further, i is incremented (s617e), and if the continuation conditional expression (i ≦ m ′) is true, the above processing s617b to s617e is repeated.

継続条件式(i≦m’)を満たさない場合、i≦mにおいて以下の処理を繰り返す。   If the continuation conditional expression (i ≦ m ′) is not satisfied, the following processing is repeated for i ≦ m.

積取得部617は、iを2で割ったときの剰余q(=i mod 2)に基づき、その剰余q(=i mod 2)のビット表現の最下位から並んでいる0の個数p(=N[q]=N[i mod 2])を記憶部115から取り出し、さらに、この0の個数p(=N[q]=N[i mod 2])に応じた積L[p](=L[N[q]]=L[N[i mod 2]])を記憶部115から取り出し(s617f)、排他的論理和算出部119に出力する。さらに、iをインクリメントし(s617g)、継続条件式(i≦m)が真の場合には、上記処理s617f〜s617gを繰り返す。 Product acquisition unit 617, based on the remainder q (= i mod 2 k) obtained by dividing the i in 2 k, the number of zeros are arranged from the least significant bit representation of the remainder q (= i mod 2 k) p (= N [q] = N [i mod 2 k ]) is taken out from the storage unit 115, and the product L corresponding to the number p of 0 (= N [q] = N [i mod 2 k ]) [P] (= L [N [q]] = L [N [i mod 2 k ]]) is extracted from the storage unit 115 (s617f) and output to the exclusive OR calculation unit 119. Further, i is incremented (s617g), and if the continuation conditional expression (i ≦ m) is true, the above processes s617f to s617g are repeated.

このような構成により、判定処理を省略することができる。   With such a configuration, the determination process can be omitted.

また、積取得部617は、第二実施形態と同じように、複数の処理をオーバーラップさせて行ってもよい。この場合、ループの継続条件式において、判定結果を推測し、次の命令をフェッチし投機的に実行し、マスク生成処理全体の効率化を実現することができる。   In addition, the product acquisition unit 617 may perform a plurality of processes in the same manner as in the second embodiment. In this case, the determination result can be estimated in the loop continuation conditional expression, the next instruction can be fetched and speculatively executed, and the overall efficiency of the mask generation process can be realized.

例えば、前半の繰り返し処理では、i≦2における処理に基づき、2<i(より詳しく言うと、2<i≦m’)において、ループの継続条件式の判定結果を推測し、次の命令をフェッチし投機的に実行する。より詳しくいうと、k=1の場合、i=1のときの判定結果(例えば条件式(i≦m’)を満たす)に基づき、i≧3における判定結果(例えば条件式(i≦m)を満たす)を推定し、判定結果が出る前に、次の処理(s617b、s119及びs617cやs617d、s119及びs617e)を始める。 For example, in the first half of the iterative process, the determination result of the loop continuation conditional expression is estimated when 2 k <i (more specifically, 2 k <i ≦ m ′) based on the process in i ≦ 2 k . Are fetched and speculatively executed. More specifically, when k = 1, based on the determination result when i = 1 (for example, satisfying conditional expression (i ≦ m ′)), the determination result when i ≧ 3 (for example, conditional expression (i ≦ m)) The following processing (s617b, s119 and s617c, s617d, s119 and s617e) is started before the determination result is obtained.

また、後半の繰り返し処理では、i=m’+1における処理に基づき、m’+1<iにおいて、ループの継続条件式の判定結果を推測し、次の命令をフェッチし投機的に実行する。より詳しくいうと、i=m’+1のときの判定結果(例えば条件式(i≦m)を満たす)に基づき、i>m’+1における判定結果(例えば条件式(i≦m)を満たす)を推定し、判定結果が出る前に、次の処理(s617fやs617g)を始める。   In the second half of the iterative process, based on the process at i = m ′ + 1, the determination result of the loop continuation conditional expression is estimated when m ′ + 1 <i, and the next instruction is fetched and speculatively executed. More specifically, based on a determination result when i = m ′ + 1 (for example, satisfying conditional expression (i ≦ m)), a determination result when i> m ′ + 1 (for example, satisfying conditional expression (i ≦ m)) And the next processing (s617f and s617g) is started before the determination result is obtained.

各繰り返し処理において、最後の一回(つまり、i>m’またはi>mとなったとき)以外は条件が成立するので、最後の一回以外は、分岐予測ミスとはならない。そのため、処理全体に対するペナルティの割合は非常に小さなものであり、マスク生成処理全体の効率化を実現することができる。   In each repetitive process, the condition is satisfied except for the last one (that is, when i> m ′ or i> m), and therefore, no branch prediction error occurs except for the last one. Therefore, the penalty ratio with respect to the entire process is very small, and the efficiency of the entire mask generation process can be realized.

k=2の場合(図13参照)、k=3の場合(図14参照)、k≧4の場合も同様である。   The same applies to the case of k = 2 (see FIG. 13), the case of k = 3 (see FIG. 14), and the case of k ≧ 4.

<第三実施形態>
<第三実施形態のポイント>
AES暗号もしくはCamellia(参考文献1参照)のようなwhiteningと呼ばれる処理(拡大鍵との排他的論理和)がある暗号で、PMACやOCBのようなグレイ符号を使ったマスクを利用している暗号利用モードがある場合、第一実施形態及び第二実施形態に係る発明と組み合わせることで、実装を高速化できる。
(参考文献1)Kazumaro AOKI, Tetsuya ICHIKAWA, Masayuki KANDA, Mitsuru MATSUI, Shiho MORIAI, Junko NAKAJIMA, Toshio TOKITA, "The 128-Bit Block Cipher Camellia", IEICE TRANSACTIONS on Fundamentals of Electronics, 2002, Communications and Computer Sciences Vol.E85-A, No.1, pp.11-24
<Third embodiment>
<Points of third embodiment>
Cryptography that uses a process called “whying” (exclusive OR with extended key) such as AES cipher or Camellia (see Reference 1), and uses a mask using a Gray code such as PMAC or OCB. When there is a usage mode, the speed of mounting can be increased by combining with the invention according to the first embodiment and the second embodiment.
(Reference 1) Kazumaro AOKI, Tetsuya ICHIKAWA, Masayuki KANDA, Mitsuru MATSUI, Shiho MORIAI, Junko NAKAJIMA, Toshio TOKITA, "The 128-Bit Block Cipher Camellia", IEICE TRANSACTIONS on Fundamentals of Electronics, 2002, Communications and Computer Sciences Vol .E85-A, No.1, pp.11-24

まず、AES暗号では、Pを平文、Kを鍵、Cを暗号文として、暗号化処理を
C=AES_K(P)
と表現するが、whiteningが行われる場合、
C=aes_K(P xor k’)=AES_K(P)
と表現することができる。ここで、k’はKから計算されるビット列(以下「拡大鍵」ともいう)を表す。
First, in AES encryption, P is plaintext, K is a key, C is ciphertext, and encryption processing is C = AES_K (P)
But when whitening is performed,
C = aes_K (P xor k ′) = AES_K (P)
It can be expressed as Here, k ′ represents a bit string calculated from K (hereinafter also referred to as “extended key”).

OCBやPMACでは、
AES_K(P xor G(1)L),AES_K(P xor G(2)L),...,AES_K(P xor G(i)L),...
といった値が計算される。ここで、i−1番目のマスクG(i−1)Lからi番目のマスクG(i)Lを求める計算は、マスクG(i−1)Lと、iとLによる値L[ntz(i)]=xntz(i)Lとの排他的論理和を求めるだけなので、
G(i)L
をどんどん更新していくのではなく、
k’ xor G(i)L
を更新していけば、
aes_K(P xor (k' xor G(1)L)),aes_K(P xor (k' xor G(2)L)),...
,aes_K(P xor (k' xor G(i)L)),...
の計算でよくなり、1ブロックの暗号処理毎に排他的論理和一回を省略できる。
In OCB and PMAC,
AES_K (P xor G (1) L), AES_K (P xor G (2) L), ..., AES_K (P xor G (i) L), ...
Is calculated. Here, the calculation for obtaining the i-th mask G (i) L from the (i-1) -th mask G (i-1) L includes the mask G (i-1) L and a value L [ntz ( i)] = x ntz (i) Since only exclusive OR with L is obtained,
G (i) L
Instead of constantly updating
k 'xor G (i) L
If you update
aes_K (P xor (k 'xor G (1) L)), aes_K (P xor (k' xor G (2) L)), ...
, aes_K (P xor (k 'xor G (i) L)), ...
This makes it possible to omit the exclusive OR once for each block of encryption processing.

つまり、G(i)Lを次式により更新すると、whiteningにおいてG(i)Lとk’との排他的論理和を求める必要がある。   That is, when G (i) L is updated by the following equation, it is necessary to obtain an exclusive OR of G (i) L and k ′ in the whitening.

G(i)L←G(i−1)L xor L[ntz(i)]
一方、k’ xor G(i)Lを次式により更新すると、whiteningにおいて、そのままk’ xor G(i)Lを用いることができ、排他的論理和の処理回数を一回省略することができる。
G (i) L ← G (i-1) L xor L [ntz (i)]
On the other hand, when k ′ xor G (i) L is updated by the following equation, k ′ xor G (i) L can be used as it is in the whitening, and the number of exclusive OR processing can be omitted once. .

k’ xor G(i)L←k’ xor G(i−1)L xor L[ntz(i)]   k ′ xor G (i) L ← k ′ xor G (i−1) L xor L [ntz (i)]

<第三実施形態に係る暗号システム500>
図15は、暗号システム500の機能ブロック図を示す。暗号システム500は、情報処理装置300と情報処理装置400と通信回線501とを含む。情報処理装置300は、平文Pを暗号化して、暗号文Cを生成し、通信回線501を介して情報処理装置400に送信する。情報処理装置400は、暗号文Cを受信し、復号する。つまり、情報処理装置300は暗号化装置として機能し、情報処理装置400は復号装置として機能する。以下、各装置の処理内容を説明する。
<Encryption System 500 According to Third Embodiment>
FIG. 15 shows a functional block diagram of the cryptographic system 500. The cryptographic system 500 includes an information processing device 300, an information processing device 400, and a communication line 501. The information processing apparatus 300 encrypts the plaintext P, generates a ciphertext C, and transmits the ciphertext C to the information processing apparatus 400 via the communication line 501. The information processing apparatus 400 receives the ciphertext C and decrypts it. That is, the information processing device 300 functions as an encryption device, and the information processing device 400 functions as a decryption device. The processing contents of each device will be described below.

<情報処理装置300>
図16は情報処理装置300の機能ブロック図を、図17はその処理フローを示す。なお、図17中、ループ端の上端には変数=初期値、終値、増分値を、下端には変数を記載している。
<Information processing apparatus 300>
FIG. 16 is a functional block diagram of the information processing apparatus 300, and FIG. In FIG. 17, variables = initial value, final value, and increment value are described at the upper end of the loop end, and variables are described at the lower end.

情報処理装置300は、積算出部111、連続0ビット算出部113、記憶部115、積取得部117、排他的論理和算出部319、拡大鍵生成部321及び暗号化部323を含む。   The information processing apparatus 300 includes a product calculation unit 111, a continuous 0-bit calculation unit 113, a storage unit 115, a product acquisition unit 117, an exclusive OR calculation unit 319, an expanded key generation unit 321 and an encryption unit 323.

情報処理装置300は、秘密情報L、正整数k、利用者が所望するマスクの個数m、鍵K、m個の平文P[i]を入力とし、グレイ符号を利用して暗号利用モードで用いるマスクG(i)Lをm個生成し、そのマスクG(i)Lを利用して、m個の暗号文C[i]を生成し、出力する。   The information processing apparatus 300 receives the secret information L, the positive integer k, the number m of masks desired by the user, the key K, and m plaintexts P [i], and uses them in the encryption usage mode using the Gray code. M masks G (i) L are generated, and m ciphertexts C [i] are generated and output using the masks G (i) L.

積算出部111、連続0ビット算出部113、記憶部115、積取得部117の処理内容については第一実施形態と同様であり、説明を省略する。   The processing contents of the product calculation unit 111, the continuous 0-bit calculation unit 113, the storage unit 115, and the product acquisition unit 117 are the same as those in the first embodiment, and a description thereof will be omitted.

<拡大鍵生成部321>
拡大鍵生成部321は、鍵Kを受け取り、拡大鍵k’を生成し(s321)、排他的論理和算出部319に出力する。
<Extended Key Generation Unit 321>
The extended key generation unit 321 receives the key K, generates an extended key k ′ (s321), and outputs it to the exclusive OR calculation unit 319.

<排他的論理和算出部319>
排他的論理和算出部319は、まず、拡大鍵k’を受け取る。さらに、積L[ntz(i)]またはL[N[i mod 2]]を受け取る。k’ xor G(i−1)L(i−1におけるマスクG(i−1)Lと拡大鍵k’との排他的論理和)と積L[p](ただし、p=ntz(i)またはp=i mod 2)との排他的論理和(k’ xor G(i−1)L xor L[p])を求め(s319)、これをiにおけるマスクG(i)Lと拡大鍵k’との排他的論理和k’ xor G(i)Lとして、暗号化部323に出力するとともに、i+1におけるマスクG(i+1)Lと拡大鍵k’との排他的論理和(k’ xor G(i+1)L)を求めるために記憶しておく。
<Exclusive OR Calculation Unit 319>
The exclusive OR calculation unit 319 first receives the extended key k ′. Further, the product L [ntz (i)] or L [N [i mod 2 k ]] is received. k ′ xor G (i−1) L (exclusive OR of mask G (i−1) L in i−1 and extended key k ′) and product L [p] (where p = ntz (i) Alternatively, an exclusive OR (k ′ xor G (i−1) L xor L [p]) with p = i mod 2 k ) is obtained (s319), and this is used as the mask G (i) L and the expanded key in i As the exclusive logical sum k ′ xor G (i) L with k ′, the exclusive logical sum k ′ xor G (i) L is output to the encryption unit 323 and the exclusive logical sum (k ′ xor) of the mask G (i + 1) L and the expanded key k ′ in i + 1 G (i + 1) L) is stored for determination.

<暗号化部323>
暗号化部323は、m個の平文P[i]と鍵Kと排他的論理和k’ xor G(i)Lとを受け取る。暗号化部323は、鍵Kと排他的論理和(k’ xor L[p])とを用いて、平文P[i]を以下のように暗号化する。
C[i]=aes_K(P[i] xor k’ xor G(i)L)
m個の暗号文C[i]を情報処理装置400に出力する。
<Encryption unit 323>
The encryption unit 323 receives m plaintexts P [i], a key K, and an exclusive OR k ′ xor G (i) L. The encryption unit 323 encrypts the plaintext P [i] using the key K and the exclusive OR (k ′ xor L [p]) as follows.
C [i] = aes_K (P [i] xor k ′ xor G (i) L)
m ciphertexts C [i] are output to the information processing apparatus 400.

<情報処理装置400>
図18は情報処理装置400の機能ブロック図を、図19はその処理フローを示す。なお、図19中、ループ端の上端には変数=初期値、終値、増分値を、下端には変数を記載している。
<Information processing apparatus 400>
18 shows a functional block diagram of the information processing apparatus 400, and FIG. 19 shows its processing flow. In FIG. 19, variables = initial value, final value, and increment value are described at the upper end of the loop end, and variables are described at the lower end.

情報処理装置400は、積算出部111、連続0ビット算出部113、記憶部115、積取得部117、排他的論理和算出部319、拡大鍵生成部321及び復号部423を含む。   The information processing apparatus 400 includes a product calculation unit 111, a continuous 0-bit calculation unit 113, a storage unit 115, a product acquisition unit 117, an exclusive OR calculation unit 319, an expanded key generation unit 321 and a decryption unit 423.

情報処理装置400は、秘密情報L、正整数k、利用者が所望するマスクの個数m、鍵K、m個の暗号文C[i]を入力とし、グレイ符号を利用して暗号利用モードで用いるマスクG(i)Lをm個生成し、そのマスクG(i)Lを利用して、m個の暗号文C[i]を復号し、m個の平文P[i]を出力する。   The information processing apparatus 400 receives the secret information L, the positive integer k, the number m of masks desired by the user, the key K, and m ciphertexts C [i], and uses the Gray code in the cipher usage mode. M masks G (i) L to be used are generated, m ciphertexts C [i] are decrypted using the masks G (i) L, and m plaintexts P [i] are output.

積算出部111、連続0ビット算出部113、記憶部115、積取得部117の処理内容については第一実施形態と同様であり、排他的論理和算出部319及び拡大鍵生成部321の処理内容については情報処理装置300と同様であり、説明を省略する。   The processing contents of the product calculation unit 111, the continuous 0-bit calculation unit 113, the storage unit 115, and the product acquisition unit 117 are the same as in the first embodiment, and the processing contents of the exclusive OR calculation unit 319 and the extended key generation unit 321 Is the same as that of the information processing apparatus 300, and the description is omitted.

<復号部423>
復号部423は、m個の暗号文C[i]と鍵Kと排他的論理和k’ xor G(i)Lとを受け取る。復号部423は、鍵Kと排他的論理和(k’ xor L[p])とを用いて、m個の暗号文C[i]を以下のように復号する。
P[i]=aes−1_K(C[i] xor k’ xor G(i)L)
m個の平文P[i]を出力する。
<Decoding unit 423>
The decryption unit 423 receives m ciphertexts C [i], a key K, and an exclusive OR k ′ xor G (i) L. The decryption unit 423 decrypts m ciphertexts C [i] using the key K and the exclusive OR (k ′ xor L [p]) as follows.
P [i] = aes −1 _K (C [i] xor k ′ xor G (i) L)
Output m plaintexts P [i].

<効果>
このような構成により、情報処理装置300及び400は、1ブロックの暗号化または復号処理毎に排他的論理和一回を省略できる。
<Effect>
With this configuration, the information processing apparatuses 300 and 400 can omit one exclusive OR for each block encryption or decryption process.

<変形例>
第二実施形態に本実施形態を適用してもよい。
<Modification>
The present embodiment may be applied to the second embodiment.

また、mは平文Pや暗号文Cの大きさ(データ量)に応じて、自動的に生成される値であってもよい。第一実施形態や第二実施形態においても同様に、暗号化または復号対象となる平文や暗号文を与えられ、その大きさに応じて自動的にmを生成する構成としてもよい。   Further, m may be a value automatically generated according to the size (data amount) of plaintext P or ciphertext C. Similarly, in the first embodiment and the second embodiment, a plaintext or ciphertext to be encrypted or decrypted is given, and m may be automatically generated according to the size.

情報処理装置300及び400を、一つのコンピュータにより機能させてもよい。その場合、積算出部111、連続0ビット算出部113、記憶部115、積取得部117、排他的論理和算出部319及び拡大鍵生成部321を共通して用いることができる。   The information processing apparatuses 300 and 400 may function by a single computer. In that case, the product calculation unit 111, the continuous 0-bit calculation unit 113, the storage unit 115, the product acquisition unit 117, the exclusive OR calculation unit 319, and the expanded key generation unit 321 can be used in common.

<その他の変形例>
本発明は上記の実施形態及び変形例に限定されるものではない。例えば、上述の各種の処理は、記載に従って時系列に実行されるのみならず、処理を実行する装置の処理能力あるいは必要に応じて並列的にあるいは個別に実行されてもよい。その他、本発明の趣旨を逸脱しない範囲で適宜変更が可能である。
<Other variations>
The present invention is not limited to the above-described embodiments and modifications. For example, the various processes described above are not only executed in time series according to the description, but may also be executed in parallel or individually as required by the processing capability of the apparatus that executes the processes. In addition, it can change suitably in the range which does not deviate from the meaning of this invention.

<プログラム及び記録媒体>
上述したマスク生成装置及び情報処理装置は、コンピュータにより機能させることもできる。この場合はコンピュータに、目的とする装置(各種実施形態で図に示した機能構成をもつ装置)として機能させるためのプログラム、またはその処理手順(各実施形態で示したもの)の各過程をコンピュータに実行させるためのプログラムを、CD−ROM、磁気ディスク、半導体記憶装置などの記録媒体から、あるいは通信回線を介してそのコンピュータ内にダウンロードし、そのプログラムを実行させればよい。
<Program and recording medium>
The above-described mask generation apparatus and information processing apparatus can also be functioned by a computer. In this case, each process of a program for causing a computer to function as a target device (a device having the functional configuration shown in the drawings in various embodiments) or a process procedure (shown in each embodiment) is processed by the computer. A program to be executed by the computer may be downloaded from a recording medium such as a CD-ROM, a magnetic disk, or a semiconductor storage device or via a communication line into the computer, and the program may be executed.

Claims (8)

グレイ符号を利用して暗号利用モードで用いるマスクを生成するマスク生成装置であって、
f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は
Figure 0005818768
を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表すものとし、floor(A)をA以下の最大の整数を返す関数とし、mを生成するマスクの個数とし、p=0,1,…,floor(log(m))における秘密情報Lとx2^pとの積L[p]を求める積算出部と、
kを正整数とし、q=1,2,…,2−1における、qのビット表現の最下位から並んでいる0の個数N[q]を求める連続0ビット算出部と、
(floor(log(m))+1)個の前記積L[p]と2−1個の前記0の個数N[q]とが格納される記憶部と、
iが2の倍数であるときには、該iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数ntz(i)に応じた前記積L[ntz(i)]を前記記憶部から取り出し、iが2の倍数ではないときには、該iを2で割ったときの剰余i mod 2に基づき、その剰余i mod 2のビット表現の最下位から並んでいる0の個数N[i mod 2]を前記記憶部から取り出し、さらに、この個数N[i mod 2]に応じた前記積L[N[i mod 2]]を前記記憶部から取り出す積取得部と、
i−1におけるマスクG(i−1)Lと前記積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め、iにおけるマスクG(i)Lとする排他的論理和算出部と、を含む、
マスク生成装置。
A mask generation device that generates a mask to be used in an encryption mode using a gray code,
Let f (x) be an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is
Figure 0005818768
Is expressed as a polynomial of n-1 order or lower, the coefficient of the polynomial is expressed as an n-bit bit string, floor (A) is a function that returns the largest integer less than or equal to A, and a mask for generating m A product calculation unit for obtaining a product L [p] of secret information L and x 2 ^ p in p = 0, 1,..., Floor (log 2 (m));
a continuous 0-bit calculating unit for obtaining the number N [q] of 0s arranged from the least significant bit representation of q in k = 1, 2,..., 2 k −1, where k is a positive integer;
A storage unit storing (floor (log 2 (m)) + 1) number of the products L [p] and 2 k −1 number of the Ns [q];
When i is a multiple of 2 k , the number ntz (i) of 0s arranged from the least significant bit representation of i is obtained, and the product L [ntz (i) corresponding to the number ntz (i) of 0 is obtained. )] was removed from the storage unit, when i is not a multiple of 2 k, based on the remainder i mod 2 k obtained by dividing the i in 2 k, from the least significant bit representation of the remainder i mod 2 k The number N [i mod 2 k ] of 0 arranged is taken out from the storage unit, and the product L [N [i mod 2 k ]] corresponding to the number N [i mod 2 k ] is further stored in the storage unit. A product acquisition unit to be taken out from
An exclusive OR of the mask G (i−1) L in i−1 and the product L [ntz (i)] or L [N [i mod 2 k ]] is obtained, and the mask G (i) L in i And an exclusive OR calculation unit,
Mask generator.
請求項1記載のマスク生成装置であって、
前記積取得部は、複数の積L[p]をオーバーラップさせて取得し、2個の積L[p]を前記記憶部から取り出す処理を繰り返し、繰り返し処理の中で1個のマスクを生成する毎に生成したマスクの個数iがm以下か否かを判定し、i≦2のときの判定結果に基づき、i>2における判定結果を推定し、iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で前記記憶部から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を前記記憶部からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出し、その次に、iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数pに応じた積L[ntz(i)]を前記記憶部から取り出す、
マスク生成装置。
The mask generating apparatus according to claim 1,
The product acquisition unit acquires a plurality of products L [p] in an overlapping manner, repeats the process of retrieving 2 k products L [p] from the storage unit, and sets one mask in the repetition process. It is determined whether or not the number i of masks generated is less than or equal to m every time it is generated. Based on the determination result when i ≦ 2 k , the determination result at i> 2 k is estimated, and i is divided by 2 k . Based on the remainder q, the number N [q] of 0s arranged from the least significant bit representation of the remainder q in the order of N [1], N [2],..., N [2 k −1]. The product L [p] corresponding to the number N [1], N [2],..., N [2 k −1] is further extracted from the storage unit L [N [1]], L [N [2]],..., L [N [2 k −1]], and then the number of 0s arranged from the least significant bit representation of i ntz (i) is obtained, and a product L [ntz (i)] corresponding to the number p of 0 is extracted from the storage unit.
Mask generator.
請求項1記載のマスク生成装置であって、
前記積取得部は、2個の積L[p]を前記記憶部から取り出す処理を繰り返し、繰り返し処理の中で2個のマスクを生成する毎に生成したマスクの個数iがm以下の2の最大の倍数m’以下か否かを判定し、生成したマスクの個数が前記m’以下の場合、iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で前記記憶部から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を前記記憶部からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出し、その次に、iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数pに応じた積L[ntz(i)]を前記記憶部から取り出す、
マスク生成装置。
The mask generating apparatus according to claim 1,
The product acquisition unit repeats the process of extracting 2 k products L [p] from the storage unit, and the number i of masks generated each time 2 k masks are generated in the iterative process is m or less. It is determined whether or not the maximum multiple m ′ of 2 k is less than or equal to m ′. If the number of generated masks is less than or equal to m ′, the bit representation of the remainder q is based on the remainder q when i is divided by 2 k . The number N [q] of 0 arranged from the lowest is taken out from the storage unit in the order of N [1], N [2],..., N [2 k −1], and this number N [1] , N [2],..., N [2 k −1], L [N [1]], L [N [2]],. extraction in the order of 2 k -1]], the next, determine the number of zeros in a row from the least significant bit representation of i ntz (i), the product L corresponding to the number p of 0 ntz a (i)] is taken out from the storage unit,
Mask generator.
請求項1から請求項3の何れかに記載のマスク生成装置で生成されたマスクを用いる情報処理装置であって、
鍵Kをから拡大鍵k’を生成する拡大鍵生成部と、
鍵Kと排他的論理和k’ xor G(i)Lとを用いて、暗号化または復号する暗号化/復号部と、をさらに含み、
前記排他的論理和算出部は、前記拡大鍵k’とi−1におけるマスクG(i−1)Lとの排他的論理和と、前記積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め、求めた排他的論理和をiにおけるマスクG(i)Lと前記拡大鍵k’との排他的論理和k’ xor G(i)Lとする、
情報処理装置。
An information processing apparatus using a mask generated by the mask generation apparatus according to any one of claims 1 to 3,
An expanded key generation unit that generates an expanded key k ′ from the key K;
An encryption / decryption unit that encrypts or decrypts using the key K and the exclusive OR k ′ xor G (i) L;
The exclusive OR calculation unit calculates the exclusive OR of the expanded key k ′ and the mask G (i−1) L in i−1 and the product L [ntz (i)] or L [N [i mod 2 k ]], and the obtained exclusive OR is calculated as an exclusive OR k ′ xor G (i) L of the mask G (i) L and the expanded key k ′ in i. To
Information processing device.
グレイ符号を利用して暗号利用モードで用いるマスクを生成するマスク生成方法であって、
f(x)をGF(2)上のn次既約多項式とし、ガロア体GF(2)の元は
Figure 0005818768
を使い、n−1次以下の多項式で表現され、その多項式の係数をnビットのビット列として表すものとし、floor(A)をA以下の最大の整数を返す関数とし、mを生成するマスクの個数とし、積算出部が、p=0,1,…,floor(log(m))における秘密情報Lとx2^pとの積L[p]を求める積算出ステップと、
kを正整数とし、連続0ビット算出部が、q=1,2,…,2−1における、qのビット表現の最下位から並んでいる0の個数N[q]を求める連続0ビット算出ステップと、
前記積算出部が(floor(log(m))+1)個の前記積L[p]を、前記連続0ビット算出部が−1個の前記0の個数N[q]を記憶部に格納する記憶ステップと、
積取得部が、iが2の倍数であるときには、該iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数ntz(i)に応じた前記積L[ntz(i)]を前記記憶部から取り出し、iが2の倍数ではないときには、該iを2で割ったときの剰余i mod 2に基づき、その剰余i mod 2のビット表現の最下位から並んでいる0の個数N[i mod 2]を前記記憶部から取り出し、さらに、この個数N[i mod 2]に応じた前記積L[N[i mod 2]]を前記記憶部から取り出す積取得ステップと、
排他的論理和算出部が、i−1におけるマスクG(i−1)Lと前記積L[ntz(i)]またはL[N[i mod 2]]との排他的論理和を求め、iにおけるマスクG(i)Lとする排他的論理和算出ステップと、を含む、
マスク生成方法。
A mask generation method for generating a mask to be used in an encryption mode using a gray code,
Let f (x) be an n-th irreducible polynomial over GF (2), and the element of the Galois field GF (2 n ) is
Figure 0005818768
Is expressed as a polynomial of n-1 order or lower, the coefficient of the polynomial is expressed as an n-bit bit string, floor (A) is a function that returns the largest integer less than or equal to A, and a mask for generating m A product calculation step in which the product calculation unit obtains a product L [p] of the secret information L and x 2 ^ p in p = 0, 1,..., Floor (log 2 (m));
k is a positive integer, and the continuous 0-bit calculating unit obtains the number N [q] of 0s arranged from the least significant bit representation of q in q = 1, 2,..., 2 k −1. A calculation step;
The product calculation unit stores (floor (log 2 (m)) + 1) products L [p] , and the continuous 0-bit calculation unit stores 2 k -1 number N [q ] of 0. A storage step to store in
When i is a multiple of 2 k , the product acquisition unit obtains the number ntz (i) of 0s arranged from the lowest order of the bit representation of i, and the product corresponding to the number ntz (i) of 0 L extraction [ntz (i)] from the storage unit, when i is not a multiple of 2 k, based on the remainder i mod 2 k obtained by dividing the i in 2 k, bits of the remainder i mod 2 k The number N [i mod 2 k ] of 0 arranged from the lowest of the expression is extracted from the storage unit, and the product L [N [i mod 2 k ] corresponding to the number N [i mod 2 k ] is further obtained . ] To obtain a product from the storage unit;
An exclusive OR calculating unit obtains an exclusive OR of the mask G (i−1) L in i−1 and the product L [ntz (i)] or L [N [i mod 2 k ]]; an exclusive OR calculation step with a mask G (i) L in i,
Mask generation method.
請求項5記載のマスク生成方法であって、
前記積取得ステップにおいて、複数の積L[p]をオーバーラップさせて取得し、2個の積L[p]を前記記憶部から取り出す処理を繰り返し、繰り返し処理の中で1個のマスクを生成する毎に生成したマスクの個数iがm以下か否かを判定し、i≦2のときの判定結果に基づき、i>2における判定結果を推定し、iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で前記記憶部から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を前記記憶部からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出し、その次に、iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数pに応じた積L[ntz(i)]を前記記憶部から取り出す、
マスク生成方法。
The mask generation method according to claim 5, comprising:
In the product acquisition step, a plurality of products L [p] are acquired in an overlapping manner, and 2 k products L [p] are extracted from the storage unit repeatedly, and one mask is set in the repetition processing. It is determined whether or not the number i of masks generated is less than or equal to m every time it is generated. Based on the determination result when i ≦ 2 k , the determination result at i> 2 k is estimated, and i is divided by 2 k . Based on the remainder q, the number N [q] of 0s arranged from the least significant bit representation of the remainder q in the order of N [1], N [2],..., N [2 k −1]. The product L [p] corresponding to the number N [1], N [2],..., N [2 k −1] is further extracted from the storage unit L [N [1]], L [N [2]],..., L [N [2 k −1]] are extracted in this order, and then arranged from the least significant bit representation of i. The number of zeros ntz (i) is obtained, and the product L [ntz (i)] corresponding to the number of zeros p is taken out from the storage unit.
Mask generation method.
請求項5記載のマスク生成方法であって、
前記積取得ステップにおいて、2個の積L[p]を前記記憶部から取り出す処理を繰り返し、繰り返し処理の中で2個のマスクを生成する毎に生成したマスクの個数iがm以下の2の最大の倍数m’以下か否かを判定し、生成したマスクの個数が前記m’以下の場合、iを2で割ったときの剰余qに基づき、その剰余qのビット表現の最下位から並んでいる0の個数N[q]をN[1]、N[2]、…、N[2−1]の順で前記記憶部から取り出し、さらに、この個数N[1]、N[2]、…、N[2−1]に応じた積L[p]を前記記憶部からL[N[1]]、L[N[2]]、…、L[N[2−1]]の順で取り出し、その次に、iのビット表現の最下位から並んでいる0の個数ntz(i)を求め、この0の個数pに応じた積L[ntz(i)]を前記記憶部から取り出す、
マスク生成方法。
The mask generation method according to claim 5, comprising:
In the product acquisition step, the process of taking out 2 k products L [p] from the storage unit is repeated, and the number i of masks generated each time 2 k masks are generated in the repetition process is less than or equal to m. It is determined whether or not the maximum multiple m ′ of 2 k is less than or equal to m ′. If the number of generated masks is less than or equal to m ′, the bit representation of the remainder q is based on the remainder q when i is divided by 2 k . The number N [q] of 0 arranged from the lowest is taken out from the storage unit in the order of N [1], N [2],..., N [2 k −1], and this number N [1] , N [2],..., N [2 k −1], L [N [1]], L [N [2]],. 2 k -1]] extracted in order, the next, determine the number of zeros in a row from the least significant bit representation of i ntz (i), the number of 0 p Depending productsum L [ntz (i)] to retrieve from the storage unit,
Mask generation method.
請求項1から請求項3の何れかに記載のマスク生成装置、または、請求項4記載の情報処理装置として、コンピュータを機能させるためのプログラム。   A program for causing a computer to function as the mask generation device according to any one of claims 1 to 3 or the information processing device according to claim 4.
JP2012230803A 2012-10-18 2012-10-18 Mask generation apparatus, information processing apparatus, method thereof, and program Active JP5818768B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012230803A JP5818768B2 (en) 2012-10-18 2012-10-18 Mask generation apparatus, information processing apparatus, method thereof, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012230803A JP5818768B2 (en) 2012-10-18 2012-10-18 Mask generation apparatus, information processing apparatus, method thereof, and program

Publications (2)

Publication Number Publication Date
JP2014081569A JP2014081569A (en) 2014-05-08
JP5818768B2 true JP5818768B2 (en) 2015-11-18

Family

ID=50785779

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012230803A Active JP5818768B2 (en) 2012-10-18 2012-10-18 Mask generation apparatus, information processing apparatus, method thereof, and program

Country Status (1)

Country Link
JP (1) JP5818768B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4936996B2 (en) * 2007-05-24 2012-05-23 株式会社東芝 Nonlinear data converter, encryption device, and decryption device
JP5229315B2 (en) * 2008-03-31 2013-07-03 富士通株式会社 Encryption device and built-in device equipped with a common key encryption function
JP5202350B2 (en) * 2009-01-16 2013-06-05 三菱電機株式会社 Cryptographic processing apparatus, cryptographic processing method, and cryptographic processing program

Also Published As

Publication number Publication date
JP2014081569A (en) 2014-05-08

Similar Documents

Publication Publication Date Title
JP6934963B2 (en) Data encryption methods and systems
KR101246437B1 (en) Cryptographic system including a random number generator using finite field arithmetics
US11546135B2 (en) Key sequence generation for cryptographic operations
JP6035459B2 (en) ENCRYPTION DEVICE, DECRYPTION DEVICE, AND PROGRAM
JP6575532B2 (en) Encryption device, decryption device, encryption processing system, encryption method, decryption method, encryption program, and decryption program
US11153068B2 (en) Encryption device, encryption method, decryption device and decryption method
JP6552184B2 (en) INFORMATION PROCESSING APPARATUS AND METHOD THEREOF
JP2004363739A (en) Enciphering device or deciphering device for common key cipher that can detect alteration
WO2013065241A1 (en) Incremental mac tag generation device, method, and program, and message authentication device
WO2018154623A1 (en) Encryption device and decoding device
JPWO2012157279A1 (en) Order-preserving encryption system, apparatus, method, and program
US9515830B2 (en) Universal hash function computing device, method and program
WO2020213114A1 (en) Mac tag list generation device, mac tag list verification device, method, and program
US20150172045A1 (en) Method of cryption
CN106656500A (en) Encryption device and method
JP4857230B2 (en) Pseudorandom number generator and encryption processing device using the same
JP7371757B2 (en) Authentication encryption device, authentication decryption device, authentication encryption method, authentication decryption method and program
JP5818768B2 (en) Mask generation apparatus, information processing apparatus, method thereof, and program
Singh et al. Study & analysis of cryptography algorithms: RSA, AES, DES, T-DES, blowfish
JP7136226B2 (en) Authentication encryption device, authentication decryption device, authentication encryption method, authentication decryption method, authentication encryption program and authentication decryption program
JP2007013503A (en) Encryption device and method and decryption device and method
KR100954224B1 (en) Apparatus for offset code book coding
JP2001358709A (en) Enciphering device, decoding device, methods for the sames and recording medium
JP5268413B2 (en) Disclosure restriction processing apparatus, data processing system, and program
TW201528754A (en) Encryption and decryption system and method using chaotic mapping with spatial-temporal perturbation

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150114

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150810

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150818

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150903

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150929

R150 Certificate of patent or registration of utility model

Ref document number: 5818768

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150