JP5387291B2 - Arithmetic program, arithmetic method, and arithmetic device - Google Patents
Arithmetic program, arithmetic method, and arithmetic device Download PDFInfo
- Publication number
- JP5387291B2 JP5387291B2 JP2009223883A JP2009223883A JP5387291B2 JP 5387291 B2 JP5387291 B2 JP 5387291B2 JP 2009223883 A JP2009223883 A JP 2009223883A JP 2009223883 A JP2009223883 A JP 2009223883A JP 5387291 B2 JP5387291 B2 JP 5387291B2
- Authority
- JP
- Japan
- Prior art keywords
- calculation
- bits
- processing
- bit string
- window
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、演算処理を実行する演算プログラム、演算方法、および演算装置に関する。 The present invention relates to an arithmetic program, an arithmetic method, and an arithmetic device that execute arithmetic processing.
携帯電話、車載器、ハードディスク装置などの組み込み機器が、搭載しているCPU(Central Processing Unit)は、PC(Personal Computer)に搭載しているCPUに比べて、処理能力が低い。また、メモリ搭載量も低いのが一般的である。さらに、組み込み機器では、タスクが異常停止していないかを確認するために、一定時間ごとにOS(Operating System)等の制御部に応答することでタスクの生存確認を行うことがある。応答先としては、装置内の制御部の他、ネットワーク経由による他の装置へ応答することもある。 A CPU (Central Processing Unit) installed in an embedded device such as a mobile phone, an in-vehicle device, or a hard disk device has a lower processing capacity than a CPU installed in a PC (Personal Computer). Also, the amount of memory mounted is generally low. Furthermore, in an embedded device, in order to confirm whether a task has stopped abnormally, the existence of the task may be confirmed by responding to a control unit such as an OS (Operating System) at regular intervals. As a response destination, in addition to a control unit in the apparatus, there is a case of responding to another apparatus via a network.
一方、情報セキュリティ分野で使用されるRSA(Rivest−Shamir−Adleman)暗号処理は、演算負荷が大きく、処理能力の低い組み込み機器のCPUでは、CPUを占有する時間が長くなり、CPUは、一定時間以内にRSA暗号処理を終了することができない可能性がある。一定時間以内に処理を終了できない場合、RSA暗号処理を実行しているタスクは制御部に応答をすることができずに、制御部はタスクが異常停止していると誤認識をする結果となる。御認識を防ぐためには、RSA暗号処理を途中で中断し、制御部に応答を行った後、RSA暗号処理を再開することが必要となる。 On the other hand, RSA (Rivest-Shamir-Adleman) encryption processing used in the field of information security has a large calculation load, and the CPU of an embedded device with a low processing capacity takes a long time to occupy the CPU. May not be able to finish the RSA encryption process within. If the process cannot be completed within a certain time, the task executing the RSA encryption process cannot respond to the control unit, and the control unit misrecognizes that the task is abnormally stopped. . In order to prevent the recognition, it is necessary to interrupt the RSA encryption process halfway and to respond to the control unit, and then restart the RSA encryption process.
前述した、RSA暗号処理を分割する課題に関しては、RSA暗号処理のほとんどを構成しているべき乗剰余演算処理を所定の部分乗算に分割して実行する技術が開示されている(たとえば、下記特許文献1を参照。)。また、べき乗剰余演算の高速化方法であるモンゴメリ乗算剰余演算処理において、複数回に分割して実行する技術が開示されている(たとえば、下記特許文献2を参照。)。
Regarding the above-described problem of dividing the RSA encryption process, a technique is disclosed in which the modular multiplication process that should constitute most of the RSA encryption process is divided into predetermined partial multiplications (for example, the following patent documents) 1). In addition, a technique is disclosed in which Montgomery multiplication remainder calculation processing, which is a method for speeding up the modular exponentiation, is executed by being divided into a plurality of times (for example, see
しかしながら、上述した従来技術において、RSA暗号処理を分割する際に、分割した各RSA暗号分割処理が同一の長さになるような均等分割を行っていた。このため、CPUに空き時間が生じ、無駄な時間が存在しているという問題があった。 However, in the above-described prior art, when the RSA encryption process is divided, equal division is performed so that each divided RSA encryption division process has the same length. For this reason, there is a problem that idle time is generated in the CPU and there is wasted time.
また、部分乗算を行う際に、事前の前処理として、ある一定範囲のべきに対し、べき乗剰余演算結果を格納する事前計算テーブルの生成処理を行い、事前計算テーブルを参照する場合がある。しかしながら、事前計算テーブルの大きさは常に固定サイズであり、固定の事前計算テーブルを参照したべき乗剰余演算処理を、CPUの空き時間内に行った場合、空き時間をすべて使いきれるとは限らず、空き時間が残る場合があるという問題があった。 In addition, when performing partial multiplication, as a pre-processing in advance, there is a case where a pre-calculation table for storing a power residue calculation result is generated for a certain range of power, and the pre-calculation table is referred to. However, the size of the pre-computation table is always a fixed size, and if the remainder calculation process that should refer to the fixed pre-computation table is performed within the free time of the CPU, not all of the free time can be used, There was a problem that free time might remain.
本発明は、上述した従来技術による問題点を解消するため、CPUの空き時間にあわせてRSA暗号処理を非均等に分割し、処理効率の向上を図ることができる演算プログラム、演算方法、および演算装置を提供することを目的とする。 In order to solve the above-described problems due to the prior art, the present invention can divide RSA encryption processing non-uniformly according to CPU idle time and improve processing efficiency, an arithmetic method, and an arithmetic operation. An object is to provide an apparatus.
上述した課題を解決し、目的を達成するため、本演算プログラム、演算方法、および演算装置は、CPUの空き時間を検出し、空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における乗算剰余演算処理の利用回数とに基づいて、空き時間内に処理可能なビット数を算出し、算出された処理可能なビット数に基づいて、対象データからビット列を抽出し、抽出されたビット列を与えて、所定の部分演算処理を実行することを要件とする。 In order to solve the above-described problems and achieve the object, the present calculation program, calculation method, and calculation apparatus detect the CPU idle time and process required for the multiplication remainder calculation process that constitutes the idle time and the exponentiation remainder calculation process The number of bits that can be processed within the free time is calculated based on the time and the number of times of use of the modular multiplication operation in the predetermined partial operation processing, and the bit string is calculated from the target data based on the calculated number of bits that can be processed. It is necessary to perform extraction and give an extracted bit string to execute a predetermined partial operation process.
本演算プログラム、演算方法、および演算装置によれば、CPUの空き時間にあわせてRSA暗号処理を非均等に分割し、処理効率の向上を図ることができるという効果を奏する。 According to the calculation program, the calculation method, and the calculation device, there is an effect that the RSA encryption processing is divided non-uniformly in accordance with the CPU idle time, and the processing efficiency can be improved.
以下に添付図面を参照して、本発明にかかる演算プログラム、演算方法、および演算装置の好適な実施の形態を詳細に説明する。 Exemplary embodiments of a calculation program, a calculation method, and a calculation device according to the present invention will be described below in detail with reference to the accompanying drawings.
(実施の形態1)
(演算装置100のハードウェア構成)
図1は、実施の形態1にかかる演算装置のハードウェア構成を示すブロック図である。図1において、演算装置100は、CPU101と、ROM(Read‐Only Memory)102と、RAM(Random Access Memory)103と、磁気ディスクドライブ104と、磁気ディスク105と、光ディスクドライブ106と、光ディスク107と、ディスプレイ108と、I/F(Interface)109と、キーボード110と、マウス111と、スキャナ112と、プリンタ113と、を備えている。また、各構成部はバス114によってそれぞれ接続されている。
(Embodiment 1)
(Hardware configuration of arithmetic device 100)
FIG. 1 is a block diagram of a hardware configuration of the arithmetic device according to the first embodiment. In FIG. 1, a
ここで、CPU101は、演算装置100の全体の制御を司る。CPU以外にも、リアルタイム処理を求められる組み込み機器で使用されるDSP(Digital Signal Processor)であってもよい。
Here, the
ROM102は、ブートプログラムなどのプログラムを記憶している。RAM103は、CPU101のワークエリアとして使用される。磁気ディスクドライブ104は、CPU101の制御にしたがって磁気ディスク105に対するデータのリード/ライトを制御する。磁気ディスク105は、磁気ディスクドライブ104の制御で書き込まれたデータを記憶する。また、演算装置100の小型化を目的として、磁気ディスク105の代わりにFlash ROMを使用してもよい。
The
光ディスクドライブ106は、CPU101の制御にしたがって光ディスク107に対するデータのリード/ライトを制御する。光ディスク107は、光ディスクドライブ106の制御で書き込まれたデータを記憶したり、光ディスク107に記憶されたデータをコンピュータに読み取らせたりする。
The
ディスプレイ108は、カーソル、アイコンあるいはツールボックスをはじめ、文書、画像、機能情報などのデータを表示する。このディスプレイ108は、たとえば、CRT、TFT液晶ディスプレイ、プラズマディスプレイなどを採用することができる。
The
I/F109は、通信回線を通じてLAN(Local Area Network)、WAN(Wide Area Network)、インターネットなどのネットワーク115に接続され、このネットワーク115を介して他の装置に接続される。そして、I/F109は、ネットワーク115と内部のインターフェースを司り、外部装置からのデータの入出力を制御する。I/F109には、たとえばモデムやLANアダプタなどを採用することができる。
The I / F 109 is connected to a
キーボード110は、文字、数字、各種指示などの入力のためのキーを備え、データの入力を行う。また、タッチパネル式の入力パッドやテンキーなどであってもよい。マウス111は、カーソルの移動や範囲選択、あるいはウィンドウの移動やサイズの変更などを行う。ポインティングデバイスとして同様に機能を備えるものであれば、トラックボールやジョイスティックなどであってもよい。
The
スキャナ112は、画像を光学的に読み取り、演算装置100内に画像データを取り込む。なお、スキャナ112は、OCR(Optical Character Reader)機能を持たせてもよい。また、プリンタ113は、画像データや文書データを印刷する。プリンタ113には、たとえば、レーザプリンタやインクジェットプリンタを採用することができる。なお、組み込み機器環境においては、磁気ディスクドライブ104、磁気ディスク105、光ディスクドライブ106、光ディスク107、ディスプレイ108、I/F109、キーボード110、マウス111、スキャナ112、プリンタ113、ネットワーク115の一部、またはすべてが存在しない構成であってもよい。
The scanner 112 optically reads an image and takes in the image data into the
(演算装置100の機能的構成)
次に、演算装置100の機能的構成について説明する。図2は、演算装置100の機能的構成を示すブロック図である。演算装置100は、制御部201と、処理コントロール部202と、受信部203と、演算部204と、タイマー205と、空き時間計算部206と、リファレンス所要時間格納テーブル207と、処理時間取得部208と、を含む構成である。この制御部となる機能(制御部201〜処理時間取得部208)は、具体的には、たとえば、図1に示したROM102、RAM103、磁気ディスク105、光ディスク107などの記憶装置に記憶されたプログラムをCPU101が実行することにより、その機能を実現する。または、I/F109を経由して他のCPUが実行することにより、その機能を実現してもよい。
(Functional configuration of arithmetic device 100)
Next, a functional configuration of the
制御部201は、演算装置の制御を行うOSであり、演算部204を含む、すべてのタスクを実行するために、処理コントロール部202に処理を命令する機能を有する。具体的には、たとえば、制御部201は、処理コントロール部202がタスクAを実行終了後に、タスクBを実行するように処理コントロール部202に命令する。
The
処理コントロール部202は、制御部201からの命令にしたがって、タスクを実行する機能を有する。また、演算部204以外のタスクを実行後、OSに応答を返すまでの空き時間を空き時間計算部206より取得する。具体的には、たとえば、OSに応答を返す周期が30[msec](ミリ秒)の場合に、CPU101が他のタスクを10[msec]実行した場合、処理コントロール部202は空き時間として20[msec]を取得する。なお、取得結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
受信部203は、べき乗剰余演算処理が行われる被対象データを受信する機能を有する。具体的には、たとえば、暗号化を行う場合には、被対象データは平文であり、また、べき乗剰余演算処理の指数部分にあたる対象データとして、公開鍵の情報もあわせて受信する。なお、受信結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The receiving
演算部204は、処理コントロール部202によって実行される機能の一つであり、RSA暗号処理でのべき乗剰余演算処理を行う機能を有する。具体的には、たとえば、暗号文=平文^公開鍵(modN)というべき乗剰余演算処理を行うことで、平文から暗号文を生成する。また、平文=暗号文^暗号鍵(modN)というべき乗剰余演算処理を行うことで、暗号文から平文を生成する。演算部204の内部の詳細は後述する。なお、演算結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
タイマー205は、CPU101に対して一定間隔で割り込みを発生させる機能を有する。具体的には、たとえば、タイマー205により割り込みが発生した際に、制御部201で管理しているカウンタを増加することで、内部時刻を更新する。カウンタは、たとえば、CPU101が保持しているレジスタに記憶される。
The
空き時間計算部206は、タイマー205の内部時刻から空き時間を計算する機能を有する。具体的には、たとえば、次にOSに応答を返す時刻から、現在時刻を引くことで、空き時間を求めることができる。なお、計算結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The free
リファレンス所要時間格納テーブル207は、乗算剰余演算処理にかかる時間を事前に計算、もしくは計測し、格納しておく領域である。乗算剰余演算処理は、べき乗剰余演算処理の高速化方法であるモンゴメリ乗算剰余演算処理であってもよい。具体的には、たとえば、平文を暗号文にする場合、平文であるべき乗剰余演算処理の被対象データのビット長と、秘密鍵であるべき乗のビット長と、公開鍵であるモジュラスのビット長をインデックスとして、モンゴメリ乗算剰余演算処理にかかる時間を格納する。 The reference required time storage table 207 is an area in which the time required for the modular multiplication operation is calculated or measured in advance and stored. The multiplication residue calculation process may be a Montgomery multiplication residue calculation process, which is a method for speeding up the power residue calculation process. Specifically, for example, when plaintext is converted into ciphertext, the bit length of the data subject to the remainder calculation process that should be plaintext, the bit length of the power that should be the secret key, and the bit length of the modulus that is the public key As an index, the time required for Montgomery multiplication remainder calculation processing is stored.
また、処理方式がCRT(Chinese Remainder Theorem)もしくは非CRTかもインデックスに含めてもよい。リファレンス所要時間格納テーブル207は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。または、事前計測した結果をROM102に保持しておいても良い。また、インデックスを持たず、1024ビットの乗算剰余演算処理の結果を保持しておき、利用時には暗黙的に1024ビットとして扱ってもよい。
Also, the index may include whether the processing method is CRT (Chinese Reminder Theorem) or non-CRT. The reference required time storage table 207 is stored in a storage area such as the
処理時間取得部208は、べき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間を取得する機能を有する。具体的には、たとえば、演算装置100は、リファレンス所要時間格納テーブル207から、べき乗剰余演算処理の被対象データのビット長と、べき乗のビット長と、モジュラスのビット長を指定することで、条件に当てはまる場合の処理時間を取得する。なお、取得結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The processing
次に、実施の形態1にかかる演算部204の機能詳細について説明する。演算部204は、検出部209と、算出部210と、抽出部211と、実行部212と、設定部213と、テーブル生成部214と、テーブル取得部215で構成される。
Next, functional details of the
検出部209は、べき乗剰余演算処理より優先度の高い処理を行うまでの空き時間を検出する機能を有する。具体的には、たとえば、他のタスクの処理が終わった時点で、次のOSに応答を返す時刻までの空き時間を、空き時間計算部206より検出する。なお、検出結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
算出部210は、乗算剰余演算処理に要する処理時間と、べき乗剰余演算処理の部分演算処理における乗算剰余演算処理の利用回数と、空き時間に基づいて、空き時間内で処理可能なビット数を算出する機能を有する。それぞれ、処理時間は処理時間取得部208から、空き時間は検出部209から検出する。部分演算処理とは、後述するバイナリ法、ウィンドウ法である。さらに、受信部203によって受信された対象データのビット列に基づいて、空き時間内で処理可能なビット数を算出してもよい。
The
部分演算処理でバイナリ法が実装されている場合、処理可能なビット数の算出式として、下記式(1)で算出してもよい。以下、この算出方式を「処理可能ビット数算出法1」と称する。実施の形態1では、処理可能ビット数算出法1を適用している。
When the binary method is implemented in the partial arithmetic processing, the following formula (1) may be used as a calculation formula for the number of bits that can be processed. Hereinafter, this calculation method is referred to as “processable bit
Kb=Floor((T/t−1)/2)…(1) Kb = Floor ((T / t-1) / 2) (1)
ただし、Kbは処理可能なビット数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を示す。 Here, Kb represents the number of bits that can be processed, Floor () represents the floor function, T represents the idle time, and t represents the processing time required for the modular multiplication operation.
部分演算処理でウィンドウ法が実装されている場合、処理可能なビット数の算出式として、下記式(2)で算出してもよい。以下、この算出方式を「処理可能ビット数算出法2」と称する。後述する実施の形態2では、処理可能ビット数算出法2を適用している。
When the window method is implemented in the partial arithmetic processing, the following formula (2) may be calculated as a calculation formula for the number of bits that can be processed. Hereinafter, this calculation method is referred to as “processable bit
Kb=Floor((T/t−2^n)/(n+1))*n…(2) Kb = Floor ((T / t−2 ^ n) / (n + 1)) * n (2)
ただし、Kbは処理可能なビット数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を、nはウィンドウ法にて、1度に処理を行う対象のビット数を示す。以下、ウィンドウ幅とする。 Where Kb is the number of bits that can be processed, Floor () is the floor function, T is the idle time, t is the processing time required for the modular multiplication operation, and n is the window method. Indicates the number of bits of interest. Hereinafter, the window width is used.
部分演算処理でバイナリ法が実装されている場合、空き時間内に乗算剰余演算処理の利用可能な回数である演算利用可能回数を下記式(3)にて求める。そして、対象ビットの値に応じて演算を実行した回数を加算することにより、演算を実行した回数が演算利用可能回数になるまで対象ビットを順次読み出し、読み出した対象ビットの数を処理可能なビット数として、算出してもよい。具体的には、対象ビットが0ならば回数を1加算し、対象ビットが1ならば回数を2加算する。以下、この算出方式を「処理可能ビット数算出法3」と称する。後述する実施の形態3では、処理可能ビット数算出法3を適用している。
When the binary method is implemented in the partial operation processing, the number of usable operations that is the number of times that the modular multiplication operation processing can be used within the vacant time is obtained by the following equation (3). Then, by adding the number of times the operation has been performed according to the value of the target bit, the target bit is sequentially read out until the number of times the operation has been performed reaches the number of usable operations, and the number of read target bits can be processed. It may be calculated as a number. Specifically, if the target bit is 0, the number of times is added by 1, and if the target bit is 1, the number of times is added by 2. Hereinafter, this calculation method is referred to as “processable bit
a=Floor(T/t−1)…(3) a = Floor (T / t-1) (3)
ただし、aは演算利用可能回数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を示す。 Here, “a” indicates the number of usable operations, “Floor ()” indicates the floor function, “T” indicates the idle time, and “t” indicates the processing time required for the modular multiplication operation processing.
バイナリ法では、対象ビットが0である場合は乗算剰余演算処理を1回行い、1である場合は乗算剰余演算処理を2回行う。したがって、対象ビットの値に沿って乗算剰余演算処理を行う回数を計算することで、処理可能なビット数を算出できる。 In the binary method, when the target bit is 0, the modular multiplication process is performed once, and when it is 1, the modular multiplication process is performed twice. Therefore, the number of bits that can be processed can be calculated by calculating the number of times of performing the modular multiplication operation along the value of the target bit.
部分演算処理でウィンドウ法が実装されている場合、空き時間内に乗算剰余演算処理の利用可能な回数である演算利用可能回数を下記式(4)にて求める。そして、ウィンドウ幅分のビット列が取り得るビットパターンに応じて演算を実行した回数を加算する。演算を実行した回数が演算利用可能回数になるまでビット列を順次読み出し、読み出したビット列を構成するビットの数を処理可能なビット数として、算出してもよい。具体的には、ビット列がすべて0ならば回数をウィンドウ幅分加算し、ビット列に1が含まれるならば回数をウィンドウ幅+1分加算する。以下、この算出方式を「処理可能ビット数算出法4」と称する。後述する実施の形態4では、処理可能ビット数算出法4を適用している。
When the window method is implemented in the partial operation processing, the number of usable operations, which is the number of times that the modular multiplication operation processing can be used within the free time, is obtained by the following equation (4). Then, the number of times of calculation is added according to the bit pattern that can be taken by the bit string corresponding to the window width. The bit string may be sequentially read out until the number of times that the calculation has been performed becomes the number of times the calculation can be used, and the number of bits constituting the read bit string may be calculated as the number of bits that can be processed. Specifically, if the bit strings are all 0, the number of times is added by the window width, and if the bit string contains 1 the number of times is added by the window width + 1. Hereinafter, this calculation method is referred to as “processable bit
a=Floor(T/t−2^n)…(4) a = Floor (T / t-2 ^ n) (4)
ただし、aは演算利用可能回数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を、nはウィンドウ幅を示す。 Here, “a” represents the number of usable operations, “Floor ()” represents the floor function, “T” represents the idle time, “t” represents the processing time required for the modular multiplication operation, and “n” represents the window width.
ウィンドウ法では、nビットのビット列がすべて0である場合は乗算剰余演算処理をn回行い、ビット列に1が含まれる場合は乗算剰余演算処理をn+1回行う。したがって、nビットのビット列の値に沿って乗算剰余演算処理を行う回数を計算することで、処理可能なビット数を算出できる。 In the window method, when the n-bit bit string is all 0, the modular multiplication process is performed n times, and when the bit string includes 1 the modular multiplication process is performed n + 1 times. Therefore, the number of bits that can be processed can be calculated by calculating the number of times of performing the modular multiplication operation along the value of the n-bit bit string.
また、実施の形態2または4でのウィンドウ幅nについて、取り得るウィンドウ幅ごとに対して処理可能なビット数を算出し、後述する抽出部211にて、最長となるビット数を抽出し、後述する実行部212で実行してもよい。また、算出時に後述する設定部213にて設定されたテーブルの生成時間を含めて算出してもよい。
For the window width n in the second or fourth embodiment, the number of bits that can be processed is calculated for each possible window width, and the
また、実施の形態1〜4を同時に複数持つ形態でもよい。具体的には、たとえば、実施の形態1であるバイナリ法と実施の形態2であるバイナリ法を同時に持ち、それぞれ処理可能なビット数を算出する。そして、処理可能なビット数が最大となる部分演算処理と処理可能なビット数を使用してもよい。 Moreover, the form which has multiple Embodiment 1-4 simultaneously may be sufficient. Specifically, for example, the binary method according to the first embodiment and the binary method according to the second embodiment are simultaneously provided, and the number of bits that can be processed is calculated. Then, a partial calculation process that maximizes the number of bits that can be processed and the number of bits that can be processed may be used.
算出の具体例として、たとえば、実施の形態1にて、乗算剰余演算処理に要する処理時間が0.1[msec]、部分演算処理がバイナリ法、空き時間が20[msec]の場合を考える。バイナリ法における乗算剰余演算処理の利用回数は1ビットに対して2回である。前述の条件では、後述する式1を使用することにより、Kb=Floor((20/0.1−1)/2)により、空き時間内に99ビット処理可能であることが算出できる。なお、算出結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
As a specific example of the calculation, for example, consider a case where the processing time required for the modular multiplication operation is 0.1 [msec], the partial operation processing is the binary method, and the free time is 20 [msec] in the first embodiment. The number of times of use of the modular multiplication operation in the binary method is twice for one bit. Under the above-described conditions, it is possible to calculate that 99 bits can be processed in the free time by using Kb = Floor ((20 / 0.1-1) / 2) by using
抽出部211は、受信部203によって受信された対象データから算出部210によって算出されたビット数分のビット列を抽出する機能を有する。また、部分演算処理を開始する開始ビット位置を記憶装置から読み出し、対象データの開始ビット位置から、算出されたビット数分のビット列を抽出する。その後、次の算出時のために、開始ビット位置と算出されたビット数分に基づいて、新たな開始ビット位置を求め、開始ビット位置として記憶装置に格納してもよい。
The
具体的には、たとえば、算出部210によって99ビット処理可能であるという算出結果を受けとったら、抽出部211は、対象データの先頭もしくは記憶装置に格納されている開始ビット位置から99ビット分のビット列を抽出する。なお、算出結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
Specifically, for example, when the
実行部212は、抽出部211によって抽出されたビット列に対して、部分演算処理を実行する機能を有する。具体的には、たとえば、実施の形態1または3では、バイナリ法を実行する。また、実施の形態2または4では、ウィンドウ法を実行する。バイナリ法の概要説明は図4にて、ウィンドウ法の概要説明は図6にて後述する。
The
設定部213は、部分演算処理がウィンドウ法の場合に、ウィンドウ幅ごとに、後述するテーブル生成部214で生成するテーブルの作成時間を、処理時間取得部208を用いて設定する機能を有する。具体的には、たとえば、ウィンドウ幅が2ならば、テーブルの作成時間は、2^2×(乗算剰余演算処理)と設定できる。なお、設定結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
テーブル生成部214は、部分演算処理がウィンドウ法の場合に、事前に行う処理として、べき乗剰余演算処理が行われる被対象データをウィンドウ幅のビット列が取り得るビットパターンごとにべき乗剰余した値を格納するテーブルを生成する機能を有する。具体的には、たとえば、ウィンドウ幅が4ビットで、被対象データがX、モジュラスがZの場合、X^0(modZ)、X^1(modZ)、・・・、X^15(modZ)の値を求め、テーブルに格納する。なお、生成結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
テーブル取得部215は、部分演算処理がウィンドウ法の場合に、テーブル生成部214によって生成されたテーブルから、ビットパターンに基づいて、被対象データをビットパターンにてべき乗剰余した値を取得する機能を有する。具体的には、たとえば、ウィンドウ幅が4ビットで、被対象データがX、モジュラスがZの場合に、ウィンドウ内のビットパターンが9である場合は、テーブルに格納されているX^9(modZ)の値を取得する。なお、取得結果は、RAM103、磁気ディスク105、光ディスク107などの記憶領域に記憶される。
The
以上の機器、機能を使用して、演算装置100はべき乗剰余演算処理を行う。次に、従来例と実施の形態1による実行状態を示す。
Using the above devices and functions, the
(実施の形態1の概要説明)
図3は、従来例と実施の形態1による実行状態を示す図である。前提条件として、10[msec]ごとにOSに対して応答を返す。従来例での実行状態301では、別タスクを実行した後に、分割されたRSA暗号処理が行われている状態を示している。RSA暗号処理を均等に分割する場合、一番空き時間が短い10〜20[msec]の区間にあわせるため、他の区間、たとえば、0〜10[msec]の区間で空き時間303、20〜30[msec]の区間で空き時間304が発生してしまう。
(Overview of Embodiment 1)
FIG. 3 is a diagram showing an execution state according to the conventional example and the first embodiment. As a precondition, a response is returned to the OS every 10 [msec]. The execution state 301 in the conventional example shows a state in which a divided RSA encryption process is performed after another task is executed. In the case of equally dividing the RSA encryption process, the free time 303, 20-30 in other intervals, for example, 0-10 [msec], in order to match the interval of 10-20 [msec] with the shortest free time. Free time 304 occurs in the [msec] section.
実施の形態1では、RSA暗号処理をそれぞれの空き時間を動的に計算して処理分割し、効率的にCPUを利用する。実施の形態1での実行状態302では、RSA暗号処理は、0〜10[msec]の区間では部分演算処理305、10〜20[msec]の区間では部分演算処理306、20〜30[msec]の区間では部分演算処理307といった状態に非均等分割される。
In the first embodiment, the RSA encryption processing is divided into processes by dynamically calculating each idle time and efficiently using the CPU. In the execution state 302 according to the first embodiment, the RSA encryption processing is performed in the partial arithmetic processing 305 in the interval of 0 to 10 [msec], and in the partial
図4は、バイナリ法の概要説明を示す図である。実施の形態1では、部分演算処理にバイナリ法が実装されている。バイナリ法はべき乗部分を2進数表現し、得られたビット列に対して1ビットごとにべき乗剰余演算処理を行う方法である。平文X、公開鍵d、モジュラスZ、があるときに、求める暗号文Yは、Y=X^d(modZ)で表すことができる。 FIG. 4 is a diagram showing an overview of the binary method. In the first embodiment, the binary method is implemented in the partial arithmetic processing. The binary method is a method in which a power part is expressed in a binary number, and a power-residue calculation process is performed for each bit on the obtained bit string. When there is a plaintext X, a public key d, and a modulus Z, a ciphertext Y to be obtained can be expressed as Y = X ^ d (modZ).
ここで、d=21としてバイナリ法の具体例を示す。d=21を2進数表記すると(10101)となり、式401が得られる。式401において、符号402,403,405,406は2乗算をあらわし、符号404,407は乗算をあらわす。これら符号402〜407で示した乗算および2乗算は、d=21の2進数表記(10101)の各ビットに対応している。符号402の2乗算は2進数表記(10101)の最上位から2番目のビットである0が対応している。以下、順に、符号403の2乗算と符号404の乗算は、最上位から3番目のビットである1が対応している。符号405の2乗算は、最上位から4番目のビットである0が対応している。符号406の2乗算と符号407の乗算は、最下位のビットである1が対応している。
Here, a specific example of the binary method is shown with d = 21. When d = 21 is expressed in binary notation, (10101) is obtained, and Expression 401 is obtained. In Equation 401,
したがって、ビット列先頭以外の対象ビットが0の場合には2乗算を行い、対象ビットが1の場合には2乗算を行った後に乗算を行うことにより、X^21を得ることができる。また、合同式の性質より、A*B(modZ)=(A(modZ))*(B(modZ))(modZ)となるため、乗算剰余を行った結果同士をさらに乗算剰余することで、べき乗剰余と同じ結果を得ることができる。 Therefore, X ^ 21 can be obtained by performing multiplication by 2 when the target bit other than the head of the bit string is 0, and by performing multiplication after performing 2 multiplication when the target bit is 1. In addition, because of the property of the congruence formula, A * B (modZ) = (A (modZ)) * (B (modZ)) (modZ). Therefore, by further multiplying the results of the multiplication remainders, The same result as the power residue can be obtained.
図5は、バイナリ法によるRSA暗号非均等分割処理による実行状態を示す図である。RSA暗号非分割処理の実行状態501では10[msec]の段階でOSに応答を返すことができない。従来例の実行状態502では、バイナリ法を、2乗算のところで分割した例である。タイマーを持たせることで、空き時間に応じてRSA暗号処理を割り当てている。
FIG. 5 is a diagram showing an execution state by the RSA encryption non-uniform division processing by the binary method. In the
モンゴメリ乗算剰余を使用した従来例の実行状態503では、モンゴメリ乗算剰余を使用する際に必要な前処理が行われるため、0〜10[msec]の区間では、RSA暗号分割処理505が10[msec]を超えてしまっている。同様に10〜20[msec]の区間では、RSA暗号分割処理506が、20〜30[msec]の区間では、RSA暗号分割処理507が、各区間を超過してしまっており、OSに応答を返すことができない状態である。
In the execution state 503 of the conventional example using Montgomery multiplication remainder, pre-processing necessary for using Montgomery multiplication remainder is performed. Therefore, in the interval from 0 to 10 [msec], the RSA cipher division processing 505 is 10 [msec]. ] Has been exceeded. Similarly, the RSA cipher partitioning process 506 has exceeded each section in the section of 10 to 20 [msec], and the RSA
実施の形態1での実行状態504では、モンゴメリ乗算剰余の前処理の時間を含んで処理可能なビット数を算出する。そのため、0〜10[msec]、10〜20[msec]、20〜30[msec]、30〜40[msec]の各区間でRSA暗号分割処理が終了するように割り当てられている。空き時間内で処理可能なビットの算出式は式(1)となる。
In the
(実施の形態2の概要説明)
図6は、ウィンドウ法の概要説明を示す図である。実施の形態2のハードウェアの構成は実施の形態1に示したものと等しく、機能的構成も同様であるが、部分演算処理はウィンドウ法が実装されている。また、算出部210も部分演算処理にあわせた機能となる。Y=X^d(modZ)にて、dを2進数表記することで、ビット列601を得る。次に、所定のウィンドウ幅、図6ではkビットごとにビット列を分割し、分割して得たkビットのビット列に対してべき乗剰余演算処理を行う。ウィンドウbm-1、ウィンドウbm-2、・・・、ウィンドウb1、ウィンドウb0と分割し、分割して得た結果が式602である。
(Overview of the second embodiment)
FIG. 6 is a diagram showing an outline description of the window method. The hardware configuration of the second embodiment is the same as that shown in the first embodiment and the functional configuration is the same, but the partial arithmetic processing is implemented with the window method. Further, the
また、w[0]=X^0(modZ)、w[1]=X^1(modZ)、・・・、w[2^(k−1)]=X^(2^(k−1))(modZ)までを事前計算テーブルとして事前準備する。定義したw[]を使用すると、 ウィンドウbm-1はw[1111]と置き換えられる。以下、同様に、ウィンドウbm-2は、w[0110]と置き換えられ、b1は、w[1001]と置き換えられ、b0は、w[1101]と置き換えられる。置き換えた後、ウィンドウごとに2乗算をk回行い、さらにw[]との乗算を1回行うことを繰り返すことで、Y=X^d(modZ)を求めることができる。 Also, w [0] = X ^ 0 (modZ), w [1] = X ^ 1 (modZ),..., W [2 ^ (k-1)] = X ^ (2 ^ (k-1 )) Up to (modZ) is prepared in advance as a pre-calculation table. Using the defined w [], the window b m-1 is replaced with w [1111]. Similarly, the window b m-2 is replaced with w [0110], b 1 is replaced with w [1001], and b 0 is replaced with w [1101]. After the replacement, Y = X ^ d (modZ) can be obtained by repeating 2 multiplications k times for each window and further performing 1 multiplication with w [] once.
メモリが潤沢にある環境では、23〜25ビット程度のデータ量となる事前計算テーブルを事前計算にて準備しておき、べき乗剰余演算実行時にはこの事前計算テーブルを参照することで、高速な処理を実現できる。しかし、組み込み環境では、メモリ搭載量等の観点から事前計算テーブルを内部に保持し続けることができないため、実行の度にテーブル生成を行うことになり、オーバーヘッドがかかる。よって、一度に参照するビット幅が大きいテーブルを準備すれば、べき乗剰余演算の処理が高速に実行できる反面、事前計算テーブル生成の手間は大きくなる。 In an environment with abundant memory, a pre-calculation table with a data amount of about 23 to 25 bits is prepared by pre-calculation, and high-speed processing can be performed by referring to this pre-calculation table when executing a power-residue calculation. realizable. However, in the embedded environment, the pre-calculation table cannot be kept inside from the viewpoint of the amount of installed memory, etc., so the table is generated each time execution is performed, and overhead is applied. Therefore, if a table with a large bit width to be referred to at one time is prepared, the power-residue calculation process can be executed at a high speed, but the time for generating the pre-calculation table increases.
図7は、ウィンドウ法の処理時間を示す図である。ウィンドウ法は、処理の内容として、事前計算テーブルを生成する処理と、べき乗剰余演算処理を行う処理との2つに分かれる。図7は、それぞれのウィンドウ幅にあわせた、事前計算テーブルの生成にかかる処理時間と、べき乗剰余処理の処理時間とを表している。 FIG. 7 is a diagram illustrating the processing time of the window method. The window method is divided into two processes, that is, a process for generating a pre-calculation table and a process for performing a power-residue calculation process. FIG. 7 shows the processing time for generating the pre-calculation table and the processing time for the power-residue processing in accordance with the respective window widths.
たとえば、ウィンドウ幅が2ビットの場合は、テーブル生成には、2^2×(乗算剰余演算処理)、べき乗剰余演算処理には、(b+b/2)×(乗算剰余演算処理)の時間がかかることになる。ここで、bは対象データのビット長である。ウィンドウ幅がnビットであれば、テーブル生成には、2^n×(乗算剰余演算処理)、べき乗剰余演算処理には、(b+b/n)×(乗算剰余演算処理)の時間がかかることになる。 For example, when the window width is 2 bits, it takes 2 ^ 2 × (remainder operation processing) for table generation, and (b + b / 2) × (remainder operation processing) for power residue operation processing. It will be. Here, b is the bit length of the target data. If the window width is n bits, it takes 2 ^ n × (remainder operation processing) for table generation, and (b + b / n) × (remainder operation processing) for power residue operation processing. Become.
図8は、ウィンドウ法によるRSA暗号非均等分割処理による実行状態を示す図である。ウィンドウ幅を4ビット固定で行ったウィンドウ法の実行状態801では、10〜20[msec]の区間で空き時間803が、20〜30[msec]の区間で空き時間804が、それぞれ発生している。空き時間が発生する理由は、ウィンドウ法はバイナリ法よりも一度にまとめて処理を行うため、空きができることがあるためである。
FIG. 8 is a diagram showing an execution state by the RSA encryption non-uniform division processing by the window method. In the window
次に、実施の形態2の実行状態802では、空き時間にあわせてウィンドウ幅を動的に変更させることで、空き時間を限りなく少なくなるように使用することができる。具体的には、0〜10[msec]の区間では、ウィンドウ幅は4ビットである。同様に、10〜20[msec]の区間では、ウィンドウ幅は2ビット、20〜30[msec]の区間では、ウィンドウ幅は5ビット、30〜40[msec]の区間では、ウィンドウ幅は4ビットといったようにウィンドウ幅が可変となっている。空き時間内で処理可能なビットの算出式は式(2)となる。
Next, in the
図9は、ウィンドウ法によるRSA暗号非均等分割処理を行った処理時間例を示す図である。RSA暗号処理の対象データのビット数を1024ビットとする。また、OSに応答を返す間隔を30[msec]とし、別タスク処理時間として、各最適実装法取得回数の各フィールドが対応する。たとえば、1度目は12[msec]、2度目は10[msec]となる。余り時間Tは、OSに応答を返す間隔30[msec]と別タスク処理時間の差となる。乗算剰余演算処理が行える回数aは、余り時間Tと1回の乗算剰余演算処理に要する所要時間tの商である。 FIG. 9 is a diagram illustrating an example of processing time when the RSA encryption non-uniform division processing by the window method is performed. The number of bits of the target data for RSA encryption processing is 1024 bits. Further, an interval for returning a response to the OS is set to 30 [msec], and each field of the number of times of obtaining the optimum mounting method corresponds to another task processing time. For example, the first time is 12 [msec] and the second time is 10 [msec]. The surplus time T is a difference between an interval 30 [msec] for returning a response to the OS and another task processing time. The number of times a that can be subjected to the modular multiplication operation is a quotient of the remaining time T and the required time t required for one modular multiplication operation.
前述した前提条件にて、式(2)をウィンドウ幅1〜5ビットまで行い、最大のKbを最適実装法として取得する。たとえば、1度目の場合、Kb(1)としてウィンドウ幅1ビットの場合は89ビット、同様に、Kb(2)は116ビット、Kb(3)は129ビット、Kb(4)は128ビット、Kb(5)は120ビットとなり、最大のKbはKb(3)となる。したがって、未処理のビットは、1024ビットとKb(3)で得た129の差となり、895ビットとなる。以下、2度目以降も同様の処理を行い、処理残りビットが751ビット、721ビット、・・・と繰り返す。9度目の時点で処理残りビットがなくなったため処理を終了する。 Under the preconditions described above, Expression (2) is performed up to a window width of 1 to 5 bits, and the maximum Kb is acquired as the optimum mounting method. For example, in the first case, Kb (1) is 89 bits when the window width is 1 bit, similarly, Kb (2) is 116 bits, Kb (3) is 129 bits, Kb (4) is 128 bits, Kb (5) is 120 bits, and the maximum Kb is Kb (3). Therefore, the number of unprocessed bits is 895 bits, which is the difference between 1024 bits and 129 obtained by Kb (3). Thereafter, the same processing is performed for the second and subsequent times, and the remaining processing bits are repeated as 751 bits, 721 bits,. Since there are no remaining processing bits at the ninth time, the processing is terminated.
9度目の分割処理でRSA暗号処理が終わったため、RSA処理に要した処理時間は別タスクの時間も含めると、270[msec]となる。もし、従来例で処理を行った場合、最も余り時間が短い、RSA暗号分割処理の処理時間は5[msec]に設定することになる。ウィンドウ幅として4ビットを使用した場合、1度に24ビット処理することができ、RSA暗号処理ビットが1024ビットである場合、43度目、1290[msec]で終了することになる。 Since the RSA encryption processing is completed in the ninth division processing, the processing time required for the RSA processing is 270 [msec] including the time of another task. If processing is performed in the conventional example, the processing time of the RSA cipher splitting process, which has the shortest remaining time, is set to 5 [msec]. When 4 bits are used as the window width, 24 bits can be processed at a time, and when the RSA encryption processing bit is 1024 bits, the process ends for the 43rd time at 1290 [msec].
(実施の形態1〜4の機能説明)
図10は、RSA暗号非均等分割処理を示すフローチャートである。図10は実施の形態1〜4すべての形態で使用され、後述するステップS1004と、ステップS1008にてそれぞれの形態にて対応する処理が行われる。
(Functional description of
FIG. 10 is a flowchart showing RSA encryption non-uniform division processing. FIG. 10 is used in all the first to fourth embodiments, and corresponding processing is performed in each mode in step S1004 and step S1008 described later.
演算装置100は、別タスク実行後の空き時間を検出部209より検出し、Tに格納する(ステップS1001)。続けて、乗算剰余演算処理の処理時間を処理時間取得部208により取得し、tに格納する(ステップS1002)。演算装置100は、Tとtを用い、a=T/tを計算し(ステップS1003)、aを引数として、最適実装法取得および処理可能ビット数算出処理を実行する(ステップS1004)。具体的な処理内容は、それぞれの実施の形態、実施の形態1では図11、実施の形態2では図12、実施の形態3では図13、実施の形態4では図14にて後述する。
The
最適実装法と処理可能ビット数を取得できたら、演算装置100は、今回が初回のRSA暗号処理であるのかを確認する(ステップS1005)。初回である場合には(ステップS1005:Yes)、受信部203によって受信された対象データを入力データとして取得する(ステップS1006)。初回でなく、2回目以降の場合には(ステップS1005:No)、記憶装置に格納してあったRSA暗号処理途中結果を取得する(ステップS1007)。次に、取得した対象データに対して、算出した処理可能ビット数分、取得した最適実装法を実行する(ステップS1008)。最適実装法は、実施の形態1または3ではバイナリ法を使用し、実施の形態2または4ではウィンドウ法を使用する。
If the optimal mounting method and the number of bits that can be processed have been acquired, the
処理可能ビット数分、最適実装法を行った後に、演算装置100は、RSA暗号処理が終了したかを確認する(ステップS1009)。終了した場合には(ステップS1009:Yes)、RSA暗号処理結果を出力する(ステップS1010)。終了していなく、途中であった場合には(ステップS1009:No)、RSA暗号処理途中結果を記憶装置に格納する(ステップS1011)。
After performing the optimal mounting method for the number of processable bits, the
(実施の形態1の機能説明)
図11は、実施の形態1にかかる最適実装法取得および処理可能ビット数算出処理を示すフローチャートである。処理可能ビット数算出法1のフローチャートが図11となる。演算装置100は、引数として渡されたaを用いて、Kb=Floor((a−1)/2)を算出する(ステップS1101)。ステップS1101で求めたKbが処理可能ビット数となり、最適実装法として、バイナリ法を出力し、処理可能ビット数として、Kbを出力し(ステップS1102)、処理を終了する。
(Functional Description of Embodiment 1)
FIG. 11 is a flowchart of the optimum mounting method acquisition and processable bit number calculation processing according to the first embodiment. A flowchart of the processable bit
(実施の形態2の機能説明)
図12は、実施の形態2にかかる最適実装法取得および処理可能ビット数算出処理を示すフローチャートである。処理可能ビット数算出法2のフローチャートが図12となる。演算装置100は、iを1に初期化する(ステップS1201)。後続するステップではiをウィンドウ幅として使用する。
(Functional Description of Embodiment 2)
FIG. 12 is a flowchart of optimal mounting method acquisition and processable bit number calculation processing according to the second embodiment. A flowchart of the processable bit
次に、演算装置100は、引数として渡されたaを用いて、a−2^iを算出し、0より大きいかを確認する(ステップS1202)。0より大きい場合には(ステップS1202:Yes)、Kb(i)=Floor((a−2^i)/(i+1))*iを算出する(ステップS1203)。算出されたKb(i)を保持し(ステップS1204)、次のウィンドウ幅で計算するために、iをインクリメントし(ステップS1205)、ステップS1202に移行する。
Next, the
a−2^iが0以下の場合は(ステップS1202:No)、演算装置100は、保持したKb(1)、・・・、Kb(i)について、最大値をKb_maxに設定し、対応するウィンドウ幅の値をi_maxに設定する(ステップS1206)。最後に最適実装法として、ウィンドウ幅をi_maxとするウィンドウ法を出力し、処理可能ビット数として、Kb_maxを出力し(ステップS1207)、処理を終了する。
When a-2 ^ i is 0 or less (step S1202: No), the
また、変数iについて、演算装置100が対応していないウィンドウ幅であった場合は、該当のウィンドウ幅での算出処理を行わず対応しているウィンドウ幅に対して処理を行ってもよい。同様に、ステップS1202にて、a−2^iが0より大きい場合でも、演算装置100のハードウェアの制約上、該当のウィンドウ幅以上でテーブルを生成できない場合には、ステップS1202:Noのルートに入ってもよい。
Further, when the variable i has a window width that is not supported by the
(実施の形態3の機能説明)
図13は、実施の形態3にかかる最適実装法取得および処理可能ビット数算出処理を示すフローチャートである。処理可能ビット数算出法3のフローチャートが図13となる。実施の形態3のハードウェアの構成は実施の形態1に示したものと等しく、機能的構成も同様であるが、算出部210にて、空き時間内に乗算剰余演算処理の利用可能な回数を算出する方法として処理可能ビット数算出法3を使用する。
(Functional Description of Embodiment 3)
FIG. 13 is a flowchart of the optimum mounting method acquisition and processable bit number calculation processing according to the third embodiment. A flowchart of the processable bit
演算装置100は、引数として渡されたaを用いて、Floor(a−1)をaに設定する(ステップS1301)。乗算剰余演算処理の利用回数を示す変数mを用意し、0に初期化する(ステップS1302)。引き続き、RSA暗号処理対象ビット列に、処理開始位置sを設定する(ステップS1303)。そして、RSA暗号処理対象ビット列を指すポインタとして位置pを用意し、位置sと同位置に設定する(ステップS1304)。
The
演算装置100は、位置pがRSA暗号処理対象ビット列の先頭かを確認する(ステップS1305)。先頭の場合は(ステップS1305:Yes)、m=m+1を行い(ステップS1306)、m>aであるかを確認する(ステップS1310)。先頭でない場合は(ステップS1305:No)、続けて、位置pのビットの値が1かを確認する(ステップS1307)。1の場合は(ステップS1307:Yes)、m=m+2を行い(ステップS1309)、0の場合は(ステップS1307:No)、m=m+1を行い(ステップS1308)、ステップS1310に移行する。
The
演算装置100は、ステップS1310にて、m>aでない場合には(ステップS1310:No)、続けて、位置pがRSA暗号処理対象ビット列の末尾にあるかを確認する(ステップS1311)。末尾にない場合は(ステップS1311:No)、位置pを下位方向へ1つ移動し(ステップS1312)、ステップS1305に移行する。末尾であった場合には(ステップS1311:Yes)、RSA暗号処理が終了したことを意味し、後述するステップS1314に移行する。
In step S1310, if m> a is not satisfied (step S1310: No), the
演算装置100は、ステップS1310にて、m>aである場合には(ステップS1310:Yes)、mが空き時間内に処理可能なビット数を超えたことを意味するため、位置pを上位方向へ1つ移動する(ステップS1313)。続けて、Kbを位置sから位置pまでのビット数に設定し(ステップS1314)、最適実装法として、バイナリ法を出力し、処理可能ビット数として、Kbを出力する(ステップS1315)。ステップS1311:Yesのルートの場合は、最下位のビット列までRSA暗号処理が行えることを意味しているため、ステップS1313を行わず、ステップS1314を行う。
If m> a in step S1310 (step S1310: Yes), the
(実施の形態4の機能説明)
図14は、実施の形態4にかかる最適実装法取得および処理可能ビット数算出処理を示すフローチャートである。処理可能ビット数算出法4のフローチャートが図14となる。実施の形態4のハードウェアの構成は実施の形態2に示したものと等しく、機能的構成も同様であるが、算出部210にて、空き時間内に乗算剰余演算処理の利用可能な回数を算出する方法として処理可能ビット数算出法4を使用する。演算装置100は、iを1に初期化する(ステップS1201)。後続するステップではiをウィンドウ幅として使用する。
(Functional Description of Embodiment 4)
FIG. 14 is a flowchart of the optimum mounting method acquisition and processable bit number calculation processing according to the fourth embodiment. A flowchart of the processable bit
次に、演算装置100は、引数として渡されたaを用いて、a−2^iを算出し(ステップS1402)、a>0かを確認する(ステップS1403)。a>0であれば(ステップS1403:Yes)、乗算剰余演算処理の利用回数を示す変数mを用意し、0に初期化する(ステップS1404)。引き続き、RSA暗号処理対象ビット列に、処理開始位置sを設定する(ステップS1405)。そして、RSA暗号処理対象ビット列を指すポインタとして位置pを用意し、位置sと同位置に設定する(ステップS1406)。
Next, the
位置pを設定後、演算装置100は、位置pからi−1番目までのビットの値がすべて0かを確認する(ステップS1407)。0である場合は(ステップS1407:Yes)、m=m+iを行い(ステップS1409)、m>aであるかを確認する(ステップS1410)。値が1であるビットが含まれる場合は(ステップS1407:No)、m=m+i+1を行い(ステップS1408)、ステップS1410に移行する。
After setting the position p, the
演算装置100は、ステップS1410にて、m>aでない場合には(ステップS1410:No)、続けて、位置pがRSA暗号処理対象ビット列の末尾にあるかを確認する(ステップS1411)。末尾にない場合は(ステップS1411:No)、位置pを下位方向へi分移動し(ステップS1412)、ステップS1407に移行する。末尾であった場合には(ステップS1411:Yes)、RSA暗号処理が終了したことを意味し、後述するステップS1414に移行する。
In step S1410, if m> a is not satisfied (step S1410: No), the
演算装置100は、ステップS1410にて、m>aである場合には(ステップS1410:Yes)、mが空き時間内に処理可能なビット数を超えたことを意味するため、位置pを上位方向へi分移動する(ステップS1413)。次に、Kb(i)を位置sから位置pまでのビット数として保持し(ステップS1414)、iをインクリメントし(ステップS1415)、ステップS1402に移行する。
If m> a in step S1410 (step S1410: Yes), the
ステップS1403にて、aが0以下の場合は(ステップS1403:No)、演算装置100は、保持したKb(1)、・・・、Kb(i)について、最大値をKb_maxに設定し、対応するウィンドウ幅の値をi_maxに設定する(ステップS1416)。最後に最適実装法として、ウィンドウ幅をi_maxとするウィンドウ法を出力し、処理可能ビット数として、Kb_maxを出力し(ステップS1417)、処理を終了する。
In step S1403, when a is 0 or less (step S1403: No),
また、変数iについて、演算装置100が対応していないウィンドウ幅であった場合は、該当のウィンドウ幅での算出処理を行わず対応しているウィンドウ幅に対して処理を行ってもよい。同様に、ステップS1403にて、aが0より大きい場合でも、演算装置100のハードウェアの制約上、該当のウィンドウ幅以上でテーブルを生成できない場合には、ステップS1403:Noのルートに入ってもよい。
Further, when the variable i has a window width that is not supported by the
以上説明したように、演算装置100によれば、CPUの空き時間にあわせてべき乗剰余演算処理を非均等に分割することにより、1回のRSA暗号処理を短時間で完了することができる。
As described above, according to the
また、ビット列を抽出する場合、ビット列を順次抽出してもよい。これにより、べき乗剰余演算処理の対象データの先頭から末尾までを、複数の非均等に分割した処理に分けて処理することができる。また、上記実施の形態では先頭から末尾までを走査する方法を例示したが、逆に、末尾から先頭方向へ走査してもよい。 When extracting a bit string, the bit string may be extracted sequentially. Thereby, the data from the beginning to the end of the target data of the power-residue calculation process can be divided into a plurality of non-uniformly divided processes. In the above embodiment, the method of scanning from the head to the tail is exemplified, but conversely, the scanning may be performed from the tail to the head.
また、処理可能なビット数を算出する際に、部分演算処理がバイナリ法である場合、バイナリ法における乗算剰余演算処理の利用回数に基づいて、処理可能なビット数を算出してもよい。これにより、バイナリ法での処理可能なビット数を算出でき、CPUの空き時間を有効利用し、1回のRSA暗号処理を短時間で完了することができる。 Further, when the number of bits that can be processed is calculated, if the partial calculation processing is a binary method, the number of bits that can be processed may be calculated based on the number of times of use of the modular multiplication operation in the binary method. Thereby, the number of bits that can be processed by the binary method can be calculated, the idle time of the CPU can be effectively used, and one RSA encryption process can be completed in a short time.
また、処理可能なビット数を算出する際に、部分演算処理がバイナリ法である場合、式(1)を使用してもよい。これにより、具体的にバイナリ法での処理可能なビット数を算出でき、CPUの空き時間を有効利用し、1回のRSA暗号処理を短時間で完了することができる。 Further, when calculating the number of bits that can be processed, when the partial arithmetic processing is a binary method, the equation (1) may be used. As a result, the number of bits that can be processed by the binary method can be calculated specifically, the idle time of the CPU can be effectively used, and one RSA encryption process can be completed in a short time.
また、処理可能なビット数を算出する際に、部分演算処理がバイナリ法である場合、式(3)より乗算剰余演算処理の利用可能な回数を求める。そして、対象データの対象ビットの値に応じて回数を減算し、回数が0になるまで対象ビットを順次読み出し、読み出した対象ビットの数を処理可能なビット数として算出してもよい。これにより、対象データのビット列に0が多く、バイナリ法にて、1ビットあたりに乗算剰余演算処理を1度だけ行うことが多い場合、より多くのビット数を算出可能として算出することができる。 Further, when the number of bits that can be processed is calculated, when the partial operation processing is a binary method, the number of times that the modular multiplication operation processing can be used is obtained from Equation (3). Then, the number of times may be subtracted according to the value of the target bit of the target data, the target bits may be read sequentially until the number of times becomes zero, and the number of read target bits may be calculated as the number of bits that can be processed. As a result, when there are many 0s in the bit string of the target data and the modular multiplication operation process is often performed only once per bit by the binary method, a larger number of bits can be calculated.
また、処理可能なビット数を算出する際に、部分演算処理がウィンドウ法である場合、ウィンドウ法における乗算剰余演算処理の利用回数に基づいて、処理可能なビット数を算出してもよい。これにより、ウィンドウ法での処理可能なビット数を算出でき、CPUの空き時間を有効利用し、1回のRSA暗号処理を短時間で完了することができる。 When calculating the number of bits that can be processed, if the partial calculation process is a window method, the number of bits that can be processed may be calculated based on the number of times of use of the modular multiplication operation in the window method. Thereby, the number of bits that can be processed by the window method can be calculated, the idle time of the CPU can be used effectively, and one RSA encryption process can be completed in a short time.
また、処理可能なビット数を算出する際に、部分演算処理がウィンドウ法である場合、式(2)を使用してもよい。これにより、具体的にウィンドウ法での処理可能なビット数を算出でき、CPUの空き時間を有効利用し、空き時間にあったテーブルサイズを作成することができ、1回のRSA暗号処理を短時間で完了することができる。 Further, when calculating the number of bits that can be processed, when the partial calculation processing is a window method, the equation (2) may be used. As a result, the number of bits that can be specifically processed by the window method can be calculated, the CPU idle time can be used effectively, a table size suitable for the idle time can be created, and one RSA encryption process can be shortened. Can be completed in time.
また、処理可能なビット数を算出する際に、部分演算処理がウィンドウ法である場合、式(4)より乗算剰余演算処理の利用可能な回数を求める。そして、対象データのウィンドウ幅分のビット列が取り得るビットパターンに応じて回数をウィンドウ幅分減算し、回数が0になるまでビット列を順次読み出し、読み出したビット列を構成するビットの数を処理可能なビット数として算出してもよい。これにより、対象データのビット列に0が多く、ウィンドウ法にて、対象ビット列あたりに乗算剰余演算処理をウィンドウ幅分だけ行うことが多い場合、より多くのビット数を算出可能として算出することができる。 Further, when the number of bits that can be processed is calculated, when the partial operation processing is the window method, the number of times that the modular multiplication operation processing can be used is obtained from Equation (4). Then, the number of times is subtracted by the window width according to the bit pattern that can be taken by the bit string corresponding to the window width of the target data, the bit string is sequentially read out until the number becomes 0, and the number of bits constituting the read bit string can be processed It may be calculated as the number of bits. As a result, when there are many 0s in the bit string of the target data and the remainder calculation operation is often performed for the target bit string by the window method by the window method, a larger number of bits can be calculated. .
また、処理可能なビット数を算出する場合に部分演算処理がウィンドウ法である場合、取り得るウィンドウ幅ごとにビット数を算出し、算出されたビット数のうち最長となるビット数を抽出し、対象データからビット列を抽出し、ウィンドウ法を実行してもよい。これにより、CPUの空き時間の変化にあわせたウィンドウ幅を設定することができ、1回のRSA暗号処理を短時間で完了することができる。また、CPUの空き時間にあわせて非均等に分割した処理ごとに、毎回適切な大きさの事前計算テーブルを生成するため、処理効率を向上することができ、RSA暗号処理を短時間で完了することができる。 When calculating the number of bits that can be processed, if the partial operation processing is a window method, calculate the number of bits for each possible window width, and extract the longest number of bits from among the calculated number of bits, A bit string may be extracted from the target data and the window method may be executed. As a result, the window width can be set in accordance with the change in the CPU idle time, and one RSA encryption process can be completed in a short time. In addition, since a pre-calculation table having an appropriate size is generated every time processing is divided non-uniformly according to CPU idle time, processing efficiency can be improved, and RSA encryption processing is completed in a short time. be able to.
また、べき乗剰余演算処理を行う方式として、RSA暗号処理を例にしたが、その他のべき乗剰余演算処理や曲線上の点のスカラー倍算を伴う処理、たとえば、楕円曲線暗号、EPOC(Efficient Probabilistic public−key enCryption)暗号、ラビン暗号、エルガマル暗号等でも、本実施の形態を利用することができる。 Also, RSA encryption processing has been taken as an example of a method for performing power-residue calculation processing, but other power-residue calculation processing and processing involving scalar multiplication of points on a curve, such as elliptic curve cryptography, EPOC (Efficient Probabilistic public) -Key (enCryption) encryption, Rabin encryption, El Gamal encryption, etc., can also use this embodiment.
なお、本実施の形態で説明した演算方法は、予め用意されたプログラムをパーソナル・コンピュータやワークステーション、組み込み機器等のコンピュータで実行することにより実現することができる。本演算プログラムは、ROM、不揮発性メモリ、ハードディスク、フレキシブルディスク、CD−ROM、MO、DVD等のコンピュータで読み取り可能な記録媒体に記録され、コンピュータによって記録媒体から読み出されることによって実行される。また本演算プログラムは、インターネット等のネットワークを介して配布してもよい。 The calculation method described in this embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer, a workstation, or an embedded device. The arithmetic program is recorded on a computer-readable recording medium such as a ROM, a nonvolatile memory, a hard disk, a flexible disk, a CD-ROM, an MO, and a DVD, and is executed by being read from the recording medium by the computer. The arithmetic program may be distributed via a network such as the Internet.
上述した実施の形態に関し、さらに以下の付記を開示する。 The following additional notes are disclosed with respect to the embodiment described above.
(付記1)コンピュータを、
前記コンピュータが一定時間ごとに返す応答までの空き時間を検出する検出手段、
前記検出手段によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出手段、
前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出手段によって算出されたビット数分のビット列を抽出する抽出手段、
前記抽出手段によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行手段、
として機能させることを特徴とする演算プログラム。
(Appendix 1) Computer
Detecting means for detecting idle time until a response returned by the computer at regular intervals;
Based on the free time detected by the detecting means, the processing time required for the multiplication remainder calculation processing constituting the power residue calculation processing, and the number of times of use of the multiplication remainder calculation processing in a predetermined partial calculation processing, A calculation means for calculating the number of bits that can be processed;
Extraction means for extracting a bit string corresponding to the number of bits calculated by the calculation means from target data corresponding to an exponent part of the power-residue calculation process;
Execution means for giving the bit string extracted by the extraction means and executing the predetermined partial operation processing;
An arithmetic program characterized by functioning as
(付記2)前記抽出手段は、
前記対象データの先頭ビットから前記ビット数分のビット列を順次抽出することを特徴とする付記1に記載の演算プログラム。
(Supplementary Note 2) The extraction means includes:
The arithmetic program according to
(付記3)前記算出手段は、
前記所定の部分演算処理がバイナリ法に関する部分演算処理である場合、前記空き時間と前記乗算剰余演算処理に要する処理時間と前記バイナリ法に関する部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能な前記バイナリ法でのビット数を算出し、
前記抽出手段は、
前記対象データから前記算出手段によって算出された前記バイナリ法でのビット数分のビット列を抽出し、
前記実行手段は、
前記抽出手段によって抽出されたビット列を与えて前記バイナリ法に関する部分演算処理を実行することを特徴とする付記1または2に記載の演算プログラム。
(Supplementary Note 3) The calculation means includes:
When the predetermined partial calculation process is a partial calculation process related to a binary method, based on the idle time, a processing time required for the multiplication remainder calculation process, and the number of times the multiplication residue calculation process is used in the partial calculation process related to the binary method. And calculating the number of bits in the binary method that can be processed within the free time,
The extraction means includes
Extracting a bit string for the number of bits in the binary method calculated by the calculation means from the target data,
The execution means includes
The arithmetic program according to
(付記4)前記算出手段は、
下記式(1)により前記処理可能なビット数を算出することを特徴とする付記3に記載の演算プログラム。
Kb=Floor((T/t−1)/2)…(1)
ただし、Kbは処理可能なビット数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を示す。
(Supplementary Note 4) The calculating means includes:
The calculation program according to
Kb = Floor ((T / t-1) / 2) (1)
Here, Kb represents the number of bits that can be processed, Floor () represents the floor function, T represents the idle time, and t represents the processing time required for the modular multiplication operation.
(付記5)前記算出手段は、
下記式(2)により前記空き時間内に前記乗算剰余演算処理の利用可能な回数である演算利用可能回数を求め、前記対象ビットの値に応じて演算を行った回数である演算実行回数を加算することにより、前記演算実行回数が前記演算利用可能回数になるまで対象ビットを順次読み出し、読み出した対象ビットの数を前記処理可能なビット数として算出することを特徴とする付記3に記載の演算プログラム。
a=Floor(T/t−1)…(2)
ただし、aは演算利用可能回数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を示す。
(Supplementary Note 5) The calculation means includes:
The number of usable operations, which is the number of times that the modular multiplication operation can be used, is calculated by the following formula (2), and the number of times that the operation has been performed is added according to the value of the target bit. Then, the target bits are sequentially read out until the number of times the calculation is executed becomes the number of times the calculation can be used, and the number of read target bits is calculated as the number of bits that can be processed. program.
a = Floor (T / t-1) (2)
Here, “a” indicates the number of usable operations, “Floor ()” indicates the floor function, “T” indicates the idle time, and “t” indicates the processing time required for the modular multiplication operation processing.
(付記6)前記コンピュータを、
前記所定の部分演算処理がウィンドウ法に関する部分演算処理である場合、前記べき乗剰余演算処理が行われる被対象データをウィンドウ幅のビット列が取り得るビットパターンごとにべき乗剰余した値を格納するテーブルを生成する生成手段、
前記生成手段によって生成されたテーブルから、前記ビットパターンに基づいて、前記被対象データをべき乗剰余した値を取得する取得手段として機能させ、
前記算出手段は、
前記空き時間と前記乗算剰余演算処理に要する処理時間と前記ウィンドウ法に関する部分演算処理における前記乗算剰余演算処理の利用回数と前記生成手段によって生成されたテーブルの生成時間と前記ウィンドウ幅とに基づいて、前記空き時間内で処理可能な前記ウィンドウ法でのビット数を算出し、
前記抽出手段は、
前記対象データから前記算出手段によって算出された前記ウィンドウ法でのビット数分のビット列を抽出し、
前記実行手段は、
前記抽出手段によって抽出されたビット列と前記取得手段によって取得された前記被対象データをべき乗剰余した値とを与えて前記ウィンドウ法に関する部分演算処理を実行することを特徴とする付記1または2に記載の演算プログラム。
(Appendix 6)
When the predetermined partial calculation process is a partial calculation process related to the window method, a table for storing a power residue value for each bit pattern that can be taken by a bit string having a window width is generated for the target data to be subjected to the power residue calculation process. Generating means,
From the table generated by the generating means, based on the bit pattern, to function as an acquiring means for acquiring a value that is a power residue of the target data,
The calculating means includes
Based on the free time, the processing time required for the multiplication residue calculation processing, the number of times of use of the multiplication residue calculation processing in the partial calculation processing related to the window method, the generation time of the table generated by the generation means, and the window width , And calculate the number of bits in the window method that can be processed within the free time,
The extraction means includes
Extracting a bit string for the number of bits in the window method calculated by the calculation means from the target data,
The execution means includes
The
(付記7)前記算出手段は、
下記式(3)により前記処理可能なビット数を算出することを特徴とする付記6に記載の演算プログラム。
Kb=Floor((T/t−2^n)/(n+1))*n…(3)
ただし、Kbは処理可能なビット数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を、nはウィンドウ幅を示す。
(Supplementary note 7) The calculation means includes:
The arithmetic program according to appendix 6, wherein the number of bits that can be processed is calculated by the following equation (3).
Kb = Floor ((T / t−2 ^ n) / (n + 1)) * n (3)
Here, Kb represents the number of bits that can be processed, Floor () represents a floor function, T represents a free time, t represents a processing time required for the modular multiplication operation, and n represents a window width.
(付記8)前記算出手段は、
下記式(4)により前記空き時間内に前記乗算剰余演算処理の利用可能な回数である演算利用可能回数を求め、前記ウィンドウ幅分のビット列が取り得るビットパターンに応じて演算を行った回数である演算実行回数をウィンドウ幅に基づいて加算することにより、前記演算実行回数が前記演算利用可能回数になるまで前記ビット列を順次読み出し、読み出したビット列を構成するビットの数を前記処理可能なビット数として算出することを特徴とする付記6に記載の演算プログラム。
a=Floor(T/t−2^n)…(4)
ただし、aは演算利用可能回数を、Floor()は床関数を、Tは空き時間を、tは乗算剰余演算処理に要する処理時間を、nはウィンドウ幅を示す。
(Supplementary Note 8) The calculation means includes:
According to the following equation (4), the number of usable operations, which is the number of times the modular multiplication operation process can be used within the idle time, is obtained, and the number of operations performed according to the bit pattern that can be taken by the bit string corresponding to the window width. By adding a certain number of execution times based on the window width, the bit string is sequentially read out until the number of operation executions reaches the number of usable operations, and the number of bits constituting the read bit string is the number of bits that can be processed. The calculation program according to attachment 6, wherein the calculation program is calculated as follows.
a = Floor (T / t-2 ^ n) (4)
Here, “a” represents the number of usable operations, “Floor ()” represents the floor function, “T” represents the idle time, “t” represents the processing time required for the modular multiplication operation, and “n” represents the window width.
(付記9)前記算出手段は、
前記ウィンドウ幅ごとに前記ビット数を算出し、
前記抽出手段は、
前記算出手段によって算出されたウィンドウ幅ごとのビット数のうち、最長となるビット数を抽出し、
前記実行手段は、
前記抽出手段によって抽出された最長となるビット数に基づいて、前記ウィンドウ法に関する部分演算処理を実行することを特徴とする付記6〜8のいずれか1つに記載の演算プログラム。
(Supplementary note 9) The calculation means includes:
Calculating the number of bits for each window width;
The extraction means includes
Of the number of bits for each window width calculated by the calculation means, extract the longest number of bits,
The execution means includes
9. The arithmetic program according to any one of appendices 6 to 8, wherein the partial arithmetic processing related to the window method is executed based on the longest number of bits extracted by the extracting means.
(付記10)前記コンピュータを、
前記ウィンドウ幅ごとに、前記テーブルの生成時間を前記乗算剰余演算処理に要する処理時間に基づいて設定する設定手段として機能させ、
前記算出手段は、
前記ウィンドウ幅ごとに、前記設定手段によって設定された生成時間に基づいて前記ビット数を算出し、
前記抽出手段は、
前記ウィンドウ幅ごとに算出されたビット数のうち最長となるビット数分のビット列を抽出し、
前記生成手段は、
前記ビット数が最長となるウィンドウ幅に基づいて、前記被対象データを前記ウィンドウ幅のビット列が取り得るビットパターンごとにべき乗剰余した値を格納するテーブルを生成し、
前記取得手段は、
前記生成手段によって前記ビット数が最長となるウィンドウ幅に基づいて生成されたテーブルから、前記ウィンドウ幅のビット列のビットパターンに基づいて、前記被対象データをべき乗剰余した値を取得し、
前記実行手段は、
前記抽出手段によって抽出されたビット列と前記取得手段によって取得された前記被対象データをべき乗剰余した値とを与えて前記ウィンドウ法に関する部分演算処理を実行することを特徴とする付記9に記載の演算プログラム。
(Supplementary note 10)
For each window width, function as setting means for setting the generation time of the table based on the processing time required for the modular multiplication operation,
The calculating means includes
For each window width, calculate the number of bits based on the generation time set by the setting means,
The extraction means includes
Extract a bit string corresponding to the longest number of bits among the number of bits calculated for each window width,
The generating means includes
Based on the window width in which the number of bits is the longest, a table for storing a value that is a power residue for each bit pattern that can be taken by the bit string of the window width is generated.
The acquisition means includes
From the table generated based on the window width where the number of bits is the longest by the generating means, based on the bit pattern of the bit string of the window width, obtain a value that is a power residue of the target data,
The execution means includes
The calculation according to
(付記11)検出手段と算出手段と抽出手段と実行手段とを備えるコンピュータが、
前記検出手段により、前記コンピュータが一定時間ごとに返す応答までの空き時間を検出する検出工程と、
前記算出手段により、前記検出工程によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出工程と、
前記抽出手段により、前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出工程によって算出されたビット数分のビット列を抽出する抽出工程と、
前記実行手段により、前記抽出工程によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行工程と、
を実行することを特徴とする演算方法。
(Additional remark 11) The computer provided with a detection means, a calculation means, an extraction means, and an execution means,
A detection step of detecting an idle time until a response returned by the computer at regular intervals by the detection means;
Based on the free time detected by the detection step and the processing time required for the multiplication remainder calculation process constituting the power residue calculation process by the calculation means and the number of times the multiplication residue calculation process is used in a predetermined partial calculation process, A calculation step of calculating the number of bits that can be processed within the idle time;
An extraction step of extracting a bit string corresponding to the number of bits calculated by the calculation step from target data corresponding to an exponent part of the power-residue calculation process by the extraction unit;
An execution step of executing the predetermined partial operation processing by giving the bit string extracted by the extraction step by the execution means;
A calculation method characterized by executing
(付記12)一定時間ごとに返す応答までの空き時間を検出する検出手段と、
前記検出手段によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出手段と、
前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出手段によって算出されたビット数分のビット列を抽出する抽出手段と、
前記抽出手段によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行手段と、
を備えることを特徴とする演算装置。
(Supplementary Note 12) Detection means for detecting idle time until a response to be returned at regular intervals;
Based on the free time detected by the detecting means, the processing time required for the multiplication remainder calculation processing constituting the power residue calculation processing, and the number of times of use of the multiplication remainder calculation processing in a predetermined partial calculation processing, A calculation means for calculating the number of bits that can be processed;
Extraction means for extracting a bit string corresponding to the number of bits calculated by the calculation means from target data corresponding to an exponent part of the power-residue calculation process;
Execution means for giving the bit string extracted by the extraction means and executing the predetermined partial operation processing;
An arithmetic device comprising:
100 演算装置
201 制御部
202 処理コントロール部
203 受信部
204 演算部
205 タイマー
206 空き時間計算部
207 リファレンス所要時間格納テーブル
208 処理時間取得部
209 検出部
210 算出部
211 抽出部
212 実行部
213 設定部
214 テーブル生成部
215 テーブル取得部
DESCRIPTION OF
Claims (8)
前記コンピュータが一定時間ごとに返す応答までの空き時間を検出する検出手段、
前記検出手段によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出手段、
前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出手段によって算出されたビット数分のビット列を抽出する抽出手段、
前記抽出手段によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行手段、
として機能させることを特徴とする演算プログラム。 Computer
Detecting means for detecting idle time until a response returned by the computer at regular intervals;
Based on the free time detected by the detecting means, the processing time required for the multiplication remainder calculation processing constituting the power residue calculation processing, and the number of times of use of the multiplication remainder calculation processing in a predetermined partial calculation processing, A calculation means for calculating the number of bits that can be processed;
Extraction means for extracting a bit string corresponding to the number of bits calculated by the calculation means from target data corresponding to an exponent part of the power-residue calculation process;
Execution means for giving the bit string extracted by the extraction means and executing the predetermined partial operation processing;
An arithmetic program characterized by functioning as
前記対象データの先頭ビットから前記ビット数分のビット列を順次抽出することを特徴とする請求項1に記載の演算プログラム。 The extraction means includes
The arithmetic program according to claim 1, wherein a bit string corresponding to the number of bits is sequentially extracted from the first bit of the target data.
前記所定の部分演算処理がバイナリ法に関する部分演算処理である場合、前記空き時間と前記乗算剰余演算処理に要する処理時間と前記バイナリ法に関する部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能な前記バイナリ法でのビット数を算出し、
前記抽出手段は、
前記対象データから前記算出手段によって算出された前記バイナリ法でのビット数分のビット列を抽出し、
前記実行手段は、
前記抽出手段によって抽出されたビット列を与えて前記バイナリ法に関する部分演算処理を実行することを特徴とする請求項1または2に記載の演算プログラム。 The calculating means includes
When the predetermined partial calculation process is a partial calculation process related to a binary method, based on the idle time, a processing time required for the multiplication remainder calculation process, and the number of times the multiplication residue calculation process is used in the partial calculation process related to the binary method. And calculating the number of bits in the binary method that can be processed within the free time,
The extraction means includes
Extracting a bit string for the number of bits in the binary method calculated by the calculation means from the target data,
The execution means includes
The arithmetic program according to claim 1, wherein the partial arithmetic processing related to the binary method is executed by giving the bit string extracted by the extraction unit.
前記所定の部分演算処理がウィンドウ法に関する部分演算処理である場合、前記べき乗剰余演算処理が行われる被対象データをウィンドウ幅のビット列が取り得るビットパターンごとにべき乗剰余した値を格納するテーブルを生成する生成手段、
前記生成手段によって生成されたテーブルから、前記ビットパターンに基づいて、前記被対象データをべき乗剰余した値を取得する取得手段として機能させ、
前記算出手段は、
前記空き時間と前記乗算剰余演算処理に要する処理時間と前記ウィンドウ法に関する部分演算処理における前記乗算剰余演算処理の利用回数と前記生成手段によって生成されたテーブルの生成時間と前記ウィンドウ幅とに基づいて、前記空き時間内で処理可能な前記ウィンドウ法でのビット数を算出し、
前記抽出手段は、
前記対象データから前記算出手段によって算出された前記ウィンドウ法でのビット数分のビット列を抽出し、
前記実行手段は、
前記抽出手段によって抽出されたビット列と前記取得手段によって取得された前記被対象データをべき乗剰余した値とを与えて前記ウィンドウ法に関する部分演算処理を実行することを特徴とする請求項1または2に記載の演算プログラム。 The computer,
When the predetermined partial calculation process is a partial calculation process related to the window method, a table for storing a power residue value for each bit pattern that can be taken by a bit string having a window width is generated for the target data to be subjected to the power residue calculation process. Generating means,
From the table generated by the generating means, based on the bit pattern, to function as an acquiring means for acquiring a value that is a power residue of the target data,
The calculating means includes
Based on the free time, the processing time required for the multiplication residue calculation processing, the number of times of use of the multiplication residue calculation processing in the partial calculation processing related to the window method, the generation time of the table generated by the generation means, and the window width , And calculate the number of bits in the window method that can be processed within the free time,
The extraction means includes
Extracting a bit string for the number of bits in the window method calculated by the calculation means from the target data,
The execution means includes
3. The partial arithmetic processing related to the window method is executed by giving a bit string extracted by the extracting unit and a value obtained by performing a power residue on the target data acquired by the acquiring unit. The calculation program described.
前記ウィンドウ幅ごとに前記ビット数を算出し、
前記抽出手段は、
前記算出手段によって算出されたウィンドウ幅ごとのビット数のうち、最長となるビット数を抽出し、
前記実行手段は、
前記抽出手段によって抽出された最長となるビット数に基づいて、前記ウィンドウ法に関する部分演算処理を実行することを特徴とする請求項4に記載の演算プログラム。 The calculating means includes
Calculating the number of bits for each window width;
The extraction means includes
Of the number of bits for each window width calculated by the calculation means, extract the longest number of bits,
The execution means includes
5. The arithmetic program according to claim 4, wherein the partial arithmetic processing related to the window method is executed based on the longest number of bits extracted by the extracting means.
前記ウィンドウ幅ごとに、前記テーブルの生成時間を前記乗算剰余演算処理に要する処理時間に基づいて設定する設定手段として機能させ、
前記算出手段は、
前記ウィンドウ幅ごとに、前記設定手段によって設定された生成時間に基づいて前記ビット数を算出し、
前記抽出手段は、
前記ウィンドウ幅ごとに算出されたビット数のうち最長となるビット数分のビット列を抽出し、
前記生成手段は、
前記ビット数が最長となるウィンドウ幅に基づいて、前記被対象データを前記ウィンドウ幅のビット列が取り得るビットパターンごとにべき乗剰余した値を格納するテーブルを生成し、
前記取得手段は、
前記生成手段によって前記ビット数が最長となるウィンドウ幅に基づいて生成されたテーブルから、前記ウィンドウ幅のビット列のビットパターンに基づいて、前記被対象データをべき乗剰余した値を取得し、
前記実行手段は、
前記抽出手段によって抽出されたビット列と前記取得手段によって取得された前記被対象データをべき乗剰余した値とを与えて前記ウィンドウ法に関する部分演算処理を実行することを特徴とする請求項5に記載の演算プログラム。 The computer,
For each window width, function as setting means for setting the generation time of the table based on the processing time required for the modular multiplication operation,
The calculating means includes
For each window width, calculate the number of bits based on the generation time set by the setting means,
The extraction means includes
Extract a bit string corresponding to the longest number of bits among the number of bits calculated for each window width,
The generating means includes
Based on the window width in which the number of bits is the longest, a table for storing a value that is a power residue for each bit pattern that can be taken by the bit string of the window width is generated.
The acquisition means includes
From the table generated based on the window width where the number of bits is the longest by the generating means, based on the bit pattern of the bit string of the window width, obtain a value that is a power residue of the target data,
The execution means includes
6. The partial arithmetic processing related to the window method is executed by giving a bit string extracted by the extracting unit and a value obtained by performing a power residue on the target data acquired by the acquiring unit. Arithmetic program.
前記検出手段により、前記コンピュータが一定時間ごとに返す応答までの空き時間を検出する検出工程と、
前記算出手段により、前記検出工程によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出工程と、
前記抽出手段により、前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出工程によって算出されたビット数分のビット列を抽出する抽出工程と、
前記実行手段により、前記抽出工程によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行工程と、
を実行することを特徴とする演算方法。 A computer comprising detection means, calculation means, extraction means, and execution means,
A detection step of detecting an idle time until a response returned by the computer at regular intervals by the detection means;
Based on the free time detected by the detection step and the processing time required for the multiplication remainder calculation process constituting the power residue calculation process by the calculation means and the number of times the multiplication residue calculation process is used in a predetermined partial calculation process, A calculation step of calculating the number of bits that can be processed within the idle time;
An extraction step of extracting a bit string corresponding to the number of bits calculated by the calculation step from target data corresponding to an exponent part of the power-residue calculation process by the extraction unit;
An execution step of executing the predetermined partial operation processing by giving the bit string extracted by the extraction step by the execution means;
A calculation method characterized by executing
前記検出手段によって検出された空き時間とべき乗剰余演算処理を構成する乗算剰余演算処理に要する処理時間と所定の部分演算処理における前記乗算剰余演算処理の利用回数とに基づいて、前記空き時間内で処理可能なビット数を算出する算出手段と、
前記べき乗剰余演算処理の指数部分にあたる対象データから前記算出手段によって算出されたビット数分のビット列を抽出する抽出手段と、
前記抽出手段によって抽出されたビット列を与えて前記所定の部分演算処理を実行する実行手段と、
を備えることを特徴とする演算装置。 Detection means for detecting idle time until a response to be returned at regular intervals;
Based on the free time detected by the detecting means, the processing time required for the multiplication remainder calculation processing constituting the power residue calculation processing, and the number of times of use of the multiplication remainder calculation processing in a predetermined partial calculation processing, A calculation means for calculating the number of bits that can be processed;
Extraction means for extracting a bit string corresponding to the number of bits calculated by the calculation means from target data corresponding to an exponent part of the power-residue calculation process;
Execution means for giving the bit string extracted by the extraction means and executing the predetermined partial operation processing;
An arithmetic device comprising:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009223883A JP5387291B2 (en) | 2009-09-29 | 2009-09-29 | Arithmetic program, arithmetic method, and arithmetic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009223883A JP5387291B2 (en) | 2009-09-29 | 2009-09-29 | Arithmetic program, arithmetic method, and arithmetic device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2011075611A JP2011075611A (en) | 2011-04-14 |
| JP5387291B2 true JP5387291B2 (en) | 2014-01-15 |
Family
ID=44019707
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2009223883A Expired - Fee Related JP5387291B2 (en) | 2009-09-29 | 2009-09-29 | Arithmetic program, arithmetic method, and arithmetic device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5387291B2 (en) |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002358012A (en) * | 2001-03-28 | 2002-12-13 | Matsushita Electric Ind Co Ltd | Information security device, exponentiation operation device, exponentiation remainder operation device, and elliptic exponentiation operation device |
| JP3842641B2 (en) * | 2001-12-21 | 2006-11-08 | 富士通株式会社 | Arithmetic apparatus and method using coprocessor using Montgomery multiplication |
| JP2008276666A (en) * | 2007-05-07 | 2008-11-13 | Sony Corp | Information processing apparatus and method, and program |
| JP5441626B2 (en) * | 2009-11-06 | 2014-03-12 | 日立オートモティブシステムズ株式会社 | In-vehicle multi-app execution device |
-
2009
- 2009-09-29 JP JP2009223883A patent/JP5387291B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011075611A (en) | 2011-04-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6239661B2 (en) | Format maintenance based masking system and method | |
| KR100997555B1 (en) | Character input device | |
| US9323719B2 (en) | Mathematical expression input apparatus, mathematical expression modification method, and storage medium storing program | |
| WO2024255452A1 (en) | Data encryption and decryption method, data encryption and decryption apparatus, device, and medium | |
| CN117435855B (en) | Method for performing convolution operation, electronic device, and storage medium | |
| CN104145235A (en) | Techniques for input of a multi-character compound consonant or vowel and transliteration to another language using a touch computing device | |
| CN115567199B (en) | A random number seed generation method, device, electronic equipment and storage medium | |
| JP5387291B2 (en) | Arithmetic program, arithmetic method, and arithmetic device | |
| CN117873394A (en) | Data compression method, device, electronic device and readable storage medium | |
| EP3060981B1 (en) | Method and processor for executing instructions, method and apparatus for encoding instructions, and recording medium therefor | |
| JP7156376B2 (en) | OBSERVED EVENT DETERMINATION DEVICE, OBSERVED EVENT DETERMINATION METHOD, AND PROGRAM | |
| JP5603533B2 (en) | Prime number generating program, recording medium recording the program, prime number generating apparatus, and prime number generating method | |
| JP2022066067A (en) | Preparation and execution of quantified scaling on integrated circuit | |
| KR20140088945A (en) | Method and system of restoring characters deleted by backspace key | |
| JP7589804B2 (en) | Information processing device, conversion method and program | |
| KR101191408B1 (en) | Apparatus and method for character input of touch screen | |
| JP2552087B2 (en) | Decimal multiplication processor | |
| JP3686261B2 (en) | Computer, program conversion device, and program recording medium | |
| JP7087674B2 (en) | ID issuing device, ID issuing method, and program | |
| US20130132813A1 (en) | User interface element on mobile device for comb text field inputs | |
| CN117540669A (en) | Method and device for processing structured data of digital circuit | |
| JP5463699B2 (en) | Parallel processing support program, parallel processing support device, and parallel processing support method | |
| HK40061873A (en) | Instruction processing apparatus, method, computer equipment, and storage medium | |
| CN115220582A (en) | Text input method, equipment, device and storage medium for supporting backspace input method | |
| JP2007034927A (en) | Power arithmetic unit |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120605 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130910 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130923 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5387291 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |