JP2021043674A - Control device and method - Google Patents

Control device and method Download PDF

Info

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
Application number
JP2019164794A
Other languages
Japanese (ja)
Other versions
JP7270511B2 (en
Inventor
カミーユ ヴィオム
Vuillaume Camille
カミーユ ヴィオム
嘉捷 張
Jiajie Zhang
嘉捷 張
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bosch Corp
Original Assignee
Bosch Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bosch Corp filed Critical Bosch Corp
Priority to JP2019164794A priority Critical patent/JP7270511B2/en
Publication of JP2021043674A publication Critical patent/JP2021043674A/en
Application granted granted Critical
Publication of JP7270511B2 publication Critical patent/JP7270511B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

To perform verification of program data in a high-speed manner regardless of hardware performance.SOLUTION: An control device (10) comprises: a non-rewritable first memory (23) in which a referential value of program data, and an n-th hash chain out of first to n-th hash chains calculated from data in a prescribed length by using a hash function in a repetitive manner are stored; a writable second memory (24) in which either one of the first to n-first hash chains is stored; and a verification processing section (11) in which, when a hash value calculated from the program data is equal to the stored referential value, and further the stored n-th hash chain is equal to an n-th hash chain calculated from either one of the first to the n-first hash chains, the program data is determined to be authentic.SELECTED DRAWING: Figure 1

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.

特開2018−88574号公報JP-A-2018-88574

しかしながら、デジタル署名は計算集約型の暗号化技術であり、計算量が多い。計算に時間を要するため、ハードウェアが低性能であると検証プロセスの時間が非常に長くなる可能性がある。 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.

本実施形態のマイクロコントローラの構成を示すブロック図である。It is a block diagram which shows the structure of the microcontroller of this embodiment. ハッシュチェーンを生成する処理のフローチャートである。It is a flowchart of the process of generating a hash chain. ハッシュチェーンの概念図である。It is a conceptual diagram of a hash chain. 第1実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 1st Embodiment. 第1実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 1st Embodiment. 第1実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 1st Embodiment. 第1実施形態においてプログラムデータの真正性を検証する処理のフローチャートである。It is a flowchart of the process for verifying the authenticity of the program data in 1st Embodiment. 第2実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 2nd Embodiment. 第2実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 2nd Embodiment. 第2実施形態におけるOTPメモリ及びnon−OTPメモリのデータ例を示す図である。It is a figure which shows the data example of the OTP memory and non-OTP memory in the 2nd Embodiment. 第2実施形態においてプログラムデータの真正性を検証する処理のフローチャートである。It is a flowchart of the process for verifying the authenticity of the program data in the 2nd Embodiment.

以下、本発明の制御装置及び方法の第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 microcontroller 10 common to the first to third embodiments.
As shown in FIG. 1, the microcontroller 10 includes a CPU (Central Processing Unit) 11, a RAM (Random Access Memory) 12, an I / O interface 13, a random number generator 14, a timer 15, and a flash memory 16.

CPU11は、フラッシュメモリ16が記憶するOS(Operating System)用のプログラム又は各種アプリケーションのプログラムを読み出して実行する。CPU11は、アプリケーションを起動する際、セキュアブートを実行してプログラムデータの真正性を検証する検証処理部として機能する。 The CPU 11 reads and executes a program for an OS (Operating System) or a program of various applications stored in the flash memory 16. When the application is started, the CPU 11 functions as a verification processing unit that executes a secure boot to verify the authenticity of the program data.

RAM12は、CPU11がプログラムの実行に使用するデータ等を一時的に記憶する。 The RAM 12 temporarily stores data or the like used by the CPU 11 to execute the program.

I/Oインターフェイス13は、車両に搭載される各種センサと通信する。また、マイクロコントローラ10に外部コンピュータ50が接続された場合、I/Oインターフェイス13は、外部コンピュータ50と通信する。 The I / O interface 13 communicates with various sensors mounted on the vehicle. When the external computer 50 is connected to the microcontroller 10, the I / O interface 13 communicates with the external computer 50.

乱数生成器14は、任意の数値である乱数を生成する。例えば、乱数生成器14は、I/Oインターフェイス13を介して各種センサから入力されるノイズに基づいて乱数を生成する。 The random number generator 14 generates a random number which is an arbitrary numerical value. For example, the random number generator 14 generates random numbers based on noise input from various sensors via the I / O interface 13.

タイマー15は、CPU11によってセットされた特定値に到るまでカウントを続ける。タイマー15は、カウント値が特定値に到るとカウント値を0にリセットしてカウントを再開する。 The timer 15 continues counting until it reaches a specific value set by the CPU 11. When the count value reaches a specific value, the timer 15 resets the count value to 0 and restarts the count.

フラッシュメモリ16は、各種CPU11により実行されるプログラム、当該プログラムの実行に使用されるデータ、例えばプログラムデータの真正性の検証に用いるデータ等を記憶する不揮発性メモリである。 The flash memory 16 is a non-volatile memory that stores a program executed by various CPUs 11, data used for executing the program, for example, data used for verifying the authenticity of the program data.

フラッシュメモリ16は、コードフラッシュ161とデータフラッシュ162のセクタに分けられる。コードフラッシュ161はプログラムデータの格納に使用でき、データフラッシュ162はアプリケーションの実行に使用されるデータの格納に使用できる。 The flash memory 16 is divided into sectors of a code flash 161 and a data flash 162. The code flash 161 can be used to store program data, and the data flash 162 can be used to store data used to execute applications.

フラッシュメモリ16は、コードフラッシュ161のサブセクタとしてOTP(One Time Programmable)メモリ21及びnon−OTPメモリ22を有し、データフラッシュ162のサブセクタとしてOTPメモリ23及びnon−OTPメモリ24を有する。 The flash memory 16 has an OTP (One Time Programmable) memory 21 and a non-OTP memory 22 as subsectors of the code flash 161 and an OTP memory 23 and a non-OTP memory 24 as subsectors of the data flash 162.

OTPメモリ21及び23は、書き込まれたデータの書き換えが不可能なメモリであり、第1メモリとして機能する。non−OTPメモリ22及び24は、書き込まれたデータの書き換えが可能なメモリであり、第2メモリとして機能する。なお、OTPメモリ21及び23は1つのOTPメモリとして設けられてもよく、non−OTPメモリ22及び24も1つのnon−OTPメモリとして設けられてもよい。 The OTP memories 21 and 23 are memories in which the written data cannot be rewritten, and function as the first memory. The non-OTP memories 22 and 24 are memories in which the written data can be rewritten, and function as a second memory. The OTP memories 21 and 23 may be provided as one OTP memory, and the non-OTP memories 22 and 24 may also be provided as one non-OTP memory.

(外部コンピュータの構成)
マイクロコントローラ10は、マイクロコントローラ10の初期化、アプリケーションのバージョンアップ等のため、外部コンピュータ50に接続されることがある。
(External computer configuration)
The microprocessor 10 may be connected to the external computer 50 for the purpose of initializing the microprocessor 10 and upgrading the application version.

外部コンピュータ50は、例えばPC(Personal Computer)、マイクロコントローラ10とは別に設けられるECU等である。外部コンピュータ50は、CPU51、RAM52、I/Oインターフェイス53及びフラッシュメモリ等のメモリ54を備え、必要に応じて操作部55、表示部56等を備える。 The external computer 50 is, for example, a PC (Personal Computer), an ECU provided separately from the microcontroller 10, and the like. The external computer 50 includes a CPU 51, a RAM 52, an I / O interface 53, a memory 54 such as a flash memory, and an operation unit 55, a display unit 56, and the like, if necessary.

CPU51は、メモリ54が記憶するOS(Operating System)用のプログラム又は各種アプリケーションのプログラムを読み出して実行する。例えば、CPU51は、マイクロコントローラ10の工場出荷時、プログラム更新時等に初期化処理を実行する。初期化処理時、CPU51は、プログラムデータの検証に必要なデータをマイクロコントローラ10のフラッシュメモリ16に書き込む。 The CPU 51 reads and executes a program for an OS (Operating System) or a program of various applications stored in the memory 54. For example, the CPU 51 executes an initialization process at the time of factory shipment of the microcontroller 10 or at the time of updating a program. At the time of the initialization process, the CPU 51 writes the data necessary for verifying the program data to the flash memory 16 of the microcontroller 10.

RAM52は、CPU51がプログラムの実行に使用するデータ等を一時的に記憶する。 The RAM 52 temporarily stores data and the like used by the CPU 51 to execute the program.

I/Oインターフェイス53は、マイクロコントローラ10に接続された場合、マイクロコントローラ10と通信する。 The I / O interface 53 communicates with the microcontroller 10 when connected to the microcontroller 10.

メモリ54は、各種プログラムデータ、プログラムの実行に必要なデータ等を記憶する記憶媒体である。メモリ54としては、フラッシュメモリ、ハードディスク等を使用できる。 The memory 54 is a storage medium for storing various program data, data necessary for executing the program, and the like. As the memory 54, a flash memory, a hard disk, or the like can be used.

操作部55は、操作に応じた操作信号をCPU51に出力する。操作部55としては、例えばキーボード、マウス、タッチパネル等が挙げられる。
表示部56は、CPU51の指示に従って操作画面等を表示するディスプレイである。
The operation unit 55 outputs an operation signal corresponding to the operation to the CPU 51. Examples of the operation unit 55 include a keyboard, a mouse, a touch panel, and the like.
The display unit 56 is a display that displays an operation screen or the like according to the instructions of the CPU 51.

<第1実施形態>
(初期化処理)
マイクロコントローラ10は、外部コンピュータ50に接続されて初期化処理されることで、プログラムデータの検証に必要なデータがフラッシュメモリ16に書き込まれる。
<First Embodiment>
(Initialization process)
The microprocessor 10 is connected to the external computer 50 and is initialized, so that the data necessary for verifying the program data is written to the flash memory 16.

図2は、外部コンピュータ50が検証に必要なデータの1つである、1〜n番目のハッシュチェーンを生成する処理手順を示す。この処理は、例えば工場での出荷時におけるマイクロコントローラ10の初期化処理中にオフラインで実行される。 FIG. 2 shows a processing procedure in which the external computer 50 generates the 1st to nth hash chains, which is one of the data required for verification. This process is executed offline, for example, during the initialization process of the microprocessor 10 at the time of shipment at the factory.

図2に示すように、外部コンピュータ50は、所定長のデータを1番目のハッシュチェーンx1として生成する(ステップS11)。このデータは任意に決定される数値、例えば乱数生成器で生成した乱数等であると、改ざんに対するセキュリティが高まるため好ましい。データの長さは、ハッシュチェーンx1に用いるハッシュ関数がSHA256である場合は256ビットであり、SHA−1を使用する場合は160ビットである。 As shown in FIG. 2, the external computer 50 generates data having a predetermined length as the first hash chain x1 (step S11). It is preferable that this data is an arbitrarily determined numerical value, for example, a random number generated by a random number generator, because the security against falsification is enhanced. The length of the data is 256 bits when the hash function used for the hash chain x1 is SHA256, and 160 bits when SHA-1 is used.

次に、外部コンピュータ50は、ハッシュチェーンx1にハッシュ関数をn−1回繰り返し用いて、2番目のハッシュチェーンx2からn番目のハッシュチェーンxnまでを順次生成する(ステップS12)。nは、アプリケーションを更新できる最大回数を表す2以上の数字である。以下、ハッシュ関数としてSHA256を使用する例を説明するが、SHA256以外のハッシュ関数も用いることができる。 Next, the external computer 50 repeatedly uses the hash function on the hash chain x1 n-1 times to sequentially generate the second hash chain x2 to the nth hash chain xn (step S12). n is a number of 2 or more representing the maximum number of times the application can be updated. Hereinafter, an example of using SHA256 as a hash function will be described, but a hash function other than SHA256 can also be used.

具体的には、外部コンピュータ50は、ハッシュチェーンの生成順を表す係数iをi=2に設定する。そして、外部コンピュータ50は、ハッシュチェーンx(i−1)にハッシュ関数を用いて、ハッシュチェーンxiを生成する。ハッシュチェーンxiの生成は、下記式により表される。
ハッシュチェーンxi=SHA256(ハッシュチェーンx(i−1))
SHA256()は、()内のデータ値からハッシュ値を生成するハッシュ関数SHA256を表す。
Specifically, the external computer 50 sets the coefficient i representing the hash chain generation order to i = 2. Then, the external computer 50 uses a hash function for the hash chain x (i-1) to generate the hash chain xi. The generation of the hash chain xi is expressed by the following formula.
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 external computer 50 increments i and repeats the generation of the hash chain xi. By repeating this process until i reaches n, hash chains x2 to xn are generated.

図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 external computer 50 stores the last generated nth hash chain xn out of the n hash chains x1 to xn in the OTP memory 23 of the data flash 162 (step S13). Further, the external computer 50 stores the first hash chain x1 to the n-1th hash chain x (n-1) in a secure memory separate from the microcontroller 10 (step S14).

ハッシュチェーン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 microprocessor 10 is initialized by the external computer 50. Specifically, the external computer 50 stores the program data of the application in the non-OTP memory 22 of the code flash 161. Further, the external computer 50 calculates all the hash values of the program data of the application using the hash function SHA256, and stores the calculated hash values as reference values in the OTP memory 23 of the data flash 162.

アプリケーションを更新してバージョンアップする際も、マイクロコントローラ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 microprocessor 10 is connected to the external controller 50 and is initialized. In the initialization process at the time of update, the external computer 50 overwrites the program data of the application stored in the non-OTP memory 22 with the program data after the update. Further, the external computer 50 acquires the hash chain x (nk + 1) from the secure memory and writes it in the non-OTP memory 24. k is a number 1 to n representing the version of the application. Further, the external computer 50 calculates the hash value of the updated program data using the hash function SHA256, and stores the calculated hash value as a reference value in the OTP memory 23. Since the data cannot be rewritten in the OTP memory 23, the reference value of the latest version is stored in the OTP memory 23 together with the reference value of the previous version.

図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 OTP memory 23 and the non-OTP memory 24. FIG. 4A shows an example of data at the time of version 1, FIG. 4B shows an example of data at the time of version 2, and FIG. 4C shows an example of data at the time of version 3.
As shown in FIGS. 4A to 4C, the OTP memory 23 is provided with n slots 231 to 23n. Each slot 231 to 23n corresponds to a reference value of each version. A coefficient k (k = 1 to n) representing the number of versions is assigned as the address of each slot 231 to 23n.

工場出荷時、図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, slot 231 is occupied by the reference value v1 of the program data of version 1, as shown in FIG. 4A. The other slots 223 to 23n are empty and unused. Although the reference value v1 of the OTP memory 23 cannot be rewritten, data can be written to the other unused slots 223 to 23n. On the other hand, the non-OTP memory 24 is provided with one slot 240, but at the time of version 1, this slot 240 is empty and is in an unused state.

アプリケーションが更新されると、図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 slot 232 of the OTP memory 23 as the reference value v2 of the latest version 2. When the reference value v2 is written in the slot 232, the reference value v1 of the previous version 1 expires. On the other hand, the hash chain x (n-1) is written in the slot 240 of the non-OTP memory 24.

さらにアプリケーションが更新されると、図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 OTP memory 23, as shown in FIG. 4C. As a result, the reference values v1 and v2 of the previous versions 1 and 2 expire. On the other hand, the hash chain x (n-2) is overwritten in the slot 240 of the non-OTP memory 24.

このようにして、アプリケーションの更新ごとに最新バージョン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 OTP memory 23 every time the application is updated, and the hash chain x (n−k + 1) is overwritten in the non—OTP memory 24. N slots 231 to 23n are prepared for the reference value vk, and the application can be updated n times. The microcontroller 10 can use these data to verify the authenticity of the program data.

(検証処理)
図5は、マイクロコントローラ10においてプログラムデータの真正性を検証する処理手順を示す。この処理は、例えばアプリケーションを起動するときのセキュアブートとしてCPU11によって実行される。
(Verification process)
FIG. 5 shows a processing procedure for verifying the authenticity of program data in the microprocessor 10. This process is executed by the CPU 11 as a secure boot when starting an application, for example.

図5に示すように、CPU11は、ハッシュ関数SHA256を用いてアプリケーションのプログラムデータの全部からハッシュ値を計算する(ステップS21)。次にCPU11は、OTPメモリ23から最新バージョンkの参照値vkを検索する(ステップS22)。参照値vkは、OTPメモリ23の各スロット231〜23nのうち、アドレスがkのスロットに保存されている。 As shown in FIG. 5, the CPU 11 calculates a hash value from all the program data of the application using the hash function SHA256 (step S21). Next, the CPU 11 searches the OTP memory 23 for the reference value vk of the latest version k (step S22). The reference value vk is stored in the slot whose address is k among the slots 231 to 23n of the OTP memory 23.

CPU11は、計算されたハッシュ値を検索された参照値vkと照合し、同じか否かを判断する(ステップS23)。ハッシュ値が参照値vkと同じでない場合(ステップS23:NO)、プログラムデータが改ざんされているため、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS24)、セキュアブートを終了する。 The CPU 11 collates the calculated hash value with the searched reference value vk, and determines whether or not they are the same (step S23). If the hash value is not the same as the reference value vk (step S23: NO), the secure boot fails because the program data has been tampered with. The CPU 11 resets the microprocessor 10 (step S24) and ends the secure boot.

なおステップS24において、マイクロコントローラ10は、例えばRAMの特別なフラグを使用する等、プログラムが破損したことのトラックを残して、セキュアブートを継続することもできる。これは認証ブート(authenticated boot)と呼ばれる。 Note that in step S24, the microcontroller 10 can continue secure boot, leaving a track of program corruption, for example by using a special flag in RAM. This is called an authenticated boot.

ハッシュ値が参照値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 CPU 11 determines whether k = 1, that is, whether the application is version 1 which has never been updated (step S23: YES). S25). If k = 1 (step S25: YES), that is, version 1, the secure boot succeeds. The CPU 11 starts the application (step S29) and ends the secure boot.

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 CPU 11 reads the hash chain x (n−k + 1) from the non-OTP memory 24 (step S26). The CPU 11 repeatedly uses the hash function SHA256 k-1 times to calculate a hash value from the hash chain x (n−k + 1) (step S27). The hash value calculated should be the hash chain xn. For example, when k = 2, the hash chain x (n-1) is stored in the non-OTP memory 24. When the hash function SHA256 is used 1 (1 = 2-1) times for this hash chain x (n-1), the hash chain xn is calculated. When k = 3, the hash chain x (n-2) is stored in the non-OTP memory 24. By repeating the hash function SHA256 on the hash chain x (n-2) 2 (2 = 3-1) times, the hash chain x (n-1) is calculated from the hash chain x (n-2), and this hash chain is calculated. A hash chain xn is further calculated from x (n-1).

このように、ハッシュチェーン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 CPU 11 determines whether or not the calculated hash chain xn and the hash chain xn stored in the OTP memory 23 are the same (step S28). If they are the same (step S28: YES), the CPU 11 determines that the program data is genuine, and the secure boot succeeds. The CPU 11 starts the application (step S29) and ends the secure boot. On the other hand, if they are not the same (step S28: NO), secure boot fails. The CPU 11 resets the microprocessor 10 (step S24) and ends the secure boot.

以上のように、第1実施形態のマイクロコントローラ10によれば、プログラムデータから計算したハッシュ値とOTPメモリ23に保存された参照値vkが同じであり、かつnon−OTPメモリ24に保存されたハッシュチェーンx(n−k+1)から計算されたハッシュチェーンxnとOTPメモリ23に保存されたハッシュチェーンxnとが同じであるかを判断することにより、プログラムデータの真正性を検証する。 As described above, according to the microcontroller 10 of the first embodiment, the hash value calculated from the program data and the reference value vk stored in the OTP memory 23 are the same, and are stored in the non-OTP memory 24. The authenticity of the program data is verified by determining whether the hash chain xn calculated from the hash chain x (n−k + 1) and the hash chain xn stored in the OTP memory 23 are the same.

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 OTP memory 23 and the hash chain xn. When a malicious third party tries to forge the reference value vk, it is necessary to forge the hash chain x (n-k + 1), but due to the pre-image resistance characteristic of the hash function, the hash chain xn is before the hash chain xn. The hash chain x (n-k + 1) cannot be forged. Therefore, high security with a reference value vk can be maintained.

このように、第1実施形態のマイクロコントローラ10によれば、一般的なハードウェアであるOTPメモリ23とnon−OTPメモリ24を使用してセキュリティの高いプログラムデータの検証を行うことができる。検証に使用するハッシュチェーンx1〜xnは、データ量が256ビットと小さいデータ片に最大でもn−1回のハッシュ関数SHA256の計算を行うことにより得ることができる。計算量が少ないため、高性能でセキュアなハードウェアではなくても検証時間を短くすることができる。したがって、ハードウェアの性能によらずプログラムデータの検証を高速に行うことができる。 As described above, according to the microcontroller 10 of the first embodiment, it is possible to verify highly secure program data by using the OTP memory 23 and the non-OTP memory 24, which are general hardware. The hash chain x1 to xn used for verification can be obtained by performing the calculation of the hash function SHA256 at most n-1 times on a data piece having a data amount as small as 256 bits. Since the amount of calculation is small, the verification time can be shortened even if the hardware is not high-performance and secure. Therefore, the verification of the program data can be performed at high speed regardless of the performance of the hardware.

参照値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 microcontroller 10 of the first embodiment can speed up verification by using a hash chain xn instead of a digital signature. The calculation speed of the hash function SHA256 is several orders of magnitude faster than the verification of digital signatures. Therefore, even if the microprocessor 10 has low performance, the reference value vk can be verified at high speed, and the system can be operated at high speed such as starting the engine of the vehicle.

<第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 external computer 50 generates hash chains x1 to xn, stores the last hash chain xn in the microcomputer 10, and then generates a reference value. .. The reference value of the second embodiment is a hash value of each of m data portions in which the program data is divided.

具体的には、外部コンピュータ50は、アプリケーションのプログラムデータをm個のデータ部分に分割し、ハッシュ関数SHA256を用いて各データ部分のハッシュ値を計算する。外部コンピュータ50は、計算した各データ部分のハッシュ値を各データ部分の参照値y1〜ymとしてnon−OTPメモリ24に保存する。 Specifically, the external computer 50 divides the program data of the application into m data portions, and calculates the hash value of each data portion using the hash function SHA256. The external computer 50 stores the calculated hash value of each data portion as the reference value y1 to ym of each data portion in the non-OTP memory 24.

また、外部コンピュータ50は、各参照値y1〜ymからハッシュ値を計算する。例えば、外部コンピュータ50は、各参照値y1〜ymを順番に並べて連結したデータ列を生成し、ハッシュ関数SHA256を用いて当該データ列のハッシュ値を計算する。外部コンピュータ50は、計算されたハッシュ値をバージョンkの参照値wkとしてOTPメモリ23のスロット231に保存する。参照値wkは、non−OTPメモリ24に保存された各参照値y1〜ymの検証に使用される。 Further, the external computer 50 calculates a hash value from each reference value y1 to ym. For example, the external computer 50 generates a data string in which the reference values y1 to ym are arranged in order and concatenated, and the hash function SHA256 is used to calculate the hash value of the data string. The external computer 50 stores the calculated hash value as the reference value wk of the version k in the slot 231 of the OTP memory 23. The reference value wk is used for verification of each reference value y1 to ym stored in the non-OTP memory 24.

上記参照値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 external computer 50 overwrites the program data of the application stored in the non-OTP memory 22 with the updated program data. Further, the external computer 50 acquires the hash chain x (nk + 1) from the secure memory and writes it in the non-OTP memory 24. The external computer 50 generates reference values y1 to ym from the updated program data and stores them in the non-OTP memory 24. Further, the external computer 50 calculates a hash value of a data string in which the generated reference values y1 to ym are arranged and concatenated, and stores the generated reference values wk in the OTP memory 23. The reference value wk of each version is additionally written in the OTP memory 23 in which the data cannot be rewritten.

図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 OTP memory 23 and the non-OTP memory 24 in the second embodiment. FIG. 6A shows a version 1 data example, FIG. 6B shows a version 2 data example, and FIG. 6C shows a version 3 data example.
As shown in FIGS. 6A to 6C, the non-OTP memory 24 of the second embodiment is provided with m slots 241 to 24 m in addition to the slots 240. One slot corresponds to one reference value. Further, as in the first embodiment, the non-OTP memory 24 is provided with a slot 240, and the OTP memory 23 is provided with slots 231 to 23n.

工場出荷時、図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 version 1 are stored in the slots 241 to 24 m of the non-OTP memory 24, and the reference values of the version 1 are stored in the slots 231 of the OTP memory 23. w1 is stored. Slot 240 of the non-OTP memory 24 is in an unused state. Further, the slots 223 to 23n of the OTP memory 23 are also in an unused state.

アプリケーションのプログラムデータが更新されると、外部コンピュータ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 external computer 50 generates the latest version 2 reference values y1 to ym from the updated program data as shown in FIG. 6B, and each slot 241 of the non-OTP memory 24. Overwrite and save to ~ 24m. Further, the external computer 50 calculates the hash value of the data string of the latest version 2 reference value y1 to ym, and stores it in the slot 232 of the OTP memory 23 as the version 2 reference value w2. As a result, the reference value w1 of version 1 expires. The external computer 50 acquires the hash chain x (n-1) stored in the secure memory and stores it in the slot 240 of the non-OTP memory 24.

さらにアプリケーションが更新されると、外部コンピュータ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 external computer 50 generates the latest version 3 reference values y1 to ym from the updated program data, and overwrites and saves the reference values y1 to ym of the latest version 3 in each slot 241 to 24 m of the non-OTP memory 24. Further, the external computer 50 calculates the hash value of the data string from the reference values y1 to ym of the latest version 2, and stores it in the slot 233 of the OTP memory 23 as the reference value w3 of the version 3. As a result, the reference values w1 and w2 of versions 1 and 2 expire. The external computer 50 acquires the hash chain x (n-2) from the secure memory and overwrites and stores it in the slot 240 of the non-OTP memory 24.

このようにして、アプリケーションが更新されるごとに、最新バージョン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 non-OTP memory 24, and the reference value of the latest version k is saved. wk is stored in the OTP memory 23.

(検証処理)
図7は、第2実施形態に係るマイクロコトンローラ10がプログラムデータの真正性を検証する処理手順を示す。この処理は、例えばアプリケーションを起動するときのセキュアブートとしてCPU11によって実行される。
(Verification process)
FIG. 7 shows a processing procedure in which the microcotton roller 10 according to the second embodiment verifies the authenticity of the program data. This process is executed by the CPU 11 as a secure boot when starting an application, for example.

図7に示すように、CPU11は乱数生成器14により生成された乱数r(rは1〜mの整数)を取得する(ステップS41)。CPU11は、アプリケーションのプログラムデータをm個のデータ部分に分割し、m個のデータ部分のうちr番目のデータ部分rからハッシュ関数SHA256を用いてハッシュ値を計算する(ステップS42)。 As shown in FIG. 7, the CPU 11 acquires the random number r (r is an integer of 1 to m) generated by the random number generator 14 (step S41). The CPU 11 divides the program data of the application into m data portions, and calculates a hash value from the r-th data portion r of the m data portions using the hash function SHA256 (step S42).

CPU11は、OTPメモリ23から最新バージョンkの参照値wkを読み出す(ステップS43)。また、CPU11は、non−OTPメモリ24に保存された各参照値y1〜ymを並べて連結したデータ列を生成し、ハッシュ関数SHA256を用いてそのハッシュ値を計算する。CPU11は、計算されたハッシュ値がOTPメモリ23に保存された参照値wkと同じか否かを判断する(ステップS44)。 The CPU 11 reads the reference value wk of the latest version k from the OTP memory 23 (step S43). Further, the CPU 11 generates a data string in which the reference values y1 to ym stored in the non-OTP memory 24 are arranged and concatenated, and the hash value is calculated using the hash function SHA256. The CPU 11 determines whether or not the calculated hash value is the same as the reference value wk stored in the OTP memory 23 (step S44).

計算されたハッシュ値と参照値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 CPU 11 ends the secure boot without starting the application. In step S45, the authentication boot may be executed in the same manner as in step S24 described above. On the other hand, when the calculated hash value is the same as the reference value wk (step S44: YES), the CPU 11 has the hash value of the calculated data portion r and the reference value yr of the data portion r stored in the non-OTP memory 24. Is the same or not (step S46).

計算されたハッシュ値と保存された参照値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 CPU 11 resets the microcontroller 10 (step S45) and ends the secure boot. On the other hand, when the calculated hash value and the stored reference value yr are the same (step S46: YES), the CPU 11 determines whether or not k = 1 (step S47).

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 version 1, the secure boot succeeds. The CPU 11 starts the application (step S51) and ends the secure boot. When k = 1 (step S47: NO), that is, when the version is 2 or more, the CPU 11 reads the hash chain x (n-k + 1) from the non-OTP memory 24 (step S48). The CPU 11 repeatedly uses the hash function SHA256 k-1 times to calculate a hash value, that is, a hash chain xn from the hash chain x (n−k + 1) (step S49).

CPU11は、計算されたハッシュチェーンxnとOTPメモリ23に保存されたハッシュチェーンxnが同一か否かを判断する(ステップS50)。各ハッシュチェーンxnが同一であれば(ステップS50:YES)、CPU11はプログラムデータが真正であると判断し、セキュアブートは成功する。CPU11はアプリケーションを起動し(ステップS51)、セキュアブートを終了する。一方、同一ではない場合(ステップS50:NO)、セキュアブートは失敗する。CPU11はマイクロコントローラ10をリセットし(ステップS45)、セキュアブートを終了する。なお、上記ステップS47〜S50の処理内容は第1実施形態におけるステップS25〜S28の処理内容と同じである。 The CPU 11 determines whether or not the calculated hash chain xn and the hash chain xn stored in the OTP memory 23 are the same (step S50). If each hash chain xn is the same (step S50: YES), the CPU 11 determines that the program data is genuine, and the secure boot succeeds. The CPU 11 starts the application (step S51) and ends the secure boot. On the other hand, if they are not the same (step S50: NO), secure boot fails. The CPU 11 resets the microcontroller 10 (step S45) and ends the secure boot. The processing content of steps S47 to S50 is the same as the processing content of steps S25 to S28 in the first embodiment.

以上のように、第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 non-OTP memory 24 instead of the OTP memory 23, they can be overwritten and saved every time the program data is updated, which is necessary for saving. The memory capacity can be reduced. Whether or not the reference values y1 to ym of each data portion stored in the non-OTP memory 24 are authentic can be confirmed by the reference value wk stored in the OTP memory 23. When a malicious third party tries to forge the reference value yr in order to succeed in secure boot, the hash value of the data string consisting of the reference values y1 to ym is the non-rewritable reference value stored in the OTP memory 23. It is necessary to forge it so that it is the same as wk. However, due to the definition of the hash function SHA256, it is impossible to calculate the reference value yr so that the hash value of the data string is the same as the reference value wk. The reference value wk of each version k is stored in the OTP memory 23, but since the reference value wk is a hash value and the amount of data is small, the memory capacity of the OTP memory 23 required for storage can also be reduced.

このように、第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 microcontroller 10 of the second embodiment, as in the first embodiment, the OTP memory 23 and the non-OTP memory 24, which are general hardware, are used to obtain highly secure program data. Verification can be performed. When the program data is divided into 10 for example, a non-OTP memory 24 having a capacity of 10 × 256 bits or 320 bytes is required to store 10 reference values y1 to y10, and this capacity is determined by the microcontroller 10. It is a capacity that can be easily realized even with low performance. Since the reference values y1 to ym and the hash chain x1 to xn used for verification can be calculated by the hash function SHA256, which requires less calculation than the digital signature, the verification time should be shortened even if the hardware is not high-performance and secure. Can be done. Therefore, it is possible to verify program data with higher security at high speed regardless of the performance of the hardware.

<第3実施形態>
第3実施形態のマイクロコントローラ10は、第1又は第2実施形態で説明したプログラムデータの検証処理を指定した時間に実行することにより、セキュリティをより高める。
<Third Embodiment>
The microcontroller 10 of the third embodiment further enhances security by executing the verification process of the program data described in the first or second embodiment at a designated time.

第3実施形態に係るマイクロコントローラ10では、CPU11がセキュアブートを実行する時間をタイマー15にセットする。タイマー15によりカウントされた時間がセキュアブートの実行時間に到ると、CPU11は第1又は第2実施形態と同様のセキュアブートを実行する。セキュアブートの実行時間は、一定間隔であってもよいし、乱数等により任意に定義された時間であってもよい。 In the microprocessor 10 according to the third embodiment, the time for the CPU 11 to execute the secure boot is set in the timer 15. When the time counted by the timer 15 reaches the secure boot execution time, the CPU 11 executes the secure boot similar to the first or second embodiment. The execution time of the secure boot may be a fixed interval or a time arbitrarily defined by a random number or the like.

このように、第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)

プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証する検証処理部(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)。
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.
プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証する検証処理部(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)。
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).
前記参照値は、前記プログラムデータが分割されたm個の各データ部分のハッシュ値であり、
前記検証処理部(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.
前記プログラムデータのバージョンの数をkで表すとき、前記第2メモリ(24)に保存された前記1〜n−1番目のハッシュチェーンのいずれかは、n−k+1番目のハッシュチェーンであり、
前記検証処理部(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.
前記検証処理部(11)は、前記検証を指定した時間に実行する、
請求項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メモリ(23)とデータの書き換えが可能な第2メモリ(24)とを備え、プログラムデータの真正性を検証する制御装置(10)を初期化する方法であって、
ハッシュ関数を繰り返し用いて所定長のデータから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)と、データの書き換えが可能な第2メモリ(24)と、を備える制御装置(10)において、プログラムデータの真正性を検証する方法であって、
前記プログラムデータからハッシュ関数を用いてハッシュ値を計算し、前記ハッシュ値が参照値と同じであるか否かを判断することにより、前記プログラムデータの真正性を検証するステップを含み、
前記第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メモリ(23)とデータの書き換えが可能な第2メモリ(24)とを備え、プログラムデータの真正性を検証する制御装置(10)を初期化する方法であって、
ハッシュ関数を繰り返し用いて所定長のデータから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)と、データの書き換えが可能な第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番目のハッシュチェーンと同じである場合、前記プログラムデータが真正であると判断するステップと、
を含む方法。

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.

JP2019164794A 2019-09-10 2019-09-10 Control device and method Active JP7270511B2 (en)

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)

* Cited by examiner, † Cited by third party
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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