JP2013205437A - Method and apparatus for calculating nonlinear function s-box - Google Patents
Method and apparatus for calculating nonlinear function s-box Download PDFInfo
- Publication number
- JP2013205437A JP2013205437A JP2012070877A JP2012070877A JP2013205437A JP 2013205437 A JP2013205437 A JP 2013205437A JP 2012070877 A JP2012070877 A JP 2012070877A JP 2012070877 A JP2012070877 A JP 2012070877A JP 2013205437 A JP2013205437 A JP 2013205437A
- Authority
- JP
- Japan
- Prior art keywords
- data
- register
- polynomial
- box
- stored
- 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.)
- Pending
Links
Images
Abstract
Description
本発明は、ブロック暗号、ストリーム暗号、暗号学的ハッシュ関数の計算におけるS−box計算方法、及びプログラムの技術に関する。 The present invention relates to a block cipher, a stream cipher, an S-box calculation method for calculating a cryptographic hash function, and a program technique.
ブロック暗号、ストリーム暗号、暗号学的ハッシュ関数などの共通鍵暗号のソフトウェア実装の一手法として、ビットスライス実装が知られている。ビットスライス実装とは、小さなビット幅(例えば4ビット)の入出力をもつ構成要素(ブロック暗号AESであればS−box、MixColumns、AddRoundKey、ShiftRows)を組み合わせて共通鍵暗号アルゴリズムを構成する技術であり、暗号処理の並列化を図り、プロセッサの演算回路の効率を高め、暗号化処理速度、復号処理速度を高めるソフトウェア実装方法である。 Bit slice implementation is known as one method of software implementation of common key cryptography such as block cipher, stream cipher, and cryptographic hash function. Bit-slice implementation is a technology that configures a common key encryption algorithm by combining components (S-box, MixColumns, AddRoundKey, ShiftRows in the case of block cipher AES) that have input and output with a small bit width (for example, 4 bits). There is a software implementation method that parallelizes cryptographic processing, increases the efficiency of the arithmetic circuit of the processor, and increases the encryption processing speed and the decryption processing speed.
ビットスライス実装の効果は、暗号アルゴリズムの構造や(ブロック暗号の場合は)使用する暗号利用モードに依存しており、ビットスライス実装することを想定して暗号設計されることも多い。効率的なビットスライス実装が可能な暗号アルゴリズムの例としてブロック暗号DES、Serpentなどが知られている。 The effect of the bit slice implementation depends on the structure of the encryption algorithm and the encryption usage mode to be used (in the case of block cipher), and is often designed with the assumption that the bit slice implementation is implemented. Block ciphers such as DES and Serpent are known as examples of encryption algorithms that can implement an efficient bit slice.
ブロック暗号、ストリーム暗号、暗号学的ハッシュ関数などの共通鍵暗号において、効率的なビットスライス実装が可能か否かは暗号アルゴリズムの構成要素として含まれる非線形関数の構造に依存する。非線形関数はブロック暗号、ストリーム暗号、暗号学的ハッシュ関数などの共通鍵暗号において安全性を強化するための構成要素として用いられる。 In common key cryptosystems such as block ciphers, stream ciphers, and cryptographic hash functions, whether or not efficient bit slice implementation is possible depends on the structure of a nonlinear function included as a component of the cryptographic algorithm. The non-linear function is used as a component for enhancing security in common key cryptography such as block cipher, stream cipher, and cryptographic hash function.
この非線形関数を実現する一手法としてS−boxが知られている。ここで、S−boxとは比較的小さな整数m, n (例えば4≦m,n≦8)に対し, mビット入力、nビット出力をもつ非線形な関数(本実施例の場合は、入力ビット長、出力ビット長を表す整数m、nはm=nとする。)
S−box:{0,1}m→{0,1}n (数1)
である。
S-box is known as one method for realizing this nonlinear function. Here, S-box is a non-linear function having m-bit input and n-bit output for a relatively small integer m, n (for example, 4 ≦ m, n ≦ 8) (in this embodiment, an input bit) (The integers m and n representing the length and output bit length are assumed to be m = n.)
S-box: {0,1} m → {0,1} n (Equation 1)
It is.
以後、nビットのビット列全体の集合{0,1}nと有限体GF(2)上のn次元線形空間GF(2)n を写像φ
φ: {0,1}n→GF(2)n, a1a2…an−1an→(a1,a2,…,an−1,an) (数2)
によって同一視することにする。
After that, the set {0,1} n of the entire bit sequence of n bits and the n-dimensional linear space GF (2) n on the finite field GF (2) are mapped φ
φ: {0, 1} n → GF (2) n , a 1 a 2 ... a n−1 a n → (a 1 , a 2 ,..., a n−1 , a n ) (Equation 2)
Will be identified.
S−boxの計算方法の一つとしてテーブル参照が知られている(非特許文献1参照)。テーブル参照は、集合{S−box(0), S−box(1), …, S−box(2m−1)}を表として保持しておく。そして関数S−boxへの入力xに対し、上記集合の元であるS−box(x)を取り出し、出力する。例えば、米国標準のブロック暗号AESにおけるS−boxの表参照用のテーブルについては非特許文献4のp.16 (暗号化処理で使用するS−box), p.22(復号処理で使用する逆S−box)に記載がある。
Table reference is known as one of S-box calculation methods (see Non-Patent Document 1). As a table reference, a set {S-box (0), S-box (1),..., S-box (2 m −1)} is held as a table. Then, for the input x to the function S-box, S-box (x) that is the element of the set is extracted and output. For example, for the table for referring to the S-box table in the American standard block cipher AES, p.16 (S-box used in the encryption process), p.22 (reverse used in the decryption process) of
(数1)で表される非線形関数S−boxは、有限体GF(2)上の多項式写像の形で表されることが知られている。ここで、非線形関数S−boxを表現する有限体GF(2)上の多項式写像とは、GF(2)上のn変数多項式F1,…,Fn が存在して、すべてのa1a2…am−1am∈{0,1}mに対して
S−box(a1,…,am )=(F1 (a1,…,am ), …, Fn(a1,…,am )) (数3)
が成り立つことである。(数3)は、関数S−boxが、関数としてS−box=(F1,…Fn)と表わされることを示している。
It is known that the nonlinear function S-box expressed by (Expression 1) is expressed in the form of a polynomial map on the finite field GF (2). Here, the polynomial mapping on the finite field GF (2) representing the nonlinear function S-box includes n variable polynomials F 1 ,..., F n on GF (2), and all a 1 a 2 … for a m−1 a m ∈ {0,1} m
S−box (a 1 ,…, a m ) = (F 1 (a 1 ,…, a m ),…, F n (a 1 ,…, a m )) (Equation 3)
Is true. (Expression 3) indicates that the function S-box is expressed as S-box = (F 1 ,... F n ) as a function.
ここで、F1, …FnはGF(2)上のn変数多項式である。(数3)は、集合{0, 1}m の元a1...am を関数S−boxに代入した値S−box(a1,…am )が、(F1 (a1,…am ), …Fn (a1,…am))と等しいことを述べている。多項式写像については、例えば非特許文献2、3に記載がある。ビットスライス実装では、S−boxの入出力となるmビットデータa1,…amは、それぞれ異なるレジスタに格納されている。そのため、S−boxの計算では、入出力データを保持するレジスタの他に、S−boxの計算における中間値の計算、及び保持を行うためのレジスタ(余剰レジスタ)が必要になる。
Here, F 1 ,... F n are n variable polynomials on GF (2). (Equation 3) is a set {0, 1} m of the original a 1 ... a m a function S-box to assign values S-box (a 1, ... a m) is, (F 1 (a 1 , ... a m ), ... F n (a 1 , ... a m )). For example,
以後、入力ビット長、出力ビット長を表す整数m、nはm=nとする。また、非線形関数S−boxは全単射(つまり、nビット列の集合{0, 1}n 上の置換)であるとする。 Hereinafter, integers m and n representing the input bit length and output bit length are assumed to be m = n. Further, it is assumed that the nonlinear function S-box is bijective (that is, permutation on a set {0, 1} n of n bit strings).
情報通信ネットワークの進展とともに電子情報に対する秘匿や認証の為に暗号技術は不可欠な要素となってきている。暗号技術に課せられる要件としては、安全性以外にも、処理速度やメモリ使用量、更にレジスタ使用本数などがある。 Cryptographic technology has become an indispensable element for concealing and authenticating electronic information with the development of information and communication networks. In addition to security, requirements imposed on cryptographic techniques include processing speed, memory usage, and the number of registers used.
しかし、一般に、安全性、処理速度、メモリ使用量、レジスタ使用本数の間にはトレードオフの関係があり、全ての要件を満たすことは難しい。 However, in general, there is a trade-off relationship among safety, processing speed, memory usage, and the number of registers used, and it is difficult to satisfy all requirements.
レジスタの本数(個数)が少ないCPU上(例えばIA32 (x86系)のCPUは汎用レジスタが8本)でビットスライス実装したプログラムを実行する場合、暗復号で使用する鍵データ、及び平文データ(復号する場合は暗号文)がレジスタに格納されている。上記プログラムを用いて暗号化(または復号)処理を実施すると、上記プログラムに従って暗号化(または復号)が開始される。このとき、上記鍵データ、平文データの他に、暗号化(または復号)の中間値データを保持しておく必要がある。 When executing a bit slice-implemented program on a CPU with a small number of registers (for example, an IA32 (x86 series CPU has 8 general-purpose registers)), key data and plaintext data (decryption) The ciphertext) is stored in the register. When encryption (or decryption) processing is performed using the program, encryption (or decryption) is started according to the program. At this time, in addition to the key data and plaintext data, it is necessary to hold intermediate value data for encryption (or decryption).
汎用PCにおいて、値を保持するためにレジスタやメモリが利用される。ある計算をCPU上で実行する場合、その計算の入力値をレジスタに格納し、その後、実際の計算を行う。そのため、上記入力値がメモリに格納されている場合、上記入力値をメモリからレジスタに転送することが必要になり、転送の処理時間を要する。このように、メモリ上の値を計算で使用するためには上述の転送が必要となるため、計算に必要な値は可能な限りレジスタに格納しておくことが望ましい。 In general-purpose PCs, registers and memory are used to hold values. When a certain calculation is executed on the CPU, the input value of the calculation is stored in a register, and then the actual calculation is performed. Therefore, when the input value is stored in the memory, it is necessary to transfer the input value from the memory to the register, and a transfer processing time is required. As described above, since the above-described transfer is necessary to use the value on the memory in the calculation, it is desirable to store the value necessary for the calculation in the register as much as possible.
ところが、レジスタの本数が少ないCPUでは、上記鍵データ、平文データ、及び上記中間値データの全てをレジスタに格納できないことがある。このように、格納すべき全てのデータのデータサイズがレジスタに格納できるデータサイズより大きい場合、格納できないデータは、レジスタではなく、メモリに格納しなければならない。したがって、上記プログラムをアセンブリ言語で実装している場合、必然的に多くのスタック操作(アセンブリ言語のpush命令、pop命令)が必要となる。以後、中間値データを格納するためのレジスタを余剰レジスタと呼ぶ。 However, a CPU with a small number of registers may not be able to store all of the key data, plaintext data, and intermediate value data in the registers. Thus, when the data size of all data to be stored is larger than the data size that can be stored in the register, the data that cannot be stored must be stored in the memory, not in the register. Therefore, when the above program is implemented in assembly language, a large number of stack operations (assembly language push instructions, pop instructions) are inevitably required. Hereinafter, a register for storing intermediate value data is referred to as a surplus register.
一般に、少ない余剰レジスタを用いたビットスライス実装において、最も重要となるのは非線形関数S−boxの実装方法である。 In general, in the bit slice implementation using a small number of surplus registers, the most important is the implementation method of the nonlinear function S-box.
多くのスタック操作が必要であれば、スタック操作によってメモリアクセス頻度が高くなり、速度低下を引き起こす。一方、実システムで様々なアプリケーションが実行されているような環境(例えばサーバなど)において、S−boxの計算で多くの余剰レジスタを必要とする暗号のソフトウェアプログラムが組込まれている場合、上記アプリケーションが使用可能なレジスタが少なくなるため、処理時間に大きな影響を及ぼす。また、S−boxは暗号アルゴリズム毎に異なるため、少ない余剰レジスタを用いたビットスライス実装が可能か否かは、暗号アルゴリズム毎に個別に検討する必要がある。 If a large number of stack operations are required, the memory access frequency is increased by the stack operations, and the speed is reduced. On the other hand, in an environment where various applications are executed in a real system (for example, a server, etc.), if an encryption software program that requires a lot of surplus registers is incorporated in the S-box calculation, However, the number of registers that can be used decreases, which greatly affects processing time. In addition, since the S-box differs for each encryption algorithm, it is necessary to individually examine whether or not bit slice implementation using a small number of surplus registers is possible for each encryption algorithm.
例えば、非特許文献1では、ブロック暗号Serpentに対し、少ない余剰レジスタを用いたビットスライス実装方法を提供している。ところが、非特許文献1に記載の方法はブロック暗号Serpentに対してのみ適用可能であり、他のブロック暗号への直接適用は困難である。
For example, Non-Patent
また、非特許文献1以外にも、少ない余剰レジスタを用いたビットスライス実装方法が提供されているブロック暗号があり、ブロック暗号DESについては非特許文献5に記載されているものの、非特許文献1と同様、他のブロック暗号への直接適用は困難である。
In addition to Non-Patent
したがって、非線形関数S−boxの構造に依存せず、少ない余剰レジスタによるS−boxの汎用的なソフトウェア実装方法が提供されていない。 Therefore, a general-purpose software implementation method for S-box using a small number of surplus registers is not provided without depending on the structure of the nonlinear function S-box.
本発明は、上記課題に鑑みてなされたもので、非線形関数S−boxの置換に依存せず、少ない余剰レジスタで処理可能な非線形関数S−boxの計算技術を実現することを目的とする。 The present invention has been made in view of the above problems, and an object of the present invention is to realize a non-linear function S-box calculation technique that can be processed with a small number of surplus registers without depending on the replacement of the non-linear function S-box.
上述したように、少ない余剰レジスタでS−boxを計算する従来技術は、暗号アルゴリズム毎 (S−boxの置換毎)に計算方法を個別に検討する必要がある。 As described above, in the conventional technique for calculating the S-box with a small number of surplus registers, it is necessary to individually consider the calculation method for each cryptographic algorithm (for each replacement of the S-box).
本発明は、限定された種類の置換を、予め定められた順番に従って施すことによりS−boxを計算する。ここで、置換を多項式写像で表現した場合の、限定された種類の置換とは、後述する基本多項式写像、triangular 多項式写像、及び可逆なアフィン多項式写像をさす。基本多項式写像、triangular 多項式写像、及び可逆なアフィン多項式写像は少ない余剰レジスタで処理可能であるという特徴を用いて、少ない余剰レジスタで処理可能な非線形関数S−boxの計算を行う。 The present invention calculates the S-box by performing limited types of permutations according to a predetermined order. Here, when the permutation is expressed by a polynomial mapping, the limited types of permutations refer to a basic polynomial mapping, a triangular polynomial mapping, and a reversible affine polynomial mapping described later. Using the feature that basic polynomial mapping, triangular polynomial mapping, and reversible affine polynomial mapping can be processed with a small number of surplus registers, a nonlinear function S-box that can be processed with a small number of surplus registers is calculated.
本発明により、少ない余剰レジスタで非線形関数S−boxの計算が可能となる。上記の限定された置換を変えるだけで、種々の暗号アルゴリズムに対応したS−boxの計算が可能になる。そして、少ない余剰レジスタで計算が可能であることにより、実システムに適用した場合であっても、他のアプリケーションの処理時間に大きな影響を及ぼすことなく各種共通鍵暗号の処理が可能である。 According to the present invention, the nonlinear function S-box can be calculated with a small number of surplus registers. It is possible to calculate S-boxes corresponding to various cryptographic algorithms only by changing the above limited replacement. Since calculation can be performed with a small number of surplus registers, various common key encryption processes can be performed without greatly affecting the processing time of other applications even when applied to a real system.
以下、本発明を適用した第一の実施形態を図面により説明する。 Hereinafter, a first embodiment to which the present invention is applied will be described with reference to the drawings.
(システム構成)
図1は第一の実施例における暗号通信システムのシステム構成図であり、本発明の暗号通信システムの機能ブロック構成も示している。
(System configuration)
FIG. 1 is a system configuration diagram of the cryptographic communication system in the first embodiment, and also shows a functional block configuration of the cryptographic communication system of the present invention.
ネットワーク126を介して、ディスプレイ124及びキーボード125を有するコンピュータA(114)から、ディスプレイ152及びキーボード153を有するコンピュータB(145)にデータが転送される。コンピュータA(114)は、RAM115、入出力インタフェース130、及び、CPU144を有し、RAM115には、S−box処理プログラムPROG2(120)を含む暗号化処理プログラムPROG1(116)、秘密鍵Key(117)、補助情報IV(118)、及び平文M(119)が格納されている。コンピュータB(145)は、RAM146、入出力インタフェース156、及び、CPU157を有し、RAM146には、S−box処理プログラムPROG4(151)を含む復号処理プログラムPROG3(147)、秘密鍵Key(148)、補助情報IV(149)、及び平文M(150)が格納されている。
Data is transferred from the computer A (114) having the
(S−box計算部構成)
図2は、本実施形態に係るS−box処理プログラム120の構成例を示す図である。なお、図2に示す構成は、図1におけるコンピュータA 114およびコンピュータB 145において、共通の構成である。
(S-box calculation unit configuration)
FIG. 2 is a diagram showing a configuration example of the S-
S−box処理プログラム120は、CPU144内にある入出力レジスタ208に格納されているnビットデータを入力とし、nビットデータを出力するものであり、アフィン多項式写像計算部201、基本多項式計算部202、triangular多項式写像計算部203、プログラム読み込み部204、繰り返し判定部205、及び多項式写像所属判定部206を備える。
The S-
CPU144は、余剰レジスタ207と、入出力レジスタ208とを備える。各部201〜208の機能については、処理の説明において後記する。
The
(情報の送受信)
次に、図1に沿ってメッセージの暗号化処理および復号処理の概要を説明する。
(Send and receive information)
Next, an outline of message encryption processing and decryption processing will be described with reference to FIG.
まず、コンピュータA 114が、入力されたメッセージを暗号化する場合の動作について図1を参照して説明する。メッセージはデジタル化されたデータであればよく、テキスト、画像、映像、音などの種類は問わない。
First, an operation when the
まず、CPU144は、入出力インタフェース130を介して、平文メッセージ(入力メッセージ)M 119を取得する。
First, the
次に、CPU144は、RAM115に格納されている秘密鍵Key117、補助情報IV(118)を取得する。補助情報IV(118)は、暗号化処理プログラムPROG1(116)としてブロック暗号を利用している場合は、カウンターモードのような暗号利用モードの初期値であり、暗号化処理プログラムPROG1(116)としてストリーム暗号を利用している場合は、ストリーム暗号の初期値である。
Next, the
CPU144は、受け取った秘密鍵Key117、補助情報IV(118)を用いて、平文メッセージMの暗号化処理を行う。
The
以後、暗号化処理プログラムPROG1(116)として利用する暗号方式は非線形関数S−boxを構成要素にもつとする。また、非線形関数S−boxはS−box処理プログラムPROG2(120)として実現されているとする。暗号化処理は図3で後記するS−box計算処理を含む。 Hereinafter, it is assumed that the encryption method used as the encryption processing program PROG1 (116) has a nonlinear function S-box as a component. Further, it is assumed that the nonlinear function S-box is realized as the S-box processing program PROG2 (120). The encryption processing includes S-box calculation processing described later in FIG.
そして、CPU144は、平文メッセージ119の出力メッセージ(暗号文)をデータ127として入出力インタフェース130から出力する。データ127は、ネットワーク126を介してコンピュータB 145へ転送される。
Then, the
次に、コンピュータB 145が、暗号化されたメッセージであるデータ127を復号する場合の動作について図1を用いて説明する。
Next, the operation when the
コンピュータB 145のCPU157は、入出力インタフェース156を介して、コンピュータA 114によって暗号化されたメッセージをデータ101として入力を受け付ける。
The
次に、CPU157は、RAM146に格納されている秘密鍵Key148、補助情報IV(149)を取得する。補助情報IV(149)は、復号処理プログラムPROG3(147)としてブロック暗号を利用している場合は、カウンターモードのような暗号利用モードの初期値であり、復号処理プログラムPROG3 (147)としてストリーム暗号を利用している場合は、ストリーム暗号の初期値である。
Next, the
CPU157は、受け取った秘密鍵Key148、補助情報IV(149)を用いて、暗号化されたメッセージの復号処理を行う。
The
以後、復号処理プログラムPROG3(147)として利用する暗号方式は非線形関数S−boxを構成要素にもつとする。また、非線形関数S−boxはS−box処理プログラムPROG2(120)として実現されているとする。復号処理も図3で後記するS−box計算処理を含む。 Hereinafter, it is assumed that the encryption method used as the decryption processing program PROG3 (147) has a nonlinear function S-box as a component. Further, it is assumed that the nonlinear function S-box is realized as the S-box processing program PROG2 (120). Decoding processing also includes S-box calculation processing described later in FIG.
コンピュータB 145は、CPU157で復号されたデータを、入出力インタフェース156を介して、ディスプレイ152などから出力メッセージとしての復号メッセージを出力する。
The
(S−box計算処理)
次に、図2を参照しつつ、S−box計算処理について詳細に説明する。
(S-box calculation process)
Next, the S-box calculation process will be described in detail with reference to FIG.
まず、上述した限定された種類の置換である基本多項式写像、triangular 多項式写像、及び可逆なアフィン多項式写像について説明する。基本多項式写像、triangular 多項式写像、及び可逆なアフィン多項式写像は、逆関数が効率的に求められるような多項式写像として知られている。以下、kを体とする。 First, basic polynomial mapping, triangular polynomial mapping, and reversible affine polynomial mapping, which are the limited types of permutations described above, will be described. Basic polynomial maps, triangular polynomial maps, and reversible affine polynomial maps are known as polynomial maps for which an inverse function is efficiently obtained. Hereinafter, k is a body.
これらの多項式写像は、変換の対象を、処理前、又は最中に限定した変換処理が行える特徴を有するので、少ないレジスタでS−boxの計算処理を行うことができる。 Since these polynomial maps have a feature that the conversion target can be converted before or during the conversion, the S-box calculation processing can be performed with a small number of registers.
F=(F1, … Fn)がk上の基本多項式写像であるとは、多項式写像Fが
F(x1,…,xn)=(x1,…,xi−1,xi+f(x1,…,xi−1,xi+1,…,xn),xi+1,…,xn) (数4)
f∈k[x1,…,xi−1,xi+1,…,xn] (数5)
なる形となる多項式写像である。
F = (F 1 ,... F n ) is a basic polynomial mapping on k. A polynomial mapping F is F (x 1 ,..., X n ) = (x 1 ,..., X i−1 , x i + F (x 1 , ..., x i−1 , x i + 1 , ..., x n ), x i + 1 , ..., x n ) (Equation 4)
fεk [x 1 , ..., x i−1 , x i + 1 , ..., x n ] (Formula 5)
This is a polynomial mapping that has the form
G=(G1,…Gn)がk上のtriangular 多項式であるとは、多項式写像Gが
G(x1,…,xn)=(a1x1+f1(x2,…,xn), a2x2+f2(x3,…,xn),…,anxn+fn) (数6)
fi∈k[xi+1,…,xn](i=1,…,n−1), fn∈k, ai∈k(i=1,…,n) (数7)
なる形となる多項式写像である。
G = (G 1 ,... G n ) is a triangular polynomial on k. The polynomial mapping G is G (x 1 ,..., X n ) = (a 1 x 1 + f 1 (x 2 ,..., X n), a 2 x 2 + f 2 (x 3, ..., x n), ..., a n x n + f n) ( 6)
f i εk [x i + 1 ,..., x n ] (i = 1,..., n−1), f n εk, a i εk (i = 1,..., n) (Equation 7)
This is a polynomial mapping that has the form
H= (H1,…Hn )がk上の可逆なアフィン多項式写像であるとは、多項式写像Hが
H(x1,…,xn)=(Σj=1 na1,jxj+b1, Σj=1 na2,jxj+b2 ,…, Σj=1 nan,jxj+bn) (数8)
なる形となる多項式写像である。但し、行列A={ai,j}1≦i,j≦nは可逆な行列である。本実施例では、体k = GF(2) = {0, 1}のとき、GF(2)の元aを自然にビットとみなす。例えば、a = 0であれば、aを自然に1ビット0とみなし、a=1であれば、aを自然に1ビット1とみなす。
H = (H 1 ,... H n ) is a reversible affine polynomial map on k. The polynomial map H is H (x 1 ,..., X n ) = (Σ j = 1 n a 1, j x j + b 1 , Σ j = 1 n a 2, j x j + b 2 ,..., Σ j = 1 n a n, j x j + b n ) (Equation 8)
This is a polynomial mapping that has the form However, the matrix A = {a i, j } 1 ≦ i, j ≦ n is a reversible matrix. In the present embodiment, when the field k = GF (2) = {0, 1}, the element a of GF (2) is regarded as a bit naturally. For example, if a = 0, a is regarded as 1 bit 0 naturally, and if a = 1, a is regarded as 1
次に、k = GF(2)として、基本多項式写像、triangular 多項式写像、及び可逆なアフィン多項式写像が余剰レジスタ1本で計算できることを図5、図6、及び図7を用いて説明する。 Next, it will be described with reference to FIGS. 5, 6, and 7 that a basic polynomial map, a triangular polynomial map, and a reversible affine polynomial map can be calculated with one extra register as k = GF (2).
ここで、以下の各多項式写像におけるレジスタ操作の原則を説明する。( )は図中の具体例を示す。
(1)写像後も元のデータをそのまま使うデータは、当該レジスタに残しておく。(図5のx1、x3、x4)
(2)他のデータとの演算によって変更されるが、元のデータをそのまま使わない場合は、演算結果を元のデータが格納されていたレジスタに格納する。(図5のx2、図6のx1、図7のx2)
(3)他のデータとの演算によって変更されるが、元のデータを他の演算でも使う場合は、他のデータとの演算の前に元のデータを余剰レジスタに一時的に退避する。(図7のx1)
(4)元のデータが格納されていたレジスタに演算結果(または中間データ)を格納(加算等も含む)できない場合は、演算結果を余剰レジスタに一時的に格納する。(図5のx3x4、図6のx2x4、図7のx1+x4)
(5)(ア)他のデータとの演算によって変更されるが、(イ)元のデータを他の演算でも使う場合は、(イ)を行ってから(ア)を行う。(図6のx3)
以上の原則をまとめると、元のデータを使った演算の後で、他のデータとの演算によって元のデータが変更される演算を行い、後の演算で使用するデータ(元のデータ又は演算結果)を格納すべきレジスタがない場合は、余剰レジスタに退避する。
Here, the principle of register operation in each of the following polynomial maps will be described. () Shows a specific example in the figure.
(1) Data that uses the original data as it is after mapping is left in the register. (X 1 , x 3 , x 4 in FIG. 5)
(2) If the original data is not used as it is, but the original data is not changed as it is, the result of the operation is stored in the register where the original data was stored. (X 2 in FIG. 5, x 1 in FIG. 6, x 2 of FIG. 7)
(3) Although it is changed by an operation with other data, when the original data is used in another operation, the original data is temporarily saved in a surplus register before the operation with the other data. (X 1 in FIG. 7)
(4) If the operation result (or intermediate data) cannot be stored (including addition) in the register in which the original data was stored, the operation result is temporarily stored in the surplus register. (X 3 x 4 in FIG. 5, x 2 x 4 in FIG. 6, x 1 + x 4 in FIG. 7)
(5) (a) It is changed by calculation with other data. (B) When the original data is used in other calculation, (a) is performed after (a) is performed. (X 3 in FIG. 6)
Summarizing the above principles, after the calculation using the original data, the calculation that changes the original data by the calculation with the other data, the data used in the subsequent calculation (original data or calculation result) ) Is stored in a surplus register.
(基本多項式写像)
図5は基本多項式写像の計算処理を説明するための図である。ここでは、CPU144は、5本以上のレジスタを具備しているものとし、そのうちの4本のレジスタをreg.1、…、reg.4、残りの1本のレジスタをreg.tmpとする。そして、レジスタreg.1、…、reg.4を入出力レジスタ208とし、レジスタreg.tmpを余剰レジスタ207とする。上記4本のレジスタreg.1、…、reg.4にはそれぞれ、値としてx1、x2、x3、x4が格納されているとする。そして、余剰レジスタreg.tmpには適当な値tが格納されているとする。
(Basic polynomial mapping)
FIG. 5 is a diagram for explaining the calculation processing of the basic polynomial mapping. Here, it is assumed that the
まずCPU144はRAM115に格納されているS−box処理プログラムPROG2(120)を読み込む。ここでは、S−box処理プログラムPROG2(120)の中に基本多項式写像FとしてF(x1,…,x4)=(x1,x2+x3+x3x4,x3,x4)が格納されているものとする。
First, the
このとき、図5の(1)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2、x3、x4、tが格納されている。CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.2とreg.3の値の排他的論理和を計算し、その結果をreg.2に格納する。このとき、図5の(2)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2+x3、x3、x4、tが格納されている。次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタ3とレジスタ4の値の論理積を計算し、その結果をreg.tmpに格納する。このとき、図5の(3)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2+x3、x3、x4、x3x4が格納されている。
At this time, x 1 , x 2 , x 3 , x 4 , and t are stored in the registers reg.1,..., Reg.4, and reg.tmp at the timing of (1) in FIG. The
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタreg.2とreg.tmpの値の排他的論理和を計算し、その結果をreg.2に格納する。このとき、図5の(4)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2+ x3+x3x4、x3、x4、x3x4が格納されており、上記の基本多項式写像Fが計算できたことになる。
Next, the
一般に、基本多項式写像は数4の形をしており、数4よりn本の入出力レジスタのうち、i番目のレジスタreg.i以外のn−1本のレジスタreg.1、…、reg.i−1、reg.i+1、…、reg.nの値は変更しない。そして、i番目のレジスタreg.iの値のみを変更する。このとき、数4の右辺にあるf(x1,…,xi−1,xi+1,…,xn)を単項式の和の形に変形すると、上記各単項式は、レジスタi以外のn−1本のレジスタreg.1、…、reg.i−1、reg.i+1、…、reg.nに格納されている値を用い、逐次的に計算可能である。このとき、上記逐次的な計算における中間値を余剰レジスタreg.tmpに格納することによって、f(x1,…,xi−1,xi+1,…,xn)の値を余剰レジスタreg.tmpに格納するように計算することができる。その後、余剰レジスタreg.tmpの値とi番目のレジスタreg.iの値の排他的論理和を計算し、その結果をi番目のレジスタreg.iに格納することによって、GF(2)上の基本多項式写像は、n本の入出力レジスタと1本の余剰レジスタのみを用いて計算できる。
In general, the basic polynomial mapping has the form of
(triangular 多項式写像)
図6はtriangular 多項式写像の計算処理を説明するための図である。図5の説明と同様、CPU144は、5本以上のレジスタを具備しているものとし、そのうちの4本のレジスタをreg.1、…、reg.4、残りの1本のレジスタをreg.tmpとする。そして、レジスタreg.1、…、reg.4を入出力レジスタ208とし、レジスタreg.tmpを余剰レジスタ207とする。上記4本のレジスタreg.1、…、reg.4にはそれぞれ、値としてx1、x2、x3、x4が格納されているとする。そして、余剰レジスタreg.tmpには適当な値tが格納されているとする。
(Triangular polynomial mapping)
FIG. 6 is a diagram for explaining calculation processing of a triangular polynomial map. As in the description of FIG. 5, the
まずCPU144はRAM115に格納されているS−box処理プログラムPROG2(120)を読み込む。ここでは、S−box処理プログラムPROG2(120)の中にtriangular 多項式写像GとしてG(x1,…,x4)=(x1+x2+x2x4,x2+x3+x3x4,x3+x4,x4+1)が格納されているものとする。このとき、図6の(1)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2、x3、x4、tが格納されている。CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.1とreg.2の値の排他的論理和を計算し、その結果をreg.1に格納する。このとき、図6の(2)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2、x2、x3、x4、tが格納されている。
First, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタ2とレジスタ4の値の論理積を計算し、その結果をreg.tmpに格納する。このとき、図6の(3)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2、x2、x3、x4、x2x4が格納されている。次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタreg.1とreg.tmpの値の排他的論理和を計算し、その結果をreg.1に格納する。このとき、図6の(4)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2+x2x4、x2、x3、x4、x2x4が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.2とreg.3の値の排他的論理和を計算し、その結果をreg.2に格納する。このとき、図6の(5)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+ x2+x2x4、x2+x3、x3、x4、x2x4が格納されている。次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.3とreg.4の値の論理積を計算し、その結果をreg.tmpに格納する。このとき、図6の(6)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2+x2x4、x2+x3、x3、x4、x3x4が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.2とreg.tmpの値の排他的論理和を計算し、その結果をreg.2に格納する。このとき、図6の(7)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2+x2x4、x2+x3+x3x4、x3、x4、x3x4が格納されている。次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.3とreg.4の値の排他的論理和を計算し、その結果をreg.3に格納する。このとき、図6の(8)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2+x2x4、x2+x3+x3x4、x3+x4、x4、x3x4が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.4と定数1の値の排他的論理和を計算し、その結果をreg.4に格納する。この演算は、レジスタに格納されている値の否定演算子を用いることで実現できるため、上述したレジスタreg.1、…、reg.4、reg.tmp以外のレジスタは使用しない。このとき、図6の(9)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x2+x2x4、x2+x3+x3x4、x3+x4、x4+1、x3x4が格納されており、上記のtriangular 多項式写像Gが計算できたことになる。
Next, the
一般に、triangular 多項式写像は数6の形をしており、数6よりi番目のレジスタreg.iの値は、i+1番目以降のレジスタreg.i+1、…、reg.nの値を用いて変更する。このとき、上述した図5の説明と同様の理由により、i番目のレジスタreg.iの値は、n−i本のレジスタreg.i+1、…、reg.nの値と1本の余剰レジスタのみを用いて計算することができる。この操作をiが1からnまで逐次的に処理することによって、GF(2)上のtriangular 多項式写像はn本の入出力レジスタと1本の余剰レジスタのみを用いて計算できる。 In general, the triangular polynomial mapping has the form of Expression 6, and the value of the i-th register reg.i from Expression 6 is changed using the values of the registers reg.i + 1,..., Reg.n after i + 1. . At this time, for the same reason as described above with reference to FIG. 5, the value of the i-th register reg.i is the value of n−i registers reg.i + 1,..., Reg.n and only one extra register. Can be used to calculate. By sequentially processing this operation from 1 to n, a triangular polynomial map on GF (2) can be calculated using only n input / output registers and one extra register.
(可逆なアフィン多項式写像)
図7は可逆なアフィン多項式写像の計算処理を説明するための図である。図5、及び図6の説明と同様、CPU144は、5本以上のレジスタを具備しているものとし、そのうちの4本のレジスタをreg.1、…、reg.4、残りの1本のレジスタをreg.tmpとする。そして、レジスタreg.1、…、reg.4を入出レジスタ208、レジスタreg.tmpを余剰レジスタ207とする。上記4本のレジスタreg.1、…、reg.4にはそれぞれ、値としてx1、x2、x3、x4が格納されているとする。そして、余剰レジスタreg.tmpには適当な値tが格納されているとする。
(Reversible affine polynomial mapping)
FIG. 7 is a diagram for explaining a calculation process of a reversible affine polynomial map. As in the description of FIGS. 5 and 6, the
まずCPU144はRAM115に格納されているS−box処理プログラムPROG2(120)を読み込む。ここでは、S−box処理プログラムPROG2(120)の中に可逆なアフィン多項式写像HとしてH(x1,…,x4)=(x1+x3,x2+x4,x1+x4,x3)が格納されているものとする。
First, the
このとき、図7の(1)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2、x3、x4、tが格納されている。CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.1の値をreg.tmpに格納する。このとき、図7の(2)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1、x2、x3、x4、x1が格納されている。
At this time, x 1 , x 2 , x 3 , x 4 , and t are stored in the registers reg.1,..., Reg.4, and reg.tmp at the timing of (1) in FIG. The
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタ1とレジスタ3の値の排他的論理和を計算し、その結果をreg.1に格納する。このとき、図7の8(3)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x3、x2、x3、x4、x1が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、レジスタreg.2とreg.4の値の排他的論理和を計算し、その結果をreg.2に格納する。このとき、図7の(4)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x3、x2+x4、x3、x4、x1が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.4とreg.tmpの値の排他的論理和を計算し、その結果をreg.tmpに格納する。このとき、図7の(5)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1+x3、x2+x4、x3、x4、x1+x4が格納されている。
Next, the
次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.3の値をreg.4に格納する。このとき、図7の(6)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1 + x3、x2 + x4、x3、x3、x1 + x4が格納されている。次に、CPU144は、S−box処理プログラムPROG2(120)を読み込み、reg.tmpの値をreg.3に格納する。このとき、図7の(7)のタイミングでレジスタreg.1、…、reg.4、reg.tmpにはそれぞれx1 + x3、x2 + x4、x1 + x4、x3、x1 + x4が格納されており、上記の可逆なアフィン多項式写像Hが計算できたことになる。
Next, the
一般に、可逆なアフィン多項式写像は数8の形をしており、入力x1、…、xn の縦ベクトルt(x1, …, xn)(左肩のtはベクトルの転置を表す)に対するアフィン変換(線型変換+定数の加算)とみなすことができる。線型変換は、ある行列を施したものとみなすことができ、特に正則行列(可逆な行列)は6つの基本変形の積で表される。ここで、6つの基本変形とは、以下の操作である。
1.行列の第i行と第j行を入れ替える。
2.行列の第i行に非零定数cをかける。
3.行列の第i行に第j行の非零定数倍を加える。
4.行列の第i列と第j列を入れ替える。
5.行列の第i列に非零定数cをかける。
6.行列の第i列に第j列の非零定数倍を加える。
In general, the reversible affine polynomial mapping has the form of number 8, and for input x 1 ,…, x n longitudinal vector t (x 1 ,…, x n ) (left shoulder t represents vector transpose) It can be regarded as affine transformation (linear transformation + addition of a constant). The linear transformation can be regarded as having been subjected to a certain matrix. In particular, a regular matrix (reversible matrix) is represented by a product of six basic deformations. Here, the six basic deformations are the following operations.
1. Swap the i-th row and j-th row of the matrix.
2. Multiply i-th row of matrix by non-zero constant c.
3. Add the non-zero constant multiple of j-th row to the i-th row of the matrix.
4). Swap the i-th column and j-th column of the matrix.
5. Multiplies the i-th column of the matrix by a non-zero constant c.
6). Add the non-zero constant multiple of the jth column to the ith column of the matrix.
上述した図5、図6の説明と同様の理由により、上記6つの各基本変形は、n本の入出力レジスタと1本の余剰レジスタのみを用いて計算することができる。したがって、正則行列による線型変換もn本の入出力レジスタと1本の余剰レジスタのみを用いて計算することができるから、GF(2)上の可逆なアフィン多項式写像はn本の入出力レジスタと1本の余剰レジスタのみを用いて計算することができる。 For the same reason as described above with reference to FIGS. 5 and 6, each of the six basic variations can be calculated using only n input / output registers and one extra register. Therefore, a linear transformation using a regular matrix can also be calculated using only n input / output registers and one extra register, so a reversible affine polynomial mapping on GF (2) is obtained with n input / output registers. Calculations can be made using only one extra register.
アフィン多項式写像全体の集合、triangular 多項式写像全体の集合、及び基本多項式写像全体の集合はそれぞれ可逆な多項式写像の部分群となることが知られており、それらの集合をそれぞれAff(k, n)、J(k, n)、及びE(k, n)と表すことにする。 It is known that the set of all affine polynomial maps, the set of all triangular polynomial maps, and the set of all basic polynomial maps are subgroups of reversible polynomial maps, and each of these sets is called Aff (k, n) , J (k, n), and E (k, n).
上記Aff(k, n)、及びE(k, n)の全ての元で生成される可逆な多項式写像の部分群はtame 多項式写像の部分群と呼ばれている(非特許文献2参照)。tame 多項式写像の部分群の元はtame 多項式写像と呼ばれている。 The subgroup of the reversible polynomial mapping generated by all the elements of Aff (k, n) and E (k, n) is called the tame polynomial mapping subgroup (see Non-Patent Document 2). The element of the subgroup of the tame polynomial map is called the tame polynomial map.
また、上記Aff(k, n)、及びJ(k, n)の全ての元で生成される可逆な多項式写像の部分群と上記Aff(k, n)、及びE(k, n)の全ての元で生成される可逆な多項式写像の部分群が一致すること、およびJ(k, n)の元がE(k, n)のn個の元とAff(k, n)の1個の元の合成の形で表すことができること、も知られている(非特許文献2参照)。 Also, a subgroup of reversible polynomial maps generated from all elements of Aff (k, n) and J (k, n) and all of Aff (k, n) and E (k, n). The subgroups of the reversible polynomial maps generated by the elements of, and the elements of J (k, n) are n elements of E (k, n) and one of Aff (k, n) It is also known that it can be expressed in the original synthetic form (see Non-Patent Document 2).
一般に、多項式写像が上記の合成の形に表すことができるか否かを判定することは困難であるが、多項式写像を置換とみなしたとき、体kが有限体GF(2)であれば上記の合成の形に分解できることは知られている(非特許文献3参照)。 In general, it is difficult to determine whether a polynomial map can be represented in the above composite form, but when the polynomial map is regarded as a permutation, if the field k is a finite field GF (2), then the above It is known that it can be decomposed into a synthetic form (see Non-Patent Document 3).
図3は、第一の実施形態に係るS−box計算の流れを示すフローチャートである。 FIG. 3 is a flowchart showing the flow of S-box calculation according to the first embodiment.
まず、CPU144がnビットデータa1, …anの入力を、プログラム読み込み部204が多項式写像F1, … FLの入力を、それぞれ受け付ける(ステップ301)。
First,
ここで、多項式写像F1, …FLは有限体GF(2)上のn変数多項式写像であり、Lは多項式写像F1, …FLの個数であり、nビット列{0, 1}n上で全単射であるとする。また、多項式写像F1, …FLは、暗号化処理プログラムPROG1(116)で利用している暗号アルゴリズムに依存しており、F1, …FLを写像として合成した多項式写像は、S−boxを表現する有限体GF(2)上のn変数多項式写像と一致するものとし、多項式写像F1, …FLはプログラムとして実現する前に、予め計算されているものとする。 Here, the polynomial map F 1 ,… F L is an n-variable polynomial map on the finite field GF (2), L is the number of polynomial maps F 1 ,… F L , and an n-bit string {0, 1} n Let's say it's bijective. Further, the polynomial mapping F 1, ... F L is dependent on the encryption algorithm which is utilized in the encryption processing program PROG1 (116), F 1, synthesized polynomial mapping ... F L as mapping, S- It is assumed that it matches the n-variable polynomial mapping on the finite field GF (2) representing the box, and that the polynomial mappings F 1 ,... FL are calculated in advance before being realized as a program.
ここで、多項式写像の各多項式は多項式環GF(2)[x1,…xn]ではなく、GF(2)[x1,…xn]/(x1 2 −x1,…xn 2 − xn)の元とみなす。ここで、GF(2)[ x1,…xn]の元ではなくGF(2)[ x1,…xn]の剰余環の元とみなす、とは、環GF(2)[ x1,…xn]のイデアル(x1 2 − x1,…xn 2 − xn)の要素を含むGF(2)[ x1,…xn]の多項式は同値とみなすことであり、この剰余環を考えることにより、各多項式写像F1,…FLの各単項式は、xi m (mは2以上の整数)を含まないため、「S−box処理プログラム120のプログラムサイズが小さくなる」、「xi m (mは2以上の整数)の計算を行わないため、もともとの多項式環で考えるより、多項式写像への代入計算が高速になる」という効果がある。
Here, each polynomial in the polynomial mapping is not a polynomial ring GF (2) [x 1 , ... x n ], but GF (2) [x 1 , ... x n ] / (x 1 2 −x 1 , ... x n 2 − x n ) Here, GF (2) [x 1, ... x n] rather than the former GF (2) [x 1, ... x n] is regarded as the original residue ring of, and the ring GF (2) [x 1 ,… X n ], the polynomials of GF (2) [x 1 ,… x n ] containing elements of the ideal (x 1 2 − x 1 ,… x n 2 −x n ) are to be regarded as equivalent. By considering the remainder ring, each monomial of each polynomial map F 1 ,... F L does not include x i m (m is an integer of 2 or more), so “the program size of the S-
次に、繰り返し判定部205は、iに1を代入する(ステップ302)。
Next, the
繰り返し判定部205は、iが多項式写像の個数L以下であるか否かを判定する(ステップ303)。
The
ステップ303の結果、i≦Lが成立する場合(ステップ303→Yes)、ステップ304へ行く。i≦Lが成立しない場合(ステップ303→No)、ステップ310へ行く。
As a result of
多項式写像所属判定部206は、多項式写像Fiが可逆なアフィン多項式写像である(Fi∈Aff(k,n))か否かを判定する(ステップ304)。ステップ304の結果、Fi∈Aff(k,n)が成立する場合(ステップ304→Yes)、ステップ305へ行く。Fi∈Aff(k,n)が成立しない場合(ステップ304→No)、ステップ306へ行く。
The polynomial mapping
アフィン多項式写像計算部201は、図7に示した方法によって、各j(j =1,…n)に対して、余剰レジスタ207と入出力レジスタ208を用いてFj (a1,…an)を計算し、aj に代入する(ステップ305)。
Affine polynomial
多項式写像所属判定部206は、多項式写像Fiが基本多項式写像である(Fi∈E(k,n))か否かを判定する(ステップ306)。ステップ306の結果、Fi∈E(k,n)が成立する場合(ステップ306→Yes)、ステップ307へ行く。Fi∈E(k,n)が成立しない場合(ステップ306→No)、ステップ308へ行く。
The polynomial mapping
基本多項式写像計算部202は、図5に示した方法によって、各j(j =1,…n)に対して、余剰レジスタ207と入出力レジスタ208を用いてFj (a1,…an)を計算し、aj に代入する(ステップ307)。
Basic polynomial
triangular多項式写像計算部203は、図6に示した方法によって、各j(j =1,…n)に対して、余剰レジスタ207と入出力レジスタ208を用いてFj (a1,…an)を計算し、aj に代入する(ステップ308)。各aj に対する代入操作は並列的に行われる。
triangular polynomial
繰り返し判定部205は、iにi+1を代入する(ステップ309)。
The
CPU144はnビットデータa1, anを出力する(ステップ310)。
The
以上説明したように、CPU144から出力されるnビットデータa1,…anは、余剰レジスタ207の1本のレジスタと入出力レジスタ208を用いて計算できる。この理由は図5〜図7の説明で述べた通りである。
As described above, n bit data a 1 output from the
なお、本実施形態では、可逆なアフィン多項式写像、基本多項式写像、及びtriangular多項式写像を、1本の余剰レジスタと入出力レジスタで計算可能なことを示したが、上記多項式写像を、2本以上の余剰レジスタと入出力レジスタで計算してもよい。 In the present embodiment, it has been shown that reversible affine polynomial mapping, basic polynomial mapping, and triangular polynomial mapping can be calculated by one extra register and input / output register. The calculation may be performed using the surplus register and the input / output register.
一般に、多項式写像を、アフィン多項式写像、基本多項式写像、及びtriangular多項式写像の合成の形で表現する方法は一意的ではないが、どのような合成の形であってもよい。 In general, a method of expressing a polynomial map in the form of a combination of an affine polynomial map, a basic polynomial map, and a triangular polynomial map is not unique, but any combination may be used.
(第一実施形態の効果)
以上のように、第一実施形態のS−box計算方法によれば、1本の余剰レジスタと入出力レジスタを用いてS−boxを計算することが可能となる。すなわち、本実施形態によれば、どのような暗号アルゴリズムであっても、少ない本数の余剰レジスタを用いた共通鍵暗号のソフトウェア実装が可能になる。
(第二実施形態)
次に、図1から図4を参照して、本発明に係る第二の実施形態について説明する。第一の実施形態では、ブロック暗号、ストリーム暗号、暗号学的ハッシュ関数などの一般的な共通鍵暗号のソフトウェア実装において、少ない余剰レジスタと入出力レジスタを用いたS−boxの計算方法を説明したが、第二の実施形態では、具体的な共通鍵暗号アルゴリズムに対して、少ない余剰レジスタと入出力レジスタを用いてS−boxを計算する方法を説明する。
(Effects of the first embodiment)
As described above, according to the S-box calculation method of the first embodiment, it is possible to calculate an S-box using one surplus register and an input / output register. That is, according to the present embodiment, software implementation of common key cryptography using a small number of surplus registers is possible regardless of any cryptographic algorithm.
(Second embodiment)
Next, a second embodiment according to the present invention will be described with reference to FIGS. In the first embodiment, the S-box calculation method using a small number of surplus registers and input / output registers in the software implementation of common common key cryptography such as block cipher, stream cipher, and cryptographic hash function has been described. However, in the second embodiment, a method for calculating an S-box using a small number of surplus registers and input / output registers for a specific common key encryption algorithm will be described.
本実施形態では、具体的な共通鍵暗号アルゴリズムとして、ストリーム暗号向けの疑似乱数生成器Enocoro−128v2を用いて説明する。なお、疑似乱数生成器Enocoro−128v2については、例えば、非特許文献6に記載されている。 In the present embodiment, description will be made using a pseudo-random number generator Enocoro-128v2 for stream cipher as a specific common key encryption algorithm. The pseudorandom number generator Enocoro-128v2 is described in Non-Patent Document 6, for example.
第二の実施形態において、第一の実施形態と異なるのは、図1の暗号化処理プログラムPROG1 116、図1のS−box処理プログラムPROG2 (120)に格納されている多項式写像F1, …FL、図1の復号処理プログラムPROG3 (147)、図1のS−box処理プログラムPROG4 (151)に格納されている多項式写像G1, …GLであるため、ここではこれらの説明を記載し、それ以外の構成および処理は図示および説明を省略することとする。つまり、第一の実施形態では、具体的な暗号アルゴリズムは明記せず、どのような暗号アルゴリズムのS−box (ただし、全単射)であっても、入出力レジスタと1本の余剰レジスタで計算可能であることを述べたが、第二の実施形態では、例として、具体的な暗号アルゴリズムについて、第一の実施形態で記述した内容を、どのように実現するか、について述べている。
The second embodiment differs from the first embodiment in that the polynomial mapping F 1 ,... Stored in the encryption
第二の実施形態では、図1の暗号化処理プログラムPROG1 (116)および図1の復号処理プログラムPROG3 (147)にはストリーム暗号Enocoro−128v2のプログラムが格納されている。 In the second embodiment, the encryption processing program PROG1 (116) in FIG. 1 and the decryption processing program PROG3 (147) in FIG. 1 store a stream cipher Enocoro-128v2.
さらに、図1のS−box処理プログラムPROG2 (120)に格納されている多項式写像F1, …FLについては、L = 27であり、各i(1≦i≦L)に対し、図1のS−box処理プログラムPROG2 120に格納されている多項式写像F1,…F27は、図4に示すとおりとする。また、図1のS−box処理プログラムPROG4 151に格納されている多項式写像G1,…G27については、Fi=Giである。
Further, for the polynomial maps F 1 ,... F L stored in the S-box processing program PROG2 (120) of FIG. 1, L = 27, and for each i (1 ≦ i ≦ L), FIG. The polynomial maps F 1 ,... F 27 stored in the S-box
なお、図4に示す多項式写像F1,…F27に対し、多項式写像F2i−1(1≦i≦14)は可逆なアフィン多項式写像であり、多項式写像F2i(1≦i≦13)はtriangular多項式写像または基本多項式写像である。 Note that the polynomial map F 2i−1 (1 ≦ i ≦ 14) is a reversible affine polynomial map and the polynomial map F 2i (1 ≦ i ≦ 13) with respect to the polynomial map F 1 ,... F 27 shown in FIG. Is a triangular polynomial map or a basic polynomial map.
CPU144が、S−box処理プログラム120から図4に記載の多項式写像F1,…F27を読み込み、入出力レジスタ207に格納されているnビットデータa1,…an、及び上記の読み込んだ多項式写像F1,…F27によってS−boxの変換を行う処理を説明する。
CPU144 is, the polynomial mapping F 1 according the S-
この計算は、図3に示すフローチャートを用いて計算を行う。 This calculation is performed using the flowchart shown in FIG.
図4に示した各多項式写像は、基本多項式写像、triangular 多項式写像、又は可逆なアフィン多項式写像の何れかであり、第一の実施形態で説明したように、図5〜図7に示した方法で計算を行うことにより、入出力レジスタ207に格納されているnビットデータa1, … anから基本多項式写像、triangular 多項式写像、可逆なアフィン多項式写像の値を計算できる。
Each polynomial map shown in FIG. 4 is one of a basic polynomial map, a triangular polynomial map, or a reversible affine polynomial map. As described in the first embodiment, the method shown in FIGS. in by performing calculations, n-bit data a 1 stored in the
CPU144から出力されるnビットデータa1,…anは、余剰レジスタ207の1本のレジスタと入出力レジスタ208を用いて計算できる。この理由は第一の実施形態と同様である。
N-bit data a 1 output from the
なお、本実施形態では、第一の実施形態と同様、可逆なアフィン多項式写像、基本多項式写像、及びtriangular多項式写像を、1本の余剰レジスタと入出力レジスタで計算可能であるが、上記多項式写像を、2本以上の余剰レジスタと入出力レジスタで計算してもよいことは第一の実施形態と同様である。 In this embodiment, as in the first embodiment, a reversible affine polynomial map, basic polynomial map, and triangular polynomial map can be calculated with one extra register and input / output register. As with the first embodiment, it may be calculated with two or more surplus registers and input / output registers.
一般に、多項式写像を、アフィン多項式写像、基本多項式写像、及びtriangular多項式写像の合成の形で表現する方法は一意的ではないが、どのような合成の形であってもよいことは第一の実施形態と同様である。 In general, the method of expressing a polynomial map in the form of a composition of an affine polynomial map, a basic polynomial map, and a triangular polynomial map is not unique, but it is the first implementation that any composition form may be used. It is the same as the form.
(第二実施形態の効果)
第一の実施形態と同様に、第二実施形態のS−box計算方法によれば、1本の余剰レジスタと入出力レジスタを用いてS−boxを計算することが可能となる。すなわち、本実施形態によれば、少ない本数の余剰レジスタを用いたストリーム暗号Enocoro−128v2のソフトウェア実装が可能になる。
(Effect of the second embodiment)
Similar to the first embodiment, according to the S-box calculation method of the second embodiment, it is possible to calculate an S-box using one surplus register and an input / output register. That is, according to the present embodiment, software implementation of the stream cipher Enocoro-128v2 using a small number of surplus registers becomes possible.
なお、上記の各実施形態では、暗号通信システムとして説明し、暗号化プログラムはブロック暗号、ストリーム暗号として説明したが、認証システムとし、
暗号化プログラムをハッシュ関数プログラムとしてもよい。
In each of the above embodiments, the encryption communication system is described, and the encryption program is described as a block cipher and a stream cipher.
The encryption program may be a hash function program.
101:データ、114:コンピュータA、115:RAM、116:暗号化処理プログラムPROG1、117:秘密鍵Key、118:補助情報IV、119:平文M、120:S−box処理プログラムPROG2、124:ディスプレイ、125:キーボード、126:ネットワーク、127:データ、130:入出力インタフェース、144:CPU、145:コンピュータB、146:RAM、147:復号処理プログラムPROG3、148:秘密鍵Key、149:補助情報IV、150:平文M、151:S−box処理プログラムPROG4、152:ディスプレイ、153:キーボード、156:入出力インタフェース、157:CPU 101: Data, 114: Computer A, 115: RAM, 116: Encryption processing program PROG1, 117: Secret key Key, 118: Auxiliary information IV, 119: Plain text M, 120: S-box processing program PROG2, 124: Display , 125: keyboard, 126: network, 127: data, 130: input / output interface, 144: CPU, 145: computer B, 146: RAM, 147: decryption processing program PROG3, 148: secret key Key, 149: auxiliary information IV , 150: plaintext M, 151: S-box processing program PROG4, 152: display, 153: keyboard, 156: input / output interface, 157: CPU
Claims (11)
予め定められた順序に従って合成すると入出力がn-bitの置換であるS-boxを表現する、予め定められた個数の多項式写像を前記記憶部に格納し、
前記CPUが備えるn本の入出力用レジスタの各々に格納されているn-bitデータ、及び前記記憶部に格納された多項式写像に基づいて前記S-boxを計算する際に、
前記n-bitデータから有限体GF(2)上のn次元線形空間GF(2)nの元である第一の数値列に変換する第一のステップと、
前記入出力用レジスタに格納されている前記第一の数値列を、前記入出力用レジスタとは異なるレジスタ、及び前記予め定められた多項式写像を用いて、第二の数値列に変換する第二のステップと、
前記第二のステップを、前記多項式写像の個数回だけ繰り返す第三のステップと、を実行することを特徴とする非線形関数S-box計算方法。 A processing device having a CPU and a storage unit is a method of calculating a nonlinear function S-box for encrypting plaintext data or decrypting ciphertext data,
When combined according to a predetermined order, a predetermined number of polynomial mappings representing an S-box whose input and output are n-bit permutations are stored in the storage unit,
When calculating the S-box based on the n-bit data stored in each of the n input / output registers provided in the CPU, and the polynomial mapping stored in the storage unit,
A first step of converting the n-bit data into a first numerical sequence that is an element of an n-dimensional linear space GF (2) n on a finite field GF (2);
A second numerical value sequence that is converted into a second numerical value sequence by using the register different from the input / output register and the predetermined polynomial mapping from the first numerical value sequence stored in the input / output register. And the steps
A non-linear function S-box calculation method, wherein the second step is performed by a third step of repeating the polynomial mapping a number of times.
前記第二のステップは、n次元線形空間GF(2)nの元(a1, ..., an)と予め定められた個数の多項式写像F1, ..., FLに対してFi(a1, ..., an)を計算し、(a1, ..., an)にFi(a1, ..., an)を代入する変換を行い、
前記第三のステップは、iが1からnまでの間、Fi(a1, ..., an)を計算し、(a1,...,an)にFi(a1, ..., an)を代入する変換を行った後、iを1増加させて前記処理を繰り返す、
ことを特徴とする請求項1記載の非線形関数S-box計算方法。 The first step is, n-bit data a 1, ..., converted from a n n-dimensional linear space GF (2) n of the original (a 1, ..., a n ) , the
The second step is for n-dimensional linear space GF (2) n elements (a 1 , ..., a n ) and a predetermined number of polynomial maps F 1 , ..., F L F i (a 1, ..., a n) to calculate the, (a 1, ..., a n) F i (a 1, ..., a n) to perform conversion to assign,
The third step, between the i is 1 to n, F i (a 1, ..., a n) to calculate the, (a 1, ..., a n) to F i (a 1 , ..., a n ) are substituted, and i is incremented by 1 and the above process is repeated.
The nonlinear function S-box calculation method according to claim 1.
(1)写像後も元のデータをそのまま使うデータは、当該レジスタに残しておき、
(2)他のデータとの演算によって変更されるが、元のデータをそのまま使わない場合は、演算結果を元のデータが格納されていたレジスタに格納し、
(3)他のデータとの演算によって変更されるが、元のデータを他の演算でも使う場合は、他のデータとの演算の前に元のデータを余剰レジスタに一時的に退避し、
(4)元のデータが格納されていたレジスタに演算結果または中間データを格納又は加算できない場合は、演算結果を余剰レジスタに一時的に格納し、
(5)他のデータとの演算によって変更される前に、元のデータを他の演算で使用する、ことを特徴とする請求項4記載の非線形関数S-box計算方法。 The register operation in the polynomial map is
(1) Data that uses the original data as it is after mapping is left in the register,
(2) If the original data is not used as it is, although it is changed by the operation with other data, store the operation result in the register where the original data was stored,
(3) Although it is changed by an operation with other data, when the original data is used in another operation, the original data is temporarily saved in a surplus register before the operation with the other data,
(4) If the operation result or intermediate data cannot be stored or added to the register in which the original data was stored, the operation result is temporarily stored in the surplus register,
(5) The non-linear function S-box calculation method according to claim 4, wherein the original data is used in another calculation before being changed by the calculation with other data.
予め定められた順序に従って合成すると入出力がn-bitの置換であるS-boxを表現する、予め定められた個数の多項式写像を格納する記憶部、
前記CPUが備えるn本の入出力用レジスタの各々に格納されているn-bitデータ、及び前記記憶部に格納された多項式写像に基づいて前記S-boxを計算する際に、前記n-bitデータから有限体GF(2)上のn次元線形空間GF(2)nの元である第一の数値列に変換する第一の変換手段と、
前記入出力用レジスタに格納されている前記第一の数値列を、前記入出力用レジスタとは異なるレジスタ、及び前記予め定められた多項式写像に基づいて、第二の数値列に変換する第二の変換手段と、
前記第二の変換手段を、前記多項式写像の個数回だけ繰り返す第三の手段と、を備えることを特徴とするS-box計算装置。 An S-box computing device comprising a CPU for encrypting plaintext data or decrypting ciphertext data,
A storage unit for storing a predetermined number of polynomial mappings, which represents an S-box whose input and output are n-bit permutations when synthesized according to a predetermined order;
When calculating the S-box based on the n-bit data stored in each of the n input / output registers provided in the CPU and the polynomial mapping stored in the storage unit, the n-bit A first conversion means for converting data into a first numerical sequence that is an element of an n-dimensional linear space GF (2) n on a finite field GF (2);
A second numerical sequence that converts the first numerical sequence stored in the input / output register into a second numerical sequence based on a register different from the input / output register and the predetermined polynomial mapping; Conversion means,
An S-box calculation apparatus comprising: a third unit that repeats the second conversion unit a number of times of the polynomial mapping.
前記第二の変換手段は、n次元線形空間GF(2)nの元(a1, ..., an)と予め定められた個数の多項式写像F1, ..., FLに対してFi(a1, ..., an)を計算し、(a1, ..., an)にFi(a1, ..., an)を代入する変換を行い、
前記第三の手段は、iが1からnまでの間、Fi(a1, ..., an)を計算し、(a1, ..., an)にFi(a1, ..., an)を代入する変換を行った後iを1増加させる処理を繰り返す、
ことを特徴とする請求項6記載のS-box計算装置。 Said first conversion means, n-bit data a 1, ..., converted from a n n-dimensional linear space GF (2) n of the original (a 1, ..., a n ) , the
The second transform means is for n-dimensional linear space GF (2) n elements (a 1 , ..., a n ) and a predetermined number of polynomial maps F 1 , ..., F L F i (a 1, ..., a n) Te to calculate the, (a 1, ..., a n) F i (a 1, ..., a n) to perform conversion to assign,
It said third means, between the i is 1 to n, F i (a 1, ..., a n) to calculate the, (a 1, ..., a n) to F i (a 1 , ..., a n ) is repeated and the process of increasing i by 1 is repeated.
The S-box calculation apparatus according to claim 6.
(1)写像後も元のデータをそのまま使うデータは、当該レジスタに残しておき、
(2)他のデータとの演算によって変更されるが、元のデータをそのまま使わない場合は、演算結果を元のデータが格納されていたレジスタに格納し、
(3)他のデータとの演算によって変更されるが、元のデータを他の演算でも使う場合は、他のデータとの演算の前に元のデータを余剰レジスタに一時的に退避し、
(4)元のデータが格納されていたレジスタに演算結果または中間データを格納又は加算できない場合は、演算結果を余剰レジスタに一時的に格納し、
(5)他のデータとの演算によって変更される前に、元のデータを他の演算で使用する、ことを特徴とする請求項9記載のS-box計算装置。 The register operation in the polynomial map is
(1) Data that uses the original data as it is after mapping is left in the register,
(2) If the original data is not used as it is, although it is changed by the operation with other data, store the operation result in the register where the original data was stored,
(3) Although it is changed by an operation with other data, when the original data is used in another operation, the original data is temporarily saved in a surplus register before the operation with the other data,
(4) If the operation result or intermediate data cannot be stored or added to the register in which the original data was stored, the operation result is temporarily stored in the surplus register,
(5) The S-box calculation device according to claim 9, wherein the original data is used in another operation before being changed by the operation with other data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012070877A JP2013205437A (en) | 2012-03-27 | 2012-03-27 | Method and apparatus for calculating nonlinear function s-box |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012070877A JP2013205437A (en) | 2012-03-27 | 2012-03-27 | Method and apparatus for calculating nonlinear function s-box |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2013205437A true JP2013205437A (en) | 2013-10-07 |
Family
ID=49524627
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012070877A Pending JP2013205437A (en) | 2012-03-27 | 2012-03-27 | Method and apparatus for calculating nonlinear function s-box |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2013205437A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410490A (en) * | 2014-12-16 | 2015-03-11 | 桂林电子科技大学 | Method for protecting cryptographic S-box (substitution-box) through nonlinear extrusion |
CN108536860A (en) * | 2018-04-18 | 2018-09-14 | 武汉轻工大学 | Encrypting web, decryption method, terminal device and computer readable storage medium |
-
2012
- 2012-03-27 JP JP2012070877A patent/JP2013205437A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104410490A (en) * | 2014-12-16 | 2015-03-11 | 桂林电子科技大学 | Method for protecting cryptographic S-box (substitution-box) through nonlinear extrusion |
CN108536860A (en) * | 2018-04-18 | 2018-09-14 | 武汉轻工大学 | Encrypting web, decryption method, terminal device and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI571091B (en) | Technologies for modifying a first cryptographic cipher with operations of a second cryptographic cipher | |
Muir | A tutorial on white-box AES | |
Iwata et al. | CLOC: authenticated encryption for short input | |
Kitsos et al. | FPGA-based performance analysis of stream ciphers ZUC, Snow3g, Grain V1, Mickey V2, Trivium and E0 | |
US20120170739A1 (en) | Method of diversification of a round function of an encryption algorithm | |
US8675866B2 (en) | Multiplicative splits to protect cipher keys | |
Dolmatov | GOST 28147-89: Encryption, decryption, and message authentication code (MAC) algorithms | |
JP6575532B2 (en) | Encryption device, decryption device, encryption processing system, encryption method, decryption method, encryption program, and decryption program | |
Gouvêa et al. | High speed implementation of authenticated encryption for the MSP430X microcontroller | |
Zou et al. | Hybrid encryption algorithm based on AES and RSA in file encryption | |
Elgeldawi et al. | A comparative analysis of symmetric algorithms in cloud computing: a survey | |
Naskar et al. | A secure symmetric image encryption based on bit-wise operation | |
Xu et al. | A white-box AES-like implementation based on key-dependent substitution-linear transformations | |
JP2017167390A (en) | Information processing device, information processing method, and program | |
US9571269B2 (en) | Encryption device, encryption method and program | |
Chaddha et al. | Selection on Various Traditional Image Encryption Techniques: A Study | |
JP2010166402A (en) | Encryption processing apparatus, encryption processing method, and encryption processing program | |
Wang et al. | GPU accelerated AES algorithm | |
Buell | Modern symmetric ciphers—Des and Aes | |
Thangarajan et al. | High speed and low power implementation of AES for wireless sensor networks | |
JP2013205437A (en) | Method and apparatus for calculating nonlinear function s-box | |
JP6136325B2 (en) | Cryptographic processing apparatus, cryptographic processing method, and program | |
Belmeguenai et al. | Speech encryption using stream cipher | |
Dara et al. | Using RC4 and AES key schedule to generate dynamic S-box in AES | |
Bajaj et al. | AES algorithm for encryption |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD02 | Notification of acceptance of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7422 Effective date: 20140908 |