WO2015059845A1 - 暗号化処理回路及び復号処理回路並びにその方法 - Google Patents

暗号化処理回路及び復号処理回路並びにその方法 Download PDF

Info

Publication number
WO2015059845A1
WO2015059845A1 PCT/JP2014/003134 JP2014003134W WO2015059845A1 WO 2015059845 A1 WO2015059845 A1 WO 2015059845A1 JP 2014003134 W JP2014003134 W JP 2014003134W WO 2015059845 A1 WO2015059845 A1 WO 2015059845A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
unit
selection
mask
permutation
Prior art date
Application number
PCT/JP2014/003134
Other languages
English (en)
French (fr)
Inventor
哲孝 山下
Original Assignee
日本電気株式会社
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 日本電気株式会社 filed Critical 日本電気株式会社
Priority to JP2015543685A priority Critical patent/JPWO2015059845A1/ja
Publication of WO2015059845A1 publication Critical patent/WO2015059845A1/ja

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0631Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/002Countermeasures against attacks on cryptographic mechanisms
    • H04L9/003Countermeasures against attacks on cryptographic mechanisms for power analysis, e.g. differential power analysis [DPA] or simple power analysis [SPA]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/04Masking or blinding
    • H04L2209/043Masking or blinding of tables, e.g. lookup, substitution or mapping

Definitions

  • the present invention relates to an encryption processing circuit, a decryption processing circuit, a method thereof, and a program thereof, and more particularly to an encryption processing circuit, a decryption processing circuit, a method thereof, and a program thereof in consideration of tamper resistance. To do.
  • encryption is an indispensable technology for information protection and confidential communication.
  • secret information such as keys from being easily guessed.
  • Cryptographic analysis methods such as exhaustive key search, linear decryption that performs mathematical decryption, and differential decryption are known.
  • this kind of cryptographic analysis method makes it impossible to perform analysis in a realistic time.
  • Non-Patent Document 1 As a side channel attack, there is a power analysis attack that measures the power consumption of a cryptographic module and analyzes secret information such as a key from the power consumption.
  • differential power analysis in which analysis is performed by performing statistical processing on a plurality of power consumption waveforms, is regarded as a particularly powerful attack method (Non-Patent Document 1).
  • Non-Patent Document 3 when there is a bias in the transition probability of logic gates, it is said that there is a correlation between the number of bits that become 1 in the data string (Hamming weight) and power consumption (Non-Patent Document). 2).
  • Hi-Patent Document 3 when generating a ciphertext by executing a predetermined encryption process a predetermined number of times, it is said that there is a correlation between register bit transition (Hamming distance) and power consumption before and after the encryption process. Therefore, there is a problem that the secret key can be analyzed by paying attention to the Hamming weight and the Hamming distance.
  • Non-Patent Document 4 A masking technique has been proposed as an example of a countermeasure technique against an attack focusing on the Hamming weight and the Hamming distance.
  • the masking technique when calculating using an input value and a key, a random number called a mask value is calculated together with the input value and the key. Further, round processing is performed using an intermediate value masked by the mask value. Nonlinear conversion during round processing is performed using, for example, a conversion table. A table used for nonlinear conversion is generated every time the mask value changes. The table used for the non-linear transformation receives a value obtained by masking the intermediate value, and outputs a value obtained by re-masking the value obtained by non-linear transformation of the original intermediate value. Since the intermediate value is masked, the correlation between the power consumption and the intermediate value decreases. For this reason, the secret key cannot be analyzed due to the Hamming weight or the like, and the security is increased.
  • Patent Document 1 discloses a fixed value mask method as a method for solving the problem of the masking method using random numbers.
  • the fixed value mask method two or more fixed values are prepared in advance as a mask.
  • a table with a mask to be paired with each mask is prepared.
  • This table with a mask receives as input a value obtained by multiplying an intermediate value by a mask value that forms a set, and outputs a value obtained by multiplying the original intermediate value by a non-linear transformation and the mask value that forms a set.
  • a set of mask and table is selected according to the random number, and encryption processing is performed using the selected mask and table.
  • the mask value is switched by re-assigning the random number each time encryption processing is performed.
  • Non-Patent Document 5 proposes a Rotating Sboxes Masking (RSM) method as a countermeasure method in AES (Advanced Encryption Standard).
  • RSM Rotating Sboxes Masking
  • AES Advanced Encryption Standard
  • the RSM method similarly to the fixed value mask method, a plurality of mask values and a table (SBOX) with a mask are prepared. At the time of cryptographic processing, the plurality of mask values and tables are used in parallel.
  • the input data string is shifted before processing in the table to rotate the mask value to be used and the table. After processing in the table, an output data string with a mask is output.
  • the data string with the mask is returned to the original data position by reversely shifting the data string of the output result.
  • the mask value applied to each byte of data can be exchanged.
  • the unused mask value and table are not output, the use efficiency of the circuit is increased.
  • the first path selection means is a random number generated by the random number generation means.
  • a plurality of extended key mask values are randomly rearranged according to the value of the key, and the extended key calculation means excludes the rearranged plurality of extended key mask values, the data string representing the extended key, and the input data string
  • the second path selection means rearranges the exclusive OR data string by performing the reverse sorting of the first path selection means according to the random number value, and nonlinearly
  • the converting unit 104 performs non-linear conversion of the rearranged data sequence and outputs a data sequence masked by a plurality of non-linear conversion mask values, and the third path selecting unit outputs the first data according to the random number value. Sort the same as the route selection method And, the encryption apparatus is disclosed sort masked data sequence.
  • Patent Document 3 discloses a technique related to a cryptographic processing apparatus having a reduced cryptographic processing configuration.
  • Patent Document 4 discloses a technique related to an encryption chip that can be programmed to process various private key and public key encryption algorithms.
  • Patent Document 5 discloses a technique related to an encryption device using a data encryption standard algorithm.
  • JP 2002-366029 A Patent No. 4596686
  • Non-Patent Document 4 In the masking method using random numbers disclosed in Non-Patent Document 4, it is necessary to recalculate a table used for nonlinear conversion every time a mask value (random number) changes. For this reason, there are problems of a decrease in processing speed and an increase in necessary storage capacity (RAM (Random Access Memory) area).
  • RAM Random Access Memory
  • Non-Patent Document 5 has a problem that a large amount of ROM area is required to store the mask.
  • linear processing (ShiftRows, MixColumns, AddRoundKey) is performed after table processing. Then, after those processes, the mask changed by the linear process is released (unmasked). Furthermore, it is necessary to reapply the mask value used in the next round process (remasking). It is necessary to store a mask value for the unmask and remask in the ROM. It is necessary to prepare mask values for the shift width types. Therefore, the ROM area for storing the mask value becomes large. Further, processing time and a circuit for performing unmasking and remasking are required, and the cost increases in terms of time and circuit scale.
  • Patent Documents 3 to 5 disclose data division and exclusive OR, there is a problem with tamper resistance.
  • the present invention has been made in view of the above problems, and its purpose is to enable reduction of redundant portions in cryptographic processing, increase of processing speed, and reduction of mask value storage area. It is an object to provide an encryption processing circuit, a decryption processing circuit, a method thereof, and a program thereof.
  • a selection unit that sets a random number as an initial value of the selection value, and updates the next selection value every time round processing ends, An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, an exclusive OR is performed between the selected initial mask value and the input plaintext, and an initial value of the input data string
  • An initial mask calculator to A first permutation unit for rearranging the pattern corresponding to the selection value from the selection unit for the calculation result based on the input data string and the round key, and outputting the rearranged result;
  • a non-linear transformation unit including a plurality of tables each for non-linear transformation of a value obtained by dividing the output of the first permutation unit into a plurality of values; A second reordering of the pattern opposite to the first permutation unit is performed on the data string obtained by combining a plurality of output values of the non-linear transformation unit according to the selection value from the selection unit.
  • the non-linear conversion unit performs non-linear conversion according to the table using a value obtained by exclusive ORing with an input-side mask value with respect to the input to the table, and outputs the non-linear converted value Output the value obtained by exclusive OR with the mask value on the side,
  • the round processing using the first permutation unit, the non-linear transformation unit, the second permutation unit, and the first linear transformation unit is performed a specified number of times,
  • a value based on the output of the first linear conversion unit is set as the input data string,
  • An unmask value corresponding to the selection value from the selection unit is selected from a plurality of unmask values, and an exclusive OR is performed between the selected unmask value and the processing result after the specified number of round processes.
  • an encryption processing circuit further comprising an unmask operation unit for outputting as ciphertext.
  • an encryption processing method by a data processing apparatus A selection step of setting a random number as an initial value of the selection value, and updating to the next selection value every time round processing ends, An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, and an exclusive OR is performed between the selected initial mask value and the input value to obtain an initial value of the input data string.
  • An initial mask calculation process A first permutation step of rearranging the pattern corresponding to the selection value from the selection step for the calculation result based on the input data string and the round key, and outputting the rearranged result;
  • a non-linear transformation step for non-linear transformation of a plurality of values obtained by dividing the output value of the first permutation step into a plurality of tables;
  • a second rearrangement of the pattern opposite to the first permutation step is performed on a data string obtained by combining a plurality of output values of the nonlinear transformation step.
  • an encryption processing program for causing a data processing apparatus to execute encryption processing, A selection process in which a random number is set as an initial value of the selection value, and the round process is updated to the next selection value after each round; An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, and an exclusive OR is performed between the selected initial mask value and the input value to obtain an initial value of the input data string.
  • Initial mask calculation processing A first permutation for performing a rearrangement of the pattern corresponding to the selection value from the selection process on the operation result based on the input data string and the round key, and outputting the rearranged result Processing, A non-linear transformation process that non-linearly transforms values obtained by dividing the output value of the first permutation process into a plurality of tables, respectively; In accordance with a selection value from the selection process, a second rearrangement of the pattern opposite to the first permutation process is performed on a data string obtained by combining a plurality of output values of the nonlinear conversion process.
  • Permutation processing A first linear transformation process for performing a linear transformation based on the output of the second permutation process; Including In the non-linear transformation process, non-linear transformation is performed according to the table using a value obtained by exclusive ORing with the mask value on the input side with respect to the input to the table, and the non-linear transformation value is output.
  • a computer-readable medium for example, a semiconductor memory, a magnetic / optical disk, etc. on which the encryption processing program is recorded is provided.
  • a selection unit that sets a random number as an initial value of the selection value, and updates the next selection value every time round processing ends, According to the selection value from the selection unit, an unmask value is selected from a plurality of unmask values, and the selected unmask value is exclusive-ORed with the ciphertext to be used as an initial value of the input data string An arithmetic unit; A first permutation unit for rearranging the pattern corresponding to the selection value from the selection unit for the calculation result based on the input data string and the round key, and outputting the rearranged result; A non-linear conversion unit including a plurality of tables that non-linearly convert values obtained by dividing the output value of the first permutation unit into a plurality of values, In accordance with a selection value from the selection unit, a second reordering of the pattern opposite to the first permutation unit is performed on a data string obtained by combining a plurality of output values of the nonlinear conversion unit.
  • the permutation section A linear conversion unit that performs linear conversion based on the output of the second permutation unit;
  • the non-linear conversion unit performs non-linear conversion according to the table using a value obtained by exclusive ORing with an input-side mask value with respect to the input to the table, and outputs the non-linear converted value Output the value obtained by exclusive OR with the mask value on the side,
  • the round process using the first permutation unit, the nonlinear transformation unit, the second permutation unit, and the linear transformation unit is performed a specified number of times,
  • a value based on the output of the linear conversion unit is set as the input data string
  • An initial mask value is selected from a plurality of initial mask values in accordance with a selection value from the selection unit, and an exclusive OR of the selected initial mask value and a processing result after the specified number of round processes is completed.
  • a decoding processing circuit further comprising an initial mask calculating unit. In this decoding processing circuit, it is not necessary to perform an operation of invalid
  • FIG. 3A is a diagram (part 1-A) showing an example of data transition at the time of AES
  • FIG. 9B is a diagram illustrating an example of data transition during AES (part 1-B)
  • FIG. 9C is a diagram illustrating an example of data transition during AES (part 1-C)
  • FIG. 9B is a diagram illustrating an example of data transition during AES (part 2-A)
  • FIG. 22B is a diagram illustrating an example of data transition during AES (part 2-B)
  • FIG. 14C is a diagram illustrating an example of data transition during AES (part 2-C);
  • FIG. 10 is a diagram (3-A) showing an example of data transition in AES.
  • FIG. 6B is a diagram (part 3-B) showing an example of data transition at the time of AES.
  • FIG. 9C is a diagram illustrating an example of data transition during AES (part 3-C);
  • FIG. 4A is a diagram (part 4-A) showing an example of data transition at the time of AES;
  • FIG. 9B is a diagram (part 4-B) showing an example of data transition in the case of AES.
  • It is a figure which illustrates the structure of the encryption part of an AES encryption circuit.
  • It is a figure which illustrates the structure of the nonlinear transformation part of an AES encryption circuit.
  • an encryption processing circuit for encrypting plaintext in a plurality of rounds using an encryption key includes an initial mask operation unit (1101), a register (1200), first, second Permutation units (1301, 1302), nonlinear transformation unit (1400), linear transformation unit (1500), key computation unit (1600), unmask computation unit (1102), selection unit (1700), random number generation unit ( 1800).
  • the initial mask calculation unit (1101) reads the initial mask from the initial mask table (1111) according to the output value (selection value) of the selection unit (1700), takes an exclusive OR of the read initial mask and plaintext, Put plain text on the mask.
  • Register (1200) stores an intermediate value for each round process.
  • the calculation result of the initial mask calculation unit (1101) is input to the register (1200).
  • the output of the key calculation unit (1600) in the previous round processing is input to the register.
  • the first permutation unit (1301) rearranges the data strings using the values stored in the register (1200) as input values. At this time, what sort is performed depends on the selection value of the selection unit (1700).
  • the non-linear conversion unit (1400) includes a plurality of tables (non-linear conversion tables with a mask) (S1 to St, 1411 to 1414). In each table (S1 to St) (1411 to 1414), an output value corresponding to the input value is output according to the table.
  • the masked nonlinear conversion tables (S1 to St, 1411 to 1414) use this input / output relationship as a table.
  • the second permutation unit (1302) inputs a plurality of values output from the plurality of tables (S1 to Sn) of the nonlinear conversion unit (1400), and rearranges the data strings. At this time, what sort is performed depends on the selection value of the selection unit (1700). Note that the rearrangement is performed in the reverse order to that of the first permutation unit (1301).
  • the linear conversion unit (1500) performs linear conversion of the output value of the second permutation unit (1302).
  • the key calculation unit (1600) adds the output of the linear conversion unit (1500) and the round key (Ki) (takes an exclusive OR).
  • Round processing is performed a specified number of times (for example, the round processing times of AES-128, AES-192, and AES-256 are 10, 12, and 14 times). According to the present invention, it is not necessary (unnecessary) to invalidate a mask for a data string and repeat a new mask while repeating the round process.
  • the unmask operation unit (1102) reads the unmask value from the unmask table (1113) according to the output value (selection value) of the selection unit (1700), and performs an exclusive OR operation between the data string after the round processing and the unmask value. And unmask the data string. Output the result of exclusive OR as ciphertext.
  • the selection unit (1700) outputs the selection value with the random number value of the random number generation unit (1800) as an initial value. Further, the selection value is updated every round of round processing.
  • the mask values of the initial mask calculation unit (1101) and the unmask calculation unit (1102) are selected according to the selected value. Further, the rearrangement pattern of the first permutation section (1301) and the second permutation section (1302) is selected according to the selection value.
  • the random number generation unit (1800) generates a random number at the start of encryption processing, and outputs the generated random number to the selection unit (1700).
  • Random number generators that use LFSR (LinearFeedbackShiftRegister), those that use a one-way function, those that use chaotic sequences, or those that read random numbers stored in advance in ROM, etc. Is used.
  • the first and second permutation units (1301, 1302) have a plurality of rearrangement patterns, and which pattern is used for the rearrangement depends on the selection value of the selection unit (1700).
  • the rearrangement of the second permutation unit (1302) is P2sv (•)
  • the linear transformation is L (•)
  • the first is when the selection value is sv ′.
  • the permutation unit 1301 is rearranged as P1sv ′ (•), and when there is a selection value sv of the selection unit (1700), the next selection value is sv ′.
  • rearrangement patterns that satisfy the following relationship are represented as first and second permutation units (1301, 1302). Give it to.
  • M P1sv '(L (P2sv (N)))
  • the input side mask (M) and the output side mask (N) of the nonlinear conversion unit (1400) define the following relationship.
  • the output side mask value (N) is rearranged by any of the rearrangement patterns of the second permutation unit (1302), and the rearranged mask value (N) is linearized by the linear conversion unit (1500).
  • a result obtained by rearranging the result of the transformation and the linear transformation by any one of the rearrangement patterns of the first permutation unit (1301) is defined as the input side mask (M).
  • the non-linear conversion unit includes the non-linear conversion table with a mask, so that it is not necessary to recalculate the table to change the mask. (RAM area) increase is suppressed. Further, the nonlinear conversion unit includes a table having different masks, and further replaces the data input to the table by permutation, thereby exchanging the masks for each part of the data for each round process. By not providing unused mask values and tables, the ROM area and circuit scale can be reduced.
  • the processing speed is improved, the circuit scale and the ROM area are reduced, the analysis by the side channel attack based on the Hamming weight and the Hamming distance is made difficult, and the security of the cryptographic module is improved. Can do.
  • some embodiments will be described with reference to the drawings.
  • FIG. 1 is a diagram illustrating a configuration of an encryption processing circuit according to the first embodiment of this invention.
  • the encryption processing circuit of the present embodiment includes an encryption unit 1000 and a key generation unit 2000.
  • FIG. 2 is a diagram illustrating a configuration of the encryption unit 1000 of FIG.
  • the encryption unit 1000 includes an initial mask calculation unit 1101, an unmask calculation unit 1102, a register 1200, a permutation unit 1301, 1302, a nonlinear conversion unit 1400, a linear conversion unit 1500, a key calculation unit 1600, and a selection.
  • the encryption unit 1000 encrypts data based on the input plaintext and the round key (Ki) received from the key generation unit 2000, and outputs a ciphertext.
  • the encryption unit 1000 first performs processing in the initial mask calculation unit 1101.
  • FIG. 3 is a diagram illustrating the configuration of the initial mask calculation unit 1101 of FIG.
  • the initial mask calculation unit 1101 includes an initial mask table 1111 storing a plurality of initial masks, and an exclusive OR calculation unit (Exclusive OR: XOR) 1112.
  • the initial mask table 1111 selects and outputs one of a plurality of initial masks based on the input selection value.
  • the exclusive OR calculator 1112 calculates an exclusive OR (bitwiseXOR: bitwise XOR) between the initial mask output from the initial mask table 1111 and the plain text.
  • the initial mask table 1111 stores as many initial mask data strings as the number of values that the selection unit 1700 can take.
  • the unmask calculation unit 1102 performs the process.
  • FIG. 4 is a diagram illustrating the configuration of the unmask operation unit 1102 in FIG.
  • the unmask operation unit 1102 includes an unmask table 1113 that stores a plurality of unmasks, and an exclusive OR operation unit 1114.
  • the unmask table 1113 selects and outputs one of a plurality of unmasks based on the input selection value.
  • the exclusive OR operation unit 1114 calculates the exclusive OR (bitwiseXOR) of the unmask output from the unmask table 1113 and the round process output result (the output result of the key operation unit 1600 stored in the register 1200). And output ciphertext. Similar to the initial mask table 1111, the unmask table 1113 stores as many unmasked data strings as the number of values that the selection value can take.
  • the initial mask calculation unit 1101 selects a mask value from the initial mask table 1111 based on the selected value, calculates the exclusive OR (bitwiseXOR) of the selected mask value and the input data string, Output the calculation result. Further, the unmask calculation unit 1102 selects a mask value from the unmask table 1113 based on the selection value, calculates an exclusive OR (bitwiseXOR) of the selected mask value and the input data string, and outputs the calculation result. At this time, the initial mask calculation unit 1101 calculates an exclusive OR of the plaintext and the initial mask. Further, the unmask calculation unit 1102 calculates an exclusive OR of the round process result and the unmask.
  • the register 1200 stores the intermediate value of the round process.
  • the output of the initial mask calculation unit 1101 is stored.
  • the output of the key calculation unit 1600 is stored.
  • the permutation unit 1301 and the permutation unit 1302 have a plurality of rearrangement patterns, select the rearrangement pattern according to the selection value, rearrange the input data string according to the selected pattern, and rearrange Output the result.
  • the rearrangement includes rearrangement in bit units, byte units, and arbitrary data length units.
  • the permutation unit 1301 rearranges the data in the register 1200.
  • the permutation unit 1302 rearranges the output values (Y) of the nonlinear conversion unit 1400, and outputs the rearranged result (P2 (Y)).
  • the non-linear conversion unit 1400 performs non-linear conversion on the input value (X) and outputs a conversion result (Y).
  • FIG. 5 is a diagram illustrating the configuration of the nonlinear conversion unit 1400 of FIG.
  • the non-linear conversion unit 1400 includes t (t is a predetermined positive integer) non-linear conversion tables (S1 to St) 1411 to 1414. Partial data x1 to xt of the input value X are input to the t non-linear conversion tables 1411 to 1414, respectively, and non-linear conversion is performed in each non-linear conversion table.
  • the data is divided in bit units, byte units, and an arbitrary data length, and the data X is divided into t pieces of data x1 to xt in total.
  • x1 to xt do not overlap each other, and become X by combining (concatenating) the bit strings (or byte strings, etc.) of x1 to xt.
  • bit strings or byte strings, etc.
  • T output values y1 to yt are output as the conversion results of the non-linear conversion tables 1411 to 1414.
  • the nonlinear conversion tables 1411 to 1414 perform mask operations on the input and output of the table and are also referred to as masked nonlinear conversion tables.
  • a combination of the n output values y1 to yt becomes the output value Y of the nonlinear converter 1400.
  • FIG. 6 is a diagram illustrating the input / output relationship of the t non-linear conversion tables (S1 to St) 1411 to 1414 in FIG.
  • the nonlinear conversion table 1411 includes an input side mask m 1 , an output side mask n 1 , an exclusive OR operation unit 1431, a lookup table type nonlinear conversion table (S) 1421, and , An exclusive OR operation unit 1435 is provided.
  • the other nonlinear conversion tables 1412 to 1414 include input side masks m 2 to m t , output side masks n 2 to n t , exclusive OR operation units 1432 to 1434, and look-up table methods.
  • Nonlinear conversion tables (S) 1422 to 1424 and exclusive OR operation units 1436 to 1438 are provided.
  • the bit width of the mask m 1 ⁇ m t is equal to the data x1 ⁇ xt bits wide.
  • exclusive-OR operation unit 1431 exclusive OR of the mask m 1 on the input side and the input value x1 ((bitwise XOR) x1 ( XOR) m 1 Note that taking an exclusive OR with a mask value is also referred to as applying a mask.
  • the non-linear conversion table (S) 1421 receives the exclusive OR operation result x1 (XOR) m 1 in the exclusive OR operation unit 1431, and converts the input to the non-linear conversion result S (x1 (XOR) m 1 ) is output.
  • the exclusive OR operation unit 1435 outputs an exclusive OR S (x1 (XOR (XOR)) between the conversion result S (x1 (XOR) m 1 ) output from the nonlinear conversion table (S) 1421 and the mask n 1 on the output side. ) m 1 ) (XOR) n 1 is taken and the operation result is output as y1.
  • the nonlinear conversion table (S1) 1411 converts the input value x1 into y1 and outputs it.
  • the other nonlinear conversion tables (S2 to Sn) 1412 to 1414 perform three operations of exclusive OR, nonlinear conversion, and exclusive OR on x2 to xt, respectively.
  • the masks n 1 to n t are equal to the bit width of the output of the nonlinear conversion table (S) (for example, the bit widths of the masks m 1 to m t may be equal).
  • M that combines (joins) the masks m 1 to m t on the input side N, which is a combination (concatenation) of masks n 1 to n t on the output side
  • the exclusive OR operation Z (XOR) Ki is an addition of Z and Ki.
  • FIG. 7 is a diagram illustrating the configuration of the key calculation unit 1600 of FIG.
  • the key calculation unit 1600 includes a plurality of exclusive OR calculation units 1611 to 1614.
  • the exclusive OR operation unit 1611 calculates an exclusive OR z1 (XOR) ki1 of ki1 that is a part of the round key Ki and z1 that is a part of the input value Z, and calculates the operation result (addition result). Output as q1.
  • the selection unit 1700 outputs the selection value using the random number output from the random number generation unit 1800 as an initial value.
  • the selection value is used by the initial mask calculation unit 1101, the permutation units 1301 and 1302, and the unmask calculation unit 1102.
  • examples of the method for updating the selection value include the following (however, they are not limited to the following).
  • a random number generator 1800 generates a random number at the start of encryption processing.
  • the generated random number is input to the selection unit 1700.
  • the round key (Ki) is input to the key adding unit 1600 in FIG.
  • FIG. 8 is a flowchart for explaining the operation of the first embodiment. The operation of this embodiment will be described with reference to FIG. 8 and FIGS. 1 to 7.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 in FIG. 1 and the secret key is input to the key generation unit 2000 in FIG. 1 (step A1).
  • the random number generation unit 1800 in FIG. 2 When the cryptographic process is started, the random number generation unit 1800 in FIG. 2 generates a random number, and the random number is input to the selection unit 1700 (step A2).
  • the selection unit 1700 in FIG. 2 outputs a selection value based on the input random number (step A3).
  • step A4 The plain text with the mask is stored in the register 1200.
  • steps A5 to A11 are performed as a round process.
  • the permutation unit 1301 in FIG. 2 rearranges the data string based on the selection value (step A5).
  • the nonlinear conversion unit 1400 in FIG. 2 performs nonlinear conversion on the output value of the permutation unit 1301, and outputs a nonlinear conversion output (Y) (step A6).
  • the non-linear conversion unit 1400 divides the output value of the permutation unit 1301 into t pieces and inputs x1 to xt to the non-linear conversion tables (S1 to St) 1411 to 1414. These non-linear conversion tables are non-linear conversion tables with a mask.
  • the result of the non-linear conversion table (S1) 1411 is obtained by calculating an exclusive OR of x1 and m 1 , performing non-linear conversion on the operation result by non-linear conversion S (•), and exclusive of n 1 with the result of non-linear conversion.
  • the result is a logical sum.
  • the non-linear conversion tables (S) 1421 to 1424 perform non-linear conversion on the original plaintext.
  • a value obtained by rearranging the mask values M is stored as each mask value stored in the initial mask table 1111 in FIG. 3, and the initial mask is made to match the array of the mask values M in the permutation unit 1301 in FIG. 2.
  • the permutation unit 1302 in FIG. 2 rearranges the output Y of the nonlinear conversion unit 1400 based on the selected value (step A7).
  • the rearrangement performed in the permutation unit 1302 is reverse to the permutation unit 1301.
  • the data order can be returned to the order before being input to the permutation unit 1301.
  • the arrangement of the mask applied to the data is rearranged.
  • step A8 performs linear conversion on the output value (Y ′) of the permutation unit 1302 and outputs a conversion result (Z) (step A8).
  • step A9 The calculation result (Q) in the key calculation unit 1600 is stored in the register 1200.
  • step A10 it is determined whether or not the round process has been repeated (round process end) (step A10).
  • the counter set to the prescribed number of rounds may be counted down by one for each calculation in the key calculation unit 1600, and when the count value becomes 0, it may be determined that the round process has ended. You may make it control by the control part etc. which are not shown in figure which control each part of FIG.
  • the selection unit 1700 updates the selection value (step A11), returns to step A5, and repeats the round processing again.
  • the process proceeds to Step A12.
  • the permutation unit 1301 in FIG. 2 rearranges the results (Q) of the key calculation unit 1600 in FIG. 2 (P1 (Q)) (step A5).
  • the non-linear conversion unit 1400 in FIG. 2 performs non-linear conversion on the rearranged data string (P1 (Q)) and outputs a conversion result (Y) (step A6).
  • the output (P1 (Q)) of the permutation unit 1301 is divided into t pieces as pq1 through pqt, just like the input value (X) is divided into t pieces (x1 through xt). For example, when P1 (Q) is 32 bits, pq1 is 0 to 3 bits of P1 (Q), pq2 is 4 to 7 bits of P1 (Q), and so on. Divide into 29 to 31 bits of P1 (Q).
  • Pq1 to pqt are respectively input to the nonlinear conversion tables (S1 to St) 1411 to 1414 as x1 to xt in FIG. 5, and nonlinear conversion processing with a mask is performed.
  • non-linear conversion table (S1) 1411 in FIG. 6, calculates the exclusive OR pq1 (XOR) m 1 of PQ1 and m 1, the operation result, and non-linear transformation by the nonlinear conversion S ( ⁇ ) (operation result pq1 (XOR) m 1 is input to the table, and the result of nonlinear transformation is read from the table), and the result of the exclusive OR of the result of nonlinear transformation S (pq1 (XOR) m 1 ) and n 1 S (pq1 (XOR) m 1 ) (XOR) n 1
  • the mask N applied in step A6 (see FIG. 8) in the first round is the permutation unit 1302 and linear transformation unit 1500 (see FIG. 2) in the first round, and the permutation unit 1301 in the second round.
  • mask M m 1 ⁇ m t the bound input side 'if it matches the in exclusive OR operation unit 1431 to 1434 in FIG. 6, N' N so that M and is offset (to match If the exclusive OR of the values is taken, it becomes 0).
  • the non-linear conversion tables (S) 1421 to 1424 in FIG. 6 are equivalent to performing non-linear conversion on the original data (value before applying the mask). It becomes. Then, the mask N is applied to the result of nonlinear transformation of the original data by the exclusive OR operation units 1435 to 1438 in FIG.
  • mask M non-linear conversion tables (S1 to Sn) 1411 to 1414 (see FIGS. 5 and 6) including M and N are mounted.
  • the permutation unit 1302 in FIG. 2 rearranges the transformation result (Y) of the nonlinear transformation unit 1400 based on the selected value, and outputs the rearranged result (P2 (Y)) (step A7).
  • Step A9 calculates the exclusive OR of the output (Z) of the linear conversion unit 1500 and the round key (Ki) sent from the key generation unit 2000, and outputs the calculation result (Q).
  • step A10 When the round process has been performed a predetermined number of times, the process proceeds from step A10 to step A12 in FIG.
  • the unmask calculation unit 1102 in FIG. 2 selects an unmask based on the selection value from the unmask table 1113 in FIG. 4, and outputs (Q) of the key calculation unit 1600, which is the result of the round process, Is calculated, and the calculation result is output as ciphertext (step A12).
  • This exclusive OR with the unmask cancels the mask applied to Q and obtains the original ciphertext C.
  • the mask applied to the output (Q) of the key calculation unit 1600 which is the result of the round processing, is a value N obtained by rearranging the mask N applied in step A6 in FIG. 8 by the permutation unit 1302 and converting it by the linear conversion unit 1500. 'Is. Accordingly, the original ciphertext C can be obtained by performing an exclusive OR operation between Q and the unmask value in the unmask operation unit 1102.
  • the content of processing may change in the last round.
  • a value obtained by applying only permutation processing and linear processing performed on the mask N to N in the last round is used as the unmask value.
  • ciphertext C is output and the process ends (step A13).
  • the association between the initial mask table 1111 (FIG. 3) of the initial mask calculation unit 1101 and the permutation unit 1301 is performed by the selection value of the selection unit 1700.
  • the initial mask selected by a certain selection value sv is rearranged according to the rearrangement pattern of the permutation unit 1301 selected by the same selection value sv, so that the input side of the nonlinear conversion table (1411 to 1414 in FIG. 6) is changed. Equal to mask M.
  • nt) is rearranged by any of the rearrangement patterns that can be taken by the permutation unit 1302, and is converted by the linear transformation unit 1500 in the last round.
  • the association between the unmask table 1113 (FIG. 4) and the permutation unit 1302 is performed by the selection value of the selection unit 1700.
  • the output side mask N is rearranged according to the rearrangement pattern of the permutation unit 1302 selected with a certain selection value sv, an unmask selected with the same selection value sv and a non-linear conversion table (1411 to 1414 in FIG. 6). ) Output side mask N becomes equal.
  • the mask N ( n1
  • nt) on the output side of the nonlinear conversion table (1411 to 1414 in FIG. 6) includes the permutation unit 1302, the linear conversion unit 1500, and the next round.
  • the result converted by the permutation unit 1301 is set as a mask M on the input side of the nonlinear conversion table of the next round.
  • the masks M and N on the input side and output side of the nonlinear conversion table (1411 to 1414 in FIG. 6), the rearrangement pattern of the permutation units 1301 and 1302 in FIG. 2, and the selection value by the selection unit 1700 are as follows: As related.
  • the permutation units 1301 and 1302 in FIG. 2 determine the rearrangement pattern according to the selection value of the selection unit 1700.
  • the permutation unit 1301 is an arrangement for matching the correspondence between the mask value applied to the data string and the mask M on the input side applied in each of the nonlinear conversion tables 1411 to 1414 (FIG. 6) of the nonlinear conversion unit 1400. Change. Therefore, the selection value of the selection unit 1700 indicates the arrangement of the masks in the permutation unit 1301. Then, the permutation unit 1301 rearranges the data string input from the register 1200 according to the selection value.
  • the permutation unit 1302 performs reverse ordering of the rearrangement process performed in the permutation unit 1301 to match the original data position. In this way, by matching with the original data position in the permutation unit 1302, the original when the mask is not used in the linear processing in the subsequent linear conversion unit 1500 and the key calculation in the key calculation unit 1600. This makes it possible to eliminate the need for additional processing.
  • the rearrangement of the permutation units 1301 and 1302 it is necessary to rearrange the mask M so that the mask M can be derived from the mask N of the nonlinear transformation unit 1400 (or the mask N can be derived from the mask M).
  • the permutation unit 1302 performs rearrangement based on various rearrangement patterns. It is assumed that any rearrangement pattern is used as the mask N on the output side of each of the nonlinear conversion tables 1411 to 1414 (FIG. 6). However, after passing through the subsequent linear processing, it is necessary that the mask M can be derived by rearrangement in the permutation unit 1301 in the next round processing.
  • the permutation unit 1302 is rearranged by P2sv (•), the linear transformation is L (•), and the permutation unit 1301 is rearranged when the selection value is sv ′.
  • P1sv '(•) when there is a selection value sv of the selection unit 1700, it is assumed that the next selection value is sv ′. Mutations 1301 and 1302 are provided.
  • FIGS. 9A to 9D show the results when the above-described rearrangement is performed on the data array of AES.
  • 9A shows the original AES data array
  • FIG. 9B shows the result of rearrangement by a cyclic shift of multiples of 4 bytes (4 * 2 byte cyclic shift)
  • FIG. 9C forms a column for every 4 bytes.
  • FIG. 9A shows the original AES data array
  • FIG. 9B shows the result of rearrangement by a cyclic shift of multiples of 4 bytes (4 * 2 byte cyclic shift)
  • FIG. 9C forms a column for every 4 bytes.
  • FIG. 9C forms a column for every 4 bytes.
  • 9D rearranges by a cyclic shift of a multiple of 4 bytes, and further configures a column every 4 bytes.
  • the result of rearrangement by the same cyclic shift is shown (after 4 * 2 byte cyclic shift, 2 byte cyclic shift in each column).
  • this embodiment is compared with the comparative example shown in FIG. 10 (comparative example 1: prototype example of an encryption processing circuit that does not perform masking).
  • this comparative example includes a register 1200, a non-linear conversion unit 1401 (no mask), a linear conversion unit 1500, and a key calculation unit 1600.
  • an initial mask calculation unit 1101, an unmask calculation unit 1102, permutation units 1301 and 1302, a selection unit 1700, and a random number generation unit 1800 are added to the circuit of FIG. .
  • FIG. 10 is a nonlinear conversion table in which the mask is not reflected in the input / output, unlike the present embodiment.
  • FIG. 11 is a diagram illustrating a configuration of the nonlinear conversion unit 1401 of FIG.
  • the nonlinear conversion unit 1401 includes nonlinear conversion tables (S) 1421 to 1424.
  • S nonlinear conversion tables
  • the permutation process is particularly equivalent to an increase in the processing time in the present embodiment.
  • two types of ROM areas, an initial mask table and an unmask table, may be prepared.
  • FIG. 12 shows a configuration example (comparative example 2) of an encryption processing circuit based on the RSM method.
  • the difference between the circuit of the RSM method of FIG. 12 and the present embodiment of FIG. 2 is that the permutation units 1301 and 1302 of FIG. 2 are barrel shifts 1303 and 1304 in the comparative example of FIG.
  • the MMSj + 1 adder 1103 is added.
  • FIG. 12 is a diagram exemplifying a configuration of the nonlinear conversion unit 1402 of the RSM method.
  • FIG. 14 is a diagram illustrating a configuration of t nonlinear conversion tables (S1 to St) 1441 to 1444 in FIG.
  • the output side mask M ⁇ m1, m2,... ⁇ m2, m3, ..., mt, m1 ⁇ .
  • RSM method of FIG. 12 rearrangement is performed by barrel shift.
  • the number of bytes to be shifted by a random number is selected, the selection of the initial mask and the number to be shifted in the first round barrel shift 1303 are determined according to the selected number.
  • barrel shift 1304 returns the data position to the original by shifting the same number in the opposite direction to the barrel shift 1303.
  • barrel shifts 1303 and 1304 shift by one more than the number shifted in the previous round. If the shift number exceeds the data width, the shift number becomes zero.
  • the mask on the output side is changed by the linear transformation 1500, the mask is canceled by the mask M in the nonlinear transformation unit 1402 in the next round, and the nonlinear transformation tables 1421 to 1424 (FIG. 14). The correct processing cannot be performed.
  • the MMSj + 1 addition unit 1103 performs processing of once canceling N ′ in which the mask N has been changed by linear processing and newly applying the next round of mask M.
  • the present embodiment does not require the arithmetic processing by the MMSj + 1 adding unit 1103 for each round process. For this reason, the time required for the arithmetic processing corresponding to the number of rounds is shortened.
  • the circuit scale of the cryptographic processing circuit based on the RSM method of FIG. 12 is compared with this embodiment.
  • the MMSj + 1 addition unit 1103 is a difference from the present embodiment. Therefore, the circuit scale of the present embodiment is smaller than that of the RSM method only for the part related to the MMSj + 1 adding unit 1103.
  • the ROM area is compared.
  • the initial mask Mj, the mask MMSj + 1 used in the MMSj + 1 addition unit 1103 in the middle, and the last unmask MSj + n change depending on how many bytes are shifted by the barrel shift. come.
  • the shift width pattern is 16 patterns of 0 to 15 bytes
  • 16 masks are required for 3 masks
  • pre-processing and post-processing may be performed.
  • a configuration in which pre-processing is added before and after the initial mask calculation unit 1101 or post-processing is added before and after the unmask calculation unit 1102 may be provided.
  • a preprocessing unit 1901 that performs preprocessing of round processing is provided between the initial mask calculation unit 1101 and the register 1200.
  • a post-processing unit 1902 that receives the output of the register 1200 after the end of the specified number of rounds is provided in the preceding stage of the unmask operation unit 1102.
  • the encryption circuit of this embodiment includes an encryption unit 1000 and a key generation unit 2000, as in FIG.
  • FIG. 17 is a diagram illustrating a configuration of the encryption unit 1000 according to the second embodiment of this invention.
  • the encryption unit 1000 includes an initial mask operation unit 1101, registers 1201 and 1202, a key operation unit 1600, permutation units 1301 and 1302, a nonlinear conversion unit 1400, a linear conversion unit 1500, a selection unit 1700, a random number.
  • a generation unit 1800 and an unmask operation unit 1102 are provided.
  • the second embodiment is an embodiment for a cipher having a Feistel structure.
  • an exclusive OR operation unit 1A00 is added to deal with two series of data of the Feistel structure, and the register 1200 is divided into two registers 1201 and 1202. Points, the input of the key calculation unit 1600 and the permutation unit 1301 are different, the relational expression of sv in the selection unit 1700 and the masks M and N of the nonlinear conversion unit 1400, the initial mask table 1111 in the initial mask calculation unit 1101, It is the unmask table 1113 of the calculating part 1102.
  • the exclusive OR operation unit 1A00 adds the value stored in the register 1202 and the output of the linear conversion unit 1500 (takes an exclusive OR).
  • registers 1201 and 1202 store an intermediate value of round processing.
  • the output of the initial mask calculation unit 1101 is divided and stored in each register.
  • the result of the exclusive OR operation unit 1A00 is stored in the register 1201
  • the intermediate value stored in the register 1201 in the previous round is stored in the register 1202.
  • the key operation unit 1600 adds the value stored in the register 1201 and the round key (takes an exclusive OR).
  • the first permutation unit 1301 rearranges the data string using the output of the key calculation unit 1600 as an input value. At this time, what sort is performed depends on the selection value of the selection unit 1700.
  • the permutation of the second permutation unit 1302 is P2sv (•)
  • the linear transformation is L (•)
  • the sorting of the part 1301 is P1sv ′ ( ⁇ )
  • the selection value sv of the selection part 1700 is present, Assuming that the selected value is sv ′, for all sv, the rearrangement pattern that satisfies the following relationship with respect to the input-side mask M and the output-side mask N of the nonlinear conversion unit 1400 is the first and second rearrangement patterns.
  • Permutation units 1301 and 1302 are provided.
  • M P1sv '(L (P2sv (N)) (XOR) MRsv)
  • Each initial mask stored in the initial mask table 1111 is selected based on the selected value, and exclusive OR with the plaintext is calculated. After the calculation, the data is divided into two series and stored in registers 1201 and 1202, respectively.
  • the initial mask ML relating to the data stored in the register 1201 is rearranged by any of the rearrangement patterns that can be taken by the permutation unit 1301, so that it becomes equal to the input side mask M of the nonlinear conversion table.
  • the initial mask ML at the time of the selection value sv is MLsv
  • the rearrangement of the first permutation unit 1301 at the time of the selection value sv is P1sv (•), which satisfies the following relationship.
  • P1sv (MLsv) M
  • the initial mask MR relating to the data stored in the register 1202 assumes that the next selection value is sv ′ when the selection value sv of the selection unit 1700 is present, and the initial mask ML when the selection value is sv is MLsv. And MLsv and MRsv ′ are equal when the initial mask MR at the selection value sv ′ is MRsv ′.
  • MRsv ' MLsv
  • the data stored in the register 1201 is masked according to the selection value sv of the selection unit 1700 during the round process, and the mask is equal to the initial mask MLsv.
  • the data stored in the register 1202 is also masked according to the selection value sv of the selection unit 1700 during the round process, and the mask is equal to the initial mask MRsv.
  • Each unmask stored in the unmask table 1113 is selected based on the selected value, and the intermediate value stored in the register 1201 as a result of the round processing and the result of the exclusive OR operation unit 1A00, Exclusive OR is calculated.
  • the calculated result is output as ciphertext.
  • the unmasked UL that is operated on the intermediate value stored in the register 1201 is equal to the input side mask M of the nonlinear conversion table by rearranging with any of the rearrangement patterns that can be taken in the permutation unit 1301. .
  • the unmasked UL for the selection value sv is ULsv
  • the initial mask is MLsv
  • the rearrangement of the first permutation unit 1301 for the selection value sv is P1sv ( ⁇ ), which satisfies the following relationship.
  • the unmasked UR that is operated with the result of the exclusive OR operation unit 1A00 is the unmasked UR at the selection value sv, the URsv as the unmasked UR, and the selection value sv of the selection unit 1700.
  • the initial mask MRsv is N
  • the output side mask of the nonlinear transformation unit 1400 is N
  • the rearrangement of the second permutation unit 1302 is P2sv (•)
  • the linear transformation L (•)
  • URsv L (P2sv (N)) (XOR) MRsv
  • FIG. 18 is a flowchart for explaining the operation of the second embodiment.
  • the difference from the first embodiment is that an exclusive OR (step A14) and data exchange (step A15) are added, and that the order of steps is changed and the data to be processed changes (step A5- 1 to A9-1).
  • step A14 exclusive OR
  • step A15 data exchange
  • step A4 the processed data is stored in registers 1201 and 1202.
  • steps A9-1 to A11 are performed as a round process.
  • the key operation unit 1600 performs an exclusive OR operation between the round key and the intermediate value of the register 1201 (step A9-1). Since the length of the data string to be processed is processing in the Feistel structure, it is half the data length of the original plaintext. The data length processed in each step in the subsequent round processing is half the data length of the original plaintext.
  • the permutation unit 1301 rearranges the data sequence based on the selected value (step A5-1). Further, the nonlinear conversion unit 1200, the permutation unit 1302, and the linear conversion unit 1500 perform processing, respectively. (Steps A6-1, A7-1, A8-1).
  • the exclusive OR operation unit 1A00 calculates the exclusive OR of the intermediate value stored in the register 1202 and the output of the linear conversion unit 1500 (step A14).
  • step A10 it is determined whether the round process has been repeated for the specified number of rounds. As a result of the determination, if the round processing has not finished the specified number of times, the divided data is first replaced (step A15), and then the selection value is updated (step A11) in the selection unit 1700. Thereafter, the process returns to step A9-1, and the round process is repeated again. On the other hand, if the round processing has been completed the specified number of times, the process proceeds to step A12.
  • the unmask operation unit 1102 performs an exclusive OR operation between the unmask selected from the unmask table based on the selected value, the intermediate value stored in the register 1201, and the output of the exclusive OR operation unit 1A00. Is calculated, and the calculation result is output as ciphertext (step A12).
  • Example 1 As a specific example of the first embodiment described with reference to FIG. 2 and the like, an encryption processing circuit when 128-bit AES (AES128) is used will be described.
  • AES1228 128-bit AES
  • FIG. 20 is a diagram illustrating the configuration of the encryption unit of the encryption processing circuit according to the first embodiment.
  • the encryption unit includes an initial mask calculation unit 3101, an unmask calculation unit 3102, a register 3200, permutation units 3301 and 3302, a nonlinear conversion unit 3400 having 16 SBOXs with masks, and ShiftRows corresponding to the linear conversion unit 1500 in FIG. 2.
  • a calculation unit 3501, a MixColumns calculation unit 3502, key calculation units 3601 and 3602 for adding round keys by exclusive OR, a selection unit 3700, and a random number generation unit 3800 are provided.
  • the initial mask calculation unit 3101 and the unmask calculation unit 3102 have the same configurations as those in FIGS.
  • a key addition calculation unit 3601 is added between the initial mask calculation unit 3101 and the register 3200.
  • ShiftRows and MixColumnss are used as linear processing. Therefore, the ShiftRows calculation unit 3501 and the MixColumns calculation unit 3502 are provided as the linear processing unit 1500 in FIG. In addition, since processing in MixColumns is not performed in the final round, a route for avoiding the MixColumns calculation unit 3502 is provided in the final round.
  • AES1208 16-byte data is divided into 1-byte data, and each byte of data is expressed as 4x4 data.
  • a cyclic shift of bytes that is a multiple of 4 is a horizontal shift in the horizontal direction
  • a column is formed every 4 bytes
  • the same cyclic shift in each column is a cyclic shift in the vertical direction.
  • FIG. 23A to 23D show two types of cyclic shifts in 16-byte data represented by 4x4.
  • FIG. 23A shows the original AES data array
  • FIG. 23B shows the result of rearrangement by a cyclic shift of multiples of 4 bytes (4 * 2 byte cyclic shift)
  • FIG. 23C forms a column for every 4 bytes.
  • FIG. 23D rearranges by a cyclic shift of a multiple of 4 bytes, and further constitutes a column every 4 bytes.
  • the result of rearrangement by the same cyclic shift is shown (after 4 * 2 byte cyclic shift, 2 byte cyclic shift in each column).
  • permutation units 3301 and 3302 perform two types of cyclic shifts according to the selection value R by the selection unit 3700.
  • the permutation unit 3301 performs two types of cyclic shifts so that data at the same byte position as the selected value R comes to the 0th byte.
  • each nonlinear conversion table S1 to S16 (see FIG. 21) of the nonlinear conversion unit 3400 performs processing in units of 1 byte.
  • the mask value M on the input side and the mask value N on the output side in the nonlinear conversion unit 3400 are 16 bytes (the mask value M is a concatenation of [m1, m2, m3, m16] in FIG. 22, and the mask value N is [ n1, n2, n3, n16]), each byte is divided and associated with each masked nonlinear conversion table.
  • the selection unit 3700 in FIG. 20 receives the random number generated by the random number generation unit 3800 and sets the random number as the initial selection value R.
  • the selection unit 3700 updates the selection value R for each round process.
  • a method for updating the selection value R in the present embodiment for example, the following method is used (however, it is not limited to the following).
  • -Prepare a calculation formula and enter the current selection value or the initial random number and the current round number into the calculation formula to obtain the next selection value.
  • the selected value is updated by reading the next selected value (R ′) from the table using the current selected value (R).
  • One of the mask value M on the input side and the mask value N on the output side in the nonlinear conversion unit 3400 can be set to an arbitrary value.
  • the selection value R and the selection value R ′ for the next round are set next.
  • the permutation unit 3302 performs sorting on the output side mask value N in the nonlinear transformation unit 3400 based on the sorting table corresponding to the selection value R.
  • the ShiftRows calculation unit 3501 and the MixColumns calculation unit 3502 perform processing on the rearranged result (P2 R (N)) as linear processing.
  • the permutation unit 3301 sorts the linear processing result (L (P2 R (N))) based on the sorting table corresponding to the selection value R ′.
  • the result of this rearrangement is set as a mask M on the input side of the nonlinear conversion unit 3400.
  • the mask value N on the output side in the non-linear transformation unit 3400 is rearranged by the selection value R in the permutation unit 3302, and the data L (P2 (N)) obtained by performing the ShiftRows computation unit 3501 and the MixColumns computation unit 3502 for linear processing.
  • R ′ is the byte where the 0th byte mask of M is located.
  • the selection value necessary for making L (P2 (N)) the same as M in the permutation unit 3301 is R ′.
  • the mask value (16 bytes) used in this example is as follows. Numerical values are expressed in hexadecimal notation.
  • 26 and 27 show an initial mask table (1111 in FIG. 3) of the initial mask calculation unit 3101 in FIG. 20 and an unmask table (1113 in FIG. 4) of the unmask calculation unit 3102. These initial mask and unmask are stored in the initial mask table (1111 in FIG. 3) of the initial mask calculator 3101 and the unmask table (1113 in FIG. 4) of the unmask calculator 3102.
  • M is obtained by performing permutation (4-byte cyclic shift) after calculating N with ShiftRows and Mixcolumns.
  • the unmask is equivalent to the one obtained by performing a cyclic shift with the selected value R in the permutation unit 3302 and converting with N using ShiftRows.
  • FIG. 28 shows an example of a table representing the relationship between the current selection value R (0 to 15) and the selection value R ′ for the next round.
  • FIG. 29 is a flowchart for explaining the operation of the first embodiment shown in FIG. The operation of the first embodiment will be described with reference to FIGS.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 and the secret key is input to the key generation unit 2000 (step B1).
  • the random number generation unit 3800 in FIG. 2 When the encryption process is started, the random number generation unit 3800 in FIG. 2 generates a random number, and the random number is input to the selection unit 3700 (step B2).
  • the selection unit 3700 outputs a selection value R based on the input random number (step B3).
  • the initial mask calculation unit 3101 selects an initial mask based on the selection value R from the initial mask table of FIG. 26, and calculates an exclusive OR of the plaintext and the initial mask.
  • the plaintext is masked by this exclusive OR operation (addition operation) (step B4).
  • the key calculation unit 3601 performs an exclusive OR operation between the masked plaintext and the round key output from the key generation unit 2000, and stores the calculation result in the register 3200 (step B5).
  • steps B6 to B13 are performed as round processing. Since the processing contents differ only in the 10th round, the process branches to the next step at the end of the 9th round.
  • the permutation unit 3301 rearranges the data string based on the selection value R (step B6).
  • the non-linear conversion unit 3400 performs non-linear conversion on the output value of the permutation unit 3301, and outputs a non-linear conversion output (Y) (step B7).
  • the nonlinear conversion unit 3400 divides the output value of the permutation unit 3301 into 16, and x1 to x16 are input to the nonlinear conversion tables (S1 to S16) 3411 to 3414 (see FIG. 21).
  • non-linear conversion tables are non-linear conversion tables with a mask.
  • an exclusive OR operation unit 3431 calculates an exclusive OR of x1 and m 1, and the operation result is stored in the non-linear conversion table 3421 (S ( )) To perform non-linear transformation, take the exclusive OR of the result of non-linear transformation by the exclusive OR operation unit 3435 and n 1, and output the exclusive OR operation result to the output y 1 of the non-linear transformation table (S 1) 3411 To do.
  • M is rearranged by the permutation unit 3202 based on the selection value R and stored in the initial mask table. Since the initial mask is rearranged by the permutation unit 3201 that performs the reverse arrangement of the permutation unit 3202, the initial mask is in the same sequence as the mask value M on the input side. The masks match.
  • the non-linear transformations 3421 to 3424 are the original plaintext. Will be subjected to nonlinear transformation.
  • the permutation unit 3302 in FIG. 20 rearranges the output Y of the nonlinear conversion unit 3400 based on the selection value R (step B8).
  • the rearrangement performed by the permutation unit 3302 is opposite to the rearrangement of the permutation unit 3301.
  • the data order can be returned to the order before being input to the permutation unit 3301.
  • the arrangement of the mask applied to the data is rearranged.
  • the ShiftRows calculation unit 3501 performs ShiftRows calculation on the rearranged nonlinear transformation results (step B9).
  • the MixColumns computing unit 3502 performs MixColumns computation on the result of the ShiftRows computation (step B10).
  • the key calculation unit 3601 calculates the exclusive OR of the output of the MixColumns calculation unit 3502 and the round key sent from the key generation unit 2000, and outputs the calculation result (step B11).
  • the calculation result is stored in the register 3200.
  • the selection unit 3700 updates the current selection value R to the next selection value R ′ according to the table shown in FIG. 28, for example (step B12).
  • step B13 After the processing in the key calculation unit 3601 and the selection unit 3700 in FIG. 20, it is determined whether or not the round processing has been repeated nine times (final round processing start) (step B13).
  • step B6 If the result of this determination is that round processing has not been completed for the specified number of times (9 rounds), the process returns to step B6 and the round processing is repeated again.
  • step B14 the process proceeds to step B14 as the final round process.
  • the permutation unit 3301 rearranges the results of the key calculation unit 3601 (step B6).
  • the non-linear conversion unit 3400 performs non-linear conversion on the rearranged data string and outputs a conversion result (step B7).
  • the permutation unit 3302 rearranges the transformation results of the nonlinear transformation unit 3400 based on the selection value R, and outputs the rearranged results (step B8).
  • the ShiftRows calculation unit 3501 performs ShiftRows calculation on the rearranged nonlinear transformation results (step B9).
  • the MixColumns computing unit 3502 performs MixColumns computation on the result of the ShiftRows computation (step B10).
  • the key calculation unit 3601 calculates the exclusive OR of the output of the MixColumns calculation unit 3502 and the round key sent from the key generation unit 2000, and outputs the calculation result (step B11).
  • the calculation result is stored in the register 3200.
  • the selection unit 3700 updates the current selection value R to the next selection value R ′ according to the table shown in FIG. 28, for example (step B12).
  • step B12 When the round process has been performed a specified number of times, the process proceeds from step B12 to step B13.
  • steps B6-1, B7-1, B8-1, B9-1 and B11-1 are performed in the same manner as steps B6, B7, B8, B9 and B11 described above.
  • step B10 is not performed.
  • the unmask calculation unit 3302 calculates an exclusive OR of the processing result of the key calculation unit 3601 and the unmask indicated by the selection value R from the unmask table shown in FIG.
  • the operation result is output as ciphertext (step B14).
  • the unmask is equivalent to a value obtained by converting the output side mask value N in the non-linear conversion unit 3400 by the ShiftRows calculation unit 3501 to a value obtained by performing a cyclic shift with the selection value R in the permutation unit 3302.
  • the mask applied to the processing result of the key calculation unit 3601 can be released, and the encryption You can get a sentence.
  • ciphertext C is output and the process ends (step B15).
  • FIGS. 38A to 41B show data transitions in the comparative example AES128.
  • FIG. 42 shows a circuit configuration of the AES encryption unit of the comparative example.
  • FIG. 43 shows the configuration of the non-linear converter 3401 of FIG.
  • the nonlinear conversion unit 3401 of FIG. 43 includes 16 nonlinear conversion tables without a mask.
  • Ciphertext ⁇ 3925841d02dc09fbdc118597196a0b32 ⁇
  • the initial mask table is shown in FIG. 26, and the unmask table is shown in FIG.
  • the selection value R in the selection unit 3700 is updated based on the table of FIG.
  • Example 2 An encryption processing circuit when 3D encryption is used as encryption will be described as a second embodiment.
  • the 3D cipher has an algorithm structure that uses AES encryption processing, and AES uses 16 bytes (128 bits) of 4x4 as the processing unit, while 3D ciphers have 3 bytes of 4x4x4 64 bytes (512 bits).
  • a dimension block is used as a processing unit.
  • an AES-like process and a three-dimensional round function are added to this block (Non-Patent Document 6).
  • the data format handled by 3D encryption is shown in the following formula (2).
  • a 4x4x4 64-byte (512-bit) 3D block is a data block.
  • the 1st to 16th bytes are the 1st slice
  • the 17th to 32nd bytes are the 2nd slice
  • the 33rd to 48th bytes are the 3rd slice
  • the 49th to 64th bytes are the 4th slice.
  • FIG. 44 is a diagram showing a configuration (reference example) of an encryption circuit for 3D encryption.
  • the encryption circuit for 3D encryption includes a register 4200, a nonlinear conversion unit 4401, a diffusion function unit ( ⁇ ) 4501, a maximum distance separation matrix unit ( ⁇ ) 4502, and key operation units (AddRoundKey) 4601 and 4602.
  • the non-linear conversion unit 4401 performs non-linear conversion on the input value X and outputs the conversion result as an output value Y.
  • FIG. 45 is a diagram illustrating a configuration of the non-linear conversion unit 4401.
  • the non-linear conversion unit 4401 includes 64 non-linear conversion tables ( ⁇ ) 4421 to 4424. In the non-linear conversion tables ( ⁇ ) 4421 to 4424, non-linear conversion similar to the AES SBOX (SubstitutionBox) is performed.
  • the diffusion function unit ( ⁇ ) 4501 performs a diffusion process on the output value Y of the nonlinear conversion unit 4401 and outputs the processing result to the maximum distance separation matrix unit ( ⁇ ) 4502.
  • the diffusion function part ( ⁇ ) 4501 performs diffusion processing according to the diffusion function ⁇ 1 or ⁇ 2. Note that diffusion is performed by ⁇ 1 in the odd-numbered round, and diffusion by ⁇ 2 is performed in the even-numbered round.
  • ⁇ 1 is a process for performing ShiftRows in each slice.
  • ⁇ 2 is a 4 ⁇ 4 matrix obtained by combining the 4 bytes of the first column of each slice, and performs ShiftRows on the matrix.
  • An example of applying ⁇ 1 and ⁇ 2 to X is shown in the following equations (3) and (4).
  • the maximum distance separation matrix section ( ⁇ ) 4502 calculates the product of each slice of the processing result of the diffusion function section ( ⁇ ) 4501 and the 4 ⁇ 4 maximum distance separation matrix (MDS). As an example of the calculation performed in the maximum distance separation matrix part ( ⁇ ) 4302, the calculation of the first slice X1 of X is shown in the following equation (5).
  • Round key addition units (AddRoundKey) 4601 and 4402 calculate the processing result of the maximum distance separation matrix unit ( ⁇ ) 4502 and the exclusive OR of the plaintext and the 512-bit round key, and output the calculation result.
  • FIG. 46 is a flowchart for explaining the operation of the reference example of FIG. The operation of the reference example will be described with reference to FIGS.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 and the secret key is input to the key generation unit 2000 (step C1).
  • the key calculation unit 4602 calculates an exclusive OR of the plaintext and the round key Ki (step C2).
  • steps C3 to C7 are performed as round processing.
  • the nonlinear conversion unit 4400 performs nonlinear conversion of the output result of the key calculation unit 4601 or 4602 (step C3).
  • the nonlinear conversion unit 4400 internally divides the input value to the nonlinear conversion unit 4400 for each byte, and performs nonlinear conversion using the nonlinear conversion tables ( ⁇ ) 4421 to 4424.
  • the diffusion function part ( ⁇ ) 4501 determines whether or not it is an odd-numbered round (step C4).
  • a diffusion process is performed on the output of the nonlinear conversion unit 4401 with the diffusion function ⁇ 1 (step C5-1).
  • the diffusion process is performed on the output of the nonlinear conversion unit 4401 with the diffusion function ⁇ 2 (step C5-2).
  • the maximum distance separation matrix part ( ⁇ ) 4502 calculates the output of the diffusion function part ( ⁇ ) 4501 and the MDS matrix ⁇ (step C6).
  • the key calculation unit 4601 calculates an exclusive OR of the calculation result of the maximum distance separation matrix unit ( ⁇ ) 4502 and the round key generated by the key generation unit 2000 (step C2).
  • step C7 After the calculation by the key calculation unit 4601, it is determined whether or not the current round is the 21st round (next is the final round) (step C7).
  • next round is not the final round, return to step C3 and repeat the round process. If the next round is the final round, go to Step C3-1.
  • step C3-1 nonlinear conversion processing
  • diffusion processing ⁇ 2 step C5-2
  • processing in the key calculation unit 4601 step C2
  • step C8 the result of the key calculation unit 4601 is output as ciphertext and the process ends.
  • FIG. 47 is a diagram illustrating the configuration of the encryption unit according to the second embodiment. 44 is different from the circuit configuration of the 3D encryption unit in FIG. 44 in that an initial mask calculation unit 4101 for mask calculation, an unmask calculation unit 4102 and permutation units 4301 to 4302, a selection unit 4700, and a random number generation unit 4800. And a non-linear conversion unit 4400 including non-linear conversion tables ( ⁇ 1 to ⁇ 64) 4411 to 4414 with masks in place of the non-linear conversion unit 4401 of FIG.
  • the initial mask calculation unit 4101 calculates an exclusive OR of the initial mask and the input data
  • the unmask calculation unit 4102 calculates the exclusive OR of the unmask and the input data.
  • the permutation units 4301 and 4302 rearrange the input data based on the selected value. Note that the permutation unit 4302 performs the reverse sorting of the permutation unit 4301.
  • Non-linear conversion unit 4400 performs non-linear conversion of input data.
  • the nonlinear converter 4400 includes 64 masked nonlinear conversion tables ( ⁇ 1 to ⁇ 64) 4411 to 4414.
  • the non-linear conversion unit 4400 divides the input value into 64 pieces of data for each byte, and performs non-linear conversion processing using masked non-linear conversion tables ( ⁇ 1 to ⁇ 64) 4411 to 4414, respectively.
  • FIG. 48 is a diagram illustrating a configuration of the nonlinear conversion unit 4400.
  • the non-linear conversion table ( ⁇ 1) 4411 performs non-linear conversion with the non-linear conversion table ⁇ on the value obtained by exclusive ORing the 1-byte input value and the mask m 1, and sets the mask n 1 to the non-linear conversion result.
  • the value obtained by exclusive OR is taken as the output value.
  • FIG. 49 shows the configuration of the nonlinear converter 4400.
  • FIG. 49 is a diagram showing the input / output relationship of each of the nonlinear conversion tables 4411 to 4414 in FIG.
  • Example 2 The mask value of Example 2 will be described.
  • the spreading process changes between odd and even rounds, so a countermeasure is required.
  • the first countermeasure is a method of switching the non-linear conversion unit between odd and even rounds. Two combinations of mask values are prepared, and two nonlinear conversion units are prepared accordingly.
  • the output values of the non-linear converters 4400A and 4400B are selected by the selector 4450, the output value of 4400A is selected during the odd round, and the output value of 4400B is selected during the even round (FIG. 50).
  • either the input side or output side mask can be set arbitrarily.
  • Either the input side mask Ma of the nonlinear selection unit 4400A and the input side mask Mb of 4400B are arbitrarily set, or conversely, the output side mask Na of the nonlinear selection unit 4400A and the output side mask Nb of 4400B are arbitrarily set.
  • Either combination can be set arbitrarily.
  • the input side mask Ma of the non-linear selection unit 4400A is permutation unit 4302 with respect to Nb in the previous even round. It is assumed that permutation by, diffusion processing by ⁇ 2, arithmetic processing by MDS matrix ⁇ , and permutation by permutation unit 4301 are performed.
  • the input side mask Mb of the non-linear transformation unit 4400B sets the selection value R of the previous even number round and the selection value R ′ of the next odd number round, and then permutates the Na with respect to Na in the previous even number round. It is assumed that permutation by 4302, diffusion processing by ⁇ 1, calculation processing by MDS matrix ⁇ , and permutation by permutation unit 4301 are performed.
  • Mb-A that is calculated during the odd-numbered rounds can be canceled by the non-linear selection unit 420B of the next even-numbered round.
  • the permutation unit 4301 performs the reverse of the rearrangement for each selection value with respect to Ma.
  • the second countermeasure is to set a mask so that the result is the same regardless of which of ⁇ 1 and ⁇ 2 is performed on N.
  • a setting method first, the selection value R of the current round and the selection value R ′ of the next round are set. Next, an arbitrary value is set in the output side mask N1 of the 1st to 16th bytes corresponding to the first slice.
  • the output side mask N2 of the 17th to 32nd bytes of the second slice is obtained by cyclically shifting N1 by 12 bytes.
  • the output side mask N3 in the 33rd to 48th bytes of the third slice is obtained by cyclically shifting N1 by 8 bytes.
  • Fig. 51 shows the input side mask M set by the above method.
  • Permutation applicable to 3D encryption includes rearrangement in three steps.
  • cyclic shift is performed for each slice. This means that the entire data is cyclically shifted by a multiple of 16 bytes.
  • cyclic shift of multiples of 4 bytes is performed within each slice.
  • the cyclic shift of 0, 4, 8, 12 bytes in the 1st to 16th bytes, and the cyclic shift of 0, 4, 8, 12 bytes in the 17th to 32nd bytes I will go.
  • the other two slices are cyclically shifted to 0, 4, 8, or 12 bytes.
  • the third step there is a method in which the 1st to 4th bytes are arranged in the first row and the 5th to 8th bytes are arranged in units of 4 bytes and the second row, and the same cyclic shift is performed inside each row.
  • FIG. 52A and FIG. 52B are diagrams showing permutation by the above three steps.
  • 53A and 53B are flowcharts for explaining the operation of the second embodiment. 46 is different from the comparative example in FIG. 46 in that steps C9 to 15 and C12-1 are added, and steps C3 and C3-1 in FIG. 46 are changed to non-linear transformation with a mask (step C3-2). It is a point.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 and the secret key is input to the key generation unit 2000 (step C1).
  • the random number generation unit 4800 generates a random number and outputs it to the selection unit 4700 (step C9).
  • the selection unit 4700 determines the selection value from the random number and outputs the selection value (step C10).
  • the initial mask calculation unit 4101 selects an initial mask based on the selection value from the initial mask table 1111 in FIG. 3, and calculates an exclusive OR of the plaintext and the initial mask.
  • the plaintext is masked by this exclusive OR operation (addition operation) (step C11).
  • the plain text with the mask is stored in the register 4200.
  • the key calculation unit 4601 calculates an exclusive OR of the plaintext and the round key Ki (step C2).
  • steps C12 to C7 are performed as round processing.
  • the permutation unit 4301 in FIG. 47 rearranges the data string based on the selection value (step C12).
  • the nonlinear conversion unit 4400 performs nonlinear conversion on the output value of the permutation unit 4301 and outputs a nonlinear conversion output (step C3-2).
  • the nonlinear conversion unit 4400 divides the output value of the permutation unit 4301 into 64, and x1 to x64 are input to the nonlinear conversion tables ⁇ 1 to ⁇ 64) 4411 to 4414.
  • These non-linear conversion tables are non-linear conversion tables with a mask.
  • the result of the non-linear conversion table ( ⁇ 1) 4411 is obtained by calculating an exclusive OR of x1 and m 1 , performing non-linear conversion on the operation result by non-linear conversion ⁇ ( ⁇ ), and exclusive of n 1 with the result of non-linear conversion.
  • the result is a logical sum.
  • the permutation unit 4302 rearranges the outputs of the nonlinear conversion unit 4400 based on the selected value (step C13).
  • the rearrangement performed by the permutation unit 4302 is reverse to the permutation unit 4301.
  • the data order can be returned to the order before being input to the permutation unit 4301.
  • the arrangement of the mask applied to the data is rearranged.
  • the diffusion function part ( ⁇ ) 4501 determines whether or not it is an odd-numbered round (step C4).
  • the diffusion process is performed on the output of the nonlinear conversion unit 4400 with the diffusion function ⁇ 1 (step C5-1).
  • the diffusion process is performed on the output of the nonlinear conversion unit 4400 with the diffusion function ⁇ 2 (step C5-2).
  • the maximum distance separation matrix part ( ⁇ ) 4502 calculates the output of the diffusion function part ( ⁇ ) 4501 and the MDS matrix ⁇ (step C6).
  • the key calculation unit 4600 calculates an exclusive OR of the calculation result of the maximum distance separation matrix unit ( ⁇ ) 4502 and the round key generated by the key generation unit 2000 (step C2).
  • the selection unit 4700 updates the selection value (step C14).
  • step C7 After the calculation by the key calculation unit 4600 and the update of the selected value, it is determined whether or not the current round is the 21st round (next is the final round) (step C7).
  • next round is not the final round, return to Step C12 and repeat the round process.
  • the process proceeds to Step C12-1.
  • step C2 the operation with the MDS matrix ⁇ is skipped. Therefore, a non-linear transformation process with a mask (step C3-2), a diffusion process ⁇ 2 (step C5-2), and a key calculation (step C2) are performed.
  • step C2 a non-linear transformation process with a mask
  • step C5-2 a diffusion process ⁇ 2
  • step C2 a key calculation
  • the unmask calculation unit 4102 selects an unmask based on the selection value from the unmask table 1113 in FIG. 4, and calculates an exclusive OR of the output of the key calculation unit 4600, which is the result of the round processing, and the unmask.
  • the calculation result is output as ciphertext (step C15).
  • This exclusive OR with the unmask removes the mask applied to the round processing result and obtains the original ciphertext.
  • step C8 the result of the unmask operation unit 4102 is output as ciphertext and the process ends.
  • Example 3 An encryption processing circuit when TWINE is used as encryption will be described as a third embodiment.
  • TWINE has a structure that is an improvement over Generalized Feistel, and has a processing unit of 4 bits that divides 64-bit data into 16 sub-blocks. Of these sub-blocks, key values are given to only eight sub-blocks, and then converted by the F function, and the remaining eight sub-blocks are encrypted by exclusive OR operation (Non-patent Document 7). ).
  • FIG. 54 is a diagram showing the configuration (reference example) of the encryption unit of the encryption processing circuit of TWINE.
  • the TWINE encryption circuit includes a register 5200, eight F function units 5A01 to 5A04, eight exclusive OR operation units 5901 to 5904, and a linear conversion unit 5500.
  • the register 5200 stores the plaintext or the processing result (intermediate value) for each round.
  • FIG. 55 is a diagram illustrating a configuration of the F function unit 5A01.
  • the F function unit 5A01 of TWINE includes an exclusive OR operation unit 5411 that calculates exclusive OR with the round key ki1, and a non-linear conversion table 5421.
  • the F function unit 5A01 of TWINE first performs an exclusive OR operation between the 4-bit part (ki_1) of the round key and the input, and performs a nonlinear conversion S (•) on the operation result using the nonlinear conversion table 5421.
  • the exclusive OR operation unit 5901 in FIG. 54 performs an exclusive OR operation between the output of the F function unit 5A01 and one of the sub-blocks stored in the register 5200.
  • the linear conversion unit 5500 performs linear conversion on the eight sub-blocks stored in the register 5200 and the results of the exclusive OR operation units 5901 to 5904.
  • FIG. 56 shows processing of the linear conversion unit 5500. In FIG. 56, the linear conversion unit 5500 performs only replacement of 16 sub-blocks.
  • FIG. 57 shows a circuit equivalently modified from the circuit of FIG.
  • the plaintext is first divided into two and stored in registers 5201 and 5202, respectively.
  • the plaintext is first divided into 16 sub-blocks, and the odd-numbered (1, 3,..., 15) data among the divided sub-blocks is sent to the register 5201 and the even-numbered (2, 4,. .., 16) is stored in the register 5202.
  • the order of the divided data is restored and output.
  • the data is divided into two series.
  • One of the divided series is processed by the key calculation unit 5600 and the nonlinear conversion unit 5401, and the result of processing by the exclusive OR calculation unit 5900 and the other series Calculate the exclusive OR of.
  • the result of the exclusive OR operation unit 5900 is linearly converted by the linear conversion unit 5501, and the conversion result is stored in the register 5201.
  • the data stored in the register 5201 is linearly converted by the linear conversion unit 5502 and stored in the register 5202.
  • FIG. 58 is a diagram showing a configuration of the key calculation unit 5600 of FIG.
  • the key calculation unit 5600 includes eight exclusive OR calculation units 5611 to 5614.
  • Key operation unit 5600 divides the input and round key into 8 sub-blocks, and performs an exclusive OR operation for each sub-block.
  • FIG. 59 is a diagram showing a configuration of the nonlinear converter 5401 in FIG.
  • the non-linear conversion unit 5401 includes eight non-linear conversion tables 5421 to 5424 shown in FIG.
  • the non-linear conversion unit 5401 divides the input into eight sub-blocks, and performs non-linear conversion using the non-linear conversion tables 5421 to 5424 for each sub-block.
  • 60 and 61 are diagrams showing the configuration of the linear conversion units 5501 and 5502 in FIG. While the linear conversion unit 5500 in FIG. 56 performs replacement of 16 subblocks, the linear conversion units 5501 and 5502 in FIGS. 60 and 61 perform replacement of 8 subblocks.
  • FIG. 62 is a flowchart for explaining the operation of TWINE in FIG. The operation of TWINE will be described with reference to FIGS.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 and the secret key is input to the key generation unit 2000 (step D1).
  • the plaintext input to the encryption unit 1000 is divided into 16 sub-blocks. Of the divided plaintexts, the odd-numbered 8 sub-blocks are stored in the register 5201 and the remaining half is stored in the register 5202.
  • steps D2 to D6 are performed as round processing.
  • the key calculation unit 5600 calculates the exclusive OR of the data of the eight sub-blocks stored in the register 5201 and the round key (step D2).
  • the non-linear conversion unit 5401 performs non-linear conversion of the output result of the key calculation unit 5600 (step D3).
  • the non-linear conversion unit 5401 internally divides the input value to the non-linear conversion unit 5401 into eight sub-blocks, and performs non-linear conversion using the non-linear conversion tables 5421 to 5424.
  • the exclusive OR operation unit 5900 calculates the exclusive OR of the output result of the non-linear conversion unit 5401 and the data of the eight sub-blocks stored in the register 5202 (step D4).
  • the linear conversion unit 5501 performs linear conversion of the output result of the exclusive OR operation unit 5900, and the linear conversion unit 5502 performs linear conversion of the data of the eight sub-blocks stored in the register 5201 (step D5 ).
  • the output result of the linear conversion unit 5501 is stored in the register 5201, and the output result of the linear conversion unit 5202 is stored in the register 5202.
  • step D6 After the processing in the linear conversion units 5501 and 5502, it is determined whether or not the current round is the 35th round (next is the final round) (step D6).
  • step D2 If the next round is not the final round, return to step D2 and repeat the round process. If the next is the final round, the process proceeds to step D2-1.
  • step D7 the data of the eight sub-blocks stored in the register 5201 and the output result of the exclusive OR operation unit 5900 are integrated, and the integration result is output as ciphertext and the process ends (step D7).
  • FIG. 63 is a diagram illustrating the configuration of the encryption unit according to the third embodiment.
  • 57 is different from the circuit configuration of the encryption unit of TWINE in FIG. 57 in that an initial mask calculation unit 5101 for mask calculation at the start of encryption processing, an unmask calculation unit 5102 performed before ciphertext output, a permutation unit 5301, and 5302, a selection unit 5700 and a random number generation unit 5800 are added, and a non-linear conversion unit 5400 including eight non-linear conversion tables 5411 to 5414 with masks is provided instead of the non-linear conversion unit 5401 of FIG. It is.
  • the initial mask calculation unit 5101 includes an initial mask table 1111 and an exclusive OR calculation unit 1112, and an exclusive logic between the initial mask selected by the selected value and the plaintext. Calculate the sum.
  • the unmask operation unit 5102 includes an unmask table 1113 and an exclusive OR operation unit 1114, and calculates an exclusive OR of the unmask selected by the selected value and the input data. To do.
  • the permutation units 5301 and 5302 rearrange the input data based on the selected value. Note that the permutation unit 5302 performs the reverse sorting of the permutation unit 5301.
  • the non-linear conversion unit 5400 includes a plurality of non-linear conversion tables with a mask, similar to the non-linear conversion unit 1400 of FIGS.
  • FIG. 64 is a diagram illustrating a configuration of the nonlinear conversion unit 5400.
  • the third embodiment includes eight masked nonlinear conversion tables 5411 to 5414.
  • the nonlinear conversion unit 5400 divides the input value into 8 blocks in units of 4-bit sub-blocks, and performs nonlinear conversion processing using the masked nonlinear conversion tables 5411 to 5414, respectively.
  • FIG. 64 is a diagram showing the input / output relationship of each of the nonlinear conversion tables 5411 to 5414 in FIG.
  • the mask value obtained by combining the masks m 1 to m 8 arranged on the input side of the nonlinear conversion tables 5421 to 5424 is M, and the mask value obtained by combining the masks n 1 to n 8 arranged on the output side. Is N.
  • the selection unit 5700 updates the selection value sv every time round processing ends.
  • the method exemplified in the first embodiment can be used as the method for updating the selected value.
  • the selected value is updated by a method of reading the next selected value sv ′ from the table using the current selected value sv.
  • the selection value of the selection unit 5700 is sv
  • the rearrangement of the second permutation unit 5302 is P2sv (•)
  • the linear conversion of the linear conversion unit 5501 is L1 (•)
  • the selection value is sv ′.
  • the permutation part 5301 of 1 is P1sv ′ ( ⁇ )
  • the selection part 5700 has the selection value sv.
  • the initial mask ML relating to the data stored in the register 5201 becomes equal to the input side mask M of the non-linear conversion table by rearranging with any of the rearrangement patterns that the permutation unit 5301 can take.
  • the initial mask ML at the time of the selection value sv is MLsv
  • the rearrangement of the first permutation unit 5301 at the time of the selection value sv is P1sv ( ⁇ ), which satisfies the following relationship.
  • P1sv (MLsv) M
  • the initial mask MR relating to the data stored in the register 5202 assumes that the next selection value is sv ′ when the selection value sv of the selection unit 5700 is present, and the initial mask MR at the selection value sv ′ is MRsv.
  • MRsv ' L2 (MLsv)
  • the data stored in the register 5201 is masked according to the selection value sv of the selection unit 5700 during the round process, and the mask is equal to the initial mask MLsv.
  • the data stored in the register 5202 is also masked according to the selection value sv of the selection unit 5700 during the round process, and the mask is equal to the initial mask MRsv.
  • the unmasked UL that is calculated with the intermediate value stored in the register 5201 is equal to the input side mask M of the nonlinear conversion table by rearranging with any of the rearrangement patterns that the permutation unit 5301 can take.
  • the unmask UL for the selection value sv is ULsv
  • the initial mask for the intermediate value of the register 5201 is MLsv
  • the first permutation unit 5301 for the selection value sv The following relation is satisfied with P1sv (•) as the rearrangement of.
  • the unmask UR in which the calculation with the result of the exclusive OR operation unit 5900 is applied to the unmask UR when the selection value sv is URsv and the intermediate value of the register 5202
  • the initial mask is MRsv
  • the output side mask of the nonlinear transformation unit 5400 is N
  • the rearrangement of the second permutation unit 5302 is P2sv ( ⁇ ), which satisfies the following relationship.
  • URsv P2sv (N) (XOR) MRsv
  • FIG. 66 shows an example of P1sv (•) and P2sv (•) of the permutation units 5301 and 5302 in the third embodiment.
  • FIG. 67 shows an example of the input side mask M and the output side mask N of the nonlinear conversion unit 5400
  • FIG. 68 shows an example of the selection value sv update table in the selection unit 5700.
  • M and N indicate the mask values in the eight masked nonlinear conversion tables.
  • MLsv indicates a mask for data stored in the register 5201 when the first selection value is sv.
  • MRsv indicates a mask for data stored in the register 5202 when the first selection value is sv.
  • ULsv indicates an unmask used to cancel the mask applied to the data stored in the register 5201 when the selection value in the 36th round is sv.
  • URsv indicates an unmask used for canceling the mask applied to the output of the exclusive OR operation unit 5900 when the selection value in the 36th round is sv.
  • FIG. 68 is a table showing the number of selection values sv ′ for the next round when the selection value for the current round is sv.
  • 69A and 69B are flowcharts for explaining the operation of the third embodiment shown in FIG. 62 is different from the flowchart in FIG. 62 in that steps D8 to D14 are added and step D3 in FIG. 62 is changed to non-linear transformation with a mask (step D3-1).
  • the operation of the third embodiment will be described with reference to FIGS. 63, 69A and 69B.
  • the plaintext and the secret key are input to the encryption processing circuit, and the plaintext is input to the encryption unit 1000 and the secret key is input to the key generation unit 2000 (step D1).
  • the random number generation unit 5800 generates a random number and outputs it to the selection unit 5700 (step D8).
  • the selection unit 5700 determines the selection value from the random number and outputs the selection value (step D9).
  • the initial mask calculation unit 5101 selects an initial mask based on the selected value from the initial mask table 1111 in FIG. 3, and calculates an exclusive OR of the plaintext and the initial mask.
  • the plaintext is masked by this exclusive OR operation (step D10).
  • the masked plaintext is divided into 16 sub-blocks, and the odd-numbered 8 sub-blocks of the divided plaintext are stored in the register 5201 and the remaining half are stored in the register 5202.
  • steps D2 to D6 are performed as round processing.
  • the key calculation unit 5600 calculates the exclusive OR of the data of the eight sub-blocks stored in the register 5201 and the round key (step D2).
  • the permutation unit 5301 sorts the output of the key calculation unit 5600 based on the selection value output from the selection unit 5700 (step D11).
  • the nonlinear conversion unit 5400 performs nonlinear conversion of the output result of the permutation unit 5301 (step D3-1).
  • the nonlinear conversion unit 5400 internally divides the input value to the nonlinear conversion unit 5401 into eight sub-blocks, and performs nonlinear conversion using the masked nonlinear conversion tables 5411 to 5414.
  • the non-linear conversion table (S1) 5411 the 4-bit input value x 1 and the mask m 1 are calculated by exclusive OR, the non-linear conversion is performed on the calculation result by the non-linear conversion table (S) 5421, and the non-linear conversion result is obtained.
  • a value obtained by exclusive OR with the mask n 1 is output.
  • the permutation unit 5302 rearranges the outputs of the nonlinear conversion unit 5400 based on the selection value output from the selection unit 5700 (step D12).
  • the rearrangement performed by the permutation unit 5302 is reverse to the permutation unit 5301.
  • the data order can be returned to the order before being input to the permutation unit 5301.
  • the arrangement of masks on the data is rearranged.
  • the exclusive OR operation unit 5900 calculates an exclusive OR of the output result of the permutation unit 5302 and the data of the eight sub-blocks stored in the register 5202 (step D4).
  • the linear conversion unit 5501 performs linear conversion of the output result of the exclusive OR operation unit 5900, and the linear conversion unit 5502 performs linear conversion of the data of the eight sub-blocks stored in the register 5201 (step D5 ).
  • the output result of the linear conversion unit 5501 is stored in the register 5201, and the output result of the linear conversion unit 5202 is stored in the register 5202.
  • the selection unit 5700 updates the selection value (step D13).
  • step D6 After the selection value is updated, it is determined whether or not the current round is the 35th round (the next is the final round) (step D6).
  • step D2 If the next round is not the final round, return to step D2 and repeat the round process. If the next is the final round, the process proceeds to step D2-1.
  • step D4 the key calculation unit 5600 (step D2-1), the permutation unit 5301 (step D11), the nonlinear transformation unit 5400 (step D3-1), the permutation unit 5302 (step D12), and the exclusive OR calculation unit
  • the processing at 5900 (step D4) is performed.
  • the round process ends here.
  • data of eight sub-blocks stored in the register 5201 and an output result of the exclusive OR operation unit 5900 are obtained.
  • the unmask calculation unit 5102 selects an unmask based on the selection value from the unmask table 1113 in FIG. 4, the selected unmask, the data of the eight subblocks stored in the register 5201, and An exclusive OR with the data obtained by integrating the output results of the exclusive OR calculating unit 5900 is calculated (step D14).
  • step D7 the calculation result of the unmask calculation unit 5102 is output as ciphertext and the process ends.
  • the encryption processing circuits of the first and second embodiments and the first, second, and third embodiments can be realized by hardware, software, or a combination thereof.
  • the encryption processing method performed by the above-described encryption processing circuit and other devices can also be realized by hardware, software, or a combination thereof.
  • “realized by software” means realized by a computer reading and executing a program.
  • the program can be stored and provided to a computer using various types of non-transitory computer readable media.
  • Non-transitory computer readable media include various types of tangible storage media.
  • non-transitory computer-readable media examples include magnetic recording media (for example, flexible disks, magnetic tapes, hard disk drives), magneto-optical recording media (for example, magneto-optical disks), CD-ROM (Read Only Memory), CD-R, CD-R / W, semiconductor memory (for example, mask ROM, PROM (Programmable ROM), EPROM (Erasable PROM), flash ROM, RAM (random access memory)) are included.
  • the program may also be supplied to the computer by various types of transitory computer readable media. Examples of transitory computer readable media include electrical signals, optical signals, and electromagnetic waves.
  • the temporary computer-readable medium can supply the program to the computer via a wired communication path such as an electric wire and an optical fiber, or a wireless communication path.
  • the encryption processing circuit has been described.
  • the decryption processing circuit (that is, the decryption processing circuit) may have the same configuration as the encryption processing circuit. it can.
  • the decryption process is a process for returning a ciphertext to a plaintext, contrary to the encryption process. In this case, “encryption” is replaced with “decryption”.
  • FIG. 70 is a diagram illustrating the configuration of the decoding processing circuit according to the first embodiment of the present invention.
  • “encryption unit 1000” in FIG. 1 is replaced with “decryption unit 6000”.
  • “ciphertext” is input and “plaintext” is output in FIG.
  • the encryption unit in FIG. 2 is replaced with a decryption unit.
  • FIG. 71 is a diagram showing the configuration of the decoding unit 6000.
  • the operation in the decoding unit will be described with reference to FIG. In FIG. 71, the ciphertext is input and the processing result is output as plaintext.
  • the ciphertext encrypted in the first embodiment is input to the decryption unit, unmasked by the unmask operation unit 6102 in the decryption unit, and stored in the register 6200. Thereafter, as round processing, the key calculation unit 6600 performs addition (equivalently subtraction) with the round key Ki, and the calculation result is linearly converted by the linear conversion unit 6500.
  • the linear transformation unit 6500 in the decryption unit is an inverse transformation L ⁇ 1 ( ⁇ ) with respect to the linear transformation L ( ⁇ ) in the encryption unit.
  • the result of inverse transformation by the linear transformation unit 6500 is rearranged by the permutation unit 6302.
  • the rearrangement in the permutation unit 6302 is opposite to the rearrangement in the permutation unit 1302 of the encryption unit.
  • the rearranged result is divided into t pieces and input to the tables (S1 to St) of the nonlinear conversion unit 6400.
  • the table (S1 to St) in the decryption unit is the input and output of the table (S1 to St) in the encryption unit are reversed (the table output in the encryption unit is the input (table index), and the table in the encryption unit) Is the output value corresponding to the table index).
  • the mask N on the output side of the table in the encryption unit is used as the mask on the input side
  • the mask M on the input side of the table in the encryption unit is used as the mask on the output side.
  • the permutation unit 6301 rearranges the results converted by the nonlinear conversion unit 6400.
  • the rearrangement in the permutation unit 6301 is opposite to the rearrangement in the permutation unit 1301 of the encryption unit.
  • the selection value is updated in the opposite way to the encryption unit.
  • the selection value sv is updated to sv ′ in the next round in the encryption unit
  • the selection value sv ′ is updated in the next round in the decryption unit. Then the value is updated to sv.
  • FIG. 72 is a diagram illustrating the configuration of the decoding unit according to the second embodiment of the present invention.
  • the ciphertext is input and the processing result is output as plaintext.
  • the ciphertext encrypted in the second embodiment is input to the decryption unit, unmasked by the unmask operation unit 7102 in the decryption unit, and divided and stored in registers 7201 and 7202. Thereafter, as round processing, processing by the key calculation unit 7600, permutation unit 7302, nonlinear transformation unit 7400, permutation unit 7301, and linear transformation unit 7500 is performed.
  • the key calculation unit 7600 adds (equivalently subtracts) the value stored in the register 7201 and the round key Ki.
  • Permutation section 7302 rearranges the calculation results of key addition section 7600 according to the selected value.
  • the rearrangement in the permutation unit 7302 is opposite to the rearrangement in the permutation unit 1302 of the encryption unit.
  • the rearranged result is divided into t pieces and input to the tables (S1 to St) of the nonlinear conversion unit 7400.
  • the table (S1 to St) in the decryption unit is the input and output of the table (S1 to St) in the encryption unit are reversed (the table output in the encryption unit is the input (table index), and the table in the encryption unit) Is the output value corresponding to the table index).
  • the mask N on the output side of the table in the encryption unit is used as the mask on the input side
  • the mask M on the input side of the table in the encryption unit is used as the mask on the output side.
  • the permutation unit 7301 rearranges the results converted by the nonlinear conversion unit 7400.
  • the rearrangement in the permutation unit 7301 is opposite to the rearrangement in the permutation unit 1301 of the encryption unit.
  • the result of rearrangement by the permutation unit 7301 is linearly converted by the linear conversion unit 7500.
  • the linear transformation unit 7500 in the decryption unit is an inverse transformation L ⁇ 1 ( ⁇ ) with respect to the linear transformation L ( ⁇ ) in the encryption unit.
  • the exclusive OR operation unit 7A00 obtains an exclusive OR of the result of inverse conversion by the linear conversion unit 7500 and the value stored in the register 7202.
  • the result of the exclusive OR operation unit 7A00 is stored in the register 7201, and the intermediate value stored in the register 7201 in the previous round is stored in the register 7202.
  • the initial mask calculation unit 7101 calculates the initial mask for the result of the exclusive OR calculation unit 7A00 and the value stored in the register 7201. As a result, the mask is released and the processing result is output as plain text.
  • the selection value is updated in the opposite way to the encryption unit. When the selection value sv is updated to sv ′ in the next round in the encryption unit, the selection value sv ′ is updated in the next round in the decryption unit. Then the value is updated to sv.
  • the correlation between the intermediate value and the power consumption can be reduced by masking, and the tamper resistance is improved by adding the mask data to the intermediate value by exclusive OR. be able to.
  • a selection unit that sets a random number as an initial value of the selection value, and updates the next selection value every time round processing ends, An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, an exclusive OR is performed between the selected initial mask value and the input plaintext, and an initial value of the input data string
  • An initial mask calculator to A first permutation unit for rearranging the pattern corresponding to the selection value from the selection unit for the calculation result based on the input data string and the round key, and outputting the rearranged result;
  • a non-linear transformation unit including a plurality of tables each for non-linear transformation of a value obtained by dividing the output of the first permutation unit into a plurality of values; A second reordering of the pattern opposite to the first permutation unit is performed on the data string obtained by combining a plurality of output values of the non-linear transformation unit according
  • the non-linear conversion unit performs non-linear conversion according to the table using a value obtained by exclusive ORing with an input-side mask value with respect to the input to the table, and outputs the non-linear converted value Output the value obtained by exclusive OR with the mask value on the side,
  • the round processing using the first permutation unit, the non-linear transformation unit, the second permutation unit, and the first linear transformation unit is performed a specified number of times,
  • a value based on the output of the first linear conversion unit is set as the input data string,
  • An unmask value corresponding to the selection value from the selection unit is selected from a plurality of unmask values, and an exclusive OR is performed between the selected unmask value and the processing result after the specified number of round processes.
  • An encryption processing circuit further comprising an unmask operation unit that outputs the encrypted text.
  • Each permutation part of the first and second permutation parts is: A result obtained by linearly transforming a data string with respect to the values rearranged in the permutation unit by the first linear transform unit; Results obtained by rearranging the data string by the permutation unit with respect to the result of linear conversion by the first linear conversion unit; 2.
  • the selection unit sets a rearrangement pattern of the first permutation unit so that a sequence of mask values applied to a data string matches a sequence of mask values on the input side of the nonlinear conversion unit.
  • the encryption processing circuit according to appendix 1 or 2, wherein the encryption processing circuit is selected.
  • the encryption processing circuit according to any one of appendices 1 to 3, wherein the first and second permutation units have a rearrangement pattern that satisfies the above relationship.
  • Appendix 5 The mask values on the output side of the non-linear transformation unit are rearranged in the second permutation unit, The values rearranged by the second permutation unit are linearly transformed by the first linear transformation unit, Supplementary note 1 characterized in that a value rearranged by the first permutation unit with respect to a result of linear transformation by the first linear transformation unit is used as a mask value on the input side of the nonlinear transformation unit. 5.
  • the encryption processing circuit according to any one of items 1 to 4.
  • the encryption processing circuit according to any one of appendices 1 to 3, characterized in that: (Appendix 7) When the selection value of the selection unit is the first value (sv), rearrangement of the second permutation unit is P2sv ( ⁇ ), linear transformation is L ( ⁇ ), and the remaining half of the series
  • the mask that is applied is MRsv
  • the selection value is the second value (sv ′)
  • the rearrangement of the first permutation unit is P1sv ′ (•)
  • the selection value of the selection unit has the first value (sv).
  • the first and second permutation units perform rearrangement by cyclic shifts of multiples of 4 bytes, and further form a column every 4 bytes, and perform rearrangement by the same cyclic shift in each column.
  • the encryption processing circuit according to any one of appendices 1 to 5, wherein the encryption processing circuit is performed.
  • the first and second permutation units are: In the first slice, rearrangement is performed by cyclic shift with a multiple of 4 bytes, and further, a column is formed every 4 bytes, and rearrangement is performed by the same cyclic shift in each column, In the second slice, rearrangement is performed by cyclic shift with the same multiple of 4 bytes as in the first slice, and further, a column is formed every 4 bytes, and the first slice in each column Sort by the same cyclic shift as In the third slice, rearrangement is performed by a cyclic shift with the same multiple of 4 bytes as in the first slice, and a column is formed every 4 bytes.
  • the first linear transformation unit performs a first linear transformation on an exclusive OR operation result of the processing result and the remaining half of the series, and first input data that is the half of the series Column, A second linear transformation unit that performs a second linear transformation on the first input data sequence and sets the second input data sequence as the remaining half of the series;
  • the selection value of the selection unit is the first value (sv)
  • the rearrangement of the second permutation unit is P2sv ( ⁇ )
  • the mask applied to the remaining half of the series is MRsv
  • the first linear transformation for the remaining half of the series is L1 ( ⁇ )
  • the selection value is the second value (sv ′)
  • the rearrangement of the first permutation unit is P1sv ′ (•)
  • the selection value of the selection unit has the first value (sv).
  • An encryption processing method by a data processing device A selection step of setting a random number as an initial value of the selection value, and updating to the next selection value every time round processing ends, An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, and an exclusive OR is performed between the selected initial mask value and the input value to obtain an initial value of the input data string.
  • An initial mask calculation process A first permutation step of rearranging the pattern corresponding to the selection value from the selection step for the calculation result based on the input data string and the round key, and outputting the rearranged result;
  • a non-linear transformation step for non-linear transformation of a plurality of values obtained by dividing the output value of the first permutation step into a plurality of tables;
  • a second rearrangement of the pattern opposite to the first permutation step is performed on a data string obtained by combining a plurality of output values of the nonlinear transformation step.
  • An encryption processing method further comprising: (Appendix 14) An encryption processing program for causing a data processing apparatus to execute encryption processing, A selection process in which a random number is set as an initial value of the selection value, and the round process is updated to the next selection value after each round; An initial mask value corresponding to the initial value of the selected value is selected from a plurality of initial mask values, and an exclusive OR is performed between the selected initial
  • Initial mask calculation processing A first permutation for performing a rearrangement of the pattern corresponding to the selection value from the selection process on the operation result based on the input data string and the round key, and outputting the rearranged result Processing, A non-linear transformation process that non-linearly transforms values obtained by dividing the output value of the first permutation process into a plurality of tables, respectively; In accordance with a selection value from the selection process, a second rearrangement of the pattern opposite to the first permutation process is performed on a data string obtained by combining a plurality of output values of the nonlinear conversion process.
  • Permutation processing A first linear transformation process for performing a linear transformation based on the output of the second permutation process; Including In the non-linear transformation process, non-linear transformation is performed according to the table using a value obtained by exclusive ORing with the mask value on the input side with respect to the input to the table, and the non-linear transformation value is output.
  • a selection unit that sets a random number as an initial value of the selection value, and updates the next selection value every time round processing ends, According to the selection value from the selection unit, an unmask value is selected from a plurality of unmask values, and the selected unmask value is exclusive-ORed with the ciphertext to be used as an initial value of the input data string An arithmetic unit; A first permutation unit for rearranging the pattern corresponding to the selection value from the selection unit for the calculation result based on the input data string and the round key, and outputting the rearranged result; A non-linear conversion unit including a plurality of tables that non-linearly convert values obtained by dividing the output value of the first permutation unit into a plurality of values, In accordance with a selection value from the selection unit, a second reordering of the pattern opposite to the first permutation unit is performed on a data string obtained by combining a plurality of output values of the nonlinear conversion unit.
  • the permutation section A linear conversion unit that performs linear conversion based on the output of the second permutation unit;
  • the non-linear conversion unit performs non-linear conversion according to the table using a value obtained by exclusive ORing with an input-side mask value with respect to the input to the table, and outputs the non-linear converted value Output the value obtained by exclusive OR with the mask value on the side,
  • the round process using the first permutation unit, the nonlinear transformation unit, the second permutation unit, and the linear transformation unit is performed a specified number of times, In the second and subsequent round processing, a value based on the output of the linear conversion unit is set as the input data string, An initial mask value is selected from a plurality of initial mask values in accordance with a selection value from the selection unit, and an exclusive OR of the selected initial mask value and a processing result after the specified number of round processes is completed.
  • a decoding processing circuit further comprising an initial mask calculating unit.
  • Appendix 16 A decoding processing method by a data processing device, A selection step of setting a random number as an initial value of the selection value, and updating to the next selection value every time round processing ends, According to the selection value from the selection step, an unmask value is selected from a plurality of unmask values, and the selected unmask value and the ciphertext are exclusive-ORed to obtain an initial value of the input data string A calculation process; A first permutation step of rearranging the pattern corresponding to the selection value from the selection step for the calculation result based on the input data string and the round key, and outputting the rearranged result; A non-linear transformation step including a plurality of tables each for non-linear transformation of values obtained by dividing the output value of the first permutation step into a plurality of values; In accordance with a selection value from the selection step, a second rearrangement of the pattern opposite to the first permutation step is performed on a data string
  • a decryption processing program for causing a data processing device to perform decryption processing, A selection process in which a random number is set as an initial value of the selection value, and the round process is updated to the next selection value after each round; According to the selection value from the selection process, an unmask value is selected from a plurality of unmask values, and the selected unmask value is exclusive-ORed with the ciphertext to be used as an initial value of the input data string Arithmetic processing, A first permutation process for rearranging the pattern corresponding to the selection value from the selection process for the calculation result based on the input data string and the round key, and outputting the rearranged result; A non-linear transformation process including a plurality of tables each for non-linear transformation of values obtained by dividing the output value of the first permutation process into a plurality of values; In accordance with a selection value from the selection process, a second rearrangement of the pattern opposite to the first permutation process is performed on
  • Permutation processing A linear transformation process for performing a linear transformation based on the output of the second permutation process; Including In the non-linear transformation process, non-linear transformation is performed according to the table using a value obtained by exclusive ORing with the mask value on the input side with respect to the input to the table, and the non-linear transformation value is output.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

初期マスク演算部(1101)は平文と初期マスク値との排他的論理和をとり、第1のパーミュテーション部(1301)は非線形変換部(1400)への入力の並び替えを行い、非線形変換部(1400)は複数の非線形変換用のテーブルへの入力に対してマスクをかけ前記テーブルに従った非線形変換を行い前記非線形変換した値に対して出力側のマスクをかけた値を出力し、第2のパーミュテーション部(1302)は非線形変換部(1400)からの出力の並び替えを行い、線形変換部(1500)は第2のパーミュテーション部(1302)の出力に基づいて線形変換を施し、アンマスク演算部(1102)はラウンド処理終了後の出力とアンマスク値との排他的論理和をとり、結果を暗号文として出力する。

Description

暗号化処理回路及び復号処理回路並びにその方法
 本発明は、暗号化処理回路及び復号処理回路とその方法並びにそのプログラムに関し、特に、耐タンパー性を考慮した暗号化処理回路及び復号処理回路、その方法並びにそのプログラムに関する。
する。
 情報の電子データ化が進む中で、情報の保護、秘匿な通信において、暗号はかかせない技術となっている。暗号はその安全性を保つために、鍵等の秘密情報が容易に推測できないようにする必要がある。鍵の全数探索や数学的に解読を行う線形解読や差分解読等といった暗号解析方法が知られている。しかし、この種の暗号解析方法により、現実的な時間で解析を行うことは不可能な状況といえる。
 その一方で、携帯端末などの暗号機能を実装した装置(暗号モジュール)において、攻撃者が処理時間や消費電力、漏洩電磁波などのサイドチャネル情報を精密に測定できるとの仮定の下で、サイドチャネル情報から秘匿情報の取得を試みるサイドチャネル攻撃とその対策が大きな研究テーマとなっている。
 サイドチャネル攻撃として、暗号モジュールの消費電力を測定し、消費電力から鍵等の秘密情報を解析する電力解析攻撃がある。その中でも、複数の消費電力波形に統計処理を行うことで解析を行う、差分電力解析が特に強力な攻撃法とされている(非特許文献1)。
 暗号モジュールにおいて、論理ゲートの遷移確率に偏りが生じる場合に、データ列の中で1となるビットの数(ハミング重み)と消費電力との間には相関があるとされている(非特許文献2)。また、予め規定された暗号化処理を所定回数実行して暗号文を生成する場合、暗号化処理前後でのレジスタのビット遷移(ハミング距離)と消費電力とに相関があるとされている(非特許文献3)。そのため、ハミング重みやハミング距離に着目することで、秘密鍵が解析できてしまう、という問題がある。
 ハミング重みやハミング距離に着目した攻撃への対策手法の例として、マスキング手法が提案されている(非特許文献4)。マスキング手法では、入力値と鍵を用いて演算する際に、マスク値という乱数を入力値と鍵とともに演算する。さらに、マスク値によってマスキングされた中間値を用いてラウンド処理を行う。ラウンド処理中の非線形変換は、例えば変換テーブルを用いて行われる。非線形変換に用いるテーブルは、マスク値が変わるたびに生成される。非線形変換に用いるテーブルは、中間値にマスクがかかった値を入力とし、元の中間値を非線形変換した値にマスクをかけ直した値が出力される。中間値にマスクがかかっているため、消費電力と中間値の相関が低下する。そのため、ハミング重みなどから、秘密鍵の解析ができなくなり、安全性が高くなる。
 特許文献1には、乱数によるマスキング手法の問題を解決する方法として、固定値マスク法が開示されている。固定値マスク法では、予め2つ以上の固定値をマスクとして用意する。次に、各マスクと組となるマスク付テーブルを用意する。このマスク付テーブルは、中間値に組となるマスク値がかかった値を入力とし、元の中間値を非線形変換した値に組となるマスク値をかけ直した値を出力とする。そして、暗号処理開始時に、乱数にしたがってマスクとテーブルの組を選択し、選択したマスクとテーブルを用いて暗号処理を実施する。暗号処理のたびに乱数をふり直すことで、マスク値が切り替わる。固定値としてマスク値とテーブルを用意することで、非特許文献4の手法で問題となった、処理速度の低下と、RAM(Random Access Memory)領域の増大という問題を解決することができる。
 非特許文献5には、AES(Advanced Encryption Standard)における対策手法としてRotating Sboxes Masking(RSM)法が提案されている。RSM法では、固定値マスク法と同様に、複数のマスク値とマスク付のテーブル(SBOX)を用意する。暗号処理時には、これら複数のマスク値及びテーブルを並列に使用することになる。RSMでは、入力データ列をテーブルでの処理前にシフトすることで、使用するマスク値とテーブルをローテートする。テーブルでの処理後に、マスク付の出力データ列が出力される。この出力結果のデータ列を逆シフトすることで、元のデータ位置にマスク付データ列を戻す。使用するテーブルをローテートすることで、データの各バイトにかかるマスク値を入れ替えることができる。また、未使用となるマスク値とテーブルを出さないことから、回路の使用効率を高めている。
 特許文献2には、共通鍵暗号処理において、秘密鍵の解読防止のために必要な処理時間及び回路規模を削減するための構成として、第1の経路選択手段は、乱数発生手段が発生した乱数の値に応じて、複数の拡大鍵マスク値をランダムに並べ替え、拡大鍵演算手段は、並べ替えられた複数の拡大鍵マスク値と、拡大鍵を表すデータ列と、入力データ列との排他的論理和を生成し、第2の経路選択手段は、乱数の値に応じて第1の経路選択手段とは逆の並べ替えを行うことで、排他的論理和のデータ列を並べ替え、非線形変換手段104は、並べ替えられたデータ列の非線形変換を行って、複数の非線形変換マスク値によりマスクされたデータ列を出力し、第3の経路選択手段は、乱数の値に応じて第1の経路選択手段と同じ並べ替えを行うことで、マスクされたデータ列を並べ替える暗号化装置が開示されている。
 尚、特許文献3には、暗号処理構成を小型化した暗号処理装置に関する技術が開示されている。また、特許文献4には、様々な秘密鍵及び公開鍵の暗号化アルゴリズムを処理するようプログラム可能な暗号化チップに関する技術が開示されている。また、特許文献5には、データ暗号化標準アルゴリズムを利用した暗号化装置に関する技術が開示されている。
特開2002-366029号公報(特許4596686号公報) 特開2008-131108号公報 特開2012-215814号公報 特開2011-008285号公報 特開2002-032016号公報
P. Kocher, J. Jaffe and B. Jun, "Introduction to Differential Power Analysis and Related Attacks," 1998. 佐々木明彦, 阿部公輝, "暗号回路への電力差分解析攻撃に対するアルゴリズムレベルでの耐性評価," 2006. E. Brier, C. Clavier, and F. Olivier, "Correlation Power Analysis with a Leakage Model," 2004. Thomas S. Messerges, "Securing the AES Finalists Against Power Analysis Attacks," 2000. M. Nassar, Y. Souissi, S. Guilley and J.-L. Danger, "RSM: a Small and Fast Countermeasure for AES, Secure against 1st and 2nd -order Zero-Offset SCAs," 2012. NAKAHARA Jorge Jr, " 3D: A Three-Dimensional Block Cipher," 2008. T. Suzaki, K. Minematsu, S. Morioka and E. Kobayashi, "TWINE: A Lightweight Block Cipher for Multiple Platforms," 2012.
 以下に関連技術の分析を与える。
 非特許文献4に開示された乱数によるマスキング手法では、マスク値(乱数)が変わるたびに、非線形変換に用いるテーブルを再計算する必要がある。このため、処理速度の低下、及び、必要な記憶容量(RAM(Random Access Memory)領域)の増大、という問題がある。
 特許文献1の手法では、複数のマスク値とテーブルをマスク値の数だけ用意しておく必要があるため、マスク値とテーブルを保存するためのROM(Read Only Memory)領域が必要となる。また、複数のマスク値とテーブルの組の中からいずれか1つを選択する構成のため、選択されなかったマスク値とテーブルは、暗号処理時には冗長部分となる。
 非特許文献5に開示されたRSM法では、マスクを保存するために、多くのROM領域を必要とする、という問題がある。RSM法では、テーブル処理後に、線形処理(ShiftRows, MixColumns, AddRoundKey)を行う。そして、それらの処理の後に、線形処理で変化したマスクを解除(アンマスク)する。さらに次のラウンド処理で使用するマスク値を改めてかけ直す作業(リマスク)が必要となる。当該アンマスク及びリマスクのためのマスク値を、ROMに記憶しておく必要がある。マスク値は、シフト幅の種類分用意する必要がある。そのため、マスク値を記憶しておくためのROM領域が大きくなる。また、アンマスクおよびリマスクを行うための処理時間と回路が必要となり、時間と回路規模の面でコストが増大する。
 特許文献2の手法においても、線形処理と非線形処理の繰り返し処理を行う場合には、前の線形処理に対するマスクを解除するためのデータ列と、複数の新たなマスク値との排他的論理和を生成するマスク演算手段を必要としており、マスクを解除するためのデータ列と新たなマスク値を記憶しておくROM領域と、マスクを解除し新たにかけ直すための処理時間と回路が必要となり、RSM同様に時間と回路規模の面でコストが増大する。
 尚、特許文献3から5には、データの分割や排他的論理和について開示されているが、耐タンパ性に課題がある。
 したがって、本発明は、上記問題点に鑑みて創案されたものであって、その目的は、暗号処理における冗長部分を削減可能とし、処理速度を向上させ、マスク値の記憶領域を削減可能とする暗号化処理回路及び復号処理回路と、その方法並びにそのプログラムを提供することを目的とする。
 本発明によれば、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択部と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力した平文との排他的論理和をとり、入力データ列の初期値とする初期マスク演算部と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択部からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション部と、
 前記第1のパーミュテーション部の出力を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換部と、
 前記非線形変換部の複数の出力値を結合したデータ列に対して、前記選択部からの前記選択値に応じて、前記第1のパーミュテーション部とは逆のパターンの並び替えを行う第2のパーミュテーション部と、
 前記第2のパーミュテーション部の出力に基づいて線形変換を施す第1の線形変換部と、
 を備え、
 前記非線形変換部は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション部、前記非線形変換部、前記第2のパーミュテーション部及び前記第1の線形変換部を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換部の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択部からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算部
 をさらに備える暗号化処理回路が提供される。この暗号化処理回路においては、前記ラウンド処理を繰り返す間に、データ列に対するマスクを無効化し新たにマスクをかけ直す演算を不要としている。
 本発明によれば、データ処理装置による暗号化処理方法であって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択工程と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算工程と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択工程からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション工程と、
 前記第1のパーミュテーション工程の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換工程と、
 前記選択工程からの選択値に応じて、前記第1のパーミュテーション工程とは逆のパターンの並び替えを、前記非線形変換工程の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション工程と、
 前記第2のパーミュテーション工程の出力に基づいて線形変換を施す第1の線形変換工程と、
 を含み、
 前記非線形変換工程において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション工程、前記非線形変換工程、前記第2のパーミュテーション工程及び前記第1の線形変換工程を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換工程の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択工程からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算工程と、
 をさらに含む暗号化処理方法が提供される。この暗号化処理方法においては、ラウンド処理を繰り返す間にデータ列に対するマスクを無効化し新たにマスクをかけ直す演算を不要としている。
 本発明によれば、データ処理装置に暗号化処理を実行させる暗号化処理プログラムであって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択処理と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算処理と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択処理からの選択値に対応したパターンの並べ替えを入力データ列に行い、並び替えた結果を出力する第1のパーミュテーション処理と、
 前記第1のパーミュテーション処理の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換処理と、
 前記選択処理からの選択値に応じて、前記第1のパーミュテーション処理とは逆のパターンの並び替えを、前記非線形変換処理の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション処理と、
 前記第2のパーミュテーション処理の出力に基づいて線形変換を施す第1の線形変換処理と、
 を含み、
 前記非線形変換処理において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション処理、前記非線形変換処理、前記第2のパーミュテーション処理及び前記第1の線形変換処理を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換処理の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択処理からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算処理
をさらに含むことを特徴とする暗号化処理プログラムが提供される。この暗号化処理プログラムにおいては、ラウンド処理を繰り返す間にデータ列に対するマスクを無効化し新たにマスクをかけ直す演算を不要としている。本発明によれば、該暗号化処理プログラムを記録したコンピュータ読み出し可能な媒体(例えば半導体メモリ、磁気/光ディスク等)が提供される。
 本発明によれば、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択部と、
 前記選択部からの選択値に応じて、複数のアンマスク値の中からアンマスク値を選択し、選択したアンマスク値と、暗号文との排他的論理和をとり、入力データ列の初期値とするアンマスク演算部と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択部からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション部と、
 前記第1のパーミュテーション部の出力値を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換部と、
 前記選択部からの選択値に応じて、前記第1のパーミュテーション部とは逆のパターンの並び替えを、前記非線形変換部の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション部と、
 前記第2のパーミュテーション部の出力に基づいて線形変換を施す線形変換部と、
 を備え、
 前記非線形変換部は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション部、前記非線形変換部、前記第2のパーミュテーション部及び前記線形変換部を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記線形変換部の出力に基づく値を前記入力データ列とし、
 前記選択部からの選択値に応じて複数の初期マスク値の中から初期マスク値を選択し、選択した初期マスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとる初期マスク演算部をさらに備える復号処理回路が提供される。この復号処理回路においては、ラウンド処理を繰り返す間にデータ列に対するマスクを無効化し新たにマスクをかけ直す演算を不要としている。
 本発明によれば、暗号処理時における冗長部分を削減可能とし、処理速度を向上させ、マスク値の記憶領域を削減可能としている。
本発明の第1の実施形態に係る暗号化処理回路の構成を例示する図である。 本発明の第1の実施形態に係る暗号化部の構成を例示する図である。 本発明の第1の実施形態に係る初期マスク演算部の構成を例示する図である。 本発明の第1の実施形態に係るアンマスク演算部の構成を例示する図である。 本発明の第1の実施形態に係る非線形変換部の構成を例示する図である。 本発明の第1の実施形態に係る非線形変換テーブルを排他的論理和と非線形変換テーブルで置換した図である。 本発明の第1の実施形態に係る鍵加算部の構成を例示する図である。 本発明の第1の実施形態の動作を説明するためのフローチャートである。 元のAESのデータ配列である。 4の倍数のバイトの巡回シフトによって並び替えた結果である。 4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果である。 AESに対して、4の倍数のバイトの巡回シフトの並び替えを行い、さらに4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行った場合の結果である。 第1の比較例(マスクなし)の暗号化部の構成を例示する図である。 第1の比較例の非線形変換部の構成を例示する図である。 第2の比較例(RSM法)の暗号化部の構成を例示する図である。 第2の比較例(RSM法)の非線形変換部の構成を例示する図である。 第2の比較例(RSM法)の非線形変換テーブルを排他的論理和と非線形変換テーブルで置換した図である。 本発明の第1の実施形態に係る、初期マスク演算部の後に前処理部を設置したときの、暗号化部の構成を例示する図である。 本発明の第1の実施形態に係る、アンマスク演算部の前に後処理部を設置したときの、暗号化部の構成を例示する図である。 本発明の第2の実施形態に係る暗号化部の構成を例示する図である。 本発明の第2の実施形態の動作を説明するためのフローチャートである。 本発明の第2の実施形態に係る、4系列の一般化Feistel構造に第2の実施形態を適用したときの、暗号化部の構成を例示する図である。 本発明の実施例1に係る暗号化部の構成を例示する図である。 本発明の実施例1に係る非線形変換部の構成を例示する図である。 本発明の実施例1に係る非線形変換テーブルを排他的論理和と非線形変換テーブルで置換した図である。 元のAESのデータ配列である。 4の倍数のバイトの巡回シフトによって並び替えた結果である。 4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果である。 本発明の実施例1に対して、4の倍数のバイトの巡回シフトの並び替えを行い、さらに4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行った場合の結果である。 本発明の実施例1に係るパーミュテーション部3301において、各選択値R(R=0~7)において並び替えを行った場合を例示する図である。 本発明の実施例1に係るパーミュテーション部3301において、各選択値R(R=8~15)において並び替えを行った場合を例示する図である。 本発明の実施例1に係るパーミュテーション部3302において、各選択値R(R=0~7)において並び替えを行った場合を例示する図である。 本発明の実施例1に係るパーミュテーション部3302において、各選択値R(R=8~15)において並び替えを行った場合を例示する図である。 本発明の実施例1に係る初期マスク演算部における、初期マスクテーブルを例示する図である。 本発明の実施例1に係るアンマスク演算部における、アンマスクテーブルを例示する図である。 本発明の実施例1に係る選択部における、選択値の更新用のテーブルを例示する図である。 本発明の実施例1の動作を説明するためのフローチャートである。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その1-A)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その1-B)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その1-C)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その2-A)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その2-B)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その2-C)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その3-A)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その3-B)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その3-C)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その4-A)である。 本発明の実施例1に係る、R=0のときのデータ遷移の例を示す図(その4-B)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その1-A)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その1-B)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その1-C)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その2-A)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その2-B)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その2-C)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その3-A)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その3-B)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その3-C)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その4-A)である。 本発明の実施例1に係る、R=7のときのデータ遷移の例を示す図(その4-B)である。 AESのときのデータ遷移の例を示す図(その1-A)である。 AESのときのデータ遷移の例を示す図(その1-B)である。 AESのときのデータ遷移の例を示す図(その1-C)である。 AESのときのデータ遷移の例を示す図(その2-A)である。 AESのときのデータ遷移の例を示す図(その2-B)である。 AESのときのデータ遷移の例を示す図(その2-C)である。 AESのときのデータ遷移の例を示す図(その3-A)である。 AESのときのデータ遷移の例を示す図(その3-B)である。 AESのときのデータ遷移の例を示す図(その3-C)である。 AESのときのデータ遷移の例を示す図(その4-A)である。 AESのときのデータ遷移の例を示す図(その4-B)である。 AES暗号化回路の暗号化部の構成を例示する図である。 AES暗号化回路の非線形変換部の構成を例示する図である。 3D暗号の暗号化回路の暗号化部の構成を例示する図である。 3D暗号の暗号化回路の非線形変換部の構成を例示する図である。 3D暗号のフローチャートである。 本発明の実施例2に係る、暗号化部の構成を例示する図である。 本発明の実施例2に係る、非線形変換部の構成を例示する図である。 本発明の実施例2に係る、非線形変換テーブルを排他的論理和と非線形変換テーブルで置換した図である。 本発明の実施例2に係る、非線形変換部の構成を例示する図である。(2つの非線形変換部) 本発明の実施例2に係る、マスクの配置を例示する図である。 元のAESのデータ配列である。 16の倍数のバイトの巡回シフトによって並び替えた結果である。 スライスないで4の倍数のバイトの巡回シフトによって並び替えた結果である。 本発明の実施例2に係る、16の倍数のバイトの巡回シフトの並び替えを行い、続いてスライス内で4の倍数のバイトの巡回シフトの並び替えを行い、さらに4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行った場合の結果である。 本発明の実施例2の動作を説明するためのフローチャートである。 本発明の実施例2の動作を説明するためのフローチャートである。 TWINEの暗号化回路の暗号化部の構成を例示する図である。 TWINEの暗号化回路のF関数部の構成を例示する図である。 TWINEの暗号化回路の線形変換部の構成を例示する図である。 TWINEの暗号化回路の暗号化部の別の構成を例示する図である。 TWINEの暗号化回路の鍵演算部の構成を例示する図である。 TWINEの暗号化回路の非線形変換部の構成を例示する図である。 TWINEの暗号化回路の1つめの線形変換部の構成を例示する図である。 TWINEの暗号化回路の2つめの線形変換部の構成を例示する図である。 TWINEのフローチャートである。 本発明の実施例3に係る、暗号化部の構成を例示する図である。 本発明の実施例3に係る、非線形変換部の構成を例示する図である。 本発明の実施例3に係る、非線形変換テーブルを排他的論理和と非線形変換テーブルで置換した図である。 本発明の実施例3に係る、パーミュテーションの動作を例示する図である。 本発明の実施例3に係る各マスクを例示する図である。 本発明の実施例3に係る選択部における、選択値の更新用のテーブルを例示する図である。 本発明の実施例3の動作を説明するためのフローチャートである。 本発明の実施例3の動作を説明するためのフローチャートである。 本発明の第1の実施形態に係る復号処理回路の構成を例示する図である。 本発明の第1の実施形態に係る復号部の構成を例示する図である。 本発明の第2の実施形態に係る復号部の構成を例示する図である。
 本発明の第1の形態によれば、暗号鍵を用いて平文を複数のラウンドで暗号化する暗号化処理回路は、初期マスク演算部(1101)と、レジスタ(1200)、第1、第2のパーミュテーション部(1301、1302)、非線形変換部(1400)と、線形変換部(1500)、鍵演算部(1600)、アンマスク演算部(1102)、選択部(1700)、乱数生成部(1800)、とを備える。
 初期マスク演算部(1101)は、選択部(1700)の出力値(選択値)にしたがって初期マスクテーブル(1111)から初期マスクを読み出し、読み出した初期マスクと平文との排他的論理和をとり、平文にマスクをかける。
 レジスタ(1200)は1ラウンド処理ごとの中間値を記憶する。
 初回のラウンド処理では、レジスタ(1200)には、初期マスク演算部(1101)の演算結果が入力される。2回目以降のラウンド処理では、前記レジスタには、前回のラウンド処理での前記鍵演算部(1600)の出力が入力される。
 第1のパーミュテーション部(1301)は、レジスタ(1200)に格納されている値を入力値としてデータ列の並び替えを行う。このとき、どのような並び替えを行うかは、選択部(1700)の選択値にしたがう。
 非線形変換部(1400)は、複数のテーブル(マスク付き非線形変換テーブル)(S1~St、1411~1414)を備えている。各々のテーブル(S1~St)(1411~1414)おいて、テーブルにしたがって入力値に応じた出力値が出力される。
 前記非線形変換部(1400)の各テーブル(1411~1414)は入力側のマスク(M=m~mt)とマスクなし非線形変換テーブル(S、1420)、出力側のマスク(N=n~nt)によって得られる値で構成される。テーブル(1411~1414)の入力に対して入力側のマスク(M=m~mt)をかけることで入力値をマスク前の値に変換し、マスク前の値を用いてテーブル(S、1420)に従った非線形変換を行う。テーブル(S、1420)の出力に対して出力側のマスク(N=n~nt)をかけた値を出力する。マスク付き非線形変換テーブル(S1~St、1411~1414)はこの入出力の関係をテーブルとしている。
 第2のパーミュテーション部(1302)は、非線形変換部(1400)の複数のテーブル(S1~Sn)から出力される複数の値を入力し、データ列の並び替えを行う。このとき、どのような並び替えを行うかは、選択部(1700)の選択値にしたがう。なお、並び替えについては、第1のパーミュテーション部(1301)とは逆の並び替えを行う。
 線形変換部(1500)は、第2のパーミュテーション部(1302)出力値の線形変換をとる。
 鍵演算部(1600)は、線形変換部(1500)の出力とラウンド鍵(Ki)とを加算する(排他的論理和をとる)。
 前記第1のパーミュテーション部(1301)、前記非線形変換部(1400)、前記第2のパーミュテーション部(1302)、前記線形変換部(1500)、及び、前記鍵加算部(1600)によるラウンド処理が、規定回数行われる(例えばAES-128、AES-192、AES-256のラウンド処理回数は10回、12回、14回)。本発明によれば、該ラウンド処理を繰り返す間にデータ列に対するマスクを無効化し新たにマスクをかけ直す演算を必要としない(不要としている)。
 アンマスク演算部(1102)は、選択部(1700)の出力値(選択値)にしたがってアンマスクテーブル(1113)からアンマスク値を読み出し、ラウンド処理終了後のデータ列とアンマスク値との排他的論理和をとり、データ列のマスクを解除する。排他的論理和の結果を暗号文として出力する。
 選択部(1700)は、乱数生成部(1800)の乱数値を初期値として、選択値を出力する。また、選択値はラウンド処理が1ラウンド終わるごとに更新される。
 選択値によって、前記初期マスク演算部(1101)および前記アンマスク演算部(1102)のマスク値が選択される。また、選択値によって、前記第1のパーミュテーション部(1301)および前記第2のパーミュテーション部(1302)の並び替えのパターンが選択される。
 乱数生成部(1800)は、暗号処理開始時に乱数を生成し、生成した乱数を前記選択部(1700)へ出力する。乱数生成には、LFSR(LinearFeedbackShiftRegister)を利用するものや、一方向性関数を利用するもの、カオス系列を利用するもの、予めROMなどに記憶しておいた乱数を読みだすもの等、公知のものが用いられる。
 第1、第2パーミュテーション部(1301、1302)は、複数の並び替えのパターンを持ち、どのパターンで並び替えを行うかは、前記選択部(1700)の選択値に従う。
 選択部(1700)の選択値がsvであるときの第2のパーミュテーション部(1302)の並び替えをP2sv(・)、線形変換をL(・)、選択値sv’のときの第1のパーミュテーション部1301の並び替えをP1sv’(・)とし、選択部(1700)の選択値svがあったときに、次の選択値がsv’となるとして、全てのsvに対して、前記非線形変換部(1400)の入力側マスク(M)と出力側マスク(N)に対して、次の関係を満たせる並び替えパターンを、第1、第2のパーミュテーション部(1301、1302)に持たせる。
M=P1sv'(L(P2sv(N)))
 前記第1、第2パーミュテーション部(1301、1302)の並び替えのパターンでは、同じ選択値に対して、逆の並び替えを行う。これにより、前記第1のパーミュテーション部で移動したデータの位置を、前記第2のパーミュテーション部によって元の位置に戻すことができる。
 前記非線形変換部(1400)の入力側マスク(M)と出力側マスク(N)は次のような関係を規定しておく。前記出力側マスク値(N)を前記第2のパーミュテーション部(1302)のいずれかの並び替えパターンで並び替え、さらに並び替えたマスク値(N)を前記線形変換部(1500)で線形変換し、線形変換した結果を前記第1のパーミュテーション部(1301)のいずれかの並び替えパターンで並び替えた結果を前記入力側マスク(M)とする。
 本発明の上記形態によれば、非線形変換部において、マスク付の非線形変換テーブルを具備することで、マスクを変えるためにテーブルの再計算を行う必要性がなくなり、処理速度の低下と、記憶領域(RAM領域)の増大を抑制する。さらに、非線形変換部において、異なるマスクを持つテーブルを具備し、さらにパーミュテーションによりテーブルに入力されるデータを入れ替えることで、ラウンド処理ごとにデータの各部分にかかるマスクを入れ替える。未使用となるマスク値とテーブルを出さないことで、ROM領域及び回路規模を削減することができる。
 非線形変換部のマスク付の非線形変換テーブルにおける入力側マスク値(M)と出力側のマスク値(N)の関係を規定しておき、さらに、パーミュテーションに条件付けを行う。こうすることで、本発明によれば、ラウンドごとのアンマスクやリマスクといったマスクの作業が不要となり、作業用のマスク値をROM等の記憶装置に記憶しておくことを要しなくしている。その結果、処理速度の向上と回路規模の削減が期待できる。
 このように、本発明によれば、処理速度を向上させ、回路規模及びROM領域を削減しつつ、ハミング重みやハミング距離に基づくサイドチャネル攻撃による解析を困難にし、暗号モジュールの安全性を高めることができる。以下、図面を参照していくつかの実施形態を説明する。
(第1の実施形態)
 図1は、本発明の第1の実施形態の暗号化処理回路の構成を例示する図である。本実施形態の暗号化処理回路は、暗号化部1000と鍵生成部2000を含む。
 図2は、図1の暗号化部1000の構成を例示する図である。図2を参照すると、暗号化部1000は、初期マスク演算部1101、アンマスク演算部1102、レジスタ1200、パーミュテーション部1301、1302、非線形変換部1400、線形変換部1500、鍵演算部1600、選択部1700、及び、乱数生成部1800を備えている。本明細書では、各変換部での演算として以下のような表記を用いる。
非線形変換:S(・)、
線形変換:L(・)、
パーミュテーション(1301、1302):P1(・)、P2(・)。
 図1を参照すると、暗号化部1000は、入力された平文と、鍵生成部2000から受け取るラウンド鍵(Ki)をもとに、データを暗号化し、暗号文を出力する。
 暗号化部1000では、図2を参照すると、初めに初期マスク演算部1101において、処理を行う。
 図3は、図2の初期マスク演算部1101の構成を例示する図である。図3を参照すると、初期マスク演算部1101は、複数の初期マスクを格納している初期マスクテーブル1111と、排他的論理和演算部(Exclusive OR:XOR)1112を備えている。初期マスクテーブル1111は、入力された選択値に基づき複数の初期マスクの中から1つを選択して出力する。排他的論理和演算部1112は、初期マスクテーブル1111から出力された初期マスクと平文との排他的論理和(bitwiseXOR:ビット毎のXOR)を演算する。初期マスクテーブル1111は、選択部1700の選択値がとり得る値の数だけ初期マスクのデータ列を格納する。
 再び、図2を参照して、次に、規定ラウンド数だけ、パーミュテーション部1301、非線形変換部1400、パーミュテーション部1302、線形変換部1500、鍵加算部1600でラウンド処理を繰り返す。なお、ラウンド処理中の中間値はレジスタ1200に格納される。
 ラウンド処理終了後、アンマスク演算部1102において処理を行う。
 図4は、図2のアンマスク演算部1102の構成を例示する図である。図4を参照すると、アンマスク演算部1102は、複数のアンマスクを格納しているアンマスクテーブル1113と、排他的論理和演算部1114を備えている。アンマスクテーブル1113は、入力された選択値に基づき、複数のアンマスクの中から1つを選択して出力する。排他的論理和演算部1114は、アンマスクテーブル1113から出力されたアンマスクとラウンド処理の出力結果(レジスタ1200に格納されている鍵演算部1600の出力結果)との排他的論理和(bitwiseXOR)を演算し、暗号文を出力する。アンマスクテーブル1113は、初期マスクテーブル1111と同様に、選択値がとり得る値の数だけアンマスクのデータ列を格納する。
 このように、図2において、初期マスク演算部1101は、選択値に基づき初期マスクテーブル1111からマスク値を選択し、選択したマスク値と入力データ列の排他的論理和(bitwiseXOR)を演算し、演算結果を出力する。また、アンマスク演算部1102は、選択値に基づきアンマスクテーブル1113からマスク値を選択し、選択したマスク値と入力データ列の排他的論理和(bitwiseXOR)を演算し、演算結果を出力する。このとき、初期マスク演算部1101では、平文と初期マスクとの排他的論理和を演算する。また、アンマスク演算部1102では、ラウンド処理の結果とアンマスクとの排他的論理和を演算する。
 図2において、レジスタ1200は、ラウンド処理の中間値を記憶する。初回のラウンド処理では、初期マスク演算部1101の出力が記憶される。2回目以降のラウンド処理では、鍵演算部1600の出力が記憶される。
 パーミュテーション部1301及びパーミュテーション部1302は、複数の並び替えのパターンを持ち、選択値に応じて並び替えのパターンを選択し、選択したパターンにしたがって入力データ列を並び替えて、並び替えた結果を出力する。並び替えは、ビット単位、バイト単位、及び任意のデータ長単位での並び替えがある。パーミュテーション部1301では、レジスタ1200のデータを並び替える。パーミュテーション部1302では、非線形変換部1400の出力値(Y)を並び替え、並び替えた結果(P2(Y))を出力する。
 非線形変換部1400は、入力値(X)を非線形変換し、変換結果(Y)を出力する。
 図5は、図2の非線形変換部1400の構成を例示する図である。図5を参照すると、非線形変換部1400は、t個(tは所定の正整数)の非線形変換テーブル(S1~St)1411~1414を備えている。t個の非線形変換テーブル1411~1414へは入力値Xのうちの一部のデータx1~xtがそれぞれ入力され、各非線形変換テーブルで非線形変換が行われる。データの一部の取り出し方としては、ビット単位、バイト単位、及び、任意のデータ長で分割され、データXは、全部でt個のデータx1~xtに分割される。x1~xtは互いに重ならず、x1~xtのビット列(あるいはバイト列等)を結合(連結)することでXとなる。特に制限されないが、例えばXが32ビットのとき、例えば4ビット単位にx1はXの0~3ビット、x2はXの4~7ビット、・・・、x8はXの29~31ビット等に分割する。
 非線形変換テーブル1411~1414の変換結果としてt個の出力値y1~ytが出力される。なお、非線形変換テーブル1411~1414は、後述するように、テーブルの入力と出力にマスク演算を施すものであり、マスク付き非線形変換テーブルともいう。n個の出力値y1~ytを結合したものが非線形変換部1400の出力値Yとなる。
 図6は、図5のt個の非線形変換テーブル(S1~St)1411~1414の入出力の関係を例示する図である。図6を参照すると、非線形変換テーブル1411は、入力側のマスクm1と、出力側のマスクn1と、排他的論理和演算部1431と、ルックアップテーブル方式の非線形変換テーブル(S)1421と、排他的論理和演算部1435を備えている。同様に、他の非線形変換テーブル1412~1414は、入力側のマスクm~mtと、出力側のマスクn~ntと、排他的論理和演算部1432~1434、ルックアップテーブル方式の非線形変換テーブル(S)1422~1424と、排他的論理和演算部1436~1438を備えている。マスクm~mtのビット幅は、データx1~xtビット幅と等しい。
 図6において、非線形変換テーブル(S1)1411内において、排他的論理和演算部1431は、入力値x1と入力側のマスクm1との排他的論理和((bitwise XOR)x1(XOR)m1をとる。なお、マスク値との排他的論理和をとることを、マスクをかけるともいう。
 非線形変換テーブル(S)1421は、排他的論理和演算部1431での排他的論理和演算結果x1(XOR)m1を入力し、該入力に非線形変換を施した変換結果S(x1(XOR)m1)を出力する。
 排他的論理和演算部1435は、非線形変換テーブル(S)1421から出力された変換結果S(x1(XOR)m1)と、出力側のマスクn1との排他的論理和S(x1(XOR)m1)(XOR)n1をとり、演算結果をy1として出力する。このように、非線形変換テーブル(S1)1411は、入力値x1をy1へ変換して出力する。他の非線形変換テーブル(S2~Sn)1412~1414も、S1と同様に、x2~xtのそれぞれに対して排他的論理和、非線形変換、排他的論理和の3つの演算を行い、それぞれy2~ytを出力する。マスクn1~ntは、非線形変換テーブル(S)の出力のビット幅と等しい(例えばマスクm~mtのビット幅と等しくしてもよい)。
 ここで、
 入力側の各マスクm1~mtを結合(連接)したものをM、
 出力側の各マスクn1~ntを結合(連接)したものをN、
 とする。
 非線形変換テーブル1411をメモリ装置へ実装する場合には、入力x1に対して、
出力y1=S(x1(XOR)m1)(XOR)n1を出力する。前述したように、図5のS1~Snの各々は、排他的論理和演算、非線形変換、排他的論理和演算を行う。
 再び図2を参照すると、線形変換部1500は、パーミュテーション部1301から出力された出力値(P2(Y))を線形変換して変換結果(Z)を出力する。線形変換の関数をLとした場合、
Z=L(P2(Y))
となる。
 鍵演算部1600は、図1の鍵生成部2000から出力されたラウンド鍵(Ki)と、線形変換部1500の出力(Z)との排他的論理和Q=Z(XOR)Ki(iは現在のラウンド数を示す)を演算する。なお、排他的論理和演算Z(XOR)KiはZとKiの加算である。
 図7は、図2の鍵演算部1600の構成を例示する図である。図7を参照すると、鍵演算部1600は、複数の排他的論理和演算部1611~1614を備えている。排他的論理和演算部1611は、ラウンド鍵Kiの一部であるki1と入力値Zの一部であるz1との排他的論理和z1(XOR)ki1を演算し、演算結果(加算結果)をq1として出力する。他の排他的論理和演算部1612~1614も同様に、ラウンド鍵Kiの一部kij(j=2~t)と入力値Zの一部zj(j=2~t)との排他的論理和zj(XOR)kijを演算し演算結果をqj(j=2~t)として出力する。
 また図2において、選択部1700は、乱数生成部1800から出力される乱数を初期値として、選択値を出力する。前記選択値は、前記初期マスク演算部1101、パーミュテーション部1301及び1302、並びに、アンマスク演算部1102で用いられる。
 選択部1700において、選択値の更新方法としては、例えば次のようなものがあげられる(ただし、以下に制限されない)。
1)1ラウンドごとに1ずつ増加(減少)していき、最大値(最小値)を超えたら、最小値(最大値)へとループする方法。
2)テーブルを用意しておき、現在のラウンドにおける選択値や、初期値と現在のラウンド数を引数としてテーブルから次の選択値を決定する方法。
3)更新式を用意しておき、現在のラウンドにおける選択値や、初期値と現在のラウンド数を引数として、次の選択値を更新式より算出する方法。
 図2において、乱数生成部1800は暗号処理開始時に乱数を生成する。生成した乱数は選択部1700の入力となる。
 図1の鍵生成部2000は、入力された秘密鍵をもとに、暗号化部1000で使用するラウンド鍵(Ki)を生成する。このラウンド鍵(Ki)は図2の鍵加算部1600に入力される。
 図8は、第1の実施形態の動作を説明するフローチャートである。図8と、図1乃至図7を参照して、本実施形態の動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は図1の暗号化部1000、秘密鍵は図1の鍵生成部2000へ入力される(ステップA1)。
 暗号処理が開始されたときに、図2の乱数生成部1800は乱数を生成し、乱数が選択部1700へ入力される(ステップA2)。
 図2の選択部1700は、入力された乱数を基に、選択値を出力する(ステップA3)。
 図2の初期マスク演算部1101は、図3の初期マスクテーブル1111より選択値に基づいて初期マスクを選択し、平文と初期マスクとの排他的論理和を演算する。この排他的論理和演算(加算演算)により、平文にマスクをかける(ステップA4)。マスクがかかった平文は、レジスタ1200に記憶される。
 マスク処理後、ラウンド処理として、ステップA5~A11が行われる。まず、図2のパーミュテーション部1301は選択値に基づき、データ列の並び替えを行う(ステップA5)。
 次に、図2の非線形変換部1400は、パーミュテーション部1301の出力値を非線形変換し、非線形変換出力(Y)を出力する(ステップA6)。非線形変換部1400は、パーミュテーション部1301の出力値がt個に分割されx1~xtが、非線形変換テーブル(S1~St)1411~1414へと入力する。これら、非線形変換テーブルはマスク付の非線形変換テーブルとなっている。非線形変換テーブル(S1)1411の結果は、x1とm1との排他的論理和を演算し、演算結果を非線形変換S(・)によって非線形変換し、非線形変換した結果とn1との排他的論理和をとった結果となる。
 ここで、ステップA4で平文にかけた初期マスク値と、m1~mtを結合(concatenate)したマスク値M(=m1||m2||・・・||mt;ただし、||は連結(連接)を示す)とが一致する場合、図6の排他的論理和演算部1431~1434において、初期マスクとMが相殺されることになる(一致する値同士の排他的論理和をとると、0となる)。このため、非線形変換テーブル(S)1421~1424は、元の平文に対して非線形変換を行うこととなる。そして、図6の排他的論理和演算部1435~1438で、元の平文を非線形変換した結果に、n1~ntを連結したマスクN(=n1||n2||・・・||nt)をかけることとなる。
 図3の初期マスクテーブル1111に格納される各マスク値としてマスク値Mを並び替えた値を格納しておき、図2のパーミュテーション部1301で、初期マスクをマスク値Mの配列と一致させるように並び替えを行うことで、上記の初期マスクとMの相殺が可能となる。
 図2のパーミュテーション部1302は、選択値に基づき、非線形変換部1400の出力Yを並び替える(ステップA7)。パーミュテーション部1302で行われる並び替えはパーミュテーション部1301とは逆の並び替えである。逆の並び替えを行うことで、データの順番をパーミュテーション部1301に入力される前の順番に戻すことができる。また、データにかかっているマスクの配列が並び替えられる。
 図2の線形変換部1500は、パーミュテーション部1302の出力値(Y’)に対して線形変換を行い、変換結果(Z)を出力する(ステップA8)。
 図2の鍵演算部1600は、線形変換部1500の出力(Z)と、鍵生成部2000から送られてきたラウンド鍵(Ki)との排他的論理和を演算し、演算結果(Q)を出力する(ステップA9)。鍵演算部1600での演算結果(Q)は、レジスタ1200に記憶される。
 鍵演算部1600での演算後、規定ラウンド回数、ラウンド処理を繰り返したか否か(ラウンド処理終了)の判定を行う(ステップA10)。この判定は、規定ラウンド回数に設定されたカウンタを、鍵演算部1600での演算のたびに1つカウントダウンし、カウント値が0となった時点で、ラウンド処理終了と判定してもよいし、図2の各部を制御する不図示の制御部等で制御するようにしてもよい。該判定の結果、ラウンド処理が規定回数分終わっていない場合には、選択部1700において、選択値の更新(ステップA11)を行った後、ステップA5に戻り、再び、ラウンド処理を繰り返す。一方、ラウンド処理が規定回数分終了した場合には、ステップA12へ進む。
 ラウンド処理を繰り返す場合、まず、図2のパーミュテーション部1301は、図2の鍵演算部1600の結果(Q)を並び替える(P1(Q))(ステップA5)。
 次に、並び替えたデータ列(P1(Q))に対して、図2の非線形変換部1400は非線形変換を行い、変換結果(Y)を出力する(ステップA6)。
 パーミュテーション部1301の出力(P1(Q))も、入力値(X)をt個(x1~xt)に分割したのと同様、t個に分割し、pq1~pqtとする。特に制限されないが、例えばP1(Q)が32ビットのとき、4ビット単位にpq1はP1(Q)の0~3ビット、pq2はP1(Q)の4~7ビット、・・・、pq8はP1(Q)の29~31ビット等に分割する。
 pq1~pqtが、図5のx1~xtとして、各非線形変換テーブル(S1~St)1411~1414にそれぞれ入力され、マスク付きの非線形変換処理が行われる。
 例えば図6の非線形変換テーブル(S1)1411では、pq1とm1との排他的論理和pq1(XOR)m1を演算し、演算結果を、非線形変換S(・)によって非線形変換し(演算結果pq1(XOR)m1をテーブルに入力し、該テーブルから非線形変換した結果が読み出される)、非線形変換した結果S(pq1(XOR)m1)とn1との排他的論理和をとった結果S(pq1(XOR)m1)(XOR)n1となる。
 ここで、1ラウンド目のステップA6(図8参照)でかけたマスクNが、1ラウンド目のパーミュテーション部1302と線形変換部1500(図2参照)、及び2ラウンド目のパーミュテーション部1301で変換された結果をN’とする。m1~mtを結合した入力側のマスクMが、N’と一致する場合、図6の排他的論理和演算部1431~1434において、N’とMが相殺されることになる(一致する値同士の排他的論理和をとると、0となる)。
 このため、マスクMが、N’と一致する場合、図6の非線形変換テーブル(S)1421~1424は、元のデータ(マスクをかける前の値)に対して、非線形変換を行うことと等価となる。そして、図6の排他的論理和演算部1435~1438で、元のデータを非線形変換した結果に、マスクNをかけることとなる。
 したがって、本実施形態においては、図8のステップA6でかけたマスクNを、図2のパーミュテーション部1302、線形変換部1500、及びパーミュテーション部1301で変換した結果N’を、入力側のマスクMとして、M、Nを含めた非線形変換テーブル(S1~Sn)1411~1414(図5、図6参照)を実装する。
 こうすることで、ラウンド処理中に、線形変換部1500での線形処理等で変化してしまったマスクを一旦解除して改めてマスクをかけ直す作業(処理)を不要としている。
 図2のパーミュテーション部1302は、非線形変換部1400の変換結果(Y)を選択値に基づき並び替え、並び替えた結果(P2(Y))を出力する(ステップA7)。
 図2の線形変換部1500は、パーミュテーション部1302の出力(P2(Y))に対して線形変換を行い、変換結果(Z)を出力する(ステップA8)。
 図2の鍵加算部1600は、線形変換部1500の出力(Z)と鍵生成部2000から送られてきたラウンド鍵(Ki)との排他的論理和を演算し、演算結果(Q)を出力する(ステップA9)。
 ラウンド処理が規定回数行われた場合、図8のステップA10からステップA12へと進む。
 ラウンド処理終了後、図2のアンマスク演算部1102は、図4のアンマスクテーブル1113より選択値に基づいてアンマスクを選択し、ラウンド処理の結果である鍵演算部1600の出力(Q)と、アンマスクとの排他的論理和を演算し、演算結果を暗号文として出力する(ステップA12)。このアンマスクとの排他的論理和は、Qにかかっているマスクを解除し、本来の暗号文Cを得るものである。
 ラウンド処理の結果である鍵演算部1600の出力(Q)にかかるマスクは、図8のステップA6でかけられたマスクNを、パーミュテーション部1302で並び替え、線形変換部1500で変換した値N’である。したがって、アンマスク演算部1102で、Qと、アンマスク値との排他的論理和の演算をすることで、本来の暗号文Cを得ることができる。
 なお、暗号アルゴリズムによっては、最後のラウンドでは処理の内容が変わることがある。その場合は、最後のラウンドで、マスクNに対して行われたパーミュテーション処理及び線形処理だけをNに適用した値をアンマスク値として用いる。
 例えば、AESでは最後のラウンドでは、線形変換の1つであるMixColumnsが行われない。そのため、それ以外の演算である、パーミュテーションとShiftRowsのみ、マスク値Nに適用した結果が、アンマスク値となる。
 最後に暗号文Cを出力し終了となる(ステップA13)。
 本実施形態で用いるマスク値として、
・初期マスク、
・アンマスク、
・非線形変換テーブルの入力側のマスクM、
・非線形変換テーブルの出力側のマスクN、
がある。各マスク値の関係について説明する。
 初期マスク演算部1101の初期マスクテーブル1111(図3)に格納されている各初期マスクは、パーミュテーション部1301においてとり得る並び替えパターンのいずれかで並び替えることで、非線形変換テーブル(図6の1411~1414)の入力側のマスクM(=m1||m2||・・・||mt)と等しくなる。
 初期マスク演算部1101の初期マスクテーブル1111(図3)と、パーミュテーション部1301の対応付けは、選択部1700の選択値によって行われる。ある選択値svによって選択された初期マスクは、同じ選択値svで選択されたパーミュテーション部1301の並び替えパターンによって並び替えることによって、非線形変換テーブル(図6の1411~1414)の入力側のマスクMと等しくなる。
 アンマスク演算部1102のアンマスクテーブル1113(図4)に格納されている各アンマスクは、非線形変換テーブル(図6の1411~1414)の出力側のマスクN(=n1||n2||・・・||nt)とをパーミュテーション部1302においてとり得る並び替えパターンのいずれかで並び替え、最後のラウンドの線形変換部1500で変換された結果とする。
 アンマスクテーブル1113(図4)とパーミュテーション部1302の対応付けは選択部1700の選択値によって行われる。ある選択値svで選択されたパーミュテーション部1302の並び替えパターンによって出力側のマスクNを並び替えた場合、同じ選択値svによって選択されるアンマスクと、非線形変換テーブル(図6の1411~1414)の出力側のマスクNが等しくなる。
 非線形変換テーブル(図6の1411~1414)の出力側のマスクN(=n1||n2||・・・||nt)が、パーミュテーション部1302、線形変換部1500、及び次のラウンドのパーミュテーション部1301で変換された結果を、次のラウンドの非線形変換テーブルの入力側のマスクMとする。
 非線形変換テーブル(図6の1411~1414)の入力側と出力側のマスクMとNと、図2のパーミュテーション部1301、1302の並び替えパターン、及び選択部1700による選択値は、次のように関係づけられる。
 選択部1700による選択値svにおいて、パーミュテーション部1302でsvに対応した並び替えパターンで並び替えられた出力側マスク(P2(N))を線形変換部1500で処理した結果L(P2(N))があり、次のラウンドでは選択値がsvからsv’に更新される。次のラウンドではパーミュテーション部1301においてsv’に対応した並び替えパターンでL(P2(N))が並び替えられる(P1(L(P2(N)))。このとき、M=P1(L(P2(N))となるように、選択値とパーミュテーションの並び替えパターン、およびMとNを設定する。
 次に、本実施形態で行うパーミュテーションについて説明する。図2のパーミュテーション部1301、1302は、選択部1700の選択値に応じて並び替えパターンが決定される。
 パーミュテーション部1301は、データ列にかかっているマスク値と非線形変換部1400の各非線形変換テーブル1411~1414(図6)で適用される入力側のマスクMとの対応を一致させるための並び替えを行う。そのため、選択部1700の選択値は、パーミュテーション部1301にどのような並びでマスクが入ってくるかを示している。そして、パーミュテーション部1301は、選択値に応じてレジスタ1200から入力されるデータ列を並び替える。
 パーミュテーション部1302は、パーミュテーション部1301にて行われた並び替え処理の逆の並び替えを行い、元のデータ位置との整合をとる。このようにパーミュテーション部1302で、元のデータ位置との整合をとることで、後段の線形変換部1500での線形処理や鍵演算部1600での鍵演算において、マスクを使わない時の本来の処理に対して追加の処理を不要とすることができる。
 また、パーミュテーション部1301及び1302の並び替えの制限として、非線形変換部1400のマスクNからマスクMが導出できるよう(もしくはマスクMからマスクNを導出できるよう)に並び替える必要がある。
 パーミュテーション部1302では、様々な並び替えパターンに基づいて並び替えが行われるが、いずれの並び替えパターンを、各非線形変換テーブル1411~1414(図6)の出力側のマスクNに用いたとしても、後段の線形処理を通過後、次のラウンド処理におけるパーミュテーション部1301における並び替えによってマスクMが導出できることが必要である。
 選択部1700の選択値がsvであるときのパーミュテーション部1302の並び替えをP2sv(・)、線形変換をL(・)、選択値sv’のときのパーミュテーション部1301の並び替えをP1sv’(・)とする。ここで、本実施形態では、選択部1700の選択値svがあったときに、次の選択値がsv’となるとして、全てのsvに対して、次の関係を満たせる並び替えパターンを、パーミュテーション部1301および1302に持たせる。
M=P1sv'(L(P2sv(N)))
 例えば、AESに適用した場合、パーミュテーション部1301及び1302では、4の倍数のバイトの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを適用することが可能である。図9A乃至図9Dに、AESのデータ配列に対して、上記の並び替えを行った場合の結果を示す。図9Aは元のAESのデータ配列、図9Bは4の倍数のバイトの巡回シフトによって並び替えた結果(4*2バイト巡回シフト)、図9Cは4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果(各列の中の2バイト巡回シフト)、図9Dは4の倍数のバイトの巡回シフトによって並び替え、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果(4*2バイト巡回シフト後、各列の中の2バイト巡回シフト)を示している。
 ここで、本実施形態を、図10に示した比較例(マスキングを行わない暗号化処理回路の比較例1:プロトタイプ例)と比較する。図10を参照すると、この比較例は、レジスタ1200、非線形変換部1401(マスクなし)、線形変換部1500及び鍵演算部1600を備えている。図10の回路に対して、図2に示した本実施形態では、初期マスク演算部1101、アンマスク演算部1102、パーミュテーション部1301及び1302、選択部1700並びに乱数生成部1800が追加されている。
 図10の非線形変換部1401は、本実施形態と異なり、マスクが入出力に反映されない非線形変換テーブルとされる。図11は、図10の非線形変換部1401の構成を例示する図である。非線形変換部1401は、非線形変換テーブル(S)1421~1424を備えている。図2の非線形変換部1400において、非線形変換テーブルをメモリに実装した場合には、図10、図11の比較例と、処理時間、回路規模ともに違いはない。
 処理時間については、最初に、乱数生成と選択値出力、初期マスク演算、最後にアンマスク演算、ラウンド処理中はデータのパーミュテーションが2回ずつ、の処理時間が追加される。このうち、特に、パーミュテーション処理が、本実施形態での処理時間の増加分にあたることになる。
 回路規模については、図2の初期マスク演算部1101、アンマスク演算部1102、パーミュテーション部1301及び1302、選択部1700、乱数生成部1800並びにマスク値を保存するROM領域が、図10の回路構成に追加される。ただし、ROM領域については、初期マスクテーブルとアンマスクテーブルの2種類用意すればよい。
 ここで、非特許文献5に開示されたRSM法による構成と比較する。図12に、RSM法による暗号処理回路の構成例(比較例2)を示す。図12のRSM法の回路と、図2の本実施形態との相違点は、図12の比較例では、図2のパーミュテーション部1301及び1302が、バレルシフト1303及び1304となっている点と、MMSj+1加算部1103が追加されている点である。
 また、図12の非線形変換部1402のマスク配置も図2の非線形変換部1400とは異なる。図13は、RSM法の非線形変換部1402の構成を例示する図である。図14は、図13のt個の非線形変換テーブル(S1~St)1441~1444の構成を例示する図である。
 図14のRSM法の非線形変換部1402では、入力側のマスクM={m1,m2,・・・,mt-1,mt}に対して、1つずつずらしたものが出力側のマスクN={m2,m3,・・・,mt,m1}となる。
 図12のRSM法では、バレルシフトによって並び替えを行っている。RSM法では、最初に乱数によってシフトするバイト数を選択し、選択した数に応じて初期マスクの選択、及び、1ラウンド目のバレルシフト1303においてシフトする数が決定される。
 なお、バレルシフト1304は、バレルシフト1303と逆方向に、同じ数だけシフトすることで、データ位置を元に戻している。
 2ラウンド目以降は、バレルシフト1303及び1304は、前のラウンドでシフトした数よりも1つ多い数だけのシフトを行う。もし、シフト数がデータ幅以上となった場合にはシフト数は0になる。図12のRSM法では、出力側のマスクが線形変換1500によって変化するため、そのままでは、次のラウンドの非線形変換部1402においてマスクMによってマスクを解除して非線形変換テーブル1421~1424(図14)で正しい処理を行うことができない。
 したがって、RSM法では、ラウンド処理ごとに、マスクNが線形処理で変化したものN’を一度解除し、新たに次のラウンドのマスクMをかけ直す処理を、MMSj+1加算部1103で行う。
 処理時間について比較する。図12の比較例(RSM法)の回路と比較して、本実施形態は、ラウンド処理ごとにMMSj+1加算部1103による演算処理を必要としない。そのため、ラウンド回数分の演算処理分の時間が短縮される。
 次に、図12のRSM法による暗号処理回路の回路規模を、本実施形態と比較する。回路規模についても、MMSj+1加算部1103が、本実施形態との差分となる。したがって、MMSj+1加算部1103に関する部分だけRSM法よりも、本実施形態の方が回路規模が小さいことになる。
 次に、ROM領域について比較する。図12のRSM法による暗号処理回路では、バレルシフトで何バイトシフトするかによって、初期マスクMjや途中のMMSj+1加算部1103で使用するマスクMMSj+1、最後のアンマスクMSj+nが変わってくる。例えば、AES128の場合、シフト幅のパターンが0~15バイトの16パターンとすると、マスクの数は、3つのマスクで16個必要となり、ROM領域は、
T*16*3(T=16バイト)
分必要となる。
 一方、本実施形態においても、図2の選択部1700の選択値のパターン数に応じて、初期マスクやアンマスクのROM領域が変わってくる。もし、選択値のパターン数をRSM法でのシフト数と同じ数にした場合、RSM法に比べて、MMSj+1加算部1103で使用するマスクMMSj+1の分だけ、ROM領域を削減することができる。例えば、AES128の場合、選択部1700の選択値のパターンが16パターンとすると、マスクの数は、2つのマスクで16個必要となり、ROM領域は、
T*16*2(T=16バイト)
分必要となる。
 なお、本実施形態では、ラウンド処理のみ行い、ラウンド処理前後では初期マスクとアンマスクの演算のみ行っているが、暗号によっては、前処理や後処理を行うこともある。この場合には、初期マスク演算部1101の前後に前処理を追加したり、アンマスク演算部1102の前後に後処理を追加した構成を備えた構成としてもよい。図15の例では、ラウンド処理の前処理を行う前処理部1901を、初期マスク演算部1101とレジスタ1200の間に備えている。図16の例では、規定回数のラウンド終了後のレジスタ1200の出力を受ける後処理部1902を、アンマスク演算部1102の前段に備えている。
(第2の実施形態)
 次に、本発明の第2の実施形態を説明する。本実施形態の暗号化回路は図1と同様、暗号化部1000と鍵生成部2000を含む。
 図17は、本発明の第2の実施形態の暗号化部1000の構成を例示する図である。図17を参照すると、暗号化部1000は初期マスク演算部1101、レジスタ1201及び1202、鍵演算部1600、パーミュテーション部1301及び1302、非線形変換部1400、線形変換部1500、選択部1700、乱数生成部1800並びにアンマスク演算部1102を備えている。
 第2の実施形態は、Feistel構造を持つ暗号に対する実施形態となっている。
 第1の実施形態との違いは、Feistel構造の2系列のデータに対応するために、排他的論理和演算部1A00が追加された点、レジスタ1200がレジスタ1201と1202の2つに分割された点と、鍵演算部1600とパーミュテーション部1301の入力が異なる点、選択部1700におけるsvと非線形変換部1400のマスクMとNの関係式、初期マスク演算部1101の初期マスクテーブル1111、アンマスク演算部1102のアンマスクテーブル1113である。
 排他的論理和演算部1A00は、レジスタ1202に格納された値と線形変換部1500の出力とを加算する(排他的論理和をとる)。
 図17において、レジスタ1201および1202はラウンド処理の中間値を記憶する。初回のラウンド処理では、初期マスク演算部1101の出力を分割したものが各レジスタに記憶される。2回目以降のラウンド処理では、レジスタ1201には排他的論理和演算部1A00の結果が格納され、レジスタ1202には前のラウンドでレジスタ1201に格納されていた中間値が格納される。
 鍵演算部1600は、レジスタ1201に格納されている値と、ラウンド鍵とを加算する(排他的論理和をとる)。
 第1のパーミュテーション部1301は、鍵演算部1600の出力を入力値としてデータ列の並び替えを行う。このとき、どのような並び替えを行うかは、選択部1700の選択値にしたがう。
 選択部1700の選択値がsvであるとき、第2のパーミュテーション部1302の並び替えをP2sv(・)、線形変換をL(・)、選択値sv’のときの第1のパーミュテーション部1301の並び替えをP1sv’(・)、選択値svのときにレジスタ1202に格納されているデータにかかっているマスクをMRsvとし、選択部1700の選択値svがあったときに、次の選択値がsv’になるとして、全てのsvに対して、前記非線形変換部1400の入力側マスクMと出力側マスクNに対して、次の関係を満たせる並び替えパターンを、第1及び第2パーミュテーション部1301及び1302に持たせる。
M=P1sv’(L(P2sv(N)) (XOR) MRsv)
 初期マスクテーブル1111に格納されている各初期マスクは、選択値に基づいて選択され、平文との排他的論理和が演算される。演算後に、データは2系列に分割され、レジスタ1201と1202にそれぞれ格納される。
 レジスタ1201に格納されるデータにかかる初期マスクMLは、パーミュテーション部1301においてとり得る並び替えパターンのいずれかで並び替えることで、非線形変換テーブルの入力側マスクMと等しくなる。選択値svのときの初期マスクMLをMLsv、選択値svのときの第1のパーミュテーション部1301の並び替えをP1sv(・)として次の関係を満たす。
P1sv(MLsv) = M 
 レジスタ1202に格納されるデータにかかる初期マスクMRは、選択部1700の選択値svがあったときに、次の選択値がsv’になるとして、選択値がsvのときの初期マスクMLをMLsvとし、選択値sv’のときの初期マスクMRをMRsv’としたとき、MLsvとMRsv’は等しくなる。
MRsv’ = MLsv
 レジスタ1201に格納されるデータには、ラウンド処理をしている間、選択部1700の選択値svに応じたマスクがかかっており、かかっているマスクは初期マスクMLsvと等しい。また、レジスタ1202に格納されるデータにも、ラウンド処理をしている間、選択部1700の選択値svに応じたマスクがかかっており、かかっているマスクは初期マスクMRsvと等しい。
 アンマスクテーブル1113に格納されている各アンマスクは、選択値に基づいて選択され、ラウンド処理の結果であるレジスタ1201に格納されていた中間値と、排他的論理和演算部1A00の結果、それぞれとの排他的論理和が演算される。演算された結果が暗号文として出力される。
 レジスタ1201に格納されていた中間値との演算が行われるアンマスクULは、パーミュテーション部1301においてとり得る並び替えパターンのいずれかで並び替えることで、非線形変換テーブルの入力側マスクMと等しくなる。選択値svのときのアンマスクULをULsv、初期マスクをMLsv、選択値svのときの第1のパーミュテーション部1301の並び替えをP1sv(・)として次の関係を満たす。
P1sv(ULsv) = M
ULsv = MLsv
 排他的論理和演算部1A00の結果との演算が行われるアンマスクURは、選択値svのときのアンマスクURをURsvとして、選択部1700の選択値svがあったときに、選択値svのときの初期マスクMRsvとし、非線形変換部1400の出力側マスクをN、第2のパーミュテーション部1302の並び替えをP2sv(・)、線形変換をL(・)として、次の関係を満たす。
URsv = L(P2sv(N)) (XOR) MRsv
 図18は、第2の実施形態の動作を説明するフローチャートである。第1の実施形態との違いは、排他的論理和(ステップA14)とデータ入れ替え(ステップA15)が追加された点と、ステップの順番が入れ替わり、処理対象のデータが変わった点(ステップA5-1~A9-1)である。図17と18を用いて、第2の実施形態の動作を説明する。
 ステップA4の後、処理されたデータはレジスタ1201及び1202に記憶される。初期マスク処理後、ラウンド処理として、ステップA9-1からステップA11が行われる。第2の実施形態では、まず鍵演算部1600で、ラウンド鍵とレジスタ1201の中間値との排他的論理和演算を行う(ステップA9-1)。処理するデータ列の長さは、Feistel構造における処理となるため、元の平文のデータ長の半分となる。以降のラウンド処理における各ステップでも処理するデータ長は元の平文のデータ長の半分となる。
 次に、パーミュテーション部1301は選択値に基づき、データ列の並び替えを行う(ステップA5-1)さらに、非線形変換部1200、パーミュテーション部1302および線形変換部1500でそれぞれ処理が行われる(ステップA6-1、A7-1、A8-1)。
 続いて、排他的論理和演算部1A00は、レジスタ1202に記憶された中間値と、線形変換部1500の出力との排他的論理和を演算する(ステップA14)。
 排他的論理和演算部1A00での演算後、規定ラウンド回数、ラウンド処理を繰り返したか否か(ラウンド処理終了)の判定を行う(ステップA10)。該判定の結果、ラウンド処理が規定回数終わっていない場合には、まず分割されたデータの入れ替えが行われ(ステップA15)、続けて選択部1700において、選択値の更新(ステップA11)を行った後、ステップA9-1に戻り、再び、ラウンド処理を繰り返す。一方、ラウンド処理が規定回数部終了した場合には、ステップA12へ進む。
 ラウンド処理終了後、アンマスク演算部1102は、選択値に基づいてアンマスクテーブルから選択されたアンマスクと、レジスタ1201に記憶されている中間値および排他的論理和演算部1A00の出力との排他的論理和を演算し、演算結果を暗号文として出力する(ステップA12)。
 なお、本実施形態では、2系列のFeistel構造以外にも、4系列や8系列などの一般化Feistelに適用することも可能である。図19の例では、4系列の一般化Feistel構造に対して本実施形態を適用している。なお、図19では選択部や乱数生成部は省略して記載している。
(実施例1)
 図2等を参照して説明した前記第1の実施形態の一具体例として、128ビットAES(AES128)を用いるときの暗号化処理回路を説明する。
 図20は、実施例1の暗号化処理回路の暗号化部の構成を例示する図である。暗号化部は、初期マスク演算部3101、アンマスク演算部3102、レジスタ3200、パーミュテーション部3301及び3302、マスク付SBOXを16個備える非線形変換部3400、図2の線形変換部1500に対応するShiftRows演算部3501とMixColumns演算部3502、ラウンド鍵を排他的論理和で加算する鍵演算部3601及び3602、選択部3700並びに乱数生成部3800とを備えている。
 初期マスク演算部3101とアンマスク演算部3102は、それぞれ図3、図4と同じ構成を持つ。
 AES128では、ラウンド処理の前に鍵加算を行う必要があるため、鍵加算用の演算部3601が、初期マスク演算部3101とレジスタ3200の間に追加されている。
 また、線形処理としては、ShiftRowsと、MixColumnssが用いられる。そのため、ShiftRows演算部3501とMixColumns演算部3502を、図2の線形処理部1500として、備えている。なお、最終ラウンドではMixColumnsでの処理は行われないため、最終ラウンドでMixColumns演算部3502を回避するための経路を設けている。
 AES128でのパーミュテーションとして、4の倍数のバイトの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行う、2種類の巡回シフトを組み合わせた並び替えを採用する。
 AES128では16バイトのデータを1バイトずつに区切り、各バイトのデータを4x4のデータで表現することがある。本実施形態では、4の倍数のバイトの巡回シフトのことを横方向への巡回シフトとし、4バイトごとに列を構成し、各列の中で同じ巡回シフトを縦方向への巡回シフトとする。
 図23Aから図23Dは、4x4で表した16バイトのデータにおける、2種類の巡回シフトを示したものである。図23Aは元のAESのデータ配列、図23Bは4の倍数のバイトの巡回シフトによって並び替えた結果(4*2バイト巡回シフト)、図23Cは4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果(各列の中の2バイト巡回シフト)、図23Dは4の倍数のバイトの巡回シフトによって並び替え、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えた結果(4*2バイト巡回シフト後、各列の中の2バイト巡回シフト)を示している。
 AES128における線形変換では、あるデータ列Xに対して2種類の巡回シフトによる並び替えを行い、並び替えたP1(X)に対して線形変換を行った結果L(P(X))と、同じデータ列に対して線形変換を行い、線形変換を行った結果L(X)を2種類の巡回シフトにより並び替えた結果P2(L(X))との結果を一致させることができるためである。なお、P1(・)とP2(・)はともに2種類の巡回シフトによる並び替えであるが、縦方向及び横方向への移動量は一致してなくてもよい。
 図20において、パーミュテーション部3301及び3302では、選択部3700による選択値Rにしたがって2種類の巡回シフトを行う。選択値Rがとり得る値はR={0,1,・・・,14,15}のいずれかとする。
 パーミュテーション部3301では、選択値Rと同じバイト位置のデータが0バイト目に来るように2種類の巡回シフトを行う。
 図24A及び図24Bは、以下の式(1)に示すデータXを、それぞれの選択値R(R=0~15)でシフトしたときのデータ位置PR(X)を示している。図24Aは、R=0~7、図24Bは、R=8~15のPR(X)を示している。
Figure JPOXMLDOC01-appb-M000001
 パーミュテーション部3302では、パーミュテーション部3301とは逆に、0バイト目のデータが選択値Rと同じバイト位置に来るように2種類の巡回シフトを行う。
 図25A及び図25Bは、上記のXをそれぞれの選択値R(R=0~15)でシフトしたときのデータ位置PR(X)を示している。図25Aは、R=0~7、図25Bは、R=8~15のPR(X)を示している。
 図20の非線形変換部3400の各非線形変換テーブルS1~S16(図21参照)は1バイト単位で処理を行う。非線形変換部3400における入力側のマスク値Mおよび出力側のマスク値Nは16バイトとなり(マスク値Mは図22の[m1,m2,m3, m16]の連結、マスク値Nは図22の[n1,n2,n3, n16]の連結)、1バイトずつに区切られて、各マスク付非線形変換テーブルに対応づけられる。
 図20の選択部3700は、乱数生成部3800が生成する乱数を受け取り、乱数を初期の選択値Rとする。
 また、選択部3700では、ラウンド処理ごとに選択値Rの更新が行われる。本実施例における選択値Rの更新方法としては、例えば以下の方法が用いられる(ただし、以下に制限されない)。
・計算式を用意しておき、その計算式に現在の選択値、もしくは初期の乱数値と現在のラウンド数を入力して、次の選択値を求める、
・テーブルを用意しておき、現在の選択値、もしくは初期の乱数値と現在のラウンド数を引数として、次の選択値を読み出す。
 本実施例では、現在の選択値(R)を用いて、テーブルから、次の選択値(R')を読み出す方法により、選択値を更新する。
 非線形変換部3400における入力側のマスク値Mおよび出力側のマスク値N(図22参照)、および選択部3700の選択値Rの更新用のテーブルの決め方について説明する。
 非線形変換部3400における入力側のマスク値Mと出力側のマスク値Nのうち、一方は任意の値を設定できる。ここで、マスク値Nを設定した場合には、次に選択値Rと次のラウンドの選択値R’を設定する。
 そして、非線形変換部3400における出力側のマスク値Nに対して、パーミュテーション部3302において選択値Rに対応する並び替えテーブルに基づき並び替えを行う。
 次に、並び替えた結果(P2R(N))に対して、線形処理として、ShiftRows演算部3501とMixColumns演算部3502で処理を行う。
 線形処理を行った結果(L(P2R(N)))に対して、パーミュテーション部3301において、選択値R’に対応する並び替えテーブルに基づき並び替えを行う。この並び替えの結果を、非線形変換部3400の入力側のマスクMとする。
 逆にMに任意の値を設定した場合は、上記とは逆の手順として、パーミュテーション部3301における並び替えの逆演算、MixColumns演算部3502での逆演算、ShiftRows演算部3501の逆演算、及びパーミュテーション部3302の並び替えの逆演算によってNを求める。
 次に、選択値Rの更新用のテーブルの決め方について説明する。
 まず、非線形変換部3400における出力側のマスク値Nをパーミュテーション部3302において選択値Rによって並び替え、線形処理のShiftRows演算部3501、MixColumns演算部3502を行ったデータL(P2(N))において、Mの0バイト目のマスクが位置しているバイトをR’とする。
 もしくは、パーミュテーション部3301においてL(P2(N))をMと同じ並びとするために必要な選択値をR’とする。この作業を、全てのRに対して行うことで、Rに対するR’を決定することができ、更新用のテーブルが完成する。
 乱数生成部3800は、暗号処理開始時にR={0,1,・・・,14,15}の中のいずれかの値を生成し、選択部へ出力する。
 本実施例で用いるマスク値(16バイト)は以下の通りとする。なお、数値は16進法で表記している。
SBOX入力側マスクM={30482444cfb7dbbba1622a0b5e9dd5f4}
SBOX出力側マスクN={6afe93444801c1bbb7783e4895876cb7}
 図26および図27は、図20の初期マスク演算部3101の初期マスクテーブル(図3の1111)と、アンマスク演算部3102のアンマスクテーブル(図4の1113)を示す。これらの初期マスクとアンマスクは、初期マスク演算部3101の初期マスクテーブル(図3の1111)、アンマスク演算部3102のアンマスクテーブル(図4の1113)に記憶される。
 一方、MとNは、非線形変換部3400のSBOX(図21のS1~S16)に事前に反映しておく。元のSBOXの関数をS(x)とした場合、反映後のSBOX St(x)(t=1~16)は以下で与えられる。
St(x)=S(xt(XOR)mt)(XOR)nt
 ここで、m、nは、MとMの中のある1バイト分のマスク値を示す。
 マスク値の関係として、MはNに、ShiftRows,Mixcolumnsで演算した後、パーミュテーション(4バイト巡回シフト)をしたものとなる。
 つまり、R=0として、パーミュテーション部3302で巡回シフトし(R=0なので、シフトはしない)、ShiftRows、Mixcolumnsで演算した後、R’=4としてパーミュテーション部3301で巡回シフトしたものである。
 本実施例では、R=0、R’=4として、マスクや選択値の更新用のテーブルを設定しているが、RとR’の組み合わせを変えることで、異なるマスクや選択値の更新用のテーブルを構築することが可能である。
 初期マスクはR=0のときは、SBOX入力側マスクMと等価となり、それ以外の選択値Rの初期マスクはR=0の初期マスクM0に対して、パーミュテーション部3302で選択値Rとして巡回シフトを行ったものとなる。
 アンマスクは、Nをパーミュテーション部3302において選択値Rで巡回シフトを行ったものに、ShiftRowsで変換したものと等価となる。
 また、図28は、現在の選択値R(0~15)と次のラウンドの選択値R’の関係を表すテーブルの一例を示す。
 図29は、図20の実施例1の動作を説明するフローチャートである。図20、図29を参照して、実施例1の動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は暗号化部1000、秘密鍵は鍵生成部2000へ入力される(ステップB1)。
 暗号処理が開始されたときに、図2の乱数生成部3800は乱数を生成し、乱数が選択部3700へ入力される(ステップB2)。
 選択部3700は、入力された乱数を基に選択値Rを出力する(ステップB3)。
 初期マスク演算部3101はて、図26の初期マスクテーブルより選択値Rに基づいて初期マスクを選択し、平文と初期マスクとの排他的論理和を演算する。この排他的論理和演算(加算演算)により、平文にマスクをかける(ステップB4)。
 次に、鍵演算部3601は、マスクがかかった平文と、鍵生成部2000から出力されるラウンド鍵との排他的論理和をとり、演算結果をレジスタ3200へ記憶する(ステップB5)。
 鍵演算部3601での処理後、ラウンド処理として、ステップB6~B13が行われる。なお、10ラウンド目のみ処理内容が異なるため9ラウンド目終了時に次のステップへ分岐する。
 まず、パーミュテーション部3301は選択値Rに基づき、データ列の並び替えを行う(ステップB6)。
 次に、非線形変換部3400は、パーミュテーション部3301の出力値を非線形変換し、非線形変換出力(Y)を出力する(ステップB7)。非線形変換部3400は、パーミュテーション部3301の出力値を16個に分割し、x1~x16が非線形変換テーブル(S1~S16)3411~3414(図21参照)へと入力される。
 これら、非線形変換テーブルはマスク付の非線形変換テーブルとなっている。非線形変換テーブル(S1)3411では、図22に示すように、排他的論理和演算部3431にて、x1とm1との排他的論理和を演算し、演算結果を非線形変換テーブル3421(S(・))によって非線形変換し、排他的論理和演算部3435で非線形変換した結果とn1との排他的論理和をとり、排他的論理和演算結果を非線形変換テーブル(S1)3411の出力y1とする。
 ここで、ステップB4で平文にかけた初期マスク値と、m1~mtを結合(concatenate)したマスク値M(=m1||m2||・・・||mt;ただし、||は連結(連接)を示す)とが一致する。これは、選択値Rが共通であり、Mを選択値Rに基づいてパーミュテーション部3202によって並び替えたものを初期マスクテーブルに格納しているためである。初期マスクは、パーミュテーション部3202とは逆の並び替えを行うパーミュテーション部3201によって並び替えられるため、初期マスクは入力側のマスク値Mと同じ並びとなり、入力側のマスク値Mと初期マスクは一致する。
 初期マスクと、非線形変換部3400での入力側のマスク値Mが相殺されるため(一致する値同士の排他的論理和をとると、0となる)、非線形変換3421~3424は、元の平文に対して非線形変換を行うこととなる。
 そして、図22の排他的論理和演算部3435~3438において、元の平文を非線形変換した結果に、n1~n16を連結したマスクN(=n1||n2||・・・||n16)をかけることとなる。
 図20のパーミュテーション部3302は、選択値Rに基づき、非線形変換部3400の出力Yを並び替える(ステップB8)。
 パーミュテーション部3302で行われる並び替えは、パーミュテーション部3301の並び替えとは逆である。パーミュテーション部3302で逆の並び替えを行うことで、データの順番を、パーミュテーション部3301に入力される前の順番に戻すことができる。また、データにかかっているマスクの配列が並び替えられる。
 次に、ShiftRows演算部3501は、並び替えられた非線形変換の結果に対して、ShiftRows演算を行う(ステップB9)。
 つづけて、MixColumns演算部3502は、ShiftRows演算の結果に対して、MixColumns演算を行う(ステップB10)。
 鍵演算部3601は、MixColumns演算部3502の出力と、鍵生成部2000から送られてきたラウンド鍵との排他的論理和を演算し、演算結果を出力する(ステップB11)。演算結果はレジスタ3200に記憶される。
 選択部3700は、例えば図28に示したテーブルにしたがって、現在の選択値Rから次の選択値R'へ更新する(ステップB12)。
 図20の鍵演算部3601及び選択部3700における処理後、ラウンド処理を9回繰り返したか否か(最終ラウンド処理開始)の判定を行う(ステップB13)。
 該判定の結果、ラウンド処理が規定回数分(9ラウンド)終わっていない場合には、ステップB6に戻り、再び、ラウンド処理を繰り返す。
 一方、ラウンド処理が9回終了した場合には、最終ラウンド処理として、ステップB14へ進む。
 ラウンド処理を繰り返す場合、まず、パーミュテーション部3301は、鍵演算部3601の結果を並び替える(ステップB6)。
 次に、並び替えたデータ列に対して、非線形変換部3400は非線形変換を行い、変換結果を出力する(ステップB7)。
 パーミュテーション部3302は、非線形変換部3400の変換結果を選択値Rに基づき並び替え、並び替えた結果を出力する(ステップB8)。
 次に、ShiftRows演算部3501は、並び替えられた非線形変換の結果に対して、ShiftRows演算を行う(ステップB9)。
 つづけて、MixColumns演算部3502は、ShiftRows演算の結果に対して、MixColumns演算を行う(ステップB10)。
 鍵演算部3601は、MixColumns演算部3502の出力と、鍵生成部2000から送られてきたラウンド鍵との排他的論理和を演算し、演算結果を出力する(ステップB11)。演算結果はレジスタ3200に記憶される。
 選択部3700は、例えば図28に示したテーブルにしたがって、現在の選択値Rから次の選択値R'へ更新する(ステップB12)。
 ラウンド処理が規定回数行われた場合、ステップB12からステップB13へと進む。
 最終ラウンド(10ラウンド目)では、ステップB6-1,B7-1,B8-1,B9-1及びB11-1が、上述したステップB6,B7,B8,B9及びB11と同じように行われる。
 AESでは、最終ラウンドにおいて、MixColumns処理は行わないため、ステップB10は行われない。
 鍵演算部3601での処理終了後、アンマスク演算部3302は、鍵演算部3601の処理結果と、図27に示したアンマスクテーブルの中から選択値Rが示すアンマスクとの排他的論理和を演算し、演算結果を暗号文として出力する(ステップB14)。
 アンマスクは、非線形変換部3400における出力側マスク値Nを、パーミュテーション部3302において選択値Rで巡回シフトを行ったものに、ShiftRows演算部3501で変換したものと等価となる。
 したがって、鍵演算部3601の処理結果と、選択値Rで読み出したアンマスクとの排他的論理和を演算することで、鍵演算部3601の処理結果にかかっているマスクを解除することができ、暗号文を得ることができる。
 最後に暗号文Cを出力し終了となる(ステップB15)。
 本実施例を適用したときのデータの遷移を、図30A、図30B、図30C、図31A、図31B、図31C、図32A、図32B、図32C、図33A及び図33Bに示す。
 図30A~図33Bは、最初の乱数がR=0のときの遷移を示す図である(図30A:ラウンド0、図30B:ラウンド1、図30C:ラウンド2、図31A:ラウンド3、図31B:ラウンド4、図31C:ラウンド5、図32A:ラウンド6、図32B:ラウンド7、図32C:ラウンド8、図33A:ラウンド9、図33B:ラウンド10)。
 また、図34A~図37Bは、最初の乱数がR=7のときの遷移を示す図である(図34A:ラウンド0、図34B:ラウンド1、図34C:ラウンド2、図35A:ラウンド3、図35B:ラウンド4、図35C:ラウンド5、図36A:ラウンド6、図36B:ラウンド7、図36C:ラウンド8、図37A:ラウンド9、図37B:ラウンド10)。
 また比較例のAES128におけるデータ遷移を、図38A~図41Bに示す。図42に、比較例のAESの暗号化部の回路構成を示す。また、図43は図42の非線形変換部3401の構成を示す。図43の非線形変換部3401では、16個のマスクなしの非線形変換テーブルを備える。
 図30A~図41Bでは、以下のデータに対して処理を行っている。
平文={3243f6a8885a308d313198a2e0370734}
秘密鍵={2b7e151628aed2a6abf7158809cf4f3c}
暗号文={3925841d02dc09fbdc118597196a0b32}
SBOX入力側マスクM={30482444cfb7dbbba1622a0b5e9dd5f4}
SBOX出力側マスクN={6afe93444801c1bbb7783e4895876cb7}
 なお、初期マスクテーブルは図26、アンマスクテーブルは図27に示している。
 また、選択部3700における選択値Rの更新は、図28のテーブルにもとづいて行う。
 なお、1ラウンド目から10ラウンド目のAfterAddInputMask、AfterSubBytes、AfterAddOutputMask、InputMask、OutputMaskは、データの遷移を示すために記載されているが、実際の処理では、StartofRoundの次のAfterPermutationR=xの値が、図20の非線形変換部3400に入力されたら、AfterAddOutputMaskの値のみが出力される。そのため、AfterAddInputMask、AfterSubBytes、InputMask、OutputMaskの値は、非線形変換部3400の変換処理では現れない。
 選択値の更新はラウンドの最後に行い、どのように遷移しているかは、AfterAddRoundKeyの下にR:x->x’の形で示している。
(実施例2)
 暗号として3D暗号を用いるときの暗号化処理回路を実施例2として説明する。はじめに、3D暗号を用いるときの暗号化処理回路の一般的な構成例を説明する。3D暗号とは、AESの暗号化処理を利用したアルゴリズム構造を持ち、AESが4x4の16バイト(128ビット)を処理単位としているのに対し、3D暗号では4x4x4の64バイト(512ビット)の3次元ブロックを処理単位としている。また、このブロックに対してAES的処理と3次元的ラウンド関数が追加されている(非特許文献6)。3D暗号で扱われるデータ形式を以下の式(2)に示す。
Figure JPOXMLDOC01-appb-M000002
 3D暗号では4x4x4の64バイト(512ビット)の3次元ブロックが1データブロックとなる。16バイト区切りで1スライスとし、1から16バイト目が1スライス目、17から32バイト目が2スライス目、33から48バイト目が3スライス目、49から64バイト目が4スライス目となる。
 図44は、3D暗号の暗号化回路の構成(参考例)を示す図である。3D暗号の暗号化回路は、レジスタ4200、非線形変換部4401、拡散関数部(θ)4501、最大距離分離行列部(π)4502並びに鍵演算部(AddRoundKey)4601及び4602を備えている。
 非線形変換部4401は、入力値Xを非線形変換し、変換結果を出力値Yとして出力する。図45は非線形変換部4401の構成を例示する図である。非線形変換部4401は、64個の非線形変換テーブル(γ)4421~4424で構成される。非線形変換テーブル(γ)4421~4424では、AESのSBOX(SubstitutionBox)と同様の非線形変換を行う。
 拡散関数部(θ)4501では、非線形変換部4401の出力値Yに対して拡散処理を行い、処理結果を最大距離分離行列部(π)4502へ出力する。拡散関数部(θ)4501は、拡散関数θ1又はθ2にしたがって拡散処理を行う。なお、奇数ラウンドでは、θ1による拡散を行い、偶数ラウンドではθ2による拡散を行う。
 θ1は、各スライスの中でShiftRowsを行う処理となる。θ2は、各スライスの1列目の4バイトを4列あわせたものを4x4の行列とし、その行列に対して、ShiftRowsを行う。Xに対してθ1及びθ2を適用した場合の例を以下の式(3)及び式(4)に示す。
Figure JPOXMLDOC01-appb-M000003
Figure JPOXMLDOC01-appb-M000004
最大距離分離行列部(π)4502では、拡散関数部(θ)4501の処理結果の各スライスと、4x4の最大距離分離行列(MDS)との積を計算する。最大距離分離行列部(π)4302で行われる計算の例として、Xの第1スライスX1との計算を以下の式(5)に示す。
Figure JPOXMLDOC01-appb-M000005
 なお、MDS内の要素は16進数となる。ラウンド鍵加算部(AddRoundKey)4601及び4402は最大距離分離行列部(π)4502の処理結果、及び、平文と512ビットのラウンド鍵との排他的論理和を演算し、演算結果を出力する。
 図46は、図44の参考例の動作を説明するフローチャートである。図44、図46を参照して参考例の動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は暗号化部1000、秘密鍵は鍵生成部2000へ入力される(ステップC1)。
 鍵演算部4602は、平文とラウンド鍵Kiとの排他的論理和を演算する(ステップC2)。
 排他的論理和後、ラウンド処理としてステップC3~C7が行われる。
 まず、非線形変換部4400は、鍵演算部4601又は4602の出力結果の非線形変換を行う(ステップC3)。非線形変換部4400は内部で、非線形変換部4400への入力値を1バイトごとに分割し、非線形変換テーブル(γ)4421~4424で非線形変換を行う。
 拡散関数部(θ)4501は、奇数ラウンド目であるか否かを判断する(ステップC4)。
 奇数ラウンド目の場合、非線形変換部4401の出力に対して拡散関数θ1で拡散処理を行う(ステップC5-1)。
 偶数ラウンド目の場合、非線形変換部4401の出力に対して拡散関数θ2で拡散処理を行う(ステップC5-2)。
 最大距離分離行列部(π)4502は、拡散関数部(θ)4501の出力とMDS行列πとの演算を行う(ステップC6)。
 鍵演算部4601は、最大距離分離行列部(π)4502の演算結果と、鍵生成部2000で生成されたラウンド鍵との排他的論理和を演算する(ステップC2)。
 鍵演算部4601での演算後、現在のラウンドが、21ラウンド目(次が最終ラウンド)であるか否かを判断する(ステップC7)。
 次が最終ラウンドではない場合には、ステップC3に戻りラウンド処理を繰り返す。次が最終ラウンドの場合、ステップC3-1へ進む。
 22ラウンド目では、MDS行列πとの演算がスキップされる。そのため、非線形変換処理(ステップC3-1)、拡散処理θ2(ステップC5-2)、鍵演算部4601での処理(ステップC2)が行われる。ここでラウンド処理が終了となる。
 最後に、鍵演算部4601の結果を暗号文として出力して終了する(ステップC8)。
 以上の3D暗号の暗号化処理回路へ本発明を適用した実施例2を示す。図47は、実施例2の暗号化部の構成を例示する図である。図44の3D暗号の暗号化部の回路構成との相違点は、マスク演算用の初期マスク演算部4101、アンマスク演算部4102とパーミュテーション部4301~4302、選択部4700、および乱数生成部4800が追加された点と、図44の非線形変換部4401の代わりに、マスク付の非線形変換テーブル(γ1~γ64)4411~4414を備える非線形変換部4400を備えている点である。
 初期マスク演算部4101は初期マスクと入力データとの、アンマスク演算部4102ではアンマスクと入力データとの排他的論理和を演算する。
 パーミュテーション部4301及び4302は、選択値に基づき入力されたデータの並び替えを行う。なお、パーミュテーション部4302はパーミュテーション部4301とは逆の並び替えを行う。
 非線形変換部4400は入力されたデータの非線形変換を行う。非線形変換部4400は64個のマスク付非線形変換テーブル(γ1~γ64)4411~4414を備える。非線形変換部4400は、入力値を1バイトずつ64個のデータに分割し、それぞれマスク付非線形変換テーブル(γ1~γ64)4411~4414で非線形変換処理を行う。図48は非線形変換部4400の構成を例示する図である。
 非線形変換テーブル(γ1)4411は、1バイトの入力値とマスクm1を排他的論理和で演算した値に対して、非線形変換テーブルγで非線形変換を行い、非線形変換した結果にマスクn1を排他的論理和した値を出力値としてとる。図49は非線形変換部4400の構成をである。図49は図48の各非線形変換テーブル4411~4414の入出力の関係を示した図である。
 実施例2のマスク値について説明する。3D暗号では奇数ラウンドと偶数ラウンドで拡散処理が変わるため、対策が必要となる。
 1つ目の対策は、奇数ラウンドと偶数ラウンドで非線形変換部を切り替える方法である。マスク値の組み合わせとして2通り用意し、それにあわせて2つの非線形変換部を用意する。非線形変換部4400A及び4400Bの出力値はセレクタ4450で選択され、奇数ラウンド時には4400Aの出力値が、偶数ラウンド時には4400Bの出力値が選択される(図50)。
 マスク値の設定では、入力側もしくは出力側のどちらか一方のマスクを任意に設定できる。非線形選択部4400Aの入力側マスクMaと4400Bの入力側マスクMbを任意に設定するか、逆に非線形選択部4400Aの出力側マスクNaと4400Bの出力側マスクNbを任意に設定するかの、どちらか一方の組み合わせを任意に設定が可能である。
 直前の偶数ラウンドの選択値Rと次の奇数ラウンドの選択値R’を設定した上で、非線形選択部4400Aの入力側マスクMaは、直前の偶数ラウンドでNbに対して、パーミュテーション部4302によるパーミュテーション、θ2による拡散処理、MDS行列πによる演算処理、及びパーミュテーション部4301によるパーミュテーションが行われたものとする。
 これにより、偶数ラウンド中に演算が行われたNbを、次の奇数ラウンドの非線形選択部4400Aにて相殺することができる。
 一方、非線形変換部4400Bの入力側マスクMbは、直前の偶数ラウンドの選択値Rと次の奇数ラウンドの選択値R’を設定した上で、直前の偶数ラウンドでNaに対してパーミュテーション部4302によるパーミュテーション、θ1による拡散処理、MDS行列πによる演算処理、及びパーミュテーション部4301によるパーミュテーションが行われたものとする。
 これにより、奇数ラウンド中に演算が行われたMb-Aを、次の偶数ラウンドの非線形選択部420Bにて相殺することができる。
 また、初期マスクテーブルは、1ラウンド目は非線形選択部4200Aが選択されるため、Maに対してパーミュテーション部4301において各選択値に対する並び替えの逆を行ったものとする。
 一方、アンマスクテーブルは、最後の22ラウンド目には、πとの行列演算が行われないため、Nbに対して、θ2とパーミュテーション4302の各選択値の並び替えが行われた値となる。
 こちらの対策では、非線形選択部を2つ用意する必要があるが、64種類のマスク値を設定することが可能となる。
 2つ目の対策は、Nに対してθ1とθ2のどちらの演算が行われても、結果が等しくなるように、マスクを設定するものである。設定の仕方として、最初に現在のラウンドの選択値Rと次のラウンドの選択値R’を設定する。次に、第1スライスにあたる1~16バイト目の出力側マスクN1に任意の値を設定する。
 第2スライスの17~32バイト目の出力側マスクN2は、N1を12バイト巡回シフトしたものとする。
 第3スライスの33~48バイト目の出力側マスクN3は、N1を8バイト巡回シフトしたものとする。
 さらに、第4スライスの49~64バイト目の出力側マスクN4は、N1を4バイト巡回シフトしたものとする。
 続けて、入力側マスクMを求める。MはN(={N1||N2||N3||N4};ただし、||は連結(連接)を示す)に対して選択値Rでのパーミュテーション4302とθ1とπ、及び選択値R’でのパーミュテーション4301を行ったものとする。
 図51に以上の方法で設定した入力側マスクMを示す。
 このように設定することで、1つの非線形変換部を備えるだけで、ラウンド処理を繰り返すことができる。2つ目の対策では、非線形変換部は1つですむが、マスク値は16種類のみ設定可能である。
 次に、実施例2におけるパーミュテーションについて説明する。
 3D暗号に適用可能なパーミュテーションとして、3つのステップによる並び替えがあげられる。
 1ステップ目として、スライスごと巡回シフトを行う。これは、16の倍数のバイトでデータ全体を巡回シフトすることとなる。
 2ステップ目として、各スライス内で、4の倍数のバイトの巡回シフトを行う。つまり、1~16バイト目の中で、0・4・8・12バイトのいずれかの巡回シフトを、17~32バイト目の中で、0・4・8・12バイトのいずれかの巡回シフトを行っていく。他の2つのスライスも同様に0・4・8・12バイトのいずれかの巡回シフトを行っていく。
 3ステップ目として、1~4バイトを1列目、5~8バイト目を2列目と4バイト単位で列を構成し、各列の内部で同じ巡回シフトを行う方法がある。
 図52A及び図52Bは、上記の3ステップによるパーミュテーションを示している図である。
 図53A及び図53Bは、実施例2の動作を説明するフローチャートである。図46の比較例との相違点は、ステップC9~15及びC12-1が追加された点と、図46のステップC3及びC3-1が、マスク付非線形変換(ステップC3-2)に変更された点である。
 図47並びに図53A及び図53Bを使い、実施例2の動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は暗号化部1000、秘密鍵は鍵生成部2000へ入力される(ステップC1)。
 乱数生成部4800は乱数を生成し、選択部4700へ出力する(ステップC9)。
 選択部4700は、乱数から選択値を決定し、選択値を出力する(ステップC10)。
 初期マスク演算部4101は、図3の初期マスクテーブル1111より選択値に基づいて初期マスクを選択し、平文と初期マスクとの排他的論理和を演算する。この排他的論理和演算(加算演算)により、平文にマスクをかける(ステップC11)。マスクがかかった平文はレジスタ4200に記憶される。また、鍵演算部4601は、平文とラウンド鍵Kiとの排他的論理和を演算する(ステップC2)。
 マスク処理後、ラウンド処理として、ステップC12からステップC7が行われる。まず、図47のパーミュテーション部4301は選択値に基づき、データ列の並び替えを行う(ステップC12)。
 次に、非線形変換部4400は、パーミュテーション部4301の出力値を非線形変換し、非線形変換出力を出力する(ステップC3-2)。非線形変換部4400は、パーミュテーション部4301の出力値を64個に分割し、x1~x64が、非線形変換テーブルγ1~γ64)4411~4414へと入力される。これら、非線形変換テーブルはマスク付の非線形変換テーブルとなっている。非線形変換テーブル(γ1)4411の結果は、x1とm1との排他的論理和を演算し、演算結果を非線形変換γ(・)によって非線形変換し、非線形変換した結果とn1との排他的論理和をとった結果となる。
 パーミュテーション部4302は、選択値に基づき、非線形変換部4400の出力を並び替える(ステップC13)。パーミュテーション部4302で行われる並び替えはパーミュテーション部4301とは逆の並び替えである。逆の並び替えを行うことで、データの順番をパーミュテーション部4301に入力される前の順番に戻すことができる。また、データにかかっているマスクの配列が並び替えられる。
 拡散関数部(θ)4501は、奇数ラウンド目であるか否かを判断する(ステップC4)。
 奇数ラウンド目である場合、非線形変換部4400の出力に対して拡散関数θ1で拡散処理を行う(ステップC5-1)。
 偶数ラウンド目である場合、非線形変換部4400の出力に対して拡散関数θ2で拡散処理を行う(ステップC5-2)。
 最大距離分離行列部(π)4502は、拡散関数部(θ)4501の出力とMDS行列πとの演算を行う(ステップC6)。
 鍵演算部4600は、最大距離分離行列部(π)4502の演算結果と、鍵生成部2000で生成されたラウンド鍵との排他的論理和を演算する(ステップC2)。
 また、選択部4700は選択値の更新を行う(ステップC14)。
 鍵演算部4600での演算、選択値の更新後、現在のラウンドが21ラウンド目(次が最終ラウンド)であるか否かを判断する(ステップC7)。
 次が最終ラウンドではない場合、ステップC12に戻りラウンド処理を繰り返す。次が最終ラウンドの場合、ステップC12-1へ進む。
 22ラウンド目では、MDS行列πとの演算がスキップされる。そのため、マスク付非線形変換処理(ステップC3-2)、拡散処理θ2(ステップC5-2)、鍵演算(ステップC2)、が行われる。ここでラウンド処理が終了となる。
 続いて、アンマスク演算部4102は、図4のアンマスクテーブル1113より選択値にもとづいてアンマスクを選択し、ラウンド処理の結果である鍵演算部4600の出力と、アンマスクとの排他的論理和を演算し、演算結果を暗号文として出力する(ステップC15)。このアンマスクとの排他的論理和は、ラウンド処理の結果にかかっているマスクを解除し、本来の暗号文を得るものである。
 最後に、アンマスク演算部4102の結果を暗号文として出力して終了する(ステップC8)。
(実施例3)
 暗号としてTWINEを用いるときの暗号化処理回路を実施例3として説明する。はじめに、TWINEを用いるときの暗号化処理回路の一般的な構成例を説明する。TWINEとは、一般化Feistelを改良した構造を持ち、64ビットのデータを16個のサブブロックに分割した4ビットを処理単位としている。このサブブロックのうち、8つのサブブロックにのみ鍵の値を与えた後、F関数により変換を行い、残りの8つのサブブロックに排他的論理和演算で暗号化処理をする(非特許文献7)。
 図54は、TWINEの暗号化処理回路の暗号化部の構成(参考例)を示す図である。TWINEの暗号化回路は、レジスタ5200、8個のF関数部5A01~5A04、8個の排他的論理和演算部5901~5904、線形変換部5500を備えている。
 レジスタ5200には平文もしくは1ラウンドごとの処理結果(中間値)が記憶される。
 図55は、F関数部5A01の構成を例示する図である。TWINEのF関数部5A01は、ラウンド鍵ki1との排他的論理和を演算する排他的論理和演算部5411と、非線形変換テーブル5421とを備える。TWINEのF関数部5A01は、まずラウンド鍵のうちの4ビット部分(ki_1)と入力との排他的論理和演算を行い、演算結果を非線形変換テーブル5421によって非線形変換S(・)を行う。
 つづいて、図54の排他的論理和演算部5901は、F関数部5A01の出力とレジスタ5200に記憶に記憶されていたサブブロックのうちの1つとの排他的論理和演算をとる。
 次に、線形変換部5500は、レジスタ5200に記憶されていた8つのサブブロックと、排他的論理和演算部5901~5904の結果に対して、線形変換を行う。図56は線形変換部5500の処理を示している。図56において、線形変換部5500では16個のサブブロックの入れ替えのみ行っている。
 図57は図54の回路を等価変形した回路を示す。図57では最初に平文が2つに分割され、それぞれレジスタ5201と5202に記憶される。ここで、平文は16個のサブブロックにまず分割され、分割されたサブブロックのうち奇数番目(1,3、・・・、15)のデータがレジスタ5201へ、偶数番目(2,4、・・・、16)のデータがレジスタ5202へ記憶される。暗号文を出力するときには、分割されたデータの順番を元に戻して出力する。
 図57では、データが2系列に分割され、分割されたうちの1系列を鍵演算部5600および非線形変換部5401で処理し、排他的論理和演算部5900で処理した結果ともう1つの系列との排他的論理和を演算する。排他的論理和演算部5900の結果は線形変換部5501で線形変換され、変換結果はレジスタ5201へ記憶される。一方、レジスタ5201に記憶されていたデータは線形変換部5502で線形変換され、レジスタ5202へ記憶される。
 図58は図57の鍵演算部5600の構成を示す図である。鍵演算部5600は8つの排他的論理和演算部5611~5614で構成される。鍵演算部5600は、入力およびラウンド鍵が8つのサブブロックに分割し、サブブロックごとに排他的論理和演算を行う。
 図59は図57の非線形変換部5401の構成を示す図である。非線形変換部5401は図54の非線形変換テーブル5421~5424を8個備えている。非線形変換部5401は、入力が8つのサブブロックに分割し、サブブロックごとに非線形変換テーブル5421~5424で非線形変換を行う。
 図60と図61は図57の線形変換部5501と5502の構成を示す図である。図56の線形変換部5500は16個のサブブロックの入れ替えを行っていたが、図60および図61の線形変換部5501と5502は8個のサブブロックの入れ替えを行う。
 図62は図57のTWINEの動作を説明するフローチャートである。図57~62を参照して、TWINEの動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は暗号化部1000、秘密鍵は鍵生成部2000へ入力される(ステップD1)。暗号化部1000に入力された平文は16個のサブブロックに分割され、分割された平文のうち奇数番目の8個のサブブロックはレジスタ5201へ、残りの半分はレジスタ5202へ記憶される。
 TWINEでは、ラウンド処理としてステップD2~D6が行われる。
 鍵演算部5600は、レジスタ5201に記憶されている8個のサブブロックのデータとラウンド鍵との排他的論理和を演算する(ステップD2)。
 非線形変換部5401は、鍵演算部5600の出力結果の非線形変換を行う(ステップD3)。非線形変換部5401は、内部で、非線形変換部5401への入力値を8個のサブブロックへ分割し、非線形変換テーブル5421~5424で非線形変換を行う。
 排他的論理和演算部5900は、非線形変換部5401の出力結果と、レジスタ5202に記憶されている8個のサブブロックのデータとの排他的論理和を演算する(ステップD4)。
 線形変換部5501は、排他的論理和演算部5900の出力結果の線形変換を行い、線形変換部5502は、レジスタ5201に記憶されている8個のサブブロックのデータの線形変換を行う(ステップD5)。線形変換部5501の出力結果はレジスタ5201に、線形変換部5202の出力結果はレジスタ5202に記憶される。
 線形変換部5501および5502での処理後、現在のラウンドが、35ラウンド目(次が最終ラウンド)であるか否かを判断する(ステップD6)。
 次が最終ラウンドでない場合には、ステップD2に戻りラウンド処理を繰り返す。次が最終ラウンドの場合、ステップD2-1へ進む。
 36ラウンド目では、線形変換がスキップされる。そのため、鍵演算部5600(ステップD2-1)、非線形変換部5401(ステップD3)、および排他的論理和演算部5900(ステップD4)での処理が行われる。
 最後に、レジスタ5201に記憶されている8個のサブブロックのデータ、および排他的論理和演算部5900の出力結果を統合して、統合結果を暗号文として出力して終了する(ステップD7)。
 以上のTWINEの暗号化処理回路へ本発明を適用した実施例3を示す。図63は、実施例3の暗号化部の構成を例示する図である。図57のTWINEの暗号化部の回路構成との相違点は、暗号化処理開始時のマスク演算用の初期マスク演算部5101、暗号文出力前に行うアンマスク演算部5102、パーミュテーション部5301及び5302、選択部5700並びに乱数生成部5800が追加された点と、図57の非線形変換部5401の代わりに、マスク付きの非線形変換テーブル5411~5414を8個備える非線形変換部5400を備えている点である。
 初期マスク演算部5101は、図3の初期マスク演算部1101と同じく、初期マスクテーブル1111と排他的論理和演算部1112を備えており、選択値によって選択された初期マスクと平文との排他的論理和を演算する。
 アンマスク演算部5102は、図4のアンマスク演算部1102と同じく、アンマスクテーブル1113と排他的論理和演算部1114を備えており、選択値によって選択されたアンマスクと入力データとの排他的論理和を演算する。
 パーミュテーション部5301及び5302では、選択値に基づき入力されたデータの並び替えを行う。なお、パーミュテーション部5302はパーミュテーション部5301とは逆の並び替えを行う。
 非線形変換部5400は、図5や図6の非線形変換部1400と同様に、複数のマスク付き非線形変換テーブルを備える。図64は非線形変換部5400の構成を例示する図である。実施例3では8個のマスク付き非線形変換テーブル5411~5414を備える。非線形変換部5400では、入力値を4ビットのサブブロックを単位として8ブロックに分割し、それぞれマスク付き非線形変換テーブル5411~5414で非線形変換処理を行う。
 マスク付き非線形変換テーブル(S1)5411では、4ビットの入力値x1とマスクm1を排他的論理和で演算し、演算結果を非線形変換テーブル(S)5421で非線形変換を行い、非線形変換した結果とマスクn1との排他的論理和をとった値が出力となる。図64は図65の各非線形変換テーブル5411~5414の入出力の関係を示した図である。
 図65において、非線形変換テーブル5421~5424の入力側に配置されているマスクm1~m8を結合したマスク値をM、出力側に配置されているマスクn1~n8を結合したマスク値をNとする。
 図63の選択部5700は、乱数生成部5800が生成する乱数を受け取り、乱数を初期の選択値svとする。また、選択部5700はラウンド処理が1ラウンド終了するごとに選択値svの更新を行う。
 選択値の更新方法は、実施例1で例示した方法を用いることができる。本実施例では、現在の選択値svを用いて、テーブルから、次の選択値sv’を読み出す方法により、選択値を更新する。
 乱数生成部5800は暗号処理開始時にsv={0、1、・・・、6、7}の中のいずれかの値を生成し、選択部に出力する。
 選択部5700の選択値がsvであるとき、第2のパーミュテーション部5302の並び替えをP2sv(・)、線形変換部5501の線形変換をL1(・)、選択値sv’のときの第1のパーミュテーション部5301の並び替えをP1sv’(・)、選択値svのときにレジスタ5202に格納されているデータにかかっているマスクをMRsvとし、選択部5700の選択値svがあったときに、次の選択値がsv’になるとして、全てのsvに対して、前記非線形変換部5400の入力側マスクMと出力側マスクNに対して、次の関係を満たせる並び替えパターンを、第1及び第2パーミュテーション部5301及び5302に持たせる。
M=P1sv’(L1( P2sv(N) (XOR) MRsv) )
 レジスタ5201に格納されるデータにかかる初期マスクMLは、パーミュテーション部5301においてとり得る並び替えパターンのいずれかで並び替えることで、非線形変換テーブルの入力側マスクMと等しくなる。選択値svのときの初期マスクMLをMLsv、選択値svのときの第1のパーミュテーション部5301の並び替えをP1sv(・)として次の関係を満たす。
P1sv(MLsv) = M 
 レジスタ5202に格納されるデータにかかる初期マスクMRは、選択部5700の選択値svがあったときに、次の選択値がsv’になるとして、選択値sv’のときの初期マスクMRをMRsv’としたとき、線形変換部5502の線形変換をL2(・)としたとき、次の関係を満たす。
MRsv’ = L2(MLsv)
 レジスタ5201に格納されるデータには、ラウンド処理をしている間、選択部5700の選択値svに応じたマスクがかかっており、かかっているマスクは初期マスクMLsvと等しい。また、レジスタ5202に格納されるデータにも、ラウンド処理をしている間、選択部5700の選択値svに応じたマスクがかかっており、かかっているマスクは初期マスクMRsvと等しい。
 レジスタ5201に格納されていた中間値との演算が行われるアンマスクULは、パーミュテーション部5301においてとり得る並び替えパターンのいずれかで並び替えることで、非線形変換テーブルの入力側マスクMと等しくなる。選択部5700の選択値svがあったときに、選択値svのときのアンマスクULをULsv、レジスタ5201の中間値にかかる初期マスクをMLsv、選択値svのときの第1のパーミュテーション部5301の並び替えをP1sv(・)として次の関係を満たす。
P1sv(ULsv) = M
ULsv = MLsv
 排他的論理和演算部5900の結果との演算が行われるアンマスクURは、選択部5700の選択値svがあったときに、選択値svのときのアンマスクURをURsv、レジスタ5202の中間値にかかる初期マスクをMRsvとし、非線形変換部5400の出力側マスクをN、第2のパーミュテーション部5302の並び替えをP2sv(・)として、次の関係を満たす。
URsv = P2sv(N) (XOR) MRsv
 実施例3における、パーミュテーション部5301及び5302のP1sv(・)、P2sv(・)の例を図66に、初期マスク演算部5101の初期マスクMRsv、MLsv、アンマスク演算部5102のアンマスクURsv、ULsv、非線形変換部5400の入力側マスクM、出力側マスクNの例を図67に、選択部5700における選択値svの更新用テーブルの例を図68に示す。
 図66の表は、元のデータX={x0, x1, x2, ・・・, x7}に対して、選択値svの場合にパーミュテーション部5301及び5302で処理した場合の結果P1sv(X)、P2sv(X)を示している。
 図67において、M及びNは8つのマスク付き非線形変換テーブルにおけるそれぞれのマスク値を示す。MLsvは最初の選択値がsvであったときにレジスタ5201に記憶されるデータにかかるマスクを示す。また、MRsvは最初の選択値がsvであったときにレジスタ5202に記憶されるデータにかかるマスクを示す。ULsvは36ラウンド目の選択値がsvであったときに、レジスタ5201に記憶されているデータにかかっているマスクを解除するために使用するアンマスクを示す。また、URsvは36ラウンド目の選択値がsvであったときに排他的論理和演算部5900の出力にかかっているマスクを解除するために使用するアンマスクを示す。
 図68は、現在のラウンドの選択値がsvであるときに、次のラウンドの選択値sv’がいくつになるかを示す表である。
 図69A及び図69Bは、図63の実施例3の動作を説明するフローチャートである。図62のフローチャートとの相違点は、ステップD8~D14が追加された点と、図62のステップD3がマスク付き非線形変換(ステップD3-1)に変更された点である。図63並びに図69A及び図69Bを参照して、実施例3の動作を説明する。
 はじめに、平文及び秘密鍵を暗号化処理回路へ入力し、平文は暗号化部1000、秘密鍵は鍵生成部2000へ入力される(ステップD1)。
 次に、乱数生成部5800は乱数を生成し、選択部5700へ出力する(ステップD8)。
 選択部5700は、乱数から選択値を決定し、選択値を出力する(ステップD9)。
 初期マスク演算部5101は、図3の初期マスクテーブル1111より選択値に基づいて初期マスクを選択し、平文と初期マスクとの排他的論理和を演算する。この排他的論理和演算により、平文にマスクをかける(ステップD10)。マスクがかかった平文は16個のサブブロックに分割され、分割された平文のうち奇数番目の8個のサブブロックはレジスタ5201へ、残りの半分はレジスタ5202へ記憶される。
 実施例3では、ラウンド処理としてステップD2~D6が行われる。
 鍵演算部5600は、レジスタ5201に記憶されている8個のサブブロックのデータとラウンド鍵との排他的論理和を演算する(ステップD2)。
 パーミュテーション部5301は、選択部5700から出力されている選択値に基づき、鍵演算部5600の出力を並び替える(ステップD11)。
 非線形変換部5400は、パーミュテーション部5301の出力結果の非線形変換を行う(ステップD3-1)。非線形変換部5400は、内部で、非線形変換部5401への入力値を8個のサブブロックへ分割し、マスク付き非線形変換テーブル5411~5414で非線形変換を行う。非線形変換テーブル(S1)5411では、4ビットの入力値x1とマスクm1を排他的論理和で演算し、演算結果を非線形変換テーブル(S)5421で非線形変換を行い、非線形変換した結果とマスクn1との排他的論理和をとった値が出力となる。
 パーミュテーション部5302は、選択部5700から出力されている選択値に基づき、非線形変換部5400の出力を並び替える(ステップD12)。パーミュテーション部5302で行われる並び替えはパーミュテーション部5301とは逆の並び替えである。逆の並び替えを行うことで、データの順番をパーミュテーション部5301に入力される前の順番に戻すことができる。一方、データにかかっているマスクの配列が並び替えられる。
 排他的論理和演算部5900は、パーミュテーション部5302の出力結果と、レジスタ5202に記憶されている8個のサブブロックのデータとの排他的論理和を演算する(ステップD4)。
 線形変換部5501は、排他的論理和演算部5900の出力結果の線形変換を行い、線形変換部5502は、レジスタ5201に記憶されている8個のサブブロックのデータの線形変換を行う(ステップD5)。線形変換部5501の出力結果はレジスタ5201に、線形変換部5202の出力結果はレジスタ5202に記憶される。
 選択部5700は、選択値の更新を行う(ステップD13)。
 選択値の更新後、現在のラウンドが、35ラウンド目(次が最終ラウンド)であるか否かを判断する(ステップD6)。
 次が最終ラウンドでない場合には、ステップD2に戻りラウンド処理を繰り返す。次が最終ラウンドの場合、ステップD2-1へ進む。
 36ラウンド目では、線形変換がスキップされる。そのため、鍵演算部5600(ステップD2-1)、パーミュテーション部5301(ステップD11)、非線形変換部5400(ステップD3-1)、パーミュテーション部5302(ステップD12)および排他的論理和演算部5900(ステップD4)での処理が行われる。ここでラウンド処理が終了となる。ラウンド処理の結果として、レジスタ5201に記憶されている8個のサブブロックのデータ、および排他的論理和演算部5900の出力結果が得られる。
 ラウンド処理終了後、アンマスク演算部5102は、図4のアンマスクテーブル1113より選択値に基づいてアンマスクを選択し、選択されたアンマスクと、レジスタ5201に記憶されている8個のサブブロックのデータ、および排他的論理和演算部5900の出力結果を統合したデータとの排他的論理和を演算する(ステップD14)。
 最後に、アンマスク演算部5102の演算結果を暗号文として出力して終了する(ステップD7)。
 なお、上記実施形態1及び2、並びに、実施例1、2及び3の各暗号化処理回路は、ハードウェア、ソフトウェア又はこれらの組合わせにより実現することができる。また、上記の暗号化処理回路その他の装置等により行なわれる暗号化処理方法も、ハードウェア、ソフトウェア又はこれらに組合わせにより実現することができる。ここで、ソフトウェアによって実現されるとは、コンピュータがプログラムを読み込んで実行することにより実現されることを意味する。プログラムは、様々なタイプの非一時的なコンピュータ可読媒体(non-transitorycomputerreadablemedium)を用いて格納され、コンピュータに供給することができる。非一時的なコンピュータ可読媒体は、様々なタイプの実体のある記録媒体(tangiblestoragemedium)を含む。非一時的なコンピュータ可読媒体の例は、磁気記録媒体(例えば、フレキシブルディスク、磁気テープ、ハードディスクドライブ)、光磁気記録媒体(例えば、光磁気ディスク)、CD-ROM(ReadOnlyMemory)、CD-R、CD-R/W、半導体メモリ(例えば、マスクROM、PROM(ProgrammableROM)、EPROM(ErasablePROM)、フラッシュROM、RAM(randomaccessmemory))を含む。また、プログラムは、様々なタイプの一時的なコンピュータ可読媒体(transitorycomputerreadablemedium)によってコンピュータに供給されてもよい。一時的なコンピュータ可読媒体の例は、電気信号、光信号、及び電磁波を含む。一時的なコンピュータ可読媒体は、電線及び光ファイバ等の有線通信路、又は無線通信路を介して、プログラムをコンピュータに供給できる。
 上記の実施形態及び実施例では、暗号化処理回路について説明したが、本発明を適用して、復号処理回路(すなわち、暗号解読処理回路)も、暗号化処理回路と同様な構成とすることができる。復号処理とは、暗号化処理とは逆に、暗号文を平文に戻す処理のことである。この場合、「暗号化」は、「復号」に置き換わる。
 図70は、本発明の第1の実施形態に係る復号処理回路の構成を例示する図である。図70では、図1における「暗号化部1000」が「復号部6000」に置き換わる。また、図1における暗号化部1000を復号部とした場合、図70では「暗号文」を入力とし、「平文」を出力とする。また、図2の暗号化部は、復号部に置き換わる。図71は、復号部6000の構成を示した図である。以下、図71を参照して、復号部における動作を説明する。図71において、暗号文を入力として、処理結果を平文として出力する。前記実施形態1で暗号化された暗号文は、復号部に入力され、復号部におけるアンマスク演算部6102にて、アンマスクがかけられ、レジスタ6200に記憶される。以降、ラウンド処理として、鍵演算部6600で、ラウンド鍵Kiとの加算(等価的に減算)が行われ、演算結果を線形変換部6500で線形変換する。復号部における線形変換部6500は、暗号化部における線形変換L(・)に対して逆変換L-1(・)となる。線形変換部6500で逆変換した結果を、パーミュテーション部6302で並び替える。パーミュテーション部6302での並び替えは、暗号化部のパーミュテーション部1302での並び替えとは逆とされる。並び替えた結果は、t個に分割され、非線形変換部6400のテーブル(S1~St)に入力する。復号部におけるテーブル(S1~St)は、暗号化部におけるテーブル(S1~St)と入力と出力が逆となる(暗号化部におけるテーブルの出力を入力(テーブルインデックス)とし、暗号化部におけるテーブルの入力を、テーブルインデックスに対応する出力値とする)。また、復号部におけるテーブル(S1~St)では、暗号化部におけるテーブルの出力側のマスクNを入力側のマスクとし、暗号化部におけるテーブルの入力側のマスクMを出力側のマスクとする。非線形変換部6400の変換した結果を、パーミュテーション部6301で並び替える。パーミュテーション部6301での並び替えは、暗号化部のパーミュテーション部1301での並び替えとは逆とされる。復号部において、規定回数のラウンド処理が繰り返されると、パーミュテーション部6301の処理結果に対して、初期マスク演算部6101で初期マスクとの演算を行うことでマスクが解除され、処理結果が平文として出力される。また、選択値の更新も、暗号化部のときとは逆となり、暗号化部では選択値svが次のラウンドではsv’に更新されていた場合、復号部では選択値sv’が次のラウンドではsvへと値が更新される。
 また、図72は、本発明の第2の実施形態に係る復号部の構成を例示する図である。以下、図72を参照して、復号部における動作を説明する。図72において、暗号文を入力として、処理結果を平文として出力する。前記実施形態2で暗号化された暗号文は、復号部に入力され、復号部におけるアンマスク演算部7102にてアンマスクがかけられ、レジスタ7201及び7202に分割されて記憶される。以降、ラウンド処理として、鍵演算部7600、パーミュテーション部7302、非線形変換部7400、パーミュテーション部7301及び線形変換部7500による処理を行う。鍵演算部7600は、レジスタ7201に格納された値とラウンド鍵Kiとの加算(等価的に減算)を行う。パーミュテーション部7302は、鍵加算部7600の演算結果を選択値に応じて並び替える。パーミュテーション部7302での並び替えは、暗号化部のパーミュテーション部1302での並び替えとは逆とされる。並び替えた結果は、t個に分割され、非線形変換部7400のテーブル(S1~St)に入力する。復号部におけるテーブル(S1~St)は、暗号化部におけるテーブル(S1~St)と入力と出力が逆となる(暗号化部におけるテーブルの出力を入力(テーブルインデックス)とし、暗号化部におけるテーブルの入力を、テーブルインデックスに対応する出力値とする)。また、復号部におけるテーブル(S1~St)では、暗号化部におけるテーブルの出力側のマスクNを入力側のマスクとし、暗号化部におけるテーブルの入力側のマスクMを出力側のマスクとする。非線形変換部7400の変換した結果を、パーミュテーション部7301で並び替える。パーミュテーション部7301での並び替えは、暗号化部のパーミュテーション部1301での並び替えとは逆とされる。パーミュテーション部7301で並び替えた結果を線形変換部7500で線形変換する。復号部における線形変換部7500は、暗号化部における線形変換L(・)に対して逆変換L-1(・)となる。そして、排他的論理和演算部7A00は、線形変換部7500で逆変換した結果と、レジスタ7202にに格納された値との排他的論理和をとる。2回目以降のラウンド処理では、レジスタ7201には排他的論理和演算部7A00の結果が格納され、レジスタ7202には前のラウンドでレジスタ7201に格納されていた中間値が格納される。復号部において、規定回数のラウンド処理が繰り返されると、初期マスク演算部7101は、排他的論理和演算部7A00の結果と、レジスタ7201に格納された値とに対して初期マスクとの演算を行うことでマスクが解除され、処理結果が平文として出力される。また、選択値の更新も、暗号化部のときとは逆となり、暗号化部では選択値svが次のラウンドではsv’に更新されていた場合、復号部では選択値sv’が次のラウンドではsvへと値が更新される。
 このように本発明の各実施の形態では、マスキングにより中間値と消費電力との相関を低下させることができ、マスクデータを排他的論理和で中間値に付加することで、耐タンパ性を高めることができる。
 なお、上記の特許文献、非特許文献の各開示を、本書に引用をもって繰り込むものとする。本発明の全開示(請求の範囲を含む)の枠内において、さらにその基本的技術思想に基づいて、実施形態ないし実施例の変更・調整が可能である。また、本発明の請求の範囲の枠内において種々の開示要素(各付記の各要素、各実施例の各要素、各図面の各要素等を含む)の多様な組み合わせ、乃至選択が可能である。すなわち、本発明は、請求の範囲を含む全開示、技術的思想にしたがって当業者であればなし得るであろう各種変形、修正を含むことは勿論である。
 上記の実施形態の一部又は全部は、以下の付記のようにも記載され得るが、以下には限られない。
 (付記1)
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択部と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力した平文との排他的論理和をとり、入力データ列の初期値とする初期マスク演算部と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択部からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション部と、
 前記第1のパーミュテーション部の出力を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換部と、
 前記非線形変換部の複数の出力値を結合したデータ列に対して、前記選択部からの前記選択値に応じて、前記第1のパーミュテーション部とは逆のパターンの並び替えを行う第2のパーミュテーション部と、
 前記第2のパーミュテーション部の出力に基づいて線形変換を施す第1の線形変換部と、
 を備え、
 前記非線形変換部は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション部、前記非線形変換部、前記第2のパーミュテーション部及び前記第1の線形変換部を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換部の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択部からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算部
 をさらに備える暗号化処理回路。
 (付記2)
 前記第1および第2のパーミュテーション部の各パーミュテーション部は、
 データ列を、前記パーミュテーション部において並び替えた値に対して、前記第1の線形変換部で線形変換した結果と、
 前記データ列を、前記第1の線形変換部で線形変換した結果に対して、前記パーミュテーション部で並び替えを行った結果と、
 が互いに一致するような、並び替えパターンを持つ、ことを特徴とする付記1に記載の暗号化処理回路。
 (付記3)
 前記選択部は、データ列にかかっているマスク値の並びと、前記非線形変換部の前記入力側のマスク値の並びが一致するように、前記第1のパーミュテーション部の並び替えのパターンを選択する、ことを特徴とする付記1または2に記載の暗号化処理回路。
 (付記4)
 前記選択部の選択値が第1の値(sv)であるときの前記第2のパーミュテーション部の並び替えをP2sv(・)、線形変換をL(・)とし、
 前記選択値が第2の値(sv')のときの前記第1のパーミュテーション部の並び替えをP1sv’(・)とし、前記選択部の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択部での全ての選択値に対して、前記非線形変換部の入力側マスク値Mと出力側マスク値Nに対して、
M=P1sv'(L(P2sv(N)))
の関係を満たす並び替えパターンを前記第1、第2のパーミュテーション部が有する、ことを特徴とする付記1乃至3のいずれか1項に記載の暗号化処理回路。
 (付記5)
 前記非線形変換部の出力側のマスク値を、前記第2のパーミュテーション部で並び替え、
 前記第2のパーミュテーション部で並び替えた値を前記第1の線形変換部で線形変換し、
 前記第1の線形変換部で線形変換した結果に対して前記第1のパーミュテーション部で並び替えた値を、前記非線形変換部の入力側のマスク値とする、ことを特徴とする付記1乃至4のいずれか1項に記載の暗号化処理回路。
 (付記6)
 Feistel構造をもつ暗号を対象とし、
 2系列もしくはそれ以上の系列の入力のうち半数の系列を前記入力データ列として、前記第1のパーミュテーション部、前記非線形変換部、前記第2のパーミュテーション部及び前記第1の線形変換部で処理を行い、
 当該処理の結果と残りの半数の系列との排他的論理和と演算する、
 ことを特徴とする付記1乃至3のいずれか1項に記載の暗号化処理回路。
 (付記7)
 前記選択部の選択値が第1の値(sv)であるときの前記第2のパーミュテーション部の並び替えをP2sv(・)、線形変換をL(・)、前記残りの半数の系列にかかっているマスクをMRsvとし、
 前記選択値が第2の値(sv')のときの前記第1のパーミュテーション部の並び替えをP1sv’(・)とし、前記選択部の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択部での全ての選択値に対して、前記非線形変換部の入力側マスク値Mと出力側マスク値Nに対して、
 M=P1sv’(L(P2sv(N)) (XOR) MRsv)
の関係を満たす並び替えパターンを前記第1及び第2のパーミュテーション部が有する、ことを特徴とする付記6に記載の暗号化処理回路。
 (付記8)
 前記非線形変換部の出力側のマスク値を、前記第2のパーミュテーション部で並び替え、
 前記第2のパーミュテーション部で並び替えた値を前記第1の線形変換部で線形変換し、
 前記第1の線形変換部で線形変換した結果と前記残りの半数の系列にかかっているマスクとの排他的論理和を演算し、
 前記排他的論理和の演算結果を、前記第1のパーミュテーション部で並び替えた値を、前記非線形変換部の入力側のマスク値とする、
 ことを特徴とする付記6または7に記載の暗号化処理回路。
 (付記9)
 暗号化アルゴリズムとしてAES(Advanced Encryption Standard)を対象とし、
 前記第1および第2のパーミュテーション部は、4の倍数のバイトの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行う、ことを特徴とする付記1乃至5のいずれか1項に記載の暗号化処理回路。
 (付記10)
 暗号化アルゴリズムとして3D暗号を対象とし、
 前記第1および第2のパーミュテーション部は、
 第1のスライスの中で4の倍数のバイトでの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で同じ巡回シフトによって並び替えを行い、
 第2のスライスの中で、前記第1のスライスと同じ4の倍数のバイトでの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で第1のスライスと同じ巡回シフトによって並び替えを行い、
 第3のスライスの中で、前記第1のスライスと同じ4の倍数のバイトでの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で第1のスライスと同じ巡回シフトによって並び替えを行い、
 第4のスライスの中で、前記第1のスライスと同じ4の倍数のバイトでの巡回シフトによって並び替えを行い、さらに、4バイトごとに列を構成し、各列の中で第1のスライスと同じ巡回シフトによって並び替えを行う、ことを特徴とする付記1乃至5のいずれか1項に記載の暗号化処理回路。
 (付記11)
 暗号化アルゴリズムとしてTWINEを対象とし、
 前記第1の線形変換部は、前記処理の結果と残りの半数の系列との排他的論理和の演算結果に対して第1の線形変換を施し、前記半数の系列である第1の入力データ列とし、
 前記第1の入力データ列に対して第2の線形変換を施し、前記残りの半数の系列である第2の入力データ列とする第2の線形変換部をさらに備え、
 前記選択部の選択値が第1の値(sv)であるときの前記第2のパーミュテーション部の並び替えをP2sv(・)、前記残りの半数の系列にかかっているマスクをMRsv、前記残りの半数の系列に対する前記第1の線形変換をL1(・)とし、
 前記選択値が第2の値(sv')のときの前記第1のパーミュテーション部の並び替えをP1sv’(・)とし、前記選択部の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択部での全ての選択値に対して、前記非線形変換部の入力側マスク値Mと出力側マスク値Nに対して、
 M=P1sv’(L1( P2sv(N) (XOR) MRsv) )
の関係を満たす並び替えパターンを前記第1及び第2のパーミュテーション部が有する、ことを特徴とする付記6に記載の暗号化処理回路。
 (付記12)
 前記半数の系列にかかっているマスクをMLsv、前記半数の系列に対する前記第2の線形変換をL2(・)とし、
 前記選択値が第2の値(sv')のときの前記第1のパーミュテーション部の並び替えをP1sv’(・)とし、前記選択部の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択部での全ての選択値に対して、前記非線形変換部の入力側マスク値Mと出力側マスク値N、前記半数の系列にかかっているマスクMRsvおよび前記残りの半数の系列にかかっているマスクMLsvに対して、
 M=P1sv’(L1( P2sv(N) (XOR) MRsv) )
 P1sv(MLsv) = M
 MRsv’ = L2(MLsv)
 の関係を満たすマスク値となる、ことを特徴とする付記11に記載の暗号化処理回路。
 (付記13)
 データ処理装置による暗号化処理方法であって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択工程と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算工程と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択工程からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション工程と、
 前記第1のパーミュテーション工程の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換工程と、
 前記選択工程からの選択値に応じて、前記第1のパーミュテーション工程とは逆のパターンの並び替えを、前記非線形変換工程の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション工程と、
 前記第2のパーミュテーション工程の出力に基づいて線形変換を施す第1の線形変換工程と、
 を含み、
 前記非線形変換工程において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション工程、前記非線形変換工程、前記第2のパーミュテーション工程及び前記第1の線形変換工程を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換工程の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択工程からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算工程と、
 をさらに含む暗号化処理方法。
 (付記14)
 データ処理装置に暗号化処理を実行させる暗号化処理プログラムであって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択処理と、
 複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算処理と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択処理からの選択値に対応したパターンの並べ替えを入力データ列に行い、並び替えた結果を出力する第1のパーミュテーション処理と、
 前記第1のパーミュテーション処理の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換処理と、
 前記選択処理からの選択値に応じて、前記第1のパーミュテーション処理とは逆のパターンの並び替えを、前記非線形変換処理の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション処理と、
 前記第2のパーミュテーション処理の出力に基づいて線形変換を施す第1の線形変換処理と、
 を含み、
 前記非線形変換処理において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション処理、前記非線形変換処理、前記第2のパーミュテーション処理及び前記第1の線形変換処理を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記第1の線形変換処理の出力に基づく値を前記入力データ列とし、
 複数のアンマスク値の中から、前記選択処理からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算処理
をさらに含む暗号化処理プログラム。
 (付記15)
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択部と、
 前記選択部からの選択値に応じて、複数のアンマスク値の中からアンマスク値を選択し、選択したアンマスク値と、暗号文との排他的論理和をとり、入力データ列の初期値とするアンマスク演算部と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択部からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション部と、
 前記第1のパーミュテーション部の出力値を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換部と、
 前記選択部からの選択値に応じて、前記第1のパーミュテーション部とは逆のパターンの並び替えを、前記非線形変換部の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション部と、
 前記第2のパーミュテーション部の出力に基づいて線形変換を施す線形変換部と、
 を備え、
 前記非線形変換部は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション部、前記非線形変換部、前記第2のパーミュテーション部及び前記線形変換部を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記線形変換部の出力に基づく値を前記入力データ列とし、
 前記選択部からの選択値に応じて複数の初期マスク値の中から初期マスク値を選択し、選択した初期マスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとる初期マスク演算部をさらに備える復号処理回路。
 (付記16)
 データ処理装置による復号処理方法であって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択工程と、
 前記選択工程からの選択値に応じて、複数のアンマスク値の中からアンマスク値を選択し、選択したアンマスク値と、暗号文との排他的論理和をとり、入力データ列の初期値とするアンマスク演算工程と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択工程からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション工程と、
 前記第1のパーミュテーション工程の出力値を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換工程と、
 前記選択工程からの選択値に応じて、前記第1のパーミュテーション工程とは逆のパターンの並び替えを、前記非線形変換工程の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション工程と、
 前記第2のパーミュテーション工程の出力に基づいて線形変換を施す線形変換工程と、
 を含み、
 前記非線形変換工程において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション工程、前記非線形変換工程、前記第2のパーミュテーション工程及び前記線形変換工程を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記線形変換工程の出力に基づく値を前記入力データ列とし、
 前記選択工程からの選択値に応じて複数の初期マスク値の中から初期マスク値を選択し、選択した初期マスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとる初期マスク演算工程をさらに含む復号処理方法。
 (付記17)
 データ処理装置に復号処理を実行させる復号処理プログラムであって、
 乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択処理と、
 前記選択処理からの選択値に応じて、複数のアンマスク値の中からアンマスク値を選択し、選択したアンマスク値と、暗号文との排他的論理和をとり、入力データ列の初期値とするアンマスク演算処理と、
 前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択処理からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション処理と、
 前記第1のパーミュテーション処理の出力値を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換処理と、
 前記選択処理からの選択値に応じて、前記第1のパーミュテーション処理とは逆のパターンの並び替えを、前記非線形変換処理の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション処理と、
 前記第2のパーミュテーション処理の出力に基づいて線形変換を施す線形変換処理と、
 を含み、
 前記非線形変換処理において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
 前記第1のパーミュテーション処理、前記非線形変換処理、前記第2のパーミュテーション処理及び前記線形変換処理を用いた前記ラウンド処理が規定回数行われ、
 2回目以降のラウンド処理では、前記線形変換処理の出力に基づく値を前記入力データ列とし、
 前記選択処理からの選択値に応じて複数の初期マスク値の中から初期マスク値を選択し、選択した初期マスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとる初期マスク演算処理をさらに含む復号処理プログラム。
 以上、実施の形態を参照して本願発明を説明したが、本願発明は上記によって限定されるものではない。本願発明の構成や詳細には、発明のスコープ内で当業者が理解し得る様々な変更をすることができる。
 この出願は、2013年10月24日に出願された日本出願特願2013-221238を基礎とする優先権を主張し、その開示の全てをここに取り込む。
 1000 暗号化処理
 1101 初期マスク演算処理
 1102 アンマスク演算処理
 1103 MMSj+1加算処理
 1111 初期マスクテーブル
 1112 排他的論理和演算部
 1113 アンマスクテーブル
 1114 排他的論理和演算部
 1200~1204 レジスタ
 1301 パーミュテーション処理
 1302 パーミュテーション処理
 1303 バレルシフト
 1304 バレルシフト
 1305 パーミュテーション処理
 1306 パーミュテーション処理
 1400 非線形変換処理
 1401 非線形変換処理(マスクなし)
 1402 非線形変換処理
 1411 非線形変換テーブル(S1)
 1412 非線形変換テーブル(S2)
 1413 非線形変換テーブル(S3)
 1414 非線形変換テーブル(St)
 1421~1424 非線形変換テーブル(S)
 1431~1438 排他的論理和演算部
 1441 非線形変換テーブル(S1、RSM)
 1442 非線形変換テーブル(S2、RSM)
 1443 非線形変換テーブル(S3、RSM)
 1444 非線形変換テーブル(St、RSM)
 1500~1501 線形変換処理
 1600~1601 鍵加算処理
 1611~1614 排他的論理和演算部
 1700 選択部
 1800 乱数生成部
 1901 前処理部
 1902 後処理部
 1A00~1A02 排他的論理和演算部
 2000 鍵生成部
 3101 初期マスク演算部
 3102 アンマスク演算部
 3200 レジスタ
 3301、3302 パーミュテーション部
 3400 非線形変換部
 3401 非線形変換部(マスクなし)
 3411 非線形変換テーブル(S1)
 3412 非線形変換テーブル(S2)
 3413 非線形変換テーブル(S3)
 3414 非線形変換テーブル(S16)
 3421~3424 非線形変換テーブル(S)
 3431~3438 排他的論理和演算部
 3501 ShiftRows部
 3502 MixColumns部
 3601 鍵加算部
 3700 選択部
 3800 乱数生成部
 4101 初期マスク演算部
 4102 アンマスク演算部
 4400 非線形変換部
 4411 マスク付非線形変換テーブル(γ1)
 4412 マスク付非線形変換テーブル(γ2)
 4413 マスク付非線形変換テーブル(γ2)
 4414 マスク付非線形変換テーブル(γ64)
 4400A 非線形変換部
 4400B 非線形変換部
 4411A マスク付非線形変換テーブル(γ1)
 4412A マスク付非線形変換テーブル(γ64)
 4411B マスク付非線形変換テーブル(γ’1)
 4412B マスク付非線形変換テーブル(γ’64)
 4421~4424 非線形変換テーブル(γ)
 4450 セレクタ
 4501 拡散関数部(θ)
 4502 最大距離分離行列部(π)
 4600 鍵加算部
 4601 鍵加算部(ラウンド0)
 4700 選択部
 4800 乱数生成部
 5101 初期マスク演算処理
 5102 アンマスク演算処理
 5201 レジスタ
 5202 レジスタ
 5301 パーミュテーション処理
 5302 パーミュテーション処理
 5400 非線形変換処理
 5401~5404 非線形変換処理(マスクなし)
 5411 非線形変換テーブル(S1)
 5412 非線形変換テーブル(S2)
 5413 非線形変換テーブル(S3)
 5414 非線形変換テーブル(St)
 5421~5424 非線形変換テーブル(S)
 5431~5438 排他的論理和演算部
 5500 線形変換処理
 5600 鍵加算処理
 5700 選択部
 5800 乱数生成部
 5901 排他的論理和演算部
 6000 復号部
 6101 初期マスク演算部
 6102 アンマスク演算部
 6200 レジスタ
 6301、6302 パーミュテーション部
 6400 非線形変換部
 6500 線形変換部
 6600 鍵加算部
 6700 選択部
 6800 乱数生成部
 7101 初期マスク演算部
 7102 アンマスク演算部
 7201 レジスタ
 7202 レジスタ
 7301 パーミュテーション部
 7302 パーミュテーション部
 7301、7302 パーミュテーション部
 7400 非線形変換部
 7500 線形変換部
 7600 鍵加算部
 7700 選択部
 7800 乱数生成部 7A00 排他的論理和演算部

Claims (10)

  1.  乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択手段と、
     複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力した平文との排他的論理和をとり、入力データ列の初期値とする初期マスク演算手段と、
     前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択手段からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション手段と、
     前記第1のパーミュテーション手段の出力を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換手段と、
     前記非線形変換手段の複数の出力値を結合したデータ列に対して、前記選択手段からの前記選択値に応じて、前記第1のパーミュテーション手段とは逆のパターンの並び替えを行う第2のパーミュテーション手段と、
     前記第2のパーミュテーション手段の出力に基づいて線形変換を施す第1の線形変換手段と、
     を備え、
     前記非線形変換手段は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
     前記第1のパーミュテーション手段、前記非線形変換手段、前記第2のパーミュテーション手段及び前記第1の線形変換手段を用いた前記ラウンド処理が規定回数行われ、
     2回目以降のラウンド処理では、前記第1の線形変換手段の出力に基づく値を前記入力データ列とし、
     複数のアンマスク値の中から、前記選択手段からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算手段
     をさらに備える暗号化処理回路。
  2.  前記第1および第2のパーミュテーション手段の各パーミュテーション手段は、
     データ列を、前記パーミュテーション手段において並び替えた値に対して、前記第1の線形変換手段で線形変換した結果と、
     前記データ列を、前記第1の線形変換手段で線形変換した結果に対して、前記パーミュテーション手段で並び替えを行った結果と、
     が互いに一致するような、並び替えパターンを持つ、ことを特徴とする請求項1に記載の暗号化処理回路。
  3.  前記選択手段は、データ列にかかっているマスク値の並びと、前記非線形変換手段の前記入力側のマスク値の並びが一致するように、前記第1のパーミュテーション手段の並び替えのパターンを選択する、ことを特徴とする請求項1または2に記載の暗号化処理回路。
  4.  Feistel構造をもつ暗号を対象とし、
     2系列もしくはそれ以上の系列の入力のうち半数の系列を前記入力データ列として、前記第1のパーミュテーション手段、前記非線形変換手段、前記第2のパーミュテーション手段及び前記第1の線形変換手段で処理を行い、
     当該処理の結果と残りの半数の系列との排他的論理和と演算する、
     ことを特徴とする請求項1乃至3のいずれか1項に記載の暗号化処理回路。
  5.  前記選択手段の選択値が第1の値(sv)であるときの前記第2のパーミュテーション手段の並び替えをP2sv(・)、線形変換をL(・)、前記残りの半数の系列にかかっているマスクをMRsvとし、
     前記選択値が第2の値(sv')のときの前記第1のパーミュテーション手段の並び替えをP1sv’(・)とし、前記選択手段の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択手段での全ての選択値に対して、前記非線形変換手段の入力側マスク値Mと出力側マスク値Nに対して、
     M=P1sv’(L(P2sv(N)) (XOR) MRsv)
    の関係を満たす並び替えパターンを前記第1及び第2のパーミュテーション手段が有する、ことを特徴とする請求項4に記載の暗号化処理回路。
  6.  前記非線形変換手段の出力側のマスク値を、前記第2のパーミュテーション手段で並び替え、
     前記第2のパーミュテーション手段で並び替えた値を前記第1の線形変換手段で線形変換し、
     前記第1の線形変換手段で線形変換した結果と前記残りの半数の系列にかかっているマスクとの排他的論理和を演算し、
     前記排他的論理和の演算結果を、前記第1のパーミュテーション手段で並び替えた値を、前記非線形変換手段の入力側のマスク値とする、
     ことを特徴とする請求項4又は5に記載の暗号化処理回路。
  7.  暗号化アルゴリズムとしてTWINEを対象とし、
     前記第1の線形変換手段は、前記処理の結果と残りの半数の系列との排他的論理和の演算結果に対して第1の線形変換を施し、前記半数の系列である第1の入力データ列とし、
     前記第1の入力データ列に対して第2の線形変換を施し、前記残りの半数の系列である第2の入力データ列とする第2の線形変換手段をさらに備え、
     前記選択手段の選択値が第1の値(sv)であるときの前記第2のパーミュテーション手段の並び替えをP2sv(・)、前記残りの半数の系列にかかっているマスクをMRsv、前記残りの半数の系列に対する前記第1の線形変換をL1(・)とし、
     前記選択値が第2の値(sv')のときの前記第1のパーミュテーション手段の並び替えをP1sv’(・)とし、前記選択手段の選択値が第1の値(sv)があったときに、次の選択値が第2の値(sv')となるものとして、前記選択手段での全ての選択値に対して、前記非線形変換手段の入力側マスク値Mと出力側マスク値Nに対して、
     M=P1sv’(L1( P2sv(N) (XOR) MRsv) )
    の関係を満たす並び替えパターンを前記第1及び第2のパーミュテーション手段が有する、ことを特徴とする請求項4に記載の暗号化処理回路。
  8.  データ処理装置による暗号化処理方法であって、
     乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択工程と、
     複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算工程と、
     前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択工程からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション工程と、
     前記第1のパーミュテーション工程の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換工程と、
     前記選択工程からの選択値に応じて、前記第1のパーミュテーション工程とは逆のパターンの並び替えを、前記非線形変換工程の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション工程と、
     前記第2のパーミュテーション工程の出力に基づいて線形変換を施す第1の線形変換工程と、
     を含み、
     前記非線形変換工程において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
     前記第1のパーミュテーション工程、前記非線形変換工程、前記第2のパーミュテーション工程及び前記第1の線形変換工程を用いた前記ラウンド処理が規定回数行われ、
     2回目以降のラウンド処理では、前記第1の線形変換工程の出力に基づく値を前記入力データ列とし、
     複数のアンマスク値の中から、前記選択工程からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算工程と、
     をさらに含む暗号化処理方法。
  9.  データ処理装置に暗号化処理を実行させる暗号化処理プログラムであって、
     乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択処理と、
     複数の初期マスク値の中から、前記選択値の初期値に対応した初期マスク値を選択し、選択した初期マスク値と入力したとの排他的論理和をとり、入力データ列の初期値とする初期マスク演算処理と、
     前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択処理からの選択値に対応したパターンの並べ替えを入力データ列に行い、並び替えた結果を出力する第1のパーミュテーション処理と、
     前記第1のパーミュテーション処理の出力値を複数に分割した値をそれぞれ複数のテーブルで非線形変換する非線形変換処理と、
     前記選択処理からの選択値に応じて、前記第1のパーミュテーション処理とは逆のパターンの並び替えを、前記非線形変換処理の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション処理と、
     前記第2のパーミュテーション処理の出力に基づいて線形変換を施す第1の線形変換処理と、
     を含み、
     前記非線形変換処理において、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
     前記第1のパーミュテーション処理、前記非線形変換処理、前記第2のパーミュテーション処理及び前記第1の線形変換処理を用いた前記ラウンド処理が規定回数行われ、
     2回目以降のラウンド処理では、前記第1の線形変換処理の出力に基づく値を前記入力データ列とし、
     複数のアンマスク値の中から、前記選択処理からの前記選択値に対応したアンマスク値を選択し、選択したアンマスク値と前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとり、暗号文として出力するアンマスク演算処理
     をさらに含むことを特徴とする暗号化処理プログラムが格納された非一時的なコンピュータ可読媒体。
  10.  乱数を選択値の初期値として設定し、ラウンド処理が1ラウンド終わるごとに次の選択値へ更新する選択手段と、
     前記選択手段からの選択値に応じて、複数のアンマスク値の中からアンマスク値を選択し、選択したアンマスク値と、暗号文との排他的論理和をとり、入力データ列の初期値とするアンマスク演算手段と、
     前記入力データ列とラウンド鍵とに基づく演算結果に対して、前記選択手段からの選択値に対応したパターンの並べ替えを行い、並び替えた結果を出力する第1のパーミュテーション手段と、
     前記第1のパーミュテーション手段の出力値を複数に分割した値をそれぞれ非線形変換する複数のテーブルを含む非線形変換手段と、
     前記選択手段からの選択値に応じて、前記第1のパーミュテーション手段とは逆のパターンの並び替えを、前記非線形変換手段の複数の出力値を結合したデータ列に対して行う第2のパーミュテーション手段と、
     前記第2のパーミュテーション手段の出力に基づいて線形変換を施す線形変換手段と、
     を備え、
     前記非線形変換手段は、前記テーブルへの入力に対して入力側のマスク値と排他的論理和をとった値を用いて前記テーブルに従った非線形変換を行い、前記非線形変換した値に対して出力側のマスク値と排他的論理和をとった値を出力し、
     前記第1のパーミュテーション手段、前記非線形変換手段、前記第2のパーミュテーション手段及び前記線形変換手段を用いた前記ラウンド処理が規定回数行われ、
     2回目以降のラウンド処理では、前記線形変換手段の出力に基づく値を前記入力データ列とし、
     前記選択手段からの選択値に応じて複数の初期マスク値の中から初期マスク値を選択し、選択した初期マスク値と、前記規定回数のラウンド処理終了後の処理結果との排他的論理和をとる初期マスク演算手段をさらに備える復号処理回路。
PCT/JP2014/003134 2013-10-24 2014-06-12 暗号化処理回路及び復号処理回路並びにその方法 WO2015059845A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015543685A JPWO2015059845A1 (ja) 2013-10-24 2014-06-12 暗号化処理回路及びその方法及びプログラム並びに復号処理回路

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2013-221238 2013-10-24
JP2013221238 2013-10-24

Publications (1)

Publication Number Publication Date
WO2015059845A1 true WO2015059845A1 (ja) 2015-04-30

Family

ID=52992470

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2014/003134 WO2015059845A1 (ja) 2013-10-24 2014-06-12 暗号化処理回路及び復号処理回路並びにその方法

Country Status (2)

Country Link
JP (1) JPWO2015059845A1 (ja)
WO (1) WO2015059845A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116680728A (zh) * 2023-08-04 2023-09-01 浙江宇视科技有限公司 隐私保护生物识别方法、系统、设备和介质

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008292742A (ja) * 2007-05-24 2008-12-04 Toshiba Corp 非線形データ変換器、暗号化装置、および復号装置
US20130129081A1 (en) * 2009-11-13 2013-05-23 Institut Telecom-Telecom Paristech Low-complexity electronic circuit protected by customized masking

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008292742A (ja) * 2007-05-24 2008-12-04 Toshiba Corp 非線形データ変換器、暗号化装置、および復号装置
US20130129081A1 (en) * 2009-11-13 2013-05-23 Institut Telecom-Telecom Paristech Low-complexity electronic circuit protected by customized masking

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NASSAR, M. ET AL.: "RSM: A small and fast countermeasure for AES, secure against 1st and 2nd-order zero-offset SCAs, Proceedings of the Design", AUTOMATION & TEST IN EUROPE, 2012, pages 1173 - 1178 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116680728A (zh) * 2023-08-04 2023-09-01 浙江宇视科技有限公司 隐私保护生物识别方法、系统、设备和介质
CN116680728B (zh) * 2023-08-04 2023-11-24 浙江宇视科技有限公司 隐私保护生物识别方法、系统、设备和介质

Also Published As

Publication number Publication date
JPWO2015059845A1 (ja) 2017-03-09

Similar Documents

Publication Publication Date Title
JP4622807B2 (ja) 暗号処理装置、および暗号処理方法、並びにコンピュータ・プログラム
US9240885B2 (en) Cryptographic processing apparatus, cryptographic processing method, and computer program therefor
JP4882598B2 (ja) 暗号処理装置、暗号処理アルゴリズム構築方法、および暗号処理方法、並びにコンピュータ・プログラム
JP6406350B2 (ja) 暗号処理装置、および暗号処理方法、並びにプログラム
KR101770874B1 (ko) 암호 처리 장치, 암호 처리 방법, 컴퓨터로 판독가능한 기록 매체, 및 정보 처리 장치
US9363074B2 (en) Encryption processing apparatus, encryption processing method, and computer program
JP4622222B2 (ja) 暗号処理装置、および暗号処理方法、並びにコンピュータ・プログラム
US8504845B2 (en) Protecting states of a cryptographic process using group automorphisms
KR20090094086A (ko) 암호 처리 장치, 암호 처리 방법과 컴퓨터 프로그램
RU2603550C2 (ru) Устройство обработки данных, способ обработки данных и программа
JP2015191106A (ja) 暗号処理装置、および暗号処理方法、並びにプログラム
JP2009175167A (ja) データ変換装置、およびデータ変換方法、並びにコンピュータ・プログラム
WO2015146430A1 (ja) 暗号処理装置、および暗号処理方法、並びにプログラム
JP5327493B1 (ja) 暗号化処理回路及び復号処理回路、その方法並びにそのプログラム
JP2010044251A (ja) ハッシュ値生成装置、プログラム及びハッシュ値生成方法
WO2015059845A1 (ja) 暗号化処理回路及び復号処理回路並びにその方法
JP6089668B2 (ja) 暗号化処理回路及び復号処理回路とその方法並びにそのプログラム
JP5605197B2 (ja) 暗号処理装置、および暗号処理方法、並びにプログラム
JP5338327B2 (ja) 暗号処理装置
JP2014197785A (ja) 暗号化処理回路及び復号処理回路とその方法並びにそのプログラム
WO2015146432A1 (ja) 暗号処理装置、および暗号処理方法、並びにプログラム
JP5488608B2 (ja) ブロック暗号装置、ブロック暗号化方法およびプログラム
JP5510587B2 (ja) データ変換装置、およびデータ変換方法、並びにコンピュータ・プログラム
JP5338945B2 (ja) 復号処理装置、情報処理装置、および復号処理方法、並びにコンピュータ・プログラム
Yang Hardware realization for Advanced Encryption Standard key generation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14856407

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2015543685

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14856407

Country of ref document: EP

Kind code of ref document: A1