JP2011234312A - Operation device and central processing unit - Google Patents

Operation device and central processing unit Download PDF

Info

Publication number
JP2011234312A
JP2011234312A JP2010105648A JP2010105648A JP2011234312A JP 2011234312 A JP2011234312 A JP 2011234312A JP 2010105648 A JP2010105648 A JP 2010105648A JP 2010105648 A JP2010105648 A JP 2010105648A JP 2011234312 A JP2011234312 A JP 2011234312A
Authority
JP
Japan
Prior art keywords
signal
data
switching control
control signal
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2010105648A
Other languages
Japanese (ja)
Inventor
Minoru Saeki
稔 佐伯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2010105648A priority Critical patent/JP2011234312A/en
Publication of JP2011234312A publication Critical patent/JP2011234312A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To provide an operation device capable of enhancing the resistance against power analysis attack.SOLUTION: An operation device 3 has a register group 2 and an ALU 1. Each of the register group 2 and the ALU 1 receives a switching control signal 101, and a switching data signal 102 that changes in time and is irrelevant to source data stored in the resister group 2. The register group 2 outputs one or more selected source data to the ALU 1 in response to that the switching control signal 101 is deactivated, and outputs one or more data based on the switching data signal 102 to the ALU 1 in response to that the switching control signal is activated. The ALU 1 outputs the operation result resulting from arithmetic operation or logical operation to the one or more source data in response to that the switching control signal is deactivated, and outputs the data based on the switching data signal 102 in response to that the switching control signal is activated.

Description

この発明は、演算装置および中央処理装置に関し、特に暗号処理に対する電力解析攻撃への耐性を高めた演算装置および中央処理装置に関する。   The present invention relates to an arithmetic unit and a central processing unit, and more particularly to an arithmetic unit and a central processing unit that have improved resistance to power analysis attacks against cryptographic processing.

電力解析攻撃は、暗号処理中の回路の消費電力を解析することによって、処理されている秘密情報を取得するものである。代表的な手法として、DPA(Differential Power Analysis:差分電力解析)やCPA(Correlation Power Analysis:相関電力解析)がある(非特許文献1〜3を参照)。電力解析攻撃に対する耐性を高める方法として、たとえば以下の文献に記載の技術が知られている。   In the power analysis attack, the secret information being processed is obtained by analyzing the power consumption of the circuit during the cryptographic process. Typical techniques include DPA (Differential Power Analysis) and CPA (Correlation Power Analysis) (see Non-Patent Documents 1 to 3). As a method for increasing resistance to power analysis attacks, for example, techniques described in the following documents are known.

特開2008−269060号公報(特許文献1)に記載の半導体集積回路は、メモリと、主制御手段と、データバスと、使用状態判定手段と、無効データ生成手段と、バス制御手段とを含む。メモリには、セキュリティデータまたはそのデータ処理手順が記憶される。主制御手段は、データ処理手順の実行を制御する。データバスは、データ処理手順の実行で用いられる伝送データを伝送する。使用状態判定手段は、データバスに接続された周辺装置の全てについてデータバスに対する伝送データの入出力を制御する伝送制御信号に基づいて、データバスが使用されているか否かを検出する。無効データ生成手段は、無効データを生成する。バス制御手段は、データバスが使用されていないと判定された場合に、データバスに対して無効データを出力する。   A semiconductor integrated circuit described in Japanese Patent Laying-Open No. 2008-269060 (Patent Document 1) includes a memory, a main control unit, a data bus, a usage state determination unit, an invalid data generation unit, and a bus control unit. . The memory stores security data or a data processing procedure thereof. The main control means controls execution of the data processing procedure. The data bus transmits transmission data used in executing the data processing procedure. The use state determination means detects whether or not the data bus is used based on a transmission control signal for controlling input / output of transmission data to / from the data bus for all peripheral devices connected to the data bus. The invalid data generation means generates invalid data. The bus control means outputs invalid data to the data bus when it is determined that the data bus is not used.

特表2002−526849号公報(特許文献2)に記載された暗号化方法では、暗号処理に関するデータビット語をメモリセルまたはレジスタに書込む前に、乱数に基づいて生成されたデータビット語をメモリセルまたはレジスタに格納する。   In the encryption method described in Japanese Patent Publication No. 2002-526849 (Patent Document 2), the data bit word generated based on the random number is stored in the memory before the data bit word related to the encryption process is written in the memory cell or the register. Store in cell or register.

特開2006−19872号公報(特許文献3)は、DES(Data Encryption Standard)など複数段のラウンド関数の繰り返し処理を含む暗号アルゴリズムを実行する暗号処理装置について開示する。この暗号処理装置では、ラウンドごとのデータ処理を実行する関数演算部に対してラウンド遷移時に乱数が入力され、その後、レジスタに格納された中間データが入力され、演算処理が実行される。   Japanese Patent Laying-Open No. 2006-19872 (Patent Document 3) discloses a cryptographic processing apparatus that executes a cryptographic algorithm including a repetition process of a multi-stage round function such as DES (Data Encryption Standard). In this cryptographic processing apparatus, a random number is input at the time of a round transition to a function calculation unit that executes data processing for each round, and thereafter intermediate data stored in a register is input to perform calculation processing.

特開2008−269060号公報JP 2008-269060 A 特表2002−526849号公報Japanese translation of PCT publication No. 2002-526849 特開2006−19872号公報JP 2006-19872 A

Kocher他、「Differential Power Analysis」CRYPTO 1999. LNCS, vol. 1666, pp. 388-397. Springer, Heidelberg (1999)Kocher et al., "Differential Power Analysis" CRYPTO 1999. LNCS, vol. 1666, pp. 388-397. Springer, Heidelberg (1999) Brier他、「Correlation Power Analysis with a Leakage Model」CHES 2004. LNCS, vol. 3156, pp. 16-29. Springer, Heidelberg (2004)Brier et al., "Correlation Power Analysis with a Leakage Model" CHES 2004. LNCS, vol. 3156, pp. 16-29. Springer, Heidelberg (2004) Suzuki他、「DPA Lekage Models for CMOS Logic Circuits」CHES 2005.LNCS,vol.3659, pp. 366-382, Springer-Verlag(2005)Suzuki et al. “DPA Lekage Models for CMOS Logic Circuits” CHES 2005. LNCS, vol. 3659, pp. 366-382, Springer-Verlag (2005)

上記の特開2008−269060号公報(特許文献1)は、CPU(Central Processing Unit:中央処理装置)とメモリとの間でデータバスを介したデータ転送時に発生する消費電力に着目した電力解析攻撃を防御する技術を開示するものである。しかしながら、この技術では、CPU内部で実行される演算時の消費電力に着目した攻撃を防御することができない。   The above-mentioned Japanese Patent Application Laid-Open No. 2008-269060 (Patent Document 1) discloses a power analysis attack that focuses on power consumption generated during data transfer between a CPU (Central Processing Unit) and a memory via a data bus. The technique which defends is disclosed. However, with this technology, it is not possible to defend against attacks that focus on power consumption during computations executed inside the CPU.

上記の特表2002−526849号公報(特許文献2)は、メモリまたはレジスタはデータを書込む際の消費電力に対する攻撃を防御する技術を開示するものである。しかしながら、この技術では、CPUがメモリまたはレジスタに記憶されたデータを使用して演算処理を行なう際の消費電力に基づく電力解析攻撃を防御することはできない。   The above Japanese translation of PCT publication No. 2002-526849 (Patent Document 2) discloses a technique for protecting an attack against power consumption when a memory or register writes data. However, this technique cannot prevent a power analysis attack based on power consumption when the CPU performs arithmetic processing using data stored in a memory or a register.

上記の特開2006−19872号公報(特許文献3)に開示される技術は、DESなどの特定の暗号についての暗号処理を実行する暗号回路に対する電力解析攻撃に対する耐性を向上させるものであり、CPU内部で実行される演算時の消費電力に着目した攻撃を防御することができない。   The technique disclosed in the above Japanese Patent Application Laid-Open No. 2006-19872 (Patent Document 3) improves the resistance to a power analysis attack against a cryptographic circuit that executes cryptographic processing for a specific cipher such as DES, and the CPU It is not possible to defend against attacks that focus on power consumption during computations executed internally.

さらに、上記の特開2008−269060号公報(特許文献1)に記載された一部の実施形態、および特表2002−526849号公報(特許文献2)および特開2006−19872号公報(特許文献3)に開示された各実施形態を実現するためには乱数が必要であり、必要なビット数の乱数を高速に発生することが困難であるという問題もある。   Furthermore, some embodiments described in the above Japanese Patent Application Laid-Open No. 2008-269060 (Patent Document 1), Japanese Patent Application Publication No. 2002-526849 (Patent Document 2), and Japanese Patent Application Laid-Open No. 2006-19872 (Patent Document). In order to realize each embodiment disclosed in 3), a random number is necessary, and it is difficult to generate a random number having a necessary number of bits at high speed.

この発明の目的は、従来の設計を大きく変えることなく、電力解析攻撃への耐性を高めることが可能な演算装置およびCPUを提供することである。   An object of the present invention is to provide an arithmetic device and a CPU that can increase resistance to power analysis attacks without greatly changing the conventional design.

この発明の実施の一形態による演算装置は、記憶部と、演算部とを備える。演算部は、記憶部から受けた1または複数のソースデータを用いて算術演算または論理演算を行なう。記憶部および演算部の各々は、活性状態または非活性状態になる切替制御信号と、時間的に変化するとともに1または複数のソースデータとは無関係なデータ信号とを受ける。記憶部は、切替制御信号が非活性化されたことに応答して1または複数のソースデータを演算部に出力し、切替制御信号が活性化されたことに応答して上記の無関係なデータ信号に基づく1または複数のデータを演算部に出力する。演算部は、切替制御信号が非活性化されたことに応答して1または複数のソースデータに対して算術演算または論理演算を行なった演算結果を出力し、切替制御信号が活性化されたことに応答して上記の無関係なデータ信号に基づくデータを出力する。   An arithmetic device according to an embodiment of the present invention includes a storage unit and a calculation unit. The arithmetic unit performs an arithmetic operation or a logical operation using one or a plurality of source data received from the storage unit. Each of the storage unit and the calculation unit receives a switching control signal that is in an active state or an inactive state, and a data signal that changes over time and is irrelevant to one or more source data. The storage unit outputs one or a plurality of source data to the arithmetic unit in response to the switching control signal being inactivated, and the irrelevant data signal in response to the switching control signal being activated. One or a plurality of data based on the above is output to the arithmetic unit. The arithmetic unit outputs an operation result obtained by performing an arithmetic operation or a logical operation on one or a plurality of source data in response to the switching control signal being deactivated, and the switching control signal is activated. In response to the above, data based on the irrelevant data signal is output.

上記の実施の形態によれば、演算装置を構成する記憶部および演算部は、切替制御信号が活性化されたことに応答して演算に用いるソースデータと無関係なデータを出力するので、演算装置に対する電力解析攻撃への耐性を高めることができる。   According to the above embodiment, since the storage unit and the calculation unit constituting the calculation device output data unrelated to the source data used for calculation in response to the activation of the switching control signal, the calculation device Can be more resistant to power analysis attacks.

この発明の実施の形態1に従う演算装置3の構成を示すブロック図である。It is a block diagram which shows the structure of the arithmetic unit 3 according to Embodiment 1 of this invention. ANDゲートの設計方法について説明するための図である。It is a figure for demonstrating the design method of an AND gate. セレクタの設計方法について説明するための図である。It is a figure for demonstrating the design method of a selector. D−フリップフロップの設計方法について説明するための図である。It is a figure for demonstrating the design method of D flip-flop. 演算装置1において回路素子の変換を行なう箇所について説明するための図である。It is a figure for demonstrating the location which performs conversion of a circuit element in the arithmetic unit. 図5に示したデータ信号1(109)を出力する回路部分11_1の構成の一例を示す回路図である。FIG. 6 is a circuit diagram illustrating an example of a configuration of a circuit portion 11_1 that outputs a data signal 1 (109) illustrated in FIG. 5; 図5に示したデータ信号1,2(109,110)が入力される回路部分12_0〜12_Mの構成の一例を示す回路図である。FIG. 6 is a circuit diagram illustrating an example of a configuration of circuit portions 12_0 to 12_M to which data signals 1 and 2 (109, 110) illustrated in FIG. 5 are input. 図5に示した演算結果111を出力する回路部分13の構成の一例を示す回路図である。FIG. 6 is a circuit diagram illustrating an example of a configuration of a circuit portion 13 that outputs a calculation result 111 illustrated in FIG. 5. 図5の演算装置3の動作の一例を示すタイミング図である。FIG. 6 is a timing chart showing an example of the operation of the arithmetic device 3 in FIG. 5. この発明の実施の形態2に従うCPU10の構成を示すブロック図である。It is a block diagram which shows the structure of CPU10 according to Embodiment 2 of this invention. この発明の実施の形態3に従うCPU10Aの構成を示すブロック図である。It is a block diagram which shows the structure of CPU10A according to Embodiment 3 of this invention. この発明の実施の形態4に従うCPU10Bの構成を示すブロック図である。It is a block diagram which shows the structure of CPU10B according to Embodiment 4 of this invention. この発明の実施の形態5に従うCPU10Cの構成を示すブロック図である。It is a block diagram which shows the structure of CPU10C according to Embodiment 5 of this invention. クロックバッファ17の構成および動作を説明するための図である。3 is a diagram for explaining the configuration and operation of a clock buffer 17. FIG. 図13のCPU10Cの動作の一例を示すタイミング図である。FIG. 14 is a timing diagram illustrating an example of the operation of the CPU 10 </ b> C in FIG. 13. 図14(A)に示すクロックバッファ17の変形例を示すブロック図である。FIG. 15 is a block diagram showing a modification of the clock buffer 17 shown in FIG. 図13に示すCPU10Cの変形例としてのCPU10Dの構成を示すブロック図である。It is a block diagram which shows the structure of CPU10D as a modification of CPU10C shown in FIG.

一般に、CPUは、ALU(Arithmetic Logic Unit:算術論理演算ユニット)を使用する命令(たとえば、算術演算命令、論理演算命令)の実行時には複数のデータソースから2つのデータソースを選択し、それらをALUの入力データとして、ALUが入力データを用いて命令で指定された演算を実行する。一方、ALUを使用しない命令の実行時には、ALUへの入力データは、特に意味のあるデータである必要はない。典型的には、(i)ある決まった状態(たとえば、全て0のデータなどの固定値)となる場合と、(ii)最後にALUが使用された際に選択されたデータソースが入力され続ける場合とがある。ALUの出力データ(演算結果)についても、ALUを使用しない命令の実行時には、上記の(i)と同様となる場合がある。これらはCPUの設計に依存して決まる。   In general, a CPU selects two data sources from a plurality of data sources when executing an instruction (for example, an arithmetic operation instruction or a logical operation instruction) using an ALU (Arithmetic Logic Unit), As the input data, the ALU executes the operation specified by the instruction using the input data. On the other hand, when an instruction that does not use an ALU is executed, the input data to the ALU does not have to be particularly meaningful data. Typically, (i) in a certain state (for example, a fixed value such as all zero data), and (ii) the data source selected when the ALU was last used is continuously input. There are cases. The output data (calculation result) of the ALU may be the same as (i) above when executing an instruction that does not use the ALU. These are determined depending on the design of the CPU.

従来のCPUで、秘密情報(たとえば、暗号処理における鍵情報など)を扱うと、上記の(i)の場合、ALUを使用する命令の実行時には演算装置(ALUおよびレジスタ群)の内部に出現するデータ(たとえば、ALUの入力データや出力データ)のハミング重みを選択関数とした電力解析によって秘密情報が漏洩する可能性がある。なぜなら、演算装置を構成するCMOS(Complementary Metal-Oxide Semiconductor)回路では、「0」から「1」、または「1」から「0」に変化する信号の数(すなわちハミング距離)と消費電力とに高い相関があるからである。上記の(ii)の場合、データソースとして選択されていたレジスタの内容が変化する際の変化の前後のハミング距離を選択関数とした電力解析によって、秘密情報が漏洩する可能性がある。   When secret information (for example, key information in cryptographic processing) is handled by a conventional CPU, in the case of (i) above, it appears inside the arithmetic unit (ALU and register group) when an instruction using the ALU is executed. There is a possibility that secret information may be leaked by power analysis using a Hamming weight of data (for example, input data and output data of ALU) as a selection function. This is because in a CMOS (Complementary Metal-Oxide Semiconductor) circuit constituting an arithmetic device, the number of signals changing from “0” to “1” or “1” to “0” (ie, Hamming distance) and power consumption This is because there is a high correlation. In the case of (ii) above, there is a possibility that secret information may be leaked by power analysis using the Hamming distance before and after the change when the contents of the register selected as the data source change as a selection function.

これらの電力解析による秘密情報の抽出は、DPA(Differential Power Analysis)やCPA(Correlation Power Analysis)などとして知られている。DPAの場合、多数の入力データに対して消費電力波形を取得し、暗号鍵に相関のある内部変数の値(選択関数と称する)を用いて、取得した消費電力波形が分類される。そして、各グループの電力波形の平均値に差があれば、鍵の予測値が正しいことが分かる。CPAでは、予測した暗号鍵に対して消費電力値を推定し、実際の消費電力波形との相関が調べられる。全ての暗号鍵の候補について相関値を計算した後、最も高い相関値を有する鍵候補が、真と判定される。   Such extraction of secret information by power analysis is known as DPA (Differential Power Analysis), CPA (Correlation Power Analysis), or the like. In the case of DPA, a power consumption waveform is acquired for a large number of input data, and the acquired power consumption waveform is classified using a value of an internal variable correlated with an encryption key (referred to as a selection function). If there is a difference in the average value of the power waveform of each group, it can be seen that the predicted value of the key is correct. In CPA, a power consumption value is estimated for a predicted encryption key, and a correlation with an actual power consumption waveform is examined. After calculating correlation values for all encryption key candidates, the key candidate having the highest correlation value is determined to be true.

この発明では、従来の演算装置やCPUの設計を大きく変えることなく、上記の電力解析攻撃への耐性を高めることが可能な技術が提供される。以下、この発明の実施の形態について図面を参照して詳しく説明する。なお、同一または相当する部分には同一の参照符号を付して、その説明を繰返さない。   The present invention provides a technique capable of enhancing the resistance to the power analysis attack described above without greatly changing the design of a conventional arithmetic device or CPU. Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The same or corresponding parts are denoted by the same reference numerals, and description thereof will not be repeated.

<実施の形態1>
[演算装置3の構成の概略]
図1は、この発明の実施の形態1に従う演算装置3の構成を示すブロック図である。演算装置3は、CPUのうち演算命令の実行に直接関係する部分である、演算部としてのALU1と、記憶部としてのレジスタ群2とを含む。ALU1は、2個の入力データ(データ1(109)およびデータ2(110))を演算ソースとして内部に含まれる(M+1)個の演算ブロック1_0〜1_M(加算ブロック、論理和ブロック、論理積ブロック、排他的論理和ブロックなど)が演算を実行する。ALU1は、演算種類選択信号100で指定される種類の演算結果111を出力する。レジスタ群2は、ALU1の入力データとして選択され得る複数のソースデータを格納するレジスタファイルであり、(N+1)個のレジスタ2_0〜2_Nを含む。
<Embodiment 1>
[Outline of Configuration of Arithmetic Unit 3]
FIG. 1 is a block diagram showing a configuration of an arithmetic device 3 according to the first embodiment of the present invention. The arithmetic device 3 includes an ALU 1 as an arithmetic unit and a register group 2 as a storage unit, which are parts directly related to execution of arithmetic instructions in the CPU. ALU1 includes (M + 1) operation blocks 1_0 to 1_M (addition block, logical sum block, logical product block) which are included in the inside using two input data (data 1 (109) and data 2 (110)) as an operation source. , An exclusive OR block, etc.) perform the operation. The ALU 1 outputs the calculation result 111 of the type specified by the calculation type selection signal 100. The register group 2 is a register file that stores a plurality of source data that can be selected as input data of the ALU1, and includes (N + 1) registers 2_0 to 2_N.

図1の演算装置3が従来の演算装置と異なる点は、ALU1およびレジスタ群2に対して切替制御信号101および切替データ信号102が入力されている点である。図1の場合、切替制御信号101は、活性状態(アクティブ)と非活性状態(インアクティブ)とを有する1ビットの信号である。切替データ信号102は、演算装置3による演算に用いられるソースデータとは無関係な複数ビットの信号である。図2〜図8で説明するように、切替制御信号101が活性化(アサート)された状態では、演算装置3を構成する論理ゲートやフリップフロップなどの複数の回路素子のうち、少なくとも一部の回路素子から出力される信号が切替データ信号102に変更される。これによって、演算装置3内の全ての信号の組合せ(以下、「回路状態」と称する)および演算回路3の出力信号が演算とは無関係な状態に設定できる。一方、切替制御信号101が非活性化(ネゲート)された状態では、演算装置3の動作は従来の演算装置と同じであり、具体的には次のとおりである。   The arithmetic device 3 of FIG. 1 is different from the conventional arithmetic device in that a switching control signal 101 and a switching data signal 102 are input to the ALU 1 and the register group 2. In the case of FIG. 1, the switching control signal 101 is a 1-bit signal having an active state (active) and an inactive state (inactive). The switching data signal 102 is a multi-bit signal irrelevant to the source data used for the calculation by the calculation device 3. As illustrated in FIGS. 2 to 8, in a state where the switching control signal 101 is activated (asserted), at least a part of a plurality of circuit elements such as logic gates and flip-flops constituting the arithmetic device 3 is used. The signal output from the circuit element is changed to the switching data signal 102. As a result, all combinations of signals in the arithmetic device 3 (hereinafter referred to as “circuit states”) and output signals of the arithmetic circuit 3 can be set in a state unrelated to the arithmetic operation. On the other hand, in a state where the switching control signal 101 is inactivated (negated), the operation of the arithmetic device 3 is the same as that of the conventional arithmetic device, and is specifically as follows.

まず、演算装置3では演算実行に先立って、レジスタ群2が、データソース選択信号1,2(104,105)に従って、(N+1)個のレジスタ2_0〜2_Nの中から1または複数(通常2個)を選択し、選択したレジスタに格納されたソースデータを入力データ(データ1(109)およびデータ2(110))としてALU1へ出力する。ALU1はレジスタ群2から供給された2個の入力データ109,110に対して複数の演算を並行して実行し、演算種類選択信号100で指定された演算種類に該当する演算結果111を出力する。ALUの設計によっては、ALU1の内部の(M+1)個の演算ブロック1_0〜1_Mのうち、演算種類選択信号100で指定された演算種類に該当する演算ブロックのみに有効なデータを入力し、それ以外の演算ブロックには有効なデータを入力しない(たとえば、全て0の固定値を入力する)ものもある。これによって、ALU1は、必要な演算ブロックのみを動作させる。ALU1が出力した演算結果111は、演算装置3以外で用いられることもあるし、演算装置3内のレジスタ群2に書き込まれることもある。レジスタ群2への書き込みは、書込レジスタ選択信号106および書込イネーブル信号107によって制御される。レジスタ群2には、演算装置3の外部のメモリまたはレジスタなどからデータ(書込データ信号108)が書き込まれる場合もある。レジスタ群2には、さらに、クロック信号112およびリセット信号113が外部から入力される。   First, in the arithmetic unit 3, prior to the execution of the operation, the register group 2 has one or more (usually two) out of (N + 1) registers 2_0 to 2_N according to the data source selection signals 1 and 2 (104, 105). And the source data stored in the selected register is output to the ALU 1 as input data (data 1 (109) and data 2 (110)). The ALU 1 performs a plurality of operations in parallel on the two input data 109 and 110 supplied from the register group 2 and outputs an operation result 111 corresponding to the operation type specified by the operation type selection signal 100. . Depending on the design of the ALU, valid data is input only to the operation block corresponding to the operation type specified by the operation type selection signal 100 among the (M + 1) operation blocks 1_0 to 1_M in the ALU 1, and the rest Some calculation blocks do not input valid data (for example, input a fixed value of all zeros). As a result, the ALU 1 operates only necessary operation blocks. The calculation result 111 output from the ALU 1 may be used by other than the calculation device 3 or may be written to the register group 2 in the calculation device 3. Writing to the register group 2 is controlled by a write register selection signal 106 and a write enable signal 107. Data (write data signal 108) may be written to the register group 2 from a memory or a register outside the arithmetic unit 3. The register group 2 further receives a clock signal 112 and a reset signal 113 from the outside.

[従来の演算装置の問題点]
上記のように切替制御信号101がネゲートされている場合の動作、すなわち、従来の演算装置の動作には、電力解析攻撃に対する耐性の観点から次のような問題がある。
[Problems of conventional arithmetic units]
The operation when the switching control signal 101 is negated as described above, that is, the operation of the conventional arithmetic device has the following problems from the viewpoint of resistance to power analysis attacks.

第1の問題は、演算装置3を使用しない命令の実行時に、ALU内部の少なくとも1つの演算ブロックへの入力データ信号がある決まった値(たとえば、全て「0」)となる場合に発生する。たとえば、演算装置3を使用しない命令の実行時には、データ1(109)およびデータ2(110)としてある決まった値を出力するようにレジスタ群2を設計したり、ALU1の内部の演算ブロック1_0〜1_Mのうち、演算種類選択信号100で指定された演算種類に該当しない演算ブロックにはある決まった値を入力するようにALU1を設計した場合に、ALU1にある決まった値が入力される。以下、上記の決まった値が全て「0」の場合を想定して説明するが、それ以外の値であっても個々の入力データ信号のビットデータを選択関数とした電力解析によって、秘密情報が漏洩する可能性がある。   The first problem occurs when an input data signal to at least one operation block in the ALU becomes a certain value (for example, all “0”) when an instruction that does not use the operation device 3 is executed. For example, when an instruction not using the arithmetic unit 3 is executed, the register group 2 is designed so as to output certain values as data 1 (109) and data 2 (110), or the arithmetic blocks 1_0 to 1_0 in the ALU 1 are output. In A_M, when ALU1 is designed to input a predetermined value to an operation block that does not correspond to the operation type specified by the operation type selection signal 100, a predetermined value in ALU1 is input. In the following description, it is assumed that the above determined values are all “0”. However, even if the other values are other than the above, the secret information is obtained by power analysis using the bit data of each input data signal as a selection function. There is a possibility of leakage.

演算装置3を使用しない命令の実行時に、ALU1の内部の演算ブロック1_0〜1_Mの入力データ信号(データ1(109)およびデータ2(110))が全て「0」であり、演算装置3を使用する命令の実行時に入力データ信号が実際に演算に使用される値に変化したとする。そうすると、各演算ブロックの内部では、演算に使用される値のハミング重み(ビット列中の「1」の個数)に依存した消費電力が発生する。なぜなら、入力データ信号の変化するビット数が多い(すなわち、ハミング距離が大きい)ほど、演算ブロックの内部信号はより多く変化し、より多くの電力を消費するからである。上記の場合、ALU1への入力データ信号のハミング重みとハミング距離は等しくなり、入力データのハミング重みを選択関数とした電力解析によって秘密情報が漏洩する可能性がある。演算命令の実行後にALU1への入力データ信号が再び全て「0」に戻る際も同様である。   When an instruction not using the arithmetic unit 3 is executed, the input data signals (data 1 (109) and data 2 (110)) of the arithmetic blocks 1_0 to 1_M inside the ALU 1 are all “0” and the arithmetic unit 3 is used. Assume that the input data signal is changed to a value that is actually used for the operation when the instruction to be executed is executed. Then, power consumption depending on the Hamming weight (the number of “1” s in the bit string) of values used for the calculation is generated inside each calculation block. This is because the larger the number of bits that the input data signal changes (that is, the greater the Hamming distance), the more the internal signal of the operation block changes and consumes more power. In the above case, the hamming weight and the hamming distance of the input data signal to the ALU 1 are equal, and there is a possibility that secret information may be leaked by power analysis using the hamming weight of the input data as a selection function. The same applies when all input data signals to the ALU 1 return to “0” again after execution of the arithmetic instruction.

演算装置3を使用しない命令の実行時に、演算装置3の出力信号の値(すなわち、演算結果111)として、ある決まった値(たとえば、全て「0」)となるように演算装置3が設計された場合も上記と同様の問題が発生する。この場合、演算結果111のハミング重みを選択関数とした電力解析によって秘密情報が漏洩する可能性がある。   The arithmetic device 3 is designed so that, when an instruction that does not use the arithmetic device 3 is executed, the value of the output signal of the arithmetic device 3 (that is, the operation result 111) becomes a predetermined value (for example, all “0”). In this case, the same problem as described above occurs. In this case, secret information may be leaked by power analysis using the Hamming weight of the calculation result 111 as a selection function.

第2の問題は、演算装置3を使用しない命令の実行時に、最後に演算装置3が使用された際に選択されたデータソースがALU1に入力され続ける場合に発生する。具体的には、ある演算命令を実行する際、演算のデータソースを格納するレジスタと演算結果を格納するレジスタとが同一のレジスタに指定される場合に問題が生じる。この場合、ALU1では演算前後の当該レジスタの内容のハミング距離に応じた消費電力が発生する。したがって、当該ハミング距離を選択関数とした電力解析によって秘密情報が漏洩する可能性がある。   The second problem occurs when an instruction not using the arithmetic device 3 is executed and the data source selected when the arithmetic device 3 is last used continues to be input to the ALU 1. Specifically, when a certain arithmetic instruction is executed, a problem arises when the register for storing the data source of the arithmetic and the register for storing the arithmetic result are designated as the same register. In this case, ALU1 generates power consumption according to the Hamming distance of the contents of the register before and after the calculation. Therefore, secret information may be leaked by power analysis using the Hamming distance as a selection function.

たとえば、変数「a」と変数「b」との加算結果を変数「c」に代入するプログラム(c=a+b)で、変数「c」と変数「a]とが同じレジスタに割り付けられた場合を考える。この場合、演算実行中のALU1の入力データ109,110は「a」と「b」であるが、演算結果111をレジスタに格納するタイミングでは、「c」と「b」に変化する。前述のように、入力データ信号の変化するビット数が多い(すなわち、ハミング距離が大きい)ほど、演算ブロックの内部信号はより多く変化し、より多くの電力を消費する。入力データ信号の変化するビット数は、「a」と「c」のハミング距離となり、当該ハミング距離を選択関数とした電力解析によって秘密情報が漏洩する可能性がある。   For example, in a program (c = a + b) in which the addition result of the variable “a” and the variable “b” is assigned to the variable “c”, the variable “c” and the variable “a” are allocated to the same register. In this case, the input data 109 and 110 of the ALU 1 during execution of the calculation are “a” and “b”, but change to “c” and “b” at the timing when the calculation result 111 is stored in the register. As described above, the larger the number of bits that the input data signal changes (that is, the greater the Hamming distance), the more the internal signal of the operation block changes and consumes more power. The changing number of bits of the input data signal is a Hamming distance between “a” and “c”, and there is a possibility that secret information may be leaked by power analysis using the Hamming distance as a selection function.

[演算装置3の詳細な構成]
これらの問題を解決するために、演算装置3を構成する論理ゲートやフリップフロップなどの回路素子のうち少なくとも一部の回路素子にそれぞれ対応して複数の選択回路(セレクタ)が設けられる。この明細書で回路素子とは、論理演算機能または記憶機能を有し、機能的に1まとまりと考えられる単位を意味するものとする。したがって、AND素子やOR素子などの論理ゲート、セレクタ(マルチプレクサ)や加算器などの組合せ回路、フリップフロップなどの順序回路のいずれを回路素子と考えてもよい。
[Detailed Configuration of Arithmetic Unit 3]
In order to solve these problems, a plurality of selection circuits (selectors) are provided corresponding to at least some of the circuit elements such as logic gates and flip-flops constituting the arithmetic device 3. In this specification, a circuit element means a unit having a logical operation function or a storage function and functionally considered as one unit. Therefore, any of logic gates such as AND elements and OR elements, combinational circuits such as selectors (multiplexers) and adders, and sequential circuits such as flip-flops may be considered as circuit elements.

各選択回路は、対応の回路素子の出力、切替制御信号101、および切替データ信号102を受ける。選択回路は、切替制御信号101がアサートされたことに応答して切替データ信号102を出力し、切替制御信号101がネゲートされたことに応答して対応の回路素子から出力された信号を出力する。   Each selection circuit receives an output of a corresponding circuit element, a switching control signal 101, and a switching data signal 102. The selection circuit outputs the switching data signal 102 in response to the switching control signal 101 being asserted, and outputs the signal output from the corresponding circuit element in response to the switching control signal 101 being negated. .

演算装置3(ALU1およびレジスタ群2)の設計は、従来の演算装置の設計を大きく変更する必要はなく、典型的には以下のステップで設計される。   The design of the arithmetic device 3 (ALU1 and register group 2) does not require a significant change from the design of the conventional arithmetic device, and is typically designed in the following steps.

(1) 従来技術によるALUとレジスタ群の回路を設計する。
(2) (1)で得られたALUおよびレジスタ群の回路をベースとして、ALUおよびレジスタ群の入出力信号を含む内部信号を生成しているフリップフロップまたは論理ゲートなどの回路素子のうち、全てあるいは一部の回路素子の出力ノードに対してそれぞれセレクタを直列に接続する。
(1) A conventional ALU and register group circuit is designed.
(2) All of the circuit elements such as flip-flops or logic gates that generate internal signals including input / output signals of the ALU and register group based on the ALU and register group circuit obtained in (1) Alternatively, selectors are connected in series to the output nodes of some circuit elements.

(3) (2)で接続したセレクタに、切替制御信号101と切替データ信号102を接続する。各セレクタには、切替データ信号102のうち対応のビットの信号が入力される。   (3) The switching control signal 101 and the switching data signal 102 are connected to the selector connected in (2). A corresponding bit signal of the switching data signal 102 is input to each selector.

切替制御信号101をアサートおよびネゲートするタイミングは、変換する全ての回路素子について同じでよい。切替データ信号102の値は、変換する全ての回路素子について同じであっても電力解析攻撃に対する耐性を高める効果がなくはないが、変換する回路素子ごとに別々にビットデータが供給されるほうが望ましい。1つの回路素子に供給される切替データ信号102の値は任意のタイミングで(たとえば、所定の時間が経過する都度、または所定回数の演算を実行する都度)変更される必要がある。もし、切替データ信号102の値が時間的に変化しない固定値であるとすると、個々のビットを選択関数とした電力解析によって秘密情報が漏洩する危険があるので、従来と耐性が変わらなくなるからである。以下、具体的な回路素子に対する設計方法について説明する。   The timing for asserting and negating the switching control signal 101 may be the same for all circuit elements to be converted. Even if the value of the switching data signal 102 is the same for all the circuit elements to be converted, there is not an effect of improving the resistance to the power analysis attack, but it is preferable that bit data is supplied separately for each circuit element to be converted. . The value of the switching data signal 102 supplied to one circuit element needs to be changed at an arbitrary timing (for example, every time a predetermined time elapses or every time a predetermined number of operations are executed). If the value of the switching data signal 102 is a fixed value that does not change with time, there is a risk that secret information may be leaked by power analysis using individual bits as a selection function. is there. Hereinafter, a design method for a specific circuit element will be described.

図2は、ANDゲートの設計方法について説明するための図である。図2(A)は入力信号IN1,IN2の論理和を出力する従来のANDゲート30を示し、図2(B)は設計変更後のANDゲート32を示す。ANDゲート32は、従来のANDゲート30の出力ノードと直列にセレクタ31を接続したものである。セレクタ31は、ANDゲート30の出力、切替データ信号102、および切替制御信号101を受ける。セレクタ31は、切替制御信号101がアサートされたことに応答して切替データ信号102を出力信号OUTとして出力し、切替制御信号101がネゲートされたことに応答してANDゲート30の出力を出力信号OUTとして出力する。   FIG. 2 is a diagram for explaining a method of designing an AND gate. FIG. 2A shows a conventional AND gate 30 that outputs a logical sum of input signals IN1 and IN2, and FIG. 2B shows an AND gate 32 after a design change. The AND gate 32 has a selector 31 connected in series with the output node of the conventional AND gate 30. The selector 31 receives the output of the AND gate 30, the switching data signal 102, and the switching control signal 101. The selector 31 outputs the switching data signal 102 as the output signal OUT in response to the switching control signal 101 being asserted, and outputs the output of the AND gate 30 in response to the switching control signal 101 being negated. Output as OUT.

図3は、セレクタの設計方法について説明するための図である。図3(A)は選択信号SELに応じて入力信号IN1,IN2のいずれかを出力する従来のセレクタ34を示し、図3(B)は設計変更後のセレクタ36を示す。セレクタ36は、従来のセレクタ34の出力ノードと直列にセレクタ35を接続したものである。セレクタ35は、セレクタ34の出力、切替データ信号102、および切替制御信号101を受ける。セレクタ35は、切替制御信号101がアサートされたことに応答して切替データ信号102を出力信号OUTとして出力し、切替制御信号101がネゲートされたことに応答してセレクタ34の出力を出力信号OUTとして出力する。   FIG. 3 is a diagram for explaining a selector design method. 3A shows a conventional selector 34 that outputs one of the input signals IN1 and IN2 in response to the selection signal SEL, and FIG. 3B shows the selector 36 after the design change. The selector 36 has a selector 35 connected in series with the output node of the conventional selector 34. The selector 35 receives the output of the selector 34, the switching data signal 102, and the switching control signal 101. The selector 35 outputs the switching data signal 102 as the output signal OUT in response to the switching control signal 101 being asserted, and outputs the output of the selector 34 in response to the negation of the switching control signal 101 as the output signal OUT. Output as.

図4は、D−フリップフロップの設計方法について説明するための図である。図4(A)は従来のD−フリップフロップ37を示し、図4(B)は設計変更後のD−フリップフロップ39を示す。従来のD−フリップフロップ37は、クロック端子CKに入力される入力信号IN2の立上がりエッジで、データ端子Dに入力されている入力信号IN1の論理レベルを保持し、保持した論理レベル(内部論理状態)を出力端子Qから出力信号OUTとして出力する。設計変更後のD−フリップフロップ39は、従来のD−フリップフロップ37の出力端子Qにセレクタ38を接続したものである。セレクタ38は、D−フリップフロップ37の出力、切替データ信号102、および切替制御信号101を受ける。セレクタ38は、切替制御信号101がアサートされたことに応答して切替データ信号を出力信号OUTとして出力し、切替制御信号101がネゲートされたことに応答してD−フリップフロップ37の出力(D−フリップフロップ37の内部論理状態)を出力信号OUTとして出力する。   FIG. 4 is a diagram for explaining a D-flip-flop design method. 4A shows a conventional D-flip flop 37, and FIG. 4B shows a D-flip flop 39 after design change. The conventional D-flip flop 37 holds the logic level of the input signal IN1 input to the data terminal D at the rising edge of the input signal IN2 input to the clock terminal CK. ) From the output terminal Q as an output signal OUT. The D-flip flop 39 after the design change is obtained by connecting a selector 38 to the output terminal Q of the conventional D-flip flop 37. The selector 38 receives the output of the D-flip flop 37, the switching data signal 102, and the switching control signal 101. The selector 38 outputs the switching data signal as the output signal OUT in response to the assertion of the switching control signal 101, and the output (D of the D flip-flop 37 in response to the negation of the switching control signal 101. The internal logic state of the flip-flop 37 is output as the output signal OUT.

図2(B)においてANDゲート30とセレクタ31とを接続する配線W1の長さはできるだけ短いほうが望ましい。同様に、図3(B)におけるセレクタ34,35間の配線W2の長さ、および図4(B)におけるD−フリップフロップ37とセレクタ38とを接続する配線W3の長さはできるだけ短いほうが望ましい。セレクタと回路素子との間の配線長が長いと、この配線の容量が大きくなり、その結果、この配線を流れる信号の消費電力ひいてはその偏りの絶対量も大きくなる。消費電力の偏りをできるだけ小さくするためには、セレクタと回路素子との間を近接して配置して配線長を抑え、消費電力の絶対量をできるだけ小さくすることが望ましい。   In FIG. 2B, the length of the wiring W1 connecting the AND gate 30 and the selector 31 is preferably as short as possible. Similarly, the length of the wiring W2 between the selectors 34 and 35 in FIG. 3B and the length of the wiring W3 connecting the D-flip flop 37 and the selector 38 in FIG. 4B are preferably as short as possible. . When the wiring length between the selector and the circuit element is long, the capacity of the wiring increases, and as a result, the power consumption of the signal flowing through the wiring and the absolute amount of the bias also increase. In order to reduce the bias of power consumption as much as possible, it is desirable to arrange the selector and the circuit element close to each other to suppress the wiring length and to reduce the absolute amount of power consumption as much as possible.

図2〜図4では、ANDゲート、セレクタ、フリップフロップの変換のみを示したが、他の回路素子についても同様であり、変換すべき回路素子の出力ノードと直列にセレクタを接続すればよい。   2 to 4 show only the conversion of the AND gate, the selector, and the flip-flop, the same applies to other circuit elements, and the selector may be connected in series with the output node of the circuit element to be converted.

もしくは、変換後の回路素子と等価な機能(すなわち、論理ゲートまたはフリップフロップとセレクタとを合わせた機能)を単一セルで実現してもよい。この場合、変換後の回路素子は、1または複数の第1の入力ノードと、切替データ信号102が入力される第2の入力ノードと、切替制御信号101が入力される第3の入力ノードと、出力ノードとを含む。変換後の回路素子は、切替制御信号101が非活性化されたことに応答して、1または複数の第1の入力ノードから入力された信号の論理演算結果、または、内部に記憶したデータに基づく信号を出力する。変換後の回路素子は、切替制御信号101が活性化されたことに応答して切替データ信号102に応じた信号を出力する。   Alternatively, a function equivalent to the circuit element after conversion (that is, a function combining a logic gate or flip-flop and a selector) may be realized by a single cell. In this case, the converted circuit element includes one or more first input nodes, a second input node to which the switching data signal 102 is input, and a third input node to which the switching control signal 101 is input. , And output nodes. In response to the deactivation of the switching control signal 101, the circuit element after the conversion is converted into a logical operation result of a signal input from one or more first input nodes, or data stored therein. Based signal is output. The converted circuit element outputs a signal corresponding to the switching data signal 102 in response to the switching control signal 101 being activated.

図2〜図4では、切替制御信号101がアサートされたことに応答して、設計変更後の回路素子32,36,39から切替データ信号102がそのまま出力される場合を示したが、かならずしもそのまま出力する必要はない。切替データ信号102の論理レベルを反転させて出力するなど、切替データ信号102を変形させた信号を出力するようにしてもよい。   2 to 4 show a case where the switching data signal 102 is output as it is from the circuit elements 32, 36, and 39 after the design change in response to the assertion of the switching control signal 101. There is no need to output. A signal obtained by modifying the switching data signal 102 may be output, for example, by inverting the logic level of the switching data signal 102.

図5は、演算装置1において回路素子の変換を行なう箇所について説明するための図である。   FIG. 5 is a diagram for explaining a place where circuit elements are converted in the arithmetic device 1.

図2〜図4で説明した変換は、図5に示したALU1およびレジスタ群2に含まれる全ての論理ゲートや記憶素子について行なう必要はない。しかしながら、図5に示すように、少なくともデータ信号1,2(109,110)を出力する回路部分11_1,11_2、データ信号1,2(109,110)が入力される回路部分12_0〜12_M、演算結果111を出力する回路部分13、および演算結果111が書込まれるレジスタについては図2〜図4で説明した変換を行なうことが望ましい。上記のうち、回路部分11_1,11_2の変換については図6で説明し、回路部分12_0〜12_Mの変換については図7で説明し、回路部分13の変換については図8で説明する。レジスタ2_0〜2_Nについては各フリップフロップについて図4に示した変換を行なう。   The conversion described with reference to FIGS. 2 to 4 need not be performed for all the logic gates and storage elements included in the ALU 1 and the register group 2 shown in FIG. However, as shown in FIG. 5, circuit portions 11_1 and 11_2 that output at least data signals 1 and 2 (109, 110), circuit portions 12_0 to 12_M that receive data signals 1 and 2 (109, 110), and arithmetic operations For the circuit portion 13 that outputs the result 111 and the register in which the operation result 111 is written, it is desirable to perform the conversion described with reference to FIGS. Among the above, the conversion of the circuit portions 11_1 and 11_2 will be described with reference to FIG. 6, the conversion of the circuit portions 12_0 to 12_M will be described with reference to FIG. 7, and the conversion of the circuit portion 13 will be described with reference to FIG. For the registers 2_0 to 2_N, the conversion shown in FIG. 4 is performed for each flip-flop.

さらに、ALU1内部の非線形論理ゲートについても変換を行なうと、非線形論理ゲートにおける消費電力の偏りを低減することができ、電力解析攻撃に対する耐性がより向上する。ここで、線形論理ゲートとは、XOR(exclusive OR)素子のように、ランダムデータが入力されたときに出力される「1」、「0」の個数が均等な論理ゲートをいう。非線形論理ゲートとは、AND素子やOR素子のように、ランダムデータが入力されたときに出力される「1」、「0」の個数に偏りがある論理ゲートをいう。   Furthermore, if conversion is also performed for the nonlinear logic gate in the ALU 1, the bias of the power consumption in the nonlinear logic gate can be reduced, and the resistance to the power analysis attack is further improved. Here, the linear logic gate is a logic gate in which the number of “1” and “0” output when random data is input is equal, such as an XOR (exclusive OR) element. A non-linear logic gate is a logic gate having a bias in the number of “1” and “0” output when random data is input, such as an AND element and an OR element.

図6は、図5に示したデータ信号1(109)を出力する回路部分11_1の構成の一例を示す回路図である。図6において(A)は従来の回路構成の例を示し、(B)は変換後の回路構成の例を示す。データ信号2(110)を出力する回路部分11_2の構成も同様であるので、データ信号1(109)回路部分11_1の構成の一例が代表として示される。   FIG. 6 is a circuit diagram showing an example of the configuration of the circuit portion 11_1 that outputs the data signal 1 (109) shown in FIG. 6A shows an example of a conventional circuit configuration, and FIG. 6B shows an example of a circuit configuration after conversion. Since the circuit portion 11_2 that outputs the data signal 2 (110) has the same configuration, an example of the configuration of the data signal 1 (109) circuit portion 11_1 is shown as a representative.

図6(A)に示すように、データ信号1(109)を出力する回路部分11_1には、レジスタ0〜N(2_0〜2_N)の出力データDR_0〜DR_Nがそれぞれ入力されるANDゲート40_0〜40_Nと、各ANDゲート40の出力が入力されるORゲート41とが設けられる。各ANDゲート40のもう一方の入力ノードには対応のデータソース選択信号104(104_0〜104_Nのいずれか)が入力される。   As shown in FIG. 6A, AND gates 40_0 to 40_N into which output data DR_0 to DR_N of registers 0 to N (2_0 to 2_N) are input to the circuit portion 11_1 that outputs the data signal 1 (109), respectively. And an OR gate 41 to which the output of each AND gate 40 is input. A corresponding data source selection signal 104 (any one of 104 — 0 to 104 — N) is input to the other input node of each AND gate 40.

図6(B)に示すように変換後の回路部分11_1において、ORゲート41の出力ノードにセレクタ42がさらに接続される。ここで、セレクタ42は、ORゲート41の出力と、切替制御信号101と、切替データ信号102とを受け、切替制御信号101がアサートされたことに応答して切替データ信号102をデータ信号1(109)として出力し、切替制御信号101がネゲートされたことに応答してORゲート41の出力をデータ信号1(109)として出力する。   As shown in FIG. 6B, the selector 42 is further connected to the output node of the OR gate 41 in the converted circuit portion 11_1. Here, the selector 42 receives the output of the OR gate 41, the switching control signal 101, and the switching data signal 102, and in response to the switching control signal 101 being asserted, the selector 42 converts the switching data signal 102 into the data signal 1 ( 109), and in response to the negation of the switching control signal 101, the output of the OR gate 41 is output as the data signal 1 (109).

図7は、図5に示したデータ信号1,2(109,110)が入力される回路部分12_0〜12_Mの構成の一例を示す回路図である。図7において(A)は従来の回路構成の例を示し、(B)は変換後の回路構成の例を示す。回路部分12_0〜12_Mは、論理ブロック1_0〜1_Mにそれぞれ対応して設けられる。なお、図7では、一例として、論理ブロック1_0を論理積ブロックとし、論理ブロック1_1を論理和ブロックとしている。   FIG. 7 is a circuit diagram illustrating an example of the configuration of the circuit portions 12_0 to 12_M to which the data signals 1 and 2 (109, 110) illustrated in FIG. 5 are input. 7A shows an example of a conventional circuit configuration, and FIG. 7B shows an example of a circuit configuration after conversion. The circuit portions 12_0 to 12_M are provided corresponding to the logic blocks 1_0 to 1_M, respectively. In FIG. 7, as an example, the logical block 1_0 is a logical product block, and the logical block 1_1 is a logical sum block.

図7(A)に示すように、回路部分12_0は、データ信号1(109)を受けるANDゲート43_0と、データ信号2(110)を受けるANDゲート44_0とを含む。ANDゲート43_0,44_0には、さらに、演算種類選択信号100のうち論理積を表わす選択信号100_0が入力される。ANDゲート43_0,44_0の各出力ノードは、対応の論理積ブロック1_0に接続される。同様に、回路部分12_1は、データ信号1(109)を受けるANDゲート43_1と、データ信号2(110)を受けるANDゲート44_1とを含む。ANDゲート43_1,44_1には、さらに、演算種類選択信号100のうち論理和を表わす選択信号100_1が入力される。ANDゲート43_1,44_1の各出力ノードは、対応の論理和ブロック1_1に接続される。図7では図示を省略しているが、回路部分12_2〜12_Mについても同様である。   As shown in FIG. 7A, the circuit portion 12_0 includes an AND gate 43_0 that receives the data signal 1 (109) and an AND gate 44_0 that receives the data signal 2 (110). Further, a selection signal 100_0 representing a logical product among the operation type selection signals 100 is input to the AND gates 43_0 and 44_0. Each output node of the AND gates 43_0 and 44_0 is connected to the corresponding AND block 1_0. Similarly, the circuit portion 12_1 includes an AND gate 43_1 that receives the data signal 1 (109) and an AND gate 44_1 that receives the data signal 2 (110). The AND gates 43_1 and 44_1 are further supplied with a selection signal 100_1 representing a logical sum among the operation type selection signals 100. Each output node of the AND gates 43_1 and 44_1 is connected to the corresponding OR block 1_1. Although not shown in FIG. 7, the same applies to the circuit portions 12_2 to 12_M.

図7(B)に示すように、変換後の回路部分12_i(iは0以上M以下の整数)は、ANDゲート43_iと対応の論理ブロック1_iとの間に挿入されるセレクタ45_iと、ANDゲート44_iと対応の論理ブロック1_iとの間に挿入されるセレクタ46_iとをさらに含む。セレクタ45_iは、データ1(109)、切替データ信号102のうち対応のビット信号、および切替制御信号101を受ける。セレクタ46_iは、データ2(110)、切替データ信号102のうち対応のビット信号、および切替制御信号101を受ける。セレクタ45_iは、切替制御信号101がアサートされたことに応答して切替データ信号102のうちの対応のビット信号を対応の論理ブロック1_iに出力し、切替制御信号101がネゲートされたことに応答して対応のANDゲート43_iの出力を対応の論理ブロック1_iに出力する。セレクタ46_iは、切替制御信号101がアサートされたことに応答して切替データ信号102のうちの対応のビット信号を対応の論理ブロック1_iに出力し、切替制御信号101がネゲートされたことに応答して対応のANDゲート44_iの出力を対応の論理ブロック1_iに出力する。   As shown in FIG. 7B, the converted circuit portion 12_i (i is an integer of 0 to M) includes a selector 45_i inserted between the AND gate 43_i and the corresponding logic block 1_i, and an AND gate. It further includes a selector 46_i inserted between 44_i and the corresponding logical block 1_i. The selector 45_i receives data 1 (109), the corresponding bit signal among the switching data signal 102, and the switching control signal 101. The selector 46 — i receives the data 2 (110), the corresponding bit signal of the switching data signal 102, and the switching control signal 101. The selector 45_i outputs a corresponding bit signal of the switching data signal 102 to the corresponding logic block 1_i in response to the switching control signal 101 being asserted, and responds to the switching control signal 101 being negated. The output of the corresponding AND gate 43_i is output to the corresponding logic block 1_i. The selector 46_i outputs a corresponding bit signal of the switching data signal 102 to the corresponding logic block 1_i in response to the assertion of the switching control signal 101, and responds to the negation of the switching control signal 101. The output of the corresponding AND gate 44_i is output to the corresponding logic block 1_i.

図8は、図5に示した演算結果111を出力する回路部分13の構成の一例を示す回路図である。図8において(A)は従来の回路構成の例を示し、(B)は変換後の回路構成の例を示す。なお、図8では、一例として、図5の論理ブロック1_0をAND演算ブロックとし、論理ブロック1_1をOR演算ブロックとし、論理ブロック1_Mを加算ブロックとしている。   FIG. 8 is a circuit diagram showing an example of the configuration of the circuit portion 13 that outputs the calculation result 111 shown in FIG. 8A shows an example of a conventional circuit configuration, and FIG. 8B shows an example of a circuit configuration after conversion. In FIG. 8, as an example, the logical block 1_0 in FIG. 5 is an AND operation block, the logical block 1_1 is an OR operation block, and the logical block 1_M is an addition block.

図8(A)に示すように、演算結果111を出力する回路部分には、ALU1の論理ブロック1_0〜1_Mにそれぞれ対応するANDゲート50_0〜50_Mと、ANDゲート50_0〜50_Mの出力を受けるORゲート51とが設けられる。ANDゲート50_0〜50_Mには、さらに、演算種類選択信号100のうち対応の演算種類選択信号がそれぞれ入力される。   As shown in FIG. 8A, the circuit portion that outputs the operation result 111 includes AND gates 50_0 to 50_M corresponding to the logical blocks 1_0 to 1_M of the ALU1 and OR gates that receive the outputs of the AND gates 50_0 to 50_M, respectively. 51 is provided. The AND gates 50_0 to 50_M are further supplied with corresponding calculation type selection signals among the calculation type selection signals 100, respectively.

図8(B)に示すように、変換後の回路部分13には、ORゲート51の出力ノードにセレクタ52がさらに接続される。セレクタ52は、ORゲート51の出力と、切替制御信号101と、切替データ信号102とを受ける。セレクタ52は、切替制御信号101がアサートされたことに応答して切替データ信号102を演算結果111として出力し、切替制御信号101がネゲートされたことに応答してORゲート51の出力を演算結果111として出力する。ただし、セレクタ52は、切替データ信号102を出力するタイミングを、切替制御信号101がアサートされたタイミングよりも、演算ブロックの演算時間に対応する時間(遅延時間Td)だけ遅らせる。セレクタ52は、さらに、ORゲート51の出力信号を出力するタイミングを、切替制御信号101がネゲートされたタイミングよりも上記の遅延時間Tdだけ遅らせる。   As shown in FIG. 8B, a selector 52 is further connected to the output node of the OR gate 51 in the converted circuit portion 13. The selector 52 receives the output of the OR gate 51, the switching control signal 101, and the switching data signal 102. The selector 52 outputs the switching data signal 102 as the calculation result 111 in response to the switching control signal 101 being asserted, and outputs the output of the OR gate 51 in response to the switching control signal 101 being negated. 111 is output. However, the selector 52 delays the timing of outputting the switching data signal 102 by a time (delay time Td) corresponding to the calculation time of the calculation block from the timing when the switching control signal 101 is asserted. The selector 52 further delays the timing at which the output signal of the OR gate 51 is output by the delay time Td above the timing at which the switching control signal 101 is negated.

[演算装置3の動作および効果]
図9は、図5の演算装置3の動作の一例を示すタイミング図である。図9は、上から順に、クロック信号112、演算種類選択信号100、データソース選択信号1(104)、データソース選択信号2(105)、書込レジスタ選択信号106、書込イネーブル信号107、切替データ信号102、切替制御信号101、データ信号1(109)、データ信号2(110)、演算結果111、レジスタ4(2_4)に格納されているデータを示す。以下、図5、図9を参照して、レジスタ4(2_4)に格納されたデータ「a」とレジスタ5(2_5)に格納されたデータ「b」の加算結果「c」(=a+b)がレジスタ4(2_4)に書込まれる場合の動作について説明する。
[Operation and Effect of Arithmetic Unit 3]
FIG. 9 is a timing chart showing an example of the operation of the arithmetic device 3 of FIG. In FIG. 9, in order from the top, the clock signal 112, operation type selection signal 100, data source selection signal 1 (104), data source selection signal 2 (105), write register selection signal 106, write enable signal 107, switching Data signal 102, switching control signal 101, data signal 1 (109), data signal 2 (110), calculation result 111, and data stored in register 4 (2_4) are shown. Hereinafter, referring to FIGS. 5 and 9, the addition result “c” (= a + b) of the data “a” stored in the register 4 (2_4) and the data “b” stored in the register 5 (2_5) is obtained. An operation when data is written to the register 4 (2_4) will be described.

図9に示すように演算装置3は、クロック信号112の立上がりエッジ(時刻t1,t2,t3,t4)に応答して動作する。時刻t2より前の時間帯では、切替制御信号101がアサートされているので、レジスタ群2からデータ信号1(109)として無効データ「X0」が出力され、データ信号2(110)として無効データ「X1」が出力される。ALU1から無効データ「X2」が出力される。   As shown in FIG. 9, the arithmetic unit 3 operates in response to the rising edge (time t1, t2, t3, t4) of the clock signal 112. Since the switching control signal 101 is asserted before the time t2, the invalid data “X0” is output as the data signal 1 (109) from the register group 2, and the invalid data “10” is output as the data signal 2 (110). X1 "is output. Invalid data “X2” is output from ALU1.

次の時刻t2において、切替制御信号101がネゲートされ、切替データ信号102が「X0,X1,X2,…」から「Y0,Y1,Y2,…」に切替わる。なお、切替データ信号102の切替わりのタイミングは、切替制御信号101がネゲートされている間、すなわち、時刻t2から時刻t3の間のいずれのタイミングであってもよい。   At the next time t2, the switching control signal 101 is negated, and the switching data signal 102 is switched from “X0, X1, X2,...” To “Y0, Y1, Y2,. Note that the switching timing of the switching data signal 102 may be any timing while the switching control signal 101 is negated, that is, between time t2 and time t3.

さらに、時刻t2において、演算種類選択信号100として加算演算(ADD)を表わす信号がALU1に入力される。レジスタ群2には、データソース選択信号1(104)としてレジスタ4(2_4)を表わす信号が入力され、データソース選択信号2(105)としてレジスタ5(2_5)を表わす信号が入力され、書込レジスタ選択信号106としてレジスタ4(2_4)を表わす信号が入力される。さらに、レジスタ群2に入力される書込イネーブル信号107がアサートされる。この結果、レジスタ群2からデータ信号1(109)としてデータ「a」が出力され、データ信号2(110)としてデータ「b」が出力される。ALU1から出力される信号111は、時刻t2よりも遅延時間Tdだけ遅れて無効データ「X2」から加算結果「c」(ただし、c=a+b)に切替わる。加算結果「c」は、次のクロック信号の立上がりに応答して時刻t3でレジスタ4に書込まれる。   Further, at time t2, a signal representing an addition operation (ADD) is input to ALU1 as operation type selection signal 100. Register group 2 receives a signal representing register 4 (2_4) as data source selection signal 1 (104), and a signal representing register 5 (2_5) as data source selection signal 2 (105) for writing. A signal representing register 4 (2_4) is input as register selection signal 106. Further, the write enable signal 107 input to the register group 2 is asserted. As a result, data “a” is output as data signal 1 (109) from register group 2, and data “b” is output as data signal 2 (110). The signal 111 output from the ALU1 is switched from the invalid data “X2” to the addition result “c” (where c = a + b) after a delay time Td from the time t2. The addition result “c” is written into the register 4 at time t3 in response to the rise of the next clock signal.

次の時刻t3において、書込イネーブル信号107がネゲートされ、切替制御信号101がアサートされる。この結果、レジスタ群2の回路部分11_1からデータ信号1(109)として無効データ「Y0」が出力され、回路部分11_2からデータ信号2(110)として無効データ「Y1」が出力される。ALU1の回路部分13から出力される信号111は、時刻t3よりも遅延時間Tdだけ遅れて無効データ「Y2」に切替わる。   At the next time t3, the write enable signal 107 is negated and the switching control signal 101 is asserted. As a result, invalid data “Y0” is output as the data signal 1 (109) from the circuit portion 11_1 of the register group 2, and invalid data “Y1” is output as the data signal 2 (110) from the circuit portion 11_2. The signal 111 output from the circuit portion 13 of the ALU1 is switched to invalid data “Y2” with a delay time Td from the time t3.

このように、演算実行に先立って、まず切替制御信号101がアサートされる。切替制御信号101がアサートされている期間は、演算装置3を構成するフリップフロップや論理ゲートなどの出力信号値(すなわち、回路状態)が、切替データ信号102で決まる値となる。次に切替制御信号101をネゲートすることで、実際の演算が実行される。演算種類選択信号100およびデータソース選択信号104、105は、切替制御信号101がネゲートされるタイミングまたはそれ以前の切替制御信号(101)がアサートされている状態で、演算装置3に供給される。演算完了後、再び切替制御信号101がアサートされて、演算装置3を構成するフリップフロップや論理ゲートなどの出力信号値(すなわち、回路状態)は実行した演算とは無関係の値となる。切替制御信号101がネゲートされるタイミングでは、演算結果がレジスタ群2のうち書込レジスタ選択信号106で指定されたレジスタに書込まれる。   As described above, the switching control signal 101 is first asserted prior to the execution of the calculation. During the period when the switching control signal 101 is asserted, the output signal values (that is, circuit states) of the flip-flops and logic gates constituting the arithmetic device 3 are values determined by the switching data signal 102. Next, the actual calculation is executed by negating the switching control signal 101. The calculation type selection signal 100 and the data source selection signals 104 and 105 are supplied to the calculation device 3 in a state in which the switching control signal 101 is negated or the previous switching control signal (101) is asserted. After the calculation is completed, the switching control signal 101 is asserted again, and output signal values (that is, circuit states) such as flip-flops and logic gates constituting the calculation device 3 become values unrelated to the executed calculation. At the timing when the switching control signal 101 is negated, the operation result is written in the register designated by the write register selection signal 106 in the register group 2.

演算実行前および演算実行後の演算装置3の内部信号の値、すなわち回路状態は、特にALU1の入出力データ信号109,110,111は、「0」などのある決まった値ではなく、切替データ信号102で決まる値になる。このため、ALU1の入出力データのハミング重みは、ALU1の入出力データのハミング距離とは無関係となる。したがって、ALU1の入出力データのハミング重みを選択関数とした電力解析攻撃に対する耐性が向上する。   The value of the internal signal of the arithmetic unit 3 before the execution of the operation and after the execution of the operation, that is, the circuit state, in particular, the input / output data signals 109, 110, and 111 of the ALU 1 are not predetermined values such as “0” but the switching data The value is determined by the signal 102. Therefore, the hamming weight of the input / output data of ALU1 is independent of the hamming distance of the input / output data of ALU1. Therefore, resistance to power analysis attacks using the Hamming weight of the input / output data of ALU1 as a selection function is improved.

演算のソースレジスタと同一のレジスタが演算結果を格納するレジスタとして指定された場合も、レジスタに格納されるデータが更新されるタイミングで、ALU1に入力されるデータは更新後のレジスタの内容ではなく、切替データ信号102で決まる値となる。この結果、レジスタの値の更新前後のハミング距離を選択関数とした電力解析攻撃に対する耐性が向上する。   Even when the same register as the calculation source register is designated as the register for storing the calculation result, the data input to the ALU 1 is not the updated register contents at the timing when the data stored in the register is updated. The value is determined by the switching data signal 102. As a result, resistance against power analysis attacks using the Hamming distance before and after the update of the register value as a selection function is improved.

以下、演算データのデータ幅を4ビットとした場合について、図6(A),(B)を参照して具体的に説明する。図6(A)に示す変換前の回路では、データソースとしていずれのレジスタも選択されないとき(たとえば、演算を必要としない命令実行時など)は、レジスタ群2から出力されるデータ1(109)には4ビットが全て「0」のデータ(「0000」と記す)が現れる。演算実行のためにレジスタj(2_j)(jは0以上N以下の整数)が選択されるとデータ1(109)はレジスタj(2_j)の内容に変化する。このとき、レジスタj(2_j)の記憶内容が「0101」であれば、データ1(109)の2ビットの変化に対応する電力が演算装置内で消費され、レジスタj(2_j)の内容が「1111」であればデータ1(109)の4ビットの変化に対応する電力が消費される。上記演算完了時にデータ1(109)が「0000」に戻る場合も同様である。この結果は同じデータで同じ演算を何度実行しても変わらない。このため、レジスタj(2_j)の値のハミング重みを選択関数とした電力解析により、秘密情報が漏洩する可能性がある。   Hereinafter, a case where the data width of the operation data is 4 bits will be specifically described with reference to FIGS. 6 (A) and 6 (B). In the circuit before conversion shown in FIG. 6A, when any register is not selected as a data source (for example, when an instruction that does not require an operation is executed), data 1 (109) output from the register group 2 The data in which all 4 bits are “0” (denoted as “0000”) appears. When register j (2_j) (j is an integer not smaller than 0 and not larger than N) is selected for execution of operation, data 1 (109) changes to the contents of register j (2_j). At this time, if the stored content of the register j (2_j) is “0101”, the power corresponding to the 2-bit change of the data 1 (109) is consumed in the arithmetic unit, and the content of the register j (2_j) is “ If “1111”, power corresponding to a 4-bit change of data 1 (109) is consumed. The same applies when data 1 (109) returns to “0000” upon completion of the above calculation. This result does not change no matter how many times the same operation is performed with the same data. For this reason, secret information may be leaked by power analysis using the Hamming weight of the value of the register j (2_j) as a selection function.

一方、図6(B)に示す変換後の回路では、演算実行前の状態および演算実行後の状態では切替制御信号101がアサートされているので、データ1(109)の値が切替データ信号102の値に設定される。具体的に、切替データ信号102が演算前は「1010」に設定され、演算後は「0101」に設定されていたとする。この場合、レジスタj(2_j)の記憶内容が「0101」であれば、演算開始時にはデータ1(109)の変化は4ビット、演算完了時にはデータ1(109)の変化は0ビットとなる。したがって、レジスタj(2_j)の値のハミング重みとデータ1(109)との間に相関が無くなる。同じデータで同じ演算を何度実行しても、その時点での切替データ信号102の内容によって消費電力が変わる。この結果、レジスタj(2_j)の値のハミング重みを選択関数とした電力解析攻撃に対する耐性が向上する。   On the other hand, in the circuit after conversion shown in FIG. 6B, since the switching control signal 101 is asserted in the state before the execution of the operation and the state after the execution of the operation, the value of the data 1 (109) becomes the switching data signal 102. Is set to the value of Specifically, it is assumed that the switching data signal 102 is set to “1010” before the calculation and “0101” after the calculation. In this case, if the stored content of the register j (2_j) is “0101”, the change of the data 1 (109) is 4 bits at the start of the calculation, and the change of the data 1 (109) is 0 bit when the calculation is completed. Therefore, there is no correlation between the Hamming weight of the value of the register j (2_j) and the data 1 (109). No matter how many times the same operation is performed with the same data, the power consumption changes depending on the contents of the switching data signal 102 at that time. As a result, resistance against power analysis attacks using the Hamming weight of the value of the register j (2_j) as a selection function is improved.

図7で説明した演算ブロック1_0〜1_Mへの入力信号を生成している回路素子の場合も、変換前の図7(A)に示す回路では、演算ブロック1_0〜1_Mが使用されない期間には、ある決まった値(たとえば、全て「0」のデータ)がこれらの演算ブロックに入力される。これに対して、変更後の図7(B)に示す回路では、演算ブロック1_0〜1_Mが使用されない期間には、切替データ信号102で設定された値がこれらの演算ブロック1_0〜1_Mに入力される。この結果、選択されたレジスタj(2_j)(jは0以上N以下の整数)の値のハミング重みを選択関数とした電力解析攻撃に対する耐性が向上する。   In the case of the circuit elements that generate the input signals to the arithmetic blocks 1_0 to 1_M described with reference to FIG. 7, in the circuit illustrated in FIG. 7A before conversion, in the period when the arithmetic blocks 1_0 to 1_M are not used, A certain value (for example, data of all “0”) is input to these operation blocks. On the other hand, in the circuit shown in FIG. 7B after the change, the value set by the switching data signal 102 is input to these arithmetic blocks 1_0 to 1_M during a period when the arithmetic blocks 1_0 to 1_M are not used. The As a result, the resistance to a power analysis attack using the Hamming weight of the value of the selected register j (2_j) (j is an integer not less than 0 and not more than N) as a selection function is improved.

演算結果111を出力する回路素子に図8(B)に示すような変換を施した場合も上記と同様であり、演算結果111のハミング重みを選択関数とした電力解析に対する耐性が向上する。さらに、レジスタ群2内の各レジスタに図4に示すような変換を施すことで、レジスタ内容を更新した前後でのレジスタの値のハミング距離を選択関数とした電力解析攻撃に対する耐性が向上する。   The case where the conversion as shown in FIG. 8B is performed on the circuit element that outputs the calculation result 111 is similar to the above, and the resistance to power analysis using the Hamming weight of the calculation result 111 as a selection function is improved. Further, by performing the conversion as shown in FIG. 4 on each register in the register group 2, resistance to a power analysis attack using the Hamming distance of the register value before and after updating the register contents as a selection function is improved.

このように実施の形態1の演算装置3によれば、演算装置3に含まれる論理ゲートおよびフリップフロップなどの回路素子のうち少なくとも一部の回路素子について、切替制御信号101が活性化されたことに応答して、演算に用いられるソースデータや演算結果と無関係な切替データ信号102を出力するように設計が変更される。これによって、演算装置3の回路素子の単位で電力解析攻撃への木目細かい対策が可能となる。   As described above, according to the arithmetic device 3 of the first embodiment, the switching control signal 101 is activated for at least some of the circuit elements such as logic gates and flip-flops included in the arithmetic device 3. In response to this, the design is changed so as to output the switching data signal 102 irrelevant to the source data used in the calculation and the calculation result. As a result, it is possible to take detailed measures against power analysis attacks in units of circuit elements of the arithmetic device 3.

<実施の形態2>
図10は、この発明の実施の形態2に従うCPU10の構成を示すブロック図である。図10には主記憶装置20(命令メモリ21、データメモリ22)や信号の流れも併せて示される。図1で説明した演算装置3に入力される各信号のうちクロック信号112、リセット信号113の図示は省略されている。クロック信号112、リセット信号113は、通常、CPU10の外部から与えられる。なお、実施の形態2および後続する各実施の形態で説明するCPUの構成は一例として示すものであって、実施の形態1で示した演算装置3は公知のいずれの構成のCPUに対しも適用できる。
<Embodiment 2>
FIG. 10 is a block diagram showing a configuration of CPU 10 according to the second embodiment of the present invention. FIG. 10 also shows the main storage device 20 (instruction memory 21 and data memory 22) and the flow of signals. Of the signals input to the arithmetic unit 3 described with reference to FIG. 1, the clock signal 112 and the reset signal 113 are not shown. The clock signal 112 and the reset signal 113 are usually given from the outside of the CPU 10. The configuration of the CPU described in the second embodiment and each subsequent embodiment is shown as an example, and the arithmetic device 3 shown in the first embodiment is applicable to any known CPU. it can.

図10において、CPU10は、実施の形態1で説明した演算装置3と、命令レジスタ4と、命令デコーダ5と、プログラムカウンタ6と、切替データ信号生成部7とを含む。命令レジスタ4は、プログラムカウンタ6の値に従って命令メモリ21から命令を読み出す。命令デコーダ5は、命令レジスタ4によって読み出された命令をデコードし、命令の種類に応じた制御信号を演算装置3またはデータメモリ22に出力する。命令デコーダ5は、たとえば、算術論理演算命令を読み出した場合には、命令内容に応じた演算種類選択信号100をALU1に出力し、命令内容に応じたデータソース選択信号1(104)、データソース選択信号2(105)、および書込レジスタ選択信号106をレジスタ群2に出力し、書込イネーブル信号107をアサートする。この結果、ALU1で演算が実行され、演算結果が指定されたレジスタに書込まれる。メモリ操作命令を読み出した場合には、命令デコーダ5は、命令内容に応じて書込レジスタ選択信号106をレジスタ群2に出力し、メモリ制御信号をデータメモリ22に出力し、書込イネーブル信号107をアサートする。この結果、メモリ操作命令によって指令されたメモリアドレスに格納されたデータが書込データ108としてレジスタ群2の指定されたレジスタに書込まれる。   In FIG. 10, the CPU 10 includes the arithmetic device 3 described in the first embodiment, an instruction register 4, an instruction decoder 5, a program counter 6, and a switching data signal generation unit 7. The instruction register 4 reads an instruction from the instruction memory 21 according to the value of the program counter 6. The instruction decoder 5 decodes the instruction read by the instruction register 4 and outputs a control signal corresponding to the type of instruction to the arithmetic unit 3 or the data memory 22. For example, when an arithmetic logic operation instruction is read, the instruction decoder 5 outputs an operation type selection signal 100 corresponding to the instruction content to the ALU 1, and a data source selection signal 1 (104), data source corresponding to the instruction content The selection signal 2 (105) and the write register selection signal 106 are output to the register group 2, and the write enable signal 107 is asserted. As a result, the operation is executed in ALU1, and the operation result is written to the designated register. When the memory operation instruction is read, the instruction decoder 5 outputs a write register selection signal 106 to the register group 2 according to the instruction content, outputs a memory control signal to the data memory 22, and a write enable signal 107. Is asserted. As a result, the data stored at the memory address instructed by the memory operation instruction is written as the write data 108 to the designated register of the register group 2.

実施の形態2の場合、命令の種類には、切替制御信号101をアサートするための専用命令である切替命令がさらに含まれる。命令デコーダ5は、通常、ネゲートされた切替制御信号101をALU1およびレジスタ群2に出力する。命令デコーダ5は、切替命令が実行されるサイクルで切替制御信号101をアサートし、切替命令の実行が完了すると切替制御信号101をネゲートする。切替命令は、切替制御信号101を変化させる以外の副作用を持たない。CPU10を動作させるソフトウェアでは、電力解析攻撃によって秘密情報が漏洩する可能性がある演算命令の前後に、当該切替命令が挿入される。切替命令と秘密情報が漏洩する可能性がある演算命令とは連続して実行される必要があるため、これらは割り込み禁止の状態で実行されなければならない。これは、CPUが一般に備えている割り込みマスクの機能を用いて実現できる。ただし、通常、暗号処理のプログラムは割り込み禁止で実行されるので、切替命令を実行するために追加の割り込みマスクは不要である。なお、上記の切替命令を新たな命令として追加せず、副作用を持たない他の命令(たとえば、何も実行しないNOP命令(No OPeration Instruction))に上記の切替命令の機能を持たせてもよい。   In the case of the second embodiment, the type of instruction further includes a switching instruction that is a dedicated instruction for asserting the switching control signal 101. The instruction decoder 5 normally outputs the negated switching control signal 101 to the ALU 1 and the register group 2. The instruction decoder 5 asserts the switching control signal 101 in the cycle in which the switching instruction is executed, and negates the switching control signal 101 when the execution of the switching instruction is completed. The switching command has no side effects other than changing the switching control signal 101. In the software that operates the CPU 10, the switching instruction is inserted before and after the arithmetic instruction that may cause the secret information to leak due to the power analysis attack. Since the switching instruction and the calculation instruction that may leak the secret information need to be executed continuously, they must be executed in the interrupt disabled state. This can be realized by using an interrupt mask function generally provided in the CPU. However, since the encryption processing program is normally executed with interrupts disabled, no additional interrupt mask is required to execute the switching instruction. Note that the above switching instruction is not added as a new instruction, and other instructions having no side effects (for example, a NOP instruction that performs nothing) may have the function of the above switching instruction. .

図10において、切替データ信号生成部7は切替データ信号102を生成する。切替データ信号生成部7として、たとえば、乱数発生源や擬似乱数生成器を用いることができる。その他、演算実行時のシステムクロックやタイマの値を利用して切替データ信号102を生成してもよい。   In FIG. 10, the switching data signal generation unit 7 generates a switching data signal 102. As the switching data signal generator 7, for example, a random number generation source or a pseudo random number generator can be used. In addition, the switching data signal 102 may be generated using a system clock or a timer value at the time of execution of calculation.

このように、実施の形態2に従うCPU10では、切替制御信号101をアサートするための命令を追加することによって、ソフトウェアを用いて切替制御信号101をアサートまたはネゲートするタイミングを柔軟に制御することができる。   As described above, the CPU 10 according to the second embodiment can flexibly control the timing at which the switching control signal 101 is asserted or negated using software by adding a command for asserting the switching control signal 101. .

<実施の形態3>
図11は、この発明の実施の形態3に従うCPU10Aの構成を示すブロック図である。図11のCPU10Aは、図10の切替データ信号生成部7に代えて、ソフトウェアによって任意の値を書込むことができる専用のレジスタ14を含み、レジスタ14の記憶内容を切替データ信号102として使用する点で、図10のCPU10と異なる。図11のCPU10Aにおいて、専用のレジスタ14は、レジスタ群2Aの内部に設けられているが、レジスタ群2Aの外部に設けてもよい。レジスタ14のビット長は、切替データ信号(102)の生成に必要なだけ設けられる。複数の専用レジスタによって切替データ信号102を生成してもよい。
<Embodiment 3>
FIG. 11 is a block diagram showing a configuration of CPU 10A according to the third embodiment of the present invention. The CPU 10A in FIG. 11 includes a dedicated register 14 in which an arbitrary value can be written by software instead of the switching data signal generation unit 7 in FIG. 10, and uses the stored contents of the register 14 as the switching data signal 102. This is different from the CPU 10 of FIG. In the CPU 10A of FIG. 11, the dedicated register 14 is provided inside the register group 2A, but may be provided outside the register group 2A. The bit length of the register 14 is provided as much as necessary for generating the switching data signal (102). The switching data signal 102 may be generated by a plurality of dedicated registers.

CPU10Aは、専用のレジスタ14に任意の値を書き込むための専用命令を備えてもよいし、専用レジスタ14にアドレスを割り付けて、通常のストア命令によって任意の値を専用レジスタ14に書込むようにしてもよい。専用レジスタ14の記憶内容は、ソフトウェアによって、任意のタイミングで(たとえば、所定の時間が経過する都度、または所定回数の演算を実行する都度)任意のデータに更新することができる。この場合、専用レジスタ14に書込むデータは、「0」と「1」のビットをほぼ等しい割合で含み、かつ偏りの小さいようにするのが好ましい。   The CPU 10A may be provided with a dedicated instruction for writing an arbitrary value to the dedicated register 14, or an address is assigned to the dedicated register 14 and an arbitrary value is written to the dedicated register 14 by a normal store instruction. Good. The stored contents of the dedicated register 14 can be updated to arbitrary data by software at an arbitrary timing (for example, every time a predetermined time elapses or every time a predetermined number of operations are executed). In this case, it is preferable that the data to be written to the dedicated register 14 includes “0” and “1” bits at an approximately equal ratio and has a small deviation.

図11のその他の点は図10と共通するので、同一または相当する部分には同一の参照符号を付して説明を繰返さない。   Other points in FIG. 11 are the same as those in FIG. 10, and therefore, the same or corresponding parts are denoted by the same reference numerals and description thereof will not be repeated.

<実施の形態4>
図12は、この発明の実施の形態4に従うCPU10Bの構成を示すブロック図である。図12のCPU10Bは、図11の専用のレジスタ14に代えて、切替データ信号102として用いるにに必要なビット長を有するシフトレジスタ15を含み、シフトレジスタ15の記憶内容を切替データ信号102として使用する点で、図11のCPU10Aと異なる。図12に示す1個のシフトレジスタ15に代えて、複数のシフトレジスタで切替データ信号102を生成するようにしてもよい。CPU10Bでは、シフトレジスタ15がシフトすることによって切替データ信号102の値が変化する。
シフトレジスタ15に記憶されるデータは、シフト動作に伴って各ビットに0と1がほぼ等しい割合で現れ、かつ隣り合ったビット同士の偏りが小さい任意のビットパターンである。一例として、32ビットのシフトレジスタで1ビットずつ巡回シフトする場合には、たとえば、「01010011101011001010110001010011」を初期値とすればよい。
<Embodiment 4>
FIG. 12 is a block diagram showing a configuration of CPU 10B according to the fourth embodiment of the present invention. The CPU 10B of FIG. 12 includes a shift register 15 having a bit length necessary for use as the switching data signal 102 instead of the dedicated register 14 of FIG. 11, and uses the stored contents of the shift register 15 as the switching data signal 102. This is different from the CPU 10A of FIG. Instead of the single shift register 15 shown in FIG. 12, the switching data signal 102 may be generated by a plurality of shift registers. In the CPU 10B, the value of the switching data signal 102 changes as the shift register 15 shifts.
The data stored in the shift register 15 is an arbitrary bit pattern in which 0 and 1 appear in each bit in a substantially equal ratio in accordance with the shift operation, and the bias between adjacent bits is small. As an example, when a 32-bit shift register is used to cyclically shift one bit at a time, for example, “01010011101011001010110001010011” may be set as an initial value.

シフトレジスタ15のシフト方法は、たとえば以下のような例が考えられ、特に限定されるものではない。   Examples of the shift method of the shift register 15 include the following examples, and are not particularly limited.

(1) 所定のクロックサイクルごとに任意のビット数分ずつ(たとえば1ビットずつ)巡回シフトする。   (1) A cyclic shift is performed by an arbitrary number of bits (for example, one bit) every predetermined clock cycle.

(2) 切替制御信号101が所定の回数アサートされるごとに任意のビット数分ずつ(たとえば1ビットずつ)巡回シフトする。   (2) Each time the switching control signal 101 is asserted a predetermined number of times, a cyclic shift is performed by an arbitrary number of bits (for example, by 1 bit).

(3) 「クロックサイクルごとに1ビット右巡回シフト、3ビット左巡回シフト」を繰り返す。   (3) Repeat “1-bit right cyclic shift, 3-bit left cyclic shift every clock cycle”.

(4) 「2ビット左巡回シフトを50回行ない、1ビット右巡回シフトを100回行なう」というシフト動作を繰り返す。   (4) The shift operation of “2-bit left cyclic shift is performed 50 times and 1-bit right cyclic shift is performed 100 times” is repeated.

(5) 「100クロックサイクルの間、連続して巡回シフトした後、50クロックサイクルの間は巡回シフトしない」というシフト動作を繰り返す。   (5) The shift operation of “cyclic shift continuously for 100 clock cycles and no cyclic shift for 50 clock cycles” is repeated.

さらに、巡回シフト以外のシフト方法として、以下の方法も考えられる。
(6) シフトアウトしたビットの反転値を新たなビットとして追加する。
Furthermore, the following method is also conceivable as a shift method other than the cyclic shift.
(6) The inverted value of the shifted out bit is added as a new bit.

(7) シフトアウトしたビットの代わりに、シフトレジスタのX番目のビットを新たなビットとして追加する。   (7) Instead of the shifted out bit, the Xth bit of the shift register is added as a new bit.

さらに、実施の形態3で説明した専用レジスタ14と同様に、ソフトウェアによって任意の値をシフトレジスタ15に書き込むことができるようにしてもよいし、ソフトウェアによってシフト方法を変更できるようにしてもよい。   Further, similarly to the dedicated register 14 described in the third embodiment, any value may be written to the shift register 15 by software, or the shift method may be changed by software.

<実施の形態5>
図13は、この発明の実施の形態5に従うCPU10Cの構成を示すブロック図である。図13のCPU10Cは、命令デコーダ5Aが切替制御信号101を生成せず、切替制御信号101を生成するための新たな構成として、モード設定用レジスタ16と、クロックバッファ17と、ANDゲート18(切替制御信号生成部)とをさらに含む点で、図12のCPU10Bと異なる。
<Embodiment 5>
FIG. 13 is a block diagram showing a configuration of CPU 10C according to the fifth embodiment of the present invention. The CPU 10C of FIG. 13 has a mode setting register 16, a clock buffer 17, and an AND gate 18 (switching) as a new configuration for generating the switching control signal 101 without the instruction decoder 5A generating the switching control signal 101. 12 is different from the CPU 10B of FIG.

CPU10Cは、セキュアモードと非セキュアモードの2つの動作モードを有する。いずれの動作モードであるかはモード設定用レジスタ16の値によって決まる。図13の場合には、モード設定用レジスタ16の値が「1」のときセキュアモードとし、「0」のとき非セキュアモードであるとする。セキュアモードでは、切替制御信号101および切替データ信号102による演算装置3Cの制御が有効になる。非セキュアモードでは、切替制御信号101および切替データ信号102による制御が無効になる。モード設定用レジスタ16の値はソフトウェアによって設定可能である。典型的には、モード設定用レジスタ16として既存の制御レジスタの特定のビットが割当てられるが、CPU10Cがモード設定用の専用レジスタや当該レジスタにアクセスための専用命令を備えていてもよい。図13では、モード設定用レジスタ16がレジスタ群2Cの内部に設けられているが、レジスタ群2Cの外部にモード設定用レジスタ16を設けてもよい。   The CPU 10C has two operation modes, a secure mode and a non-secure mode. Which operation mode is selected depends on the value of the mode setting register 16. In the case of FIG. 13, the secure mode is set when the value of the mode setting register 16 is “1”, and the non-secure mode is set when “0”. In the secure mode, the control of the arithmetic device 3C by the switching control signal 101 and the switching data signal 102 is effective. In the non-secure mode, control by the switching control signal 101 and the switching data signal 102 is invalid. The value of the mode setting register 16 can be set by software. Typically, a specific bit of an existing control register is assigned as the mode setting register 16, but the CPU 10C may include a dedicated register for mode setting or a dedicated instruction for accessing the register. In FIG. 13, the mode setting register 16 is provided in the register group 2C, but the mode setting register 16 may be provided outside the register group 2C.

クロックバッファ17は、CPU10Cの外部から与えられたクロック信号112に基づいてクロック信号112に同期する新たな信号114を生成する。設計ルールとしてクロック信号112を組合せ回路の入力信号として使用することが許されていない場合などにクロックバッファ17が用いられる。   The clock buffer 17 generates a new signal 114 synchronized with the clock signal 112 based on the clock signal 112 given from the outside of the CPU 10C. The clock buffer 17 is used when the clock signal 112 is not permitted as an input signal of the combinational circuit as a design rule.

図14は、クロックバッファ17の構成および動作を説明するための図である。図14(A)を参照して、クロックバッファ17は、D−フリップフロップ61,62と、インバータ63,64と、排他的論理和ゲート65とを含む。D−フリップフロップ61,62のクロック端子CKにはクロック信号112が入力される。D−フリップフロップ61の出力端子Qはインバータ63を介してD−フリップフロップ61のデータ端子Dに接続される。D−フリップフロップ62の出力端子Qはインバータ64を介してD−フリップフロップ62のデータ端子Dに接続される。D−フリップフロップ61,62の出力端子Qはさらに排他的論理和ゲート65の入力ノードに接続される。D−フリップフロップ61は、クロック信号112の立上がりエッジに応答してD端子の入力値がQ端子の出力として保持され、D−フリップフロップ62は、クロック信号112の立下がりエッジに応答してD端子の入力値がQ端子の出力として保持される。   FIG. 14 is a diagram for explaining the configuration and operation of the clock buffer 17. Referring to FIG. 14A, clock buffer 17 includes D-flip flops 61 and 62, inverters 63 and 64, and an exclusive OR gate 65. The clock signal 112 is input to the clock terminal CK of the D flip-flops 61 and 62. The output terminal Q of the D flip-flop 61 is connected to the data terminal D of the D flip-flop 61 through the inverter 63. The output terminal Q of the D flip-flop 62 is connected to the data terminal D of the D flip-flop 62 through the inverter 64. The output terminals Q of the D flip-flops 61 and 62 are further connected to the input node of the exclusive OR gate 65. In the D-flip flop 61, the input value of the D terminal is held as the output of the Q terminal in response to the rising edge of the clock signal 112, and the D-flip flop 62 in response to the falling edge of the clock signal 112. The input value of the terminal is held as the output of the Q terminal.

図14(B)には、クロック信号112、D−フリップフロップ61,62の出力信号S1,S2、および排他的論理和ゲート65の出力信号SOUTの電圧波形が示される。D−フリップフロップ61の出力信号S1はクロック信号112の立上がりエッジ(時刻t1,t3など)に応答してハイ(H)レベルまたはロー(L)レベルに切替わり、D−フリップフロップ62に出力信号S2はクロック信号112の立下がりエッジ(時刻t2,t4など)に応答してHレベルまたはLレベルに切替わる。この結果、排他的論理和ゲート65の出力信号SOUTはクロック信号112に応答して信号レベルが変化する。   FIG. 14B shows voltage waveforms of the clock signal 112, the output signals S1 and S2 of the D-flip flops 61 and 62, and the output signal SOUT of the exclusive OR gate 65. The output signal S1 of the D-flip flop 61 is switched to a high (H) level or a low (L) level in response to the rising edge (time t1, t3, etc.) of the clock signal 112, and the output signal to the D-flip flop 62 is output. S2 switches to H level or L level in response to the falling edge of clock signal 112 (time t2, t4, etc.). As a result, the signal level of the output signal SOUT of the exclusive OR gate 65 changes in response to the clock signal 112.

再び図13を参照して、ANDゲート18は、クロックバッファ17の出力信号114とモード設定用レジスタ16の設定値に対応するモード設定信号115とを受け、これらの論理積を切替制御信号101として、ALU1およびレジスタ群2Cに出力する。したがって、モード設定用レジスタ16の値が「1」であるセキュアモードでは、1クロックサイクルのうちクロック信号が「1」(Hレベル)の期間で切替制御信号101がアサートされ、クロック信号が「0」(Lレベル)の期間で切替制御信号101がネゲートされる。したがって、セキュアモードでは、クロック信号「0」の期間が演算装置3Cによる演算処理に使用できる時間となる。一方、モード設定用レジスタ16の値が「0」である非セキュアモードでは、クロックバッファ17の出力信号114の論理レベルによらず、切替制御信号101がネゲートされる。したがって、非セキュアモードでは、1クロックサイクルの全てが演算装置3Cによる演算処理に使用できる時間になる。   Referring again to FIG. 13, the AND gate 18 receives the output signal 114 of the clock buffer 17 and the mode setting signal 115 corresponding to the setting value of the mode setting register 16, and these logical products are used as the switching control signal 101. , ALU1 and register group 2C. Therefore, in the secure mode in which the value of the mode setting register 16 is “1”, the switching control signal 101 is asserted during the period in which the clock signal is “1” (H level) in one clock cycle, and the clock signal is “0”. ”(L level), the switching control signal 101 is negated. Therefore, in the secure mode, the period of the clock signal “0” is a time that can be used for the arithmetic processing by the arithmetic device 3C. On the other hand, in the non-secure mode where the value of the mode setting register 16 is “0”, the switching control signal 101 is negated regardless of the logic level of the output signal 114 of the clock buffer 17. Therefore, in the non-secure mode, all of one clock cycle is a time that can be used for arithmetic processing by the arithmetic device 3C.

図13のその他の点は、図12で説明したCPU10Bと同じであるので、同一または相当する部分には同一の参照符号を付して説明を繰返さない。   The other points in FIG. 13 are the same as those of CPU 10B described in FIG. 12, and therefore, the same or corresponding parts are denoted by the same reference numerals and description thereof will not be repeated.

図15は、図13のCPU10Cの動作の一例を示すタイミング図である。図15は、上から順に、クロック信号112、演算種類選択信号100、データソース選択信号1(104)、データソース選択信号2(105)、書込レジスタ選択信号106、書込イネーブル信号107、切替データ信号102、切替制御信号101、データ信号1(109)、データ信号2(110)、演算結果を表わす信号111、レジスタ4(2_4)に格納されているデータを示す。以下、図13、図15を参照して、レジスタ4(2_4)に格納されたデータ「a」とレジスタ5(2_5)に格納されたデータ「b」の加算結果「c」(=a+b)がレジスタ4(2_4)に書込まれる場合の動作について説明する。   FIG. 15 is a timing chart showing an example of the operation of the CPU 10C of FIG. In FIG. 15, in order from the top, the clock signal 112, the operation type selection signal 100, the data source selection signal 1 (104), the data source selection signal 2 (105), the write register selection signal 106, the write enable signal 107, switching The data signal 102, the switching control signal 101, the data signal 1 (109), the data signal 2 (110), the signal 111 indicating the calculation result, and the data stored in the register 4 (2_4) are shown. Hereinafter, referring to FIG. 13 and FIG. 15, the addition result “c” (= a + b) of the data “a” stored in the register 4 (2_4) and the data “b” stored in the register 5 (2_5) is obtained. An operation when data is written to the register 4 (2_4) will be described.

図15に示すようにCPU10Cは、切替制御信号101を除いて、クロック信号112の立上がりエッジ(時刻t11,t13,t15,t17)に応答して動作する。切替制御信号101は、クロック信号112の立上がりエッジに応答してアサートされ、クロック信号112の立下がりエッジ(時刻t12,t14,t16,t18)に応答してネゲートされる。これによって、レジスタ群2CからALU1出力されるデータ信号1,2(109,110)およびALU1から出力される演算結果を表わす信号111もクロック信号112の立上がりエッジおよび立下がりエッジの両方に応答して変化する。ただし、ALU1から出力される演算結果を表わす信号111の信号レベルは、ALU1における演算時間に相当する時間(遅延時間Td)だけクロックエッジよりも遅延して変化する。   As shown in FIG. 15, the CPU 10C operates in response to the rising edges (time t11, t13, t15, t17) of the clock signal 112 except for the switching control signal 101. The switching control signal 101 is asserted in response to the rising edge of the clock signal 112 and negated in response to the falling edge of the clock signal 112 (time t12, t14, t16, t18). Thus, data signals 1 and 2 (109, 110) output from ALU1 from register group 2C and signal 111 representing the operation result output from ALU1 are also responsive to both the rising edge and falling edge of clock signal 112. Change. However, the signal level of the signal 111 representing the calculation result output from the ALU 1 changes with a delay from the clock edge by a time corresponding to the calculation time in the ALU 1 (delay time Td).

切替データ信号102は、たとえば、シフトレジスタ15が巡回シフトすることによって、クロック信号112の立上がりエッジに応答してその値が変化する。図15の場合には、切替データ信号102は、時刻t11に「X0,X1,X2,…」に切替わり、時刻t13に「Y0,Y1,Y2,…」に切替わり、時刻t15に「Z0,Z1,Z2,…」に切替わる。   The value of the switching data signal 102 changes in response to the rising edge of the clock signal 112, for example, when the shift register 15 is cyclically shifted. In the case of FIG. 15, the switching data signal 102 is switched to “X0, X1, X2,...” At time t11, switched to “Y0, Y1, Y2,. , Z1, Z2,...

時刻t13において、演算種類選択信号100として加算演算(ADD)を表わす信号がALU1に入力される。レジスタ群2Cには、データソース選択信号1(104)としてレジスタ4を表わす信号が入力され、データソース選択信号2(105)としてレジスタ5を表わす信号が入力され、書込レジスタ選択信号106としてレジスタ4を表わす信号が入力される。さらに、レジスタ群2Cに入力される書込イネーブル信号107がアサートされる。   At time t13, a signal representing an addition operation (ADD) is input to ALU1 as operation type selection signal 100. The register group 2C receives a signal representing the register 4 as the data source selection signal 1 (104), receives a signal representing the register 5 as the data source selection signal 2 (105), and registers as the write register selection signal 106. 4 is input. Further, the write enable signal 107 input to the register group 2C is asserted.

時刻t13と次の時刻t14との間の時間帯では、切替制御信号101がアサートされているので、ALU1に入力されるデータ信号1,2(109,110)はそれぞれ切替データ信号「Y0」、「Y1」であり、レジスタ4,5(2_4,2_5)の記憶内容「a」、「b」はALU1に入力されない。   Since the switching control signal 101 is asserted in the time zone between the time t13 and the next time t14, the data signals 1 and 2 (109, 110) input to the ALU1 are switched data signals “Y0”, “Y1” and the stored contents “a” and “b” of the registers 4 and 5 (2_4 and 2_5) are not input to the ALU1.

時刻t14に切替制御信号101がネゲートされると、データ信号1,2(109,110)として「a」、「b」がALU1に入力される。この結果、時刻t14よりも遅延時間Tdだけ遅れて、ALU1から出力される信号111が、切替データ信号「Y2」から加算結果「c」(c=a+b)に切替わる。加算結果「c」は、次のクロック信号112の立上がりエッジに応答して時刻t15でレジスタ4に書込まれる。   When the switching control signal 101 is negated at time t14, “a” and “b” are input to the ALU 1 as the data signals 1 and 2 (109 and 110). As a result, the signal 111 output from the ALU 1 is switched from the switching data signal “Y2” to the addition result “c” (c = a + b) after a delay time Td from the time t14. The addition result “c” is written to the register 4 at time t15 in response to the rising edge of the next clock signal 112.

次の時刻t15において、書込イネーブル信号107がネゲートされ、切替制御信号101がアサートされる。この結果、レジスタ群2Cからデータ信号1(109)として無効データ「Z0」がALU1出力され、データ信号2(110)として無効データ「Z1」がALU1に出力される。ALU1から出力される信号111は、時刻t3よりも遅延時間Tdだけ遅れて無効データ「Z2」に切替わる。   At the next time t15, the write enable signal 107 is negated and the switching control signal 101 is asserted. As a result, the invalid data “Z0” is output to the ALU1 as the data signal 1 (109) from the register group 2C, and the invalid data “Z1” is output to the ALU1 as the data signal 2 (110). The signal 111 output from the ALU1 is switched to invalid data “Z2” with a delay time Td from the time t3.

このように、1クロックサイクルの前半の半周期で切替制御信号101をアサートすることによって、ALU1に入出力される信号109,110,111の値、さらには演算装置3C内の回路状態が切替データ信号102で決まる値となる。1クロックサイクルの後半の半周期で切替制御信号101をネゲートすることによって、実際の演算が実行される。演算完了後、切替制御信号101を再度アサートすることによって、ALU1に入出力される信号109,110,111の値が切替データ信号102で決まる値となり、実行した演算とは無関係の値となる。この結果、ALU1の入出力データのハミング重みは、ALU1の入出力データのハミング距離とは無関係となる。このため、ALU1の入出力データのハミング重みを選択関数とした電力解析攻撃に対する耐性が向上するとともに、更新前後のレジスタの値のハミング距離を選択関数とした電力解析攻撃に対する耐性も向上する。さらに、1クロックサイクルの間に、切替データ信号の出力と演算処理とが行なわれるので、切替データ信号を出力するための余計なクロックサイクルを設ける必要がない。   As described above, by asserting the switching control signal 101 in the first half of one clock cycle, the values of the signals 109, 110, and 111 inputted to and outputted from the ALU1 and the circuit state in the arithmetic unit 3C are changed over to the switching data. The value is determined by the signal 102. The actual calculation is executed by negating the switching control signal 101 in the second half of one clock cycle. After the calculation is completed, by asserting the switching control signal 101 again, the values of the signals 109, 110, and 111 input / output to / from the ALU1 become values determined by the switching data signal 102, and become values unrelated to the executed calculation. As a result, the Hamming weight of the input / output data of ALU1 becomes independent of the Hamming distance of the input / output data of ALU1. For this reason, the resistance against the power analysis attack using the Hamming weight of the input / output data of the ALU1 as the selection function is improved, and the resistance against the power analysis attack using the Hamming distance of the register value before and after the update is also improved. Furthermore, since the output of the switching data signal and the arithmetic processing are performed during one clock cycle, it is not necessary to provide an extra clock cycle for outputting the switching data signal.

ただし、実施の形態5の場合には、クロック周波数に対する制限が図9の場合よりも厳しくなる。すなわち、セキュアモードでは、クロック信号112が「0」(Lレベル)になって初めて実際の演算処理が始まるが、次のクロック信号112の立上がりまでに演算処理を完了する必要がある。このため、クロック信号112が「0」である期間T2は、演算処理時間に対応する遅延時間Tdよりも長くする必要がある(すなわち、Td<T2)。一方、非セキュアモードでは、Td<T2を満たす必要はなく、Td<T1+T2=Tcでよい(ただし、クロック信号112が「1」である期間をT1とし、クロック周期をTcとする)。この結果、非セキュアモードの場合は、セキュアモードの場合よりもT2を小さくすることができる。したがって、秘密情報が漏洩する可能性がないプログラムを実行する際は、非セキュアモードに設定することで、CPUのクロック周波数を向上させることができる。なお、ソフトウェア制御によってクロック周波数を制御する機能は、既存の多くのCPUが備えている機能である。   However, in the case of the fifth embodiment, the restriction on the clock frequency is stricter than in the case of FIG. That is, in the secure mode, the actual arithmetic processing starts only after the clock signal 112 becomes “0” (L level), but the arithmetic processing needs to be completed before the next rising of the clock signal 112. Therefore, the period T2 in which the clock signal 112 is “0” needs to be longer than the delay time Td corresponding to the calculation processing time (that is, Td <T2). On the other hand, in the non-secure mode, it is not necessary to satisfy Td <T2, and Td <T1 + T2 = Tc may be satisfied (however, a period in which the clock signal 112 is “1” is T1 and a clock cycle is Tc). As a result, in the non-secure mode, T2 can be made smaller than in the secure mode. Therefore, when executing a program with no possibility of leakage of secret information, the CPU clock frequency can be improved by setting the non-secure mode. The function of controlling the clock frequency by software control is a function provided in many existing CPUs.

図16は、図14(A)に示すクロックバッファ17の変形例を示すブロック図である。図16に示すクロックバッファ17Aは、D−フリップフロップ61と、インバータ63とを含む。D−フリップフロップ61のクロック端子CKには、図13の演算装置3Cが使用するクロック信号の2倍の周波数を有するクロック信号120が供給される。D−フリップフロップ61の出力端子Qはインバータ63を介してD−フリップフロップ61のデータ端子Dに接続される。D−フリップフロップ61のデータ端子Dから出力される信号が切替制御信号101である。   FIG. 16 is a block diagram showing a modification of the clock buffer 17 shown in FIG. A clock buffer 17 </ b> A illustrated in FIG. 16 includes a D-flip flop 61 and an inverter 63. A clock signal 120 having a frequency twice that of the clock signal used by the arithmetic unit 3C of FIG. 13 is supplied to the clock terminal CK of the D flip-flop 61. The output terminal Q of the D flip-flop 61 is connected to the data terminal D of the D flip-flop 61 through the inverter 63. A signal output from the data terminal D of the D flip-flop 61 is the switching control signal 101.

図17は、図13に示すCPU10Cの変形例としてのCPU10Dの構成を示すブロック図である。図17のCPU10Dは、モード設定用レジスタ16に代えて、命令デコーダ5Bが動作モードを指定するモード設定信号116をANDゲート18に出力する点で、図13のCU10Cと異なる。図17の演算装置3Bにはモード設定用レジスタ16が設けられておらず、演算装置3Bの構成は図12の場合と同じである。   FIG. 17 is a block diagram showing a configuration of a CPU 10D as a modification of the CPU 10C shown in FIG. The CPU 10D of FIG. 17 differs from the CU 10C of FIG. 13 in that the instruction decoder 5B outputs a mode setting signal 116 for designating an operation mode to the AND gate 18 instead of the mode setting register 16. The arithmetic device 3B of FIG. 17 is not provided with the mode setting register 16, and the configuration of the arithmetic device 3B is the same as that of FIG.

図17において、命令デコーダ5Bは、命令レジスタ4から読み込んだ命令が演算装置3Bを使用して演算を行なう演算命令である場合には、この演算命令を実行している間、セキュアモードを指定するモード設定信号116(「1」:Hレベル)をANDゲート18に出力する。命令デコーダ5Bは、演算命令の実行が完了した後に、非セキュアモードを指定するモード設定信号116(「0」:Lレベル)をANDゲート18に出力する。   In FIG. 17, when the instruction read from the instruction register 4 is an arithmetic instruction for performing an arithmetic operation using the arithmetic device 3B, the instruction decoder 5B designates the secure mode while executing the arithmetic instruction. The mode setting signal 116 (“1”: H level) is output to the AND gate 18. The instruction decoder 5B outputs a mode setting signal 116 (“0”: L level) designating the non-secure mode to the AND gate 18 after the execution of the operation instruction is completed.

図17に示すCPU10Dのその他の点は、図13に示すCPU10Cと同じであるので、同一または相当する部分には同一の参照符号を付して説明を繰返さない。   The other points of CPU 10D shown in FIG. 17 are the same as those of CPU 10C shown in FIG. 13. Therefore, the same or corresponding parts are denoted by the same reference numerals, and description thereof will not be repeated.

今回開示された各実施の形態はすべての点で例示であって制限的なものでないと考えられるべきである。たとえば、上記の実施の形態2〜5において、切替制御信号101および切替データ信号102の種々の生成方法を示したが、これらの信号の生成方法は、実施の形態2〜5に示した生成方法に限定されるものでない。この発明の範囲は上記した説明ではなくて請求の範囲によって示され、請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。   Each embodiment disclosed this time should be considered as illustrative in all points and not restrictive. For example, in the above second to fifth embodiments, various generation methods of the switching control signal 101 and the switching data signal 102 have been described. The generation methods of these signals are the generation methods described in the second to fifth embodiments. It is not limited to. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.

1 算術論理演算ユニット(ALU)、2,2A,2B,2C レジスタ群、3,3A,3B,3C 演算装置、5,5A,5B 命令デコーダ、7 切替データ信号生成部、14 専用レジスタ、15 シフトレジスタ、16 モード設定用レジスタ、31,35,38,42,45,46,52 セレクタ、101 切替制御信号、102 切替データ信号、109,110 入力データ、111 演算結果、112 クロック信号、115,116 モード設定信号。   1 arithmetic logic unit (ALU), 2, 2A, 2B, 2C register group, 3, 3A, 3B, 3C arithmetic unit, 5, 5A, 5B instruction decoder, 7 switching data signal generator, 14 dedicated register, 15 shift Register, 16 mode setting register, 31, 35, 38, 42, 45, 46, 52 selector, 101 switching control signal, 102 switching data signal, 109, 110 input data, 111 operation result, 112 clock signal, 115, 116 Mode setting signal.

Claims (10)

記憶部と、
前記記憶部から受けた1または複数のソースデータを用いて算術演算または論理演算を行なう演算部とを備え、
前記記憶部および前記演算部の各々は、活性状態または非活性状態になる切替制御信号と、時間的に変化するとともに前記1または複数のソースデータとは無関係なデータ信号とを受け、
前記記憶部は、前記切替制御信号が非活性化されたことに応答して前記1または複数のソースデータを前記演算部に出力し、前記切替制御信号が活性化されたことに応答して前記無関係なデータ信号に基づく1または複数のデータを前記演算部に出力し、
前記演算部は、前記切替制御信号が非活性化されたことに応答して前記1または複数のソースデータに対して算術演算または論理演算を行なった演算結果を出力し、前記切替制御信号が活性化されたことに応答して前記無関係なデータ信号に基づくデータを出力する、演算装置。
A storage unit;
An arithmetic unit that performs an arithmetic operation or a logical operation using one or more source data received from the storage unit,
Each of the storage unit and the calculation unit receives a switching control signal that is in an active state or an inactive state, and a data signal that changes over time and is unrelated to the one or more source data,
The storage unit outputs the one or more source data to the arithmetic unit in response to the switching control signal being deactivated, and the storage unit is in response to the switching control signal being activated. Outputting one or more data based on an irrelevant data signal to the computing unit;
The operation unit outputs an operation result obtained by performing an arithmetic operation or a logical operation on the one or more source data in response to the switching control signal being deactivated, and the switching control signal is activated. A computing device that outputs data based on the irrelevant data signal in response to being converted.
前記無関係なデータ信号は、多ビットの信号であり、
前記記憶部および前記演算部の各々は、
各々が論理演算機能または記憶機能を有する複数の回路素子と、
前記複数の回路素子の少なくとも一部にそれぞれ対応する複数の選択回路とを含み、
前記複数の選択回路の各々は、対応する回路素子の出力信号、前記無関係なデータ信号のうち対応するビットの信号、および前記切替制御信号を受け、
前記複数の選択回路の各々は、前記切替制御信号が非活性化されたことに応答して前記対応する回路素子の出力信号を出力し、前記切替制御信号が活性化されたことに応答して前記対応するビットの信号を出力する、請求項1に記載の演算装置。
The unrelated data signal is a multi-bit signal,
Each of the storage unit and the calculation unit is
A plurality of circuit elements each having a logical operation function or a storage function;
A plurality of selection circuits respectively corresponding to at least a part of the plurality of circuit elements,
Each of the plurality of selection circuits receives an output signal of a corresponding circuit element, a signal of a corresponding bit among the irrelevant data signal, and the switching control signal,
Each of the plurality of selection circuits outputs an output signal of the corresponding circuit element in response to the switching control signal being deactivated, and in response to the switching control signal being activated. The arithmetic unit according to claim 1, wherein a signal of the corresponding bit is output.
論理演算機能または記憶機能を有する回路素子を複数備え、
複数の前記回路素子のうち少なくとも一部の回路素子の各々は、
1または複数の第1の入力ノードと、
前記1または複数の第1の入力ノードから入力される1または複数の信号と異なる信号を受ける第2の入力ノードと、
出力ノードと、
前記出力ノードから出力する信号を切替えるための切替制御信号を受ける第3の入力ノードとを含み、
前記一部の回路素子の各々は、前記切替制御信号が非活性化されたことに応答して、前記1または複数の第1の入力ノードから入力された1または複数の信号を論理演算することによって得られる信号、または内部に記憶したデータに応じた信号を前記出力ノードから出力し、
前記一部の回路素子の各々は、前記切替制御信号が活性化されたことに応答して、前記第2の入力ノードから入力された信号に応じた信号を前記出力ノードから出力する、演算装置。
A plurality of circuit elements having a logical operation function or a storage function are provided,
Each of at least some of the plurality of circuit elements is
One or more first input nodes;
A second input node receiving a signal different from the one or more signals input from the one or more first input nodes;
An output node;
A third input node that receives a switching control signal for switching a signal output from the output node;
Each of the circuit elements performs a logical operation on one or more signals input from the one or more first input nodes in response to the switching control signal being deactivated. Or a signal corresponding to the data stored inside is output from the output node,
Each of the partial circuit elements outputs a signal corresponding to a signal input from the second input node from the output node in response to activation of the switching control signal. .
請求項1または2に記載の演算装置と、
予め設定された複数の命令のいずれかを受け、受けた命令に応じた信号を前記演算装置に出力する命令デコーダとを備え、
前記複数の命令は、前記演算部に算術演算または論理演算を行なわせる演算命令を含む、中央処理装置(CPU)。
The arithmetic device according to claim 1 or 2,
An instruction decoder that receives any of a plurality of preset instructions and outputs a signal corresponding to the received instruction to the arithmetic unit;
The plurality of instructions includes a central processing unit (CPU) including an operation instruction for causing the operation unit to perform an arithmetic operation or a logical operation.
前記中央処理装置は、前記記憶部の内部または外部に設けられ、前記無関係なデータ信号に対応するデータを格納する第1のレジスタをさらに備え、
前記第1のレジスタに格納されるデータは、プログラムで設定可能である、請求項4に記載の中央処理装置。
The central processing unit further includes a first register that is provided inside or outside the storage unit and stores data corresponding to the irrelevant data signal,
The central processing unit according to claim 4, wherein the data stored in the first register can be set by a program.
前記中央処理装置は、前記記憶部の内部または外部に設けられ、前記無関係なデータ信号に対応するデータを格納するシフトレジスタをさらに備え、
前記無関係なデータ信号は、前記シフトレジスタがシフトすることによって変化する、請求項4に記載の中央処理装置。
The central processing unit further includes a shift register that is provided inside or outside the storage unit and stores data corresponding to the irrelevant data signal,
The central processing unit according to claim 4, wherein the irrelevant data signal changes as the shift register shifts.
前記複数の命令は、前記切替制御信号を活性化するための切替命令を含み、
前記命令デコーダは、前記切替制御信号を前記演算装置に出力し、前記切替命令を受けた場合に前記切替制御信号を活性化する、請求項4に記載の中央処理装置。
The plurality of instructions include a switching instruction for activating the switching control signal,
The central processing unit according to claim 4, wherein the instruction decoder outputs the switching control signal to the arithmetic unit and activates the switching control signal when the switching instruction is received.
前記中央処理装置は、第1および第2の動作モードを有し、
前記中央処理装置は、クロック信号と前記第1および第2の動作モードのいずれかに設定するためのモード設定信号とを受け、前記クロック信号および前記モード設定信号に基づいて前記切替制御信号を生成する切替制御信号生成部をさらに備え、
前記記憶部は、前記クロック信号の第1のエッジに応答して、前記演算部の演算結果を格納し、
前記切替制御信号生成部は、前記第1の動作モードの場合に、前記クロック信号の前記第1のエッジに応答して前記切替制御信号を活性化し、前記クロック信号の第2のエッジに応答して前記切替制御信号を非活性化し、
前記切替制御信号生成部は、前記第2の動作モードの場合に、前記クロック信号によらず前記切替制御信号を非活性化する、請求項4に記載の中央処理装置。
The central processing unit has first and second operation modes;
The central processing unit receives a clock signal and a mode setting signal for setting one of the first and second operation modes, and generates the switching control signal based on the clock signal and the mode setting signal A switching control signal generation unit
The storage unit stores a calculation result of the calculation unit in response to a first edge of the clock signal,
The switching control signal generation unit activates the switching control signal in response to the first edge of the clock signal and responds to the second edge of the clock signal in the first operation mode. Deactivating the switching control signal,
The central processing unit according to claim 4, wherein the switching control signal generation unit deactivates the switching control signal regardless of the clock signal in the second operation mode.
前記中央処理装置は、前記記憶部の内部または外部に設けられ、前記モード設定信号に対応するデータを格納する第2のレジスタをさらに備え、
前記第2のレジスタに格納されたデータは、プログラムで設定可能である、請求項8に記載の中央処理装置。
The central processing unit further includes a second register that is provided inside or outside the storage unit and stores data corresponding to the mode setting signal,
9. The central processing unit according to claim 8, wherein the data stored in the second register can be set by a program.
前記命令デコーダは、前記演算装置が前記演算命令に従って演算を実行している間は、前記第1の動作モードを指定する前記モード設定信号を前記切替制御信号生成部に出力し、前記演算装置が前記複数の前記演算命令に従った演算の実行を完了した後は、前記第2の動作モードを指定する前記モード設定信号を前記切替制御信号生成部に出力する、請求項8に記載の中央処理装置。   The instruction decoder outputs the mode setting signal for designating the first operation mode to the switching control signal generation unit while the arithmetic device is executing an operation according to the arithmetic instruction, and the arithmetic device 9. The central processing according to claim 8, wherein after completing execution of the operations according to the plurality of the operation instructions, the mode setting signal designating the second operation mode is output to the switching control signal generation unit. apparatus.
JP2010105648A 2010-04-30 2010-04-30 Operation device and central processing unit Withdrawn JP2011234312A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010105648A JP2011234312A (en) 2010-04-30 2010-04-30 Operation device and central processing unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010105648A JP2011234312A (en) 2010-04-30 2010-04-30 Operation device and central processing unit

Publications (1)

Publication Number Publication Date
JP2011234312A true JP2011234312A (en) 2011-11-17

Family

ID=45323126

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010105648A Withdrawn JP2011234312A (en) 2010-04-30 2010-04-30 Operation device and central processing unit

Country Status (1)

Country Link
JP (1) JP2011234312A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014049891A (en) * 2012-08-30 2014-03-17 Renesas Electronics Corp Central processing unit and arithmetic unit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014049891A (en) * 2012-08-30 2014-03-17 Renesas Electronics Corp Central processing unit and arithmetic unit
US10223110B2 (en) 2012-08-30 2019-03-05 Renesas Electronics Corporation Central processing unit and arithmetic unit

Similar Documents

Publication Publication Date Title
Sokolov et al. Design and analysis of dual-rail circuits for security applications
US8861720B2 (en) Tamper-resistant memory integrated circuit and encryption circuit using same
Saputra et al. Masking the energy behavior of DES encryption [smart cards]
Cilio et al. Mitigating power-and timing-based side-channel attacks using dual-spacer dual-rail delay-insensitive asynchronous logic
JP5926655B2 (en) Central processing unit and arithmetic unit
JP2015527642A (en) Computer processor and system without arithmetic and logic units
Bayrak et al. An EDA-friendly protection scheme against side-channel attacks
Järvinen et al. A generalization of addition chains and fast inversions in binary fields
Antognazza et al. Metis: An integrated morphing engine CPU to protect against side channel attacks
JP2015095786A (en) Logic circuit, logic circuit layout support device, logic circuit layout support method and program
JP2011234312A (en) Operation device and central processing unit
Dhanuskodi et al. Energy optimization of unrolled block ciphers using combinational checkpointing
Plana et al. SPA—A secure amulet core for smartcard applications
Teegarden et al. Side-channel attack resistant ROM-based AES S-Box
Tillich et al. Implementation and evaluation of an SCA-resistant embedded processor
Ghavami et al. An EDA tool for implementation of low power and secure crypto-chips
IT202000013390A1 (en) An IT platform to prevent side channel attacks
KR20020079144A (en) Apparatus and Method of Polynomial-Basis Multiplication based on Finite-Field
Casu Improving synchronous elastic circuits: Token cages and half-buffer retiming
Zarrinchian et al. Combinational counters: A low overhead approach to address DPA attacks
Thoonen Hardening FPGA-based AES implementations against side channel attacks based on power analysis
Dhanuskodi et al. Techniques to reduce switching and leakage energy in unrolled block ciphers
Saputra et al. Masking the energy behaviour of encryption algorithms
RU2644505C1 (en) Special processor for boolean satisfiability task
Susithra et al. FPGA-based Realization of Processor Unit with Key-Based Logical Obfuscation

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20130702