JP2021043674A - Control device and method - Google Patents
Control device and method Download PDFInfo
- Publication number
- JP2021043674A JP2021043674A JP2019164794A JP2019164794A JP2021043674A JP 2021043674 A JP2021043674 A JP 2021043674A JP 2019164794 A JP2019164794 A JP 2019164794A JP 2019164794 A JP2019164794 A JP 2019164794A JP 2021043674 A JP2021043674 A JP 2021043674A
- Authority
- JP
- Japan
- Prior art keywords
- hash
- memory
- data
- value
- reference value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims description 41
- 230000015654 memory Effects 0.000 claims abstract description 190
- 230000006870 function Effects 0.000 claims abstract description 69
- 238000012795 verification Methods 0.000 claims abstract description 49
- 230000003252 repetitive effect Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004904 shortening Methods 0.000 description 2
Images
Landscapes
- Storage Device Security (AREA)
Abstract
Description
本発明は、制御装置及び方法に関する。 The present invention relates to a control device and a method.
マイクロコントローラ等の制御装置では、アプリケーションが真正か否かを検証してから起動するセキュアブートが行われることが一般的である。この検証は、起動しようとするアプリケーションのプログラムデータを安全な環境に格納された参照データと照合することによって行われる。参照データの格納に、安全で耐タンパー性を有する外部チップやTrustZone(登録商標)と呼ばれる特別な機能を有するハードウェアを用いることにより、参照データの改ざんに対するセキュリティを高めることができるが、高性能なハードウェアが必要であるため、コストがかかる。 In a control device such as a microcontroller, secure boot is generally performed to start after verifying whether the application is authentic or not. This verification is performed by matching the program data of the application to be started with the reference data stored in the secure environment. By using a safe and tamper-resistant external chip or hardware with a special function called TrustZone (registered trademark) to store the reference data, the security against tampering of the reference data can be enhanced, but the performance is high. It is costly because it requires a lot of hardware.
一方、ハッシュ関数にデジタル署名のような暗号化技術を組み合わせたソフトウェア処理によってプログラムデータを検証する方法も提案されている(例えば、特許文献1参照。)。このソフトウェア処理によれば、上記のような特別なハードウェア機能に依存することなく、アプリケーションの検証が可能である。 On the other hand, a method of verifying program data by software processing in which a hash function is combined with an encryption technique such as a digital signature has also been proposed (see, for example, Patent Document 1). According to this software processing, it is possible to verify the application without depending on the special hardware function as described above.
しかしながら、デジタル署名は計算集約型の暗号化技術であり、計算量が多い。計算に時間を要するため、ハードウェアが低性能であると検証プロセスの時間が非常に長くなる可能性がある。 However, digital signatures are computationally intensive encryption techniques and require a large amount of computation. Poor hardware performance can result in very long verification process times due to the time required for computation.
本発明は、ハードウェアの性能によらずプログラムデータの検証を高速に行うことを目的とする。 An object of the present invention is to perform high-speed verification of program data regardless of hardware performance.
本発明の一態様によれば、プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証する検証処理部(11)と、データの書き換えが不可能な第1メモリ(23)と、データの書き換えが可能な第2メモリ(24)と、を備え、前記第1メモリ(23)には、前記参照値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンと、が保存され、前記第2メモリ(24)には、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかが保存され、前記検証処理部(11)は、前記ハッシュ関数を用いて前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算し、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記計算されたn番目のハッシュチェーンと前記第1メモリ(23)に保存された前記n番目のハッシュチェーンとが同じである場合、前記プログラムデータが真正であると判断する、制御装置(10)が提供される。 According to one aspect of the present invention, the authenticity of the program data is verified by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value. The first memory (23) includes a verification processing unit (11), a first memory (23) in which data cannot be rewritten, and a second memory (24) in which data can be rewritten. , The reference value and the nth hash chain of the 1st to nth hash chains calculated from the data of a predetermined length by repeatedly using the hash function are stored in the second memory (24). Is stored in any of the 1st to n-1st hash chains among the 1st to nth hash chains, and the verification processing unit (11) uses the hash function to store the second memory (24). The nth hash chain is calculated from any of the 1st to n-1th hash chains stored in), and the hash value calculated from the program data is the same as the reference value and is calculated. When the nth hash chain and the nth hash chain stored in the first memory (23) are the same, a control device (10) for determining that the program data is genuine is provided. Hash function.
本発明の他の一態様によれば、プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証する検証処理部(11)と、データの書き換えが不可能な第1メモリ(23)と、データの書き換えが可能な第2メモリ(24)と、を備え、前記第1メモリ(23)には、前記参照値のハッシュ値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとが保存され、前記第2メモリ(24)には、前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとが保存され、前記検証処理部(11)は、前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された参照値からハッシュ値を計算するとともに前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算し、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記参照値から計算されたハッシュ値が前記保存された参照値のハッシュ値と同じであって、前記計算されたn番目のハッシュチェーンが前記保存されたn番目のハッシュチェーンと同じである場合、前記プログラムデータが真正であると判断する、制御装置(10)が提供される。 According to another aspect of the present invention, the authenticity of the program data is determined by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value. The first memory (23) includes a verification processing unit (11) for verifying the above, a first memory (23) in which data cannot be rewritten, and a second memory (24) in which data can be rewritten. The hash value of the reference value and the nth hash chain of the 1st to nth hash chains calculated from the data of a predetermined length by repeatedly using the hash function are stored in the second memory. In (24), the reference value and any one of the 1st to n-1st hash chains of the 1st to nth hash chains are stored, and the verification processing unit (11) has the hash function. Is used to calculate the hash value from the reference value stored in the second memory (24), and n from any of the first to n-1th hash chains stored in the second memory (24). The second hash chain is calculated, the hash value calculated from the program data is the same as the reference value, and the hash value calculated from the reference value is the same as the hash value of the stored reference value. Therefore, when the calculated n-th hash chain is the same as the stored n-th hash chain, the control device (10) for determining that the program data is genuine is provided.
本発明の他の一態様によれば、データの書き換えが不可能な第1メモリ(23)とデータの書き換えが可能な第2メモリ(24)とを備え、プログラムデータの真正性を検証する制御装置(10)を初期化する方法であって、ハッシュ関数を繰り返し用いて所定長のデータから1〜n番目のハッシュチェーンを計算するステップと、前記検証に用いる参照値として、前記ハッシュ関数を用いて前記プログラムデータからハッシュ値を計算するステップと、前記計算された参照値と、前記1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとを、前記第1メモリ(23)に保存するステップと、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかを、前記第2メモリ(24)に保存するステップと、を含む方法が提供される。 According to another aspect of the present invention, a control for verifying the authenticity of program data is provided with a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten. A method of initializing the device (10), in which a hash function is repeatedly used to calculate the 1st to nth hash chains from data of a predetermined length, and the hash function is used as a reference value used for the verification. The step of calculating the hash value from the program data, the calculated reference value, and the nth hash chain of the 1st to nth hash chains are stored in the first memory (23). A method is provided including a step and a step of storing any one of the 1st to n-1st hash chains in the 1st to nth hash chains in the second memory (24).
本発明の他の一態様によれば、データの書き換えが不可能な第1メモリ(23)と、データの書き換えが可能な第2メモリ(24)と、を備える制御装置(10)において、プログラムデータの真正性を検証する方法であって、前記プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証するステップを含み、前記第1メモリ(23)には、前記参照値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンと、が保存され、前記第2メモリ(24)には、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかが保存され、前記検証するステップは、前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算するステップと、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記計算されたn番目のハッシュチェーンと前記保存されたn番目のハッシュチェーンとが同じである場合、前記プログラムデータが真正であると判断するステップと、を含む方法が提供される。 According to another aspect of the present invention, a program is provided in a control device (10) including a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten. It is a method of verifying the authenticity of data. By calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value, the program data Including the step of verifying the authenticity, the first memory (23) includes the nth hash chain of the 1st to nth hash chains calculated from the data of a predetermined length by repeatedly using the reference value and the hash function. The second hash chain and the second hash chain are stored, and any one of the 1st to n-1st hash chains among the 1st to nth hash chains is stored in the second memory (24), and the verification is performed. The step is a step of calculating the nth hash chain from any of the 1st to n-1st hash chains stored in the second memory (24) using the hash function, and from the program data. If the calculated hash value is the same as the reference value, and the calculated nth hash chain and the stored nth hash chain are the same, it is determined that the program data is authentic. Steps to do, and methods including.
本発明の一態様によれば、データの書き換えが不可能な第1メモリ(23)とデータの書き換えが可能な第2メモリ(24)とを備え、プログラムデータの真正性を検証する制御装置(10)を初期化する方法であって、ハッシュ関数を繰り返し用いて所定長のデータから1〜n番目のハッシュチェーンを計算するステップと、前記検証に用いる参照値として、前記ハッシュ関数を用いて前記プログラムデータからハッシュ値を計算するステップと、前記ハッシュ関数を用いて前記参照値からハッシュ値を計算するステップと、前記参照値から計算されたハッシュ値と、前記1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとを、前記第1メモリ(23)に保存するステップと、前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとを、前記第2メモリ(24)に保存するステップと、を含む方法が提案される。 According to one aspect of the present invention, a control device provided with a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten, and which verifies the authenticity of program data ( 10) is a method of initializing, wherein the hash function is repeatedly used to calculate the 1st to nth hash chains from data of a predetermined length, and the hash function is used as a reference value used for the verification. Of the steps of calculating the hash value from the program data, the step of calculating the hash value from the reference value using the hash function, the hash value calculated from the reference value, and the 1st to nth hash chains. The nth hash chain of the above is stored in the first memory (23), the reference value, and any of the 1st to n-1th hash chains of the 1st to nth hash chains. A method including a step of storing the hash in the second memory (24) is proposed.
本発明の他の一態様によれば、データの書き換えが不可能な第1メモリ(23)と、データの書き換えが可能な第2メモリ(24)と、を備える制御装置(10)においてプログラムデータの真正性を検証する方法であって、前記プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証するステップを含み、前記第1メモリ(23)には、前記参照値から計算されたハッシュ値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとが保存され、前記第2メモリ(24)には、前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとが保存され、前記検証するステップは、前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された参照値からハッシュ値を計算するステップと、前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算するステップと、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記参照値から計算されたハッシュ値が前記保存された参照値のハッシュ値と同じであって、前記計算されたn番目のハッシュチェーンが前記保存された前記n番目のハッシュチェーンと同じである場合、前記プログラムデータが真正であると判断するステップと、を含む方法が提供される。 According to another aspect of the present invention, the program data in the control device (10) including the first memory (23) in which the data cannot be rewritten and the second memory (24) in which the data can be rewritten. This is a method for verifying the authenticity of the program data. By calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value, the authenticity of the program data is determined. Including the step of verifying the property, the first memory (23) contains the hash value calculated from the reference value and the 1st to nth hashes calculated from the data of a predetermined length by repeatedly using the hash function. The nth hash chain of the chain is stored, and the reference value and the 1st to n-1th hash chains of the 1st to nth hash chains are stored in the second memory (24). One of the steps is saved, and the verification step is a step of calculating a hash value from a reference value saved in the second memory (24) using the hash function, and a step of saving in the second memory (24). The step of calculating the nth hash chain from any of the 1st to n-1th hash chains and the hash value calculated from the program data are the same as the reference value, and from the reference value. When the calculated hash value is the same as the hash value of the stored reference value and the calculated nth hash chain is the same as the stored nth hash chain, the program data. A method is provided that includes, and a step in determining that is authentic.
本発明によれば、ハードウェアの性能によらずプログラムデータの検証を高速に行うことができる。 According to the present invention, the verification of program data can be performed at high speed regardless of the performance of the hardware.
以下、本発明の制御装置及び方法の第1〜第3実施形態について、図面を参照して説明する。以下に説明する構成は、本発明の一実施態様としての一例(代表例)であり、本発明は以下に説明する構成に限定されない。 Hereinafter, the first to third embodiments of the control device and method of the present invention will be described with reference to the drawings. The configuration described below is an example (representative example) as an embodiment of the present invention, and the present invention is not limited to the configuration described below.
本発明の制御装置の第1〜第3実施形態として、車両のECU(Electronic Control Unit)に設けられ、車両の走行を制御するマイクロコントローラの例を説明するが、プログラムデータの検証を行う制御装置であれば、一般的なPC(Personal Computer)、家電製品等に搭載される制御装置にも本発明を適用できる。
第1〜第3実施形態において、マイクロコントローラの処理内容は異なるが基本的な構成は同じであるので、共通する構成について説明した後、各実施形態における処理内容について説明する。
As the first to third embodiments of the control device of the present invention, an example of a microcontroller provided in an ECU (Electronic Control Unit) of a vehicle and controlling the running of the vehicle will be described, but a control device for verifying program data will be described. If so, the present invention can be applied to a control device mounted on a general PC (Personal Computer), a home electric appliance, or the like.
In the first to third embodiments, the processing contents of the microprocessor are different, but the basic configuration is the same. Therefore, after explaining the common configuration, the processing contents in each embodiment will be described.
(マイクロコントローラの構成)
図1は、第1〜第3実施形態に共通のマイクロコントローラ10の構成を示す。
図1に示すように、マイクロコントローラ10は、CPU(Central Processing Unit)11、RAM(Random Access Memory)12、I/Oインターフェイス13、乱数生成器14、タイマー15及びフラッシュメモリ16を備える。
(Microcontroller configuration)
FIG. 1 shows the configuration of the
As shown in FIG. 1, the
CPU11は、フラッシュメモリ16が記憶するOS(Operating System)用のプログラム又は各種アプリケーションのプログラムを読み出して実行する。CPU11は、アプリケーションを起動する際、セキュアブートを実行してプログラムデータの真正性を検証する検証処理部として機能する。
The
RAM12は、CPU11がプログラムの実行に使用するデータ等を一時的に記憶する。
The
I/Oインターフェイス13は、車両に搭載される各種センサと通信する。また、マイクロコントローラ10に外部コンピュータ50が接続された場合、I/Oインターフェイス13は、外部コンピュータ50と通信する。
The I /
乱数生成器14は、任意の数値である乱数を生成する。例えば、乱数生成器14は、I/Oインターフェイス13を介して各種センサから入力されるノイズに基づいて乱数を生成する。
The
タイマー15は、CPU11によってセットされた特定値に到るまでカウントを続ける。タイマー15は、カウント値が特定値に到るとカウント値を0にリセットしてカウントを再開する。
The
フラッシュメモリ16は、各種CPU11により実行されるプログラム、当該プログラムの実行に使用されるデータ、例えばプログラムデータの真正性の検証に用いるデータ等を記憶する不揮発性メモリである。
The
フラッシュメモリ16は、コードフラッシュ161とデータフラッシュ162のセクタに分けられる。コードフラッシュ161はプログラムデータの格納に使用でき、データフラッシュ162はアプリケーションの実行に使用されるデータの格納に使用できる。
The
フラッシュメモリ16は、コードフラッシュ161のサブセクタとしてOTP(One Time Programmable)メモリ21及びnon−OTPメモリ22を有し、データフラッシュ162のサブセクタとしてOTPメモリ23及びnon−OTPメモリ24を有する。
The
OTPメモリ21及び23は、書き込まれたデータの書き換えが不可能なメモリであり、第1メモリとして機能する。non−OTPメモリ22及び24は、書き込まれたデータの書き換えが可能なメモリであり、第2メモリとして機能する。なお、OTPメモリ21及び23は1つのOTPメモリとして設けられてもよく、non−OTPメモリ22及び24も1つのnon−OTPメモリとして設けられてもよい。
The
(外部コンピュータの構成)
マイクロコントローラ10は、マイクロコントローラ10の初期化、アプリケーションのバージョンアップ等のため、外部コンピュータ50に接続されることがある。
(External computer configuration)
The
外部コンピュータ50は、例えばPC(Personal Computer)、マイクロコントローラ10とは別に設けられるECU等である。外部コンピュータ50は、CPU51、RAM52、I/Oインターフェイス53及びフラッシュメモリ等のメモリ54を備え、必要に応じて操作部55、表示部56等を備える。
The
CPU51は、メモリ54が記憶するOS(Operating System)用のプログラム又は各種アプリケーションのプログラムを読み出して実行する。例えば、CPU51は、マイクロコントローラ10の工場出荷時、プログラム更新時等に初期化処理を実行する。初期化処理時、CPU51は、プログラムデータの検証に必要なデータをマイクロコントローラ10のフラッシュメモリ16に書き込む。
The
RAM52は、CPU51がプログラムの実行に使用するデータ等を一時的に記憶する。
The
I/Oインターフェイス53は、マイクロコントローラ10に接続された場合、マイクロコントローラ10と通信する。
The I /
メモリ54は、各種プログラムデータ、プログラムの実行に必要なデータ等を記憶する記憶媒体である。メモリ54としては、フラッシュメモリ、ハードディスク等を使用できる。
The
操作部55は、操作に応じた操作信号をCPU51に出力する。操作部55としては、例えばキーボード、マウス、タッチパネル等が挙げられる。
表示部56は、CPU51の指示に従って操作画面等を表示するディスプレイである。
The
The
<第1実施形態>
(初期化処理)
マイクロコントローラ10は、外部コンピュータ50に接続されて初期化処理されることで、プログラムデータの検証に必要なデータがフラッシュメモリ16に書き込まれる。
<First Embodiment>
(Initialization process)
The
図2は、外部コンピュータ50が検証に必要なデータの1つである、1〜n番目のハッシュチェーンを生成する処理手順を示す。この処理は、例えば工場での出荷時におけるマイクロコントローラ10の初期化処理中にオフラインで実行される。
FIG. 2 shows a processing procedure in which the
図2に示すように、外部コンピュータ50は、所定長のデータを1番目のハッシュチェーンx1として生成する(ステップS11)。このデータは任意に決定される数値、例えば乱数生成器で生成した乱数等であると、改ざんに対するセキュリティが高まるため好ましい。データの長さは、ハッシュチェーンx1に用いるハッシュ関数がSHA256である場合は256ビットであり、SHA−1を使用する場合は160ビットである。
As shown in FIG. 2, the
次に、外部コンピュータ50は、ハッシュチェーンx1にハッシュ関数をn−1回繰り返し用いて、2番目のハッシュチェーンx2からn番目のハッシュチェーンxnまでを順次生成する(ステップS12)。nは、アプリケーションを更新できる最大回数を表す2以上の数字である。以下、ハッシュ関数としてSHA256を使用する例を説明するが、SHA256以外のハッシュ関数も用いることができる。
Next, the
具体的には、外部コンピュータ50は、ハッシュチェーンの生成順を表す係数iをi=2に設定する。そして、外部コンピュータ50は、ハッシュチェーンx(i−1)にハッシュ関数を用いて、ハッシュチェーンxiを生成する。ハッシュチェーンxiの生成は、下記式により表される。
ハッシュチェーンxi=SHA256(ハッシュチェーンx(i−1))
SHA256()は、()内のデータ値からハッシュ値を生成するハッシュ関数SHA256を表す。
Specifically, the
Hash chain xi = SHA256 (hash chain x (i-1))
SHA256 () represents a hash function SHA256 that generates a hash value from the data value in ().
ハッシュチェーンxiを生成後、外部コンピュータ50はiをインクリメントして上記ハッシュチェーンxiの生成を繰り返す。この処理をiがnに到るまで繰り返すことで、ハッシュチェーンx2〜xnが生成される。
After generating the hash chain xi, the
図3は、ハッシュチェーンx1〜xnの概念図である。
図3に示すように、ハッシュ関数SHA256を用いて、ハッシュチェーンx1からハッシュチェーンx2が生成され、ハッシュチェーンx2からハッシュチェーンx3が生成される。このようにハッシュチェーンのハッシュ値を次のハッシュチェーンとする処理を繰り返すことにより、1番目のハッシュチェーンx1からn番目のハッシュチェーンxnまで順番に生成される。
FIG. 3 is a conceptual diagram of hash chains x1 to xn.
As shown in FIG. 3, the hash function SHA256 is used to generate the hash chain x2 from the hash chain x1 and the hash chain x3 from the hash chain x2. By repeating the process of using the hash value of the hash chain as the next hash chain in this way, the first hash chain x1 to the nth hash chain xn are sequentially generated.
外部コンピュータ50は、n個のハッシュチェーンx1〜xnのうち、最後に生成されたn番目のハッシュチェーンxnをデータフラッシュ162のOTPメモリ23に保存する(ステップS13)。また、外部コンピュータ50は、1番目のハッシュチェーンx1からn−1番目のハッシュチェーンx(n−1)までを、マイクロコントローラ10とは別のセキュアメモリに保存する(ステップS14)。
The
ハッシュチェーンx1〜xnの保存が終了すると、外部コンピュータ50によってマイクロコントローラ10は初期化される。具体的には、外部コンピュータ50は、アプリケーションのプログラムデータをコードフラッシュ161のnon−OTPメモリ22に保存する。また、外部コンピュータ50は、ハッシュ関数SHA256を用いてアプリケーションのプログラムデータの全部のハッシュ値を計算し、計算したハッシュ値を参照値としてデータフラッシュ162のOTPメモリ23に保存する。
When the storage of the hash chains x1 to xn is completed, the
アプリケーションを更新してバージョンアップする際も、マイクロコントローラ10は外部コントローラ50に接続されて初期化処理される。更新時の初期化処理において、外部コンピュータ50は、non−OTPメモリ22に保存されたアプリケーションのプログラムデータを更新後のプログラムデータに上書きする。また、外部コンピュータ50は、ハッシュチェーンx(n−k+1)をセキュアメモリから取得し、non−OTPメモリ24に書き込む。kは、アプリケーションのバージョンを表す1〜nの数字である。また、外部コンピュータ50はハッシュ関数SHA256を用いて更新後のプログラムデータのハッシュ値を計算し、計算したハッシュ値を参照値としてOTPメモリ23に保存する。OTPメモリ23ではデータの書き換えができないため、OTPメモリ23には以前のバージョンの参照値とともに最新バージョンの参照値が保存される。
When the application is updated and upgraded, the
図4A〜図4Cは、OTPメモリ23及びnon−OTPメモリ24のデータ例を示す。図4Aはバージョン1のときのデータ例を示し、図4Bはバージョン2のときのデータ例を示し、図4Cはバージョン3の時のデータ例を示す。
図4A〜図4Cに示すように、OTPメモリ23にはn個のスロット231〜23nが設けられている。各スロット231〜23nは、各バージョンの参照値に対応する。バージョンの数を表す係数k(k=1〜n)が各スロット231〜23nのアドレスとして割り当てられている。
4A to 4C show data examples of the
As shown in FIGS. 4A to 4C, the
工場出荷時、図4Aに示すように、スロット231はバージョン1のプログラムデータの参照値v1によって占められる。他のスロット232〜23nは空であり、未使用の状態である。OTPメモリ23の参照値v1を書き換えることはできないが、未使用の他のスロット232〜23nはデータを書き込むことが可能である。一方、non−OTPメモリ24には1つのスロット240が設けられているが、バージョン1の時点ではこのスロット240は空であり、未使用の状態である。
At the time of shipment from the factory,
アプリケーションが更新されると、図4Bに示すように、更新後のプログラムデータのハッシュ値が最新バージョン2の参照値v2としてOTPメモリ23のスロット232に書き込まれる。スロット232に参照値v2が書き込まれると、先のバージョン1の参照値v1は失効する。一方、non−OTPメモリ24のスロット240には、ハッシュチェーンx(n−1)が書き込まれる。
When the application is updated, as shown in FIG. 4B, the hash value of the updated program data is written to the
さらにアプリケーションが更新されると、図4Cに示すように、最新バージョン3の参照値v3がOTPメモリ23のスロット233に書き込まれる。これにより、先のバージョン1及び2の参照値v1及びv2は失効する。一方、non−OTPメモリ24のスロット240にはハッシュチェーンx(n−2)が上書きされる。
When the application is further updated, the reference value v3 of the latest version 3 is written to slot 233 of the
このようにして、アプリケーションの更新ごとに最新バージョンkの参照値vkがOTPメモリ23に書き込まれ、ハッシュチェーンx(n−k+1)がnon−OTPメモリ24に上書きされていく。参照値vk用にn個のスロット231〜23nが用意されており、アプリケーションをn回更新することができる。マイクロコントローラ10は、これらデータを使用してプログラムデータの真正性を検証することができる。
In this way, the reference value vk of the latest version k is written in the
(検証処理)
図5は、マイクロコントローラ10においてプログラムデータの真正性を検証する処理手順を示す。この処理は、例えばアプリケーションを起動するときのセキュアブートとしてCPU11によって実行される。
(Verification process)
FIG. 5 shows a processing procedure for verifying the authenticity of program data in the
図5に示すように、CPU11は、ハッシュ関数SHA256を用いてアプリケーションのプログラムデータの全部からハッシュ値を計算する(ステップS21)。次にCPU11は、OTPメモリ23から最新バージョンkの参照値vkを検索する(ステップS22)。参照値vkは、OTPメモリ23の各スロット231〜23nのうち、アドレスがkのスロットに保存されている。
As shown in FIG. 5, the
CPU11は、計算されたハッシュ値を検索された参照値vkと照合し、同じか否かを判断する(ステップS23)。ハッシュ値が参照値vkと同じでない場合(ステップS23:NO)、プログラムデータが改ざんされているため、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS24)、セキュアブートを終了する。
The
なおステップS24において、マイクロコントローラ10は、例えばRAMの特別なフラグを使用する等、プログラムが破損したことのトラックを残して、セキュアブートを継続することもできる。これは認証ブート(authenticated boot)と呼ばれる。
Note that in step S24, the
ハッシュ値が参照値vkと同じである場合(ステップS23:YES)、CPU11はk=1であるか否か、つまりアプリケーションが一度も更新されていないバージョン1であるか否かを判断する(ステップS25)。k=1である場合(ステップS25:YES)、つまりバージョン1の場合、セキュアブートは成功する。CPU11はアプリケーションを起動し(ステップS29)、セキュアブートを終了する。
When the hash value is the same as the reference value vk (step S23: YES), the
k=1ではない場合(ステップS25:NO)、つまりバージョンが2以上である場合、CPU11はハッシュチェーンx(n−k+1)をnon−OTPメモリ24から読み出す(ステップS26)。CPU11は、ハッシュ関数SHA256をk−1回繰り返し用いてハッシュチェーンx(n−k+1)からハッシュ値を計算する(ステップS27)。計算されるハッシュ値は、ハッシュチェーンxnとなるはずである。例えば、k=2の場合、non−OTPメモリ24にはハッシュチェーンx(n−1)が保存されている。このハッシュチェーンx(n−1)にハッシュ関数SHA256を1(1=2−1)回用いると、ハッシュチェーンxnが計算される。k=3の場合、non−OTPメモリ24にはハッシュチェーンx(n−2)が保存されている。ハッシュチェーンx(n−2)にハッシュ関数SHA256を2(2=3−1)回繰り返すことで、ハッシュチェーンx(n−2)からハッシュチェーンx(n−1)が計算され、このハッシュチェーンx(n−1)からさらにハッシュチェーンxnが計算される。
When k = 1 (step S25: NO), that is, when the version is 2 or more, the
このように、ハッシュチェーンxnより前のハッシュチェーンx1〜x(n−1)にハッシュ関数SHA256を繰り返し適用することで、ハッシュチェーンxnを再計算することができる。ハッシュ関数SHA256はプレイメージ耐性を有することから、ハッシュチェーンをその生成順に計算することが可能だが、生成順とは逆順、すなわち末尾側のハッシュチェーンから先頭側のハッシュチェーンを計算することはできない。例えば、ハッシュチェーンx(n−2)からハッシュチェーンx(n−1)及びxnを計算できるが、ハッシュチェーンx(n−3)は計算できない。 In this way, the hash chain xn can be recalculated by repeatedly applying the hash function SHA256 to the hash chains x1 to x (n-1) before the hash chain xn. Since the hash function SHA256 has pre-image resistance, it is possible to calculate the hash chain in the order in which it is generated, but it is not possible to calculate the hash chain on the head side from the hash chain on the tail side, that is, in the reverse order of the generation order. For example, the hash chain x (n-1) and xn can be calculated from the hash chain x (n-2), but the hash chain x (n-3) cannot be calculated.
CPU11は、計算したハッシュチェーンxnとOTPメモリ23に保存されたハッシュチェーンxnが同じか否かを判断する(ステップS28)。同じである場合(ステップS28:YES)、CPU11はプログラムデータが真正であると判断し、セキュアブートは成功する。CPU11はアプリケーションを起動し(ステップS29)、セキュアブートを終了する。一方、同じではない場合(ステップS28:NO)、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS24)、セキュアブートを終了する。
The
以上のように、第1実施形態のマイクロコントローラ10によれば、プログラムデータから計算したハッシュ値とOTPメモリ23に保存された参照値vkが同じであり、かつnon−OTPメモリ24に保存されたハッシュチェーンx(n−k+1)から計算されたハッシュチェーンxnとOTPメモリ23に保存されたハッシュチェーンxnとが同じであるかを判断することにより、プログラムデータの真正性を検証する。
As described above, according to the
OTPメモリ23の参照値vkとハッシュチェーンxnの改ざんは不可能である。悪意の第3者が参照値vkを偽造しようとする場合、ハッシュチェーンx(n−k+1)の偽造も必要だが、ハッシュ関数のプレイメージ耐性の特性上、ハッシュチェーンxnからハッシュチェーンxnより前のハッシュチェーンx(n−k+1)を偽造することはできない。したがって、参照値vkの高いセキュリティを維持することができる。
It is impossible to falsify the reference value vk of the
このように、第1実施形態のマイクロコントローラ10によれば、一般的なハードウェアであるOTPメモリ23とnon−OTPメモリ24を使用してセキュリティの高いプログラムデータの検証を行うことができる。検証に使用するハッシュチェーンx1〜xnは、データ量が256ビットと小さいデータ片に最大でもn−1回のハッシュ関数SHA256の計算を行うことにより得ることができる。計算量が少ないため、高性能でセキュアなハードウェアではなくても検証時間を短くすることができる。したがって、ハードウェアの性能によらずプログラムデータの検証を高速に行うことができる。
As described above, according to the
参照値vkの改ざんはデジタル署名を使用して検証することもできる。デジタル署名を用いる場合、non−OTPメモリにアプリケーションのプログラムデータ及びその参照値が保存され、書き換え可能な参照値には秘密鍵で作成されたデジタル署名が付与される。秘密鍵に対応する公開鍵はOTPメモリに保存される。セキュアブート時には、アプリケーションのプログラムデータから計算されたハッシュ値と参照値とが同じであり、かつ公開鍵を使用して参照値のデジタル署名が正しいことが検証された場合に、アプリケーションの起動が行われる。 Tampering with the reference value vk can also be verified using a digital signature. When a digital signature is used, the program data of the application and its reference value are stored in the non-OTP memory, and the rewritable reference value is given a digital signature created by the private key. The public key corresponding to the private key is stored in the OTP memory. During secure boot, the application is launched when the hash value calculated from the program data of the application and the reference value are the same, and the public key is used to verify that the digital signature of the reference value is correct. Will be.
しかし、デジタル署名の検証は計算量が多く、低性能のマイクロコントローラでは数秒かかることがある。クロック速度が100MHz以上の高性能のマイクロコントローラであっても数百ミリ秒かかることがあり、車両のエンジン起動等の非常に短い時間で稼働する必要があるシステムには不向きである。第1実施形態のマイクロコントローラ10は、デジタル署名の代わりにハッシュチェーンxnを使用することで検証の高速化が可能である。ハッシュ関数SHA256の計算速度はデジタル署名の検証よりも数桁速い。したがって、マイクロコントローラ10が低性能であっても参照値vkの検証を高速に行うことができ、車両のエンジン起動等の高速なシステムの稼働が可能である。
However, digital signature verification is computationally intensive and can take seconds on low performance microcontrollers. Even a high-performance microcontroller with a clock speed of 100 MHz or more may take several hundred milliseconds, which is not suitable for a system that needs to operate in a very short time such as starting a vehicle engine. The
<第2実施形態>
第1実施形態ではプログラムデータの全部のハッシュ値を計算したが、第2実施形態では、ハッシュ値の計算をプログラムデータの一部とすることにより、第1実施形態よりもハッシュ値の計算を高速化する。
<Second Embodiment>
In the first embodiment, all the hash values of the program data are calculated, but in the second embodiment, the hash value calculation is made a part of the program data, so that the hash value calculation is faster than in the first embodiment. To become.
(初期化処理)
第2実施形態における初期化処理では、第1実施形態と同様に、外部コンピュータ50がハッシュチェーンx1〜xnを生成して末尾のハッシュチェーンxnをマイクロコンピュータ10に保存した後、参照値を生成する。第2実施形態の参照値は、プログラムデータが分割されたm個の各データ部分のハッシュ値である。
(Initialization process)
In the initialization process in the second embodiment, as in the first embodiment, the
具体的には、外部コンピュータ50は、アプリケーションのプログラムデータをm個のデータ部分に分割し、ハッシュ関数SHA256を用いて各データ部分のハッシュ値を計算する。外部コンピュータ50は、計算した各データ部分のハッシュ値を各データ部分の参照値y1〜ymとしてnon−OTPメモリ24に保存する。
Specifically, the
また、外部コンピュータ50は、各参照値y1〜ymからハッシュ値を計算する。例えば、外部コンピュータ50は、各参照値y1〜ymを順番に並べて連結したデータ列を生成し、ハッシュ関数SHA256を用いて当該データ列のハッシュ値を計算する。外部コンピュータ50は、計算されたハッシュ値をバージョンkの参照値wkとしてOTPメモリ23のスロット231に保存する。参照値wkは、non−OTPメモリ24に保存された各参照値y1〜ymの検証に使用される。
Further, the
上記参照値wkは、下記式により表される。
参照値wk=SHA256(参照値y1||参照値y2||…||参照値ym)
式中の||は、連結を表す。SHA256()は、()内のデータ値からハッシュ値を生成するハッシュ関数SHA256を表す。
The reference value wk is expressed by the following formula.
Reference value wk = SHA256 (reference value y1 || reference value y2 ||… || reference value ym)
|| in the formula represents a concatenation. SHA256 () represents a hash function SHA256 that generates a hash value from the data value in ().
アプリケーションのバージョンアップ時、外部コンピュータ50は、non−OTPメモリ22に保存されたアプリケーションのプログラムデータを更新後のプログラムデータに上書きする。また、外部コンピュータ50は、ハッシュチェーンx(n−k+1)をセキュアメモリから取得し、non−OTPメモリ24に書き込む。外部コンピュータ50は、更新後のプログラムデータから参照値y1〜ymを生成し、non−OTPメモリ24に保存する。また、外部コンピュータ50は、生成された参照値y1〜ymを並べて連結したデータ列のハッシュ値を計算し、参照値wkとしてOTPメモリ23に保存する。データの書き換えが不可能なOTPメモリ23には、各バージョンの参照値wkが追加で書き込まれる。
When the application version is upgraded, the
図6A〜図6Cは、第2実施形態におけるOTPメモリ23及びnon−OTPメモリ24のデータ例を示す。図6Aはバージョン1のデータ例を示し、図6Bはバージョン2のデータ例を示し、図6Cはバージョン3のデータ例を示す。
図6A〜図6Cに示すように、第2実施形態のnon−OTPメモリ24には、スロット240に加えてm個のスロット241〜24mが設けられている。1つのスロットは、1つの参照値に対応する。また、第1実施形態と同様に、non−OTPメモリ24にはスロット240が設けられ、OTPメモリ23にはスロット231〜23nが設けられている。
6A to 6C show data examples of the
As shown in FIGS. 6A to 6C, the
工場出荷時、図6Aに示すように、non−OTPメモリ24の各スロット241〜24mには、バージョン1の参照値y1〜ymが保存され、OTPメモリ23のスロット231にはバージョン1の参照値w1が保存されている。non−OTPメモリ24のスロット240は未使用の状態である。また、OTPメモリ23のスロット232〜23nも未使用の状態である。
At the time of shipment from the factory, as shown in FIG. 6A, the reference values y1 to ym of the
アプリケーションのプログラムデータが更新されると、外部コンピュータ50は、図6Bに示すように、更新後のプログラムデータから最新バージョン2の参照値y1〜ymを生成し、non−OTPメモリ24の各スロット241〜24mに上書き保存する。また、外部コンピュータ50は、最新バージョン2の参照値y1〜ymのデータ列のハッシュ値を計算し、バージョン2の参照値w2としてOTPメモリ23のスロット232に保存する。これによりバージョン1の参照値w1が失効する。外部コンピュータ50は、セキュアメモリに保存されたハッシュチェーンx(n−1)を取得してnon−OTPメモリ24のスロット240に保存する。
When the program data of the application is updated, the
さらにアプリケーションが更新されると、外部コンピュータ50は、更新後のプログラムデータから最新バージョン3の参照値y1〜ymを生成し、non−OTPメモリ24の各スロット241〜24mに上書き保存する。また、外部コンピュータ50は、最新バージョン2の参照値y1〜ymからそのデータ列のハッシュ値を計算し、バージョン3の参照値w3としてOTPメモリ23のスロット233に保存する。これによりバージョン1及び2の参照値w1及びw2が失効する。外部コンピュータ50は、セキュアメモリからハッシュチェーンx(n−2)を取得してnon−OTPメモリ24のスロット240に上書き保存する。
When the application is further updated, the
このようにして、アプリケーションが更新されるごとに、最新バージョンkの参照値y1〜ym及びハッシュチェーンx(n−k+1)がnon−OTPメモリ24に上書き保存されるとともに、最新バージョンkの参照値wkがOTPメモリ23に保存される。
In this way, every time the application is updated, the reference value y1 to ym of the latest version k and the hash chain x (n−k + 1) are overwritten and saved in the
(検証処理)
図7は、第2実施形態に係るマイクロコトンローラ10がプログラムデータの真正性を検証する処理手順を示す。この処理は、例えばアプリケーションを起動するときのセキュアブートとしてCPU11によって実行される。
(Verification process)
FIG. 7 shows a processing procedure in which the
図7に示すように、CPU11は乱数生成器14により生成された乱数r(rは1〜mの整数)を取得する(ステップS41)。CPU11は、アプリケーションのプログラムデータをm個のデータ部分に分割し、m個のデータ部分のうちr番目のデータ部分rからハッシュ関数SHA256を用いてハッシュ値を計算する(ステップS42)。
As shown in FIG. 7, the
CPU11は、OTPメモリ23から最新バージョンkの参照値wkを読み出す(ステップS43)。また、CPU11は、non−OTPメモリ24に保存された各参照値y1〜ymを並べて連結したデータ列を生成し、ハッシュ関数SHA256を用いてそのハッシュ値を計算する。CPU11は、計算されたハッシュ値がOTPメモリ23に保存された参照値wkと同じか否かを判断する(ステップS44)。
The
計算されたハッシュ値と参照値wkが同じではない場合(ステップS44:NO)、セキュアブートが失敗し(ステップS45)、CPU11はアプリケーションを起動せずにセキュアブートを終了する。ステップS45においては、上述したステップS24と同様に認証ブートが実行されてもよい。一方、計算したハッシュ値が参照値wkと同じである場合(ステップS44:YES)、CPU11は計算されたデータ部分rのハッシュ値とnon−OTPメモリ24に保存されたデータ部分rの参照値yrが同じか否かを判断する(ステップS46)。
If the calculated hash value and the reference value wk are not the same (step S44: NO), the secure boot fails (step S45), and the
計算されたハッシュ値と保存された参照値yrが同じではない場合(ステップS46:NO)、プログラムデータの一部が改ざんされているため、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS45)、セキュアブートを終了する。一方、計算されたハッシュ値と保存された参照値yrが同じである場合(ステップS46:YES)、CPU11はk=1か否かを判断する(ステップS47)。
If the calculated hash value and the stored reference value yr are not the same (step S46: NO), secure boot fails because part of the program data has been tampered with. The
k=1の場合(ステップS47:YES)、つまりバージョン1の場合、セキュアブートは成功する。CPU11はアプリケーションを起動し(ステップS51)、セキュアブートを終了する。k=1ではない場合(ステップS47:NO)、つまりバージョンが2以上である場合、CPU11はnon−OTPメモリ24からハッシュチェーンx(n−k+1)を読み出す(ステップS48)。CPU11は、ハッシュ関数SHA256をk−1回繰り返し用いて、ハッシュチェーンx(n−k+1)からハッシュ値、すなわちハッシュチェーンxnを計算する(ステップS49)。
When k = 1 (step S47: YES), that is, in the case of
CPU11は、計算されたハッシュチェーンxnとOTPメモリ23に保存されたハッシュチェーンxnが同一か否かを判断する(ステップS50)。各ハッシュチェーンxnが同一であれば(ステップS50:YES)、CPU11はプログラムデータが真正であると判断し、セキュアブートは成功する。CPU11はアプリケーションを起動し(ステップS51)、セキュアブートを終了する。一方、同一ではない場合(ステップS50:NO)、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS45)、セキュアブートを終了する。なお、上記ステップS47〜S50の処理内容は第1実施形態におけるステップS25〜S28の処理内容と同じである。
The
以上のように、第2実施形態によれば、プログラムデータの1/mのデータ部分rのハッシュ値を計算すればよく、プログラムデータの全部のハッシュ値を計算する必要がない。したがって、第1実施形態と同様にハッシュチェーンx1〜xnを用いることで検証を高速化するだけでなく、プログラムデータのハッシュ値の計算もm倍高速化することができる。例えば、プログラムデータ全体のハッシュ値の計算に100msの時間を要する場合、m=10に設定してプログラムデータを10分割すれば、10msの時間でハッシュ値の計算が終了するため、10倍の高速化が可能である。プログラムデータのデータ量が大きい場合であっても、システムの高速な稼働が可能である。 As described above, according to the second embodiment, the hash value of the data portion r of 1 / m of the program data may be calculated, and it is not necessary to calculate the entire hash value of the program data. Therefore, by using the hash chains x1 to xn as in the first embodiment, not only the verification can be speeded up, but also the calculation of the hash value of the program data can be speeded up by m times. For example, if it takes 100 ms to calculate the hash value of the entire program data, if m = 10 is set and the program data is divided into 10, the hash value calculation will be completed in 10 ms, which is 10 times faster. Can be converted. Even when the amount of program data is large, the system can be operated at high speed.
改ざんされたプログラムデータには、元のプログラムデータと異なる部分が少なくとも一部分ある。ハッシュ値の計算により検証するデータ部分rは1〜mの任意の数字であるため、セキュアブートを十分な回数行うことにより、改ざんされたデータ部分が発見され得る。 The falsified program data has at least a part different from the original program data. Since the data portion r to be verified by calculating the hash value is an arbitrary number from 1 to m, the falsified data portion can be found by performing secure boot a sufficient number of times.
第2実施形態において、各データ部分の参照値y1〜ymはOTPメモリ23ではなく、non−OTPメモリ24に保存されるため、プログラムデータの更新ごとに上書き保存することができ、保存に必要なメモリ容量を減らすことができる。non−OTPメモリ24に保存された各データ部分の参照値y1〜ymが真正か否かは、OTPメモリ23に保存される参照値wkによって確認できる。悪意の第3者がセキュアブートを成功させるため、参照値yrを偽造しようとする場合、参照値y1〜ymからなるデータ列のハッシュ値が、OTPメモリ23に保存された書き換え不可能な参照値wkと同じとなるように偽造する必要がある。しかし、ハッシュ関数SHA256の定義上、データ列のハッシュ値が参照値wkと同じとなるように参照値yrを計算することは不可能である。各バージョンkの参照値wkがOTPメモリ23に保存されるが、参照値wkはハッシュ値でありデータ量が少ないため、保存に必要なOTPメモリ23のメモリ容量も減らすことができる。
In the second embodiment, since the reference values y1 to ym of each data portion are saved in the
このように、第2実施形態のマイクロコントローラ10によれば、第1実施形態と同様に、一般的なハードウェアであるOTPメモリ23とnon−OTPメモリ24を使用してセキュリティの高いプログラムデータの検証を行うことができる。プログラムデータを例えば10分割する場合、10個の参照値y1〜y10を保存するには10×256ビット又は320バイトの容量のnon−OTPメモリ24が必要になるが、この容量はマイクロコントローラ10が低性能であっても容易に実現できる容量である。検証に使用する参照値y1〜ym及びハッシュチェーンx1〜xnは、デジタル署名よりも計算量が少ないハッシュ関数SHA256により計算できるため、高性能でセキュアなハードウェアではなくても検証時間を短くすることができる。したがって、ハードウェアの性能によらずよりセキュリティが高いプログラムデータの検証を高速に行うことができる。
As described above, according to the
<第3実施形態>
第3実施形態のマイクロコントローラ10は、第1又は第2実施形態で説明したプログラムデータの検証処理を指定した時間に実行することにより、セキュリティをより高める。
<Third Embodiment>
The
第3実施形態に係るマイクロコントローラ10では、CPU11がセキュアブートを実行する時間をタイマー15にセットする。タイマー15によりカウントされた時間がセキュアブートの実行時間に到ると、CPU11は第1又は第2実施形態と同様のセキュアブートを実行する。セキュアブートの実行時間は、一定間隔であってもよいし、乱数等により任意に定義された時間であってもよい。
In the
このように、第3実施形態によれば、プログラムデータの検証が指定された時間に行われるため、検証を実行する間隔を短くすることでセキュリティをより高めることができる。これは特に第2実施形態において有効である。第2実施形態に係る検証処理では、プログラムデータの全部ではなく一部に対してハッシュ値による検証を行うため、検証の間隔を短くして検証するデータ部分を増やすことによりセキュリティが高まる。 As described above, according to the third embodiment, since the verification of the program data is performed at the designated time, the security can be further enhanced by shortening the interval for executing the verification. This is particularly effective in the second embodiment. In the verification process according to the second embodiment, since the verification by the hash value is performed not for all but a part of the program data, the security is enhanced by shortening the verification interval and increasing the data portion to be verified.
以上、本発明の好ましい実施形態について説明したが、本発明は、これらの実施形態に限定されず、その要旨の範囲内で種々の変形及び変更が可能である。
例えば、アプリケーションのバージョンが更新されるごとに異なるハッシュチェーンを保存することでセキュリティを高めることができるが、ハッシュチェーンxnより前に生成されるハッシュチェーンx1〜x(n−1)のいずれかであれば最後のハッシュチェーンxnを計算できる。よって、更新ごとに異なるハッシュチェーンを書き込むのではなく、ハッシュチェーンx1〜x(n−1)から選択した1つのハッシュチェーン、例えばハッシュチェーンx5を毎回保存するようにしてもよい。
Although the preferred embodiments of the present invention have been described above, the present invention is not limited to these embodiments, and various modifications and modifications can be made within the scope of the gist thereof.
For example, security can be enhanced by saving a different hash chain each time the application version is updated, but one of the hash chains x1 to x (n-1) generated before the hash chain xn can be used. If so, the last hash chain xn can be calculated. Therefore, instead of writing a different hash chain for each update, one hash chain selected from the hash chains x1 to x (n-1), for example, the hash chain x5 may be saved each time.
10・・・マイクロコントローラ、11・・・CPU、21・・・OTPメモリ、22・・・non−OTPメモリ、23・・・OTPメモリ、24・・・non−OTPメモリ、50・・・外部コントローラ
10 ... Microcontroller, 11 ... CPU, 21 ... OTP memory, 22 ... non-OTP memory, 23 ... OTP memory, 24 ... non-OTP memory, 50 ... External controller
Claims (12)
データの書き換えが不可能な第1メモリ(23)と、
データの書き換えが可能な第2メモリ(24)と、を備え、
前記第1メモリ(23)には、前記参照値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンと、が保存され、
前記第2メモリ(24)には、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかが保存され、
前記検証処理部(11)は、前記ハッシュ関数を用いて前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算し、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記計算されたn番目のハッシュチェーンと前記第1メモリ(23)に保存された前記n番目のハッシュチェーンとが同じである場合、前記プログラムデータが真正であると判断する、
制御装置(10)。 A verification processing unit (11) that verifies the authenticity of the program data by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value.
The first memory (23), which cannot be rewritten, and
It is equipped with a second memory (24) that can rewrite data.
In the first memory (23), the reference value and the nth hash chain of the 1st to nth hash chains calculated from data of a predetermined length by repeatedly using the hash function are stored. ,
One of the 1st to n-1st hash chains of the 1st to nth hash chains is stored in the second memory (24).
The verification processing unit (11) calculates the nth hash chain from any of the 1st to n-1th hash chains stored in the second memory (24) using the hash function, and the above-mentioned The hash value calculated from the program data is the same as the reference value, and the calculated nth hash chain and the nth hash chain stored in the first memory (23) are the same. If the program data is determined to be genuine,
Control device (10).
前記検証処理部(11)は、前記プログラムデータの全部からハッシュ値を計算し、前記計算されたハッシュ値が前記参照値と同じか否かを判断する、
請求項1に記載の制御装置(10)。 The reference value is a hash value calculated from all of the program data.
The verification processing unit (11) calculates a hash value from all of the program data, and determines whether or not the calculated hash value is the same as the reference value.
The control device (10) according to claim 1.
データの書き換えが不可能な第1メモリ(23)と、
データの書き換えが可能な第2メモリ(24)と、を備え、
前記第1メモリ(23)には、前記参照値のハッシュ値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとが保存され、
前記第2メモリ(24)には、前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとが保存され、
前記検証処理部(11)は、前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された参照値からハッシュ値を計算するとともに前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算し、前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記参照値から計算されたハッシュ値が前記保存された参照値のハッシュ値と同じであって、前記計算されたn番目のハッシュチェーンが前記保存されたn番目のハッシュチェーンと同じである場合、前記プログラムデータが真正であると判断する、
制御装置(10)。 A verification processing unit (11) that verifies the authenticity of the program data by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as the reference value.
The first memory (23), which cannot be rewritten, and
It is equipped with a second memory (24) that can rewrite data.
In the first memory (23), the hash value of the reference value and the nth hash chain of the 1st to nth hash chains calculated from the data of a predetermined length by repeatedly using the hash function are stored. Saved
The reference value and any one of the 1st to n-1st hash chains of the 1st to nth hash chains are stored in the second memory (24).
The verification processing unit (11) uses the hash function to calculate a hash value from a reference value stored in the second memory (24), and the above 1 to 1 stored in the second memory (24). The nth hash chain is calculated from any of the n-1th hash chains, the hash value calculated from the program data is the same as the reference value, and the hash value calculated from the reference value is the said. If it is the same as the hash value of the stored reference value and the calculated nth hash chain is the same as the stored nth hash chain, it is determined that the program data is genuine.
Control device (10).
前記検証処理部(11)は、前記プログラムデータのいずれかのデータ部分のハッシュ値を計算し、前記計算されたハッシュ値が前記参照値として保存された前記いずれかのデータ部分のハッシュ値と同じか否かを判断する、
請求項3に記載の制御装置(10)。 The reference value is a hash value of each of m pieces of data in which the program data is divided.
The verification processing unit (11) calculates a hash value of any data portion of the program data, and the calculated hash value is the same as the hash value of any of the data portions stored as the reference value. Judge whether or not
The control device (10) according to claim 3.
前記検証処理部(11)は、前記参照値として保存された前記各データ部分のハッシュ値を連結したデータ列を生成し、当該データ列のハッシュ値を計算して前記保存された参照値のハッシュ値と同じか否かを判断する、
請求項4に記載の制御装置(10)。 The hash value of the reference value is a hash value of a data string in which the hash values of the data parts are concatenated.
The verification processing unit (11) generates a data string in which the hash values of the respective data portions saved as the reference value are concatenated, calculates the hash value of the data string, and hashes the saved reference value. Judge if it is the same as the value,
The control device (10) according to claim 4.
請求項1〜5のいずれか一項に記載の制御装置(10)。 The reference value is calculated and saved from the updated version of the program data each time the program data is updated.
The control device (10) according to any one of claims 1 to 5.
前記検証処理部(11)は、前記n−k+1番目のハッシュチェーンに前記ハッシュ関数を繰り返し用いて前記n番目のハッシュチェーンを計算する、
請求項6に記載の制御装置(10)。 When the number of versions of the program data is represented by k, any of the 1st to n-1st hash chains stored in the second memory (24) is the nk + 1th hash chain.
The verification processing unit (11) repeatedly uses the hash function for the nk + 1th hash chain to calculate the nth hash chain.
The control device (10) according to claim 6.
請求項1〜7のいずれか一項に記載の制御装置(10)。 The verification processing unit (11) executes the verification at a designated time.
The control device (10) according to any one of claims 1 to 7.
ハッシュ関数を繰り返し用いて所定長のデータから1〜n番目のハッシュチェーンを計算するステップと、
前記検証に用いる参照値として、前記ハッシュ関数を用いて前記プログラムデータからハッシュ値を計算するステップと、
前記計算された参照値と、前記1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとを、前記第1メモリ(23)に保存するステップと、
前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかを、前記第2メモリ(24)に保存するステップと、
を含む方法。 This is a method of initializing a control device (10) that includes a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten, and verifies the authenticity of program data. hand,
The step of calculating the 1st to nth hash chains from the data of a predetermined length by repeatedly using the hash function, and
As a reference value used for the verification, a step of calculating a hash value from the program data using the hash function, and a step of calculating the hash value from the program data.
A step of storing the calculated reference value and the nth hash chain of the 1st to nth hash chains in the first memory (23).
A step of storing any one of the 1st to n-1st hash chains in the 1st to nth hash chains in the second memory (24), and
How to include.
前記プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証するステップを含み、
前記第1メモリ(23)には、前記参照値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンと、が保存され、
前記第2メモリ(24)には、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかが保存され、
前記検証するステップは、
前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算するステップと、
前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記計算されたn番目のハッシュチェーンと前記保存されたn番目のハッシュチェーンとが同じである場合、前記プログラムデータが真正であると判断するステップと、
を含む方法。 A method for verifying the authenticity of program data in a control device (10) including a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten. ,
A step of verifying the authenticity of the program data by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as a reference value is included.
In the first memory (23), the reference value and the nth hash chain of the 1st to nth hash chains calculated from data of a predetermined length by repeatedly using the hash function are stored. ,
One of the 1st to n-1st hash chains of the 1st to nth hash chains is stored in the second memory (24).
The verification step is
Using the hash function, a step of calculating the nth hash chain from any of the 1st to n-1st hash chains stored in the second memory (24), and
When the hash value calculated from the program data is the same as the reference value, and the calculated nth hash chain and the stored nth hash chain are the same, the program data is authentic. And the steps to determine that
How to include.
ハッシュ関数を繰り返し用いて所定長のデータから1〜n番目のハッシュチェーンを計算するステップと、
前記検証に用いる参照値として、前記ハッシュ関数を用いて前記プログラムデータからハッシュ値を計算するステップと、
前記ハッシュ関数を用いて前記参照値からハッシュ値を計算するステップと、
前記参照値から計算されたハッシュ値と、前記1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとを、前記第1メモリ(23)に保存するステップと、
前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとを、前記第2メモリ(24)に保存するステップと、
を含む方法。 This is a method of initializing a control device (10) that includes a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten, and verifies the authenticity of program data. hand,
The step of calculating the 1st to nth hash chains from the data of a predetermined length by repeatedly using the hash function, and
As a reference value used for the verification, a step of calculating a hash value from the program data using the hash function, and a step of calculating the hash value from the program data.
A step of calculating a hash value from the reference value using the hash function, and
A step of storing the hash value calculated from the reference value and the nth hash chain of the 1st to nth hash chains in the first memory (23).
A step of storing the reference value and any of the 1st to n-1st hash chains of the 1st to nth hash chains in the second memory (24).
How to include.
前記プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証するステップを含み、
前記第1メモリ(23)には、前記参照値から計算されたハッシュ値と、前記ハッシュ関数を繰り返し用いて所定長のデータから計算された1〜n番目のハッシュチェーンのうちのn番目のハッシュチェーンとが保存され、
前記第2メモリ(24)には、前記参照値と、前記1〜n番目のハッシュチェーンのうちの1〜n−1番目のハッシュチェーンのいずれかとが保存され、
前記検証するステップは、
前記ハッシュ関数を用いて、前記第2メモリ(24)に保存された参照値からハッシュ値を計算するステップと、
前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかからn番目のハッシュチェーンを計算するステップと、
前記プログラムデータから計算されたハッシュ値が前記参照値と同じであり、かつ前記参照値から計算されたハッシュ値が前記保存された参照値のハッシュ値と同じであって、前記計算されたn番目のハッシュチェーンが前記保存された前記n番目のハッシュチェーンと同じである場合、前記プログラムデータが真正であると判断するステップと、
を含む方法。
A method of verifying the authenticity of program data in a control device (10) including a first memory (23) in which data cannot be rewritten and a second memory (24) in which data can be rewritten.
A step of verifying the authenticity of the program data by calculating a hash value from the program data using a hash function and determining whether or not the hash value is the same as a reference value is included.
In the first memory (23), the hash value calculated from the reference value and the nth hash of the 1st to nth hash chains calculated from the data of a predetermined length by repeatedly using the hash function. The chain and is saved,
The reference value and any one of the 1st to n-1st hash chains of the 1st to nth hash chains are stored in the second memory (24).
The verification step is
A step of calculating a hash value from a reference value stored in the second memory (24) using the hash function, and
A step of calculating the nth hash chain from any of the first to n-1th hash chains stored in the second memory (24), and
The hash value calculated from the program data is the same as the reference value, and the hash value calculated from the reference value is the same as the hash value of the stored reference value, and the calculated nth position. If the hash chain of is the same as the stored nth hash chain, the step of determining that the program data is authentic and
How to include.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019164794A JP7270511B2 (en) | 2019-09-10 | 2019-09-10 | Control device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019164794A JP7270511B2 (en) | 2019-09-10 | 2019-09-10 | Control device and method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021043674A true JP2021043674A (en) | 2021-03-18 |
JP7270511B2 JP7270511B2 (en) | 2023-05-10 |
Family
ID=74861603
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019164794A Active JP7270511B2 (en) | 2019-09-10 | 2019-09-10 | Control device and method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7270511B2 (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005210479A (en) * | 2004-01-23 | 2005-08-04 | Ntt Data Corp | Time stamp system, time stamp requesting device, time stamp verifying device, and computer program |
JP2008293033A (en) * | 2003-09-18 | 2008-12-04 | Apple Inc | Method and apparatus for incremental code signing |
JP2015022521A (en) * | 2013-07-19 | 2015-02-02 | スパンション エルエルシー | Secure boot method, built-in apparatus, secure boot device and secure boot program |
JP2015036847A (en) * | 2013-08-12 | 2015-02-23 | 株式会社東芝 | Semiconductor device |
US20190042725A1 (en) * | 2018-06-28 | 2019-02-07 | Xiaoyu Ruan | System, Apparatus And Method For Independently Recovering A Credential |
-
2019
- 2019-09-10 JP JP2019164794A patent/JP7270511B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008293033A (en) * | 2003-09-18 | 2008-12-04 | Apple Inc | Method and apparatus for incremental code signing |
JP2005210479A (en) * | 2004-01-23 | 2005-08-04 | Ntt Data Corp | Time stamp system, time stamp requesting device, time stamp verifying device, and computer program |
JP2015022521A (en) * | 2013-07-19 | 2015-02-02 | スパンション エルエルシー | Secure boot method, built-in apparatus, secure boot device and secure boot program |
JP2015036847A (en) * | 2013-08-12 | 2015-02-23 | 株式会社東芝 | Semiconductor device |
US20190042725A1 (en) * | 2018-06-28 | 2019-02-07 | Xiaoyu Ruan | System, Apparatus And Method For Independently Recovering A Credential |
Also Published As
Publication number | Publication date |
---|---|
JP7270511B2 (en) | 2023-05-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8296579B2 (en) | System and method for updating a basic input/output system (BIOS) | |
US10650151B2 (en) | Method of execution of a binary code of a secure function by a microprocessor | |
US8060941B2 (en) | Method and system to authenticate an application in a computing platform operating in trusted computing group (TCG) domain | |
JP5740573B2 (en) | Information processing apparatus and information processing method | |
EP1788506A2 (en) | Method and apparatus for securely updating and boot code image | |
EP2831800B1 (en) | Method for protecting data | |
JP6925542B2 (en) | Software verification device, software verification method and software verification program | |
EP1334419B1 (en) | System and method for verifying the integrity of stored information within an electronic device | |
WO2001050230A3 (en) | Electronic security technique for gaming software | |
CN103093150A (en) | Dynamic integrity protection method based on credible chip | |
US20090034717A1 (en) | Method of processing data protected against attacks by generating errors and associated device | |
US10942868B2 (en) | Execution process of binary code of function secured by microprocessor | |
CN112653559B (en) | Electric control unit starting method and device and storage medium | |
JP2021043674A (en) | Control device and method | |
US20200387612A1 (en) | Secure boot system, method and apparatus | |
CN109753788B (en) | Integrity checking method and computer readable storage medium during kernel operation | |
WO2009057095A1 (en) | Secure overlay manager protection | |
JP7171339B2 (en) | Information processing device, control method for information processing device, and program | |
CN113434122A (en) | Multi-role page creation method and device, server and readable storage medium | |
KR101893504B1 (en) | A file integrity test in linux environment device and method | |
TW202022660A (en) | Image file packaging method and image file packaging system | |
US11514167B2 (en) | Computer system having firmware verification mechanism and firmware verification method of the same | |
CN117193863B (en) | Method, device, system and processor for starting host bootstrap program | |
US20230214491A1 (en) | Firmware verification system and firmware verification method | |
JP7341376B2 (en) | Information processing device, information processing method, and information processing program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220901 |
|
TRDD | Decision of grant or rejection written | ||
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230412 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20230419 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230425 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 7270511 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |