明 細 書
プログラム変換装置及び秘密保持プログラム 技術分野
[0001] 本発明は、秘密情報を保持して実行するプログラムを、秘密情報を不正に解析す ることを困難にするプログラムに変換する技術に関する。
背景技術
[0002] 従来、秘密の要素を使用して処理を行うプログラムを、不正解析者に解析させたく ないという要求がある。このようなプログラムには、例えば、暗号プログラムがある。暗 号プログラムは、秘密情報である暗号鍵を用いて処理を行うが、これを解析されたく ないという要望がある。
また、例えば、画像に埋め込まれたコピー制御情報のウォーターマークの検出を行 うプログラムである。ウォーターマークの検出プログラムの処理が不正解析者によって 解析された場合、画像に埋め込まれたウォーターマークを除去するツールを作成さ れる恐れがある。よって、このようなプログラムは、不正解析者にとって解析困難であ ることが望まれる。そのような要望に対し、例えばプログラムを暗号ィ匕しておき、実行 時には復号して力もそのプログラムを実行するという方法がある。しかし、このような方 法を用いてもプログラムは実行時にメモリ上で平文となるため、メモリ上のプログラム を抜き取られて解析されるという脅威がある。このような脅威に対し、抜き取ったプログ ラムに含まれるプログラム命令群がどのような実行順序で実行されるかが解析困難で あれば、ウォーターマークを除去するツールを作成することは困難になる。
[0003] 従来、秘密の要素を使用して処理を行うプログラムの不正な解析 Z改ざんを防止 するための方法としてプログラムの制御構造 Z処理などを元のプログラムとは異なる 形式に変換することで制御構造を複雑にして、解析困難なプログラムにするプロダラ ム難読化の方法が考えられて ヽる (例えば非特許文献 1参照)。
非特許文献 1では、秘密情報を含むプログラム命令を、複数のプログラム命令群に 置き換えることでプログラムを難読ィ匕する方法が開示されている。例えば、「dO= 123 4」というプログラム命令において「1234」が被秘匿情報である場合、「dO= 1234」と
ヽぅプログラム命令を、「dO= 100」、「dO = dO X 2」、「dO = dO + 30」、「dO = dO+ l 000」、「d0 = d0+4」のようなプログラム命令群に置き換え、これらを分散して配置す ることが述べられている。このような方法を用いれば、プログラム中に存在する定数デ ータを収集しても、その中から被秘匿情報を見つけることができなくなる。
[0004] し力しながら、プログラムに含まれる各命令群の実行順序が知られてしまうと、不正 解析者は、その実行順序に従って、 dOの値を算出することにより被秘匿情報を見つ けることができる。
そこで、従来、プログラムの実行順序の解析を困難にする方法として、実行する命 令群を示す値に基づ ヽて分岐先を決定する分岐命令 (例えば、 switch文)と配列と を用いて、各命令群の実行順序を制御する方法がある (非特許文献 2)。このとき、ォ リジナルプログラムに含まれる複数の命令群 (例えば、命令群 1〜3であり、この順序 に実行される。)は、実行する命令群を示す値と 1対 1に対応付けられており、また、 命令群 1〜3の最後に、配列を用いた演算式により次に実行する命令群を示す値を 算出し、算出した値が、 switch文にて用いられる変数 Varに格納するプログラム命令 が挿入される。配列の個数を 10とすると、挿入されるプログラム命令の一例は、 Var =g[3] +g[4]である。
[0005] これにより、命令群 1〜3の配置順序を入れ替えても、 switch文により実行順序は、 正当なままで保たれている。また、命令群 1〜3の配置順序を入れ替えることで、オリ ジナルプログラムの構造の解析を困難にすることができる。つまり、ウォーターマーク の検出プログラムの解析や、被秘匿情報の取得を困難にすることができる。
非特許文献 1 :鴨志田、松本、井上、〃耐タンパ一ソフトウェアの構成手法に関する考 察"、 ISEC97- 59
非特干文献 2: Chenxi Wang、 A ecurity Architecture lor Survivabilit y Mechanisms", Ph. D. Dissertation (2000)
発明の開示
発明が解決しょうとする課題
[0006] し力しながら、各命令群の最後に挿入されるプログラム命令と配列に格納されてい る各データとは、例えば、コンピュータ装置の記憶領域力 取得される可能性がある
。そのため、各命令群の最後に挿入されるプログラム命令と配列に格納されている各 データとが、不正解析者に知られてしまうと、不正解析者は、 switch文にて用いられ る変数の値を取得し、オリジナルプログラムの制御構造を再構成することができ、オリ ジナルプログラムの解析を容易に行うことができる。
[0007] そこで、本発明は、不正解析者がオリジナルプログラムの解析を容易にすることが できな!/、秘密保持プログラムを生成するプログラム変換装置、前記秘密保持プロダラ ムを実行する秘密処理装置、変換方法、及び秘密処理方法を提供することを目的と する。
課題を解決するための手段
[0008] 上記目的を達成するために、本発明は、オリジナルプログラム力も秘密保持プログ ラムを生成するプログラム変換装置であって、オリジナルプログラムを取得するプログ ラム取得手段と、所定の順序で処理することにより、前記オリジナルプログラムと同一 の実行結果を出力し、異なる選択識別子が対応付けられる複数の選択対象データを 生成する選択対象データ生成手段と、複数の選択パラメータそれぞれに値を代入す る前処理命令群を生成する前処理命令群生成手段と、前記複数の選択パラメータを 用いた演算式に基づいて、次に処理される選択対象データを示す選択識別子を取 得する命令群を含む選択処理命令群を生成する選択処理命令群生成手段と、選択 パラメータの値に、過去に処理された選択対象データを示す選択識別子、又は前記 選択パラメータに過去に代入された 1つ以上の選択パラメータの値のうち少なくとも 1 つの選択パラメータの値を反映させる更新処理命令群を生成する更新処理命令群 生成手段と、前記前処理命令群と前記処理選択命令群と前記更新処理命令群と前 記複数の選択対象データとを含み、前記処理選択命令群を実行する処理と、前記 選択処理命令群により取得される選択識別子が示す選択対象データを処理する処 理と、前記選択対象データが処理されると前記更新処理命令群を実行する処理とを 繰り返す秘密保持プログラムを生成する秘密保持プログラム生成手段とを備えること を特徴とする。
発明の効果
[0009] 上記に示した構成によると、プログラム変換装置にて生成された秘密保持プロダラ
ムは、演算式の前記複数の選択パラメータを更新する際に、選択パラメータの値に、 過去に処理された選択対象データを示す選択識別子、又は前記演算式に過去に代 入された 1以上の選択パラメータの値のうち少なくとも 1の選択パラメータの値を反映 させている。従来は、次に実行すべきブロックを決定する際には、複数の固定値が格 納された配列を用いていたが、本発明のプログラム変換装置にて生成された秘密保 持プログラムは、次に実行すべきブロックを決定した後、常に、演算式に用いる選択 ノ メータを更新するので、複数の選択パラメータに格納される値は特定されに《な る。そのため、不正解析者がオリジナルプログラムの解析を容易にすることができな い。
[0010] ここで、前記所定の順序は、前記複数の選択パラメータに所定の初期値を与えて、 前記選択処理命令群及び前記更新処理命令群の実行を繰り返すことにより、順次算 出される選択識別子の順序であるとしてもょ ヽ。
この構成によると、プログラム変換装置は、各選択パラメータに所定の初期値を与 えた場合に、オリジナルプログラムと同一の実行結果を出力する秘密保持プログラム を生成することができる。
[0011] ここで、前記複数の選択対象データのそれぞれは、 1個以上のデータからなるとし てもよい。
この構成〖こよると、プログラム変換装置は、選択対象データをデータとして扱う秘密 保持プログラムを生成することができる。
ここで、前記オリジナルプログラムは、秘匿すべき秘密情報を有し、前記選択処理 命令群生成手段は、前記複数の選択パラメータを用いる第 1の演算式により前記選 択識別子を算出する命令群からなる選択処理命令群を生成し、前記更新処理命令 群生成手段は、算出された前記選択識別子にて示される選択対象データの値に基 づいて、前記複数の選択パラメータを更新する更新処理命令群を生成し、前記プロ グラム変換装置は、さらに、更新した複数の選択パラメータを用いた第 2の演算式に より、前記秘密情報と同一の値を算出する変遷処理命令群を生成する変遷処理命 令群生成手段を備え、前記秘密保持プログラム生成手段は、生成された変遷処理命 令群を、前記更新処理命令群の配置位置と、前記秘密情報の配置位置との間へ配
置し、及び前記秘密情報を前記変遷処理命令群で算出する処理に置換するとしても よい。
[0012] この構成〖こよると、プログラム変換装置にて生成された秘密保持プログラムは、秘密 情報と同一の値を算出する方法を、前記選択処理命令群、前記更新処理命令群、 及び前記変遷処理命令群により隠匿しているので、不正解析者は、秘密情報を解析 することが困難となる。
ここで、プログラム変換装置は、さらに、前記オリジナルプログラムを、 1つ以上のブ ロックに分割する分割手段を備え、前記複数の選択対象データのそれぞれは、異な るブロックを含むとしてもよ 、。
[0013] この構成によると、プログラム変換装置は、選択対象データをオリジナルプログラム 力も分割されたブロックとして扱う秘密保持プログラムを生成することができる。
ここで、前記複数の選択パラメータは、第 1から第 nの選択パラメータであり、前記更 新処理命令群生成手段は、前記複数の選択対象データのそれぞれに対して、第 j 1 (jは 2以上 n以下の整数)の選択パラメータに格納されている値を第 jの選択パラメ ータへ格納し、定数値を第 1の選択パラメータに格納する更新処理命令群を生成す るとしてちよい。
[0014] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、前記 演算式に過去に代入された 1以上の選択パラメータの値のうち少なくとも 1の選択パ ラメータの値を反映させて前記複数の選択パラメータの値を更新することができる。 ここで、前記選択対象データの個数は、前記ブロックの個数以上力 なる所定の数 であり、前記演算式は、前記第 1から第 nの選択パラメータのそれぞれに対して、 Pi X 第 iの選択パラメータ (iは 1以上 n以下の整数)を算出し、算出した結果それぞれを加 算し、加算結果に、前記所定の数をモジュロ値 Nとするモジュロ演算を施し、選択識 別子を算出し、 Piとモジュロ値 Nとは、互いに素であるとしてもよい。
[0015] この構成によると、プログラム変換装置は、演算式を用いて、選択対象データを確 実に決定することができる。
ここで、選択対象データ生成手段は、現時点までに前記演算式にて算出された選 択識別子それぞれを記憶する記憶部と、 1つのブロックに対して、 1つの値を選択し、
第 j 1 (jは 2以上 n以下の整数)の選択パラメータに格納されて ヽる値を第 jの選択パ ラメータへ格納し、選択した値を第 1の選択パラメータに格納して、前記演算式を実 行する実行部と、算出された算出値と同一の選択識別子が前記記憶部に記憶され ているカゝ否かを判断する判断部と、判断結果が否定的である場合には、前記選択さ れた 1つの値を、前記 1つのブロックに対する前記定数値と決定し、前記 1つのブロッ クを算出された算出値が示す選択対象データに格納する格納部と、判断結果が肯 定的である場合には、前記定数値が決定され、 1つのブロックが選択対象データに 格納されるまでの間、前記実行部と前記判断部とによる処理を繰り返すように制御す る繰返制御部とを備え、前記選択対象データ生成手段による処理は、全てのブロック に対して実行されるとしてちょ 、。
[0016] この構成によると、プログラム変換装置は、更新処理命令群の演算式を用いて、次 のブロックを格納する選択対象データを決定する場合に、これまでに格納されて!ヽな い選択対象データとなるように、前記複数の選択パラメータを更新することができる。 これにより、生成された秘密保持プログラムは、複数の選択パラメータを用いた演算 式により次に実行するべきブロックを確実に決定することができるので、オリジナルプ ログラムと同等の機能を提供することができる。
[0017] ここで、前記選択処理命令群生成手段は、未実行である選択対象データを示す識 別子を、常に取得する選択処理命令群を生成するとしてもよい。
この構成〖こよると、プログラム変換装置にて生成された秘密保持プログラムは、未実 行であるブロックを含む選択対象データを、常に取得することができる。また、秘密保 持プログラムは、選択処理命令群により、常に異なる選択対象データを次に実行す べき選択対象データとしているので、不正解析者は、正しい実行順序を特定すること が困難となる。
[0018] ここで、前記選択処理命令群生成手段は、未実行である選択対象データを示す識 別子を、前記複数の選択対象データのそれぞれにつ!、て実行済であるか否かを示 す管理情報を用いて取得する選択処理命令群を生成するとしてもよ ヽ。
この構成〖こよると、プログラム変換装置にて生成された秘密保持プログラムは、管理 情報を用いて、未実行であるブロックを含む選択対象データを、常に取得することが
できる。
[0019] ここで、前記複数の選択パラメータは、第 1から第 nの選択パラメータであり、前記管 理情報は、前記複数の選択対象データのそれぞれに対して、現時点における実行 済若しくは未実行の 、ずれかの状態を示す配列テーブルであり、前記選択対象デ ータの個数は、前記ブロックの個数以上力 なる所定の数であり、前記選択処理命 令群生成手段は、前記配列テーブルと、前記第 1から第 nの選択パラメータのそれぞ れに対して、 Pi X第 iの選択パラメータ (iは 1以上 n以下の整数)を算出し、算出した 結果それぞれを加算し、加算結果に、前記所定の数をモジュロ値 Nとするモジュロ演 算を施し、次に実行すべきブロックを含む選択対象データを示す仮の選択識別子を 算出する前記演算式と、前記算出式にて算出された前記仮の選択識別子が示す選 択対象データが、前記配列テーブルにおいて未実行であることを示す場合には、前 記仮の選択識別子を次に実行すべきブロックを含む選択対象データを示す真の選 択識別子とし、実行済であることを示す場合には、未実行である選択対象データを取 得するまで予め決められた選択順序に基づき仮の選択識別子の取得を行う取得プロ グラム命令群とを生成し、前記選択処理命令群は、前記配列テーブルと、前記演算 式と、前記取得プログラム命令群とを含み、 Piとモジュロ値 Nとは互いに素であるとし てもよい。
[0020] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、配列 テーブルを用いて、未実行であるブロックを含む選択対象データを確実に取得する ことができる。
ここで、前記更新処理命令群生成手段は、第 j (jは 2以上 n以下の整数)の選択パラ メータに格納されて 、る値を第 j - 1の選択パラメータへ格納し、前記選択処理命令 群にて取得された前記真の選択識別子を第 nの変数へ格納する前記更新処理命令 群を生成するとしてもよい。
[0021] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、選択 パラメータの更新の際には、常に、選択パラメータの値に、過去に処理された選択対 象データを示す選択識別子、又は前記演算式に過去に代入された 1以上の選択パ ラメータの値のうち少なくとも 1の選択パラメータの値を反映させているので、複数の
選択パラメータに格納される値は特定されに《なる。
[0022] ここで、前記演算式は、 1つの選択パラメータを示すインデックスを用いて、前記複 数の選択パラメータ力 前記 1つのパラメータを取得する第 1取得プログラム命令群 であり、前記管理情報は、前記複数の選択対象データのそれぞれに対して、現時点 における実行済若しくは未実行のいずれかの状態を示す配列テーブルであり、前記 選択処理命令群生成手段は、前記第 1取得プログラム命令群と、前記配列テーブル と、前記配列テーブルのうち未実行である 1つ以上の選択対象データを示す選択識 別子の配列順序に基づ 、て、前記取得プログラム命令群にて取得されたパラメータ の値にて示される順序に配置された選択識別子を取得する第 2取得プログラム命令 群とを生成し、前記選択処理命令群は、前記第 1取得プログラム命令群と、前記配列 テーブルと、前記第 2取得プログラム命令群とを含むとしてもよ 、。
[0023] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、イン デッタスを用いて、次に実行する選択対象データを示す選択識別子を取得すること ができる。
ここで、前記更新処理命令群生成手段は、前記インデックスの値をインクリメントす る前記更新処理命令群を生成するとしてもよ ヽ。
[0024] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、イン デッタスの更新をする。不正解析者が、ある 1のブロックを知ったとしても、インデック スの値が分力 ないため、次に実行すべきブロックが特定されることはない。そのため 、不正解析者がオリジナルプログラムの解析を容易にすることができな 、。
ここで、前記選択対象データの個数は、前記ブロックの個数以上力 なる所定の数 であり、前記複数の選択パラメータは、第 1から第 nのパラメータであり、前記管理情 報は、前記複数の選択対象データのそれぞれに対して、現時点における実行済若し くは未実行のいずれかの状態を示す配列テーブルであり、前記選択処理命令群生 成手段は、前記配列テーブルと、前記第 1から第 nの選択パラメータのそれぞれに対 して、 PiX第 iの選択パラメータ (iは 1以上 n以下の整数)を算出し、算出した結果そ れぞれを加算し、加算結果に、前記所定の数をモジュロ値 Nとするモジュロ演算を施 し、次に実行すべきブロックを含む選択対象データを示す値を算出する前記演算式
と、前記配列テーブルと同一のテーブルテーブル内において、未実行である 1っ以 上の選択対象データを示す選択識別子の配列順序に基づ!/、て、前記演算式にて算 出された前記値にて示される順序に配置された選択識別子を取得する取得プロダラ ム命令群とを生成し、前記選択処理命令群は、前記配列テーブルと、前記演算式と 、前記取得プログラム命令群とを含むとしてもよい。
[0025] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、未実 行であるブロックを含む選択対象データを確実に取得することができる。また、秘密 保持プログラムは、選択処理命令群により、常に異なる選択対象データを次に実行 すべき選択対象データとしているので、不正解析者は、正しい実行順序を特定する ことが困難となる。
ここで、前記選択対象データの個数は、前記ブロックの個数以上力 なる所定の数 であり、前記秘密保持プログラム生成手段は、さらに、前記複数のブロックのそれぞ れが選択対象データに含まれた後、ブロックを含まない 1つ以上の選択対象データ に、 1つ以上のプログラム命令を含む偽装ブロックを挿入するとしてもよい。
[0026] この構成によると、プログラム変換装置にて生成された秘密保持プログラムは、偽装 ブロックを含むので、不正解析者の解析を困難にすることができる。
また、本発明は、処理順序が定まった複数の選択対象データを処理することにより 、秘匿すべき秘密処理を実行する秘密処理装置であって、複数の選択パラメータの それぞれに値を代入する前処理実行手段と、前記複数の選択パラメータを用いた演 算式に基づ ヽて、次に処理される選択対象データを示す選択識別子を取得する選 択処理実行手段と、選択パラメータの値に、過去に処理された選択対象データを示 す選択識別子、又は前記選択パラメータに過去に代入された 1つ以上の選択パラメ ータの値のうち少なくとも 1つの選択パラメータの値を反映させる更新処理実行手段 と、前記選択処理実行手段にて取得された選択識別子が示す選択対象データを処 理する選択対象データ実行手段とを備え、前記秘密保持プログラムの終了とみなす まで、前記選択処理実行手段と、更新処理命令実行手段と、選択対象データ実行手 段とによる処理を繰り返すことを特徴とする。
[0027] この構成によると、秘密処理装置は、演算式の前記複数の選択パラメータを更新す
る際に、選択パラメータの値に、過去に処理された選択対象データを示す選択識別 子、又は前記演算式に過去に代入された 1以上の選択パラメータの値のうち少なくと も 1の選択パラメータの値を反映させている。従来は、次に実行すべきブロックを決定 する際には、複数の固定値が格納された配列を用いていたが、本発明の秘密処理 装置は、次に実行すべき選択対象データを決定した後、常に、演算式に用いる選択 ノ メータを更新するので、複数の選択パラメータに格納される値は特定されに《な る。そのため、不正解析者が秘密処理の解析を容易にすることができない。
[0028] ここで、前記複数の選択対象データのそれぞれは、 1個以上のデータからなるとし てもよい。
この構成によると、秘密処理装置は、選択対象データをデータとして扱うことができ る。
ここで、前記秘密処理は、秘匿すべき秘密情報を用いる代わりに、所定の処理を施 して前記秘密情報を算出する処理であり、前記選択処理実行手段は、前記複数の 選択パラメータを用いる演算式により前記選択識別子を算出し、前記更新処理実行 手段は、前記選択識別子にて示される選択対象データの値に基づいて、前記複数 の選択パラメータを更新し、前記秘密処理装置は、さらに、更新した複数の選択パラ メータを用いた前記所定の処理により、前記秘密情報と同一の値を算出する変遷処 理実行手段を備えるとしてもよい。
[0029] この構成によると、秘密処理装置は、秘密情報と同一の値を算出する方法を隠匿し ているので、不正解析者は、秘密情報を解析することが困難となる。
ここで、前記秘密処理は、外部装置により 1つ以上のブロックに分割されたオリジナ ルプログラムを実行する処理であり、前記ブロックは 1つ以上のプログラム命令を含み
、前記複数の選択対象データのそれぞれは、異なるブロックを含むとしてもよい。
[0030] この構成〖こよると、秘密処理装置は、選択対象データをオリジナルプログラムから分 割されたブロックとして扱うことができる。
ここで、前記複数の選択パラメータは、第 1から第 nの選択パラメータであり、前記更 新処理実行手段は、前記複数の選択対象データのそれぞれに対して、第 j l (jは 2 以上 n以下の整数)の選択パラメータに格納されている値を第 jの選択パラメータへ格
納し、定数値を第 1の選択パラメータに格納し、前記定数値は、前記演算式を用いて
、次に実行される選択対象データを示す選択識別子が算出されるように、前記外部 装置が前記秘密保持プログラム生成時に予め設定した値であるとしてもよい。
[0031] この構成によると、秘密処理装置は、前記演算式に過去に代入された 1以上の選 択パラメータの値のうち少なくとも 1の選択パラメータの値を反映させて前記複数の選 択パラメータの値を更新することができる。
ここで、前記選択対象データの個数は、前記ブロックの個数以上力 なる所定の数 であり、前記演算式は、前記第 1から第 nの選択パラメータのそれぞれに対して、 Pi X 第 iの選択パラメータ (iは 1以上 n以下の整数)を算出し、算出した結果それぞれを加 算し、加算結果に、前記所定の数をモジュロ値 Nとするモジュロ演算を施し、選択識 別子を算出し、 Piとモジュロ値 Nとは、互いに素であるとしてもよい。
[0032] この構成〖こよると、秘密処理装置は、演算式により、選択対象データを確実に決定 することができる。
ここで、前記選択処理実行手段は、未実行である選択対象データを示す識別子を 、常に取得するとしてもよい。
この構成〖こよると、秘密処理装置は、未実行であるブロックを含む選択対象データ を、常に取得することができる。また、秘密処理装置にて実行される秘密処理は、常 に異なる選択対象データを次に実行すべき選択対象データとしているので、不正解 析者は、正しい実行順序を特定することが困難となる。
[0033] ここで、前記選択処理実行手段は、未実行である選択対象データを示す識別子を 、前記複数の選択対象データのそれぞれにつ!、て実行済であるか否かを示す管理 情報を用いて取得するとしてもよ 、。
この構成〖こよると、秘密処理装置は、管理情報を用いて、未実行であるブロックを含 む選択対象データを、常に取得することができる。
[0034] ここで、前記複数の選択パラメータは、第 1から第 nの選択パラメータであり、前記選 択対象データの個数は、前記ブロックの個数以上力 なる所定の数であり、前記管 理情報は、前記複数の選択対象データのそれぞれに対して、現時点における実行 済若しくは未実行の!/、ずれの状態を示す配列テーブルであり、前記選択処理実行
手段は、前記配列テーブルを保持し、前記演算式は、前記第 1から第 nの選択パラメ ータのそれぞれに対して、 Pi X第 iの選択パラメータ (iは 1以上 n以下の整数)を算出 し、算出した結果それぞれを加算し、加算結果に、前記所定の数をモジュロ値 Nとす るモジュロ演算を施し、次に実行すべきブロックを含む選択対象データを示す仮の選 択識別子を算出する演算式であり、前記選択処理実行手段は、前記算出式にて算 出された前記仮の選択識別子が示す選択対象データが、前記配列テーブルにお ヽ て未実行であることを示す場合には、前記仮の選択識別子を次に実行すべきブロッ クを含む選択対象データを示す真の選択識別子とし、実行済であることを示す場合 には、未実行である選択対象データを取得するまで予め決められた選択順序に基づ き仮の選択識別子の取得を行 、、 Piとモジュロ値 Nとは互いに素であるとしてもょ 、。
[0035] この構成〖こよると、秘密処理装置は、配列テーブルを用いて、未実行であるブロック を含む選択対象データを確実に取得することができる。
ここで、前記更新処理実行手段は、第 j (jは 2以上 n以下の整数)の選択パラメータ に格納されて 、る値を第 j 1の選択パラメータへ格納し、前記選択処理実行手段に て取得された前記真の選択識別子を第 nの変数へ格納するとしてもよい。
[0036] この構成によると、秘密処理装置は、選択パラメータの更新の際には、常に、選択 パラメータの値に、過去に処理された選択対象データを示す選択識別子、又は前記 演算式に過去に代入された 1以上の選択パラメータの値のうち少なくとも 1の選択パ ラメータの値を反映させて 、るので、複数の選択パラメータに格納される値は特定さ れにくくなる。
ここで、前記管理情報は、前記複数の選択対象データのそれぞれに対して、現時 点における実行済若しくは未実行の 、ずれの状態を示す配列テーブルであり、前記 選択処理実行手段は、前記配列テーブルを保持し、 1つの選択パラメータを示すィ ンデッタスを用いて、前記複数の選択パラメータ力 前記 1の選択パラメータを取得 する前記演算式を実行する第 1取得部と、前記配列テーブルのうち未実行である 1つ 以上の選択対象データを示す選択識別子の配列順序に基づ!/ヽて、前記第 1取得部 にて取得された選択パラメータの値にて示される順序に配置された選択識別子を取 得する第 2取得部とを含むとしてもよ 、。
[0037] この構成〖こよると、秘密処理装置は、インデックスを用いて、次に実行する選択対象 データを示す選択識別子を取得することができる。
ここで、前記更新処理実行手段は、前記インデックスの値をインクリメントするとして ちょい。
この構成〖こよると、秘密処理装置は、インデックスの更新をする。不正解析者が、あ る 1のブロックを知ったとしても、インデックスの値が分からないため、次に実行すべき ブロックが特定されることはない。そのため、不正解析者がオリジナルプログラムの解 析を容易にすることができな 、。
[0038] ここで、前記選択対象データの個数は、前記ブロックの個数以上力 なる所定の数 であり、前記複数の選択パラメータは、第 1から第 nのパラメータであり、前記管理情 報は、前記複数の選択対象データのそれぞれに対して、現時点における実行済若し くは未実行の 、ずれの状態を示す配列テーブルであり、前記選択処理実行手段は、 前記配列テーブルを保持し、前記演算式は、前記第 1から第 nの選択パラメータのそ れぞれに対して、 PiX第 iの選択パラメータ (iは 1以上 n以下の整数)を算出し、算出 した結果それぞれを加算し、加算結果に、前記所定の数をモジュロ値 Nとするモジュ 口演算を施し、次に実行すべきブロックを含む選択対象データを示す仮の選択識別 子を算出する演算式であり、前記選択処理実行手段は、前記配列テーブルと同一の テーブルテーブル内にぉ ヽて、未実行である 1つ以上の選択対象データを示す選択 識別子の配列順序に基づいて、前記演算式にて算出された前記値にて示される順 序に配置された選択識別子を取得するとしてもよ ヽ。
[0039] この構成〖こよると、秘密処理装置は、未実行であるブロックを含む選択対象データ を確実に取得することができる。また、秘密処理装置にて実行される秘密処理は、常 に異なる選択対象データを次に実行すべき選択対象データとしているので、不正解 析者は、正しい実行順序を特定することが困難となる。
ここで、前記秘密処理は、前記外部装置により前記オリジナルプログラムから生成さ れた秘密保持プログラムを実行する処理であり、前記選択対象データの個数は、前 記ブロックの個数以上からなる所定の数であり、ブロックを含まない 1つ以上の選択対 象データには、 1つ以上のプログラム命令を含む偽装ブロックが含まれ、前記秘密保
持プログラムは、前記オリジナルプログラムより分割された各ブロックと、 1つ以上の偽 装ブロックとを含むとしてもよ 、。
[0040] この構成〖こよると、秘密処理装置にて実行される秘密保持プログラムは、偽装プロ ックを含むので、不正解析者の解析を困難にすることができる。
図面の簡単な説明
[0041] [図 1]秘密保持システム 1の構成を示すブロック図である。
[図 2]秘密保持プログラム 100の構造を示す図である。
[図 3]秘密保持プログラム 100の具体的なプログラムを示す図である。
[図 4]秘密保持プログラム 100を正常系で実行した場合の処理の動作を示す流れ図 である。
[図 5]プログラム難読ィ匕装置 10の構成を示すブロック図である。
[図 6]秘密保持プログラム生成部 203の構成を示すブロック図である。
[図 7]プログラム難読ィ匕装置 10の動作概要を示す流れ図である。
[図 8]選択対象データの生成処理の動作を示す流れ図である。図 9に続く。
[図 9]選択対象データの生成処理の動作を示す流れ図である。図 8から続く。
[図 10]秘密保持システム 2の構成を示すブロック図である。
[図 11]秘密保持プログラム 300の構造を示す図である。
[図 12]秘密保持プログラム 300を正常系で実行した場合の処理の動作を示す流れ 図である。
[図 13]プログラム難読ィ匕装置 30の構成を示すブロック図である。
[図 14]プログラム難読ィ匕装置 30の動作概要を示す流れ図である。
[図 15]秘密保持システム 3の構成を示すブロック図である。
[図 16]秘密保持プログラム 500の構造を示す図である。
[図 17]難読対象プログラムのコントロールフローを示す図である。
[図 18]秘密保持プログラム 500の各ブロックを模式的に記述した図である。
[図 19]秘密保持プログラム 500の具体的なプログラムを示す図である。
[図 20]秘密保持プログラム 500の各ブロックを C言語で記述した具体例を示す図であ る。
[図 21]秘密処理装置 60の構成を示すブロック図である。
[図 22]管理情報テーブル T700のデータ構造の一例を示す図である。
[図 23]制御部 700の構成を示すブロック図である。
[図 24]秘密処理装置 60の動作を示す流れ図である。
[図 25]プログラム難読ィ匕装置 50の構成を示すブロック図である。
[図 26]配置順序決定部 804の構成を示すブロック図である。
圆 27]プログラム難読ィ匕装置 50の動作概要を示す流れ図である。
[図 28]配置決定処理の動作を示す流れ図である。
圆 29]初期値算出処理の動作を示す流れ図である。
圆 30]機能提供命令群 1〜3の実行順序を示す図である。
[図 31]選択処理部 722bの構成を示すブロック図である。
圆 32]選択識別子取得処理の動作を示す流れ図である。
[図 33]難読ィ匕対象プログラムのコントロールフローを示す図である。
[図 34]プログラム難読ィ匕装置 50cの構成を示すブロック図である。
[図 35]図 33に示すコントロールフローを、生成した 3つの機能提供命令群に置き換え たコントロールフローを示す図である。
[図 36]各機能提供命令群を展開したプログラムのコントロールフローを示す図である
[図 37]配置順序決定部 804cの構成を示すブロック図である。
[図 38]秘密保持プログラム 1800の構造を示す図である。
[図 39]配置順序決定部 804dの動作を示す流れ図である。
[図 40]秘密保持プログラム 500eの各ブロックを C言語で記述した具体例を示す図で ある。
[図 41]秘密保持プログラム 2000の構造を示す図である。
[図 42]秘密保持プログラム 2000の動作の具体例を示す流れ図である。
[図 43]プログラム難読ィ匕装置 1010の構成を示すブロック図である。
[図 44]配置決定処理の動作を示す流れ図である。
[図 45]秘密保持プログラム 2200の構造を示す図である。
[図 46]秘密保持プログラム 2200の動作の具体例を示す流れ図である。
[図 47]プログラム難読ィ匕装置 3010の構成を示すブロック図である。
[図 48]配置決定処理の動作を示す流れ図である。
符号の説明
1 秘密保持システム
10 プログラム難読ィ匕装置
20 プログラム実行装置
100 秘密保持プログラム
200 入力部
201 機能提供命令群生成部
202 偽装機能提供命令群生成部
203 秘密保持プログラム生成部
2 秘密保持システム
30 プログラム難読ィ匕装置
40 プログラム実行装置
300 秘密保持プログラム
400 入力部
401 機能提供命令群生成部
402 変遷処理命令群生成部
403 秘密保持プログラム生成部
3 秘密保持システム
50 プログラム難読ィ匕装置
60 秘密処理装置
500 秘密保持プログラム
700 制御部
701 n己' 1思 ρβ
702 第 1プログラム記憶部
703 第 2プログラム記憶部
704 管理情報保持部
705 選択パラメータ群保持部
800 プログラム記憶部
801 入力部
802 機能提供命令群生成部
803 偽装機能提供命令群生成部
804 配置順序決定部
805 管理命令群生成部
806 秘密保持プログラム生成部
807 出力部
1010 プログラム難読ィ匕装置
1020 秘密処理装置
2000 秘密保持プログラム
2200 秘密保持プログラム
3010 プログラム難読ィ匕装置
3020 秘密処理装置
発明を実施するための最良の形態
[0043] 1.第 1の実施の形態
以下、本発明に係る第 1の実施の形態としての秘密保持プログラム 100及びプログ ラム難読ィ匕装置 10について、図面を参照して説明する。
1. 1 秘密保持システム 1の概要
秘密保持システム 1は、図 1に示すように、プログラム難読化装置 10と、プログラム 実行装置 20とから構成されて ヽる。
[0044] プログラム難読ィ匕装置 10は、実行順序を秘密にしたい難読ィ匕対象プログラムから 秘密保持プログラム 100を生成し、生成した秘密保持プログラム 100をプログラム実 行装置 20へ配布する。
プログラム実行装置 20は、プログラム難読ィ匕装置 10から配布された秘密保持プロ グラム 100を実行する。
[0045] ここで、難読化対象プログラムは、命令群 A、命令群 B、命令群 Cの 3つの命令群か ら構成されており、命令群 A、 B、 Cの順に実行することにより正しく動作するものとす る。
1. 2 秘密保持プログラム 100の構造
ここでは、プログラム難読ィ匕装置 10にて生成され、プログラム実行装置 20にて実行 される秘密保持プログラム 100のプログラム構造について説明する。
[0046] 秘密保持プログラム 100は、秘密の要素を使用して処理を行うプログラムであり、プ ログラムに含まれるプログラム命令群がどのような実行順序で実行されるかを、不正 解析者に解析されたくないプログラムである。例えば、ウォーターマーク検出プロダラ ムゃ、非特許文献 1で述べられている方法で、秘密情報を扱うプログラム命令を別の プログラム命令群に置き換えて、それらを分散して配置したプログラムである。後者に ついては、置き換えたプログラム命令群を不正解析者が収集し、正しい順番で実行 すれば秘密情報の値が算出できるので、実行経路を分力り難くしたい。
[0047] 秘密保持プログラム 100は、おおまかにはプログラムに含まれる複数の選択対象デ ータ 140〜 146がどのような実行順序で実行されるかが解析困難なプログラムである 。なお、選択対象データ 140〜146には、正常系の実行時には実行されることのな い選択対象データも含まれている。実行されることのない選択対象データは、正しい 実行順序を知らな ヽ不正解析者が、考えうる実行順序の組み合わせ数を多くするた めに組み込まれている。ここで、正常系の実行とは、デバッガ等を用いてプログラム力 ゥンタや選択パラメータを強制的に変更するなどの特別な操作を行わないで処理を することである。秘密保持プログラム 100は、図 2に示すように、前処理命令群 110、 選択処理命令群 120、変遷処理命令群 130、選択対象データ 140、 141、 · · ·、 146 から構成され、これらが図 2に示す順番に配置されている。
[0048] 秘密保持プログラム 100は、呼出元のプログラムから、 32ビットの入力値 inl、 in2、 in3、および、このプログラムが提供する機能の処理を行う際に使用するパラメータを 受け取る。
秘密保持プログラム 100は、選択処理命令群 120での処理に用いる複数の選択パ ラメータの各値 (ここでは、 3つの値)を保持する 32ビットの第 1、第 2及び第 3の選択
パラメータ用変数と、選択識別子を保持する 32ビットの選択識別子用変数を用いて 処理を行う。ここで、選択パラメータは、選択対象データ 140、 141、 · · ·、 146から 1 の選択対象を決定する際に、使用されるパラメータであり、選択識別子は、選択対象 データを一意に識別する識別子である。
[0049] ここでは、秘密保持プログラム 100が実際に使用される際に呼出元のプログラムか ら受け取る入力値 inl、in2、in3は値「1」、「2」、「3」であるとする。本実施の形態で 提供する秘密保持プログラム 100は、呼出元のプログラム力も受け取る値を用いれば 、(選択対象主要命令群を含む)選択対象データを正 ヽ順番に実行できるプロダラ ムであって、呼出元のプログラム力 受け取る値を知ることができな 、不正解析者に とっては、(選択対象主要命令群を含む)選択対象データの実行順序を知ることが困 難なプログラムである。
[0050] 1. 2. 1 前処理命令群 110
前処理命令群 110は、選択処理命令群 120で用 、る選択パラメータ群の初期値を 算出するプログラム命令群である。ここで、選択パラメータ群は、第 1、第 2及び第 3の 選択パラメータ用変数力もなる。
前処理命令群 110は、秘密保持プログラム 100が起動された際に、最初に実行さ れるプログラム命令群である。
[0051] 前処理命令群 110は、呼び出し元のプログラムから 32ビットの入力値 inl、 in2、 in 3を受け取り、受け取った値を選択パラメータ群の初期値として選択パラメータ用変数 に格納する第 1の前処理プログラム命令群と、選択処理命令群 120に分岐する第 2 の前処理プログラム命令群とからなり、これらを順に行う。
具体的には、第 1の前処理プログラム命令群は、第 1〜3の選択パラメータ用変数 にそれぞれ、 inl、 in2、 in3の値を格納する。正常系の実行時には、第 1の前処理プ ログラム命令群は、入力値 inl、in2、in3として、それぞれ値「1」、「2」、「3」を受け取 り、第 1〜3の選択パラメータ用変数にそれぞれ値「1」、「2」、「3」を格納する処理を 行う。
[0052] 第 2の前処理プログラム命令群は、例えば、 C言語で記述されるプログラムにお 、て 選択処理命令群 120の先頭にラベル「label 120 :」が挿入されている場合には、プ
ログラム命令「goto label— 120;」で表されるプログラム命令である。
なお、前処理命令群 110の直後に選択処理命令群 120が配置されている場合に は、プログラム命令「goto label— 120;」がなくても構わな!/ヽ。この場合、前処理命 令群 110は、第 1の前処理プログラム命令群のみ力も構成されることになる。
[0053] 1. 2. 2 選択処理命令群 120
選択処理命令群 120は、選択パラメータ群に基づき、選択対象データ 140〜146 から 1つを選択し選択識別子とするプログラム命令群である。
選択処理命令群 120は、選択パラメータ群を用いて、選択識別子を算出する第 1の 選択処理プログラム命令群と、変遷処理命令群 130に分岐する第 2の選択処理プロ グラム命令群力 なり、これらを順に行う。なお、選択識別子は後述の変遷処理命令 群で使用する値である。
[0054] 第 1の選択処理プログラム命令群について、具体例を用いて、以下に説明する。第 1の選択処理プログラム命令群は、 pi X (第 1の選択パラメータ用変数) +p2 X (第 2 の選択パラメータ用変数) +p3 X (第 3の選択パラメータ用変数) mod NNを算出 し、算出した値を選択識別子用変数に格納するプログラム命令の集まりである。 NN は選択対象データの数とする。また、 pl、 p2、 p3は、それぞれ NNと互いに素な素数 であって、 NNを法とした場合にそれぞれ異なる値となる数とする。なお、 NNを素数 とし、 pl、 p2、 p3をそれぞれ NN未満の互いに異なる素数としてもよい。ここで演算 子「X」は掛け算を表す。ここでは、 pl、 p2、 p2、 NNをそれぞれ、値「2」、「3」、「5」、 「7」とし、式 1「2 X (第 1の選択パラメータ用変数) + 3 X (第 2の選択パラメータ用変 数) + 5 X (第 3の選択パラメータ用変数) MOD 7」を算出するプログラム命令群で あるとする。
[0055] なお、変遷処理命令群 130に分岐するプログラム命令群については、前処理命令 群 110で述べた第 2の前処理プログラム命令群と同様で、分岐先が変遷処理命令群 130になったものである。
1. 2. 3 変遷処理命令群 130
変遷処理命令群 130は、選択処理命令群 120で算出した選択識別子に基づき、 いずれかの選択対象データ 140〜 146に分岐する処理を行うプログラム命令群であ
る。
[0056] 具体的には、選択識別子用変数の値が、 0、 1、 · · ·、 6の場合にそれぞれ、選択対 象データ 140、 141、 · · ·、 146への分岐を行うプログラム命令群である。
例えば、秘密保持プログラム 100が記述されるプログラムが C言語のプログラムとし 、選択対象データ 140、 141、 · · ·、 146の先頭に、それぞれラベル「label— 140 :」、 「label— 141 :」、 · · ·、「label— 146 :」があるとすると、変遷処理命令群 130は以下 のようなプログラム命令となる。
[0057] 「
switch (選択識別子用変数) {
case 0 : goto label― 140 ;
case 1 : goto label― 141; case 6: goto label― 146; J
1. 2. 4 選択対象データ 140〜146
選択対象データ 140〜146は、変遷処理命令群 130により分岐してきた際に、実 行されるプログラム命令群である。
[0058] 選択対象データ 140〜146は、それぞれ、選択対象主要命令群 150〜156、更新 処理命令群 160〜166、分岐命令群 170〜176からなり、これらは図 2に示す順番 に配置されている。各命令群は、 1以上のプログラム命令力もなるプログラム命令群 である。
ここでは、選択対象データ 140の構成内容について説明する。なお、選択対象デ ータ 141〜146については、選択対象データ 140の構成内容と同様であるため、説 明は省略する。
[0059] ( 1 )選択対象主要命令群 150
選択対象主要命令群 150は、このプログラムが提供する機能 (例えばウォーターマ ーク検出の機能)の処理の一部を行うプログラム命令群である力、あるいは、提供す
る機能とは無関係であり、正常系での実行時 (以降、正常系の実行時)には実行され ない命令群である。
[0060] 本実施例では、正常系の実行時には、選択対象主要命令群 152、 154、 156の順 番で実行されることで、この秘密保持プログラムが提供する機能の処理を行う。すな わち、選択対象主要命令群 152、 154、 156は、難読化対象プログラムが提供する 機能の処理の一部を含むプログラム命令群であり、選択対象主要命令群 152、 154 、 156のそれぞれは、順に命令群 A、 B、 Cと同一のものである。
[0061] また、選択対象主要命令群 150、 151、 153、 155は、提供する機能とは無関係な 処理が含まれるプログラム命令群である。以降の説明では、選択対象主要命令群 15 2、 154, 156の命令群であって、秘密保持プログラムが提供する機能の一部である 命令群をそれぞれ機能提供命令群 1〜3と呼ぶ。また、選択対象主要命令群 150、 1 51、 153、 155に含まれる正常系の実行時には実行されない命令群を偽装機能提 供命令群と呼ぶ。
[0062] 本実施例では、デバッガ等を用いてプログラムカウンタや選択パラメータを強制的 に変更するなどの特別な操作を行わない正常系での実行時 (以降、正常系の実行 時)には、前処理命令群 110で選択パラメータ用変数 1〜3にそれぞれ初期値「1」、「 2」、「3」が格納されて、以降説明する処理に乗っ取って、選択対象主要命令群 152 、 154、 156が順番に実行されることとなる。正確には、途中、更新処理命令群などの 処理が行われている。
[0063] (2)更新処理命令群 160
更新処理命令群 160は、選択パラメータ群の値の更新を行うプログラム命令群であ る。
更新処理命令群 160は、選択パラメータ群の値の更新に用いる定数値を予め有し ている。更新処理命令群 160は、正当な選択パラメータ群を受け取った場合には、 受け取った選択パラメータ群と定数値とを用いて、選択処理命令群 120が次処理とし て正当な選択対象を選択することができる新たな選択パラメータ群を生成する。
[0064] ここで、生成方法の一例を以下に示す。
更新処理命令群 160は、第 2の選択パラメータ用変数の値を第 3の選択パラメータ
用変数に格納し、第 1の選択パラメータ用変数の値を第 2の選択パラメータ用変数に 格納し、選択パラメータ用変数 1に予め有している定数値を代入して、新たな選択パ ラメータを生成する。
[0065] 定数値は、これらの第 1〜第 3の選択パラメータ用変数の値「(定数値)」、「x」、「y」 を選択処理命令群 120の式 1に代入して得られる選択識別子が、これまでに選択さ れた 1以上の選択対象データを示さない値である。もし、これが、これまでに選択され た 1の選択対象データになる値であるとすると、当該選択対象データが連続して無限 ループを行う処理となってしまうからである。
[0066] ここで、更新処理命令群 160〜166のそれぞれが有する定数値の具体例を、以下 に示す。
秘密保持プログラム 100は、上述したように、選択対象主要命令群 152、 154、 15 6の順番で実行されることで、この秘密保持プログラムが提供する機能の処理を行う。
[0067] 選択対象主要命令群 152が実行された後、更新処理命令群 162は、第 2の選択パ ラメータ用変数の値「2」を第 3の選択パラメータ用変数に格納し、第 1の選択パラメ一 タ用変数の値「1」を第 2の選択パラメータ用変数に格納する。このとき、更新処理命 令群 162が有する定数値 Aを「6」とすることで、選択処理命令群 120は、次の正当な 処理として、選択対象データ 144を選択することができる。
[0068] 次に、選択対象主要命令群 154が実行された後、更新処理命令群 164は、第 2の 選択パラメータ用変数の値「1」を第 3の選択パラメータ用変数に格納し、第 1の選択 ノ メータ用変数の値「6」を第 2の選択パラメータ用変数に格納する。このとき、更新 処理命令群 164が有する定数値 Bを「2」とすることで、選択処理命令群 120は、次の 正当な処理として、選択対象データ 146を選択することができる。
[0069] 次に、選択対象主要命令群 156が実行された後、更新処理命令群 166は、第 2の 選択パラメータ用変数の値「6」を第 3の選択パラメータ用変数に格納し、第 1の選択 ノ メータ用変数の値「2」を第 2の選択パラメータ用変数に格納する。このとき、更新 処理命令群 164が有する定数値 Bを「0」とすることで、選択処理命令群 120は、これ までに実行された選択対象データ 142、 144、 146以外の選択対象データを指定す ることがでさる。
[0070] 正常系の動作では実行されることない、選択対象データ 140、 141、 143、 145の 更新処理命令群 160、 161、 163、 165には、値「0」から「6」のうち未使用である値を 重複しないように、選択する。ここでは、更新処理命令群 160、 161、 163、 165のそ れぞれには、値「1」、「3」、「4」、「5」とする。
(3)分岐命令群 170
分岐命令群 170は、選択処理命令群 120へ分岐するプログラム命令群や、プログ ラム呼出元に制御を戻す処理のプログラム命令群である。
[0071] 1. 2. 5 秘密保持プログラム 100の具体例
秘密保持プログラム 100の具体例として、 C言語にて記述した秘密保持プログラム 1 00aを図 3に示す。ここで、演算子「*」は掛け算を表す。
プログラム命令群 11 Oaは前処理命令群 110に対応し、プログラム命令群 120aは 選択処理命令群 120に対応し、プログラム命令群 130aは変遷処理命令群 130に対 応している。また、プログラム命令群 140a、 142a, 143a, 146aのそれぞれは、選択 対象データ 140、 142、 143、 146と対応して!/ヽる。
[0072] プログラム命令群 150a、 152a, 153a, 156aのそれぞれは、選択対象主要命令群 150、 152、 153、 156と対応して!/ヽる。プログラム命令群 160a、 162a, 163a, 166 aのそれぞれは、更新処理命令群 160、 162、 163、 166と対応している。また、プロ グラム命令群 170a、 172a, 173a, 176aのそれぞれは、分岐命令群 170、 172、 17 3、 176と対応している。なお、選択対象データ 141、 144、 145に対応する具体例は 、図面の都合上記述していない。
[0073] 1. 3 秘密保持プログラム 100の実行
プログラム実行装置 20が、秘密保持プログラム 100を正常系で実行した場合の処 理について、図 4に示す流れ図を用いて説明する。
秘密保持プログラム 100は、前処理命令群 110の処理を行う(ステップ S5)。具体 的には、前処理命令群 110は、入力値 inl、 in2、 in3として、それぞれ値「1」、「2」、「 3」を受け取り、第 1〜3の選択パラメータ用変数にそれぞれ値「1」、「2」、「3」を格納 する処理を行い、選択処理命令群 120へ分岐する。
[0074] 次に、秘密保持プログラム 100は、受け取った入力値「1」、「2」、「3」を用いて、選
択処理命令群 120の処理を行う(ステップ S10)。具体的には、選択処理命令群 120 は、式 1「2 X (第 1の選択パラメータ用変数( = 1) ) + 3 X (第 2の選択パラメータ用変 数( = 2) ) + 5 X (第 3の選択パラメータ用変数( = 3) ) MOD 7」により値「2」を算 出し、算出した値「2」を選択識別子用変数に格納し、変遷処理命令群 130へ分岐す る。
[0075] 秘密保持プログラム 100は、選択識別子用変数( = 2)を用いて、変遷処理命令群 130の処理を行う(ステップ S15)。具体的には、変遷処理命令群 130は、選択処理 命令群 120で算出した選択識別子「2」に基づいて、選択対象データ 142に分岐す る。
秘密保持プログラム 100は、変遷処理命令群 130の分岐命令に従って、選択対象 データ 142の選択対象主要命令群 152の処理を行う(ステップ S20)。具体的には、 選択対象主要命令群 152は、難読化対象プログラムにおける命令群 Aを実行する。
[0076] 次に、秘密保持プログラム 100は、更新処理命令群 162の処理を行う (ステップ S2 5)。具体的には、更新処理命令群 162は、第 2の選択パラメータ用変数の値を第 3 の選択パラメータ用変数に格納し、第 1の選択パラメータ用変数の値を第 2の選択パ ラメータ用変数に格納し、第 1の選択パラメータ用変数に定数値 A (=「6」)を代入す る処理を行うプログラム命令群である。ここでは、第 1〜第 3の選択パラメータ用変数 のそれぞれは初期値「1」、「2」、「3」であるので、更新処理命令群 162は、第 1〜第 3 の選択パラメータ用変数のそれぞれに値「定数値 A( = 6)」、「1」、「2」を代入する。
[0077] 次に、秘密保持プログラム 100は、分岐命令群 172の処理を行う (ステップ S30)。
具体的には、分岐命令群 172は、選択処理命令群 120へ分岐する。
次に、秘密保持プログラム 100は、更新された選択パラメータ群 (値「6」、「1」、「2」 )を用いて、選択処理命令群 120の処理を行う (ステップ S35)。具体的には、選択処 理命令群 120は、式 1「2 X (第 1の選択パラメータ用変数( = 6) ) + 3 X (第 2の選択 パラメータ用変数( = 1) ) + 5 X (第 3の選択パラメータ用変数( = 2) ) MOD 7」に より値「4」を算出し、算出した値「4」を選択識別子用変数に格納し、変遷処理命令群 130へ分岐する。
[0078] 秘密保持プログラム 100は、選択識別子用変数(=4)を用いて、変遷処理命令群
130の処理を行う(ステップ S40)。具体的には、変遷処理命令群 130は、選択処理 命令群 120で算出した選択識別子「4」に基づいて、選択対象データ 144に分岐す る。
秘密保持プログラム 100は、変遷処理命令群 130の分岐命令に従って、選択対象 データ 144の選択対象主要命令群 154の処理を行う(ステップ S45)。具体的には、 選択対象主要命令群 154は、難読化対象プログラムにおける命令群 Bを実行する。
[0079] 次に、秘密保持プログラム 100は、更新処理命令群 164の処理を行う(ステップ S5 0)。具体的には、更新処理命令群 164は、第 2の選択パラメータ用変数の値を第 3 の選択パラメータ用変数に格納し、第 1の選択パラメータ用変数の値を第 2の選択パ ラメータ用変数に格納し、第 1の選択パラメータ用変数に定数値 B (=「2」)を代入す る処理を行うプログラム命令群である。ここでは、第 1〜第 3の選択パラメータ用変数 のそれぞれは初期値「6」、「1」、「2」であるので、更新処理命令群 164は、第 1〜第 3 の選択パラメータ用変数のそれぞれに値「定数値 B ( = 2)」、「6」、「1」を代入する。
[0080] 次に、秘密保持プログラム 100は、分岐命令群 174の処理を行う(ステップ S55)。
具体的には、分岐命令群 174は、選択処理命令群 120へ分岐する。
次に、秘密保持プログラム 100は、更新された選択パラメータ群 (値「2」、「6」、「1」 )を用いて、選択処理命令群 120の処理を行う (ステップ S60)。具体的には、選択処 理命令群 120は、式 1「2 X (第 1の選択パラメータ用変数( = 2) ) + 3 X (第 2の選択 パラメータ用変数( = 6) ) + 5 X (第 3の選択パラメータ用変数( = 1) ) MOD 7」に より値「6」を算出し、算出した値「6」を選択識別子用変数に格納し、変遷処理命令群 130へ分岐する。
[0081] 秘密保持プログラム 100は、選択識別子用変数( = 6)を用いて、変遷処理命令群 130の処理を行う(ステップ S65)。具体的には、変遷処理命令群 130は、選択処理 命令群 120で算出した選択識別子「6」に基づいて、選択対象データ 146に分岐す る。
秘密保持プログラム 100は、変遷処理命令群 130の分岐命令に従って、選択対象 データ 146の選択対象主要命令群 156の処理を行う(ステップ S70)。具体的には、 選択対象主要命令群 156は、難読化対象プログラムにおける命令群 Cを実行する。
[0082] 次に、秘密保持プログラム 100は、更新処理命令群 166の処理を行う (ステップ S7 5)。具体的には、更新処理命令群 166は、第 2の選択パラメータ用変数の値を第 3 の選択パラメータ用変数に格納し、第 1の選択パラメータ用変数の値を第 2の選択パ ラメータ用変数に格納し、第 1の選択パラメータ用変数に定数値 C (=「0」)を代入す る処理を行うプログラム命令群である。ここでは、第 1〜第 3の選択パラメータ用変数 のそれぞれは初期値「2」、「6」、「1」であるので、更新処理命令群 164は、第 1〜第 3 の選択パラメータ用変数のそれぞれに値「定数値 C ( = 0)」、「2」、「6」を代入する。
[0083] 次に、秘密保持プログラム 100は、分岐命令群 176の処理を行う(ステップ S80)。
具体的には、分岐命令群 176は、呼出元のプログラムへ制御を返す処理を行う(選 択対象データ 146は、最後に実行される選択対象データなので、選択処理命令群 1 20に分岐する必要はない)。例えば、 C言語のプログラムでは return文がこの処理 に対応する。
[0084] なお、ここでは、動作の主体を秘密保持プログラム 100としている力 実際には、プ ログラム実行装置 20が秘密保持プログラム 100を実行することにより、上記の動作が 実現できる。つまり、動作の主体を、秘密保持プログラム 100からプログラム実行装置 20へと置き換えてもよい。
1. 4 プログラム難読化装置 10
ここでは、実行順序を隠蔽した 、難読ィ匕対象プログラム力も秘密保持プログラム 10 0を生成するプログラム難読化装置 10につ ヽて述べる。秘密保持プログラム 100〖こ おいて、選択対象主要命令群 150〜156に含まれる機能提供命令群および偽装機 能提供命令群以外の各部は、どのような難読化対象プログラムに対しても共通して 用いることができる。ここでは、機能提供命令群の生成、偽装機能提供命令群の生 成について中心に述べる。
[0085] プログラム難読ィ匕装置 10は、図 5に示すように、入力部 200、機能提供命令群生成 部 201と、偽装機能提供命令群生成部 202と、秘密保持プログラム生成部 203とか ら構成されている。
プログラム難読化装置 10は、具体的には、マイクロプロセッサ、 ROM、 RAM、ノヽ ードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコン
ピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビユー タプログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を達成 するために、コンピュータに対する指令を示す命令コードが複数個組み合わされて 構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラムに従つ て動作することにより、プログラム難読ィ匕装置 10は、その機能を達成する。つまり、前 記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1個ずつ読 み出し、読み出した命令を解読し、解読結果に従って動作する。
[0086] 1. 4. 1 入力部 200
難読化対象のプログラムと、秘密保持プログラム 100を正常系にて実行する際、秘 密保持プログラム 100に与える 3つの初期値 (ここでは、「1」、「2」、「3」)を受け付け る。
1. 4. 2 機能提供命令群生成部 201
機能提供命令群生成部 201は、入力部 200にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力 なる複数のブロックに分割して複数の機能提供命令群 を生成する。なお、難読化対象プログラムに無条件飛び越し、条件飛び越しが含ま れる場合には、飛び越しを行うプログラム命令と飛び越し先のプログラム命令は同じ ブロックに含まれるように分割を行う。なお、コンパイラに関する用語は被特許文献 2 、 3に述べられている。
[0087] ここでは、分割した各部に含まれる命令数が出来るだけ均等になるように 3つのプロ ックに分割し、 3つの機能提供命令群を生成する。生成した機能提供命令群は、元と なったプログラム命令群が難読ィ匕対象プログラムにおいて始まりの方にあった順に機 能提供命令群 1〜3とする。
1. 4. 3 偽装機能提供命令群生成部 202
偽装機能提供命令群生成部 202は、難読化対象プログラムが記述されて!ヽるプロ グラミング言語で記述された 1以上のプログラム命令をランダムに組み合わせた偽装 機能提供命令群を複数個生成する。
[0088] なお、難読化対象プログラムに含まれて!/、るプログラム命令のみを用いてランダム あるいは手動で偽装機能提供命令群を生成しても構わな ヽ。このよう〖こすることで、
偽装機能提供命令群と難読化対象プログラムに元から含まれている命令とを区別す ることを困難にすることができ、解析を困難にすることができる。また、 C言語、 Java ( 登録商標)言語などのコンパイル処理を行うプログラミング言語にぉ ヽては、偽装機 能提供命令群生成部 202は、コンパイルが通るように難読化対象プログラムで使わ れている変数を用いて偽装機能提供命令群を生成する。または、難読化対象プログ ラムで使われて 、な 、変数を偽装機能提供命令群に含める場合には、偽装機能提 供命令群生成部 202は、難読ィ匕後のプログラムに、そのような変数の宣言を追加す る。なお、 C言語に関する用語、変数の宣言の仕方などについては、公知のプロダラ ミング言語 (C言語)の仕様であるので、ここでの説明は省略する。 Java (登録商標) に関する用語は、変数の宣言の仕方などについては、公知のプログラミング言語 Cia va (登録商標))の仕様であるので、ここでの説明は省略する。ここでは、偽装機能提 供命令群生成部 202は、 4つの偽装機能提供命令群を生成する。
[0089] 1. 4. 4 秘密保持プログラム生成部 203
秘密保持プログラム生成部 203は、複数の機能提供命令群、及び複数の偽装機 能提供命令群を用いて、前処理命令群 110、選択処理命令群 120、変遷処理命令 群 130、選択対象データ 140、 141、 · · ·、 146を生成することにより、秘密保持プロ グラム 100を生成する。
[0090] 秘密保持プログラム生成部 203は、図 6に示すように、プログラム記憶部 210、位置 記憶部 211、ブロック選択部 212、ブロック配置部 213、決定部 214、及び挿入部 21 5を有している。
プログラム記憶部 210は、生成された各命令群及び選択対象データを記憶する領 域を有している。
[0091] 位置記憶部 211は、各選択対象主要命令群が配置された位置を示す情報を記憶 するための領域を有している。例えば、値「2」が位置記憶部 211に格納されている場 合には、選択対象データ 142には、既に、 1の機能提供命令群、又は 1の偽装機能 提供命令群が挿入されて 、ることを示す。
ブロック選択部 212は、難読対象プログラムから、次に配置すべきブロック (機能提 供命令群)を選択する。
[0092] ブロック配置部 213は、式 1を用いて、選択された前記ブロックの配置位置を算出し 、前記中間プログラム内において、算出した前記配置位置に、選択された前記ブロッ クを配置する。
決定部 214は、位置記憶部 211に記憶されて ヽる前記配置位置以外の配置位置 が算出されるように、前記変数に代入すべき代入値を決定する。
[0093] 挿入部 215は、決定された代入値を前記変数に代入するプログラム命令群(更新 処理命令群)を生成し、配置された前記ブロックの直後に、生成した前記プログラム 命令群を挿入する。
(1)前処理命令群 110の生成
秘密保持プログラム生成部 203は、呼び出し元のプログラムから 32ビットの入力値 i nl、 in2、 in3を受け取り、受け取った値を選択パラメータ群の初期値として選択パラ メータ用変数に格納する第 1の前処理プログラム命令群と、選択処理命令群 120に 分岐する第 2の前処理プログラム命令群とからなり、これらを順に行う前処理命令群 1 10を生成する。秘密保持プログラム生成部 203は、生成した前処理命令群 110をプ ログラム記憶部 210に格納する。
[0094] (2)選択処理命令群 120の生成
秘密保持プログラム生成部 203は、選択パラメータ群を用いて、選択識別子を算出 する第 1の選択処理プログラム命令群と、変遷処理命令群 130に分岐する第 2の選 択処理プログラム命令群からなり、これらを順に行う選択処理命令群 120を生成する ここでは、秘密保持プログラム生成部 203は、第 1の選択処理プログラム命令群とし て、式 1「2 X (第 1の選択パラメータ用変数) + 3 X (第 2の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) MOD 7」を算出するプログラム命令群を生成 する。秘密保持プログラム生成部 203は、生成した選択処理命令群 120をプログラム 記憶部 210に格納する。
[0095] (3)変遷処理命令群 130の生成
秘密保持プログラム生成部 203は、選択処理命令群 120で算出した選択識別子に 基づき、選択対象データ 140〜146のうちいずれかの選択対象データに分岐する処
理を行う変遷処理命令群 130を生成する。
具体的には、秘密保持プログラム生成部 203は、機能提供命令群生成部 201にて 生成された複数の機能提供命令群の個数 (ここでは、 3個)と、偽装機能提供命令群 生成部 202にて生成された複数の偽装機能提供命令群の個数 (ここでは、 4個)とを 取得し、その合計値を算出する。秘密保持プログラム生成部 203は、算出した合計 値 (ここでは、 7)と同数のラベル名を生成する。秘密保持プログラム生成部 203は、 選択処理命令群 120に含まれる式 1が取り得る値のそれぞれに対して、分岐先として 、生成したラベル名を対応付けることにより、変遷処理命令群 130を生成する。秘密 保持プログラム生成部 203は、生成した変遷処理命令群 130をプログラム記憶部 21 0に格納する。
[0096] (4)選択対象データ 140、 141、 · · ·、 146の生成
秘密保持プログラム生成部 203は、 3つの初期値と、式 1と、生成した複数の機能提 供命令群及び複数の偽装機能提供命令群とを用いて、複数の機能提供命令群の個 数と、機能提供命令群の個数との合計値と同数の選択対象データを生成する。 以下、具体例を用いて、選択対象データの生成について説明する。
[0097] 秘密保持プログラム生成部 203は、生成した各ラベル名のみ力もなる選択対象デ ータを生成する。ここでは、秘密保持プログラム生成部 203は、 7個の選択対象デー タ 140〜146を生成する。秘密保持プログラム生成部 203は、生成した各ラベル名の み力もなる選択対象データそれぞれをプログラム記憶部 210に格納する。
秘密保持プログラム生成部 203は、機能提供命令群 1を機能提供命令群生成部 2 01から取得する。秘密保持プログラム生成部 203は、入力部 200にて受け取った 3 つの初期値と、式 1とを用いて、取得した機能提供命令群 1を挿入する選択対象デ ータを決定する。ここでは、 3つの初期値(「1」、「2」、「3」)と式 1とから値「2」が算出 されるので、秘密保持プログラム生成部 203は、機能提供命令群 1を、プログラム記 憶部 210に格納されている選択対象データ 142に挿入する。秘密保持プログラム生 成部 203は、位置記憶部 211に「2」を格納する。
[0098] 秘密保持プログラム生成部 203は、選択対象データ 142に挿入する更新処理命令 群 162を生成する。ここでは、秘密保持プログラム生成部 203は、第 2の選択パラメ
ータ用変数の値「2」を第 3の選択パラメータ用変数に格納し、第 1の選択パラメータ 用変数の値「1」を第 2の選択パラメータ用変数に格納する。秘密保持プログラム生成 部 203は、第 1〜第 3の選択パラメータ用変数の値「(定数値 A)」、「1」、「2」を式 1に 代入して得られる値が、これまでに選択された 1以上の選択対象データを示さな!/ヽ値 となるように、位置記憶部 211に格納されている 1つ以上の値を用いて、定数値 Aとし て、「6」を取得する。なお、取得方法については後述する。秘密保持プログラム生成 部 203は、取得した定数値 A (=「6」)を含み、選択パラメータ群の値の更新を行う更 新処理命令群 162を生成し、生成した更新処理命令群をプログラム記憶部 210に格 納されている選択対象データ 142に挿入する。
[0099] 秘密保持プログラム生成部 203は、選択対象データ 142に挿入する分岐命令群 1 72を生成し、生成した分岐命令群 172を選択対象データ 142に挿入する。ここでは 、秘密保持プログラム生成部 203は、選択処理命令群 120へ分岐する分岐命令群 1 72を生成し、生成した分岐命令群 172をプログラム記憶部 210に格納されている選 択対象データ 142に挿入する。これにより、秘密保持プログラムを構成する選択対象 データ 142が生成されることになる。
[0100] 秘密保持プログラム生成部 203は、機能提供命令群 2を機能提供命令群生成部 2 01から取得する。秘密保持プログラム生成部 203は、選択パラメータ群(「定数値 A ( = 6)」、「1」、「2」)と、式 1とを用いて、取得した機能提供命令群 2を挿入する選択対 象データを決定する。ここでは、 3つの初期値(「6」、「1」、「2」)と式 1とから値「4」が 算出されるので、秘密保持プログラム生成部 203は、機能提供命令群 2をプログラム 記憶部 210に格納されて ヽる選択対象データ 144に挿入する。秘密保持プログラム 生成部 203は、位置記憶部 211に「4」を格納する。このとき、位置記憶部 211には、 値「2」、「4」が格納されている。
[0101] 秘密保持プログラム生成部 203は、選択対象データ 144に挿入する更新処理命令 群 164を生成する。ここでは、秘密保持プログラム生成部 203は、第 2の選択パラメ ータ用変数の値「1」を第 3の選択パラメータ用変数に格納し、第 1の選択パラメータ 用変数の値「6」を第 2の選択パラメータ用変数に格納する。秘密保持プログラム生成 部 203は、定数値 Bとして、第 1〜第 3の選択パラメータ用変数の値「(定数値 B)」、「
6」、 「1」を式 1に代入して得られる値が、これまでに選択された 1以上の選択対象デ ータを示さな 、値となるように、位置記憶部 211に格納されて 、る 1つ以上の値を用 いて、定数値 Bとして、「2」を取得する。秘密保持プログラム生成部 203は、取得した 定数値 B (=「2」)を含み、選択パラメータ群の値の更新を行う更新処理命令群 164 を生成し、生成した更新処理命令群 164をプログラム記憶部 210に格納されて!、る 選択対象データ 144に挿入する。
[0102] 秘密保持プログラム生成部 203は、選択対象データ 144に挿入する分岐命令群 1 74を生成する。ここでは、秘密保持プログラム生成部 203は、選択処理命令群 120 へ分岐する分岐命令群 174を生成し、生成した分岐命令群 174をプログラム記憶部 210に格納されている選択対象データ 144に挿入する。これにより、秘密保持プログ ラムを構成する選択対象データ 144が生成されることになる。
[0103] 秘密保持プログラム生成部 203は、機能提供命令群 3を機能提供命令群生成部 2 01から取得する。秘密保持プログラム生成部 203は、選択パラメータ群(「定数値 B ( = 2)」、 「6」、 「1」)と、式 1とを用いて、取得した機能提供命令群 3を挿入する選択対 象データを決定する。ここでは、 3つの初期値(「2」、 「6」、 「1」)と式 1とから値「6」が 算出されるので、秘密保持プログラム生成部 203は、機能提供命令群 3をプログラム 記憶部 210に格納されて ヽる選択対象データ 146に挿入する。秘密保持プログラム 生成部 203は、位置記憶部 211に「6」を格納する。このとき、位置記憶部 211には、 値「2」、 「4」、 「6」が格納されている。
[0104] 秘密保持プログラム生成部 203は、選択対象データ 146に挿入する更新処理命令 群 166を生成する。ここでは、秘密保持プログラム生成部 203は、第 2の選択パラメ ータ用変数の値「6」を第 3の選択パラメータ用変数に格納し、第 1の選択パラメータ 用変数の値「2」を第 2の選択パラメータ用変数に格納する。秘密保持プログラム生成 部 203は、定数値 Cとして、第 1〜第 3の選択パラメータ用変数の値「(定数値 C)」、 「 2」、 「6」を式 1に代入して得られる値が、これまでに選択された 1以上の選択対象デ ータを示さな 、値となるように、位置記憶部 211に格納されて 、る 1つ以上の値を用 いて、定数値 Cとして、「0」を取得する。秘密保持プログラム生成部 203は、取得した 定数値 C (=「0」)を含み、選択パラメータ群の値の更新を行う更新処理命令群 166
を生成し、生成した更新処理命令群 166をプログラム記憶部 210に格納されている 選択対象データ 146に挿入する。
[0105] 秘密保持プログラム生成部 203は、選択対象データ 146に挿入する分岐命令群 1 76を生成する。ここでは、秘密保持プログラム生成部 203は、呼出元のプログラムへ 制御を返す処理を行う分岐命令群 176を生成し、生成した分岐命令群 176をプログ ラム記憶部 210に格納されている選択対象データ 146に挿入する。これにより、秘密 保持プログラムを構成する選択対象データ 146が生成されることになる。なお、最後 の機能提供命令群 3 (選択対象主要命令群 156)自体が return文で終わっている場 合には、改めて return文を追加する必要はな 、。
[0106] 次に、秘密保持プログラム生成部 203は、機能提供命令群、又は偽装機能提供命 令群が挿入されていない選択対象データ 140を取得する。秘密保持プログラム生成 部 203は、取得した選択対象データ 140に、選択対象データに挿入されていない 1 以上の偽装機能提供命令群のうち 1の偽装機能提供命令群を挿入する。秘密保持 プログラム生成部 203は、「0」〜「6」のうち定数値として使用されて 、な 、値 (ここで は、「1」)を含み、選択パラメータ群の値の更新を行う更新処理命令群 160を生成し 、生成した更新処理命令群 160を選択対象データ 140に挿入する。
[0107] 秘密保持プログラム生成部 203は、選択対象データ 140に挿入する分岐命令群 1 70を生成する。ここでは、秘密保持プログラム生成部 203は、選択処理命令群 120 へ分岐する分岐命令群 170を生成し、生成した分岐命令群 170を選択対象データ 1 40に挿入する。これにより、秘密保持プログラムを構成する選択対象データ 140が生 成されること〖こなる。
[0108] 選択対象データ 141、 143、 145の生成については、選択対象データ 140の生成 と同様であるので、ここでの説明は省略する。
ここで、機能提供命令群の挿入時における定数値の取得方法にっ 、て説明する。 なお、選択対象データの個数を m個とする。
秘密保持プログラム生成部 203は、「0」から「m— 1」までの整数のうちランダムに 1 の整数「n」を選択し、第 1〜第 3の選択パラメータ用変数の値をそれぞれ、「n」、「第 1の選択パラメータ用変数の値」、「第 2の選択パラメータ用変数の値」として、式 1に
代入して値を算出する。算出した値が位置記憶部 211に存在しない場合には、秘密 保持プログラム生成部 203は、選択した整数「n」を定数値とする。算出した値が位置 記憶部 211に存在する場合には、秘密保持プログラム生成部 203は、「0」から「m— 1」までの整数のうちランダムに 1の整数「n」を、再度選択し、上記の動作を、式 1が位 置記憶部 211に存在しな 、値を算出するまで繰り返す。
[0109] 秘密保持プログラム生成部 203は、全ての機能提供命令群の挿入が終了すると、 複数の偽装機能提供命令群それぞれに、「0」から「m—l」までの整数のうち未使用 である整数を割り当てる。
なお、整数「n」は「0」から「m— 1」までの整数力も選択されたが、これに限定されな い。選択する整数は、 0以上の整数であればよい。この場合、偽装機能提供命令群 の挿入先についても、上記にて示す定数値の算出方法を用 、て決定する。
[0110] (5)秘密保持プログラム 100の生成
秘密保持プログラム生成部 203は、プログラム記憶部 210に格納して 、る前処理命 令群 110、選択処理命令群 120、変遷処理命令群 130、及び選択対象データ 140、 141、 · · ·、 146を図 2に示す順番に配置することにより、秘密保持プログラム 100を 生成する。
[0111] 1. 4. 5 プログラム難読化装置 10の動作
(1)動作概要
ここでは、プログラム難読ィ匕装置 10の動作概要について、図 7にて示す流れ図を用 いて説明する。
プログラム難読ィ匕装置 10の入力部 200は、難読化対象プログラムと、秘密保持プロ グラム 100を正常系にて実行する際、秘密保持プログラムに与える 3つの初期値 (こ こでは、「1」、「2」、「3」)を受け付ける(ステップ S 100)。
[0112] 機能提供命令群生成部 201は、入力部 200にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力 なる複数のブロックに分割して複数の機能提供命令群 を生成する(ステップ S 105)。
偽装機能提供命令群生成部 202は、難読化対象プログラムが記述されて!ヽるプロ グラミング言語で記述された 1以上のプログラム命令をランダムに組み合わせた偽装
機能提供命令群を複数個生成する (ステップ S110)。
[0113] 秘密保持プログラム生成部 203は、呼び出し元のプログラムから 32ビットの入力値 i nl、 in2、 in3を受け取り、受け取った値を選択パラメータ群の初期値として選択パラ メータ用変数に格納する第 1の前処理プログラム命令群と、選択処理命令群に分岐 する第 2の前処理プログラム命令群とからなり、これらを順に行う前処理命令群を生 成する(ステップ S 115)。
[0114] 秘密保持プログラム生成部 203は、選択パラメータ群を用いて、選択識別子を算出 する第 1の選択処理プログラム命令群と、変遷処理命令群に分岐する第 2の選択処 理プログラム命令群からなり、これらを順に行う選択処理命令群を生成する (ステップ S120)。ここでは、秘密保持プログラム生成部 203は、第 1の選択処理プログラム命 令群として、式 1「2 X (第 1の選択パラメータ用変数) + 3 X (第 2の選択パラメータ用 変数) + 5 X (第 3の選択パラメータ用変数) MOD 7」を算出するプログラム命令群 を生成する。
[0115] 秘密保持プログラム生成部 203は、選択処理命令群で算出した選択識別子に基 づき、複数の選択対象データのうち ヽずれかの選択対象データに分岐する処理を行 う変遷処理命令群を生成する (ステップ S 125)。具体的には、秘密保持プログラム生 成部 203は、機能提供命令群生成部 201にて生成された複数の機能提供命令群の 個数 (m個)と、偽装機能提供命令群生成部 202にて生成された複数の偽装機能提 供命令群の個数 (n個)とを取得し、その合計値を算出する。秘密保持プログラム生 成部 203は、算出した合計値 (ここでは、 7)と同数のラベル名を生成する。秘密保持 プログラム生成部 203は、選択処理命令群 120に含まれる式 1が取り得る値のそれ ぞれに対して、分岐先として、生成したラベル名を対応付けることにより、変遷処理命 令群を生成する。
[0116] 秘密保持プログラム生成部 203は、 3つの初期値と、式 1と、生成した複数の機能提 供命令群及び複数の偽装機能提供命令群とを用いて、複数の機能提供命令群の個 数と、機能提供命令群の個数との合計値と同数の選択対象データを生成する (ステ ップ S 130)。
秘密保持プログラム生成部 203は、生成した前処理命令群、選択処理命令群、変
遷処理命令群、及び複数の選択対象データを、順番に配置することにより、秘密保 持プログラムを生成する (ステップ S 135)。
[0117] (2)選択対象データの生成処理
ここでは、図 7のステップ S130にて示す選択対象データの生成処理の動作につい て、図 8及び図 9にて示す流れ図を用いて説明する。
秘密保持プログラム生成部 203は、生成した各ラベル名のみからなる選択対象デ ータを生成する(ステップ S 200)。
[0118] 秘密保持プログラム生成部 203は、カウンタ iに 1を設定する(ステップ S205)。ここ で、カウンタ iは、現在着目している機能提供命令群が何番目に実行されるべきであ るかを表す。
秘密保持プログラム生成部 203は、実行順序 i番目の機能提供命令群を機能提供 命令群生成部 201から取得する。秘密保持プログラム生成部 203は、取得した実行 順序 i番目の機能提供命令群を挿入する選択対象データを、選択パラメータ群及び 式 1を用いて、決定する。なお、 iが 1である場合には、秘密保持プログラム生成部 20 3は、 3つの初期値力もなる選択パラメータ群及び式 1を用いて、選択対象データを 決定し、 iが 2以上である場合には、秘密保持プログラム生成部 203は、更新された選 択パラメータ群及び式 1を用いて、選択対象データを決定する。秘密保持プログラム 生成部 203は、決定した選択対象データに、実行順序 i番目の機能提供命令群を揷 入する(ステップ S 210)。
[0119] 秘密保持プログラム生成部 203は、第 2の選択パラメータ用変数の値を第 3の選択 ノ メータ用変数に格納し、第 1の選択パラメータ用変数の値を第 2の選択パラメータ 用変数に格納する。秘密保持プログラム生成部 203は、第 1〜第 3の選択パラメータ 用変数の値「定数値」、「1」、「2」を式 1に代入して得られる値が、これまでに選択さ れた 1以上の選択対象データを示さない値となるように、定数値を取得する (ステップ S215)。
[0120] 秘密保持プログラム生成部 203は、取得した定数値を含み、選択パラメータ群の値 の更新を行う更新処理命令群を生成し、生成した更新処理命令群を選択対象デー タに揷入する(ステップ S220)。
秘密保持プログラム生成部 203は、カウンタ iの値が、機能提供命令群の個数 mと 一致する力否かを判定する (ステップ S 225)。
[0121] 一致しないと判定する場合 (ステップ S225における「NO」)、秘密保持プログラム 生成部 203は、選択処理命令群へ分岐する分岐命令群を生成し、生成した分岐命 令群を選択対象データに挿入する (ステップ S230)。
一致すると判定する場合 (ステップ S225における「YES」 )、秘密保持プログラム生 成部 203は、呼出元のプログラムへ制御を返す処理を行う分岐命令群を生成し、生 成した分岐命令群を選択対象データに挿入する (ステップ S235)。
[0122] 秘密保持プログラム生成部 203は、カウンタ iに値「1」を加算する (ステップ S240)。
秘密保持プログラム生成部 203は、カウンタ iが機能提供命令群の個数より大きい か否かを判定する(ステップ S243)。
大きくないと判定する場合には (ステップ S243における「NO」)、秘密保持プロダラ ム生成部 203は、ステップ S210〖こ戻り、再度、処理を繰り返す。
[0123] 大きいと判定する場合には (ステップ S243における「YES」)、秘密保持プログラム 生成部 203は、偽装機能提供命令群の個数 nの間、ステップ S245からステップ S27 5を繰り返す。
秘密保持プログラム生成部 203は、機能提供命令群も偽装機能提供命令群も挿入 されて!/ヽな ヽ選択対象データ、つまりラベル名のみが含まれる選択対象データを 1つ 取得する(ステップ S 250)。
[0124] 秘密保持プログラム生成部 203は、選択対象データに挿入されて!ヽな ヽ偽装機能 提供命令群を 1つ取得し、取得した偽装機能提供命令群を、ステップ S250にて取得 した選択対象データに挿入する (ステップ S255)。
秘密保持プログラム生成部 203は、定数値として使用されて 、な 、値を取得し (ス テツプ S260)、取得した定数値を含み、選択パラメータ群の値の更新を行う更新処 理命令群を生成し、生成した更新処理命令群を選択対象データに挿入する (ステツ プ S265)。
[0125] 秘密保持プログラム生成部 203は、選択処理命令群へ分岐する分岐命令群を生 成し、生成した分岐命令群を選択対象データに挿入する (ステップ S270)。
秘密保持プログラム生成部 203は、偽装機能提供命令群の個数 nまでの間、ステツ プ S250力らステップ S270を繰り返すと、処理を終了する(ステップ S275)。
1. 5 変形例
なお、本発明を上記第 1の実施の形態に基づいて説明してきたが、本発明は、上 記の実施の形態に限定されないのはもちろんである。以下のような場合も本発明に 含まれる。
[0126] (1)上記第 1の実施の形態では、選択識別子を算出する算出式として式 1を用いた 力 これに限定されない。選択識別子を算出する算出式は、選択パラメータ用変数を 用いる他の式であっても構わな 、。
また、選択識別子用変数に初期値を設定しておき、選択識別子用変数を用いた式 であっても構わない。また、選択処理命令群に、選択処理命令群が呼び出された回 数を数えるカウンター用変数を設けておき、カウンター用変数をも用いた式であって も構わない。
[0127] また、カウンター用変数は、選択処理命令群以外でカウンターの値を上げる処理を 行ってもよい。
(2)上記第 1の実施の形態において、最後の機能提供命令群 3を含む選択対象デ ータ 146に、更新処理命令群 166を含めなくてもよい。
(3)上記第 1の実施の形態において、機能提供命令群の数を 3つとしたが、これに 限定されない。機能提供命令群の数は、幾つであってもよい。
[0128] (4)上記第 1の実施の形態において、選択パラメータの数を 3としたが、これに限定 されな 、。選択パラメータの数は複数個であればょ 、。
この場合の式 1は、「pl X (第 1の選択パラメータ用変数) +P2 X (第 2の選択パラメ ータ用変数) + · · · + pn X (第 nの選択パラメータ用変数) MOD NN」となる(nは 2以上の整数)。なお、 pl、 p2、 · · ·、 pnは互いに素である素数であり、 NNを選択対 象データの数とする。また、選択パラメータの更新時には、第 i 1のパラメータに格 納されている値を第 iのパラメータに格納する。このとき、第 nのパラメータ、第 n— 1の パラメータ、 · · ·、第 2のパラメータの順に格納する。また、第 1のパラメータには、実行 した選択対象主要命令群が有する定数値を格納する。ここで、 iは 2以上 n以下の整
数である。
[0129] また、入力値の初期値を「1」、「2」、「3」としたがこの値でなくてもよい。
また、入力値等を 32ビットの値とした力 32ビットより短いビット数であってもよいし、 32ビットより長!、ビット数であってもよ!/ヽ。
(5)上記第 1の実施の形態において、選択対象データ 140〜146に分岐命令群 1 70〜175がある構成を、各選択対象データに選択処理命令群と変遷処理命令群を 持つ構成としても構わない。
[0130] (6)上記第 1の実施の形態において、選択情報パラメータの初期値は、秘密保持 プログラムに与えられた値としている構成を、前処理部等で、秘密保持プログラム外 のプログラムやプログラムを実行する機器が有する機能を用いて決定する値としても よい。
(7)秘密保持プログラムが秘密情報を持つ場合に、秘密情報の値を選択パラメータ 用変数、選択識別子用変数を用いて算出する処理に置き換えても構わない。
[0131] (8)上記第 1の実施の形態のプログラム難読ィ匕装置 10において、選択対象データ の数や選択パラメータの数は、必ずしも固定の値である必要はなぐ別の値であって ちょい。
また、これらの値を、プログラム難読ィ匕装置に入力として与えてもよい。
(9)上記第 1の実施の形態において、ブロックの分割の分割方法として、ここでは簡 単な方法について説明した力 この方法に限定するものではなぐブロックの分割の 仕方に応じた制御構造の解析を行 ヽ、ブロックの分割の仕方に応じた機能提供命令 群を生成すればよい。なお、制御構造の解析については、公知であるため説明は省 略する。
[0132] (10)上記第 1の実施の形態において、プログラム難読ィ匕装置 10は、初期値、定数 値の決定後、機能提供命令群を挿入する選択対象データを決定したが、これに限定 されない。プログラム難読ィ匕装置 10は、機能提供命令群の配置を決めた後に、初期 値、定数値を決めてもよい。
(11)上記第 1の実施の形態において、プログラム難読ィ匕装置 10は、ラベル名のみ からなる複数の選択対象データのそれぞれに、選択対象主要命令群、更新処理命
令群、及び分岐命令群を挿入した後に、前処理命令群、選択処理命令群、変遷処 理命令群、及び複数の選択対象データの配置を決定して秘密保持プログラムを生 成したが、これに限定されない。
[0133] プログラム難読化装置 10は、前処理命令群、選択処理命令群、変遷処理命令群、 及びラベル名のみ力 なる複数の選択対象データの配置を決定し、その後、ラベル 名のみからなる複数の選択対象データのそれぞれに、選択対象主要命令群、更新 処理命令群、及び分岐命令群を挿入して秘密保持プログラムを生成してもよ ヽ。
(12)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよ!/、。
[0134] 1. 6 まとめ
上記第 1の実施の形態にて示す秘密保持プログラム 100は、選択対象主要命令群 152、 154、 156は実際の実行順序とは無関係にバラバラな位置に配置されるため、 実行順序の解析が困難である。
また、選択対象主要命令群 152、 154、 156には、他の選択対象主要命令群への 直接的な分岐命令が含まれていないので、実行順序の解析が困難である。
[0135] また、次にどの選択対象データに分岐するかを決定する処理を行う選択処理命令 群は、選択パラメータの値によっては、全ての選択対象主要命令群に分岐する可能 性があるプログラム命令であるため、実行順序の解析が困難である。さらに、選択対 象データ 140〜146には正常系の実行時には実行されることのない選択対象データ 140、 141、 143、 145が含まれるため、解析がより困難である。
[0136] 更に、本実施の形態では、複数の選択パラメータを用いて、選択対象データ 140 〜 146の実行順序を決定している。よって、もし、不正解析者が実行順序の一部をた またま知っていたとしても、それ以外の部分の実行順序を知ることが困難になる。この ことをより具体的に説明する。例えば、秘密保持プログラムがウォーターマーク検出す るアルゴリズムであった場合にぉ 、て、不正解析者が一般的なウォーターマーク処理 に詳しぐ一般的なウォーターマーク検出アルゴリズムのどのような処理で含まれるか を知っていることが考えられる。このような場合、多数の選択対象データの中から、実 行されそうな選択対象データを見つけ出すことが考えられる。このとき、もし、選択処 理命令群が 1つの選択パラメータに基づいて実行順序を決める処理であれば、不正
解析者はその 1つだけの選択パラメータの値を知ることができる。これを行うには、実 行されそうな選択対象データに分岐するには、変遷処理命令群がどのような選択識 別子を使っているかを逆算し、さらに、そのような選択識別子をもたらすには、選択処 理命令群がどのような選択パラメータに用いて処理を行つたかを逆算すればよい。以 降は、選択パラメータの値の変化、選択処理命令群の処理を追跡することで実行順 序を知ることが出来る。
[0137] しかし、本手法のように複数の選択パラメータを用いるのであれば、たまたま、実行 されそうな選択対象データを 1つ見つけ出しても、選択識別子カゝら選択パラメータを 逆算することはできない。
さらに、不正解析者が、たまたま、連続して実行される選択対象データが分かる場 合が考えられる。このような場合に、不正解析者は、選択処理命令群の式 1に対する 入出力の組をより多く知ることができるようになるので、式 1に用いる選択パラメータ用 の変数の数を多くすることが、解析を困難にすることになる。
[0138] 更に、本実施例では、選択対象データに選択パラメータを更新する処理がある。よ つて、不正解析者が秘密保持プログラムと、秘密保持プログラムに与えられる入力値 とを知っていたとしても、選択パラメータの値がどのように変わっていくかを、順に解析 して!/、かなければ、実際に選択対象が実行される順番を解析することができな 、。 また、従来、例えば、 Switch文を用いて、実行順序を決定する場合、あるブロック の最後に、次の実行すべきブロックを示す値 (Switch文にて用いられる値)が直接 記述されている。本実施の形態では、 3つの値力もなる選択パラメータ群を用いて選 択処理命令群を実行することにより、次に実行する選択対象データが決定される。こ のとき、正当な 3つの初期値から、まず、 1番目に実行される機能提供命令群が決定 される。次に、更新処理命令群により更新された選択パラメータ群(1回目の更新選 択パラメータ群)から、 2番目に実行される機能提供命令群が決定される。 n番目に実 行される機能提供命令群は、 3つの初期値力 なる選択パラメータ群、 1回目の更新 選択パラメータ群、…、(n— 1)回目の選択パラメータ群を、順次用いて選択処理命 令群を実行することにより、決定される。ここで、 nは 1以上の整数である。より詳細に は、更新処理命令群を正当な順序で実行することにより、正当に更新された選択パラ
メータ群を生成し、生成した選択パラメータ群を用いて択処理命令群を実行すること により、 n番目に実行される機能提供命令群が決定される。本実施の形態では、選択 ノ メータ群を順次更新することにより、 Switch文にて用いられる値を取得すること ができる。つまり、本実施の形態では、 Switch文にて用いられる値をプログラム上で は隠匿し、選択パラメータ群を順次更新することにより取得している。このように、隠匿 した 、情報を、 V、くつかの他の情報から取得することを分割秘密による難読ィ匕と!/ ヽ 、本実施の形態における更新処理命令群が、分割秘密に相当している。
[0139] 2.第 2の実施の形態
以下、本発明に係る第 2の実施の形態としての秘密保持プログラム 300及びプログ ラム難読ィ匕装置 30について、図面を参照して説明する。
2. 1 秘密保持システム 2の概要
秘密保持システム 2は、図 10に示すように、プログラム難読化装置 30と、プログラム 実行装置 40とから構成されて 、る。
[0140] プログラム難読ィ匕装置 30は、実行順序を秘密にしたい難読ィ匕対象プログラムから 秘密保持プログラム 300を生成し、生成した秘密保持プログラム 300をプログラム実 行装置 40へ配布する。
プログラム実行装置 40は、プログラム難読ィ匕装置 30から配布された秘密保持プロ グラム 300を実行する。
[0141] ここで、難読化対象プログラムは、命令群 A、命令群 B、命令群 Cの 3つの命令群か ら構成されており、命令群 A、 B、 Cの順に実行することにより正しく動作するものとす る。
2. 2 秘密保持プログラム 300の構造
ここでは、プログラム難読ィ匕装置 30にて生成され、プログラム実行装置 40にて実行 される秘密保持プログラム 300のプログラム構造について説明する。
[0142] 秘密保持プログラム 300は、 2以上の秘密情報を用いて処理を行うプログラムであ る。秘密情報は、不正解析者に対して解析されたくない情報である。例えば、秘密保 持プログラム 300は、秘密情報である複数のサブ鍵を用いて暗号処理を行うプロダラ ムである。このようなプログラムにお 、て複数の秘密情報を隠蔽した 、と 、う要求があ
る。ここでは、命令群 A、 B、 Cのそれぞれ力 秘密情報を有しているものとする。
[0143] 秘密保持プログラム 300は、前処理命令群 310、選択処理命令群 320、主要処理 命令群 340、選択対象データ 350〜356からなり、これらが図 11に示す順番に配置 されている。
秘密保持プログラム 300は、呼出元のプログラムから、選択パラメータ群の初期値と なる 32ビットの入力値 inl、 in2、 in3および秘密情報を用いた処理で使用するパラメ ータを受け取り、秘密情報を用いた処理を行うプログラム命令群である。秘密保持プ ログラムの処理では、選択処理命令群 320での処理に用いる複数の選択パラメータ の各値 (ここでは、 3つの値)を保持する 32ビットの変数である第 1〜第 3の選択パラメ ータ用変数、選択識別子を保持する 32ビットの変数である選択識別子用変数、また 変遷処理命令群 390〜392で算出される秘密情報を格納する 32ビットの変数である 秘密情報用変数を用いる。ここで、選択パラメータは、選択対象データ 140、 141、 · • ·、 146から 1の選択対象を決定する際に、使用されるノ メータであり、選択識別子 は、選択対象データを一意に識別する識別子である。
[0144] ここでは、秘密保持プログラムが実際に使用される際に呼出元のプログラム力 受 け取る入力値 inl、 in2、 in3は値「1」、「2」、「3」であるとする。
秘密保持プログラム 300は 2以上の秘密情報を用いた処理を行うプログラム命令群 であり、本実施例では命令群 A、 B、 Cのそれぞれが有する秘密情報を、第 1〜第 3の 秘密情報とし、それぞれの値を「100」、「200」、「300」とする。
[0145] 2. 2. 1 前処理命令群 310
前処理命令群 310は、後述の選択処理命令群 320で用いる選択パラメータ群の初 期値を算出するプログラム命令群である。ここで、選択パラメータ群は、第 1、第 2及 び第 3の選択パラメータ用変数力 なる。
前処理命令群 310の処理は、上記第 1の実施の形態にて示す前処理命令群 110 と同様のほぼ同様の処理である力 前処理命令群 110の最後は、選択処理命令群 1 20分岐するプログラム命令群であるのに対し、前処理命令群 310の最後は、主要処 理命令群 340へ分岐するプログラム命令群である点が異なる。
[0146] 2. 2. 2 選択処理命令群 320
選択処理命令群 320は、選択パラメータ群に基づき、選択対象データ 350〜356 から 1つを選択し選択識別子とするプログラム命令群である。
選択処理命令群 320の処理は、選択処理命令群 120と同様とほぼ同等の処理で ある力 選択処理命令群 320はサブルーチンである点で異なる。
[0147] 具体的には、選択処理命令群 120は、当該命令群の処理の最後で変遷処理命令 群へ分岐するプログラム命令を有するのに対し、選択処理命令群 320はプログラム 関数であり、選択処理命令群 320の最後ではこの関数を呼び出した呼出元に分岐 する点が異なる。
なお、ここでは、選択処理命令群 120と同様に、式 1を用いて選択識別子を算出す るちのとする。
[0148] 2. 2. 3 選択対象データ 350〜356
選択対象データ 350〜356は、更新処理命令群にて読み出されるデータである。 具体的には、選択対象データ 350〜356は、例えば、配列データであって、 C言語 の場合は、以下のような配列である。
Γ
variable— 140 [7] = { 1、 2、 3、 4、 5、 6、 7} ;
J
この配列は、後述の変遷処理命令群 390〜392にて用いられる配列であり、この配 列と前処理命令群 310で選択パラメータに設定する初期値に依存して変遷処理命 令群 390〜392がどのようなプログラム命令群になるかが決まる。
[0149] 2. 2. 4 主要処理命令群 340
主要処理命令群 340は、秘密情報を用いて処理を行うプログラム命令群である。 主要処理命令群 340は、機能提供命令群 360〜362、選択処理命令群呼出命令 370〜372、更新処理命令群 380〜382、及び変遷処理命令群 390〜392力もなる プログラム命令群であり、各命令群は、図 11に示す位置に配置されている。
[0150] (1)機能提供命令群 360〜362
機能提供命令群 360は、秘密情報を用いた処理を行うプログラム命令群である。秘 密情報の値を用いるプログラム命令は、秘密情報用変数を用いた処理として記述さ
れている。つまり、秘密情報が予め秘密情報用変数に変換されている。もし、秘密情 報用変数の値が第 1の秘密情報の値「100」であれば、機能提供命令群 360は、本 来の処理を行うプログラム命令群である。
[0151] 機能提供命令群 361も同様なプログラム命令群であり、秘密情報用変数に格納さ れた値が秘密情報 2の値が「200」であれば、機能提供命令群 361は、本来の処理 を行うプログラム命令群である。
機能提供命令群 362も同様なプログラム命令群であり、秘密情報用変数に格納さ れた値が秘密情報 3の値が「300」であれば、機能提供命令群 362は、本来の処理 を行うプログラム命令群である。
[0152] なお、各機能提供命令群に含まれる秘密情報は、予め秘密情報用変数に変換さ れている。
(2)選択処理命令群呼出命令 370〜372
選択処理命令群呼出命令 370〜372は、選択処理命令群 320を呼び出すプログ ラム命令群である。
[0153] (3)更新処理命令群 380〜382
更新処理命令群 380は、選択識別子に対応する選択対象データの値を読み出す 処理を行って、読み出した値を用いて選択パラメータ群の値を更新する処理を行うプ ログラム命令群である。
具体的には、更新処理命令群 380は、まず、選択識別子用変数の値が、 0、 1、 · · · 、 6の場合にそれぞれ、選択対象データ 350、 351、 · · ·、 356に格納されている値を
BJCみ出す。
[0154] 次に、更新処理命令群 380は、読み出した値に基づき、選択パラメータ群の更新を 行う。ここでは、更新処理命令群 380は、第 2の選択パラメータの値を第 3の選択パラ メータに格納し、第 1の選択パラメータの値を第 2の選択パラメータに格納し、第 1の 選択パラメータに読み出した値を格納する。
例えば、 C言語のプログラム命令で、更新処理を記載すると
Γ
(第 3の選択パラメータ変数) = (第 2の選択パラメータ変数);
(第 2の選択パラメータ変数) = (第 1の選択パラメータ変数);
(第 1の選択パラメータ変数) = variable— 140 [ (選択識別子用変数) ] ;」 で表されるプログラム命令群になる。
[0155] なお、更新処理命令群 381〜382は、更新処理命令群 380と同様の構成であるの で、ここでの説明は省略する。
(4)変遷処理命令群 390〜392
変遷処理命令群 390〜392は、選択パラメータ変数の値に基づ ヽて秘密情報用 変数の値を決定する処理である。
[0156] 具体的には、変遷処理命令群 390〜392は、選択パラメータ変数に格納する値( 秘密情報)を算出し、算出した値を秘密情報用変数に格納するプログラム命令群で ある。
以下に、変遷処理命令群 390〜392の動作の詳細について説明する。 (4 1)変遷処理命令群 390
変遷処理命令群 390は、第 1〜第 3選択パラメータ用変数を用いた演算を行い、第
1の秘密情報の値を算出し、算出した値を秘密情報用変数に格納する処理を行うプ ログラム命令である。
[0157] 例えば、変遷処理命令群 390は、 P4、 P5、 P6を互い〖こ素な素数とし、「P4 X (第 1 の選択パラメータ用変数) +P5 X (第 2の選択パラメータ用変数) +P6 X (第 3の選 択パラメータ用変数) + (定数 1)」を算出し、算出した値を秘密情報用変数に格納す る処理を行うプログラム命令群である。なお演算子「X」は掛け算を表す。ここでは、 P 4、 P5、 P6をそれぞれ値「2」、「3」、「5」、とした場合、式 2「2 X (第 1の選択パラメ一 タ用変数) + 3 X (第 2の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数 ) + (定数 1)」を算出し、算出した値を秘密情報用変数に格納する処理である。
[0158] 以下、定数 1について説明する。
秘密保持プログラム 300では、変遷処理命令群 390が実行されるまでには、前処 理命令群 310、選択処理命令群呼出命令 370、選択処理命令群 320、更新処理命 令群 380が、この順序で実行されている。なお、前処理命令群 310、選択処理命令 群呼出命令 370、選択処理命令群 320、及び更新処理命令群 380を実行する際に
は、呼出元のプログラム力も受け取る入力値 inl、 in2、 in3の値をそれぞれ値「1」、「 2」、「3」として実行する。その他の呼出元のプログラム力も受ける入力値は任意の値 であってよい。
[0159] このとき、選択処理命令群 320は、式 1「2 X (第 1の選択パラメータ用変数( = 1) )
+ 3 X (第 2の選択パラメータ用変数( = 2) ) + 5 X (第 3の選択パラメータ用変数(= 3) ) MOD 7」により選択識別子の値は「2」となり、更新処理命令群 380が選択対 象データ 350〜356から取得する値は「3」となり、第 1〜第 3の選択パラメータ変数の 更新後の値は、「3」、「1」、「2」となる。
[0160] 定数 1は、このようにして得られた第 1〜第 3の選択パラメータ変数の値を式 2に代 入して得られる秘密情報用変数の値が、第 1の秘密情報の値「100」になるように、予 め設定された値であり、ここでは、 81となる。
(4 2)変遷処理命令群 391
同様に、変遷処理命令群 392は、 Γ2 Χ (第 1の選択パラメータ用変数) + 3 X (第 2 の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) + (定数 2)」からなる 命令群である。
[0161] 以下、定数 2の値について説明する。
秘密保持プログラム 300では、変遷処理命令群 391が実行されるまでには、前処 理命令群 310、選択処理命令群呼出命令 370、選択処理命令群 320、更新処理命 令群 380、変遷処理命令群 390、機能提供命令群 360、選択処理命令群呼出命令 371、選択処理命令群 320、更新処理命令群 381が、この順序で実行されている。
[0162] このとき、更新処理命令群 381にて取得される第 1〜第 3の選択パラメータ変数の 値は、「6」、「3」、「1」となる。上記と同様の方法にて定数 2を算出すると、値「174」と なる。
(4 3)変遷処理命令群 392
同様に、変遷処理命令群 392は、 Γ2 Χ (第 1の選択パラメータ用変数) + 3 X (第 2 の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) + (定数 3)」からなる 命令群である。
[0163] 秘密保持プログラム 300では、変遷処理命令群 392が実行されるまでには、前処
理命令群 310、選択処理命令群呼出命令 370、選択処理命令群 320、更新処理命 令群 380、変遷処理命令群 390、機能提供命令群 360、選択処理命令群呼出命令 371、選択処理命令群 320、更新処理命令群 381、変遷処理命令群 391、機能提 供命令群 361、選択処理命令群呼出命令 372、選択処理命令群 320、及び更新処 理命令群 382、力 この順序で実行されている。
[0164] このとき、更新処理命令群 382にて取得される第 1〜第 3の選択パラメータ変数の 値は、「6」、「6」、「3」となる。上記と同様の方法にて定数 3を算出すると、値「255」と なる。
2. 3 秘密保持プログラム 300の実行
プログラム実行装置 40が、秘密保持プログラム 300を正常系で実行した場合の処 理について、図 12に示す流れ図を用いて説明する。
[0165] 秘密保持プログラム 300は、前処理命令群 310の処理を行う(ステップ S300)。具 体的には、前処理命令群 310は、入力値 inl、 in2、 in3として、それぞれ値「1」、「2」 、「3」を受け取り、第 1〜3の選択パラメータ用変数にそれぞれ値「1」、「2」、「3」を格 納する処理を行! \選択処理命令群呼出命令 370へ分岐する。
[0166] 次に、秘密保持プログラム 300は、選択処理命令群呼出命令 370の処理を行う (ス テツプ S305)。具体的には、選択処理命令群呼出命令 370は、選択処理命令群 32 0の呼出を行う。
次に、秘密保持プログラム 300は、受け取った入力値「1」、「2」、「3」を用いて、選 択処理命令群 320の処理を行う(ステップ S310)。具体的には、選択処理命令群 32 0は、式 1「2 X (第 1の選択パラメータ用変数( = 1) ) + 3 X (第 2の選択パラメータ用 変数( = 2) ) + 5 X (第 3の選択パラメータ用変数( = 3) ) MOD 7」により値「2」を 算出し、算出した値「2」を選択識別子用変数に格納する。
[0167] 秘密保持プログラム 300は、更新処理命令群 380の処理を行う(ステップ S315)。
具体的には、更新処理命令群 380は、選択識別子用変数の値「2」により、選択対象 データ 352の値「3」を読み出す。更新処理命令群 380は、第 2の選択パラメータの値 「2」を第 3の選択パラメータに格納し、第 1の選択パラメータの値「1」を第 2の選択パ ラメータに格納し、第 1の選択パラメータに読み出した値「3」を格納する。
[0168] 秘密保持プログラム 300は、更新処理命令群 380にて生成した選択パラメータ群( 第 1〜第 3の選択パラメータ)を用いて変遷処理命令群 390の処理を行う(ステップ S 320)。具体的には、変遷処理命令群 390は、式 2「2 X (第 1の選択パラメータ用変 数) + 3 X (第 2の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) + (定 数 1)」を用いて、秘密情報用変数に格納する値を算出し、算出した値を秘密情報変 数に格納する。なお、ここでは、秘密情報変数には「100」が格納される。
[0169] 秘密保持プログラム 300は、秘密情報変数に格納された値に基づ 、て、機能提供 命令群 360の処理を行う(ステップ S325)。具体的には、機能提供命令群 360は、 難読化対象プログラムにおける命令群 Aを実行する。
次に、秘密保持プログラム 300は、選択処理命令群呼出命令 371の処理を行う (ス テツプ S330)。具体的には、選択処理命令群呼出命令 371は、選択処理命令群 32 0の呼出を行う。
[0170] 次に、秘密保持プログラム 300は、第 1〜第 3の選択パラメータの値「3」、「1」、「2」 を用いて、選択処理命令群 320の処理を行う (ステップ S335)。具体的には、選択処 理命令群 320は、式 1「2 X (第 1の選択パラメータ用変数( = 3) ) + 3 X (第 2の選択 パラメータ用変数( = 1) ) + 5 X (第 3の選択パラメータ用変数( = 2) ) MOD 7」に より値「5」を算出し、算出した値「5」を選択識別子用変数に格納する。
[0171] 秘密保持プログラム 300は、更新処理命令群 381の処理を行う(ステップ S340)。
具体的には、更新処理命令群 381は、選択識別子用変数の値「5」により、選択対象 データ 355の値「6」を読み出す。更新処理命令群 381は、第 2の選択パラメータの値 「1」を第 3の選択パラメータに格納し、第 1の選択パラメータの値「3」を第 2の選択パ ラメータに格納し、第 1の選択パラメータに読み出した値「6」を格納する。
[0172] 秘密保持プログラム 300は、更新処理命令群 381にて生成した選択パラメータ群( 第 1〜第 3の選択パラメータ)を用いて変遷処理命令群 391の処理を行う(ステップ S 345)。具体的には、変遷処理命令群 391は、式 2「2 X (第 1の選択パラメータ用変 数) + 3 X (第 2の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) + (定 数 2)」を用いて、秘密情報用変数に格納する値を算出し、算出した値を秘密情報変 数に格納する。なお、ここでは、秘密情報変数には「200」が格納される。
[0173] 秘密保持プログラム 300は、秘密情報変数に格納された値に基づ 、て、機能提供 命令群 361の処理を行う(ステップ S350)。具体的には、機能提供命令群 361は、 難読化対象プログラムにおける命令群 Bを実行する。
次に、秘密保持プログラム 300は、選択処理命令群呼出命令 372の処理を行う (ス テツプ S355)。具体的には、選択処理命令群呼出命令 372は、選択処理命令群 32 0の呼出を行う。
[0174] 次に、秘密保持プログラム 300は、第 1〜第 3の選択パラメータの値「6」、 「3」、 「1」 を用いて、選択処理命令群 320の処理を行う (ステップ S360)。具体的には、選択処 理命令群 320は、式 1「2 X (第 1の選択パラメータ用変数( = 6) ) + 3 X (第 2の選択 パラメータ用変数( = 3) ) + 5 X (第 3の選択パラメータ用変数( = 1) ) MOD 7」に より値「5」を算出し、算出した値「5」を選択識別子用変数に格納する。
[0175] 秘密保持プログラム 300は、更新処理命令群 382の処理を行う(ステップ S365)。
具体的には、更新処理命令群 382は、選択識別子用変数の値「5」により、選択対象 データ 355の値「6」を読み出す。更新処理命令群 382は、第 2の選択パラメータの値 「3」を第 3の選択パラメータに格納し、第 1の選択パラメータの値「6」を第 2の選択パ ラメータに格納し、第 1の選択パラメータに読み出した値「6」を格納する。
[0176] 秘密保持プログラム 300は、更新処理命令群 382にて生成した選択パラメータ群( 第 1〜第 3の選択パラメータ)を用いて変遷処理命令群 392の処理を行う(ステップ S 370)。具体的には、変遷処理命令群 392は、式 2「2 X (第 1の選択パラメータ用変 数) + 3 X (第 2の選択パラメータ用変数) + 5 X (第 3の選択パラメータ用変数) + (定 数 3)」を用いて、秘密情報用変数に格納する値を算出し、算出した値を秘密情報変 数に格納する。なお、ここでは、秘密情報変数には「300」が格納される。
[0177] 秘密保持プログラム 300は、秘密情報変数に格納された値に基づ 、て、機能提供 命令群 362の処理を行う(ステップ S375)。具体的には、機能提供命令群 362は、 難読化対象プログラムにおける命令群 Cを実行する。
2. 4 プログラム難読化装置 30
ここでは、実行順序を隠蔽した 、難読ィ匕対象プログラム力も秘密保持プログラム 30 0を生成するプログラム難読ィ匕装置 30につ 、て述べる。秘密保持プログラム 300に
おいて、機能提供命令群 360〜362、変遷処理命令群 390〜392以外の各部は、 どのような難読ィ匕対象プログラムに対しても共通して用いることができる。ここでは、機 能提供命令群、変更処理命令群の生成について中心に述べる。
[0178] プログラム難読ィ匕装置 30は、図 13に示すように、入力部 400と、機能提供命令群 生成部 401と、変遷処理命令群生成部 402と、秘密保持プログラム生成部 403とか ら構成されている。
プログラム難読化装置 30は、具体的には、マイクロプロセッサ、 ROM、 RAM、ノヽ ードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコン ピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビユー タプログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を達成 するために、コンピュータに対する指令を示す命令コードが複数個組み合わされて 構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラムに従つ て動作することにより、プログラム難読ィ匕装置 30は、その機能を達成する。つまり、前 記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1個ずつ読 み出し、読み出した命令を解読し、解読結果に従って動作する。
[0179] 2. 4. 1 入力部 400
難読化対象のプログラムと、秘密保持プログラム 300を正常系にて実行する際、秘 密保持プログラム 300に与える 3つの初期値 (ここでは、「1」、「2」、「3」)と、秘密情報 の位置を示す位置情報 (ここでは、 3個の秘密情報「100」、「200」、「300」が出現す る位置を示す情報)とを受け付ける。
[0180] 2. 4. 2 機能提供命令群生成部 401
機能提供命令群生成部 401は、入力部 400にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力 なる複数のブロックに分割し機能提供命令群を生成す る。なお、難読化対象プログラムに無条件飛び越し、条件飛び越しが含まれる場合に は、飛び越しを行うプログラム命令と飛び越し先のプログラム命令は同じブロックに含 まれるように分割を行う。また、秘密情報の値を用いた処理を行うプログラム命令は、 それぞれ異なるブロックに含まれるようにブロックを構成する。
[0181] ここでは、難読ィ匕対象プログラムが 3つの秘密情報の値を用いた処理であるとし、分
割した各部に含まれる命令数が出来るだけ均等になるように 3つのブロックに分割し 、 3つの機能提供命令群を生成する。生成した機能提供命令群は、元となったプログ ラム命令群が難読ィ匕対象プログラムにおいて始まりの方にあった順に機能提供命令 群 1〜3とする。
2. 4. 3 変遷処理命令群生成部 402
変遷処理命令群生成部 402は、定数が未決定である式 2を含む変遷処理命令群 を、機能提供命令群生成部 401にて生成した機能提供命令群の個数分生成する。
[0182] ここでは、変遷処理命令群生成部 402は、定数が未決定である式 2を含む変遷処 理命令群を 3個生成する。
2. 4. 4 秘密保持プログラム生成部 403
秘密保持プログラム生成部 403は、複数の機能提供命令群、及び機能提供命令 群と同数の変遷処理命令群を用いて、前処理命令群 310、選択処理命令群 320、 選択処理命令群呼出命令 370〜372、更新処理命令群 380〜382、及び選択対象 データ 350〜351を生成することにより秘密保持プログラム 300を生成する。
[0183] 秘密保持プログラム生成部 403は、図 13に示すように、プログラム記憶部 410を有 している。
プログラム記憶部 410は、生成された各命令群及び選択対象データを記憶する領 域を有している。
秘密保持プログラム生成部 403は、機能提供命令群生成部 401にて生成された複 数の機能提供命令群を取得し、取得した複数の機能提供命令群をプログラム記憶 部 410に格納する。
[0184] 秘密保持プログラム生成部 403は、変遷処理命令群生成部 402にて生成された、 機能提供命令群の個数と同数の変遷処理命令群を取得し、取得した複数の変遷処 理命令群をプログラム記憶部 410に格納する。
(1)前処理命令群 310の生成
秘密保持プログラム生成部 403は、呼び出し元のプログラムから 32ビットの入力値 i nl、 in2、 in3を受け取り、受け取った値を選択パラメータ群の初期値として選択パラ メータ用変数に格納する第 1の前処理プログラム命令群と、選択処理命令群呼出命
令に分岐する第 2の前処理プログラム命令群とからなり、これらを順に行う前処理命 令群 310を生成する。
[0185] 秘密保持プログラム生成部 403は、生成した前処理命令群 310をプログラム記憶 部 410へ格納する。
(2)選択処理命令群 320の生成
秘密保持プログラム生成部 403は、選択パラメータ群に基づき、選択対象データ 3 50〜356から 1つを選択し選択識別子とする選択処理命令群 320を生成する。
[0186] なお、選択処理命令群 320の処理は、選択処理命令群 120と同様とほぼ同等の処 理である力 選択処理命令群 320はサブルーチンである点で異なる。具体的には、 選択処理命令群 120は、当該命令群の処理の最後で変遷処理命令群へ分岐する プログラム命令を有するのに対し、選択処理命令群 320はプログラム関数であり、選 択処理命令群 320の最後ではこの関数を呼び出した呼出元に分岐する点が異なる 。ここでは、選択処理命令群 120と同様に、式 1を用いて選択識別子を算出するもの とする。
[0187] 秘密保持プログラム生成部 403は、生成した選択処理命令群 320をプログラム記 憶部 410へ格納する。
(3)選択処理命令群呼出命令 370〜372の生成
秘密保持プログラム生成部 403は、選択処理命令群 320を呼び出す選択処理命 令群呼出命令 370〜372を生成する。
[0188] 秘密保持プログラム生成部 403は、生成した選択処理命令群呼出命令 370〜372 をプログラム記憶部 410へ格納する。
(4)更新処理命令群 380〜382の生成
秘密保持プログラム生成部 403は、選択識別子に対応する選択対象データの値を 読み出す処理を行って、読み出した値を用いて選択パラメータ群の値を更新する処 理を行う更新処理命令群 380〜382を生成する。
[0189] 秘密保持プログラム生成部 403は、生成した更新処理命令群 380〜382をプログ ラム記憶部 410へ格納する。
(5)選択対象データ 350〜351の生成
秘密保持プログラム生成部 403は、更新処理命令群 380〜382にて読み出される データである選択対象データ 350〜356を生成する。秘密保持プログラム生成部 40 3は、生成した選択対象データ 350〜356をプログラム記憶部 410へ格納する。
[0190] 具体的には、選択対象データ 350〜356は、例えば、配列データであって、 C言語 の場合は、以下のような配列である。
Γ
variable— 140 [7] = { 1、 2、 3、 4、 5、 6、 7} ;
J
秘密保持プログラム生成部 403による上記動作により、本発明における選択対象 データをデータとして扱うことができる。
[0191] (6)秘密保持プログラム 300の生成
秘密保持プログラム生成部 403は、プログラム記憶部 410にて記憶されて 、る前処 理命令群 310、選択処理命令群 320、機能提供命令群 360〜362、選択処理命令 群呼出命令 370〜372、更新処理命令群 380〜382、変遷処理命令群 390〜392 及び選択対象データ 350〜356を、図 11に示す順番に配置することにより、変遷処 理命令群 390〜392に含まれる各定数が未決定である秘密保持プログラム 300aを 生成する。
[0192] 次に、秘密保持プログラム生成部 403は、入力部 400にて受け取った初期値(「1」 、「2」、「3」)を用いて、生成した秘密保持プログラム 300aを、更新処理命令群 380 による処理まで実行する。その後、秘密保持プログラム生成部 403は、変遷処理命 令群 390の実行時に、入力部 400にて受け取った秘密情報「100」を用いて、定数 1 を決定し、決定した定数 1を、変遷処理命令群 390に含まれる式 2へ代入する。
[0193] 秘密保持プログラム生成部 403は、次に、更新処理命令群 381による処理まで実 行する。その後、秘密保持プログラム生成部 403は、変遷処理命令群 391の実行時 に、入力部 400にて受け取った秘密情報「200」を用いて、定数 2を決定し、決定した 定数 2を、変遷処理命令群 391に含まれる式 2へ代入する。
秘密保持プログラム生成部 403は、次に、更新処理命令群 382による処理まで実 行する。その後、秘密保持プログラム生成部 403は、変遷処理命令群 392の実行時
に、入力部 400にて受け取った秘密情報「300」を用いて、定数 3を決定し、決定した 定数 3を、変遷処理命令群 392に含まれる式 2へ代入する。
[0194] これにより、秘密保持プログラム生成部 403は、変遷処理命令群 390〜392に含ま れる各定数が決定された秘密保持プログラム 300を生成することができる。
秘密保持プログラム生成部 403は、選択処理命令群呼出命令 370〜372、更新処 理命令群 380〜382、変遷処理命令群 390〜392を配置し、各定数を決定し、対応 する変遷処理命令群の式 2へ代入することにより、各命令群を適切な配置位置へ挿 人することができる。
[0195] 秘密保持プログラム生成部 403は、入力部 400にて受け取った位置情報に基づい て、秘密情報を秘密情報用変数へと変換する。これにより、生成する秘密保持プログ ラムを、秘匿すべき秘密情報を予め変換した秘密変数を用いる処理とすることができ る。
2. 4. 5 プログラム難読化装置 30の動作
ここでは、プログラム難読ィ匕装置 30の動作について、図 14にて示す流れ図を用い て説明する。
[0196] プログラム難読ィ匕装置 30の入力部 400は、難読化対象プログラムと、秘密保持プロ グラム 300を正常系にて実行する際、秘密保持プログラムに与える 3つの初期値 (こ こでは、「1」、「2」、「3」)と、秘密情報の位置を示す位置情報 (ここでは、 3個の秘密 情報「100」、「200」、「300」の位置を示す情報)とを受け付ける(ステップ S400)。
[0197] 機能提供命令群生成部 401は、入力部 400にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力 なる複数のブロックに分割して複数の機能提供命令群 (ここでは、機能提供命令群 360〜362)を生成する (ステップ S405)。
変遷処理命令群生成部 402は、定数が未決定である式 2を含む変遷処理命令群 を、ステップ S405にて生成した機能提供命令群の個数分生成する (ステップ S410) 。ここでは、変遷処理命令群生成部 402は、定数が未決定である式 2を含む変遷処 理命令群 390〜392を生成する。
[0198] 秘密保持プログラム生成部 403は、前処理命令群 310を生成する (ステップ S415)
秘密保持プログラム生成部 403は、選択処理命令群 320を生成する (ステップ S42 0)。
秘密保持プログラム生成部 403は、生成した機能提供命令群の数と同数の選択処 理命令群呼出命令 370〜372を生成する (ステップ S425)。
[0199] 秘密保持プログラム生成部 403は、生成した機能提供命令群の数と同数の更新処 理命令群 380〜382を生成する(ステップ S430)。
秘密保持プログラム生成部 403は、選択対象データ 350〜356を生成する (ステツ プ S435)。
秘密保持プログラム生成部 403は、生成した前処理命令群 310、選択処理命令群 320、機能提供命令群 360〜362、選択処理命令群呼出命令 370〜 372、更新処 理命令群 380〜382、変遷処理命令群 390〜392及び選択対象データ 350〜356 の配置を決定し、秘密保持プログラム 300aを生成する(ステップ S440)。
[0200] 秘密保持プログラム生成部 403は、ステップ S400にて受け取った 3つの初期値、 及び 3つの秘密情報と、秘密保持プログラム 300aとを用いて、未決定である各定数 を決定、及び各秘密情報を秘密情報用変数へと変換し、秘密保持プログラム 300を 生成する(ステップ S445)。
2. 5 変形例
なお、本発明を上記第 2の実施の形態に基づいて説明してきたが、本発明は、上 記の実施の形態に限定されないのはもちろんである。以下のような場合も本発明に 含まれる。
[0201] (1)上記第 2の実施の形態では、秘密情報を算出する算出式として式 2を用いたが 、これに限定されない。秘密情報を算出する算出式は、選択パラメータ用変数を用い る他の式であっても構わな!/、。
(2)上記第 2の実施の形態では、第 1の実施の形態と同様に、選択識別子を算出 する算出式として式 1を用いたが、これに限定されない。選択識別子を算出する算出 式は、選択パラメータ用変数を用いる他の式であっても構わな 、。
[0202] また、選択識別子用変数に初期値を設定しておき、選択識別子用変数を用いた式 であっても構わない。また、選択処理命令群に、選択処理命令群が呼び出された回
数を数えるカウンター用変数を設けておき、カウンター用変数をも用いた式であって も構わない。
また、カウンター用変数は、選択処理命令群以外でカウンターの値を上げる処理を 行ってもよい。
[0203] (3)上記第 2の実施の形態において、機能提供命令群の数を 3つとしたが、これに 限定されない。機能提供命令群の数は、幾つであってもよい。
(4)上記第 2の実施の形態において、選択パラメータの数を 3としたが、これに限定 されな 、。選択パラメータの数は複数個であればょ 、。
この場合の式 2は、「pl X (第 1の選択パラメータ用変数) +p2 X (第 2の選択パラメ ータ用変数) + · · · +pn X (第 nの選択パラメータ用変数) +定数値」となる (nは 2以 上の整数)。なお、 pl、 ρ2、 · · ·、 pnは互いに素である素数である。また、選択パラメ ータの更新時には、第 i 1のパラメータに格納されている値を第 iのパラメータに格納 する。このとき、第 nのパラメータ、第 n— 1のパラメータ、 · · ·、第 2のパラメータの順に 格納する。また、第 1のパラメータには、選択識別子に対応する選択対象データから 読み出した値を格納する。ここで、 iは 2以上 n以下の整数である。
[0204] また、入力値の初期値を「1」、「2」、「3」としたがこの値でなくてもよい。
また、入力値等を 32ビットの値とした力 32ビットより短いビット数であってもよいし、 32ビットより長!、ビット数であってもよ!/ヽ。
(5)上記第 2の実施の形態において、選択情報パラメータの初期値は、秘密保持 プログラムに与えられた値としている構成を、前処理部等で、秘密保持プログラム外 のプログラムやプログラムを実行する機器が有する機能を用いて決定する値としても よい。
[0205] (6)秘密保持プログラムが秘密情報を持つ場合に、秘密情報の値を選択パラメータ 用変数、選択識別子用変数を用いて算出する処理に置き換えても構わない。
(7)上記第 2の実施の形態のプログラム難読ィ匕装置 30において、選択対象データ の数や選択パラメータの数は、必ずしも固定の値である必要はなぐ別の値であって ちょい。
[0206] また、これらの値を、プログラム難読ィ匕装置に入力として与えてもよい。
(8)上記第 2の実施の形態において、ブロックの分割の分割方法として、ここでは簡 単な方法について説明した力 この方法に限定するものではなぐブロックの分割の 仕方に応じた制御構造の解析を行 ヽ、ブロックの分割の仕方に応じた機能提供命令 群を生成すればよい。なお、制御構造の解析については、コンパイラの分野で公知 であるため説明は省略する。
[0207] (9)上記第 2実施の形態において、プログラム難読ィ匕装置 30は、式 2における各定 数を決定した後に、秘密情報を秘密情報用変数に変換したが、これに限定されない 。プログラム難読ィ匕装置 30は、複数の機能提供命令群の生成時に、秘密情報を秘 密情報用変数に変換してもよい。つまり、プログラム難読ィ匕装置 30は、式 2における 各定数を決定する前に、秘密情報を秘密情報用変数に変換してもよい。この場合、 プログラム難読ィ匕装置 30は、各秘密情報を、一時的に記憶し、式 2における各定数 を決定する際には、一時的に記憶している秘密情報を用いる。
[0208] (10)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよ!/、。
2. 6 まとめ
上記第 2の実施の形態では、選択対象の実行順序が、選択パラメータの初期値に よって決定するので、プログラムのみを見て選択パラメータの初期値を知らな 、不正 解析者に対し、選択対象データの実行順序の解析を困難にすることが出来る。
[0209] 更に、第 2の実施の形態では、更新処理命令群に選択パラメータを更新する処理 がある。よって、不正解析者が秘密保持プログラムと、秘密保持プログラムに与えられ る入力値とを知って 、たとしても、選択パラメータの値がどのように変わって!/ヽくかを、 順に解析して ヽかなければ、実際に選択対象が実行される順番を解析することがで きない。
3.第 3の実施の形態
以下、本発明に係る第 3の実施の形態としての秘密保持プログラム 500、プログラム 難読化装置 50及び秘密処理装置 60について、図面を参照して説明する。
[0210] 非特許文献 2及び第 1の実施の形態の難読化手法では、正しい手順においては、 各ブロックが 1度ずつしか実行されない。このことを不正解析者が知っていた場合、 効率的な解析を行うことが可能となる。
例えば、第 1の実施の形態において、プログラムの正しい初期値の組み合わせを知 らない不正解析者が、初期値の組み合わせを「0」、 「0」、 「0」と仮定した場合、秘密 保持プログラム 100は、まず、式 1を実行すると選択識別子「0」を取得し、選択対象 データ 143へ分岐する。そして、更新処理命令群 163を実行することにより、各選択 ノ ラメータの値はそれぞれ、「1」、 「0」、 「0」となる。秘密保持プログラム 100は、さら に、更新された値「1」、 「0」、 「0」を用いて、式 1を実行すると選択識別子「2」を取得 し、選択対象データ 142へ分岐する。そして、更新処理命令群 162を実行することに より、各選択パラメータの値はそれぞれ、「6」、 「1」、 「0」となる。秘密保持プログラム 1 00は、さら〖こ、更新された値「6」、 「1」、 「0」を用いて、式 1を実行すると選択識別子「 1」を取得し、各選択パラメータは、「3」、 「6」、 「1」に更新される。秘密保持プログラム 100は、値「3」、 「6」、 「1」を用いて、式 1を実行すると選択識別子「1」を取得すること になる。これは、選択対象データ 141が 2回実行されることになる。
[0211] もし、不正解析者が同じブロックが重複して実行されることがないことを知っていた ならば、この時点で選択対象データ 141が重複して実行される初期値の組み合わせ を「0」、 「0」、 「0」と仮定する実行手順は間違いであったことを知ることができる。この 場合、その後のプログラムの解析を続けてウォーターマーク除去ツールを作成するま でもなぐこの仮定が間違っていたことが分かり、効率的な解析を行うことが出来る。 すなわち、上記全数攻撃に力かる時間を短くすることができる。
[0212] そこで、本実施の形態では、どのような初期値の組み合わせを用いても、同じブロッ クが重複して実行されることない秘密保持システム 3を提供する。
3. 1 秘密保持システム 3の概要
秘密保持システム 3は、図 15に示すように、プログラム難読化装置 50と、秘密処理 装置 60とから構成されて 、る。
[0213] プログラム難読ィ匕装置 50は、実行順序を隠蔽した ヽ難読化対象プログラムから秘 密保持プログラム 500を生成し、生成した秘密保持プログラム 500を秘密処理装置 6 0へ配布する。
秘密処理装置 60は、プログラム難読ィ匕装置 50から配布された秘密保持プログラム 500を実行する。
[0214] 3. 2 秘密保持プログラム 500の構造
秘密保持プログラム 500の構造について説明する。秘密保持プログラム 500は、プ ログラムに含まれるプログラム命令群がどのような実行順序で実行されるかを、不正 解析者に解析されな ヽように、難読化されたプログラムである。
秘密保持プログラム 500は、図 16に示すように、前処理命令群 510、選択処理命 令群 520、管理情報更新命令群 525、変遷処理命令群 530、選択対象データ 540、 541、 · · ·、 546力らなり、これらが図 16に示す順番に配置されている。
[0215] また、選択対象データ 540〜546はそれぞれ、選択対象主要命令群 550〜556、 更新処理命令群 560〜566、分岐命令群 570〜576力らなり、これらは図 16に示す 順番に配置されている。各命令部は、 1以上のプログラム命令力もなるプログラム命 令群である。選択対象主要命令群 550〜556は、このプログラムが提供する機能 (例 えばウォーターマーク検出の機能)の処理の一部を示すプログラム命令群であるか、 あるいは、提供する機能とは無関係で正常系の実行時には実行されない命令群であ る。ここで、正常系とは、デバッガ等を用いてプログラムカウンタや選択パラメータを強 制的に変更するなどの特別な操作を行わずに秘密保持プログラム 500を実行する場 合のことをいう。
[0216] 難読対象プログラムは、例えば、図 17に示すコントロールフローのプログラムを実 行するプログラムである。ここで、図 17における第 1機能提供命令群 601、第 2機能 提供命令群 602、第 3機能提供命令群 603は、プログラム命令の集合であり、図 17 に示すフローで実行された場合に適切な結果を出力する命令群である。しかしなが ら、これをそのままの順番で実行すると解析が容易となるため、秘密保持プログラム 5 00においてはこの実行順序を解析されに《する難読ィ匕が施されている。すなわち、 秘密保持プログラム 500は複数の選択対象データ 540〜546のいずれかに第 1機能 提供命令群 601、第 2機能提供命令群 602、第 3機能提供命令群 603が含まれるよ うに難読ィ匕されている。
[0217] ここでは、選択対象データ 545、 546、 543に、それぞれ第 1機能提供命令群 601 、第 2機能提供命令群 602、第 3機能提供命令群 603が含まれているものとし、正常 系の実行時には、選択対象データ 545、 546、 543が順に選択されて実行されるも
のとして説明を続ける。また、第 1〜第 3機能提供命令群が割り当てられていない選 択対象データ 540、 541、 542、 544は、正常系では実行されることのない選択対象 データである。これらは、正しい実行順序を知らない不正解析者が全数攻撃により解 析を行う際には実行される場合がある選択対象データであり、不正解析者が第 1〜 第 3の機能提供命令群を得に《するために組み込まれている。以下では、このような 命令群を偽装機能提供命令群と呼ぶ。
[0218] ここで、秘密保持プログラム 500のコントロールフローの一例を、図 18に示す。秘密 保持プログラム 500は、このコントロールフローにて示すように、まず、前処理命令群 510、選択処理命令群 520、管理情報更新命令群 525、変遷処理命令群 530を順 次実行し、その後、変遷処理命令群 530に基づいて、選択対象データ 540〜546の 何れかが実行される。秘密保持プログラム 500は、この処理を、選択対象データ 543 が実行されるまで、繰り返す。秘密保持プログラム 500は、変遷処理命令群 130が何 らかの分岐を行うことは分力ゝつても、選択対象データが実行される順番は分からな ヽ ような構造になっている。
[0219] ここで、秘密保持プログラム 500の具体例として C言語にて記述した秘密保持プロ グラム 500aを、図 19に示す。
プログラム命令群 510aは前処理命令群 510に対応し、プログラム命令群 520aは 選択処理命令群 520に対応し、プログラム命令群 525aは管理情報更新命令群 525 に対応し、プログラム命令群 530aは変遷処理命令群 530に対応している。また、プ ログラム命令群 540a、 543a, 545a, 546aのそれぞれは、選択対象データ 540、 54
3、 545、 546と対応して!/ヽる。
[0220] プログラム命令群 550a、 553a, 555a, 556aのそれぞれは、選択対象主要命令群 550、 553、 555、 556と対応して!/ヽる。プログラム命令群 560a、 563a, 565a, 566 aのそれぞれは、更新処理命令群 560、 563、 565、 566と対応して!/ヽる。また、プロ グラム命令群 570a、 573a, 575a, 576aのそれぞれは、分岐命令群 570、 573、 57
4、 576と対応している。なお、選択対象データ 541、 542、 544に対応する具体例は 、図面の都合上記述していない。
[0221] また、図 20において、図 19に示すプログラムの処理の流れを具体的に示す。
秘密保持プログラム 500は、呼出元のプログラムから、入力値 in— 1、 in— 2および 、このプログラムが提供する機能の処理を行う際に使用するパラメータを受け取り、こ のプログラムが提供する機能の前処理を行うプログラム命令群である。ここで、入力 値 in— 1および in— 2は、選択処理命令群 520での処理に用いる選択パラメータ CP —1および CP— 2の初期値であるものとする。本実施の形態においては、選択対象 データの数が 7つであるため、 in— 1および in— 2は、 7未満の非負整数であるものと して説明する。
[0222] ここで、秘密保持プログラム 500は、選択パラメータ CP— 1、 CP— 2を示す変数とし て「cp— 1」、「cp— 2」を、選択識別子 swVarを示す変数として「sv」を用いて!/、るもの とする。なお、選択パラメータは、選択対象データ 540、 541、 · · ·、 546から 1の選択 対象を決定する際に、使用されるパラメータであり、選択識別子は、選択対象データ を一意に識別する識別子であり、次に実行すべき選択対象データを特定する情報で ある。
[0223] 以下、図 18の各ブロックと、図 20の各ブロックとの対応関係を説明する。
図 20おいては、図 18の前処理命令群 510は、ブロック 650に記載の「cp— l = l ; c p— 2 = 2 ;tb [7] =0 ;」に相当する。選択処理命令群 520は、ブロック 651に記載の「 label A: sv= (cp_l +cp_2 * 2) %7 ; while (tb [sv] = = 1) {sv= ( + + sv) %7 山に相当する。また、管理情報更新命令群 525は、ブロック 652に記載の「tb [sv] = 1 ;」に相当し、変遷処理命令群 530は、ブロック 653に記載の「switch (sv)」に相 当し、選択対象データ 540〜546は選択対象データ 660〜666に相当して!/、る。
[0224] また、図 16に示す更新処理命令群 560〜566は、選択対象データ 660〜666に 含まれるそれぞれの「cp—l = Cp2 ; cp2—SV;」に相当する。また、第 1〜第 3機能提 供命令群のそれぞれは、「a = b = 2 ;」、「a * b;」、 [a—一 ;]に相当し、それぞれは選 択対象データ 665、 666、 663に含まれている。したがって、偽装機能提供命令群は 、選択対象データ 660、 661、 662, 664に含まれる「a= 1、 a= 2 ;」「a * =b ;b + = a;」「b——; J「a = b/a」である。
[0225] また、分岐命令群 570〜572及び 574〜586は、「goto label A;」に相当し、分 岐命令群 573は、「return;」に相当する。
それぞれの命令群の具体的な動作については以下で詳しく説明する。
3. 2. 1 前処理命令群 510
前処理命令群 510は、選択処理命令群 520で用いる選択パラメータ群の初期値を 算出するプログラム命令群である。
[0226] 前処理命令群 510は、秘密保持プログラム 500が起動された際に、最初に実行さ れるプログラム命令群である。
前処理命令群 510は、具体的には、呼び出し元のプログラム力 入力値 in— 1、 in —2を受け取り、受け取った値を選択パラメータ群の初期値として選択パラメータ CP — 1〜CP— 2に格納する命令群と、選択対象データの個数と同数の管理情報の初 期ィ匕命令とからなるプログラム命令群である。ここで、管理情報のそれぞれは、選択 対象データと対応しており、対応する選択対象データが実行されたか否かを管理し ている。
[0227] ここでは、前処理命令群 510は、選択パラメータ CP— 1〜CP— 2にそれぞれ、 in— 1、 in— 2の値を格納する処理を行う。また、正常系の実行時には、入力値 in— 1、 in — 2として値「1」、「2」が与えられるものとする。
前処理命令群 510は、管理情報の初期化として、秘密処理装置 60が有する管理 情報を初期化する。ここでは、管理情報は、 6個の配列からなり、前処理命令群 510 は、これら全ての値に未実行を示す「0」を代入することにより、管理情報の初期化を 行っている。
[0228] ここで、前処理命令群 510は、図 20におけるブロック 650に記載の「cp— l =in— 1 ; cp— 2 = in— 2; tb [7] = 0;」に相当する。
3. 2. 2 選択処理命令群 520
選択処理命令群 520は、選択パラメータ群を用いて、選択識別子を算出するプロ グラム命令群である。
[0229] 以下、選択処理命令群 520が選択識別子を算出する処理について説明する。なお 、以下の説明では、選択対象データの数を NNという記号で表す。
まず、選択処理命令群 520は、値 NNと、値 NNと互いに素な整数である pi及び p2 とを用いた式 3「pl X (選択パラメータ CP_1) +p2 X (選択パラメータ CP_2) mo
d NN」により、仮の選択識別子を算出する。ここで演算子「X」は掛け算を表す。ま た、 piと NNと互いに素とは piと NNの最大公約数が 1であることを示す。ここでは、 p
1、 p2、及び NNをそれぞれ、「1」、「2」、及び「7」とする。
[0230] 次に、選択処理命令群 520は、式 3の結果を仮の選択識別子 swVarとして選択識 別子用変数 svに格納する。続いて、選択処理命令群 520は、 svが示す選択対象デ ータが既に実行されている力否力判断する。
svが示す選択対照データが未実行であると判断する場合には、選択処理命令群 5
20は、 svの値を変更せず、選択識別子の値を現在の svの値に決定する。
[0231] svが示す選択対象データが既に実行されて!、ると判断する場合は、選択処理命令 群 520は、算出した値以降で直近の未実行の選択対象データを検索する。ここで、 算出した値以降の全ての選択対象データが既に実行済みであった場合には、選択 処理命令群 520は、最初の選択対象データから順に未実行の選択対象データを検 索する。
選択処理命令群 520は、検索により見つかった選択対象データの番号を選択識別 子用変数 svに格納する。このような処理を行うことにより、算出した値に対応する選択 対象データが既に実行されている場合でも、未実行の選択対象データが常に選択さ れることとなり、正常系の実行時であるカゝ否かに関わらず、常に異なる対象データが 実行されることとなる。
[0232] ここで、選択処理命令群 520は、図 20におけるブロック 651に記載の「sv= (cp— 1
+ cp— 2 * 2) % 7; while (tb [sv] = = 1 ) { sv = ( + + sv) % 7; }」に相当する。
3. 2. 3 管理情報更新命令群 525
管理情報更新命令群 525は、選択処理命令群 520で選択した選択対象データに 対応する管理情報を、「実行済み」を示す状態に更新するプログラム命令群である。 具体的には、図 20におけるブロック 652に記載の「tb [sv] = 1;」に相当する。
[0233] 例えば、選択処理命令群 520の動作の結果、選択識別子用変数 svの値が「5」に なった場合には、管理情報更新命令群 525は、選択対象データ 545に対応する管 理情報 tb [5]の値を、未実行を示す「0」から実行済みを示す「 1」へと更新する。
3. 2. 4 変遷処理命令群 530
変遷処理命令群 530は、選択処理命令群 520で選択した選択識別子に基づき、 いずれかの選択対象データ 540〜546に分岐する処理を行うプログラム命令群であ る。具体的には、選択識別子用変数 svの値が、 0、 1、 · · ·、 6の場合にそれぞれ、選 択対象データ 540、 541、 · · ·、 546への分岐を行うプログラム命令群である。
[0234] 具体例として、秘密保持プログラム 500が記述されるプログラムが C言語のプロダラ ムであり、選択対象データ 540、 541、 · · ·、 546の先頭に、それぞれラベル「label— 140 :」、「label— 141 :」、 · · ·、「label— 146 :」が記述されている場合には、変遷処 理命令群 530は以下のようなプログラム命令となる。
[0235] 「
switcn (sv) t
case 0 : goto label― 140 ;
case 1 : goto label― 141; case 6: goto label― 146;
J
3. 2. 5 選択対象データ 540〜546
選択対象データ 540〜546は、変遷処理命令群 530により分岐してきた際に、実 行されるプログラム命令群である。
[0236] 選択対象データ 540〜546は、それぞれ、選択対象主要命令群 550〜556、更新 処理命令群 560〜566、分岐命令群 570〜576からなるプログラム命令群である。 選択対象主要命令群 550〜556は、各選択対象データにおいて行うべき処理を示 すプログラム命令群である。具体的には、例えば、選択対象データ 660に記載の「a
= l ;b = 2 ;」がこれに当たる。
[0237] 更新処理命令群 560〜566は、選択パラメータ群に含まれる各値の更新を行うプロ グラム命令群である。ここでは、一例として、選択パラメータ変数 cp— 2に格納されて いる値を選択パラメータ変数 cp— 1に代入し、選択パラメータ変数 cp— 2に、選択識 別子用変数 svの値を代入している。具体的には、図 20における選択対象データ 66
0〜666のそれぞれに含まれる「cp— 1 = cp2 ; cp_2 = sv;」がこれに当たる。
[0238] 分岐命令群 570〜576は、それぞれ選択対象データ 540〜546の外にある選択処 理命令群 520へ分岐するプログラム命令群、及びプログラム呼出元に制御を戻す処 理のプログラム命令群の 、ずれかである。
ここで、最後に実行されるべき第 3機能提供命令群を含む選択対象データ 543の 分岐命令群 573は、プログラム呼び出し元に制御を戻す処理のプログラム命令群で あり、他の選択対象データに含まれる分岐命令群は、選択処理命令群 120へ分岐 するプログラム命令群である。具体的には、図 20における選択対象データ 660〜66 6のそれぞれに含まれる「goto label A;」、又は「return」がこれに当たる。
[0239] 3. 3 秘密処理装置 60
ここでは、秘密保持プログラム 500を実行する秘密処理装置 60につ ヽて述べる。 秘密処理装置 60は、図 21に示すように、制御部 700と記憶部 701とから構成され ている。
秘密処理装置 60は、具体的には、マイクロプロセッサ、 ROM、 RAM,ハードデイス クユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコンピュータ システムである。前記 RAM又は前記ハードディスクユニットには、コンピュータプログ ラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を達成するた めに、コンピュータに対する指令を示す命令コードが複数個組み合わされて構成さ れたものである。前記マイクロプロセッサ力 前記コンピュータプログラムに従って動 作することにより、秘密処理装置 60は、その機能を達成する。つまり、前記マイクロプ 口セッサは、前記コンピュータプログラムに含まれる各命令を 1個ずつ読み出し、読み 出した命令を解読し、解読結果に従って動作する。
[0240] 3. 3. 1 記憶部 701
記憶部 701は、図 21に示すように、第 1プログラム記憶部 702、第 2プログラム記憶 部 703、管理情報保持部 704、及び選択パラメータ群保持部 705を有している。
(1)第 1プログラム記憶部 702
第 1プログラム記憶部 702は、秘密保持プログラムに含まれる複数の選択対象デー タを記憶している。ここで、選択対象データは、秘密情報を用いた処理の手順を示す
情報であり、具体的にはプログラム命令の集合等である。これらの選択対象データは
、制御部 700からの指示に応じていずれかが選択され、秘密処理装置 60により選択 された選択対象データに示される手順が実行される。また、選択対象データは、秘密 情報を用いた演算の正し 、手順を分割したもの、又は正常系では実行されることの な 、偽装の秘密情報を用いた演算を含むものである。
[0241] なお、ここでは、第 1プログラム記憶部 702には、選択対象データ 540、 541、 · · ·、 546の計 7つが記憶されているとする力 この数が 7つに限られるものではないことは 言うまでもない。
(2)第 2プログラム記憶部 703
第 2プログラム記憶部 703は、秘密保持プログラムに含まれる複数の選択対象デー タ以外のプログラム命令を記憶して 、る。
[0242] 具体的には、第 2プログラム記憶部 703は、秘密保持プログラム 500に含まれる前 処理命令群 510、選択処理命令群 520、管理情報更新命令群 525、変遷処理命令 群 530を記憶している。
(3)管理情報保持部 704
管理情報保持部 704は、各選択対象データのそれぞれに対して、選択対象データ の実行及び未実行の情報を管理する管理情報を保持している。
[0243] 管理情報保持部 704は、図 22に示すように、管理情報テーブル T700を有してい る。
管理情報テーブル T700は、選択対象データの個数からなり、選択対象データの それぞれに対応する管理情報を記憶する領域を有している。
管理情報テーブル T700に含まれる管理情報 710〜716のそれぞれは、順に、選 択対象データ 540〜546に対応している。
[0244] 管理情報 710〜716格納される初期値は、未実行であることを示す値「0」である。
選択対象データが制御部 700により選択されると、対応する管理情報は、制御部 7 00により値「0」から実行済であることを示す値「 1」へと更新される。
(4)選択パラメータ群保持部 705
選択パラメータ群保持部 705は、選択パラメータ CP 1、 CP 2からなる選択パラ
メータ群を保持する。
[0245] 3. 3. 2 制御部 700
制御部 700は、秘密処理装置 60全体の動作を制御し、秘密情報を用いた処理 (秘 密保持プログラム)を解析が困難になるように実行する。
制御部 700は、図 23に示すように、全体処理部 720、前処理部 721、選択処理部 722、管理情報更新部 723、変遷処理部 724、及び更新処理部 725を有している。
[0246] なお、制御部 700は、これらの構成要素を別個の構成として備えるのではなぐ制 御部 700が随時これらの構成要素それぞれの機能を果たすものとしてもよい。
(1)前処理部 721
前処理部 721は、秘密保持プログラムが起動された際に、最初に動作する。
前処理部 721は、第 2プログラム記憶部 703から前処理命令群に含まれる 1以上の プログラム命令を、全体処理部 720を介して、読み出し、読み出した 1以上のプロダラ ム命令を秘密保持プログラムの構造に基づ 、て、順次実行する。
[0247] 具体的には、前処理部 721は、まず、呼出元のプログラム力 の入力値 in— 1、 in —2を、選択パラメータ CP— 1及び CP— 2の初期値として取得し、取得した選択パラ メータ CP— 1及び CP— 2を、全体処理部 720を介して選択パラメータ群保持部 705 へ格納する。次に、前処理部 721は、管理情報保持部 704の初期化を行う。つまり、 管理情報テーブル T700に含まれる各管理情報の値を「0」に設定する。
[0248] (2)選択処理部 722
選択処理部 722は、選択パラメータを用いて選択識別子 swVarを決定する。
選択処理部 722は、第 2プログラム記憶部 703から選択処理命令群に含まれる以 上のプログラム命令を、全体処理部 720を介して、読み出し、読み出した 1以上のプ ログラム命令を秘密保持プログラムの構造に基づ 、て、順次実行する。
[0249] 具体的には、選択処理部 722は、選択パラメータ群保持部 705に格納されている 選択パラメータ CP— 1及び CP— 2と、選択処理命令群に含まれる式 3とを用いて、仮 の選択識別子を算出する。選択処理部 722は、管理情報テーブル T700を用いて、 算出した仮の選択識別子に対応する選択対象データが実行済であるカゝ否かを判定 する。
実行済であると判定する場合には、選択処理部 722は、未実行の選択対象データ を示す識別子を取得し、取得した値を選択識別子 swVarとする。
[0250] 未実行であると判定する場合には、選択処理部 722は、算出した仮の選択識別子 を、選択識別子 swVarとする。
このような処理を行うことにより、選択処理部 722は、選択識別子 swVarとして、常 に未実行の選択対象データに対応する値を取得することができる。すなわち、選択 ノ ラメータの初期値がどのような値であっても同一の選択対象データが重複して実行 されることはなくなるため、不正解析者による解析を困難にすることができる。
[0251] (3)管理情報更新部 723
管理情報更新部 723は、選択処理部 722にて選択された選択対象データに対応 する管理情報を更新する。
管理情報更新部 723は、第 2プログラム記憶部 703から管理情報命令群に含まれ る以上のプログラム命令を、全体処理部 720を介して、読み出し、読み出した 1以上 のプログラム命令を秘密保持プログラムの構造に基づ 、て、順次実行する。
[0252] 具体的には、管理情報更新部 723は、管理情報テーブル T700に含まれる複数の 管理情報のうち、選択処理部 722にて取得された選択識別子 swVarに対応する管 理情報を、値「0」から値「1」へと更新する。
例えば、図 22において、選択処理部 722が選択識別子 swVarの値を「5」とした場 合には、管理情報更新部 723は、選択対象データ 545に対応する管理情報 715の 値を「1」に更新する。
[0253] (4)変遷処理部 724
変遷処理部 724は、選択処理部 722で選択された選択識別子 swVarに基づき、 複数の選択対象データのうち、分岐先の選択対象データを決定し、決定した選択対 象データに含まれる選択対象主要命令群を実行する。
変遷処理部 724は、第 2プログラム記憶部 703から変遷処理命令群に含まれる以 上のプログラム命令を、全体処理部 720を介して、読み出し、読み出したプログラム 命令を秘密保持プログラムの構造に基づ 、て、順次実行する。
[0254] 具体的には、変遷処理部 724は、選択処理部 722で選択された選択識別子 swVa
rに基づき、複数の選択対象データのうち、分岐先の選択対象データを決定する。 変遷処理部 724は、決定した選択対象データに含まれる選択対象主要命令群を、 全体処理部 720を介して、読み出し、読み出した選択対象主要命令群を実行する。
(5)更新処理部 725
更新処理部 725は、選択された選択対象データに含まれる選択対象主要命令群 が実行された後に、選択パラメータの値を更新する処理を行う。
[0255] 更新処理部 725は、選択された選択対象データに含まれる更新処理命令群を、全 体処理部 720を介して第 1プログラム記憶部 702から、読み出し、読み出した更新処 理命令群を実行する。
具体的には、更新処理部 725は、選択パラメータ群保持部 705に格納されている 選択パラメータ CP_1及び CP_2と、選択識別子とを用いて、選択パラメータ CP_ 1及び CP— 2の更新を行う。更新方法については、上述しているので、ここでの説明 は省略する。
[0256] (6)全体処理部 720
全体処理部 720は、制御部 700に含まれる各構成部の動作の制御を行う。
全体処理部 720は、秘密保持プログラムの実行開始時には、前処理部 721、選択 処理部 722、管理情報更新部 723、変遷処理部 724、更新処理部 725の順に動作 するように制御する。
[0257] 全体処理部 720は、選択対象データに含まれる分岐命令群に基づ!/、て、秘密保 持プログラムの終了の制御、及び選択処理部 722、管理情報更新部 723、変遷処理 部 724、更新処理部 725の順に動作するように制御の ヽずれかを行う。
具体的には、全体処理部 720は、選択された選択対象データに含まれる分岐命令 群を、全体処理部 720を介して第 1プログラム記憶部 702から、読み出す。
[0258] 全体処理部 720は、読み出した分岐命令群力 選択処理命令群への分岐を示す プログラム命令群である場合には、選択処理部 722、管理情報更新部 723、変遷処 理部 724、更新処理部 725の順に動作するように制御する。
全体処理部 720は、読み出した分岐命令群力 プログラム呼出元に制御を戻す処 理のプログラム命令群である場合には、全体処理部 720は、秘密保持プログラムを
終了し、秘密保持プログラムの呼び出し元に制御を戻す。
[0259] 3. 3. 3 秘密処理装置 60の動作
ここでは、秘密処理装置 60の動作を、図 24にて示す流れ図を用いて説明する。 秘密処理装置 60の前処理部 721は、呼出元のプログラム若しくは外部装置等から の入力値 in— 1、 in— 2を、選択パラメータ CP— 1及び CP— 2の初期値として取得し 、取得した選択パラメータ CP_1及び CP_2を、全体処理部 720を介して選択パラ メータ群保持部 705へ格納し、管理情報保持部 704の管理情報テーブル T700の初 期化を行う(ステップ S 500)。
[0260] また、前処理部 721は、必要であれば、記憶部 701上に第 1プログラム記憶部 702 、第 2プログラム記憶部 703、管理情報保持部 704、選択パラメータ群保持部 705〖こ 用いる領域を確保し、各領域に記憶される値の初期化を行う。
選択処理部 722は、選択パラメータ群保持部 705に格納されている選択パラメータ CP— 1及び CP— 2と、選択処理命令群に含まれる式 3とを用いて、仮の選択識別子 を算出する (ステップ S505)。
[0261] 選択処理部 722は、管理情報テーブル T700を用いて、算出した仮の選択識別子 に対応する選択対象データが実行済であるか否かを判定する (ステップ S510)。 実行済であると判定する場合には (ステップ S510における「YES」)、選択処理部 7 22は、仮の選択識別子を更新する (ステップ S515)。ここで、ステップ S510および S 515の具体例は、図 20におけるブロック 651に含まれる「while(tb[sv] = = l){sv=( + +sv)%7 ;」等である。この例では、 tb[sv]の値が 1 (実行済みを示す)である限り、 s Vをインクリメントしていくことにより、未実行の選択対象データに相当する選択識別子 を探索している。
[0262] 未実行であると判定する場合には (ステップ S510における「NO」)、選択処理部 72 2は、算出した仮の選択識別子を、選択識別子 swVarとする。管理情報更新部 723 は、管理情報テーブル T700に含まれる複数の管理情報のうち、選択識別子 swVar に対応する管理情報を、値「0」力も値「 1」へと更新する (ステップ S520)。
変遷処理部 724は、選択識別子 swVarに基づき、複数の選択対象データのうち、 分岐先の選択対象データを取得し、取得した選択対象データに含まれる選択対象
主要命令群を実行する (ステップ S525)。
[0263] 更新処理部 725は、選択パラメータ群保持部 705に格納されている選択パラメータ
CP— 1及び CP— 2と、選択識別子とを用いて、選択パラメータ CP— 1及び CP— 2の 更新を行う(ステップ S530)。
全体処理部 720は、選択された選択対象データに含まれる分岐命令群がプロダラ ムの終了を示すか否かを判断する(ステップ S535)。
[0264] 分岐命令群がプログラムの終了を示すと判断する場合には (ステップ S535におけ る「YES」)、全体処理部 720は、秘密保持プログラムを終了し、秘密保持プログラム の呼び出し元に制御を戻す。
分岐命令群がプログラムの終了を示さないと判断する場合には (ステップ S535に おける「NO」)、つまり、分岐命令群が、選択処理命令群への分岐を示すと判断する 場合には、全体処理部 720は、ステップ S505へ戻る。
[0265] ステップ S535は、具体的には、選択された選択対象データに含まれる分岐命令群 が選択処理命令群に分岐する命令群 (例えば、 goto文)である場合には、判断結果 を「NO」とし、分岐命令群がプログラムの終了を示す命令群 (例えば、 return文)で ある場合には、判断結果を「YES」とする。
3. 4 プログラム難読化装置 50
ここでは、実行順序を隠蔽したい難読ィ匕対象プログラムから、秘密保持プログラム 5 00を生成するプログラム難読ィ匕装置 50について述べる。
[0266] プログラム難読ィ匕装置 50は、図 25に示すように、プログラム記憶部 800、入力部 8 01、機能提供命令群生成部 802、偽装機能提供命令群生成部 803、配置順序決定 部 804、管理命令群生成部 805、秘密保持プログラム生成部 806、及び出力部 807 から構成されている。
プログラム難読化装置 50は、具体的には、マイクロプロセッサ、 ROM、 RAM、ノヽ ードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコン ピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビユー タプログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を達成 するために、コンピュータに対する指令を示す命令コードが複数個組み合わされて
構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラムに従つ て動作することにより、プログラム難読ィ匕装置 50は、その機能を達成する。つまり、前 記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1個ずつ読 み出し、読み出した命令を解読し、解読結果に従って動作する。
[0267] 3. 4. 1 プログラム記憶部 800
プログラム記憶部 800は、当該装置で生成した各命令群、及び選択対象データを 記憶するための領域を有して 、る。
3. 4. 2 入力部 801
入力部 801は、難読ィ匕対象となるプログラム、及び生成した秘密保持プログラムに 与える 2つの初期値を受け付ける。
[0268] 3. 4. 3 機能提供命令群生成部 802
機能提供命令群生成部 802は、入力部 801にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力もなる複数のブロックに分割する。機能提供命令群生成 部 802は、分割した各ブロックを、機能提供命令群とする。これにより、機能提供命令 群生成部 802は、入力部 801にて受け付けた難読ィ匕対象プログラム力も複数の機能 提供命令群を生成することができる。
[0269] 機能提供命令群生成部 802は、複数のブロックに分割する際に、難読化対象プロ グラムに条件飛び越しを行うプログラム命令が含まれる場合には、機能提供命令群 生成部 802は、その条件飛び越しを行うプログラム命令と複数ある飛び越し先のプロ グラム命令とが全て同じブロックに含まれるように分割を行う。このように分割すること で、機能提供命令群生成部 802は、一つのブロックからの分岐先を必ず一つのプロ ックにすることが出来る。
[0270] また、入力プログラムに無条件飛び越しを行うプログラム命令がある場合には、機能 提供命令群生成部 802は、その無条件飛越を行うプログラム命令と飛び越し先のプ ログラム命令とは同じブロックになるように分割を行う。このように分割することで、機 能提供命令群生成部 802は、一つのブロックに対する分岐元を必ず一つのブロック にすることが出来る。
[0271] ここで、「条件飛び越しを行う命令」とは、所定の条件に従ってプログラム命令を飛
ばすような命令であり、具体的には、「if (a= =0) goto labelA;」等であるこの場 合、変数 aがゼロであるという条件が満たされた場合に、 labelAへとプログラム命令の 飛び越しを行う。また、「無条件飛び越しを行う命令」とは、常にプログラム命令を飛ば す命令であり、具体的には「goto labelA;」等である。この場合、特に変数の値等に 関わらず、常に labelAへの飛び越しが行われる。
[0272] ここでは、機能提供命令群生成部 802は、 3つの機能提供命令群に分割したものと する。この場合におけるコントロールフローグラフは、図 17と同様になる。すなわち、 前述したように飛び越し命令の飛び越し元と飛び越し先とが 1つのブロックに含まれ るよう分割しているので、生成されるブロックのコントロールフローグラフは、分岐のな いコントロールフローとなる。ここでは、コントロールフローの始点となるブロックから順 番に、各ブロックを構成するプログラム命令群を第 1、第 2及び第 3機能提供命令群と する。
[0273] 3. 4. 4 偽装機能提供命令群生成部 803
偽装機能提供命令群生成部 803は、入力部 801にて受け付けた難読化対象プロ グラムを元に、複数の偽装機能提供命令群を生成する。
偽装機能提供命令群生成部 803は、例えば、難読化対象プログラムが記述されて いるプログラミング言語のプログラム命令をランダムに組み合わせた偽装機能提供命 令群を生成する。
[0274] なお、難読化対象プログラムに含まれて!/、るプログラム命令のみを用いてランダム あるいは手動で偽装機能提供命令群を生成しても構わないし、入力プログラム内に ない命令を適当に生成しても構わない。また、プログラミング言語力 C言語、 Java ( 登録商標)言語などのコンパイル処理を行うプログラミング言語である場合には、コン パイルが通るように入力プログラムで使われて ヽる変数を用いて偽装機能提供命令 群を生成する。また、入力プログラムで使われていない変数を偽装機能提供命令群 に含める場合には、難読ィ匕後のプログラムにそのような変数の宣言を追加することに よりコンノィルに失敗しないようにする。
[0275] ここでは、偽装機能提供命令群生成部 803は、 4つの偽装機能提供命令群を生成 したものとして説明を続ける。
3. 4. 5 管理命令群生成部 805
管理命令群生成部 805、秘密保持プログラム 500のうち、難読ィ匕対象プログラムに 依存しないプログラム命令群を生成する。すなわち、図 16の秘密保持プログラム 500 を例にすると、難読化対象プログラムに依存して変化するのは、難読化対象プロダラ ムの手順を分割したものである選択対象主命令群である 150〜 156であるため、管 理命令群生成部 805は、その他の命令群を生成する。
[0276] 具体的には、管理命令群生成部 805は、前処理命令群 510、選択処理命令群 52 0、管理情報更新命令群 525、変遷処理命令群 530、 1個の更新処理命令群、分岐 先が選択処理命令群を示すプログラム命令群からなる第 1の分岐命令群、及びプロ グラム呼出元に制御を戻す処理のプログラム命令群力 なる第 2の分岐命令群を生 成する。
このとき、管理命令群生成部 805は、機能提供命令群生成部 802にて生成された 複数の機能提供命令群の個数 (ここでは、 3個)と、偽装機能提供命令群生成部 803 にて生成された複数の偽装機能提供命令群の個数 (ここでは、 4個)とを取得し、そ の合計値を算出する。管理命令群生成部 805は、算出した合計値 (ここでは、 7)と同 数のラベル名を生成する。管理命令群生成部 805は、選択処理命令群 520に含ま れる式 3が取り得る値のそれぞれに対して、分岐先として、生成したラベル名を対応 付けることにより、変遷処理命令群 530を生成する。
[0277] 管理命令群生成部 805は、生成した各ラベル名のみ力もなる選択対象データを生 成する。ここでは、管理命令群生成部 805は、 7個の選択対象データ 540〜546を 生成する。
ここで、管理命令群生成部 805は、生成した前処理命令群 510、選択処理命令群 520、管理情報更新命令群 525、変遷処理命令群 530、 1個の更新処理命令群、第 1の分岐命令群、及び第 2の分岐命令群をプログラム記憶部 800へ格納する。
[0278] また、管理命令群生成部 805は、生成した各ラベル名のみからなる選択対象デー タ 540〜546をもプログラム記憶部 800へ格納する。
3. 4. 6 配置順序決定部 804
配置順序決定部 804は、生成した機能提供命令群 (ここでは、 3つの機能提供命
令群)、および偽装機能提供命令群 (ここでは、 4つの偽装機能提供命令群)をどの ような順序で選択対象主要命令群 550〜556に割り当てるのかを決定する。具体的 には、配置順序決定部 804は、選択対象主要命令群 550〜556のいずれに第 1〜 第 3機能提供命令群を配置するかを決め、残り 4つの選択対象主要命令群のいずれ に偽装機能提供命令群を配置するかを決める。
[0279] 配置順序決定部 804は、上述した式 3を予め記憶している。ここでは、式 3における pl、 p2、及び NNをそれぞれ、「1」、「2」、及び「7」とする。
なお、ここでは、後述する管理命令群生成部 805にてラベル名からなる選択対象 主要命令群 550〜556が生成されて!、るものとする。
配置順序決定部 804は、入力部 801にて受け付けた 2つの選択パラメータの初期 値と、予め記憶している式 3を用いて、実際にどのような順序で選択識別子が算出さ れるのかを確認することにより、機能提供命令群および偽装機能提供命令群が配置 されるべき選択対象主要命令群を決定する。
[0280] なお、入力部 801にて 2つの初期値として、選択パラメータ CP— 1 (= 1)、 CP— 2 (
= 2)を受け付けたものとする。以下に配置の決定方法の一例について説明する。 配置順序決定部 804は、図 26に示すように、制御部 850、選択処理部 851、管理 情報更新部 852、更新処理部 853及び管理情報保持部 854を備えている。以下、 配置順序決定部 804の各構成要素についての詳細を説明する。
[0281] (1)管理情報保持部 854
管理情報保持部 854は、管理情報テーブル T800を有している。管理情報テープ ル T800のデータ構造は、管理情報保持部 704が有する管理情報テーブル T700の データ構造と同様であるので、ここでの説明は省略する。
なお、ここでは、管理情報テーブル T800に格納される値「1」は、対応する選択対 象データには、機能提供命令群が配置されていることを示し、値「0」は、対応する選 択対象データには、機能提供命令群が配置されていないことを示す。
[0282] また、管理情報テーブル T800の各管理情報の初期値は「0」である。
これにより、機能提供命令群が配置された位置 (配置された選択対象データ)を記 '隐することができる。
(2)制御部 850
制御部 850は、選択パラメータ群を記憶するパラメータ記憶領域を有して!/、る。
[0283] 制御部 850は、入力部 801にて受け付けた選択パラメータの初期値 CP— 1及び C P— 2 (ここでは、それぞれ「1」、「2」)をパラメータ記憶領域に記憶する。
制御部 850は、選択処理部 851、管理情報更新部 852、及び更新処理部 853の 動作を制御する。
制御部 850は、後述する選択処理部 851が有する式 3が取り得る値、つまり、式 3に て取り得る選択識別子の値それぞれと、プログラム記憶部 800にて記憶されて 、る選 択対象データとの対応付けを行う。
[0284] 制御部 850は、生成された第 i番目の機能提供命令群を機能提供命令群生成部 8 02から取得する。制御部 850は、取得した第潘目の機能提供命令群を、選択処理 部 851にて取得された選択識別子に基づいて、プログラム記憶部 800にて記憶され 、対応する選択対象データへ挿入する。ここで、 iは 1以上 m以下の整数である。また 、制御部 850は、第 i番目の機能提供命令群と、挿入先の選択対象データとの対応 付けを一時的に記憶して 、る。
[0285] 制御部 850は、生成された複数の偽装機能提供命令群のうち選択対象データに挿 入されていない 1の偽装機能提供命令群を偽装機能提供命令群生成部 803から取 得する。制御部 850は、取得した偽装機能提供命令群を、第 i機能提供命令群、又 は偽装機能提供命令群が挿入されて!ヽな ヽ 1の選択対象データに挿入する。制御 部 850は、この動作を、全ての偽装機能提供命令群に対して行う。
[0286] これにより、制御部 850は、各選択対象データに、第 i機能提供命令群、又は偽装 機能提供命令群が挿入することができる。
制御部 850による第 i番目の機能提供命令群を取得する動作により、配置対象とな る機能提供命令群を選択することができる。
(3)選択処理部 851
選択処理部 851は、上述した式 3を予め記憶している。
[0287] 選択処理部 851は、ノ メータ記憶領域に記憶されている選択パラメータ CP— 1、 及び CP— 2を取得する。
選択処理部 851は、取得した CP— 1及び CP— 2と、予め記憶している式 3とを用い て、仮の選択識別子を算出する。選択処理部 851は、管理情報テーブル T800を用 いて、算出した仮の選択識別子に対応する選択対象データが配置済である力否か を判定する。
[0288] 配置済であると判定する場合には、選択処理部 851は、未配置の選択対象データ を示す識別子を取得し、取得した値を選択識別子 swVarとする。
未配置であると判定する場合には、選択処理部 851は、算出した仮の選択識別子 を、選択識別子 swVarとする。
選択処理部 851の動作と、制御部 850による第 i番目の機能提供命令群を選択処 理部 851にて取得された選択識別子に基づき選択対象データに挿入する動作と〖こ より、機能提供命令群を適切な配置先へ配置することができる。
[0289] (4)管理情報更新部 852
管理情報更新部 852は、管理情報テーブル T800に含まれる複数の管理情報のう ち、選択処理部 851にて取得された選択識別子 swVarに対応する管理情報を、値「 0」から値「1」へと更新する。
(5)更新処理部 853
更新処理部 853は、ノ メータ記憶領域にて記憶されている選択パラメータ群と、 選択処理部 851にて取得された選択識別子とを用いて、選択パラメータ CP— 1及び CP— 2の更新を行う。なお、更新方法は、上述しているので、ここでの説明は省略す る。
[0290] 更新処理部 853は、更新した選択パラメータ群を、制御部 850のパラメータ記憶領 域へ上書きする。
3. 4. 7 秘密保持プログラム生成部 806
秘密保持プログラム生成部 806は、プログラム記憶部 800にて記憶されて 、る更新 処理命令群を、選択対象データのそれぞれに対して、選択対象主要命令群の次に 位置するように挿入する。これにより、秘密保持プログラム生成部 806は、選択対象 データのそれぞれに対して、更新処理命令群 560〜566を生成することができる。管 理命令群生成部 805による更新処理命令群の生成の動作と、秘密保持プログラム生
成部 806による上記動作とにより、更新処理命令群 560〜566を適切な配置先へ挿 人することができる。
[0291] 秘密保持プログラム生成部 806は、第 m番目の機能提供命令群 (つまり、正常系に て最後に実行される機能提供命令群)が挿入された選択対象データに対して、管理 命令群生成部 805にて生成された第 2の分岐命令群を、更新処理命令群の次に位 置するように挿入する。このとき、秘密保持プログラム生成部 806は、第 m番目の機 能提供命令群の最後にプログラム呼出元に制御を戻す処理のプログラム命令が含ま れている場合には、そのプログラム命令を削除する、若しくは、第 2の分岐命令群を 挿入しない。
[0292] 秘密保持プログラム生成部 806は、他の選択対象データに対して、管理命令群生 成部 805にて生成された第 1の分岐命令群を、更新処理命令群の次に位置するよう に挿入する。これにより、秘密保持プログラム生成部 806は、選択対象データ 540〜 546を生成することができる。
秘密保持プログラム生成部 806は、プログラム記憶部 800にて記憶されて 、る各命 令群を配置し、秘密保持プログラム 500を生成する。すなわち、管理命令群生成部 8 05は、生成した各命令群を図 16に示す順序に配置する。
[0293] 3. 4. 8 出力部 807
出力部 807は、生成した秘密保持プログラムを、秘密処理装置 60へ出力する。
3. 4. 9 プログラム難読化装置 50の動作
(1)動作概要
ここでは、プログラム難読ィ匕装置 50の動作概要について、図 27に示す流れ図を用 いて説明する。
[0294] 入力部 801は、難読ィ匕対象となるプログラム、及び生成した秘密保持プログラムに 与える 2つの初期値を受け付ける (ステップ S600)。
機能提供命令群生成部 802は、入力部 801にて受け付けた難読ィ匕対象プログラム を 1以上のプログラム命令力もなる複数のブロックに分割する (ステップ S605)。 偽装機能提供命令群生成部 803は、入力部 801にて受け付けた難読化対象プロ グラムを元に、複数の偽装機能提供命令群を生成する (ステップ S610)。
[0295] 管理命令群生成部 805は、前処理命令群 510、選択処理命令群 520、管理情報 更新命令群 525、変遷処理命令群 530、 1個の更新処理命令群、分岐先が選択処 理命令群を示すプログラム命令群からなる第 1の分岐命令群、及びプログラム呼出 元に制御を戻す処理のプログラム命令群からなる第 2の分岐命令群、及びラベル名 のみからなる複数の選択対象データを生成する (ステップ S615)。なお、選択対象デ ータの個数は、機能提供命令群の個数と偽装機能提供命令群の個数の合計値と同 一である。
[0296] 配置順序決定部 804は、選択パラメータ群と、予め記憶して 、る式 3を用いて、機 能提供命令群および偽装機能提供命令群の配置先を決定する (ステップ S620)。 秘密保持プログラム生成部 806は、管理命令群生成部 805にて生成された更新処 理命令群を用いて、選択対象データのそれぞれに対する更新処理命令群 560〜56 6を生成する。秘密保持プログラム生成部 806は、第 1及び第 2の分岐命令群を用い て、選択対象データ 540〜546を生成する。秘密保持プログラム生成部 806は、生 成された各命令群を配置し、秘密保持プログラム 500を生成する (ステップ S625)。
[0297] 出力部 807は、生成した秘密保持プログラムを、秘密処理装置 60へ出力する (ステ ップ S 630)。
(2)配置決定処理
ここでは、図 27のステップ S620にて示す配置決定処理の動作について、図 28に 示す流れ図を用いて説明する。
[0298] 制御部 850は、カウンタ iに「1」を設定し、選択パラメータ群の初期値をパラメータ記 憶領域へ格納する。制御部 850は、選択識別子の値それぞれと、プログラム記憶部 800にて記憶されている選択対象データとの対応付けを行う(ステップ S700)。ここ で、カウンタ iは、現在着目している機能提供命令群が何番目に実行されるべきであ るカゝを表す。すなわち、ここでは、第 1の機能提供命令群カゝら順番に配置順序を決定 していく。
[0299] 選択処理部 851は、ノ メータ記憶領域に記憶されている選択パラメータ CP_1、 及び CP— 2を取得する。選択処理部 851は、取得した CP— 1及び CP— 2と、予め 記憶している式 3とを用いて、仮の選択識別子を算出する (ステップ S705)。例えば、
選択パラメータ CP— 1〜CP— 2の値が「1」、「2」である場合には、式 3の値は「1 X 1 + 2 X 2 MOD 7 = 5」になる。
[0300] 選択処理部 851は、管理情報テーブル T800を用いて、算出した仮の選択識別子 に対応する管理情報の値力 S「 1」であるか否かを判定する (ステップ S 710)。
「1」あると判定する場合には (ステップ S710における「YES」)、選択処理部 851は 、仮の選択識別子を更新し (ステップ S715)、ステップ S710へ戻る。具体的には、選 択処理部 851は、算出した仮の選択識別子が「5」であり、値「5」に対応する管理情 報の値が「1」である場合には、仮の選択識別子「5」以降の直近に値「6」を仮の選択 識別子とする。
[0301] 「1」でないと判定する場合には (ステップ S710における「NO」)、選択処理部 851 は、算出した仮の選択識別子を、選択識別子 swVarとし、制御部 850は、第 i番目の 機能提供命令群を、選択処理部 851にて取得された選択識別子 swVarに基づ ヽて 、対応する選択対象データへ挿入する (ステップ S 720)。例えば cont = 1 で、選 択識別子の値が「5」であった場合には、第 1機能提供命令群が、選択対象データ 54 5に配置されることとなる。
[0302] 管理情報更新部 852は、管理情報テーブル T800に含まれる複数の管理情報のう ち、選択処理部 851にて取得された選択識別子 swVarに対応する管理情報を、値「 0」から値「1」へと更新する (ステップ S725)。例えば、選択識別子の値が「5」であつ た場合には、管理情報保持部 854の管理情報テーブル T800において、選択対象 データ 545に対応する管理情報を未配置力も配置済みに変える。
[0303] 更新処理部 853は、パラメータ記憶領域にて記憶されている選択パラメータ群と、 選択処理部 851にて取得された選択識別子とを用いて、選択パラメータ CP— 1及び CP— 2の更新を行う。更新処理部 853は、更新した選択パラメータ群を、制御部 850 のパラメータ記憶領域へ上書きする (ステップ S730)。例えば、選択パラメータの値 力 S「l」「2」で選択識別子の値が「5」であった場合は、選択パラメータの値を「2」、 「5」 にする。
[0304] 制御部 850は、カウンタ iに値「1」をカ卩算する(ステップ S735)。
制御部 850は、カウンタ iが機能提供命令群の個数より大きいか否かを判定する (ス
テツプ S 740)。
大きくないと判定する場合には (ステップ S740における「NO」)、制御部 850は、ス テツプ S705に戻り、選択処理部 851の動作を制御する。
[0305] 大きいと判定する場合には (ステップ S740における「YES」)、制御部 850は、複数 の偽装機能提供命令群のそれぞれに対して、機能提供命令群が挿入されて!ヽな ヽ 1以上の選択対象データの何れかが配置先となるように、配置先を決定する (ステツ プ S745)。例えば、選択対象データ 540、 541、 542、 544が未実行であれば、偽装 機能提供命令群を配置する位置をそれらに決定し、各偽装提供命令群を挿入する。
[0306] 3. 5 まとめ
第 3の実施の形態における秘密処理装置 60の選択処理部 722、及び秘密保持プ ログラム 500の選択処理命令群 520では、複数の選択対象データのうち、未実行の 選択対象データの中からのみ、次に選択する選択対象データを決定している。これ により、秘密処理装置 60や秘密保持プログラム 500が同じ選択対象データを重複し て実行することがな 、ことを知って 、る不正解析者が、選択パラメータ群の初期値を 変えての全数探索を行ったとしても、 Vヽずれの初期値を代入した場合にも選択対象 データが重複して選ばれることはないため、効率的に解析を行うことが困難になる。
[0307] プログラム難読ィ匕装置 50は、難読化対象プログラムを、秘密処理装置 60にて実行 される秘密保持プログラムへと変換することができる。これにより、同じプログラム命令 群を重複して実行することのな 、ことを知って 、る不正解析者が、変換後のプロダラ ムに対して、選択パラメータ群の初期値を変えての全数探索を行ったとしても、重複 する力否かに基づいて効率的に間違った初期値を見つけ出していくことができない。 そのため、入力プログラムを、不正な解析を効率的に短時間で行うことを阻止できる プログラムへと変換することができるという効果がある。
[0308] 3. 6 変形例 1
上記にて示すプログラム難読ィ匕装置 50は、配置順序決定部 804を、以下に示す配 置順序決定部 804a (図示せず)に置き換えてもよ 、。
他の構成要素については、上記と同様であるためここでの説明は省略する。
なお、本変形例 1では、プログラム難読ィ匕装置 50は、難読ィ匕対象プログラムのみを
、入力部 801にて受け付ける。
[0309] 3. 6. 1 配置順序決定部 804a
配置順序決定部 804と配置順序決定部 804aとの違いは、前者は、選択パラメータ 用の初期値を決めてから機能提供命令群を配置する位置を決定する方法であった のに対し、後者は 1番〜 p番目(pは選択パラメータの数)までの機能提供命令群を配 置する位置を決めて力 選択パラメータ用変数の初期値を決定し、 p+ 1番目以降の 機能提供命令群を配置する位置を決定することである。
[0310] 配置順序決定部 804aは、制御部 850a、選択処理部 851a、管理情報更新部 852 a、更新処理部 853a及び管理情報保持部 854aを備えている。以下、配置順序決定 部 804aの各構成要素についての詳細を説明する。
(1)管理情報保持部 854a
管理情報保持部 854aは、管理情報保持部 854と同様であるためここでの説明は 省略する。なお、以降において必要であれば、管理情報テーブル T800を用いて説 明する。
[0311] (2)制御部 850a
制御部 850aは、選択パラメータの個数 p (ここでは、 2個)を予め記憶している。 制御部 850aは、選択パラメータ群を記憶するパラメータ記憶領域を有して 、る。 制御部 850aは、後述する選択処理部 851aが有する式 3が取り得る値、つまり、式 3にて取り得る選択識別子の値それぞれと、プログラム記憶部 800にて記憶されて ヽ る選択対象データとの対応付けを行う。
[0312] 制御部 850aは、 1〜 番目の機能提供命令群を配置する位置を、ランダムに設定 する。例えば、制御部 850aは、選択対象データ 540〜546のいずれに第 1の機能提 供命令群を配置する力を乱数を用いて決定し、次に、第 1の機能提供命令群が配置 されて!/ヽな!、選択対象データの!/、ずれに第 2の機能提供命令群を配置するかを乱 数を用いて決定する。以下、同様に機能提供命令群が配置されていない選択対象 データのいずれに機能提供命令群 Κ (Κ= 3 · · ·πι)を配置するかを乱数を用いて決 定する。
[0313] 制御部 850aは、第 1〜 番目の機能提供命令群それぞれの配置先に対応する管
理情報の値を「0」から「1」へと更新する。制御部 850aは、更新された管理情報テー ブル T800と、第 l〜p番目の機能提供命令群それぞれの配置先に係る情報と、選択 識別子を算出する算出式とを用いて、 P個の初期値を算出する。制御部 850aは、算 出した p個の初期値を、表示部(図示せず)を用いて表示することにより、ユーザに通 知する。
[0314] 制御部 850aは、算出した p個の初期値をパラメータ記憶領域に格納する。
制御部 850aは、選択処理部 851、管理情報更新部 852、及び更新処理部 853の 動作を制御する。
制御部 850aは、第 i番目の機能提供命令群を、選択処理部 851aにて取得された 選択識別子に基づいて、対応する選択対象データへ挿入する。ここで、 iは (P + 1) 以上 m以下の整数であり、 mは機能提供命令群の個数である。また、制御部 850aは 、第 i番目の機能提供命令群と、挿入先の選択対象データとの対応付けを一時的に 記憶している。なお、選択処理部 851aについては後述する。
[0315] 制御部 850aは、機能提供命令群が挿入されていない 1以上の選択対象データの それぞれに対して、生成された複数の偽装機能提供命令群のうち 1の偽装機能提供 命令群を挿入する。ここで、 1度挿入された偽装機能提供命令群は、他の選択対象 データには挿入されない。
<初期値算出方法の具体例 >
初期値算出方法の具体例を以下に示す。ここでは、選択パラメータ数 p = 2とし、選 択対象データ 540〜546、式 3を用いる。また、第 1番目の機能提供命令群は、選択 対象データ 545に配置され、第 2の機能提供命令群は、選択対象データ 546に配置 されているとする。
[0316] 制御部 850aは、まず、選択対象データ 545の処理が終了した時点での選択パラメ 一タの値 CP— 1及び CP— 2を取得する。以下にその取得について説明する。選択 対象データ 545の更新処理命令群 165は、「cp— l = cp— 2 ; cp— 2 = sv;」であるた め、選択パラメータ CP— 1 (プログラム中の変数 cp— 1に相当)には、選択パラメータ CP— 2に設定されている値が代入される。そして、選択パラメータ CP— 2 (プログラム 中の変数 cp— 2に相当)には、選択識別子の値 (プログラム中の変数 svに相当)の値
が代入される。なお、この時点での選択識別子は第 1の機能提供命令群が配置され る選択対象データ 545の識別子 (すなわち、 5)である。その後、上記のように値が代 入された選択パラメータを用いて、選択識別子が計算しなおされる。ここまでをまとめ ると、第 1の選択パラメータの値は選択パラメータ CP— 2の初期値となり、第 2の選択 パラメータの値は、第 1の機能提供命令群が配置された選択対象データの識別子と なる。本変形例 1では、第 2の機能提供命令群を配置する位置を選択対象データ 54 6としているので、式 3により算出される仮の選択識別情報は、「5」又は「6」となる。な ぜなら、式 3の値が「6」であれば未実行の選択対象データ 546が選択され、式 3の値 が「5」であれば選択済みの選択対象データ 545は選択されずに、それ以降の直近 にある未実行の選択対象データ 546が選択されるからである。
[0317] ここで、式 3の値力 「5」であるためには、「I X (選択パラメータ CP— 1) + 2 X 5 M OD 7 = 5」である必要があり、これを解くと選択パラメータ CP— 1の値が「2」となる 。同様に、式の値が「6」であるためには、「I X (選択パラメータ CP— 1) + 2 X 5 M OD7 =6」である必要があり、これを解くと選択パラメータ CP_1の値が「3」となる。 一般に piと NNとが互いに素であるとき、全ての自然数 Aに対して、「pl XY MOD NN = A」を満たす Yが存在する。よって、選択パラメータ CP_1の値を決定す ることがでさる。
[0318] よって、選択パラメータ CP— 2の初期値は「2」または「3」のいずれかになる。制御 部 850aは、選択パラメータ CP— 2の初期値は「2」または「3」の 、ずれかを選択する 以下では、制御部 850aは、選択パラメータ CP— 2の初期値として「2」を選択したも のとして説明を続ける。
[0319] 次に、制御部 850aは、選択パラメータ CP_1の初期値を決定する。
第 1の機能提供命令群を配置した選択対象データ 545が選択されるためには、式 3 によって算出される仮の選択識別子が「5」である必要がある。なお、この時点では全 選択対象データが未実行であるため、式の値が選択対象データ 545を直接示す「5」 以外の値を取ることはできない。よって「1 X (選択パラメータ CP— 1) + 2 X (選択パ ラメータ CP 2) MOD 7 = 5」である必要がある。さらに、選択パラメータ CP 2
の初期値は先ほど算出した通り「2」であり、管理情報更新命令群 125が最初に実行 される時点では、選択パラメータ CP— 2の値は、その初期値である。この値を、式 3に 代入すると、「I X (選択パラメータ CP_1) + 2 X 2 MOD 7 = 5」となる。これを解 くと選択パラメータ CP_1の値は「1」となる。この時点では、選択パラメータ CP_1の 値は初期値のままであるので、選択パラメータ CP— 1の初期値が「1」となる
これにより、第 1及び第 2の選択パラメータの初期値「1」、「2」が算出されることにな る。
[0320] (3)選択処理部 85 la
選択処理部 851aは、選択処理部 851と同様であるため、ここでの説明は省略する
(4)管理情報更新部 852a
管理情報更新部 852aは、管理情報更新部 852と同様であるため、ここでの説明は 省略する。
[0321] (5)更新処理部 853a
更新処理部 853aは、更新処理部 853と同様であるため、ここでの説明は省略する
3. 6. 2 変形例 1のプログラム難読ィ匕装置の動作
(1)動作概要
変形例 1のプログラム難読ィ匕装置の動作は、図 27にて示すステップ S615と、配置 決定処理 (ステップ S620)との間に、初期値算出処理を追加することで、秘密保持プ ログラムを生成することができる。
[0322] (2)初期値算出処理
ここでは、初期値算出処理の動作について、図 29にて示す流れ図を用いて説明す る。
制御部 850aは、第 l〜p番目の機能提供命令群を配置する位置を、ランダムに設 定する(ステップ S 800)。
制御部 850aは、第 1〜 番目の機能提供命令群それぞれの配置先に対応する管 理情報の値を「0」から「 1」へと更新する (ステップ S805)。
[0323] 制御部 850aは、 j =p〜lまでの間、ステップ S815力らステップ S825を繰り返す( ステップ S810)。
制御部 850aは、第 jの選択パラメータの初期値を算出し (ステップ S815)、算出し た第 jの選択パラメータの初期値をパラメータ記憶領域へ格納する (ステップ S820)。
[0324] 繰り返しの終了後、制御部 850aは、算出した第 l〜pの選択パラメータの初期値を 表示する(ステップ S 830)。
3. 6. 2 変形例 1の効果
本変形例 1のプログラム難読ィ匕装置は、難読ィ匕対象プログラムを第 1の実施の形態 に示したような秘密保持プログラムへと変換することができる。これにより、同じプログ ラム命令群を重複して実行することのないことを知っている不正解析者が、変換後の 秘密保持プログラムに対して、選択パラメータ群の初期値を変えての全数探索を行 つたとしても、重複するか否かに基づいて効率的に間違った初期値を見つけ出して いくことができない。そのため、難読化対象プログラムを、不正な解析を効率的に短 時間で行うことを阻止できるプログラムへと変換することができるという効果がある。
[0325] なお、本変形例 1のプログラム難読ィ匕装置は、第 l〜pの機能提供命令群の配置先 を決定した後、配置決定処理にて、再度、第 l〜pの機能提供命令群の配置先を決 定している。この場合、予め決定した配置先の選択識別子が算出されるように、各選 択パラメータの初期値が算出されているので、配置決定処理にて決定された第 l〜p の機能提供命令群の配置先は、予め決定した配置先と同じになる。
[0326] ここで、本変形例 1のプログラム難読ィ匕装置は、第 l〜pの機能提供命令群の配置 先を決定した後、配置決定処理にて、再度、第 l〜pの機能提供命令群の配置先を 決定しなくてもよい。この場合、制御部 850aは、第 l〜pの機能提供命令群を順次実 行した後の、各選択パラメータの値を算出し、算出した各値をパラメータ記憶領域へ 格納し、それ以降における選択処理部 851、管理情報更新部 852、及び更新処理 部 853の動作を制御する。このとき、図 28に示す配置決定処理を実行する際には、 ステップ S600を i=p+ lに変更する。これにより、プログラム難読ィ匕装置は、すでに 配置先が決定している第 l〜pの機能提供命令群に対する位置決定処理を省略して 、配置決定処理にて、第 p + 1以降の機能提供命令群の配置先を決定することがで
きる。
[0327] 3. 7 変形例 2
変形例 2では、機能提供命令群 1〜3を図 30に示す順序で実行する秘密処理装置 について説明する。すなわち、この秘密処理装置は正常系の実行時に同じ選択対 象データの手順を重複して実行することがある秘密処理装置である。変形例 2の秘 密処理装置は、第 3の実施の形態の選択処理部 722を、図 31に図示する選択処理 部 722bに置き換えることにより実現される。
[0328] 3. 7. 1 選択処理部 722b
選択処理部 722bは、選択対象データの選択が行われた回数をカウントするカウン タを有し、カウンタの値に応じて、選択識別子の決定方法を変化させる。
以下、第 3の実施の形態と同様の選択識別子の決定方法、すなわち、未実行の選 択対対象データを示す選択識別子が得られるまで選択識別子の更新を行う決定方 法を「第一の決定方法」と呼ぶ。また、選択識別子の値を、 A回目(B= l、 2、 · · · 6) に決定した選択識別子の値と同一のものとする決定方法をする「第二の決定方法」と 呼ぶ。
[0329] 以下、選択処理部 722bは、図 31に示すように決定方法保持部 750b、選択履歴 保持部 751b、カウンタ 752b、制御部 753bを有している。
(1)決定方法保持部 750b
決定方法保持部 750bは、図 31に示すように、決定方法テーブル T1000を有して いる。
[0330] 決定方法テーブル T1000は、選択回数と決定方法とからなる組を 1以上記憶する ための領域を有している。
選択回数は、選択対象データの選択回数を示し、決定方法は、その回数の場合に おける選択識別子の決定方法を示して ヽる。
値「0」が決定方法に設定されている場合には、選択識別子の決定方法が第一の 決定方法であることを示し、値「0」以外の値「A」が決定方法に設定されて!、る場合 には、選択識別子の決定方法が第二の決定方法であることを示す。値「A」が設定さ れている場合には、 A回目に選択された値と同一の選択識別子を取得することを示
す。
[0331] 例えば、選択回数と決定方法とからなる組が、「1、 0」である場合には、 1回目に選 択する選択対象データを決定する選択識別子は、第一の決定方法を用いて決定さ れることを表している。また、選択回数と決定方法とからなる組が、「3、 1」である場合 には、 3回目に選択する選択対象データを決定する選択識別子は、第二の決定方法 を用いて決定され、 1回目に決定された値と同一の選択識別子とすることを表してい る。
[0332] (2)選択履歴保持部 75 lb
選択履歴保持部 751bは、過去に決定された選択識別子を、決定された時点にお けるカウンタの値と対応付けて保持して 、る。
(3)カウンタ 752b
カウンタ 752bは、現在行おうとしているの選択対象データの選択が何回目の選択 であるのかをカウントする。カウンタ 752bの初期値は 1であり、選択を行うたびにカウ ンタ 752bの値をインクリメントする。
[0333] (4)制御部 753b
制御部 753bは、カウンタ 752bの値と、決定方法テーブル T1000とを用いて、選択 識別子の決定方法を決定する。具体的には、カウンタ 752bの値が「1」である場合に は、制御部 753bは、決定方法テーブル T1000の選択回数力「l」に対応する決定 方法「0」を取得する。制御部 753bは、取得した決定方法力「0」であるので、選択識 別子の決定方法は、第一の決定方法であると決定する。なお、取得した決定方法の 値が「0」以外である場合には、制御部 753bは、選択識別子の決定方法は、第二の 決定方法であると決定する。
[0334] 制御部 753bは、決定した決定方法が第一の決定方法である場合には、選択処理 命令群 520を実行する場合と同様の処理により選択識別子を選択する。
制御部 753bは、決定した決定方法が第二の決定方法である場合には、取得した 値「A」を用いて、 A回目に決定された選択識別子を選択履歴保持部 751bから取得 する。
制御部 753bは、カウンタ 752bが示す値と決定された選択識別子とを選択履歴保
持部 751bに格納する。制御部 753bはカウンタ 1340の値を 1カウントアップする。
[0335] 3. 7. 2 秘密処理装置の動作
変形例 2における秘密処理装置の動作は、図 24にて示すステップ S 500に、カウン タ 752bのカウンタ countに初期値「1」を設定する処理を追加する。
その後、以下に示す識別子算出処理を行い、その後、ステップ S520以降を行う。 ステップ S535における判断力 「YES」の場合には処理を終了し、「NO」である場合 には、識別子算出処理に戻る。
[0336] 以下に、識別子算出処理の動作について、図 32にて示す流れ図を用いて説明す る。
なお、ここでは、選択パラメータの数が 2個であるとし、選択識別子を算出する式は 、式 3を用いる。また、必要があれば、第 3の実施の形態にて示す構成部を用いて説 明する。
制御部 753bは、カウンタ 752bの値と、決定方法テーブル T1000とを用いて、選択 識別子の決定方法を決定する (ステップ S850)。
[0337] 制御部 753bは、決定した決定方法が第一の決定方法であるか否かを判断する (ス テツプ S855)
第一の決定方法であると判断する場合には (ステップ S855における「YES」)、制 御部 753bは、選択パラメータ群保持部 705に格納されている選択パラメータ CP— 1 及び CP— 2と、選択処理命令群に含まれる式 3とを用いて、仮の選択識別子を算出 する(ステップ S860)。
[0338] 制御部 753bは、管理情報テーブル T700を用いて、算出した仮の選択識別子に 対応する選択対象データが実行済である力否かを判定する (ステップ S865)。
制御部 753bは、実行済であると判定する場合には (ステップ S865における「YES 」)、制御部 753bは、仮の選択識別子を更新する (ステップ S870)。
未実行であると判定する場合には (ステップ S865における「NO」)、制御部 753b は、カウンタ 752bが示す値と決定された選択識別子とを選択履歴保持部 751bに格 納し (ステップ S880)、カウンタ 1340の値 countをインクリメントする(ステップ S885)
[0339] 第二の決定方法であると判断する場合には (ステップ S855における「NO」)、制御 部 753bは、決定方法テーブル T1000か取得した決定方法の値「A」を用いて、 A回 目に決定された選択識別子を選択履歴保持部 751bから取得し (ステップ S875)、ス テツプ S880以降の動作を行う。
3. 7. 3 変形例 2の効果
変形例 2における選択処理部 722bは、図 31にて示す決定方法テーブル T1000 では、 3、 4、 6番目に実行する選択対象データを選択する際に、選択済みの選択対 象データから 1つを選択している。よって、難読化対象プログラムが同じ選択対象デ ータを重複して実行することを知って 、る不正解析者が、選択パラメータ群の初期値 を変えての全数探索を行ったとしても、 Vヽずれの初期値を代入した場合にも選択対 象データが重複して選ばれ、効率的に間違った初期値を見つけ出していくことができ ない。そのため、難読化対象プログラムを、不正な解析を効率的に短時間で行うこと を阻止できるプログラムへと変換することができるという効果がある。
[0340] 3. 8 変形例 3
ここでは、ループを有し、ループ内のプログラム命令群が実行される回数が固定の 回数である難読ィ匕対象プログラム力 秘密保持プログラムを生成するプログラム難読 化装置 50cである。本変形例 3では、一例として、難読ィ匕対象プログラムのコントロー ルフローを図 33に示す。このプログラムにはループ構造が 2箇所あり、それぞれのル ープ内のプログラム命令が実行される回数は 2回である。
[0341] 以下、図 33に示す難読化対象プログラムを用いて説明する。
3. 8. 1 プログラム難読ィ匕装置 50c
プログラム難読ィ匕装置 50cは、図 34にて示すように、プログラム記憶部 800c、入力 部 801c、機能提供命令群生成部 802c、偽装機能提供命令群生成部 803c、配置 順序決定部 804c、管理命令群生成部 805c、秘密保持プログラム生成部 806c、出 力部 807、及び選択処理命令群生成部 808cから構成されて ヽる。
[0342] プログラム難読化装置 50cは、具体的には、マイクロプロセッサ、 ROM、 RAM,ノヽ ードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコン ピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビユー
タプログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を達成 するために、コンピュータに対する指令を示す命令コードが複数個組み合わされて 構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラムに従つ て動作することにより、プログラム難読ィ匕装置 50cは、その機能を達成する。つまり、 前記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1個ずつ 読み出し、読み出した命令を解読し、解読結果に従って動作する。
[0343] なお、プログラム難読ィ匕装置 50cは、難読ィ匕対象プログラムから 3つの機能提供命 令群を取得するものとする。また、プログラム難読ィ匕装置 50cで生成される秘密保持 プログラムの構造は、上記にて示す秘密保持プログラム 500の構造と同一であるもの とし、以下の説明において、必要であれば、秘密保持プログラム 500で用いた符号を 用いて説明する。
[0344] (1)プログラム記憶部 800c
プログラム記憶部 800cは、上記第 3の実施の形態にて示すプログラム記憶部 800 と同様であるため、説明は省略する。
(2)入力部 801c
入力部 801cは、上記第 3の実施の形態にて示す入力部 801と同様であるため、説 明は省略する。
[0345] なお、入力部 801cが受け取る難読ィ匕対象プログラムは、ループを有し、ループ内 のプログラム命令群が実行される回数が予め定められているプログラムである。
(3)機能提供命令群生成部 802c
機能提供命令群生成部 802c、入力部 801cにて受け取った難読化対象プログラム から、複数の機能提供命令群を生成する。
[0346] 機能提供命令群生成部 802cは、例えば、入力部 801cが図 33に示す難読化対象 プログラムを受け取ると、ループ内に存在する 2つのプログラム命令群(ここでは、ステ ップ S905で実行されるプログラム命令群 1と、ステップ S925で実行されるプログラム 命令群 2)のそれぞれに対して、上記にて示す機能提供命令群生成部 802と同様に 動作を行って、複数の機能提供命令群を生成する。ここでは、機能提供命令群生成 部 802cは、プログラム命令群 1を分割して 2つの機能提供命令群 (以下、機能提供
命令群 1、 2という。)を生成し、プログラム命令群 2から、 1つの機能提供命令群 (以下 、機能提供命令群 3という。)を生成する。
[0347] 図 33に示すコントロールフローを、生成した 3つの機能提供命令群に置き換えたコ ントロールフローを、図 35に示す。
ステップ S905で実行されるプログラム命令群 1が、ステップ S906で実行される機 能提供命令群 1と、ステップ S907で実行される機能提供命令群 2とに置き換わり、ス テツプ S925で実行されるプログラム命令群 2が、ステップ S926で実行される機能提 供命令群 3に置き換わっている。なお、プログラム命令群 2と機能提供命令群 3とは同 一のものである。
[0348] (4)偽装機能提供命令群生成部 803c
偽装機能提供命令群生成部 803cは、上記にて示す偽装機能提供命令群生成部 803と同様であるため、説明は省略する。
(5)選択処理命令群生成部 808c
選択処理命令群生成部 808cは、変形例 2に示した選択処理部 722bをコンビユー タ等に実現させるプログラム命令群を生成する。
[0349] 選択処理命令群生成部 808cは、まず、決定方法保持部 750bが有する決定方法 テーブル T1000を生成する。
選択処理命令群生成部 808cは、図 35にて示すコントロールフローから、ループを 展開したプログラムのコントロールフローを生成する。具体的には、図 35において、 ループ内のプログラム命令である第 1及び第 2機能提供命令群をループが実行され る回数分すなわち、 2回展開し、第 3機能提供命令群も同様に 2回展開する。図 36に 各機能提供命令群を展開したプログラムのコントロールフローを示す。
[0350] 次に、選択処理命令群生成部 808cは、ループを展開したプログラムのコントロー ルフローを元に、決定方法保持部 750bに保持する決定方法を生成する。
図 36のコントロールフローにおいて、ステップ S950〜S975はそれぞれ、 1〜6番 目に実行されるブロックである。このコントロールフローにおいて 3番目に実行される 機能提供命令群 1は 1番目に実行される機能提供命令群 1と同じである。よって、選 択処理命令群生成部 808cは、決定方法テーブル T1000の選択回数「3」に対応す
る決定方法には値「1」を設定する。同様に、選択処理命令群生成部 808cは、決定 方法テーブル T1000の選択回数「4」、「6」のそれぞれに対応する決定方法には値「 2」、「5」を設定する。
[0351] また、図 36のコントロールフロー上では存在しないが、ループを展開した後のコント ロールフロー上でも一度しか現れないブロックを選択する際の選択識別子の決定方 法は、未配置の選択対象データより選択するという決定方法とする。
このようにして、選択処理命令群生成部 808cは、決定方法保持部 750bにて保持 する決定方法テーブル T1000を生成する。具体的には、選択処理命令群生成部 80 8cは、コンピュータ上に、決定方法テーブル T1000のデータ構造を持たせるような プログラム命令群を生成する。これにより、 e回目の選択識別子が、未実行の選択対 象データを示す選択識別子となる決定方法を用いる場合には「e、 0」の組を持ち、 f 回目に決定した選択識別子と同一のものとする場合には「e、 f」の組を持つような決 定方法テーブル T1000が実現できる。
[0352] また、選択処理命令群生成部 808cは、さらに、選択履歴保持部 75 lb、カウンタ 75 2bおよび制御部 753bをコンピュータ上に実現するプログラム命令群も生成する。こ こで、選択履歴保持部 75 lbを実現するプログラム命令群は、選択識別子をカウンタ の値と対応付けて記憶するような命令群である。カウンタ 752bを実現するプログラム 命令群は、初期値を「1」とし、 1インクリメントするカウンタを示す命令群である。また、 制御部 753bを実現する命令群は、変形例 2にて説明した動作を実現するプログラム 命令群である。以下において、カウンタ示す命令群及び、制御部 753bを実現する命 令群をあわせて決定方法制御命令群と!/、う。
[0353] これにより、選択処理命令群生成部 808cは、選択処理部 722bを動作させるため のプログラム命令群を生成することができる。
選択処理命令群生成部 808cは、生成した各命令群をプログラム記憶部 800cへ格 納する。
(6)配置順序決定部 804c
配置順序決定部 804cは、生成した機能提供命令群 (ここでは、 3つの機能提供命 令群)、および偽装機能提供命令群 (ここでは、 4つの偽装機能提供命令群)をどの
ような順序で選択対象主要命令群 550〜556に割り当てるのかを決定する。具体的 には、配置順序決定部 804cは、選択対象主要命令群 550〜556のいずれに第 1〜 第 3機能提供命令群を配置するかを決め、残り 4つの選択対象主要命令群のいずれ に偽装機能提供命令群を配置するかを決める。
[0354] 配置順序決定部 804cは、上述した式 3を予め記憶している。ここでは、式 3におけ る pl、p2、及び NNをそれぞれ、「1」、「2」、及び「7」とする。
配置順序決定部 804cは、入力部 801cにて受け付けた 2つの選択パラメータの初 期値と、予め記憶している式 3を用いて、実際にどのような順序で選択識別子が算出 されるのかを確認することにより、機能提供命令群および偽装機能提供命令群が配 置されるべき選択対象主要命令群を決定する。
[0355] なお、入力部 801cにて 2つの初期値として、選択パラメータ CP— 1 ( = 1)、 CP— 2
( = 2)を受け付けたものとする。以下に配置の決定方法の一例について説明する。 配置順序決定部 804cは、図 37に示すように、制御部 850c、選択処理部 851c、 管理情報更新部 852c、更新処理部 853c及び管理情報保持部 854cを備えている。 以下、配置順序決定部 804cの各構成要素についての詳細を説明する。
[0356] <管理情報保持部 854c >
管理情報保持部 854cは、管理情報保持部 854と同様であるので、説明は省略す る。なお、以降において必要であれば、管理情報テーブル T800を用いて説明する。 これにより、機能提供命令群が配置された位置 (配置された選択対象データ)を記 '隐することができる。
[0357] <制御部 850c >
制御部 850cは、選択パラメータ群を記憶するパラメータ記憶領域を有して 、る。 制御部 850cは、入力部 801cにて受け付けた選択パラメータの初期値 CP— 1及び CP— 2 (ここでは、それぞれ「1」、「2」)をパラメータ記憶領域に記憶する。
制御部 850cは、選択処理部 851c、管理情報更新部 852c、及び更新処理部 853 cの動作を制御する。
[0358] 制御部 850cは、後述する選択処理部 851cが有する式 3が取り得る値、つまり、式 3にて取り得る選択識別子の値それぞれと、プログラム記憶部 800cにて記憶されて
V、る選択対象データとの対応付けを行う。
制御部 850cは、生成された第 i番目の機能提供命令群を機能提供命令群生成部 802cから取得する。制御部 850cは、取得した第潘目の機能提供命令群を、選択 処理部 851cにて取得された選択識別子に基づいて、プログラム記憶部 800cにて記 憶され、対応する選択対象データへ挿入する。ここで、 iは 1以上 m以下の整数である 。また、制御部 850cは、第 i番目の機能提供命令群と、挿入先の選択対象データと の対応付けを一時的に記憶して 、る。
[0359] 制御部 850cは、生成された複数の偽装機能提供命令群のうち選択対象データに 挿入されていない 1の偽装機能提供命令群を偽装機能提供命令群生成部 803から 取得する。制御部 850cは、取得した偽装機能提供命令群を、第 i機能提供命令群、 又は偽装機能提供命令群が挿入されていない 1の選択対象データに挿入する。制 御部 850cは、この動作を、全ての偽装機能提供命令群に対して行う。
[0360] これにより、制御部 850cは、各選択対象データに、第 i機能提供命令群、又は偽装 機能提供命令群が挿入することができる。
制御部 850cによる第 i番目の機能提供命令群を取得する動作により、配置対象と なる機能提供命令群を選択することができる。
<選択処理部 851c >
選択処理部 851cは、上述した式 3を予め記憶している。
[0361] 選択処理部 851cは、図 36にて示すコントロールフロー及び選択処理命令群生成 部 808cにて生成された選択処理部 722bを動作させるためのプログラム命令群に基 づいて、各機能提供命令群の配置先を決定する。
選択処理部 851cは、図 36にて示すコントロールフローにより、 t回目に実行される 第 iの機能提供命令群を取得する。ここで、 tは、 1以上 6以下の整数であり、 iは 1以上 3以下の整数である。
[0362] 選択処理部 851cは、選択処理命令群生成部 808cにて生成された決定方法テー ブル T1000を用いて、選択回数「t」に対応する決定方法を取得する。
決定方法が「0」である場合には、選択処理部 851cは、上記にて示す選択処理部 8 51と同様の動作により、選択識別子 swVarを取得する。選択処理部 851cは、取得
した選択識別子 swVarと、第 iの機能提供命令群とを対応付ける。これにより、制御部
850cは、第 iの機能提供命令群を、対応する選択識別子 swVarにて示される選択対 象データに挿入することができる。
[0363] 決定方法が「0」以外の値である場合には、選択処理部 851cは、 t+ 1回目に実行 される第 jの機能提供命令群を取得し、上記の動作を行う。
選択処理部 851cの動作と、制御部 850cによる第 i番目の機能提供命令群を選択 処理部 851cにて取得された選択識別子に基づき選択対象データに挿入する動作と により、機能提供命令群を適切な配置先へ配置することができる。
[0364] <管理情報更新部 852c >
管理情報更新部 852cは、管理情報更新部 852と同様であるので、説明は省略す る。
く更新処理部 853c >
更新処理部 853cは、更新処理部 853と同様であるため、説明は省略する。
[0365] (7)管理命令群生成部 805c
管理命令群生成部 805cは、上記にて示す管理命令群生成部 805と同様であるた め説明は省略する。
(8)秘密保持プログラム生成部 806c
秘密保持プログラム生成部 806cは、プログラム記憶部 800cにて記憶されて 、る各 命令群を配置し、秘密保持プログラムを生成する。すなわち、管理命令群生成部 80 5cが生成した命令群と、選択処理命令群生成部 808cが生成した命令群と、配置順 序決定部 804cにて生成された選択対象データとを図 38のような順序に配置し、秘 密保持プログラム 1800を生成する。管理命令群生成部 805cによる更新処理命令群 の生成の動作と、秘密保持プログラム生成部 806cによる上記動作とにより、各命令 群を適切な配置位置へ挿入することができる。
[0366] なお、選択処理命令群生成部 808cが生成する決定方法制御命令群 580以外の 他の命令群の位置については、特に明示していないが、例えば前処理命令群 510 の中等に含ませることで、実行開始時に必要な領域を確保したり、決定方法保持部 7 50bを例えばメモリ上に生成したりすることができる。
さらに、秘密保持プログラム生成部 806cは、選択対象主要命令群 550〜556に対 し、機能提供命令群生成部 802cが生成した複数の機能提供命令群および偽装機 能提供命令群生成部 803cが生成した複数の偽装機能提供命令群を、配置順序決 定部 804cが決定した順序に対応するように配置する。
[0367] (9)出力部 807c
出力部 807cは、上記にて示す出力部 807と同様であるので、説明は省略する。
3. 8. 2 プログラム難読ィ匕装置 50cの動作
ここでは、プログラム難読ィ匕装置 50cの動作にっ 、て説明する。
プログラム難読ィ匕装置 50cの動作は、基本的には、プログラム難読ィ匕装置 50と同 様である。以下に、図 27にて示す流れ図を用いて、プログラム難読ィ匕装置 50の動作 と異なる点を中心に説明する。
[0368] ステップ S620は、配置順序決定部 804cにより実行される。
また、図 27にて示す流れ図において、選択処理命令群生成部 808cが動作するス テツプを加える。選択処理命令群生成部 808cを動作させるステップは、配置順序決 定部 804cによる配置順序を決定する前、つまりステップ S620より前であれば、どの 位置でもよい。
[0369] 3. 8. 3 変形例 3の効果
本変形例 3のプログラム難読ィ匕装置 50cは、難読ィ匕対象プログラムを第 3の実施の 形態にて示すような秘密保持プログラムへと変換することができる。ここで、第 3の実 施の形態にて示すプログラム難読ィ匕装置 50とは異なり、ループのあるプログラムで難 読ィ匕することができるため、より多種の入力プログラムに対して、難読化を施すことが できる。
[0370] 3. 9 変形例 4
変形例 4にて示すプログラム難読ィ匕装置は、第 3の実施の形態のプログラム難読ィ匕 装置によるプログラムの難読ィ匕に加え、さらに、定数を含むプログラム命令を、その定 数を含まないプログラム命令に置き換える難読ィ匕を追加する装置である。
3. 9. 1 変形例 4のプログラム難読化装置
ここで、プログラム難読ィ匕装置は、機能提供命令群を構成するプログラム命令に含
まれる第一の定数を「(第 1の選択パラメータ) + (第 2の選択パラメータ) + (第二の定 数)」に置き換える。例えば、機能提供命令群 1にプログラム命令「b = a+ 30」が含ま れており、機能提供命令群 1が実行される際の第 1及び第 2選択パラメータそれぞれ の値が「1」、「2」である場合に、「b = a + 30」を「b = a+ (選択パラメータ CP_l) + ( 選択パラメータ CP— 2) + 27」に置き換える。
[0371] 以下、このような変換を行うプログラム難読ィ匕装置を説明する。
変形例 4では、第 3の実施の形態で示す配置順序決定部 804の変わりに配置順序 決定部 804d (図示せず)を用いる。配置順序決定部 804dは、第 3の実施の形態で 説明した構成要素に加え、プログラム命令変更部 810dを有する。
プログラム命令変更部 810dは、上述したように入力プログラム中の定数を「(第 1の 選択パラメータ) + (第 2の選択パラメータ) + (第二の定数)」に置き換える処理を行う 。具体的には、配置順序決定部 804dが現在見ている各機能提供命令群について、 定数を含むプログラム命令が含まれて ヽる場合に、パラメータ記憶領域に格納されて いる第 1及び第 2の選択パラメータを取得する。プログラム命令変更部 810dは、取得 した第 1及び第 2の選択パラメータを用いて、その定数を「(第 1の選択パラメータ) + ( 第 2の選択パラメータ) + (第二の定数)」に置き換えていく処理を行う。
[0372] ここで、第二の定数は、第一の定数力 第 1及び第 2の選択パラメータのそれぞれ の値を減算することにより算出される。
3. 9. 2 動作
以下、変形例 4のプログラム難読ィ匕装置の動作を、配置順序決定部 804dの処理の 流れを中心に図 39を用いて説明する。なお、変形例 4のプログラム難読ィ匕装置の動 作は、配置順序決定部 804dの動作以外は第 3の実施の形態と同様である。
[0373] 配置順序決定部 804dは、カウンタ countに「1」を設定し、ノ メータ記憶領域に選 択パラメータ群の初期値を格納する (ステップ S 1000)。
配置順序決定部 804dは、パラメータ記憶領域に記憶されて 、る選択パラメータ CP —1、及び CP— 2を取得する。配置順序決定部 804dは、取得した CP— 1及び CP— 2と、予め記憶している式 3とを用いて、仮の選択識別子を算出する (ステップ S1005
) o
[0374] 配置順序決定部 804dは、第 count番目の機能提供命令群の配置先を決定する( ステップ S1010)。具体的には。配置順序決定部 804dは、図 28にて示すステップ S 710、 S715、 S720を行う。
配置順序決定部 804dは、第 count番目の機能提供命令群に定数を含むプロダラ ム命令が存在するか否かを判断する(ステップ S1015)。
[0375] 存在すると判断する場合には (ステップ S1015における「YES」)、配置順序決定部 804dは、定数を含むプログラム命令を取得し、取得したプログラム命令に含まれる定 数及びパラメータ記憶領域に格納されている第 1及び第 2の選択パラメータを用いて 第二の定数を算出する (ステップ S 1020)。配置順序決定部 804dは、取得したプロ グラム命令に含まれる定数を、第 1及び第 2の選択パラメータと、算出した第二の定 数とに置き換える (ステップ S1025)。例えば、配置順序決定部 804dは、「b = a+ 30 」を「b = a+ (選択パラメータ 1) + (選択パラメータ 2) + 27」に置き換える。なお、配 置順序決定部 804dは、ステップ S1020及び S1025の動作を、第 count番目の機 能提供命令群に存在する定数を含むプログラム命令全てに対して行う。
[0376] 配置順序決定部 804dは、パラメータ記憶領域にて記憶されている選択パラメータ 群と、選択処理部 851にて取得された選択識別子とを用いて、選択パラメータ CP— 1及び CP— 2の更新を行い、更新した選択パラメータ群を、パラメータ記憶領域へ上 書きする(ステップ S 1030)。
配置順序決定部 804dは、管理情報テーブル T800に含まれる複数の管理情報の うち、取得された選択識別子 swVarに対応する管理情報を、値「0」から値「1」へと更 新する (ステップ S 1035)。
[0377] 配置順序決定部 804dは、カウンタ countに値「1」を加算する (ステップ S1040)。
配置順序決定部 804dは、カウンタ countが機能提供命令群の個数より大き 、か否 かを判定する(ステップ S 1045)。
大きくないと判定する場合には (ステップ S1045における「NO」)、配置順序決定部 804diま、ステップ S1005に戻る。
[0378] 大きいと判定する場合には (ステップ S 1045における「YES」)、配置順序決定部 8 04dは、複数の偽装機能提供命令群のそれぞれに対して、機能提供命令群が挿入
されて 、な ヽ 1以上の選択対象データの何れかが配置先となるように、配置先を決定 する(ステップ S 1050)。
第 count番目の機能提供命令群に定数を含むプログラム命令が存在しないと判断 する場合には (ステップ S1015における「NO」)、配置順序決定部 804dは、ステップ S 1030以降を行う。
[0379] なお、ここでは、定数を置き換える置換式を「(選択パラメータ 1) + (選択パラメータ 2) + (第二の定数)」としているが、他の式であっても構わない。その場合は式「(置換 式) = (第一の定数)」から第二の定数を求める式を作成し、その式を用いて、第二の 定数を算出してもよい。また、置換式は固定である必要はなぐ置き換えを行うたびに
ヽても構わな 、。
[0380] また、なお、説明に用いた難読ィ匕対象プログラムは一例であって、そのコントロール フローやループの回数、その他の制御構造はこれに限るものではない。
3. 9. 3 変形例 4の効果
本変形例 4のような変換を行えば、第 3の実施の形態で行った難読化に加え、生成 されたプログラム中の定数の値を直接見ることが出来なくなり、さらに解析が困難にな る。特に、秘密情報である鍵の値等を本変形例 4によって、直接見ることが出来なく することで、秘密情報の値の解析を困難にすることが出来る。
[0381] 3. 10 その他の変形例
なお、本発明を上記第 3の実施の形態、及び変形例 1〜4に基づいて説明してきた 1S 本発明は、上記の実施の形態に限定されないのはもちろんである。以下のような 場合も本発明に含まれる。
(1)上記第 3の実施の形態において、選択識別子の算出式を「I X (選択パラメータ CP— 1) + 2 X (選択パラメータ CP— 2) MOD 7」としている力 これに限定されな い。何らかの形で選択識別子の候補を算出できる式であれば他の式であっても構わ ない。
[0382] (2)上記第 3の実施の形態において、選択パラメータ群の更新処理 (更新処理命令 群)を、選択対象データ 540〜 546に埋め込まれているが(例えば、図 20における選 択対象データ 660の「cp—l = cp— 2 ; cp— 2 = sv;」など)、これに限定されない。秘
密保持プログラムは、更新処理命令群を選択対象データ 540〜546の実行後に参 照する構成でもよい。
[0383] (3)また、図 20では、図 24にて示すステップ S535における判断は明示的には行つ ておらず、正常系の実行において最後に実行される選択対象データ 543の実行後 に処理を終了する構成としている力 これに限定されない。秘密保持プログラムは、 実行された選択対象データが処理の最後に実行すべき選択対象データであるかの 判断処理を選択対象データカゝら独立した形で実行してもよい。
[0384] (4)さらに、上記第 3の実施の形態では、選択パラメータを更新することにより間接 的に選択対象識別子を更新しているが、これに限定されない。秘密保持プログラム は、選択識別子を直接更新する構成としてもよい。この場合は、図 24にて示すステツ プ S530において選択識別子の更新を行い、ステップ S535における判断結果が「N 0」である場合には、ステップ S510へ戻る。
[0385] (5)上記第 3の実施の形態では、秘密保持プログラムは、選択パラメータの初期値 として、呼び出し元力 の入力値を格納した力 これに限定されない。秘密保持プロ グラムは、ネットワーク上の他の機器から取得する値を選択パラメータの初期値に代 入する構成でもよ ヽし、プログラム実行装置が保持する他のプログラムを実行した結 果得られる出力値を選択パラメータの初期値に代入する構成でもよい
(6)上記第 3の実施の形態において、プログラム難読ィ匕装置は、難読化対象プログ ラムを、秘密保持プログラムに変換する際に、入力部にて選択パラメータの初期値を 受け取つたが、これに限定されない。プログラム難読ィ匕装置は、選択パラメータの初 期値は定められて 、るものとし、予め記憶して 、てもよ 、。
[0386] (7)上記第 3の実施の形態では、機能提供命令群が 3つ、偽装機能提供命令群が 4つの場合を示したが必ずしもこの数である必要はな 、。機能提供命令群は複数個 、偽装機能提供命令群は 1個以上であればよい。
(8)上記第 3の実施の形態では、選択対象部の数、選択パラメータの数、選択識別 子の計算式を、固定して秘密保持プログラムを生成する場合について述べたが、こ れらの値や式を必ずしも固定の値である必要はなぐ別の値や式であってもよい。こ れらの値や式は、例えば、プログラム難読ィ匕装置に入力として与えられる構成であつ
てもよ!/ヽし、全数攻撃を用いて攻撃を行う際の全数に基づ ヽて決定する構成であつ てもよい。なお、入力として与えられる構成である場合には、生成される秘密保持プロ グラム 500が正しくコンピュータ上で動作することを保証するためには、選択識別子 の計算式は、その計算結果が常に選択対象データの数以下であるような式が望まし い。また、この式は不正解析者による解析を困難にするため、選択パラメータの値に 応じて算出される値が大きく変動するような式が望ましい。
[0387] また、選択パラメータの初期値は、難読ィ匕対象となるプログラム毎にランダムな値で あるとしてもよい。これにより、仮に不正解析者が正しい選択パラメータの初期値を得 ることができたとしても、他のプログラムに対してはその初期値を適用することができ なくなる。
(9)上記第 3の実施の形態では、ブロックの分割は、簡単な方法について説明した 力 この方法に限定するものではなぐブロックの分割の仕方に応じた制御構造の解 析を行 ヽ、ブロックの分割の仕方に応じた機能提供命令群を生成すればょ ヽ。
[0388] (10)上記第 3の実施の形態では、秘密処理装置 60を上述の通りプログラムを用い たプログラム実行装置の形で実現している力 S、これに限られるものではなくハードゥエ ァ的な実装を行ってもよい。
(11)上記第 3の実施の形態において、秘密処理装置 60は、図 24のステップ S535 の判断結果により、処理の終了又は継続の判断を行っている力 これに限定されな い。
[0389] 秘密処理装置 60は、図 24のステップ S535にて示す判断の代わりに、分割後ブロ ックの個数と同一の選択処理データが選択されたか否かを判断してもよい。
この場合の、秘密保持プログラム 500eの具体例を図 40の流れ図にて示す。図 40 にて示すプログラムの流れ図は、図 18の各ブロックを C言語で記述した具体例である 図 40〖こおける値「i」は、選択対象データの選択回数を示す。ブロック 651eに含ま れる条件式「if (i > 3) then return;」により、秘密保持プログラム 500eの終 了、及び処理の継続が制御されている。つまり、選択回数が 3より大きい場合には、 秘密処理装置 60は、秘密保持プログラム 500eの実行を終了し、 3以下の場合には、
秘密保持プログラム 500eの実行を継続する。ここで、条件式に含まれる値「3」は分 割後ブロックの数と同一の値である。
[0390] また、選択対象データに含まれる分岐命令群は、選択処理命令群に分岐する分岐 命令に統一されている。
これにより、正常系の実行において最後に実行される選択対象データを、見つけ出 すことは困難になる。
また、条件式「if (i > 3) then return;」に含まれる値を、分割後ブロックの数 と同一とすることで、正条系の動作において最後に実行される選択対象データ (例え ば、第 3の機能提供命令群)を実行後に、常に秘密保持プログラム 500eの動作が終 了することが保証されて ヽる。
[0391] (12)上記第 3の実施の形態において、選択パラメータの数を 2としたが、これに限 定されな ヽ。選択パラメータの数は複数個であればょ 、。
この場合の式 3は、「pl X (第 1の選択パラメータ用変数) +p2 X (第 2の選択パラメ ータ用変数) + · · · +pn X (第 nの選択パラメータ用変数) mod NN」となる(nは 2 以上の整数)。なお、 NNと pl、 ρ2、 · · ·、 pnとは互いに素である整数である。また、 選択パラメータの更新時には、第 iのパラメータに格納されている値を第 i- 1のパラメ ータに格納する。このとき、第 1のパラメータ、第 2のパラメータ、 · · ·、第 n— 1のパラメ ータの順に格納する。また、第 nのパラメータには、選択対象データの選択に使用し た選択識別子の値を格納する。ここで、 iは 2以上 n以下の整数である。
[0392] (13)上記第 3の実施の形態において、プログラム難読ィ匕装置 50は、ラベル名のみ からなる複数の選択対象データのそれぞれに、選択対象主要命令群、更新処理命 令群、及び分岐命令群を挿入した後に、前処理命令群、選択処理命令群、変遷処 理命令群、及び複数の選択対象データの配置を決定して秘密保持プログラムを生 成したが、これに限定されない。
[0393] プログラム難読化装置 50は、前処理命令群、選択処理命令群、変遷処理命令群、 及びラベル名のみ力 なる複数の選択対象データの配置先を決定して、その後、ラ ベル名のみからなる複数の選択対象データのそれぞれに、選択対象主要命令群、 更新処理命令群、及び分岐命令群を挿入して秘密保持プログラムを生成してもよ ヽ
(14)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよい。
[0394] 4.第 4の実施の形態
以下、本発明に係る第 4の実施の形態としての秘密保持プログラム 2000、プロダラ ム難読化装置 1010及び秘密処理装置 1020について、図面を参照して説明する。 なお、システムの構成は、第 3の実施の形態にて示す構成と同様であるため、説明 は省略する。
[0395] 秘密処理装置 1020は、第 3の実施の形態にて示す秘密処理装置 60と同様に、秘 密情報を用いた装置である。
秘密処理装置 1020と、第 3の実施の形態にて示す秘密処理装置 60とは、構成要 素は同じであるが、各部の処理がそれぞれ異なっている。以下では、各部の処理の 説明が中心となるため、説明を簡単にするために、コンピュータ上で実行されることで 秘密処理装置を実現する秘密保持プログラム 2000の説明をもって、秘密処理装置 の説明に替える。ここで、秘密処理装置 1020の構成と秘密保持プログラム 2000の 各部との対応関係は第 3の実施の形態と同様である。
[0396] 4. 1 秘密保持プログラム 2000
秘密保持プログラム 2000の全体構成図を図 41に示す。以下では秘密保持プログ ラム 2000の詳細について、図 41を参照しながら説明していく。ここで、第 3の実施の 形態の秘密保持プログラム 500と同様の部分については、同一の符号を付け、説明 を省略する。
[0397] 秘密保持プログラム 2000は、第 3の実施の形態にて示す秘密保持プログラム 500 と同様、プログラムに含まれるプログラム命令群がどのような実行順序で実行されるか を、不正解析者に解析されないように、難読化されたプログラムである。
秘密保持プログラム 2000は、第 3の実施の形態と同様の管理情報更新命令群 52 5、変遷処理命令群 530と、第 3の実施の形態と異なる前処理命令群 2010、選択処 理命令群 2020、選択対象データ 2040、 2041、 · · ·、 2046とを備え、これら力 S図 41 に示す順番に配置されている。各部の具体的な説明は後述する。
[0398] 選択対象データ 2040〜2046はそれぞれ、第 3の実施の形態と同様の選択対象
主要命令群 550〜556、第 3の実施の形態と異なる更新処理命令群 2060〜2066 と分岐命令群 2070〜2076と力 なり、これらは図 41に示す順番に配置されている。 各部は 1以上のプログラム命令力もなるプログラム命令群である。
秘密保持プログラム 2000は、呼出元のプログラムから、 3つの入力値 in— 1、 in— 2 、 in— 3および、このプログラムが提供する機能の処理を行う際に使用するパラメータ を受け取り、このプログラムが提供する機能の処理を行うプログラム命令群である。な お、 in— k(kはインデックス)は(7— k)未満の非負整数である。なお、選択対象デー タをここでは、 2040〜2046の 7つとしている力 これに限らない。選択対象データの 個数を n+ 1個としてもよい。ここで、 nは自然数である。このとき、 in— kは(n+ 1— k) 未満の非負整数である。また、入力値の個数は、 in— 1、 in— 2、 in— 3の 3つとして いるが、これに限らない。 m (mは n+ 1以下の自然数)個であってもよい。
[0399] 秘密保持プログラム 2000の処理では、選択処理命令群 2020での処理に用いる 選択パラメータ群の選択パラメータ CP_1、 CP_2、 CP_3と選択パラメータインデ ックス CPIと、選択識別子を保持する選択識別子用変数を用いる。
ここでは、秘密保持プログラム 2000が正常系の実行時に呼出元のプログラムから 受け取る入力値 in— 1、 in— 2、 in— 3は値「2」、「4」、「3」であるとする。本実施の形 態で提供する秘密保持プログラム 2000は、呼出元のプログラム力も受け取る値を用 Vヽれば、(選択対象主要命令群を含む)選択対象データを正 ヽ順番に実行できる プログラムであって、呼出元のプログラムから受け取る値を知ることができな 、不正解 析者にとっては、(選択対象主要命令群を含む)選択対象データの実行順序を知る ことが困難なプログラムである。
[0400] 4. 1. 1 前処理命令群 2010
前処理命令群 2010は、選択処理命令群 2020で用いる選択パラメータ群を設定 するプログラム命令群である。なお、選択パラメータ群は、選択パラメータ CP_1、選 択パラメータ CP— 2、選択パラメータ CP— 3と、選択パラメータインデックス CPIから なる。これらの選択パラメータ CP— 1〜CP— 3は、非負整数値であり、選択パラメ一 タインデックス CPIは自然数である。
[0401] 前処理命令群 2010は、秘密保持プログラム 2000が起動された際に、最初に実行
されるプログラム命令群である。呼び出し元のプログラムカゝら入力値 in— 1、 in— 2、 i n— 3を受け取り、受け取った 3つの値それぞれを選択パラメータ群の選択パラメータ CP— 1、選択パラメータ CP— 2、選択パラメータ CP— 3にそれぞれ格納し、選択パラ メータ群の選択パラメータインデックス CPIを値「1」に設定するプログラム命令群を含 む。正常系の実行時には、 in— 1、 in— 2、 in— 3は値「2」、「4」、「3」であり、選択パ ラメータ CP— 1〜CP— 3にそれぞれ値「2」、「4」、「3」を格納する処理を行う。なお、 選択パラメータは、入力値 in_l、 in_2、 · · ·の個数 (本実施の形態では 3個)だけ 存在する。
[0402] 4. 1. 2 選択処理命令群 2020
選択処理命令群 2020は、選択パラメータ群を用いて、選択識別子を算出するプロ グラム命令群を含む。なお、選択識別子は、第 3の実施の形態と同様、変遷処理命 令群の実行時に使用する値である。
選択処理命令群が選択識別子を算出する処理では、まず、選択パラメータ群の選 択パラメータインデックス CPIに対し、選択パラメータ群の選択パラメータ CP_CPIを 選択する(すなわち、 CPI= 1の場合には、選択パラメータ CP— 1を選択する)。
[0403] 次に、秘密処理装置 1020が有する管理情報を用いて、未実行の選択対象データ の中で CP— CPI番目の選択対象データを選択する。選択した選択対象データの番 号を選択識別子用変数に格納する。ここで、選択対象データの番号は 1からではなく 、 0から順に数える。例えば、選択対象データ 2040が未実行であり、 CP_CPI = 0 である場合は、選択対象データ 2040を選択し、選択識別子用変数には 0が格納さ れる。
[0404] 4. 1. 3 選択対象データ 2040〜2046
選択対象データ 2040〜2046は、変遷処理命令群 530による分岐後に、いずれか が実行されるプログラム命令群である。
選択対象データ 2040〜2046は、それぞれ、第 3の実施の形態と同様の選択対象 主要命令群 150〜156と、第 3の実施の形態と異なる更新処理命令群 2060〜206 6と分岐命令群 2070〜2076とを含むプログラム命令群である。
[0405] 本実施の形態では、正常系での実行時には、選択対象主要命令群 552、 555、 55
4の順番で実行されることで、この秘密保持プログラムが提供する機能の処理を行う。 すなわち、選択対象主要命令群 552、 555、 554のそれぞれには、第 1〜第 3の機能 提供命令群が入る。また、選択対象主要命令群 550、 551、 553、 556には、偽装機 能提供命令群が入る。
[0406] (1)更新処理命令群 2060〜2066
更新処理命令群 2060〜2066は、次回の選択時に用いる選択パラメータ群の値 の更新を行うプログラム命令群である。具体的には、更新処理命令群 2060〜2066 は、選択パラメータインデックス CPIをインクリメントする。これにより、選択処理命令群 2020は、選択時に用いる選択パラメータを直接指定する。
[0407] (2)分岐命令群 2070〜2076
分岐命令群 2070〜 6は、それぞれ選択対象データ 2040〜2046の外にある 選択処理命令群 2020へ分岐するプログラム命令群、及びプログラム呼出元に制御 を戻す処理のプログラム命令群の何れかからなる。
第 3の機能提供命令群を含む選択対象データ 2044に含まれる分岐命令群 2074 は、プログラム呼び出し元に制御を戻す処理のプログラム命令群であり、他の選択対 象データに含まれる選択対象外への分岐命令群は、選択処理命令群 2020へ分岐 するプログラム命令群である。
[0408] 4. 1. 4 動作
(1)秘密保持プログラム 2000の実行時の動作
ここでは、秘密保持プログラム 2000を実行した場合の秘密処理装置 1020の動作 と秘密処理装置 60の動作との異なる点を、図 24を用いて説明する。
秘密処理装置 1020の動作は、図 24〖こ示すステップ S500、ステップ S505、ステツ プ S530の動作を以下の動作に変更する。
[0409] 本実施の形態では、ステップ S500を、選択パラメータの初期値を、機能提供命令 群の数と同じだけ取得、選択パラメータインデックス CPIの値の初期化、及び前処理 の実行を行うように変更する。
本実施の形態では、ステップ S505を、選択識別子を、選択パラメータインデックス CPIが示す番号を持つ選択パラメータを選択することにより選択するように変更する。
例えば、選択パラメータインデックス CPIが「1」の場合は選択パラメータ CP— 1を選 択する。
[0410] 本実施の形態では、ステップ S530を、選択パラメータインデックス CPIの値をインク リメントするように変更する。
(2)動作の具体例
以下、本実施の形態における秘密保持プログラム 2000の動作の具体例を、図 42 を用いて説明する。
[0411] ここでは、上述したように、選択対象主要命令群 552、 555、 554のそれぞれに、第 1〜第 3の機能提供命令群が含まれ、選択対象主要命令群 550、 551、 553、 556 には、偽装機能提供命令群が含まれており、正常系での実行時には、選択対象主 要命令群 552、 555、 554の順番で実行されることで、この秘密保持プログラムが提 供する機能の処理を行う。
[0412] 秘密保持プログラム 2000は、前処理命令群 2010の処理を行う(ステップ S2000) 。具体的には、秘密保持プログラム 2000の前処理命令群 2010は、呼出元のプログ ラムから、入力値 inl、 in2、 in3として、それぞれ値「2」、「4」、「3」を受け取り、第 1〜 3の選択パラメータ用変数にそれぞれ値「2」、「4」、「3」を格納する処理、及び選択 パラメータインデックス CPIを値「1」に初期化する処理を行い、選択処理命令群 202 0へ分岐する。
[0413] 秘密保持プログラム 2000は、選択処理命令群 2020の処理を行う(ステップ S200 5)。具体的には、選択処理命令群 2020は、選択パラメータインデックス CPIに格納 されている値に基づいて、 1つの選択パラメータを取得する。選択処理命令群 2020 は、取得した選択パラメータに基づいて、複数の選択対象データうち 1の選択対象デ ータを選択する。ここでは、選択パラメータインデックス CPIは 1であるため、選択処理 命令群 2020は、選択パラメータ CP— 1 (= 2)を取得する。選択処理命令群 2020は 、秘密処理装置 1020が有する管理情報により、未実行の選択対象データ(2040、 2 041、 2042、 2043、 2044、 2045、 2046)の中で、 CP— 1 ( = 2)番目〖こ配置された 選択対象データ 2042を選択する。選択処理命令群 2020は、選択識別子用変数に 値「2」を格納する。
[0414] 秘密保持プログラム 2000は、管理情報更新命令群 525の処理を行う(ステップ S2
010)。具体的には、管理情報更新命令群 525は、選択識別子用変数「2」に対応す る選択対象データ 2042の管理情報を実行済みに更新する。
秘密保持プログラム 2000は、変遷処理命令群 530の処理を行う(ステップ S2015)
。具体的には、変遷処理命令群 530は、選択識別子用変数「2」に対応する選択対 象データ 2042に分岐する処理を行う。
[0415] 秘密保持プログラム 2000は、選択対象データ 2042に含まれる選択対象主要命令 群 552の処理を行う(ステップ S2020)である。具体的には、選択対象データ 2042は
、このプログラムが提供する機能の一部である第 1機能提供命令群に相当する処理 を行う。
秘密保持プログラム 2000は、更新処理命令群 2062の処理を行う(ステップ S202 5)。具体的には、更新処理命令群 2062は、選択パラメータ群の選択パラメータイン デッタス CPIをインクリメントする。ここでは、選択パラメータインデックス CPIの値が「1 」であったものが「2」になる。
[0416] 秘密保持プログラム 2000は、分岐命令群 2072の処理を行う(ステップ S2030)。
具体的には、分岐命令群 2072は、選択処理命令群 2020へ分岐する処理を行う。 秘密保持プログラム 2000は、選択処理命令群 2020の処理を行う(ステップ S203 5)。具体的には、選択パラメータインデックス CPIに格納された値は「2」であるため、 選択処理命令群 2020は、選択パラメータ CP— 2 (=4)を取得する。選択処理命令 群 2020は、秘密処理装置 1020が有する管理情報により、未実行の選択対象デー タ(2040、 2041、 2043、 2044、 2045、 2046)の中で、 CP— 2 (=4)番目〖こ配置さ れた選択対象データ 2045を選択する。選択処理命令群 2020は、選択識別子用変 数に値「5」を格納する。
[0417] 秘密保持プログラム 2000は、管理情報更新命令群 525の処理を行う(ステップ S2 040)。具体的には、管理情報更新命令群 525は、選択識別子用変数「5」に対応す る選択対象データ 2045の管理情報を実行済みに更新する。
秘密保持プログラム 2000は、変遷処理命令群 530の処理を行う(ステップ S2045) 。具体的には、変遷処理命令群 530は、選択識別子用変数「5」に対応する選択対
象データ 2045に分岐する処理を行う。
[0418] 秘密保持プログラム 2000は、選択対象データ 2045に含まれる選択対象主要命令 群 555の処理を行う(ステップ S2050)。具体的には、選択対象データ 2045は、この プログラムが提供する機能の一部である第 2機能提供命令群に相当する処理を行う 秘密保持プログラム 2000は、更新処理命令群 2065の処理を行う(ステップ S205 5)。具体的には、更新処理命令群 2065は、選択パラメータ群の選択パラメータイン デッタス CPIをインクリメントする。ここでは、選択パラメータインデックスの値力「2」で あったものが「3」になる。
[0419] 秘密保持プログラム 2000は、分岐命令群 2075の処理を行う(ステップ S2060)。
具体的には、分岐命令群 2075は、選択処理命令群 2020へ分岐する処理を行う。 秘密保持プログラム 2000は、選択処理命令群 2020の処理を行う(ステップ S206 5)。具体的には、選択パラメータインデックス CPIに格納された値は「3」であるため、 選択処理命令群 2020は、選択パラメータ CP— 3 ( = 3)を取得する。選択処理命令 群 2020は、秘密処理装置 1020が有する管理情報により、未実行の選択対象デー タ(2040、 2041、 2043、 2044、 2046)の中で、 CP— 3 ( = 3)番目に配置された選 択対象データ 2044を選択する。選択処理命令群 2020は、選択識別子用変数に値 「4」を格納する。
[0420] 秘密保持プログラム 2000は、管理情報更新命令群 525の処理を行う(ステップ S2 070)。具体的には、管理情報更新命令群 525は、選択識別子用変数「4」に対応す る選択対象データ 2044の管理情報を実行済みに更新する。
秘密保持プログラム 2000は、変遷処理命令群 530の処理を行う(ステップ S2075) 。具体的には、変遷処理命令群 530は、選択識別子用変数「4」に対応する選択対 象データ 2044に分岐する処理を行う。
[0421] 秘密保持プログラム 2000は、選択対象データ 2044に含まれる選択対象主要命令 群 554の処理を行う(ステップ S2080)。具体的には、選択対象データ 2044は、この プログラムが提供する機能の一部である第 3機能提供命令群に相当する処理を行う
秘密保持プログラム 2000は、更新処理命令群 2064の処理を行う(ステップ S208 5)。具体的には、更新処理命令群 2064は、選択パラメータ群の選択パラメータイン デッタス CPIをインクリメントする。ここでは、選択パラメータインデックスの値力 「3」で あったものが「4」になる。
[0422] 秘密保持プログラム 2000は、分岐命令群 2074の処理を行う(ステップ S2090)。
具体的には、分岐命令群 2074は、秘密保持プログラム 2000の呼び出し元に分岐 する処理を行う。
4. 2 プログラム難読ィ匕装置 1010
プログラム難読ィ匕装置 1010は、図 43にて示すように、プログラム記憶部 800f、入 力部 801f、機能提供命令群生成部 802f、偽装機能提供命令群生成部 803f、配置 順序決定部 804f、管理命令群生成部 805f、秘密保持プログラム生成部 806f、及 び出力部 807fから構成されて ヽる。
[0423] プログラム難読化装置 1010は、具体的には、マイクロプロセッサ、 ROM、 RAM、 ハードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成される コンピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビ ユータブログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を 達成するために、コンピュータに対する指令を示す命令コードが複数個組み合わさ れて構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラム に従って動作することにより、プログラム難読ィ匕装置 1010は、その機能を達成する。 つまり、前記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1 個ずつ読み出し、読み出した命令を解読し、解読結果に従って動作する。
[0424] なお、プログラム記憶部 800f、入力部 801f、機能提供命令群生成部 802f、偽装 機能提供命令群生成部 803f、管理命令群生成部 805f、秘密保持プログラム生成 部 806f、及び出力部 807fのそれぞれは、第 3の実施の形態にて示すプログラム記 憶部 800、入力部 801、機能提供命令群生成部 802、偽装機能提供命令群生成部 803、管理命令群生成部 805、秘密保持プログラム生成部 806、及び出力部 807と 同様であるため、説明は省略する。
[0425] 配置順序決定部 804と、配置順序決定部 804fとの違いは、前者は選択パラメータ
の初期値と選択識別子を求めるための計算式を用いて選択識別子を算出したが、後 者は選択パラメータの初期値を用い、計算式を用いな 、ことである。
以下、配置順序決定部 804fにつ 、て説明する。
また、配置順序決定部 804fは、図示していないが、制御部 850f、選択処理部 851 f、管理情報更新部 852f、更新処理部 853f、及び管理情報保持部 854fを有してい る。これら構成要素の接続関係は、図 26にて示す配置順序決定部 804の構成要素 の接続関係と同じである。
[0426] 配置順序決定部 804fは、選択パラメータの初期値を用いて、実際にどのような順 序で選択識別子が算出されるのかを確認することにより、機能提供命令群および偽 装機能提供命令群が配置されるべき選択対象主要命令群を決定する。
なお、本実施の形態では、第 3の実施の形態と同様に、入力部 801fにて選択パラ メータの初期値を受け付けるものとし、選択パラメータ CP— 1〜CP— 3の初期値は「 2」、「4」、「3」であるとする。
[0427] (1)管理情報保持部 854f
管理情報保持部 854fは、管理情報保持部 854と同様であるため、説明は省略す る。なお、以降、必要であれば、管理情報テーブル T800を用いて説明する。
これにより、機能提供命令群が配置された位置 (配置された選択対象データ)を記 '隐することができる。
[0428] (2)制御部 850f
制御部 850fは、選択パラメータ群を記憶するパラメータ記憶領域を有して 、る。 制御部 850fは、入力部 801fにて受け付けた選択パラメータの初期値 CP— 1、 CP —2、及び CP— 3 (ここでは、それぞれ「2」、「4」、「3」)をパラメータ記憶領域に記憶 する。
[0429] また、処理開始時には、制御部 850fは、選択パラメータインデックス CPIに初期値「 1」を設定し、パラメータ記憶領域に記憶する。
制御部 850fは、選択処理部 851f、管理情報更新部 852f、及び更新処理部 853f の動作を制御する。
制御部 850fは、選択識別子の値それぞれと、プログラム記憶部 800fにて記憶され
て ヽる選択対象データとの対応付けを行う。
[0430] 制御部 850fは、生成された第 i番目の機能提供命令群を機能提供命令群生成部 8 02fから取得する。制御部 850fは、取得した第潘目の機能提供命令群を、選択処 理部 85 Ifにて取得された選択識別子に基づいて、プログラム記憶部 800fにて記憶 され、対応する選択対象データへ挿入する。ここで、 iは 1以上 m以下の整数である。 また、制御部 850fは、第 i番目の機能提供命令群と、挿入先の選択対象データとの 対応付けを一時的に記憶して 、る。
[0431] 制御部 850fは、生成された複数の偽装機能提供命令群のうち選択対象データに 挿入されていない 1の偽装機能提供命令群を偽装機能提供命令群生成部 803fから 取得する。制御部 850fは、取得した偽装機能提供命令群を、第 i機能提供命令群、 又は偽装機能提供命令群が挿入されていない 1の選択対象データに挿入する。制 御部 850fは、この動作を、全ての偽装機能提供命令群に対して行う。
[0432] これにより、制御部 850fは、各選択対象データに、第 i機能提供命令群、又は偽装 機能提供命令群が挿入することができる。
制御部 850fによる第 i番目の機能提供命令群を取得する動作により、配置対象と なる機能提供命令群を選択することができる。
(3)選択処理部 85 If
選択処理部 85 Ifは、パラメータ記憶領域に記憶されて 、る選択パラメータインデッ タス CPIを取得し、取得した CPIに基づいて、選択パラメータ CP— kを取得する。ここ で、 kは 1以上 3以下の数である。
[0433] 選択処理部 851fは、取得した CP— kの値と管理情報テーブル T800を用いて、選 択識別子を取得する。
選択識別子の取得方法について、以下に説明する。
選択処理部 851fは、管理情報テーブル T800にお 、て値が「0」であるものを上位 力も順に、 0番目、 1番目、 · · · ·とし、取得した CP— kの値と一致する管理情報を取 得する。選択処理部 851fは、取得した管理情報に対応する選択対象データの選択 識別子を取得する。
[0434] 選択処理部 851fの動作と、制御部 850fによる第 i番目の機能提供命令群を選択
処理部 851fにて取得された選択識別子に基づき選択対象データに挿入する動作と により、機能提供命令群を適切な配置先へ配置することができる。
(4)管理情報更新部 852f
管理情報更新部 852fは、管理情報更新部 852と同様であるので、説明は省略す る。
[0435] (5)更新処理部 853f
更新処理部 853fは、パラメータ記憶領域にて記憶されて 、る選択パラメータインデ ックス CPIを更新する。つまり、ノ メータ記憶領域にて記憶されている選択パラメ一 タインデックス CPIに 1をインクリメントする。
4. 3 プログラム難読ィ匕装置 1010の動作
プログラム難読ィ匕装置 1010の動作は、図 27にて示すステップ S620の処理を、以 下に示す配置決定処理に置き換えることで、秘密保持プログラムを生成する。
[0436] 4. 3. 1 配置決定処理
ここでは、配置決定処理の動作について、図 44に示す流れ図を用いて説明する。 制御部 850fは、カウンタ iに「1」、選択パラメータインデックス CPIに初期値「1」を設 定し、選択パラメータインデックス CPI及び選択パラメータ CP_1、 CP_2、 CP_3 の各初期値「2」、「4」、「3」をパラメータ記憶領域へ格納する。制御部 850fは、選択 識別子の値それぞれと、選択対象データとの対応付けを行う (ステップ S2500)。ここ で、カウンタ iは、現在着目している機能提供命令群が何番目に実行されるべきであ るカゝを表す。すなわち、ここでは、第 1の機能提供命令群カゝら順番に配置順序を決定 していく。
[0437] 選択処理部 851fは、選択パラメータインデックス CPIを取得し、取得した CPIに基 づいて、選択パラメータ CP— kを取得する。選択処理部 851fは、取得した CP— kの 値と管理情報テーブル T800を用いて、選択識別子を取得する (ステップ S 2505)。 ここで、 kは 1以上 3以下の数である。例えば、選択処理部 851fは、選択パラメ一タイ ンデッタス CPIが「1」である場合には、選択パラメータ CP— 1 (= 2)を取得し、取得し た CP_1と管理情報テーブル T800とを用いて、選択識別子「2」を取得する。
[0438] 制御部 850fは、第 i番目の機能提供命令群を、選択処理部 85 Ifにて取得された
選択識別子に基づいて、対応する選択対象データへ挿入する (ステップ S2510)。 例えば cont = 1で、選択識別子の値が「2」であった場合には、第 1機能提供命令 群が、選択対象データ 542に配置されることとなる。
管理情報更新部 852fは、管理情報テーブル T800に含まれる複数の管理情報の うち、選択処理部 851fにて取得された選択識別子に対応する管理情報を、値「0」か ら値「1」へと更新する (ステップ S2515)。例えば、選択識別子の値が「2」であった場 合には、管理情報保持部 854fの管理情報テーブル T800において、選択対象デー タ 542に対応する管理情報を未配置力も配置済みに変える。
[0439] 更新処理部 853fは、パラメータ記憶領域にて記憶されている選択パラメータインデ ックス CPIに 1をインクリメントして、選択パラメータインデックス CPIの値を更新し、更 新結果をパラメータ記憶領域へ上書きする (ステップ S2520)。
制御部 850fは、カウンタ iに値「1」を加算する(ステップ S2525)。
制御部 850fは、カウンタ iが機能提供命令群の個数より大きいか否かを判定する( ステップ S2530)。
[0440] 大きくないと判定する場合には (ステップ S2530における「NO」)、制御部 850fは、 ステップ S2505に戻り、選択処理部 85 Ifの動作を制御する。
大きいと判定する場合には (ステップ S2530における「YES」)、制御部 850fは、複 数の偽装機能提供命令群のそれぞれに対して、機能提供命令群が挿入されて ヽな い 1以上の選択対象データの何れかが配置先となるように、配置先を決定する (ステ ップ S2535)。例えば、選択対象データ 540、 541、 542、 544力未実行であれば、 偽装機能提供命令群を配置する位置をそれらに決定し、各偽装提供命令群を挿入 する。
[0441] 4. 4 変形例
(1)上記第 4の実施の形態では、秘密保持プログラムは、選択パラメータの初期値 として、呼び出し元力 の入力値を格納した力 これに限定されない。秘密保持プロ グラムは、ネットワーク上の他の機器から取得する値を選択パラメータの初期値に代 入する構成でもよ ヽし、プログラム実行装置が保持する他のプログラムを実行した結 果得られる出力値を選択パラメータの初期値に代入する構成でもよい
(2)上記第 4の実施の形態では、機能提供命令群が 3つ、偽装機能提供命令群が 4つの場合を示したが必ずしもこの数である必要はな 、。機能提供命令群は複数個 、偽装機能提供命令群は 1個以上であればよい。
[0442] (3)上記第 4の実施の形態では、秘密処理装置 1020を上述の通りプログラムを用 いたプログラム実行装置の形で実現している力 これに限られるものではなくハードウ エア的な実装を行ってもょ 、。
(4)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよ!/、。
4. 5 第 4の実施の形態の効果
本実施の形態では、選択処理命令群 2020では選択対象データのうち、未実行の 選択対象データの中からのみ、次に選択する選択対象データを決定している。よつ て、難読化対象データが同じ選択対象データを重複して実行することがないことを知 つて 、る不正解析者が、選択パラメータ群の初期値を変えての全数探索を行ったと しても、 V、ずれの初期値を代入した場合にも選択対象データが重複して選ばれること はなぐ重複する力否かに基づいて効率的に間違った初期値を見つけ出していくこと が困難になる。
[0443] また、本実施の形態では、機能提供命令群の数と同じだけの入力値を用意し、各 入力値に対応する選択対象データを選択している。このような実装による効果を、具 体例を交えながら、以下に述べる。上述した例では機能提供命令群の数は 3つであ るため、入力値 in— 1、 in— 2、 in— 3により、選択対象データを選択している。本実 施の形態の秘密保持プログラム 2000では、始めに 6以下の非負整数 in— 1 (7種類 存在)を用いて、 7種類の選択対象データ 2040〜2046のいずれかを選択する。ここ で、括弧内の" 7種類存在"は、不正解析者が設定しうる in— 1の値が 7種類存在する という意味である。次に 5以下の非負整数 in— 2 (6種類存在)を用いて、 6種類の未 実行の選択対象データ(選択対象データ 2040〜2046から in— 1で選択された選択 対象データを除いたもの)のいずれかを選択する。さらに 4以下の非負整数 in— 3 (5 種類存在)を用いて、 5種類の未実行の選択対象データ (選択対象データ 2040〜2 046から in— 1及び in— 2で選択された選択対象データを除 ヽたもの)を選択する。 このように一意に選択対象データを選択することにより、入力値に対して選択対象デ
ータの選択するバリエーションが減らず、攻撃者が全数攻撃するときの組合せ数を減 らすことがない。
[0444] 5.第 5の実施の形態
以下、本発明に係る第 5の実施の形態としての秘密保持プログラム 2200、プロダラ ム難読化装置 3010及び秘密処理装置 3020について、図面を参照して説明する。 なお、システムの構成は、第 3の実施の形態にて示す構成と同様であるため、説明 は省略する。
[0445] 秘密処理装置 1020は、第 3の実施の形態にて示す秘密処理装置 60と同様に、秘 密情報を用いた装置である。
秘密処理装置 3020と、第 3の実施の形態にて示す秘密処理装置 60とは、構成要 素は同じであるが、各部の処理がそれぞれ異なっている。以下では、各部の処理の 説明が中心となるため、説明を簡単にするために、コンピュータ上で実行されることで 秘密処理装置を実現する秘密保持プログラム 2200の説明をもって、秘密処理装置 の説明に替える。ここで、秘密処理装置 3020の構成と秘密保持プログラム 2200の 各部との対応関係は第 3の実施の形態と同様である。
[0446] 5. 1 秘密保持プログラム 2200
秘密保持プログラム 2200の全体構成図を図 45に示す。以下では秘密保持プログ ラム 2200の詳細について、図 45を参照しながら説明していく。ここで、第 3の実施の 形態の秘密保持プログラム 500と同様の部分については、同一の符号を付け、説明 を省略する。
[0447] 秘密保持プログラム 2200は、第 3実施の形態の秘密保持プログラム 500と同様、プ ログラムに含まれるプログラム命令群がどのような実行順序で実行されるかを、不正 解析者に解析されたくな ヽプログラムである。
秘密保持プログラム 2200は、管理情報更新命令群 525、変遷処理命令群 530と、 第 3の実施の形態と異なる前処理命令群 2210、選択処理命令群 2220、選択対象 データ 2240、 2241、 · · ·、 2246とを含み、これらが図 45に示す順番に配置されて いる。
[0448] 選択対象データ 2240〜2246はそれぞれ、第 3の実施の形態と同様の選択対象
主要命令群 550〜556、第 3の実施の形態と異なる更新処理命令群 2260〜2266 と分岐命令群 2270〜2276と、とからなり、これらは図 45に示す順番に配置されてい る。各命令群は 1以上のプログラム命令力もなるプログラム命令群である。
秘密保持プログラム 2200は、呼出元のプログラムから、 2つの入力値 in— 1、 in— 2 および、このプログラムが提供する機能の処理を行う際に使用するパラメータを受け 取り、このプログラムが提供する機能の処理を行うプログラム命令群である。なお、 in —k (kはインデックス)は(7— k)未満の非負整数である。なお、選択対象データをこ こでは、 2240〜2246の 7つとしている力 これに限らない。選択対象データの個数 を n+ 1個としてもよい。ここで、 nは自然数である。このとき、 in— kは(n+ 1— k)未満 の非負整数である。また、入力値 in— 1、 in— 2の数は 2つとしている力 これに限ら ない。 m (mは n+ 1以下の自然数)個であってもよい。
[0449] 秘密保持プログラム 2200の処理では、後述の選択処理命令群 2220での処理に 用いる選択パラメータ群の選択パラメータ CP— 1、 CP— 2とモジュラス値 NNと、後述 の選択識別子を保持する選択識別子用変数を用いる。
ここでは、秘密保持プログラム 2200が正常系の実行時に呼出元のプログラムから 受け取る入力値 in— 1、 in— 2は値「2」、「4」であるとする。本実施の形態で提供する 秘密保持プログラム 2200は、呼出元のプログラム力も受け取る値を用いれば、(選択 対象主要命令群を含む)選択対象データを正 、順番に実行できるプログラムであ つて、呼出元のプログラム力 受け取る値を知ることができな 、不正解析者にとって は、(選択対象主要命令群を含む)選択対象データの実行順序を知ることが困難な プログラムである。
[0450] 5. 1. 1 前処理命令群 2210
前処理命令群 2210は、選択処理命令群 2220で用いる選択パラメータ群を設定 するプログラム命令群である。なお、選択パラメータ群は、選択パラメータ CP_1、選 択パラメータ CP— 2と、モジュラス値 NNカゝらなる。これらの選択パラメータ CP— 1、 C P— 2は、非負整数値であり、モジュラス値 NNは自然数である。
[0451] 前処理命令群 2210は、秘密保持プログラム 2200が起動された際に、最初に実行 されるプログラム命令群である。呼び出し元のプログラム力 入力値 in l、in 2を
受け取り、前処理命令群 2210は、受け取った値を選択パラメータ群の選択パラメ一 タ CP_1、選択パラメータ CP_2にそれぞれ格納し、選択パラメータ群のモジュラス 値 NNを 7に設定するプログラム命令群と、選択処理命令群 2220に分岐するプログ ラム命令群とからなり、これらは順に行われるプログラム命令群である。正常系の実行 時には、 in— 1、 in— 2は値「2」、「4」であり、前処理命令群 2210は、選択パラメータ CP— 1、 CP— 2にそれぞれ値「2」、「4」を格納する処理を行う。なお、選択パラメ一 タは、入力値 in_l、 in_2、 · · ·の個数 (本実施の形態では 2個)だけ存在する。また 、本実施の形態では、モジュラス値の初期値は選択対象データの数に合わせて 7と している。
[0452] 5. 1. 2 選択処理命令群 2220
選択処理命令群 2220は、選択パラメータ群を用いて、選択識別子を算出するプロ グラム命令群と、変遷処理命令群 530に分岐するプログラム命令群からなり、これら は順に行われるプログラム命令群である。なお、選択識別子は、第 3の実施の形態と 同様に変遷処理命令群 530で使用する値である。
[0453] 選択処理命令群 2220が選択識別子を算出する処理では、まず、選択パラメータ 群の選択パラメータ CP— 1、 CP— 2とモジュラス値 NNに対し、 pl、 p2を NNと互い に素な整数とし、式 20「pl X (選択パラメータ CP_1) +p2 X (選択パラメータ CP_ 2) mod NN」を算出し、算出結果を INDに設定する。以降の説明において、 IND は選択識別子を示す。ここで、 piと NNと互いに素とは piと NNの最大公約数が 1で あることを示す。また、演算子「X」は掛け算を表す。次に、秘密処理装置 3020が有 する管理情報を用いて、未実行の選択対象データの中で IND番目の選択対象デー タを選択する。選択した選択対象データの番号を選択識別子用変数に格納する。こ こで、選択対象データの番号は 1からではなぐ 0から順に数える。したがって、もし、 選択対象データ 2240が未実行であり、 IND=0である場合は、選択対象データ 224 0を選択し、選択識別子用変数は 0となる。
[0454] 本実施の形態では、 pl、 p2をそれぞれ、値「1」、「2」とし、式 20を「1 X (選択パラメ ータ CP— 1) + 2 X (選択パラメータ CP— 2) mod NN」とする。
5. 1. 3 選択対象データ 2240〜2246
選択対象データ 2240〜2246は、変遷処理命令群 530により分岐してきた際に、 実行されるプログラム命令群である。
[0455] 選択対象データ 2240〜2246は、それぞれ、第 3の実施の形態と同様の選択対象 主要命令群 550〜556と、第 3の実施の形態と異なる更新処理命令群 2260〜226 6と分岐命令群 2270〜2276と力 なるプログラム命令群である。
本実施例では、正常系での実行時には、選択対象主要命令群 553、 555、 554の 順番で実行されることで、この秘密保持プログラムが提供する機能の処理を行う。す なわち、選択対象主要命令群 553、 555、 554のそれぞれには、第 3の実施の形態 における第 1機能提供命令群、第 2機能提供命令群、及び第 3機能提供命令群が入 り、選択対象主要命令群 550、 551、 552、 556には第 3の実施の形態と同様の偽装 機能提供命令群が入るものとする。
[0456] (1)更新処理命令群 2260〜2266
更新処理命令群 2260〜2266は、選択パラメータ群の値の更新を行うプログラム 命令群である。選択パラメータ CP— 2の値を選択パラメータ CP— 1に代入し、選択 ノ メータ CP— 2に、選択識別子用変数に格納されている値を代入し、選択パラメ一 タ群のモジュラス値をデクリメントする。なお、ここでは選択パラメータの数が 2つであ る力 m個の場合は、選択パラメータ CP_mの値を選択パラメータ CP_(m— 1)に 代入し、選択パラメータ CP— (m—1)の値を選択パラメータ CP— (m— 2)に代入し、 · · ·、選択パラメータ CP— 2の値を選択パラメータ CP— 1に代入し、選択パラメータ C P— mに、選択識別子用変数に格納されている値を代入し、モジュラス値をデクリメン トする。また、モジュラス値をデクリメントした場合には、デクリメントされたモジュラス値 は、 pl、 p2と互いに素になる必要はない。
[0457] (2)分岐命令群 2270〜2276
分岐命令群 2270〜2276は、それぞれ選択対象データ 2240〜2246の外にある 選択処理命令群 520へ分岐するプログラム命令群や、プログラム呼出元に制御を戻 す処理のプログラム命令群である。第 3機能提供命令群を含む選択対象データ 224 4に含まれる分岐命令群 2274は、プログラムの呼出元に制御を戻す処理のプロダラ ム命令群であり、他の選択対象データに含まれる分岐命令群は、選択処理命令群 5
20へ分岐するプログラム命令群である。
[0458] 5. 1. 4 動作
ここでは、秘密保持プログラム 2200を実行した場合の秘密処理装置 3020の動作 と、秘密処理装置 60の動作との異なる点を、図 24を用いて説明する。
秘密処理装置 3020の動作は、図 24〖こ示すステップ S500、ステップ S505、ステツ プ S530の動作を以下の動作に変更する。
[0459] 本実施の形態では、ステップ S500を、選択パラメータの初期化お呼び前処理の実 行にカロえ、モジュラス値 NNの初期化も行うように変更する。ここで、モジュラス値の初 期値は選択対象データの数と同一とする。
本実施の形態では、ステップ S505を、選択パラメータ群に含まれるモジュラス値 N Nを取得し、式 20と、取得したモジュラス値 NNとを用いて選択識別子を算出するよう に変更する。なお、ここでの NNは選択対象データの数ではなぐモジュラス値である
[0460] 本実施の形態では、ステップ S530を、選択パラメータの更新に加え、モジュラス値 NNをデクリメントするように変更する。
(2)動作の具体例
以下、本実施の形態における秘密保持プログラム 2200の動作の具体例を、図 46 を用いて説明する。
[0461] ここでは、上述したように、選択対象主要命令群 553、 555、 554のそれぞれに、第 1〜第 3の機能提供命令群が含まれ、選択対象主要命令群 550、 551、 552、 556 には、偽装機能提供命令群が含まれており、正常系での実行時には、選択対象主 要命令群 553、 555、 554の順番で実行されることで、この秘密保持プログラムが提 供する機能の処理を行う。
[0462] 秘密保持プログラム 2200は、前処理命令群 2210の処理を行う(ステップ S3000) 。具体的には、前処理命令群 2210は、選択パラメータ CP— 1、 CP— 2のそれぞれ に、値「2」、「4」を格納し、モジュラス値 NNに値「7」を設定する。
秘密保持プログラム 2200は、選択処理命令群 2220の処理を行う(ステップ S300 5)。具体的には、選択処理命令群 2220は、式 20、選択パラメータ CP— 1 (= 2)、 C
P— 2 ( = 4)、及びモジュラス値 NN ( = 7)を用いて、値 INDを算出する。ここでは、算 出される値 INDは、「1 X 2 + 2 X 4 mod 7 = 3」となる。秘密処理装置 3020が有す る管理情報より、未実行の選択対象データ(2240、 2241、 2242、 2243、 2244、 2 245、 2246)の中で 3番目の選択対象データ 2243を選択する。選択識別子用変数 の値は「3」となる。
[0463] 秘密保持プログラム 2200は、管理情報更新命令群 525の処理を行う(ステップ S3 010)。具体的には、管理情報更新命令群 525は、選択識別子用変数「3」に対応す る選択対象データ 2243の管理情報を実行済みに更新する。
秘密保持プログラム 2200は、変遷処理命令群 530の処理を行う(ステップ S3015) 。具体的には、変遷処理命令群 530は、選択識別子変数「3」に対応する選択対象 データ 2243に分岐する処理を行う。
[0464] 秘密保持プログラム 2200は、選択対象データ 2243に含まれる選択対象主要命令 群 553の処理を行う(ステップ S3020)。具体的には、選択対象データ 2243は、プロ グラムが提供する機能の一部である第 1機能提供命令群に相当する処理を行う。 秘密保持プログラム 2200は、更新処理命令群 2263の処理を行う(ステップ S302 5)。具体的には、更新処理命令群 2263は、選択パラメータ CP— 2の値を選択パラ メータ CP— 1に代入し、選択パラメータ CP— 2に、選択識別子用変数の値を代入す る。ここでは、選択パラメータ CP— 1、 CP— 2のそれぞれの値が「2」、 「4」であったも の力 「4」、 「3」になる。さらに、モジュラス値 NNをデクリメントする。ここでは、モジュ ラス値 NNが「7」であったものが「6」になる。
[0465] 秘密保持プログラム 2200は、分岐命令群 2273の処理を行う(ステップ S3030)。
具体的には、分岐命令群 2273は、選択処理命令群 2220へ分岐する処理を行う。 秘密保持プログラム 2200は、選択処理命令群 2220の処理を行う(ステップ S303 5)。具体的には、選択処理命令群 2220は、式 20、選択パラメータ CP— 1 ( =4)、 C P— 2 ( = 3)、及びモジュラス値 NN ( = 6)を用いて、値 INDを算出する。ここでは、算 出される値 INDは、「1 X 4 + 2 X 3 mod 6=4」となる。秘密処理装置 3020が有す る管理情報より、未実行の選択対象データ(2240、 2241、 2242、 2244、 2245、 2 246)の中で 4番目の選択対象データ 2245を選択する。選択識別子用変数の値は「
5」となる。
[0466] 秘密保持プログラム 2200は、管理情報更新命令群 525の処理を行う(ステップ S3 040)。具体的には、管理情報更新命令群 525は、選択識別子用変数「5」に対応す る選択対象データ 2245の管理情報を実行済みに更新する。
秘密保持プログラム 2200は、変遷処理命令群 530の処理を行う(ステップ S3045) 。具体的には、変遷処理命令群 530は、選択識別子変数「5」に対応する選択対象 データ 2245に分岐する処理を行う。
[0467] 秘密保持プログラム 2200は、選択対象データ 2245に含まれる選択対象主要命令 群 555の処理を行う(ステップ S3050)。具体的には、選択対象データ 2245は、プロ グラムが提供する機能の一部である第 2機能提供命令群に相当する処理を行う。 秘密保持プログラム 2200は、更新処理命令群 2265の処理を行う(ステップ S305 5)。具体的には、更新処理命令群 2265は、選択パラメータ CP— 2の値を選択パラ メータ CP— 1に代入し、選択パラメータ CP— 2に、選択識別子用変数の値を代入す る。ここでは、選択パラメータ CP— 1、 CP— 2のそれぞれの値が「4」、「3」であったも の力 「3」、「5」になる。さらに、モジュラス値 NNをデクリメントする。ここでは、モジュ ラス値 NNが「6」であったものが「5」になる。
[0468] 秘密保持プログラム 2200は、分岐命令群 2275の処理を行う(ステップ S3060)。
具体的には、分岐命令群 2275は、選択処理命令群 2220へ分岐する処理を行う。 秘密保持プログラム 2200は、選択処理命令群 2220の処理を行う(ステップ S306 5)。具体的には、選択処理命令群 2220は、式 20、選択パラメータ CP— 1 (= 3)、 C P— 2 ( = 5)、及びモジュラス値 NN ( = 5)を用いて、値 INDを算出する。ここでは、算 出される値 INDは、「1 X 3 + 2 X 5 mod 5 = 3」となる。秘密処理装置 3020が有す る管理情報より、未実行の選択対象データ(2240、 2241、 2242、 2244、 2246)の 中で 3番目の選択対象データ 2244を選択する。選択識別子用変数の値は「4」とな る。
[0469] 秘密保持プログラム 2200は、管理情報更新命令群 525の処理を行う(ステップ S3 070)。具体的には、管理情報更新命令群 525は、選択識別子用変数「4」に対応す る選択対象データ 2244の管理情報を実行済みに更新する。
秘密保持プログラム 2200は、変遷処理命令群 530の処理を行う(ステップ S3075) 。具体的には、変遷処理命令群 530は、選択識別子変数「4」に対応する選択対象 データ 2244に分岐する処理を行う。
[0470] 秘密保持プログラム 2200は、選択対象データ 2244に含まれる選択対象主要命令 群 554の処理を行う(ステップ S3080)。具体的には、選択対象データ 2244は、プロ グラムが提供する機能の一部である第 3機能提供命令群に相当する処理を行う。 秘密保持プログラム 2200は、更新処理命令群 2264の処理を行う(ステップ S308 5)。具体的には、更新処理命令群 2264は、選択パラメータ CP— 2の値を選択パラ メータ CP— 1に代入し、選択パラメータ CP— 2に、選択識別子用変数の値を代入す る。ここでは、選択パラメータ CP— 1、 CP— 2のそれぞれの値が「3」、「5」であったも の力 「5」、「4」になる。さらに、モジュラス値 NNをデクリメントする。ここでは、モジュ ラス値 NNが「5」であったものが「4」になる。
[0471] 秘密保持プログラム 2200は、分岐命令群 2274の処理を行う(ステップ S3090)。
具体的には、分岐命令群 2274は、秘密保持プログラム 2200の呼び出し元に分岐 する処理を行う。
4. 2 プログラム難読ィ匕装置 3010
プログラム難読ィ匕装置 3010は、図 47にて示すように、プログラム記憶部 800g、入 力部 801g、機能提供命令群生成部 802g、偽装機能提供命令群生成部 803g、配 置順序決定部 804g、管理命令群生成部 805g、秘密保持プログラム生成部 806g、 及び出力部 807gから構成されて ヽる。
[0472] プログラム難読化装置 3010は、具体的には、マイクロプロセッサ、 ROM、 RAM、 ハードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成される コンピュータシステムである。前記 RAM又は前記ハードディスクユニットには、コンビ ユータブログラムが記憶されている。ここで、コンピュータプログラムは、所定の機能を 達成するために、コンピュータに対する指令を示す命令コードが複数個組み合わさ れて構成されたものである。前記マイクロプロセッサ力 前記コンピュータプログラム に従って動作することにより、プログラム難読ィ匕装置 3010は、その機能を達成する。 つまり、前記マイクロプロセッサは、前記コンピュータプログラムに含まれる各命令を 1
個ずつ読み出し、読み出した命令を解読し、解読結果に従って動作する。
[0473] なお、プログラム記憶部 800g、入力部 801g、機能提供命令群生成部 802g、偽装 機能提供命令群生成部 803g、管理命令群生成部 805g、秘密保持プログラム生成 部 806g、及び出力部 807gのそれぞれは、第 3の実施の形態にて示すプログラム記 憶部 800、入力部 801、機能提供命令群生成部 802、偽装機能提供命令群生成部 803、管理命令群生成部 805、秘密保持プログラム生成部 806、及び出力部 807と 同様であるため、説明は省略する。
[0474] 配置順序決定部 804と、配置順序決定部 804gとの違いは、選択識別子を求める ための計算式が異なることと、後者にぉ 、て計算式のモジュラス値が変化して 、くこと である。
以下、配置順序決定部 804gについて説明する。
また、配置順序決定部 804gは、図示していないが、制御部 850g、選択処理部 85 lg、管理情報更新部 852g、更新処理部 853g、及び管理情報保持部 854gを有し ている。これら構成要素の接続関係は、図 26にて示す配置順序決定部 804の構成 要素の接続関係と同じである。
[0475] 配置順序決定部 804gは、選択パラメータの初期値と選択識別子の計算式を用い て、実際にどのような順序で選択識別子が算出されるのかを確認することにより、機 能提供命令群および偽装機能提供命令群が配置されるべき選択対象主要命令群を 決定する。なお、本実施の形態では、入力部 801gにて選択パラメータの初期値を受 け付けるものとし、選択パラメータ CP— 1〜CP— 2の初期値は「2」、「4」であるとする
[0476] (1)管理情報保持部 854g
管理情報保持部 854gは、管理情報保持部 854と同様であるため、説明は省略す る。なお、以降、必要であれば、管理情報テーブル T800を用いて説明する。
これにより、機能提供命令群が配置された位置 (配置された選択対象データ)を記 '隐することができる。
[0477] (2)制御部 850g
制御部 850gは、選択パラメータ群を記憶するパラメータ記憶領域を有して!/、る。
制御部 850gは、入力部 801gにて受け付けた選択パラメータの初期値 CP— 1、及 び CP— 2 (ここでは、それぞれ「2」、「4」)をパラメータ記憶領域に記憶する。
また、処理開始時には、制御部 850gは、モジュラス値 NNに初期値「7」を設定し、 パラメータ記憶領域に記憶する。
[0478] 制御部 850gは、選択処理部 851g、管理情報更新部 852g、及び更新処理部 853 gの動作を制御する。
制御部 850gは、選択処理部 851gが有する式 20が取り得る値、つまり、式 20にて 取り得る選択識別子の値それぞれと、プログラム記憶部 800gにて記憶されて 、る選 択対象データとの対応付けを行う。
[0479] 制御部 850gは、生成された第 i番目の機能提供命令群を機能提供命令群生成部 802gから取得する。制御部 850gは、取得した第潘目の機能提供命令群を、選択 処理部 85 lgにて取得された選択識別子に基づいて、プログラム記憶部 800gにて記 憶され、対応する選択対象データへ挿入する。ここで、 iは 1以上 m以下の整数である 。また、制御部 850gは、第 i番目の機能提供命令群と、挿入先の選択対象データと の対応付けを一時的に記憶して 、る。
[0480] 制御部 850gは、生成された複数の偽装機能提供命令群のうち選択対象データに 挿入されていない 1の偽装機能提供命令群を偽装機能提供命令群生成部 803gか ら取得する。制御部 850gは、取得した偽装機能提供命令群を、第 i機能提供命令群 、又は偽装機能提供命令群が挿入されていない 1の選択対象データに挿入する。制 御部 850gは、この動作を、全ての偽装機能提供命令群に対して行う。
[0481] これにより、制御部 850gは、各選択対象データに、第 i機能提供命令群、又は偽装 機能提供命令群が挿入することができる。
制御部 850gによる第 i番目の機能提供命令群を取得する動作により、配置対象と なる機能提供命令群を選択することができる。
(3)選択処理部 85 lg
選択処理部 851gは、パラメータ記憶領域に記憶されている選択パラメータ CP— 1 、 CP— 2、及びモジュラス値 NNを取得し、取得した各値と、式 20とを用いて、値 IND を算出する。
[0482] 選択処理部 851gは、算出した値 INDと管理情報テーブル T800を用いて、選択識 別子を取得する。
選択識別子の取得方法について、以下に説明する。
選択処理部 851gは、管理情報テーブル T800にお 、て値が「0」であるものを上位 力も順に、 0番目、 1番目、 · · · ·とし、算出した INDの値と一致する管理情報を取得 する。選択処理部 851gは、取得した管理情報に対応する選択対象データの選択識 別子を取得する。
[0483] 選択処理部 851の動作と、制御部 850による第 i番目の機能提供命令群を選択処 理部 851にて取得された選択識別子に基づき選択対象データに挿入する動作と〖こ より、機能提供命令群を適切な配置先へ配置することができる。
(4)管理情報更新部 852g
管理情報更新部 852gは、管理情報更新部 852と同様であるので、説明は省略す る。
[0484] (5)更新処理部 853g
更新処理部 853gは、パラメータ記憶領域にて記憶されて 、る選択パラメータ CP— 1、 CP— 2、及びモジュラス値 NNを更新する。
ここでは、更新処理部 853gは、選択パラメータ CP— 2の値を選択パラメータ CP— 1に代入し、選択パラメータ CP— 2に、選択識別子用変数の値を代入し、それぞれに 選択パラメータの値を更新する。更新処理部 853gは、更新した選択パラメータ CP— 1及び CP— 2を、制御部 850gのパラメータ記憶領域へ上書きする。更新処理部 853 gは、モジュラス値 NNの値をデクリメントし、その結果を、制御部 850gのパラメータ記 憶領域へ上書きする。
[0485] 5. 3 プログラム難読ィ匕装置 3010の動作
プログラム難読ィ匕装置 3010の動作は、図 27にて示すステップ S620の処理を、以 下に示す配置決定処理に置き換えることで、秘密保持プログラムを生成する。
5. 3. 1 配置決定処理
ここでは、配置決定処理の動作について、図 48に示す流れ図を用いて説明する。
[0486] 制御部 850gは、カウンタ iに「1」、モジュラス値 NNに初期値「7」を設定し、選択パ
ラメータ群に含まれる選択パラメータ CP— 1、 CP— 2及び、モジュラス値 NNの各初 期値「2」、「4」、「7」をパラメータ記憶領域へ格納する。制御部 850gは、選択識別子 の値それぞれと、選択対象データとの対応付けを行う(ステップ S3500)。ここで、力 ゥンタ iは、現在着目している機能提供命令群が何番目に実行されるべきであるかを 表す。すなわち、ここでは、第 1の機能提供命令群カゝら順番に配置順序を決定してい
<o
[0487] 選択処理部 851g、パラメータ記憶領域に記憶されている選択パラメータ CP— 1、 CP— 2、及びモジュラス値 NNを取得し、取得した各値と、式 20とを用いて、値 IND を算出する。選択処理部 85 lgは、算出した値 INDと管理情報テーブル T800を用 いて、選択識別子を取得する (ステップ S3505)。例えば、選択パラメータ CP_1〜 CP— 2の値が「2」、「4」であり、モジュラス値 NN力「7」である場合には、式 20の値は 「1 X 2 + 2 X 4 MOD 7 = 3」になる。選択処理部 85 lgは、管理情報テーブル T80 0より、未実行の選択対象データ(2240、 2241, 2242, 2243, 2244, 2245, 224 6)の中で 3番目の選択対象データ 2243を選択する。選択識別子用変数の値は「3」 となる。ここで、「未実行」とは、機能提供命令群が選択対象データに配置されていな いことを示す。また、「実行済」とは、機能提供命令群が選択対象データに配置済で あることを示す。
[0488] 制御部 850gは、第 i番目の機能提供命令群を、選択処理部 85 lgにて取得された 選択識別子に基づいて、対応する選択対象データへ挿入する (ステップ S3510)。 例えば cont = 1で、選択識別子の値が「3」であった場合には、第 1機能提供命令 群が、選択対象データ 543に配置されることとなる。
管理情報更新部 852gは、管理情報テーブル T800に含まれる複数の管理情報の うち、選択処理部 851gにて取得された選択識別子に対応する管理情報を、値「0」か ら値「1」へと更新する (ステップ S3515)。例えば、選択識別子の値が「3」であった場 合には、管理情報保持部 854gの管理情報テーブル T800において、選択対象デー タ 543に対応する管理情報を未配置力も配置済みに変える。
[0489] 更新処理部 853gは、パラメータ記憶領域にて記憶されている選択パラメータ CP— 1及び CP— 2を更新し、更新結果をパラメータ記憶領域へ上書きする (ステップ S35
20)。更新方法は、上述しているのでここでの説明は省略する。例えば、選択パラメ ータ CP— 1及び CP— 2のそれぞれの値が「2」、「4」で選択識別子の値が「3」であつ た場合は、選択パラメータ CP— 1及び CP— 2のそれぞれの値を「4」、「3」にする。
[0490] 更新処理部 853gは、モジュラス値 NNをデクリメントし、その結果をパラメータ記憶 領域へ上書きする (ステップ S3525)。
制御部 850gは、カウンタ iに値「1」を加算する(ステップ S3530)。
制御部 850gは、カウンタ iが機能提供命令群の個数より大きいか否かを判定する( ステップ S3535)。
[0491] 大きくないと判定する場合には (ステップ S3535における「NO」)、制御部 850gは 、ステップ S3505に戻り、選択処理部 85 lgの動作を制御する。
大きいと判定する場合には (ステップ S3535における「YES」)、制御部 850gは、複 数の偽装機能提供命令群のそれぞれに対して、機能提供命令群が挿入されて ヽな い 1以上の選択対象データの何れかが配置先となるように、配置先を決定する (ステ ップ S3540)。例えば、選択対象データ 540、 541、 542、 544が未実行であれば、 偽装機能提供命令群を配置する位置をそれらに決定し、各偽装提供命令群を挿入 する。
[0492] 5. 4 変形例
(1)上記第 5の実施の形態では、秘密保持プログラムは、選択パラメータの初期値 として、呼び出し元力 の入力値を格納した力 これに限定されない。秘密保持プロ グラムは、ネットワーク上の他の機器から取得する値を選択パラメータの初期値に代 入する構成でもよ ヽし、プログラム実行装置が保持する他のプログラムを実行した結 果得られる出力値を選択パラメータの初期値に代入する構成でもよい
(2)上記第 5の実施の形態では、機能提供命令群が 3つ、偽装機能提供命令群が 4つの場合を示したが必ずしもこの数である必要はな 、。機能提供命令群は複数個 、偽装機能提供命令群は 1個以上であればよい。
[0493] (3)上記第 5の実施の形態では、秘密処理装置 3020を上述の通りプログラムを用 いたプログラム実行装置の形で実現している力 これに限られるものではなくハードウ エア的な実装を行ってもょ 、。
(4)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよ!/、。
5. 5 第 5の実施の形態の効果
本実施の形態では、選択処理命令群 2220では選択対象データのうち、未実行の 選択対象データの中からのみ、次に選択する選択対象データを決定している。よつ て、難読化対象データが同じ選択対象データを重複して実行することがないことを知 つて 、る不正解析者が、選択パラメータ群の初期値を変えての全数探索を行ったと しても、 V、ずれの初期値を代入した場合にも選択対象データが重複して選ばれること はなぐ重複する力否かに基づいて効率的に間違った初期値を見つけ出していくこと が困難になる。
[0494] また、本実施の形態では、入力値 in— 1、 in— 2により、一意に選択対象データを選 択していく。その理由を以下で述べる。始めに 6以下の非負整数 in— 1 (7種類存在) を用いて、 7種類の選択対象データ 2240〜2246のいずれかを選択する。次に 5以 下の非負整数 in— 2 (6種類存在)を用いて、 6種類の未実行の選択対象データ (選 択対象データ 2240〜2246から in— 1で選択された選択対象データを除いたもの) のいずれかを選択する。入力の in— k (k= l、 2)の取りうる種類と、選択対象データ の選択しうる種類が同じであるため、これらの選択は in— 1、 in— 2を用いて一意に決 定する。したがって、入力値 in— 1、 in— 2により、一意に選択対象データを選択する 。このように一意に選択対象データを選択することにより、入力値に対して選択対象 データの選択するバリエーションが減らず、攻撃者が全数攻撃するときの組合せの数 を減らすことがない。
[0495] 6.変形例
上記に説明した実施の形態は、本発明の実施の一例であり、本発明はこの実施の 形態に何ら限定されるものではなぐその旨を逸脱しな 、範囲にぉ 、て種々なる態様 で実施し得るものである。例えば、以下のような場合も本発明に含まれる。
(1)上記第 3の実施の形態の選択処理命令群が選択識別子を算出する処理で使 用する式は、式 3「pl X (選択パラメータ CP_1) +p2 X (選択パラメータ CP_2) mod NN」としている力 これに限らない。例えば、この式は、選択パラメータ CP— 1 の値を固定したときに、選択パラメータ CP— 2の値と式の計算結果が 1対 1となる条
件を満たせばよい。式 3では、選択パラメータ CP— 2が NN未満の値であれば、 p2と NNが互いに素であるため、取りうる選択パラメータ CP— 2が NN種類存在すれば、 それに対応して、 p2 X (選択パラメータ CP— 2) mod NNも NN種類存在する。
[0496] また、第 5の実施の形態においても同様に、選択識別子の算出式を、式 20としてい る力 これに限らない。例えば、この式は、選択パラメータ CP— 1の値を固定したとき に、選択パラメータ CP— 2の値と式の計算結果が 1対 1となる条件を満たせばよい。
(2)各実施の形態の動作にお!、て、選択対象主要命令群と変遷処理命令群は順 番を入れ替えてもよい。また、第 3の実施の形態において、更新処理命令群 560〜5 66は、選択対象データ 540〜546に含まれる構成となっている力 管理情報更新命 令群 525の後にひとつだけ配置する構成であっても構わない。また、選択処理命令 群 520、管理情報更新命令群 525、変遷処理命令群 530の 3つの命令群はそれぞ れ一つである構成だが、各選択対象データに含まれる分岐命令群 570から 576のぞ れぞれの代わりに前記 3つの命令群を配置する構成であっても構わな 、。
[0497] また、第 4及び第 5の実施の形態においても同様である。
(3)各命令群は、必ずしも独立した命令群である必要はなぐ複数の命令群が提供 する機能を組み合わせた手段とする構成であっても構わない。
(4)第 3、第 4及び第 5の実施の形態では、実行済みの選択対象データに相当する 選択識別子が算出された場合、未実行の選択識別子に対応する直近の値を算出す るという方法を取っているが、この計算方法に限られるものではない。例えば、選択識 別子をランダムに計算し、対応する選択対象データが実行されているか否かの確認 を繰り返していく計算方法などでもよい。このよう〖こすると、不正解析者による解析は より困難となる。
[0498] (5)上記各実施の形態および変形例における、機能提供命令群、偽装機能提供 命令群、管理命令群の生成順序は上述した順序に限るものではない。各ステップは 、生成した各命令群を用いて秘密保持プログラムを生成するステップまでに終了して いれば、どのような順序で実行されても構わない。例えば、偽装機能提供命令群と機 能提供命令群の生成順序を逆にするなどしても構わない。
[0499] (6)各実施の形態の説明にて挙げた数値は全て一例であり、その数値に限るもの
ではない。例えば、選択対象データの数や初期値の数をより増やしてもよいし、初期 値の数値を別のものとしてもよ 、。
初期値の数を増やすことで解析をさらに困難にすることができる。
(7)第 1の実施の形態において、秘密保持プログラムは、 1以上の偽装機能提供命 令群を含むとしたが、これに限定されない。
[0500] 秘密保持プログラムは、偽装機能提供命令群を含まなくてもよ!、。
また、第 3、第 4及び第 5の実施の形態においても同様に、秘密保持プログラムは、 偽装機能提供命令群を含まなくてもよ ヽ。
(8)上記の各実施の形態の秘密処理装置や秘密保持プログラムでは、いずれもプ ログラムを分割して生成した命令群を選択対象データとして ヽたが、これに限られる ものではなぐ何らかの順序をもって使用された場合に正当な結果を得られるような 情報であればどのようなものでも構わない。具体的な例としては、複数の暗号鍵によ り順序をもった多重の暗号ィ匕を行うような場合には、その暗号鍵それぞれを選択対象 データとして扱うことなどが考えられる。また、秘密保持プログラムについても同様で ある。
[0501] (9)上記の各実施の形態の秘密処理装置や秘密保持プログラムでは、 Vヽずれも選 択パラメータの初期値を受け取り、内部でその値を更新していく構成を取っているが 、これに限られるものではない。具体的には、秘密処理装置等の外部で選択パラメ一 タの値を更新し、秘密処理装置等は更新後の値を受け取るようにしてもよい。また、 予め秘密処理装置による処理が終了するまでに用いる選択パラメータの全てを配列 によるデータとして受け取って、それに従った動作をするとしてもよい。また、秘密保 持プログラムにつ ヽても同様である。
[0502] (10)第 1の実施の形態において、選択識別子の算出方法として、第 3の実施の形 態にて示す方法、第 4の実施の形態にて示す方法、及び第 5の実施の形態にて示す 方法の何れかを用いてもょ 、。
(11)上記第 1の実施の形態において、プログラム難読ィ匕装置 10は、ブロックの配 置位置に対応する値を、式 1を用いて算出したが、これに限定されない。
[0503] プログラム難読ィ匕装置 10は、ブロックを配置するアドレスを算出する算出式を用い
てもよい。このとき、プログラム実行装置 20は、前記算出式を用いて、次に実行する ブロックのアドレスを算出する。
なお、第 3、第 4、及び第 5の実施の形態においても同様に、プログラム難読化装置 は、ブロックを配置するアドレスを算出する算出式を用 、てもよ 、。
[0504] (12)本発明における「変数」は、特定の言語における変数に限定されるのではなく 、レジスタ、キャッシュ、 RAM、 HDD,その他の書き換え可能なメモリに記憶した内 容、及びそれらのメモリに記載された値によって指定された位置に記憶された内容で あってもよい。
(13)上記第 1の実施の形態において、更新処理命令群は、選択対象主要命令群 の直後に配置されたが、これに限定されない。選択対象主要命令群の中に挿入して ちょい。
[0505] ここでは、選択主要命令群に含まれる 1以上のプログラム命令群のうち最後に位置 するプログラム命令群の直後に更新処理命令群を配置することも、選択対象主要命 令群の中に挿入するという。
選択主要命令群に含まれる 1以上のプログラム命令群のうち最後に位置するプログ ラム命令群の直後に更新処理命令群が挿入されることは、選択対象主要命令群の 直後に配置されることと同等である。
[0506] (14)上記実施の形態において、選択パラメータの更新を行う場合に、選択パラメ ータに、前回算出された選択識別子そのものを代入したが、これに限定されない。 算出された選択識別子に演算を施して、その演算結果を用いて選択パラメータの 更新を行ってもよい。例えば、 A= (算出された選択識別子の値) + 1とし、 Aの値を 選択パラメータに代入してもよい。他の例として、 A= (算出された選択識別子の値) X 3とし、 Aの値を選択パラメータに代入してもよい。
[0507] または、 2つ前に選択された選択対象データ等、過去の何れかの時点で処理され た選択対象データを示す選択識別子の値を代入してもよい。すなわち、過去に選択 された選択対象データを示す選択識別子が反映されるのであればどのような代入の 仕方でもよい。ここで、過去の何れかの時点で処理された選択対象データを示す選 択識別子とは、現在選択されて!、る選択対象データを示す選択識別子をも含む。
[0508] 例えば、前回算出された選択対象データを示す選択識別子と、 2回以上過去に算 出された選択対象データを示す選択識別子を用いて、選択パラメータを更新してもよ い。具体的には、 A= (前回算出された選択識別子) + (2回前に算出された選択識 別子)とし、 Aの値を選択パラメータに代入してもよい。
(15)本発明における命令群とは、 1以上の命令力もなるものとする。つまり、本発明 における命令群は、 1の命令力 なる場合も含まれる。
[0509] (16)上記第 1の実施の形態において、複数の選択パラメータ全てを用いて、選択 識別子を算出したが、これに限定されない。
複数の選択パラメータのうち 1以上の選択パラメータを用いて選択識別子を算出し てもよい。例えば、 3つの選択パラメータ A、 B、 Cのうち、ある選択識別子を算出する 際には、選択パラメータ A、 Bを用い、他の選択識別子を算出する際には、選択パラ メータ A、 Cを用いてもよい。
[0510] なお、第 2の実施の形態、第 3の実施の形態、第 4の実施の形態、及び第 5に実施 の形態においても同様に、複数の選択パラメータのうち 1以上の選択パラメータを用
V、て選択識別子を算出してもよ!/、。
(17)上記第 2の実施の形態において、各選択対象データには 1のデータが格納さ れていたが、これに限定されない。
[0511] 各選択対象データに格納されるデータの個数は、 1以上であればよい。
(18)上記第 2の実施の形態において、選択パラメータの更新の際に、選択識別子 の値を更新対象の選択パラメータに代入したが、これに限定されな 、。
選択識別子の値に演算を施して、その演算結果を更新対象の選択パラメータに代 入してもよい。例えば、選択識別子の値に、定数を加算し、加算結果を更新対象の 選択パラメータに代入する。
[0512] なお、第 3の実施の形態、第 4の実施の形態、及び第 5に実施の形態においても同 様に、選択識別子の値に演算を施して、その演算結果を更新対象の選択パラメータ に代入してもよい。
また、第 2の実施の形態において、プログラム難読ィ匕装置は、秘密保持プログラム を生成する際に、秘密情報を秘密情報用変数へ変換したがこれに限定されな ヽ。
[0513] 秘密情報用変数を含む演算式に変換してもよ!ヽ。例えば、秘密情報を、秘密情報 用変数と定数との和の演算式に変換してもよい。
(19)上記の各装置を構成する構成要素の一部または全部は、 1個のシステム LSI (Large Scale Integration:大規模集積回路)から構成されているとしてもよい。 システム LSIは、複数の構成部を 1個のチップ上に集積して製造された超多機能 LSI であり、具体的には、マイクロプロセッサ、 ROM、 RAMなどを含んで構成されるコン ピュータシステムである。前記 RAMには、コンピュータプログラムが記憶されている。 前記マイクロプロセッサ力 前記コンピュータプログラムにしたがって動作することによ り、システム LSIは、その機能を達成する。なお、ここでは、システム LSIとした力 集 積度の違いにより、 IC、 LSI,スーパー LSI、ウルトラ LSIと呼称されることもある。また 、集積回路化の手法は LSIに限るものではなぐ専用回路又は汎用プロセサで実現 してもよい。 LSI製造後に、プログラムすることが可能な FPGA(Field Programmab le Gate Array)や、 LSI内部の回路セルの接続や設定を再構成可能なリコンフィ ギュラブノレ ·プロセッサーを利用しても良 、。
[0514] さらには、半導体技術の進歩又は派生する別技術により LSIに置き換わる集積回 路化の技術が登場すれば、当然、その技術を用いて構成要素の集積ィ匕を行ってもよ い。バイオ技術の適応等が可能性としてありえる。
(20)上記の各装置を構成する構成要素の一部または全部は、各装置に脱着可能 な ICカードまたは単体のモジュール力も構成されて 、るとしてもよ 、。前記 ICカード または前記モジュールは、マイクロプロセッサ、 ROM, RAMなどから構成されるコン ピュータシステムである。前記 ICカードまたは前記モジュールは、上記の超多機能 L SIを含むとしてもよい。マイクロプロセッサが、コンピュータプログラムにしたがって動 作することにより、前記 ICカードまたは前記モジュールは、その機能を達成する。この ICカードまたはこのモジュールは、耐タンパ性を有するとしてもよ!/、。
[0515] (21)本発明は、上記に示す方法であるとしてもよい。また、これらの方法をコンビュ ータにより実現するコンピュータプログラムであるとしてもよいし、前記コンピュータプ ログラム力 なるディジタル信号であるとしてもよい。
(22)また、本発明は、前記コンピュータプログラムまたは前記ディジタル信号をコン
ピュータ読み取り可能な記録媒体、例えば、フレキシブルディスク、ハードディスク、 C D—ROMゝ MO、 DVDゝ DVD— ROMゝ DVD— RAMゝ BD (Blu—ray Disc)、半 導体メモリなどに記録したものとしてもよい。また、これらの記録媒体に記録されてい る前記ディジタル信号であるとしてもょ ヽ。
[0516] (23)また、本発明は、前記コンピュータプログラムまたは前記ディジタル信号を、電 気通信回線、無線または有線通信回線、インターネットを代表とするネットワーク、デ ータ放送等を経由して伝送するものとしてもよい。
(24)また、本発明は、マイクロプロセッサとメモリを備えたコンピュータシステムであ つて、前記メモリは、上記コンピュータプログラムを記憶しており、前記マイクロプロセ ッサは、前記コンピュータプログラムにしたがって動作するとしてもよい。
[0517] (25)また、前記プログラムまたは前記ディジタル信号を前記記録媒体に記録して 移送することにより、または前記プログラムまたは前記ディジタル信号を前記ネットヮ 一ク等を経由して移送すること〖こより、独立した他のコンピュータシステムにより実施 するとしてちょい。
(26)これらの実施の形態及び変形例の組合せであってもよ!/、。
産業上の利用可能性
[0518] 本発明にかかる秘密処理装置、秘密保持プログラムは、暗号鍵などの秘密情報を 扱う処理を行う場合に不正解析者による攻撃を困難にすることができるため、不正解 析者に漏洩すると不利益を招くような秘密情報を用いた処理を行う装置等の分野で 有用である。
また、本発明にかかるプログラム難読ィ匕装置は、暗号鍵などの秘密情報を扱うプロ グラムを、より解析が困難な形に変換することができるので、不正解析者に漏洩する と不利益を招くような秘密情報を用いた処理を行うソフトウェア等の分野において有 用である。
[0519] また、上記にて示したプログラム難読ィ匕装置は、電器機器製造産業において、経営 的に、また継続的及び反復的に、製造し、販売することができる。