JP6724732B2 - Electronic control unit - Google Patents
Electronic control unit Download PDFInfo
- Publication number
- JP6724732B2 JP6724732B2 JP2016217323A JP2016217323A JP6724732B2 JP 6724732 B2 JP6724732 B2 JP 6724732B2 JP 2016217323 A JP2016217323 A JP 2016217323A JP 2016217323 A JP2016217323 A JP 2016217323A JP 6724732 B2 JP6724732 B2 JP 6724732B2
- Authority
- JP
- Japan
- Prior art keywords
- rewriting
- data
- area
- digest
- unit
- 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.)
- Active
Links
Images
Description
本開示は、電子制御装置が備える書き換え可能な不揮発性メモリに対する書き換えを管理する技術に関する。 The present disclosure relates to a technique for managing rewriting of a rewritable nonvolatile memory included in an electronic control device.
電子制御装置には、プログラムとデータとを、フラッシュメモリ等の書き換え可能な不揮発性メモリに記憶しているものがある。不揮発性メモリに記憶されているデータは、プログラムのバージョンアップ、データの更新により書き換えられることがある。以下、プログラムとデータとを単にデータとも言う。 Some electronic control devices store a program and data in a rewritable nonvolatile memory such as a flash memory. The data stored in the non-volatile memory may be rewritten by updating the version of the program or updating the data. Hereinafter, the program and the data are also simply referred to as data.
不揮発性メモリのデータの書き換えは、例えば電子制御装置に接続される書き換えツールにより行われる。不揮発性メモリのデータを書き換える場合、不揮発性メモリの記憶領域を複数のブロックに分け、書き換え対象のデータを含むブロックだけを書き換えることが知られている。 Rewriting of data in the non-volatile memory is performed, for example, by a rewriting tool connected to the electronic control unit. When rewriting the data in the non-volatile memory, it is known that the storage area of the non-volatile memory is divided into a plurality of blocks and only the block containing the data to be rewritten is rewritten.
ここで、不揮発性メモリのデータが書き換えられる場合、正当な書き換えではなく、悪意のある第3者によって不正な書き換えが行われる可能性がある。このような不正な書き換えを検証するため、不揮発性メモリに記憶されているデータが正当であるか否かを、所定のタイミングで検証する技術が知られている(例えば、特許文献1参照)。 Here, when the data in the non-volatile memory is rewritten, there is a possibility that the malicious rewriting may be performed by a malicious third party instead of the correct rewriting. In order to verify such unauthorized rewriting, there is known a technique of verifying whether or not the data stored in the non-volatile memory is valid at a predetermined timing (for example, refer to Patent Document 1).
不揮発性メモリのデータを検証する場合、例えば、不揮発性メモリの複数のブロックのブロック毎にブロックのデータのダイジェストを算出し、予めブロック毎に記憶している電子署名から算出するダイジェストと一致するか否かにより各ブロックのデータを検証することが考えられる。 When verifying the data in the non-volatile memory, for example, the digest of the block data is calculated for each block of the plurality of blocks in the non-volatile memory, and whether it matches the digest calculated from the digital signature stored in advance for each block. It is conceivable to verify the data of each block depending on whether or not.
しかし、この検証方法では、ブロックの数だけダイジェストを算出することになるので、ブロック数が増加するほど検証に要する処理時間が増加するという問題がある。
本開示の一側面は、ブロック毎にデータを書き換え可能な複数のブロックを有する不揮発性メモリに記憶されている全領域のデータの正当性を検証するために要する処理時間を短縮する技術を提供する。
However, in this verification method, since the digest is calculated by the number of blocks, there is a problem that the processing time required for verification increases as the number of blocks increases.
One aspect of the present disclosure provides a technique for reducing the processing time required to verify the validity of data in all areas stored in a nonvolatile memory having a plurality of blocks in which data can be rewritten for each block. ..
本開示の一態様は、不揮発性メモリ(70)と、書き換え可能な不揮発性の記憶部(70、100)と、第1の算出部(S414、S480)と、第2の算出部(S416、S482)と、検証部(S418、S484)と、を備えている。 One aspect of the present disclosure is a nonvolatile memory (70), a rewritable nonvolatile storage unit (70, 100), a first calculation unit (S414, S480), and a second calculation unit (S416, S482) and a verification unit (S418, S484).
不揮発性メモリは、ブロック毎にデータを書き換え可能な複数のブロックを有している。書き換え可能な不揮発性の記憶部は、複数のブロックの全領域のデータの正当性の検証に使用される全領域電子署名(96、102)を記憶する。 The non-volatile memory has a plurality of blocks in which data can be rewritten for each block. The rewritable non-volatile storage unit stores all-area digital signatures (96, 102) used for verifying the correctness of data in all areas of a plurality of blocks.
第1の算出部は、全領域のデータから第1の全領域ダイジェストを算出する。第2の算出部は、記憶部に記憶されている全領域電子署名から検証鍵(64)を使用して第2の全領域ダイジェストを算出する。検証部は、所定のタイミングで、第1の算出部が算出する第1の全領域ダイジェストと、第2の算出部が算出する第2の全領域ダイジェストとが一致しているか否かの判定結果に基づいて、全領域のデータの正当性を検証する。 The first calculation unit calculates a first whole area digest from the data of the whole area. The second calculation unit calculates the second whole area digest from the whole area electronic signature stored in the storage unit using the verification key (64). The verification unit determines whether or not the first full-area digest calculated by the first calculation unit and the second full-area digest calculated by the second calculation unit match at a predetermined timing. Based on, the validity of the data in all areas is verified.
この構成によれば、ブロック毎にダイジェストを算出せず全領域のデータから一つの第1の全領域ダイジェストを算出する。そして、全領域電子署名から算出された一つの第2の全領域ダイジェストと、第1の全領域ダイジェストとが一致しているか否かの判定結果に基づいて、不揮発性メモリの複数のブロックについて全領域のデータの正当性を検証する。 According to this structure, one first whole area digest is calculated from the data of all areas without calculating the digest for each block. Then, based on the determination result of whether or not the one second whole-area digest calculated from the whole-area digital signature matches the first whole-area digest, all the blocks of the non-volatile memory are Verify the legitimacy of the area data.
不揮発性メモリの全領域のデータの正当性を検証するときに、第1の全領域ダイジェストと第2の全領域ダイジェストとを一つずつ算出すればよいので、検証に要する処理時間を短縮できる。 When verifying the correctness of the data in all areas of the non-volatile memory, the first whole area digest and the second whole area digest may be calculated one by one, so that the processing time required for the verification can be shortened.
尚、この欄および特許請求の範囲に記載した括弧内の符号は、一つの態様として後述する実施形態に記載の具体的手段との対応関係を示すものであって、本開示の技術的範囲を限定するものではない。 Note that the reference numerals in parentheses described in this column and in the claims indicate the correspondence with the specific means described in the embodiments described below as one aspect, and do not indicate the technical scope of the present disclosure. It is not limited.
以下、本開示が適用された実施形態を図に基づいて説明する。
[1.第1実施形態]
[1−1.構成]
図1に示す電子制御装置2は、通信部10と、CPU20と、RAM30と、ROM40と、フラッシュメモリ70とを備えるマイクロコンピュータを搭載している。以下、電子制御装置をECUとも言う。
Hereinafter, an embodiment to which the present disclosure is applied will be described based on the drawings.
[1. First Embodiment]
[1-1. Constitution]
The
通信部10は、通信部10に接続する外部の書き換えツール200と通信する。ECU2と書き換えツール200との通信は、有線でもよいし無線でもよい。CPU20は、ROM40またはフラッシュメモリ70に記憶されているプログラムを実行する。RAM30は、CPU20がプログラムを実行するときに、一時的なデータの記憶領域として使用される。
The
ROM40は、セキュア領域50とブート領域60とを備えている。フラッシュメモリ70は、OS領域80とアプリケーションプログラム領域90とを備えている。以下、アプリケーションプログラムを単にアプリとも言う。
The
セキュア領域50には、セキュアプログラム52と、ダイジェスト生成鍵54と、ダイジェスト期待値56とが記憶されている。セキュアプログラム52は、ブートローダ62の正当性を検証するプログラムである。ダイジェスト生成鍵54は、ブートローダ62のデータからダイジェストを算出するための秘密鍵である。ダイジェスト期待値56は、正当なブートローダ62のデータから算出されると期待されるダイジェストの値である。
The
ブート領域60には、ブートローダ62と、公開鍵である電子署名検証鍵64とが記憶されている。ブートローダ62は、OS82の正当性を検証してOS82を起動する。電子署名検証鍵64は、電子署名からダイジェストを算出したり、ダイジェストを暗号化したりするために使用される。
In the
OS領域80には、OS82と、ブートローダ62がOS82の正当性を検証するときに使用するOS電子署名84とが記憶されている。
アプリ領域90は、複数のアプリを記憶する複数のブロックで構成されている。図1では、4個のアプリに対応して4個のブロックを例示しているが、アプリ領域90のブロック数は4個に限るものではなく、複数であればよい。
The
The
アプリ領域90の各ブロックには、アプリ92と、アプリ電子署名94と、全領域電子署名96と、カウンタ98とが記憶されている。
アプリ電子署名94は、各アプリ92のデータの正当性を検証するための電子署名である。アプリ電子署名94は、該当するブロックのアプリ92が書き換えられるときに、書き換えデータとともに書き換えツール200から送信される電子署名により書き換えられる。
In each block of the
The application
全領域電子署名96は、アプリ領域90の全領域のデータの正当性を検証するための電子署名である。全領域電子署名96は、書き換え対象のブロックが書き換えられるときに、書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとから算出されたダイジェストから算出された電子署名により書き換えられる。
The entire area
カウンタ98は、各ブロックに記憶されている全領域電子署名96のどれが最新であるかを判別するための判別情報である。例えば、最新の全領域電子署名96が記憶されているブロックのカウンタ98の値は、他のブロックよりも大きい最大値に設定される。
The
書き換えツール200は、ECU2と通信する通信部210を備えている。さらに、書き換えツール200は、ECU2から送信される暗号化されたダイジェストを復号化し、復号化したダイジェストから電子署名を算出するときに使用する秘密鍵である電子署名生成鍵220を記憶している。書き換えツール200は、アプリ領域90の書き換え対象のブロックを書き換えるときに、ECU2に接続される。
The
[1−2.処理]
(1)検証処理
ROM40とフラッシュメモリ70とのデータの検証処理について、図2のフローチャートに基づいて説明する。図2のフローチャートは、ECU2の電源がオンになりECU2が起動されると実行される。
[1-2. processing]
(1) Verification Processing The verification processing of the data in the
S400においてCPU20は、セキュアプログラム52を実行することにより、ダイジェスト生成鍵54を使用してブートローダ62のダイジェストを算出する。S402においてCPU20は、S400で算出したダイジェストと、セキュア領域50に予め記憶されているブートローダ62のダイジェスト期待値56とが一致するか否かを判定する。
In S400, the
S402の判定がNoであり、S400で算出したダイジェストとダイジェスト期待値56とが一致しない場合、S404においてCPU20は、異常判定処理を実行後、図2の検証処理を終了する。これにより、ECU2は、アプリ92が実行されないまま処理を終了する。S404の異常判定処理として、異常原因をエラーコード等でフラッシュメモリ70のエラーコード領域に記憶することなどが実行される。
If the determination in S402 is No, and the digest calculated in S400 does not match the expected digest
S402の判定がYesであり、S400で算出したダイジェストとダイジェスト期待値56とが一致する場合、セキュアプログラム52はブートローダ62を起動する。
そして、S406においてCPU20は、ブートローダ62を実行することにより、OS領域80のデータのダイジェストをハッシュ関数等により算出する。
If the determination in S402 is Yes and the digest calculated in S400 matches the expected digest
Then, in S406, the
S408においてCPU20は、公開鍵である電子署名検証鍵64を使用して、OS領域80に記憶されているOS電子署名84から、OS領域80のデータのダイジェスト期待値を算出する。S410においてCPU20は、S406で算出したダイジェストと、S408で算出したダイジェスト期待値とが一致するか否かを判定する。
In S408, the
S410の判定がNoであり、S406で算出したダイジェストとS408で算出したダイジェスト期待値とが一致しない場合、CPU20は、前述したS404の異常判定処理を実行後、検証処理を終了する。
If the determination in S410 is No, and the digest calculated in S406 does not match the expected digest value calculated in S408, the
S410の判定がYesであり、S406で算出したダイジェストとS408で算出したダイジェスト期待値とが一致する場合、ブートローダ62はOS82を起動する。そして、S412〜S420においてCPU20は、OS82を実行することにより、アプリ領域90のデータの検証を行う。
If the determination in S410 is Yes and the digest calculated in S406 and the expected digest value calculated in S408 match, the
S412においてCPU20は、各ブロックのカウンタ98を参照し、最大値のカウンタ98が記憶されているブロックの全領域電子署名96が最新であると判断し、最新の全領域電子署名96を抽出する。
In S412, the
例えば、書き換え対象のブロックのデータが書き換えられるときに、書き換え対象のブロックのカウンタ98を、それまで最大であったカウンタ98の値よりも、例えば+1して更新する。これにより、各ブロックに記憶されているカウンタ98の値を参照すれば、最新の全領域電子署名96が記憶されているアプリ領域90のブロックを見つけることができる。
For example, when the data of the block to be rewritten is rewritten, the
CPU20は、S412で最新の全領域電子署名96を抽出すると、S414において、アプリ領域90の全領域のデータのダイジェストをハッシュ関数等から算出する。
尚、アプリ領域90の全領域のデータを検証するためにダイジェストを算出するときに算出対象とする全領域のデータには、各ブロックにおいて、アプリ電子署名94は含まれ、全領域電子署名96とカウンタ98とは除かれる。
When the
It should be noted that, in each block, the application
これは、後述する書き換え処理において生成される最新の全領域電子署名96は、最新の全領域電子署名96を含んだデータから生成できないからである。カウンタ98は最新の全領域電子署名96を判別するための判別情報であり、全領域電子署名96とセットのデータであるから、本実施形態では、アプリ領域90の全領域のデータを検証するためにダイジェストを算出するときの対象データから除いている。
This is because the latest all-area
S416においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、最新の全領域電子署名96からアプリ領域90の全領域データのダイジェスト期待値を算出する。
In S416, the
S418においてCPU20は、S414で算出したダイジェストとS416で算出したダイジェスト期待値とが一致するか否かを判定する。
S418の判定がNoであり、S414で算出したダイジェストとS416で算出したダイジェスト期待値とが一致しない場合、CPU20は、前述したS404の異常判定処理を実行後、検証処理を終了する。
In S418, the
When the determination in S418 is No and the digest calculated in S414 does not match the expected digest value calculated in S416, the
S418の判定がYesであり、S414で算出したダイジェストとS416で算出したダイジェスト期待値とが一致する場合、S420においてCPU20は、正常判定処理を実行後、図2の検証処理を終了する。CPU20は、正常判定処理において、アプリ領域90のアプリ92を実行できる環境を整え、該当するアプリ92に処理を移行する。
If the determination in S418 is Yes and the digest calculated in S414 matches the expected digest value calculated in S416, the
(2)書き換えツール200の書き換え処理
フラッシュメモリ70のアプリ領域90に対する書き換え処理について、図3のフローチャートに基づいて説明する。図3のフローチャートは、ECU2に書き換えツール200が接続されると、ECU2と書き換えツール200とにより実行される。図3において、符号300で表されるフローチャートは書き換えツール200が実行し、符号310で表されるフローチャートはECU2が実行する。
(2) Rewriting Process of
ECU2に書き換えツール200が接続されると、S430において書き換えツール200は、書き換え対象のアプリ領域90のブロックに対する書き換えデータと書き換えデータの電子署名とを通信部210からECU2に送信する。そして、書き換えツール200は、後述する暗号化されたダイジェストを通信部210がECU2から受信するまで待機する。
When the
ECU2から受信する暗号化されたダイジェストは、アプリ領域90において、書き換え対象のブロックの書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとから算出されている。
In the
書き換えツール200は、ECU2が算出する暗号化したダイジェストをS432において受信すると、S434において、書き換えツール200が記憶している秘密鍵である電子署名生成鍵220を使用して、S432で受信した暗号化されたダイジェストを復号化する。
When the
S436において書き換えツール200は、S434で復号化したダイジェストから電子署名生成鍵220を使用して電子署名を生成する。S438において書き換えツール200は、S436で生成した電子署名をECU2に送信し、通信部210がECU2から書き換え結果を受信するまで待機する。
In S436, the
書き換えツール200は、ECU2から書き換え結果として書き換え正常終了を受信すると、S440において、正常終了を書き換えツール200のディスプレイ、ランプ、スピーカ等から報知する書き換え正常終了処理を実行し、書き換え処理を終了する。
When the
書き換えツール200は、ECU2から書き換え結果として書き換え異常終了を受信すると、S442において、異常終了を書き換えツール200のディスプレイ、ランプ、スピーカ等から報知する書き換え異常終了処理を実行し、書き換え処理を終了する。
When the
(3)ECU2の書き換え処理
CPU20は、書き換えツール200が接続されると、S450において書き換えツール200から書き換え対象のアプリ領域90のブロックに対する書き換えデータと書き換えデータの電子署名とを通信部10が受信するまで、フローチャート310の実行を待機する。
(3) Rewriting Process of
S450において書き換えツール200から書き換えデータと書き換えデータの電子署名とを通信部10が受信すると、S452においてCPU20は、受信した書き換えデータからハッシュ関数等によりダイジェストを算出する。S454においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、受信した電子署名から書き換えデータのダイジェスト期待値を算出する。
When the
S456においてCPU20は、S452で算出したダイジェストとS454で算出したダイジェスト期待値とが一致するか否かを判定する。
S456の判定がNoであり、S452で算出したダイジェストとS454で算出したダイジェスト期待値とが一致しない場合、S458においてCPU20は、書き換えデータが不正であることを書き換えツール200に送信し、書き換え処理を終了する。
In S456, the
When the determination in S456 is No, and the digest calculated in S452 does not match the expected digest value calculated in S454, the
S456の判定がYesであり、S452で算出したダイジェストとS454で算出したダイジェスト期待値とが一致する場合、S460においてCPU20は、書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとからハッシュ関数等によりダイジェストを算出する。
If the determination in S456 is Yes, and the digest calculated in S452 and the expected digest value calculated in S454 match, in S460, the
S460においてCPU20はさらに、各ブロックのカウンタ98の値を参照し、最大値のカウンタ98の値を+1してRAM30に記憶しておく。
S462においてCPU20は、S460で算出したダイジェストを電子署名検証鍵64を使用して暗号化する。S464においてCPU20は、S462で暗号化したダイジェストを書き換えツール200に送信し、S466で書き換えツール200から書き換えツール200が生成した電子署名を受信するまで待機する。
In S460, the
In S462, the
CPU20は、S466で書き換えツール200から電子署名を受信すると、S468において、S450で受信した書き換えデータと、S450で受信した書き換えデータの電子署名と、S460でRAM30に記憶したカウンタ値と、S466で受信した電子署名とで、書き換え対象のブロックにおいて、アプリ92と、アプリ電子署名94と、カウンタ98と、全領域電子署名96とを書き換える。RAM30に記憶したカウンタ値で書き換え対象のブロックのカウンタ98を書き換えることにより、カウンタ98の値は最新情報になる。
When the
例えば、図4に示すように、アプリ領域90の全ブロックに最初にデータを書き込む場合、CPU20は、書き換えツール200から受信する全領域電子署名と、カウンタ98の初期値として例えば「1」とを、いずれかのブロックに書き込む。図4では、書き換えツール200から受信した全領域電子署名とカウンタ98の初期値とが、アプリ1のブロックに書き込まれている。他のアプリ2〜4の全領域電子署名96とカウンタ98とは「NULL」である。
For example, as shown in FIG. 4, when data is first written in all blocks of the
その後、アプリ3、アプリ2のデータが順に書き換えられると、アプリ3、アプリ2の全領域電子署名96とカウンタ98とが順に書き換えられる。
S470の判定がYesであり、書き換え対象のブロックに対する書き換えが正常に終了すると、S472においてCPU20は、書き換え正常終了を書き換えツール200に送信し、書き換え処理を終了する。
After that, when the data of the
When the determination in S470 is Yes and the rewriting of the block to be rewritten ends normally, the
S470の判定がNoであり、書き換え対象のブロックに対する書き換えが正常に終了しなかった場合、S474においてCPU20は、書き換え異常終了を書き換えツール200に送信し、書き換え処理を終了する。
If the determination in S470 is No, and rewriting of the block to be rewritten did not end normally, in S474, the
[1−3.効果]
以上説明した第1実施形態では、以下の効果を得ることができる。
(1)ECU2の起動時に、アプリ領域90の全領域のデータから一つのダイジェストを算出し、最新の全領域電子署名96から算出した一つのダイジェスト期待値と一致するか否かにより、CPU20はアプリ領域90のデータの正当性を検証する。
[1-3. effect]
The following effects can be obtained in the first embodiment described above.
(1) When the
これにより、検証精度を低下させることなく、アプリ領域90の各ブロックのデータからそれぞれダイジェストを算出し、各ブロックの電子署名からそれぞれダイジェスト期待値を算出してデータの正当性を検証するよりも、検証に要する処理時間を短縮できる。
With this, without lowering the verification accuracy, rather than calculating the digest from the data of each block of the
(2)書き換え処理において、書き換えツール200で記憶している電子署名生成鍵220を使用して書き換えツール200が全領域電子署名96に対応する電子署名を生成するので、書き換えツール200がECU2に電子署名生成鍵220を送信し、ECU2側で全領域電子署名96を生成する必要がない。これにより、秘密鍵である電子署名生成鍵220の漏洩の可能性を抑制できる。
(2) In the rewriting process, the
(3)書き換え処理において、書き換えツール200が全領域電子署名96に対応する電子署名を生成するので、ECU2と書き換えツール200と以外のツールで予め全領域電子署名96に対応する電子署名を生成しておく必要がない。
(3) In the rewriting process, the
(4)書き換え処理のときに、ECU2から書き換えツール200にアプリ領域90のデータのダイジェストを暗号化して送信するので、どのようなデータがECU2から書き換えツール200に送信されているかを第3者に検知されることを抑制できる。
(4) During the rewriting process, the
(5)全領域電子署名96とカウンタ98とを、アプリと同じフラッシュメモリ70に記憶しているので、全領域電子署名96とカウンタ98とを記憶するために、フラッシュメモリ70とは別のメモリを用意する必要がない。
(5) Since the entire area
上記第1実施形態では、ECU2が電子制御装置に対応し、通信部10が通信部に対応し、フラッシュメモリ70がブロック毎に書き換え可能な複数のブロックを有する不揮発性メモリに対応し、全領域電子署名96を記憶しているフラッシュメモリ70の領域が記憶部に対応し、書き換えツール200が書き換えツールに対応する。
In the first embodiment, the
また、電子署名検証鍵64が検証鍵に対応し、電子署名生成鍵220が秘密鍵に対応し、全領域電子署名96が全領域電子署名に対応し、カウンタ98が判別情報に対応する。
また、S414、S452、S460が第1の算出部の処理に対応し、S416、S454が第2の算出部の処理に対応し、S418、S456が検証部の処理に対応し、S450、S458、S464、S466、S472、S474が通信部の処理に対応し、S462が暗号化部の処理に対応し、S468がデータ書き換え部と署名書き換え部との処理に対応する。
Further, the electronic
Further, S414, S452, and S460 correspond to the processing of the first calculation unit, S416 and S454 correspond to the processing of the second calculation unit, S418 and S456 correspond to the processing of the verification unit, and S450, S458, S464, S466, S472, and S474 correspond to the processing of the communication unit, S462 corresponds to the processing of the encryption unit, and S468 corresponds to the processing of the data rewriting unit and the signature rewriting unit.
また、S414で算出されるダイジェストが第1の全領域ダイジェストに対応し、S416で算出されるダイジェスト期待値が第2の全領域ダイジェストに対応し、S450で書き換えツール200から受信する書き換えデータの電子署名がデータ電子署名に対応し、S452で算出されるダイジェストが第1のブロックダイジェストに対応し、S454で算出されるダイジェスト期待値が第2のブロックダイジェストに対応し、S460で算出されるダイジェストが第3の全領域ダイジェストに対応する。
Further, the digest calculated in S414 corresponds to the first full-area digest, the expected digest value calculated in S416 corresponds to the second full-area digest, and the electronic data of the rewriting data received from the
[2.第2実施形態]
[2−1.第1実施形態との相違点]
次に、第2実施形態の不揮発性メモリの構成について説明する。尚、第1実施形態と同じ構成部分については同一符号を用いる。第1実施形態と同一符号については、先行する説明を参照する。
[2. Second Embodiment]
[2-1. Differences from the first embodiment]
Next, the configuration of the nonvolatile memory according to the second embodiment will be described. The same components as those of the first embodiment are designated by the same reference numerals. The same reference numerals as in the first embodiment refer to the preceding description.
図5に示すように、第2実施形態のECU4では、アプリ領域90を備えるフラッシュメモリ70とは異なるフラッシュメモリ100に、アプリ領域90の全領域に対する全領域電子署名102を一つ記憶している。尚、同じフラッシュメモリ70のアプリ領域90とは異なる領域に、一つの全領域電子署名102を記憶してもよい。
As shown in FIG. 5, in the
[2−2.処理]
(1)検証処理
ROM40とフラッシュメモリ70とのデータの検証処理について、図6のフローチャートに基づいて説明する。図6のフローチャートは、ECU4の電源がオンになりECU4が起動されると実行される。図6のS400〜S410、S420は、図2のS400〜S410、S420と実質的に同じ処理である。
[2-2. processing]
(1) Verification Processing Data verification processing of the
S480においてCPU20は、アプリ領域90の全領域のデータのダイジェストをハッシュ関数等から算出する。S482においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、フラッシュメモリ100に記憶されている全領域電子署名102からアプリ領域90の全領域のデータのダイジェスト期待値を算出する。
In S480, the
S484においてCPU20は、S480で算出したダイジェストとS482で算出したダイジェスト期待値とが一致するか否かを判定する。
(2)書き換え処理
フラッシュメモリ70のアプリ領域90に対する書き換え処理について、図7のフローチャートに基づいて説明する。図7のフローチャートは、ECU2に書き換えツール200が接続されると、ECU2と書き換えツール200とにより実行される。
In S484, the
(2) Rewriting Process The rewriting process for the
図7のS430〜S442、S450〜S458、S470〜S474は、図3のS430〜S442、S450〜S458、S470〜S474と実質的に同じ処理である。
S490においてCPU20は、書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとからハッシュ関数等によりダイジェストを算出する。
S430 to S442, S450 to S458, S470 to S474 of FIG. 7 are substantially the same processes as S430 to S442, S450 to S458, and S470 to S474 of FIG.
In S490, the
S492においてCPU20は、S490で算出したダイジェストを電子署名検証鍵64を使用して暗号化する。S494においてCPU20は、S492で暗号化したダイジェストを書き換えツール200に送信し、S496で書き換えツール200から書き換えツール200が生成した電子署名を受信するまで待機する。
In S492, the
S498においてCPU20は、S496で書き換えツール200から受信した電子署名で、フラッシュメモリ100に記憶されている全領域電子署名102を書き換える。
S500においてCPU20は、S450で書き換えツール200から受信した書き換えデータと書き換えデータの電子署名とで、書き換え対象のブロックのアプリ92とアプリ電子署名94とを書き換える。
In S498, the
In S500, the
[2−3.効果]
上記第2実施形態によると、第1実施形態の効果(1)において最新の全領域電子署名96を全領域電子署名102に置き換えた効果と、第1実施形態の効果(2)〜(4)とを得ることができる。
[2-3. effect]
According to the second embodiment, the effect of replacing the latest full-area
さらに、第2実施形態によると、アプリ領域90のブロック数に関わらず、全領域電子署名102を一つだけ記憶すればよいので、全領域電子署名102を記憶するためのメモリの使用量を低減できる。
Furthermore, according to the second embodiment, only one whole-area
上記第2実施形態では、全領域電子署名102が全領域電子署名に対応し、全領域電子署名102を記憶しているフラッシュメモリ100の領域が記憶部に対応する。
また、第2実施形態では、S480、S490が第1の算出部の処理に対応し、S482が第2の算出部の処理に対応し、S484が検証部の処理に対応し、S492が暗号化部に対応し、S494、S496が通信部の処理に対応し、S498が署名書き換え部の処理に対応し、S500がデータ書き換え部の処理に対応する。
In the second embodiment, the full-area
In the second embodiment, S480 and S490 correspond to the processing of the first calculation unit, S482 corresponds to the processing of the second calculation unit, S484 corresponds to the processing of the verification unit, and S492 encrypts. S494, S496 correspond to the processing of the communication unit, S498 corresponds to the processing of the signature rewriting unit, and S500 corresponds to the processing of the data rewriting unit.
[3.他の実施形態]
(1)上記実施形態では、ECU2、4は、アプリ領域90のデータから算出したダイジェストを暗号化して書き換えツール200に送信した。これに対し、アプリ領域90のデータから算出したダイジェストを暗号化せず、ダイジェストを直接、書き換えツール200に送信してもよい。
[3. Other Embodiments]
(1) In the above-described embodiment, the
(2)書き換え処理において、ECU2、4が書き換えツール200から書き換えデータと一緒に電子署名生成鍵220を受信し、アプリ領域90の全領域のデータの全領域電子署名を生成してもよい。
(2) In the rewriting process, the
この場合、ECU2、4は、書き換えデータと書き換え対象以外のブロックのデータとから算出したダイジェストを暗号化して書き換えツール200に送信する必要はなく、書き換え結果だけを書き換えツール200に送信する。これにより、ECU2、4と書き換えツール200との通信量が低減するので、書き換え時間を短縮できる。
In this case, the
(3)書き換えツール200において、これまでECU2、4に送信した書き換えデータに基づいて、書き換え前のアプリ領域90の全領域のデータの内容を記憶して管理しているのであれば、今回の書き換えデータにより書き換え対象のブロックが書き換えられた場合のアプリ領域90の全領域のデータから、書き換えツール200は秘密鍵である電子署名生成鍵220を使用して全領域電子署名を生成できる。
(3) If the
この構成では、書き換え処理において、書き換えツール200は、書き換えデータと、書き換えデータの電子署名と、全領域電子署名とをECU2、4に送信する。
(4)上記実施形態では、所定のタイミングとして、ECU2、4の電源がオンになりECU2、4が起動されると検証処理が実行される。これ以外にも、所定タイミングとして、例えば、所定の時間間隔で検証処理を実行してもよい。
With this configuration, in the rewriting process, the
(4) In the above embodiment, the verification process is executed when the
(5)上記第1実施形態では、検証処理においてCPU20は、各ブロックのカウンタ98を参照し、最大値のカウンタ98が記憶されているブロックの全領域電子署名96を最新の全領域電子署名96として抽出した。
(5) In the first embodiment, in the verification process, the
これに対し、以下の方法で最新の全領域電子署名96を抽出してもよい。まず、書き換え処理においてCPU20は、書き換え回数をフラッシュメモリ70等に記憶しておき、書き換え対象のブロックのカウンタ98を書き換え処理の回数で書き換える。次に、検証処理においてCPU20は、フラッシュメモリ70等に記憶されている書き換え回数と一致するカウンタ98が記憶されているブロックの全領域電子署名96を最新の全領域電子署名96として抽出する。
On the other hand, the latest full area
(6)上記実施形態における一つの構成要素が有する複数の機能を複数の構成要素によって実現したり、一つの構成要素が有する一つの機能を複数の構成要素によって実現したりしてもよい。また、複数の構成要素が有する複数の機能を一つの構成要素によって実現したり、複数の構成要素によって実現される一つの機能を一つの構成要素によって実現したりしてもよい。また、上記実施形態の構成の一部を省略してもよい。また、上記実施形態の構成の少なくとも一部を、他の上記実施形態の構成に対して付加又は置換してもよい。尚、特許請求の範囲に記載した文言のみによって特定される技術思想に含まれるあらゆる態様が本開示の実施形態である。 (6) A plurality of functions of one constituent element in the above-described embodiment may be realized by a plurality of constituent elements, or one function of one constituent element may be realized by a plurality of constituent elements. Further, a plurality of functions of a plurality of constituent elements may be realized by one constituent element, or one function realized by a plurality of constituent elements may be realized by one constituent element. Moreover, you may omit a part of structure of the said embodiment. Further, at least a part of the configuration of the above-described embodiment may be added or replaced with respect to the configuration of the other above-described embodiment. Note that all aspects included in the technical idea specified only by the wording recited in the claims are embodiments of the present disclosure.
(7)上述したECU2、4の他、当該ECU2、4を構成要素とする電子制御システム、当該ECU2、4としてコンピュータを機能させるためのデータ検証プログラムおよびデータ書き換えプログラム、このデータ検証プログラムおよびデータ書き換えプログラムを記録した記録媒体、データ検証方法およびデータ書き換え方法など、種々の形態で本開示を実現することもできる。
(7) In addition to the
2、4:ECU(電子制御装置)、10:通信部、20:CPU、64:電子署名検証鍵(検証鍵)、70:フラッシュメモリ(書き換え可能な不揮発性メモリ、記憶部)、96、102:全領域電子署名、98:カウンタ(判別情報)、100:フラッシュメモリ(記憶部)、200:書き換えツール、220:電子署名生成鍵(秘密鍵) 2, 4: ECU (electronic control unit), 10: communication unit, 20: CPU, 64: electronic signature verification key (verification key), 70: flash memory (rewritable non-volatile memory, storage unit), 96, 102 : All-area digital signature, 98: Counter (discrimination information), 100: Flash memory (storage unit), 200: Rewriting tool, 220: Digital signature generation key (secret key)
Claims (8)
前記全領域のデータから第1の全領域ダイジェストを算出する第1の算出部(S414)と、
前記ブロック毎に記憶されている前記全領域電子署名のいずれが最新であるかを判別する判別情報(98)に基づいて、最新の前記全領域電子署名から検証鍵(64)を使用して第2の全領域ダイジェストを算出する第2の算出部(S416)と、
所定のタイミングで、前記第1の算出部が算出する前記第1の全領域ダイジェストと、前記第2の算出部が算出する前記第2の全領域ダイジェストとが一致しているか否かの判定結果に基づいて、前記全領域のデータの正当性を検証する検証部(S418)と、
を備える電子制御装置(2)。 It has a plurality of blocks rewritable data for each block, a storage unit for storing the entire area electronic signature (96) used to verify the validity of the data of all areas of the plurality of blocks for each of the blocks A non-volatile memory (70) in which the full-area digital signature stored in the storage unit of the block to be rewritten is rewritten when data in any one of the plurality of blocks is rewritten ,
A first calculation unit ( S414 ) for calculating a first whole-area digest from the data of the whole area;
Based on the discrimination information (98) for discriminating which one of the all-area electronic signatures stored for each block is the latest, a verification key (64) is used from the latest all-area electronic signature to obtain the first A second calculation unit ( S416 ) for calculating the full-area digest of 2;
At a predetermined timing, a determination result of whether or not the first full-area digest calculated by the first calculation unit and the second full-area digest calculated by the second calculation unit are coincident with each other. A verification unit ( S418 ) for verifying the correctness of the data in all the areas based on
An electronic control unit ( 2 ) comprising.
外部の書き換えツール(200)と通信する通信部(10、S450、S458、S464、S466、S472、S474)をさらに備え、
さらに前記第1の算出部(S460)は、前記複数のブロックのうち書き換え対象のブロックに対する書き換えデータを前記書き換えツールから前記通信部が受信すると、書き換え対象以外の前記ブロックのデータと、前記通信部が前記書き換えツールから受信する前記書き換えデータとから第3の全領域ダイジェストを算出し、
前記第1の算出部が算出する前記第3の全領域ダイジェストから前記書き換えツールまたは当該電子制御装置が秘密鍵(220)を使用して生成する電子署名で前記全領域電子署名を書き換える署名書き換え部(S468)と、
前記書き換えデータで書き換え対象の前記ブロックのデータを書き換えるデータ書き換え部(S468)と、をさらに備える、
電子制御装置。 The electronic control unit according to claim 1,
A communication unit ( 10, S450, S458, S464, S466, S472, S474 ) for communicating with an external rewriting tool (200),
Further, when the communication unit receives the rewrite data for the rewrite target block among the plurality of blocks from the rewrite tool, the first calculation unit (S460) and the data of the block other than the rewrite target and the communication unit Calculates a third full-area digest from the rewriting data received from the rewriting tool,
A signature rewriting unit that rewrites the full-area digital signature with an electronic signature generated from the third full-area digest calculated by the first calculation unit by the rewriting tool or the electronic control device using a secret key (220). ( S468 )
And a data rewriting unit ( S468 ) for rewriting the data of the block to be rewritten with the rewriting data.
Electronic control unit.
外部の書き換えツール(200)と通信する通信部(10)をさらに備え、
前記書き換えツールは、これまで前記書き換えツールが前記通信部に送信した書き換え対象のブロックに対する書き換えデータに基づいて書き換え前の前記全領域のデータの内容を管理しており、
前記通信部は、今回の前記書き換えデータにより書き換え対象の前記ブロックが書き換えられた場合の前記全領域のデータに基づいて前記書き換えツールが秘密鍵(220)を使用して生成する電子署名と今回の前記書き換えデータとを前記書き換えツールから受信し、
前記通信部が受信する前記電子署名で前記全領域電子署名を書き換える署名書き換え部(S468)と、
前記通信部が受信する前記書き換えデータで書き換え対象の前記ブロックのデータを書き換えるデータ書き換え部(S468)と、をさらに備える、
電子制御装置。 The electronic control unit according to claim 1,
A communication unit (10) for communicating with an external rewriting tool (200),
The rewriting tool manages the contents of the data in the entire area before rewriting based on the rewriting data for the block to be rewritten that the rewriting tool has transmitted to the communication unit.
The communication unit uses an electronic signature generated by the rewriting tool using the secret key (220) based on the data in the entire area when the block to be rewritten is rewritten by the rewriting data this time, and Receiving the rewriting data from the rewriting tool,
A signature rewriting unit ( S468 ) for rewriting the full-area digital signature with the digital signature received by the communication unit;
A data rewriting unit ( S468 ) for rewriting the data of the block to be rewritten with the rewriting data received by the communication unit,
Electronic control unit.
さらに前記第1の算出部(S452)は、前記書き換えデータから第1のブロックダイジェストを算出し、
さらに前記第2の算出部(S454)は、前記書き換えデータとともに前記書き換えツールから受信する前記書き換えデータのデータ電子署名から前記検証鍵を使用して第2のブロックダイジェストを算出し、
さらに前記検証部(S456)は、前記第1の算出部が算出する前記第1のブロックダイジェストと、前記第2の算出部が算出する前記第2のブロックダイジェストとが一致しているか否かの判定結果に基づいて、前記書き換えデータの正当性を検証し、
前記第1のブロックダイジェストと前記第2のブロックダイジェストとが一致していると前記検証部が判定すると、前記データ書き換え部は、前記書き換えデータで書き換え対象の前記ブロックのデータを書き換え、前記署名書き換え部は、前記秘密鍵を使用して算出される前記電子署名で前記全領域電子署名を書き換える、
電子制御装置。 The electronic control unit according to claim 2 or 3,
Furthermore, the first calculation unit (S452) calculates a first block digest from the rewrite data,
Further, the second calculator (S454) calculates a second block digest using the verification key from the data electronic signature of the rewrite data received from the rewrite tool together with the rewrite data,
Further, the verification unit (S456) determines whether or not the first block digest calculated by the first calculation unit and the second block digest calculated by the second calculation unit match. Based on the determination result, verify the validity of the rewrite data,
When the verification unit determines that the first block digest and the second block digest match, the data rewriting unit rewrites the data of the block to be rewritten with the rewriting data and rewrites the signature. The unit rewrites the whole area electronic signature with the electronic signature calculated using the secret key,
Electronic control unit.
前記通信部(S464、S466)は、前記第3の全領域ダイジェストを前記書き換えツールに送信し、前記第3の全領域ダイジェストから前記秘密鍵を使用して前記書き換えツールが算出する前記電子署名を前記書き換えツールから受信し、
前記署名書き換え部は、前記書き換えツールから受信する前記電子署名で前記全領域電子署名を書き換える、
電子制御装置。 The electronic control device according to claim 2 or claim 4 which cites claim 2,
The communication unit ( S464, S466 ) transmits the third full-area digest to the rewrite tool, and uses the secret key to calculate the electronic signature calculated by the rewrite tool from the third full-area digest. Received from the rewriting tool,
The signature rewriting unit rewrites the whole area electronic signature with the electronic signature received from the rewriting tool,
Electronic control unit.
前記第3の全領域ダイジェストを暗号化する暗号化部(S462)をさらに備え、
前記通信部は、前記暗号化部が暗号化した前記第3の全領域ダイジェストを前記書き換えツールに送信し、前記書き換えツールが復号化した前記第3の全領域ダイジェストから前記秘密鍵を使用して生成する電子署名を前記書き換えツールから受信する、
電子制御装置。 The electronic control device according to claim 5, wherein:
Further comprising an encryption unit ( S462 ) for encrypting the third full-area digest,
The communication unit transmits the third full-area digest encrypted by the encryption unit to the rewriting tool, and uses the secret key from the third full-area digest decrypted by the rewriting tool. Receive the electronic signature to be generated from the rewriting tool,
Electronic control unit.
さらに前記署名書き換え部は、前記第3の全領域ダイジェストから前記秘密鍵を使用して電子署名を生成し、生成した前記電子署名で前記全領域電子署名を書き換える、
電子制御装置。 The electronic control device according to claim 2 or claim 4 which cites claim 2,
Further, the signature rewriting unit generates an electronic signature from the third whole area digest using the secret key, and rewrites the whole area electronic signature with the generated electronic signature.
Electronic control unit.
前記記憶部は、前記全領域電子署名に加えて前記判別情報を記憶しており、
前記署名書き換え部は、書き換え対象の前記ブロックに対応する前記記憶部の前記全領域電子署名を書き換えるときに、書き換え対象の前記ブロックに対応する前記判別情報を最新情報に書き換える、
電子制御装置。 The electronic control device according to any one of claims 2 to 7 , wherein:
The storage unit stores the discrimination information in addition to the all-area electronic signature,
The signature rewriting unit rewrites the determination information corresponding to the block to be rewritten to the latest information when rewriting the full-area digital signature of the storage unit corresponding to the block to be rewritten,
Electronic control unit.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2016217323A JP6724732B2 (en) | 2016-11-07 | 2016-11-07 | Electronic control unit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2016217323A JP6724732B2 (en) | 2016-11-07 | 2016-11-07 | Electronic control unit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2018078373A JP2018078373A (en) | 2018-05-17 |
| JP6724732B2 true JP6724732B2 (en) | 2020-07-15 |
Family
ID=62150996
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2016217323A Active JP6724732B2 (en) | 2016-11-07 | 2016-11-07 | Electronic control unit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6724732B2 (en) |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002047998A (en) * | 2000-08-04 | 2002-02-15 | Suzuki Motor Corp | Vehicle control device |
| JP2008040707A (en) * | 2006-08-04 | 2008-02-21 | Fuji Xerox Co Ltd | Document processor and program |
| US8539238B2 (en) * | 2007-05-09 | 2013-09-17 | Intel Corporation | Authenticated nonvolatile memory signing operations |
| JP2009151553A (en) * | 2007-12-20 | 2009-07-09 | Mizuho Bank Ltd | Cash payment system and cash payment method |
| US9336410B2 (en) * | 2009-12-15 | 2016-05-10 | Micron Technology, Inc. | Nonvolatile memory internal signature generation |
| TWI496161B (en) * | 2010-08-06 | 2015-08-11 | Phison Electronics Corp | Memory identification code generating method, management method, controller and storage system |
| US8775682B1 (en) * | 2012-05-08 | 2014-07-08 | Google Inc. | Data synchronization with eventual consistency |
-
2016
- 2016-11-07 JP JP2016217323A patent/JP6724732B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2018078373A (en) | 2018-05-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11074371B2 (en) | Systems, methods and apparatuses for secure storage of data using a security-enhancing chip | |
| TWI749622B (en) | Firmware updating system and method | |
| US10719606B2 (en) | Security processor for an embedded system | |
| JP5690412B2 (en) | Hardware device key provisioning method and apparatus | |
| US11270003B2 (en) | Semiconductor device including secure patchable ROM and patch method thereof | |
| CN103186434A (en) | Method and system for recovering basic input/output system | |
| TWI760752B (en) | System for accelerating verification procedure for image file | |
| JP2021179982A (en) | Security systems and methods to prevent rollback attacks on silicon device firmware | |
| CN109445705B (en) | Firmware authentication method and solid state disk | |
| CN107430658A (en) | Fail-safe software certification and checking | |
| CN103220264A (en) | Methods to provide digital signature to secure flash programming function | |
| US11816202B2 (en) | Run-time code execution validation | |
| JP6930884B2 (en) | BIOS management device, BIOS management system, BIOS management method, and BIOS management program | |
| CN109814934B (en) | Data processing method, device, readable medium and system | |
| CN111695164B (en) | Electronic equipment and control methods | |
| CN115576483B (en) | Secure identity links between components of trusted computing infrastructure | |
| CN110175478A (en) | A kind of mainboard powering method, system and programming device | |
| US10613993B2 (en) | Method for protecting a program code, corresponding system and processor | |
| Dhobi et al. | Secure firmware update over the air using trustzone | |
| KR101954439B1 (en) | Soc having double security features, and double security method for soc | |
| US20240323016A1 (en) | Verify Public Keys by Devices without Secrets for the Generation of Respective Private Keys | |
| US20170177373A1 (en) | Platform key hierarchy | |
| KR20210134053A (en) | How to Validate Over-the-Air Updates | |
| JP6724732B2 (en) | Electronic control unit | |
| CN118694516A (en) | The device verifies the public key without having the secret used to generate the corresponding private key |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190123 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20191212 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20191224 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20200220 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20200526 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200608 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 6724732 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |