Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6724732B2 - Electronic control unit - Google Patents
[go: Go Back, main page]

JP6724732B2 - Electronic control unit - Google Patents

Electronic control unit Download PDF

Info

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
Application number
JP2016217323A
Other languages
Japanese (ja)
Other versions
JP2018078373A (en
Inventor
桂亮 西江
桂亮 西江
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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2016217323A priority Critical patent/JP6724732B2/en
Publication of JP2018078373A publication Critical patent/JP2018078373A/en
Application granted granted Critical
Publication of JP6724732B2 publication Critical patent/JP6724732B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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).

特開2015−55898号公報JP, 2015-55898, A

不揮発性メモリのデータを検証する場合、例えば、不揮発性メモリの複数のブロックのブロック毎にブロックのデータのダイジェストを算出し、予めブロック毎に記憶している電子署名から算出するダイジェストと一致するか否かにより各ブロックのデータを検証することが考えられる。 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実施形態の電子制御装置を示すブロック図。The block diagram which shows the electronic control unit of 1st Embodiment. 検証処理を示すフローチャート。The flowchart which shows a verification process. 書き換え処理を示すフローチャート。The flowchart which shows a rewriting process. 書き換え処理の過程を示す説明図。Explanatory drawing which shows the process of a rewriting process. 第2実施形態の電子制御装置を示すブロック図。The block diagram which shows the electronic controller of 2nd Embodiment. 検証処理を示すフローチャート。The flowchart which shows a verification process. 書き換え処理を示すフローチャート。The flowchart which shows a rewriting process.

以下、本開示が適用された実施形態を図に基づいて説明する。
[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 electronic control unit 2 shown in FIG. 1 is equipped with a microcomputer including a communication unit 10, a CPU 20, a RAM 30, a ROM 40, and a flash memory 70. Hereinafter, the electronic control unit is also referred to as an ECU.

通信部10は、通信部10に接続する外部の書き換えツール200と通信する。ECU2と書き換えツール200との通信は、有線でもよいし無線でもよい。CPU20は、ROM40またはフラッシュメモリ70に記憶されているプログラムを実行する。RAM30は、CPU20がプログラムを実行するときに、一時的なデータの記憶領域として使用される。 The communication unit 10 communicates with an external rewriting tool 200 connected to the communication unit 10. Communication between the ECU 2 and the rewriting tool 200 may be wired or wireless. The CPU 20 executes a program stored in the ROM 40 or the flash memory 70. The RAM 30 is used as a temporary data storage area when the CPU 20 executes a program.

ROM40は、セキュア領域50とブート領域60とを備えている。フラッシュメモリ70は、OS領域80とアプリケーションプログラム領域90とを備えている。以下、アプリケーションプログラムを単にアプリとも言う。 The ROM 40 includes a secure area 50 and a boot area 60. The flash memory 70 includes an OS area 80 and an application program area 90. Hereinafter, the application program is also simply referred to as an application.

セキュア領域50には、セキュアプログラム52と、ダイジェスト生成鍵54と、ダイジェスト期待値56とが記憶されている。セキュアプログラム52は、ブートローダ62の正当性を検証するプログラムである。ダイジェスト生成鍵54は、ブートローダ62のデータからダイジェストを算出するための秘密鍵である。ダイジェスト期待値56は、正当なブートローダ62のデータから算出されると期待されるダイジェストの値である。 The secure area 50 stores a secure program 52, a digest generation key 54, and a digest expected value 56. The secure program 52 is a program that verifies the legitimacy of the boot loader 62. The digest generation key 54 is a secret key for calculating the digest from the data of the boot loader 62. The expected digest value 56 is a value of a digest expected to be calculated from valid boot loader 62 data.

ブート領域60には、ブートローダ62と、公開鍵である電子署名検証鍵64とが記憶されている。ブートローダ62は、OS82の正当性を検証してOS82を起動する。電子署名検証鍵64は、電子署名からダイジェストを算出したり、ダイジェストを暗号化したりするために使用される。 In the boot area 60, a boot loader 62 and a digital signature verification key 64 which is a public key are stored. The boot loader 62 verifies the validity of the OS 82 and activates the OS 82. The electronic signature verification key 64 is used to calculate the digest from the electronic signature and to encrypt the digest.

OS領域80には、OS82と、ブートローダ62がOS82の正当性を検証するときに使用するOS電子署名84とが記憶されている。
アプリ領域90は、複数のアプリを記憶する複数のブロックで構成されている。図1では、4個のアプリに対応して4個のブロックを例示しているが、アプリ領域90のブロック数は4個に限るものではなく、複数であればよい。
The OS area 80 stores an OS 82 and an OS electronic signature 84 used when the boot loader 62 verifies the validity of the OS 82.
The application area 90 includes a plurality of blocks that store a plurality of applications. Although FIG. 1 illustrates four blocks corresponding to four applications, the number of blocks in the application area 90 is not limited to four and may be any number.

アプリ領域90の各ブロックには、アプリ92と、アプリ電子署名94と、全領域電子署名96と、カウンタ98とが記憶されている。
アプリ電子署名94は、各アプリ92のデータの正当性を検証するための電子署名である。アプリ電子署名94は、該当するブロックのアプリ92が書き換えられるときに、書き換えデータとともに書き換えツール200から送信される電子署名により書き換えられる。
In each block of the application area 90, an application 92, an application electronic signature 94, an entire area electronic signature 96, and a counter 98 are stored.
The application electronic signature 94 is an electronic signature for verifying the validity of the data of each application 92. The application electronic signature 94 is rewritten by the electronic signature transmitted from the rewriting tool 200 together with the rewriting data when the application 92 of the corresponding block is rewritten.

全領域電子署名96は、アプリ領域90の全領域のデータの正当性を検証するための電子署名である。全領域電子署名96は、書き換え対象のブロックが書き換えられるときに、書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとから算出されたダイジェストから算出された電子署名により書き換えられる。 The entire area electronic signature 96 is an electronic signature for verifying the validity of the data in the entire area of the application area 90. When the block to be rewritten is rewritten, the entire area electronic signature 96 is calculated from the rewriting data, the electronic signature of the rewriting data, and the data excluding the entire area electronic signature 96 and the counter 98 from the blocks other than the rewriting target. It is rewritten by the electronic signature calculated from the digest.

カウンタ98は、各ブロックに記憶されている全領域電子署名96のどれが最新であるかを判別するための判別情報である。例えば、最新の全領域電子署名96が記憶されているブロックのカウンタ98の値は、他のブロックよりも大きい最大値に設定される。 The counter 98 is discriminating information for discriminating which of the all-area electronic signatures 96 stored in each block is the latest. For example, the value of the counter 98 of the block in which the latest full area electronic signature 96 is stored is set to the maximum value larger than that of other blocks.

書き換えツール200は、ECU2と通信する通信部210を備えている。さらに、書き換えツール200は、ECU2から送信される暗号化されたダイジェストを復号化し、復号化したダイジェストから電子署名を算出するときに使用する秘密鍵である電子署名生成鍵220を記憶している。書き換えツール200は、アプリ領域90の書き換え対象のブロックを書き換えるときに、ECU2に接続される。 The rewriting tool 200 includes a communication unit 210 that communicates with the ECU 2. Furthermore, the rewriting tool 200 stores an electronic signature generation key 220 which is a secret key used when decrypting the encrypted digest transmitted from the ECU 2 and calculating an electronic signature from the decrypted digest. The rewriting tool 200 is connected to the ECU 2 when rewriting a block to be rewritten in the application area 90.

[1−2.処理]
(1)検証処理
ROM40とフラッシュメモリ70とのデータの検証処理について、図2のフローチャートに基づいて説明する。図2のフローチャートは、ECU2の電源がオンになりECU2が起動されると実行される。
[1-2. processing]
(1) Verification Processing The verification processing of the data in the ROM 40 and the flash memory 70 will be described based on the flowchart of FIG. The flowchart of FIG. 2 is executed when the power of the ECU 2 is turned on and the ECU 2 is activated.

S400においてCPU20は、セキュアプログラム52を実行することにより、ダイジェスト生成鍵54を使用してブートローダ62のダイジェストを算出する。S402においてCPU20は、S400で算出したダイジェストと、セキュア領域50に予め記憶されているブートローダ62のダイジェスト期待値56とが一致するか否かを判定する。 In S400, the CPU 20 executes the secure program 52 to calculate the digest of the boot loader 62 using the digest generation key 54. In S402, the CPU 20 determines whether or not the digest calculated in S400 and the expected digest value 56 of the boot loader 62 stored in advance in the secure area 50 match.

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 value 56, the CPU 20 in S404 executes the abnormality determination process and then ends the verification process in FIG. As a result, the ECU 2 ends the process without executing the application 92. As the abnormality determination processing in S404, the cause of the abnormality is stored in the error code area of the flash memory 70 as an error code or the like.

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 value 56, the secure program 52 activates the boot loader 62.
Then, in S406, the CPU 20 executes the boot loader 62 to calculate the digest of the data in the OS area 80 using a hash function or the like.

S408においてCPU20は、公開鍵である電子署名検証鍵64を使用して、OS領域80に記憶されているOS電子署名84から、OS領域80のデータのダイジェスト期待値を算出する。S410においてCPU20は、S406で算出したダイジェストと、S408で算出したダイジェスト期待値とが一致するか否かを判定する。 In S408, the CPU 20 uses the electronic signature verification key 64, which is a public key, to calculate the expected digest value of the data in the OS area 80 from the OS electronic signature 84 stored in the OS area 80. In S410, the CPU 20 determines whether the digest calculated in S406 matches the expected digest value calculated in S408.

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 CPU 20 executes the abnormality determination process in S404 described above, and then ends the verification process.

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 boot loader 62 activates the OS 82. Then, in S412 to S420, the CPU 20 executes the OS 82 to verify the data in the application area 90.

S412においてCPU20は、各ブロックのカウンタ98を参照し、最大値のカウンタ98が記憶されているブロックの全領域電子署名96が最新であると判断し、最新の全領域電子署名96を抽出する。 In S412, the CPU 20 refers to the counter 98 of each block, determines that the all-area electronic signature 96 of the block in which the maximum-value counter 98 is stored is the latest, and extracts the latest all-area electronic signature 96.

例えば、書き換え対象のブロックのデータが書き換えられるときに、書き換え対象のブロックのカウンタ98を、それまで最大であったカウンタ98の値よりも、例えば+1して更新する。これにより、各ブロックに記憶されているカウンタ98の値を参照すれば、最新の全領域電子署名96が記憶されているアプリ領域90のブロックを見つけることができる。 For example, when the data of the block to be rewritten is rewritten, the counter 98 of the block to be rewritten is updated by, for example, incrementing the value of the counter 98, which has been the maximum until then, by +1. Thus, by referring to the value of the counter 98 stored in each block, it is possible to find the block of the application area 90 in which the latest all area electronic signature 96 is stored.

CPU20は、S412で最新の全領域電子署名96を抽出すると、S414において、アプリ領域90の全領域のデータのダイジェストをハッシュ関数等から算出する。
尚、アプリ領域90の全領域のデータを検証するためにダイジェストを算出するときに算出対象とする全領域のデータには、各ブロックにおいて、アプリ電子署名94は含まれ、全領域電子署名96とカウンタ98とは除かれる。
When the CPU 20 extracts the latest all-area electronic signature 96 in S412, the CPU 20 calculates the digest of the data in all areas of the application area 90 from a hash function or the like in S414.
It should be noted that, in each block, the application electronic signature 94 is included in the data of all the areas to be calculated when the digest is calculated in order to verify the data of all the areas of the application area 90. The counter 98 is excluded.

これは、後述する書き換え処理において生成される最新の全領域電子署名96は、最新の全領域電子署名96を含んだデータから生成できないからである。カウンタ98は最新の全領域電子署名96を判別するための判別情報であり、全領域電子署名96とセットのデータであるから、本実施形態では、アプリ領域90の全領域のデータを検証するためにダイジェストを算出するときの対象データから除いている。 This is because the latest all-area electronic signature 96 generated in the rewriting process described later cannot be generated from the data including the latest all-area electronic signature 96. The counter 98 is discrimination information for discriminating the latest electronic signature 96 of all areas, and is data set together with the electronic signature 96 of all areas. Therefore, in this embodiment, data of all areas of the application area 90 is verified. It is excluded from the target data when calculating the digest.

S416においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、最新の全領域電子署名96からアプリ領域90の全領域データのダイジェスト期待値を算出する。 In S416, the CPU 20 uses the electronic signature verification key 64 stored in the boot area 60 to calculate the expected digest value of the entire area data of the application area 90 from the latest electronic signature 96 of the entire area.

S418においてCPU20は、S414で算出したダイジェストとS416で算出したダイジェスト期待値とが一致するか否かを判定する。
S418の判定がNoであり、S414で算出したダイジェストとS416で算出したダイジェスト期待値とが一致しない場合、CPU20は、前述したS404の異常判定処理を実行後、検証処理を終了する。
In S418, the CPU 20 determines whether or not the digest calculated in S414 matches the expected digest value calculated in S416.
When the determination in S418 is No and the digest calculated in S414 does not match the expected digest value calculated in S416, the CPU 20 executes the abnormality determination process in S404 described above, and then ends the verification process.

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 CPU 20 ends the verification process in FIG. 2 after executing the normality determination process in S420. In the normality determination processing, the CPU 20 prepares an environment in which the application 92 in the application area 90 can be executed and shifts the processing to the corresponding application 92.

(2)書き換えツール200の書き換え処理
フラッシュメモリ70のアプリ領域90に対する書き換え処理について、図3のフローチャートに基づいて説明する。図3のフローチャートは、ECU2に書き換えツール200が接続されると、ECU2と書き換えツール200とにより実行される。図3において、符号300で表されるフローチャートは書き換えツール200が実行し、符号310で表されるフローチャートはECU2が実行する。
(2) Rewriting Process of Rewriting Tool 200 The rewriting process for the application area 90 of the flash memory 70 will be described based on the flowchart of FIG. The flowchart of FIG. 3 is executed by the ECU 2 and the rewriting tool 200 when the rewriting tool 200 is connected to the ECU 2. In FIG. 3, the flowchart represented by the reference numeral 300 is executed by the rewriting tool 200, and the flowchart represented by the reference numeral 310 is executed by the ECU 2.

ECU2に書き換えツール200が接続されると、S430において書き換えツール200は、書き換え対象のアプリ領域90のブロックに対する書き換えデータと書き換えデータの電子署名とを通信部210からECU2に送信する。そして、書き換えツール200は、後述する暗号化されたダイジェストを通信部210がECU2から受信するまで待機する。 When the rewriting tool 200 is connected to the ECU 2, the rewriting tool 200 transmits the rewriting data for the block of the application area 90 to be rewritten and the electronic signature of the rewriting data from the communication unit 210 to the ECU 2 in S430. Then, the rewriting tool 200 waits until the communication unit 210 receives the encrypted digest described below from the ECU 2.

ECU2から受信する暗号化されたダイジェストは、アプリ領域90において、書き換え対象のブロックの書き換えデータと、書き換えデータの電子署名と、書き換え対象以外のブロックから全領域電子署名96とカウンタ98とを除いたデータとから算出されている。 In the application area 90, the encrypted digest received from the ECU 2 is the rewriting data of the block to be rewritten, the electronic signature of the rewriting data, and the entire area electronic signature 96 and the counter 98 from the blocks other than the rewriting target. It is calculated from the data.

書き換えツール200は、ECU2が算出する暗号化したダイジェストをS432において受信すると、S434において、書き換えツール200が記憶している秘密鍵である電子署名生成鍵220を使用して、S432で受信した暗号化されたダイジェストを復号化する。 When the rewriting tool 200 receives the encrypted digest calculated by the ECU 2 in S432, the rewriting tool 200 uses the electronic signature generation key 220, which is the secret key stored in the rewriting tool 200, in S434 to encrypt the received digest in S432. Decrypt the digest that was done.

S436において書き換えツール200は、S434で復号化したダイジェストから電子署名生成鍵220を使用して電子署名を生成する。S438において書き換えツール200は、S436で生成した電子署名をECU2に送信し、通信部210がECU2から書き換え結果を受信するまで待機する。 In S436, the rewriting tool 200 uses the electronic signature generation key 220 to generate an electronic signature from the digest decrypted in S434. In S438, the rewriting tool 200 transmits the electronic signature generated in S436 to the ECU 2 and waits until the communication unit 210 receives the rewriting result from the ECU 2.

書き換えツール200は、ECU2から書き換え結果として書き換え正常終了を受信すると、S440において、正常終了を書き換えツール200のディスプレイ、ランプ、スピーカ等から報知する書き換え正常終了処理を実行し、書き換え処理を終了する。 When the rewriting tool 200 receives the rewriting normal end as the rewriting result from the ECU 2, the rewriting tool 200 executes the rewriting normal end process of notifying the normal end from the display, the lamp, the speaker, etc. of the rewriting tool 200, and ends the rewriting process.

書き換えツール200は、ECU2から書き換え結果として書き換え異常終了を受信すると、S442において、異常終了を書き換えツール200のディスプレイ、ランプ、スピーカ等から報知する書き換え異常終了処理を実行し、書き換え処理を終了する。 When the rewriting tool 200 receives the rewriting abnormal end as the rewriting result from the ECU 2, the rewriting tool 200 executes the rewriting abnormal end process of notifying the abnormal end from the display, the lamp, the speaker or the like of the rewriting tool 200 in S442, and ends the rewriting process.

(3)ECU2の書き換え処理
CPU20は、書き換えツール200が接続されると、S450において書き換えツール200から書き換え対象のアプリ領域90のブロックに対する書き換えデータと書き換えデータの電子署名とを通信部10が受信するまで、フローチャート310の実行を待機する。
(3) Rewriting Process of ECU 2 When the rewriting tool 200 is connected, the communication unit 10 of the CPU 20 receives the rewriting data for the block of the application area 90 to be rewritten and the electronic signature of the rewriting data from the rewriting tool 200 in S450. Until then, execution of the flowchart 310 is awaited.

S450において書き換えツール200から書き換えデータと書き換えデータの電子署名とを通信部10が受信すると、S452においてCPU20は、受信した書き換えデータからハッシュ関数等によりダイジェストを算出する。S454においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、受信した電子署名から書き換えデータのダイジェスト期待値を算出する。 When the communication unit 10 receives the rewriting data and the electronic signature of the rewriting data from the rewriting tool 200 in S450, the CPU 20 calculates a digest from the received rewriting data by a hash function or the like in S452. In S454, the CPU 20 uses the electronic signature verification key 64 stored in the boot area 60 to calculate the digest expected value of the rewrite data from the received electronic signature.

S456においてCPU20は、S452で算出したダイジェストとS454で算出したダイジェスト期待値とが一致するか否かを判定する。
S456の判定がNoであり、S452で算出したダイジェストとS454で算出したダイジェスト期待値とが一致しない場合、S458においてCPU20は、書き換えデータが不正であることを書き換えツール200に送信し、書き換え処理を終了する。
In S456, the CPU 20 determines whether or not the digest calculated in S452 and the expected digest value calculated in S454 match.
When the determination in S456 is No, and the digest calculated in S452 does not match the expected digest value calculated in S454, the CPU 20 in S458 transmits to the rewriting tool 200 that the rewriting data is invalid, and the rewriting process is performed. finish.

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 CPU 20 causes the rewrite data, the electronic signature of the rewrite data, and all blocks from the block other than the rewrite target. A digest is calculated by a hash function or the like from the data excluding the area electronic signature 96 and the counter 98.

S460においてCPU20はさらに、各ブロックのカウンタ98の値を参照し、最大値のカウンタ98の値を+1してRAM30に記憶しておく。
S462においてCPU20は、S460で算出したダイジェストを電子署名検証鍵64を使用して暗号化する。S464においてCPU20は、S462で暗号化したダイジェストを書き換えツール200に送信し、S466で書き換えツール200から書き換えツール200が生成した電子署名を受信するまで待機する。
In S460, the CPU 20 further refers to the value of the counter 98 of each block, increments the value of the counter 98 having the maximum value, and stores it in the RAM 30.
In S462, the CPU 20 encrypts the digest calculated in S460 using the electronic signature verification key 64. In S464, the CPU 20 transmits the digest encrypted in S462 to the rewriting tool 200, and waits in S466 until the electronic signature generated by the rewriting tool 200 is received from the rewriting tool 200.

CPU20は、S466で書き換えツール200から電子署名を受信すると、S468において、S450で受信した書き換えデータと、S450で受信した書き換えデータの電子署名と、S460でRAM30に記憶したカウンタ値と、S466で受信した電子署名とで、書き換え対象のブロックにおいて、アプリ92と、アプリ電子署名94と、カウンタ98と、全領域電子署名96とを書き換える。RAM30に記憶したカウンタ値で書き換え対象のブロックのカウンタ98を書き換えることにより、カウンタ98の値は最新情報になる。 When the CPU 20 receives the electronic signature from the rewriting tool 200 in S466, in S468, the rewriting data received in S450, the electronic signature of the rewriting data received in S450, the counter value stored in the RAM 30 in S460, and the receiving in S466. The application 92, the application electronic signature 94, the counter 98, and the entire area electronic signature 96 are rewritten in the block to be rewritten with the electronic signature. By rewriting the counter 98 of the block to be rewritten with the counter value stored in the RAM 30, the value of the counter 98 becomes the latest information.

例えば、図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 application area 90, the CPU 20 sets the entire area electronic signature received from the rewriting tool 200 and, for example, “1” as the initial value of the counter 98. , Write to any block. In FIG. 4, the full-area digital signature received from the rewriting tool 200 and the initial value of the counter 98 are written in the block of the application 1. The entire area electronic signatures 96 and the counters 98 of the other applications 2 to 4 are “NULL”.

その後、アプリ3、アプリ2のデータが順に書き換えられると、アプリ3、アプリ2の全領域電子署名96とカウンタ98とが順に書き換えられる。
S470の判定がYesであり、書き換え対象のブロックに対する書き換えが正常に終了すると、S472においてCPU20は、書き換え正常終了を書き換えツール200に送信し、書き換え処理を終了する。
After that, when the data of the application 3 and the application 2 are rewritten in order, the entire area electronic signature 96 and the counter 98 of the application 3 and the application 2 are rewritten in order.
When the determination in S470 is Yes and the rewriting of the block to be rewritten ends normally, the CPU 20 transmits the rewriting normal end to the rewriting tool 200 in S472, and ends the rewriting process.

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 CPU 20 sends a rewriting abnormal end to the rewriting tool 200, and ends the rewriting process.

[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 ECU 2 is started, one digest is calculated from the data of all the areas of the application area 90, and the CPU 20 determines whether or not one digest expected value calculated from the latest all-area electronic signature 96 matches. The validity of the data in the area 90 is verified.

これにより、検証精度を低下させることなく、アプリ領域90の各ブロックのデータからそれぞれダイジェストを算出し、各ブロックの電子署名からそれぞれダイジェスト期待値を算出してデータの正当性を検証するよりも、検証に要する処理時間を短縮できる。 With this, without lowering the verification accuracy, rather than calculating the digest from the data of each block of the application area 90 and calculating the digest expected value from the electronic signature of each block to verify the validity of the data, The processing time required for verification can be shortened.

(2)書き換え処理において、書き換えツール200で記憶している電子署名生成鍵220を使用して書き換えツール200が全領域電子署名96に対応する電子署名を生成するので、書き換えツール200がECU2に電子署名生成鍵220を送信し、ECU2側で全領域電子署名96を生成する必要がない。これにより、秘密鍵である電子署名生成鍵220の漏洩の可能性を抑制できる。 (2) In the rewriting process, the rewriting tool 200 uses the electronic signature generation key 220 stored in the rewriting tool 200 to generate an electronic signature corresponding to the entire-area electronic signature 96. It is not necessary to transmit the signature generation key 220 and generate the entire area electronic signature 96 on the ECU 2 side. As a result, it is possible to suppress the possibility of leakage of the electronic signature generation key 220 that is the private key.

(3)書き換え処理において、書き換えツール200が全領域電子署名96に対応する電子署名を生成するので、ECU2と書き換えツール200と以外のツールで予め全領域電子署名96に対応する電子署名を生成しておく必要がない。 (3) In the rewriting process, the rewriting tool 200 generates an electronic signature corresponding to the entire area electronic signature 96. Therefore, a tool other than the ECU 2 and the rewriting tool 200 generates an electronic signature corresponding to the entire area electronic signature 96 in advance. There is no need to keep it.

(4)書き換え処理のときに、ECU2から書き換えツール200にアプリ領域90のデータのダイジェストを暗号化して送信するので、どのようなデータがECU2から書き換えツール200に送信されているかを第3者に検知されることを抑制できる。 (4) During the rewriting process, the ECU 2 encrypts and transmits the digest of the data in the application area 90 to the rewriting tool 200. Therefore, what kind of data is being transmitted from the ECU 2 to the rewriting tool 200 is given to a third party. It can suppress being detected.

(5)全領域電子署名96とカウンタ98とを、アプリと同じフラッシュメモリ70に記憶しているので、全領域電子署名96とカウンタ98とを記憶するために、フラッシュメモリ70とは別のメモリを用意する必要がない。 (5) Since the entire area electronic signature 96 and the counter 98 are stored in the same flash memory 70 as the application, in order to store the entire area electronic signature 96 and the counter 98, a memory different from the flash memory 70 is stored. There is no need to prepare.

上記第1実施形態では、ECU2が電子制御装置に対応し、通信部10が通信部に対応し、フラッシュメモリ70がブロック毎に書き換え可能な複数のブロックを有する不揮発性メモリに対応し、全領域電子署名96を記憶しているフラッシュメモリ70の領域が記憶部に対応し、書き換えツール200が書き換えツールに対応する。 In the first embodiment, the ECU 2 corresponds to an electronic control unit, the communication unit 10 corresponds to a communication unit, the flash memory 70 corresponds to a nonvolatile memory having a plurality of rewritable blocks, and the entire area The area of the flash memory 70 storing the electronic signature 96 corresponds to the storage unit, and the rewriting tool 200 corresponds to the rewriting tool.

また、電子署名検証鍵64が検証鍵に対応し、電子署名生成鍵220が秘密鍵に対応し、全領域電子署名96が全領域電子署名に対応し、カウンタ98が判別情報に対応する。
また、S414、S452、S460が第1の算出部の処理に対応し、S416、S454が第2の算出部の処理に対応し、S418、S456が検証部の処理に対応し、S450、S458、S464、S466、S472、S474が通信部の処理に対応し、S462が暗号化部の処理に対応し、S468がデータ書き換え部と署名書き換え部との処理に対応する。
Further, the electronic signature verification key 64 corresponds to the verification key, the electronic signature generation key 220 corresponds to the secret key, the entire area electronic signature 96 corresponds to the entire area electronic signature, and the counter 98 corresponds to the discrimination information.
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 rewriting tool 200 in S450. The signature corresponds to the data electronic signature, the digest calculated in S452 corresponds to the first block digest, the digest expected value calculated in S454 corresponds to the second block digest, and the digest calculated in S460 is Corresponds to the third full-area digest.

[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 ECU 4 of the second embodiment, one full area electronic signature 102 for all areas of the application area 90 is stored in a flash memory 100 different from the flash memory 70 including the application area 90. .. In addition, one whole area electronic signature 102 may be stored in an area different from the application area 90 of the same flash memory 70.

[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 ROM 40 and the flash memory 70 will be described based on the flowchart of FIG. The flowchart of FIG. 6 is executed when the power of the ECU 4 is turned on and the ECU 4 is activated. S400 to S410 and S420 of FIG. 6 are substantially the same processes as S400 to S410 and S420 of FIG.

S480においてCPU20は、アプリ領域90の全領域のデータのダイジェストをハッシュ関数等から算出する。S482においてCPU20は、ブート領域60に記憶されている電子署名検証鍵64を使用して、フラッシュメモリ100に記憶されている全領域電子署名102からアプリ領域90の全領域のデータのダイジェスト期待値を算出する。 In S480, the CPU 20 calculates a digest of data in the entire area of the application area 90 from a hash function or the like. In S482, the CPU 20 uses the electronic signature verification key 64 stored in the boot area 60 to obtain the expected digest value of the data in all areas of the application area 90 from the entire area electronic signature 102 stored in the flash memory 100. calculate.

S484においてCPU20は、S480で算出したダイジェストとS482で算出したダイジェスト期待値とが一致するか否かを判定する。
(2)書き換え処理
フラッシュメモリ70のアプリ領域90に対する書き換え処理について、図7のフローチャートに基づいて説明する。図7のフローチャートは、ECU2に書き換えツール200が接続されると、ECU2と書き換えツール200とにより実行される。
In S484, the CPU 20 determines whether or not the digest calculated in S480 matches the expected digest value calculated in S482.
(2) Rewriting Process The rewriting process for the application area 90 of the flash memory 70 will be described based on the flowchart of FIG. 7. The flowchart of FIG. 7 is executed by the ECU 2 and the rewriting tool 200 when the rewriting tool 200 is connected to the ECU 2.

図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 CPU 20 calculates a digest from the rewrite data, the electronic signature of the rewrite data, and the data excluding the full-area electronic signature 96 and the counter 98 from the blocks other than the rewrite target, using a hash function or the like.

S492においてCPU20は、S490で算出したダイジェストを電子署名検証鍵64を使用して暗号化する。S494においてCPU20は、S492で暗号化したダイジェストを書き換えツール200に送信し、S496で書き換えツール200から書き換えツール200が生成した電子署名を受信するまで待機する。 In S492, the CPU 20 encrypts the digest calculated in S490 using the electronic signature verification key 64. In S494, the CPU 20 transmits the digest encrypted in S492 to the rewriting tool 200, and waits in S496 until the electronic signature generated by the rewriting tool 200 is received from the rewriting tool 200.

S498においてCPU20は、S496で書き換えツール200から受信した電子署名で、フラッシュメモリ100に記憶されている全領域電子署名102を書き換える。
S500においてCPU20は、S450で書き換えツール200から受信した書き換えデータと書き換えデータの電子署名とで、書き換え対象のブロックのアプリ92とアプリ電子署名94とを書き換える。
In S498, the CPU 20 rewrites the entire area electronic signature 102 stored in the flash memory 100 with the electronic signature received from the rewriting tool 200 in S496.
In S500, the CPU 20 rewrites the application 92 and the application electronic signature 94 of the block to be rewritten with the rewriting data received from the rewriting tool 200 in S450 and the electronic signature of the rewriting data.

[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 digital signature 96 with the full-area digital signature 102 in the effect (1) of the first embodiment and the effects (2) to (4) of the first embodiment. And can be obtained.

さらに、第2実施形態によると、アプリ領域90のブロック数に関わらず、全領域電子署名102を一つだけ記憶すればよいので、全領域電子署名102を記憶するためのメモリの使用量を低減できる。 Furthermore, according to the second embodiment, only one whole-area digital signature 102 needs to be stored regardless of the number of blocks in the application area 90, so the amount of memory used for storing the whole-area electronic signature 102 is reduced. it can.

上記第2実施形態では、全領域電子署名102が全領域電子署名に対応し、全領域電子署名102を記憶しているフラッシュメモリ100の領域が記憶部に対応する。
また、第2実施形態では、S480、S490が第1の算出部の処理に対応し、S482が第2の算出部の処理に対応し、S484が検証部の処理に対応し、S492が暗号化部に対応し、S494、S496が通信部の処理に対応し、S498が署名書き換え部の処理に対応し、S500がデータ書き換え部の処理に対応する。
In the second embodiment, the full-area digital signature 102 corresponds to the full-area digital signature, and the area of the flash memory 100 storing the full-area digital signature 102 corresponds to the storage unit.
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 ECUs 2 and 4 encrypt the digest calculated from the data in the application area 90 and send it to the rewriting tool 200. On the other hand, the digest calculated from the data in the application area 90 may be directly transmitted to the rewriting tool 200 without being encrypted.

(2)書き換え処理において、ECU2、4が書き換えツール200から書き換えデータと一緒に電子署名生成鍵220を受信し、アプリ領域90の全領域のデータの全領域電子署名を生成してもよい。 (2) In the rewriting process, the ECUs 2 and 4 may receive the electronic signature generation key 220 together with the rewriting data from the rewriting tool 200 and generate the entire-area electronic signature of the data in the entire area of the application area 90.

この場合、ECU2、4は、書き換えデータと書き換え対象以外のブロックのデータとから算出したダイジェストを暗号化して書き換えツール200に送信する必要はなく、書き換え結果だけを書き換えツール200に送信する。これにより、ECU2、4と書き換えツール200との通信量が低減するので、書き換え時間を短縮できる。 In this case, the ECUs 2 and 4 do not need to encrypt the digest calculated from the rewrite data and the data of the block other than the rewrite target and send the digest to the rewrite tool 200, but only the rewrite result to the rewrite tool 200. As a result, the amount of communication between the ECUs 2 and 4 and the rewriting tool 200 is reduced, so that the rewriting time can be shortened.

(3)書き換えツール200において、これまでECU2、4に送信した書き換えデータに基づいて、書き換え前のアプリ領域90の全領域のデータの内容を記憶して管理しているのであれば、今回の書き換えデータにより書き換え対象のブロックが書き換えられた場合のアプリ領域90の全領域のデータから、書き換えツール200は秘密鍵である電子署名生成鍵220を使用して全領域電子署名を生成できる。 (3) If the rewriting tool 200 stores and manages the data content of all areas of the application area 90 before rewriting based on the rewriting data transmitted to the ECUs 2 and 4 so far, this rewriting The rewriting tool 200 can generate a full-area digital signature using the digital signature generation key 220, which is a secret key, from the data in the entire area of the application area 90 when the block to be rewritten by the data is rewritten.

この構成では、書き換え処理において、書き換えツール200は、書き換えデータと、書き換えデータの電子署名と、全領域電子署名とをECU2、4に送信する。
(4)上記実施形態では、所定のタイミングとして、ECU2、4の電源がオンになりECU2、4が起動されると検証処理が実行される。これ以外にも、所定タイミングとして、例えば、所定の時間間隔で検証処理を実行してもよい。
With this configuration, in the rewriting process, the rewriting tool 200 transmits the rewriting data, the electronic signature of the rewriting data, and the entire area electronic signature to the ECUs 2 and 4.
(4) In the above embodiment, the verification process is executed when the ECUs 2 and 4 are powered on and the ECUs 2 and 4 are activated at a predetermined timing. Other than this, for example, the verification process may be executed at a predetermined time interval as a predetermined timing.

(5)上記第1実施形態では、検証処理においてCPU20は、各ブロックのカウンタ98を参照し、最大値のカウンタ98が記憶されているブロックの全領域電子署名96を最新の全領域電子署名96として抽出した。 (5) In the first embodiment, in the verification process, the CPU 20 refers to the counter 98 of each block, and sets the latest full-area digital signature 96 to the full-area electronic signature 96 of the block in which the maximum counter 98 is stored. Was extracted as.

これに対し、以下の方法で最新の全領域電子署名96を抽出してもよい。まず、書き換え処理においてCPU20は、書き換え回数をフラッシュメモリ70等に記憶しておき、書き換え対象のブロックのカウンタ98を書き換え処理の回数で書き換える。次に、検証処理においてCPU20は、フラッシュメモリ70等に記憶されている書き換え回数と一致するカウンタ98が記憶されているブロックの全領域電子署名96を最新の全領域電子署名96として抽出する。 On the other hand, the latest full area electronic signature 96 may be extracted by the following method. First, in the rewriting process, the CPU 20 stores the number of rewritings in the flash memory 70 or the like, and rewrites the counter 98 of the block to be rewritten with the number of rewriting processes. Next, in the verification process, the CPU 20 extracts, as the latest full-area digital signature 96, the full-area digital signature 96 of the block in which the counter 98 that matches the number of rewrites stored in the flash memory 70 or the like is stored.

(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 ECUs 2 and 4 described above, an electronic control system including the ECUs 2 and 4 as components, a data verification program and a data rewriting program for causing a computer to function as the ECUs 2 and 4, the data verification program and the data rewriting The present disclosure can be realized in various forms such as a recording medium recording a program, a data verification method, and a data rewriting method.

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)

ブロック毎にデータを書き換え可能な複数のブロックを有し、前記複数のブロックの全領域のデータの正当性の検証に使用される全領域電子署名(96)を記憶する記憶部を前記ブロック毎に有し、前記複数のブロックのいずれかのブロックのデータが書き換えられるときに、書き換え対象の前記ブロックの前記記憶部に記憶されている前記全領域電子署名が書き換えられる不揮発性メモリ(70)と、
前記全領域のデータから第1の全領域ダイジェストを算出する第1の算出部(S414)と、
前記ブロック毎に記憶されている前記全領域電子署名のいずれが最新であるかを判別する判別情報(98)に基づいて、最新の前記全領域電子署名から検証鍵(64)を使用して第2の全領域ダイジェストを算出する第2の算出部(S416)と、
所定のタイミングで、前記第1の算出部が算出する前記第1の全領域ダイジェストと、前記第2の算出部が算出する前記第2の全領域ダイジェストとが一致しているか否かの判定結果に基づいて、前記全領域のデータの正当性を検証する検証部(S418)と、
を備える電子制御装置()。
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.
請求項1に記載の電子制御装置において、
外部の書き換えツール(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.
請求項1に記載の電子制御装置において、
外部の書き換えツール(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.
請求項2または3に記載の電子制御装置において、
さらに前記第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.
請求項2、または請求項2を引用する請求項4に記載の電子制御装置であって、
前記通信部(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.
請求項5に記載の電子制御装置であって、
前記第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.
請求項2、または請求項2を引用する請求項4に記載の電子制御装置であって、
さらに前記署名書き換え部は、前記第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.
請求項2から7のいずれか一項に記載の電子制御装置であって、
前記記憶部は、前記全領域電子署名に加えて前記判別情報を記憶しており、
前記署名書き換え部は、書き換え対象の前記ブロックに対応する前記記憶部の前記全領域電子署名を書き換えるときに、書き換え対象の前記ブロックに対応する前記判別情報を最新情報に書き換える、
電子制御装置。
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.
JP2016217323A 2016-11-07 2016-11-07 Electronic control unit Active JP6724732B2 (en)

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)

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

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