JP2019041228A - Electronic control equipment - Google Patents

Electronic control equipment Download PDF

Info

Publication number
JP2019041228A
JP2019041228A JP2017161571A JP2017161571A JP2019041228A JP 2019041228 A JP2019041228 A JP 2019041228A JP 2017161571 A JP2017161571 A JP 2017161571A JP 2017161571 A JP2017161571 A JP 2017161571A JP 2019041228 A JP2019041228 A JP 2019041228A
Authority
JP
Japan
Prior art keywords
data
message
reference table
mac
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.)
Granted
Application number
JP2017161571A
Other languages
Japanese (ja)
Other versions
JP6958114B2 (en
Inventor
俊行 増江
Toshiyuki Masue
俊行 増江
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 JP2017161571A priority Critical patent/JP6958114B2/en
Publication of JP2019041228A publication Critical patent/JP2019041228A/en
Application granted granted Critical
Publication of JP6958114B2 publication Critical patent/JP6958114B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

To provide electronic control equipment capable of verifying legitimacy of a message, while reducing a processing load.SOLUTION: A MAC generating section 33 of an ECU30 divides a message body of a received message into multiple blocks, and generates a MAC by using a common key. A determination part 36 determines whether or not the generated MAC matches the MAC in the received message. A reference table storage section 35 is a block containing only the protection object data, and stores the reference data from a first block to a j-th block, and the reference table formed by encrypting reference data by a common key, and indicating correspondence with a cipher text, i.e., midway operation results of the MAC. The MAC generating section surveys the reference table, and when the data matching the reference data has been registered, refers to the cipher text corresponding to the reference data from the reference table, and generates the MAC by the referred cipher text, the common key, and the data of the remaining blocks not registered with the reference table.SELECTED DRAWING: Figure 3

Description

この明細書における開示は、他の装置とともにネットワークに接続される電子制御装置であって、に関する。   The disclosure in this specification relates to an electronic control device connected to a network together with other devices.

車載ネットワークとしてCAN(Controller Area Network)が採用されている。CANは、登録商標である。CANにおいて通信されるメッセージには、送信元や宛先の識別情報が含まれていない。そこで、メッセージの改竄を防ぐためにメッセージ認証コード(Message Authentication Code;MAC)を用い、さらに、CANに接続された不正機器からの再送攻撃(リプレイ攻撃)を防ぐ方法が提案されている(特許文献1参照)。特許文献1に開示された電子制御装置(通信装置)では、CMAC(Cipher based MAC)等のアルゴリズムによって、メッセージ認証コードを生成する。   A CAN (Controller Area Network) is adopted as an in-vehicle network. CAN is a registered trademark. The message communicated in the CAN does not include the identification information of the transmission source and the destination. Therefore, a method has been proposed in which a message authentication code (MAC) is used to prevent message tampering, and a replay attack (replay attack) from an unauthorized device connected to the CAN is prevented (Patent Document 1). reference). In the electronic control device (communication device) disclosed in Patent Literature 1, a message authentication code is generated by an algorithm such as CMAC (Cipher based MAC).

特開2017−38144号公報JP 2017-38144 A

CMAC等のブロック暗号ベース認証アルゴリズムを用いる場合、データフィールドには、メッセージ本体と、上記したメッセージ認証コードが設定される。また、再送攻撃を防ぐために、メッセージ本体として、制御データなどの保護対象である保護対象データと、再送攻撃を防ぐためのデータ(以下、耐再送攻撃データと示す)が設定される。耐再送攻撃データは、たとえばメッセージ本体の末尾に設定される。耐再送攻撃データは、たとえば送受信の双方で、決まった規則で更新されるデータである。これにより、メッセージ本体の保護対象データが同じでも、メッセージ認証コードを異ならせることができる。   When a block cipher based authentication algorithm such as CMAC is used, a message body and the above message authentication code are set in the data field. In order to prevent retransmission attacks, protection target data such as control data and data for preventing retransmission attacks (hereinafter, referred to as anti-retransmission attack data) are set as the message body. The resend-proof attack data is set at the end of the message body, for example. The resend-proof attack data is data that is updated according to a fixed rule, for example, in both transmission and reception. Thereby, even if the protection target data of the message body is the same, the message authentication code can be made different.

電子制御装置は、上記メッセージを受信すると、メッセージにおけるメッセージ本体を一定の長さを有する複数のブロックに分割する。そして、共通鍵を用いた演算によりメッセージ認証コードを生成し、生成したメッセージ認証コードが受信したメッセージのメッセージ認証コードと一致するか否かを判定する。   When receiving the message, the electronic control unit divides the message body in the message into a plurality of blocks having a certain length. Then, a message authentication code is generated by calculation using the common key, and it is determined whether or not the generated message authentication code matches the message authentication code of the received message.

このように、メッセージ本体を複数のブロックに分割し、共通鍵による暗号化処理を行うため、メッセージ認証コードの作成、ひいてはメッセージの正当性の検証に時間がかかるという問題がある。特にメッセージ(メッセージ本体)が長いほど、処理負荷が増加してしまう。   As described above, since the message body is divided into a plurality of blocks and the encryption process is performed using the common key, it takes time to create a message authentication code and thus to verify the validity of the message. In particular, the longer the message (message body), the greater the processing load.

本開示はこのような課題に鑑みてなされたものであり、メッセージの正当性を検証でき、且つ、処理負荷を低減できる電子制御装置を提供することを目的とする。   The present disclosure has been made in view of such a problem, and an object thereof is to provide an electronic control device capable of verifying the validity of a message and reducing the processing load.

本開示は、上記目的を達成するために以下の技術的手段を採用する。なお、括弧内の符号は、ひとつの態様として後述する実施形態に記載の具体的手段との対応関係を示すものであって、技術的範囲を限定するものではない。   The present disclosure employs the following technical means to achieve the above object. In addition, the code | symbol in parenthesis shows the corresponding relationship with the specific means as described in embodiment mentioned later as one aspect | mode, Comprising: The technical scope is not limited.

本開示のひとつは、他の装置とともにネットワークに接続される電子制御装置であって、
他の装置から送信され、保護対象である保護対象データに続いて再送攻撃を防ぐためのデータが設定されたメッセージ本体と、メッセージ本体に基づいて算出されたメッセージ認証コードと、を含むメッセージを受信する受信部(32)と、
受信部により受信されたメッセージのうちのメッセージ本体を、一定の長さを有する複数のブロックに分割し、共通鍵を用いた演算によりメッセージ認証コードを生成する生成部(33)と、
生成部により生成されたメッセージ認証コードと、受信部により受信されたメッセージに含まれるメッセージ認証コードとが一致するか否かを判定する判定部(36)と、
保護対象データのみを含むブロックであって、最初のブロックからj番目(jは2以上の正数)のブロックまでの保護対象データである基準データと、基準データを共通鍵によって暗号化してなり、メッセージ認証コードの演算の途中結果である暗号文との対応関係を示す参照テーブルを記憶する記憶部(35)と、
を備え、
生成部は、参照テーブルを探査して、受信部により受信されたメッセージの基準データと一致するデータが参照テーブルに登録されていると判定すると、基準データに対応する暗号文を参照テーブルから参照して、参照した暗号文と、共通鍵と、参照テーブルに登録されていない残りのブロックのデータとにより、メッセージ認証コードを生成する。
One of the present disclosure is an electronic control device connected to a network together with other devices,
Receives a message that is transmitted from another device and includes a message body in which data for preventing a replay attack is set subsequent to the protection target data to be protected, and a message authentication code calculated based on the message body Receiving unit (32),
A generating unit (33) that divides a message body of a message received by the receiving unit into a plurality of blocks having a certain length and generates a message authentication code by an operation using a common key;
A determination unit (36) for determining whether or not the message authentication code generated by the generation unit matches the message authentication code included in the message received by the reception unit;
A block including only the protection target data, the reference data being the protection target data from the first block to the j-th block (j is a positive number of 2 or more), and the reference data are encrypted with a common key, A storage unit (35) for storing a reference table indicating a correspondence relationship with a ciphertext that is an intermediate result of calculation of a message authentication code;
With
When the generation unit searches the reference table and determines that data matching the reference data of the message received by the reception unit is registered in the reference table, the generation unit refers to the ciphertext corresponding to the reference data from the reference table. Thus, a message authentication code is generated using the ciphertext referred to, the common key, and the remaining block data not registered in the reference table.

再送攻撃を防ぐためのデータがメッセージ本体の末尾にあるため、基準データが同じであれば、メッセージ認証コードの演算の途中結果も同じとなる。この電子制御装置では、基準データと、該基準データに対応する暗号文との対応関係を示す参照テーブルが記憶されている。そして、参照テーブルを探査し、メッセージ中の基準データと一致するデータが参照テーブルに登録されている場合に、基準データに対応する暗号文を参照テーブルから参照して、メッセージ認証コードを生成する。   Since the data for preventing a replay attack is at the end of the message body, if the reference data is the same, the intermediate result of the message authentication code calculation is also the same. In this electronic control device, a reference table indicating the correspondence between the reference data and the ciphertext corresponding to the reference data is stored. Then, the reference table is searched, and when data that matches the reference data in the message is registered in the reference table, the ciphertext corresponding to the reference data is referenced from the reference table to generate a message authentication code.

このように、参照テーブルから暗号文を参照するため、共通鍵を用いた暗号化処理の演算の一部を省略することができる。したがって、メッセージの正当性を検証でき、且つ、処理負荷を低減できる。   In this way, since the ciphertext is referred to from the reference table, a part of the computation of the encryption process using the common key can be omitted. Therefore, the validity of the message can be verified, and the processing load can be reduced.

第1実施形態の電子制御装置を備える通信システムを示す図である。It is a figure which shows a communication system provided with the electronic control apparatus of 1st Embodiment. データフレームの構成を示す図である。It is a figure which shows the structure of a data frame. 電子制御装置を示す図である。It is a figure which shows an electronic control apparatus. MAC生成の通常処理を説明する図である。It is a figure explaining normal processing of MAC generation. 参照テーブルを説明する図である。It is a figure explaining a reference table. 受信処理を示すフローチャートである。It is a flowchart which shows a reception process. 第2実施形態の電子制御装置を示す図である。It is a figure which shows the electronic control apparatus of 2nd Embodiment. 受信処理を示すフローチャートである。It is a flowchart which shows a reception process. 編集部が実行する処理を示す図である。It is a figure which shows the process which an edit part performs. 第3実施形態の電子制御装置において、編集部が実行する処理を示す図である。It is a figure which shows the process which an edit part performs in the electronic control apparatus of 3rd Embodiment. 第4実施形態の電子制御装置において、編集部が実行する処理を示す図である。It is a figure which shows the process which an edit part performs in the electronic control apparatus of 4th Embodiment. 第5実施形態の電子制御装置において、受信処理を示すフローチャートである。It is a flowchart which shows a reception process in the electronic control apparatus of 5th Embodiment.

図面を参照しながら、複数の実施形態を説明する。複数の実施形態において、機能的に及び/又は構造的に対応する部分には同一の参照符号を付与する。   A plurality of embodiments will be described with reference to the drawings. In several embodiments, functionally and / or structurally corresponding parts are given the same reference numerals.

(第1実施形態)
先ず、図1に基づき、本実施形態の電子制御装置を備える通信システムについて説明する。
(First embodiment)
First, a communication system including the electronic control device of the present embodiment will be described based on FIG.

図1に示す通信システム10は、CANバス20及び複数の電子制御装置(Electronic Control Unit)30を備えている。CANは、バス型ネットワークを採用したシリアル通信プロトコルである。以下、電子制御装置30を、ECU30と示す。複数のECU30(ノード)は、CANバス20に接続されている。本実施形態では、車両に搭載された複数のECU30が、CANバス20にノードとして接続されて、車載ネットワークが構築されている。   A communication system 10 shown in FIG. 1 includes a CAN bus 20 and a plurality of electronic control units (Electronic Control Units) 30. CAN is a serial communication protocol that employs a bus network. Hereinafter, the electronic control unit 30 is referred to as an ECU 30. The plurality of ECUs 30 (nodes) are connected to the CAN bus 20. In the present embodiment, a plurality of ECUs 30 mounted on the vehicle are connected to the CAN bus 20 as nodes, and an in-vehicle network is constructed.

ECU30は、メッセージの正当性をメッセージ認証コードに基づいて判断する。以下、メッセージ認証コードを、MACと示す。   The ECU 30 determines the validity of the message based on the message authentication code. Hereinafter, the message authentication code is denoted as MAC.

次に、図2に基づき、データフレームについて説明する。   Next, a data frame will be described with reference to FIG.

図2に示すように、データフレームは、IDフィールドやデータフィールドを含んでいる。それ以外にも、図示しないCRCフィールドなどを含んでいる。メッセージは、送信可能な状態のデータフレームに相当する。IDフィールドには、メッセージの種類及び優先度を示す識別情報であるIDが設定される。たとえば受信側のECU30は、IDを参照することで、自身が処理する必要のあるデータか否かを判断する。   As shown in FIG. 2, the data frame includes an ID field and a data field. In addition, a CRC field (not shown) is included. The message corresponds to a data frame that can be transmitted. In the ID field, an ID that is identification information indicating the type and priority of the message is set. For example, the ECU 30 on the receiving side refers to the ID to determine whether or not the data needs to be processed by itself.

データフィールドには、メッセージ本体及びMACが設定される。メッセージ本体は、保護対象データと、再送攻撃(リプレイ攻撃)を防ぐための耐再送攻撃データを含む。保護対象データは、車両の特定の機能、たとえば制御機能や監視機能に関する情報である。すなわち、保護すべき情報である。保護対象データとして、たとえばエンジン回転数に関する情報や、アクチュエータの駆動を指示する情報などがある。   A message body and a MAC are set in the data field. The message body includes data to be protected and resend-proof attack data for preventing a replay attack (replay attack). The protection target data is information related to a specific function of the vehicle, such as a control function or a monitoring function. That is, the information to be protected. The data to be protected includes, for example, information related to the engine speed and information that instructs driving of the actuator.

耐再送攻撃データは、保護対象データに続いて設定される。耐再送攻撃データは、メッセージ本体の末尾に設定される。耐再送攻撃データは、送受信の双方で決まった規則で更新されるデータである。耐再送攻撃データは、送受信で同様に更新される。本実施形態では、CANバス20に接続された複数のECU30において、決まった規則で更新される。このため、メッセージ本体の保護対象データが同じでも、MACを異ならせることができる。   The retransmission resilience attack data is set subsequent to the protection target data. The retransmission resilience attack data is set at the end of the message body. The resend-proof attack data is data that is updated according to a rule determined for both transmission and reception. The retransmission resilience attack data is similarly updated by transmission / reception. In the present embodiment, the ECU 30 connected to the CAN bus 20 is updated according to a predetermined rule. For this reason, even if the protection target data of the message body is the same, the MAC can be made different.

具体的には、CANバス20に接続された不正機器によりメッセージが盗聴され、後にこのメッセージがCANバス20に再送された場合、再送されたメッセージの耐再送データは盗聴時に設定されたものである。再送時には、ECU30において耐再送攻撃データが更新されており、これによりMACの値が異なるため、再送されたメッセージが不正メッセージであると判断することができる。   Specifically, when a message is wiretapped by an unauthorized device connected to the CAN bus 20 and this message is later retransmitted to the CAN bus 20, the resend resistant data of the retransmitted message is set at the time of wiretapping. . At the time of retransmission, the anti-retransmission attack data is updated in the ECU 30, and the MAC value differs accordingly, so that it is possible to determine that the retransmitted message is an illegal message.

次に、図3〜図5に基づき、本実施形態のECU30(電子制御装置)について説明する。以下に説明する構成は、複数のECU30で同じとなっている。   Next, the ECU 30 (electronic control device) of the present embodiment will be described with reference to FIGS. The configuration described below is the same for the plurality of ECUs 30.

図3に示すように、ECU30は、マイコン31を有している。マイコン31は、CPU、ROM、RAM、フラッシュメモリ、レジスタ、及び入出力インターフェースなどを備えて構成されている。マイコン31において、CPUが、RAMやレジスタの一時記憶機能を利用しつつ、ROMに予め記憶された制御プログラムにしたがって、所定の処理を実行する。マイコン31は、ソフトウェア制御により、所定の処理を実行する。マイコン31は、受信したメッセージの正当性を検証する機能部として、受信部32、MAC生成部33、共通鍵記憶部34、参照テーブル記憶部35、及び判定部36を備えている。   As shown in FIG. 3, the ECU 30 has a microcomputer 31. The microcomputer 31 includes a CPU, a ROM, a RAM, a flash memory, a register, an input / output interface, and the like. In the microcomputer 31, the CPU executes a predetermined process according to a control program stored in advance in the ROM while using a temporary storage function of a RAM or a register. The microcomputer 31 executes a predetermined process under software control. The microcomputer 31 includes a reception unit 32, a MAC generation unit 33, a common key storage unit 34, a reference table storage unit 35, and a determination unit 36 as functional units that verify the validity of the received message.

受信部32は、他のECU30から送信されたメッセージを受信する。受信部32は、受信したメッセージのIDに基づいて、受信したECU30(自身)の処理対象であり、且つ、MACによる認証が必要な対象であるかを判断する。メッセージを送信した他のECU30が、他の装置に相当する。   The receiving unit 32 receives a message transmitted from another ECU 30. Based on the ID of the received message, the receiving unit 32 determines whether it is a processing target of the received ECU 30 (self) and requires authentication by the MAC. The other ECU 30 that has transmitted the message corresponds to another device.

MAC生成部33は、受信したメッセージが、処理対象であり、且つ、MACによる認証対象である場合に、共通鍵を用いてMACを生成する。MAC生成部33が、MACを生成する生成部に相当する。共通鍵は、送受信の装置間で共通な暗号鍵である。共通鍵は、共通鍵記憶部34に記憶されている。MAC生成部33は、条件に応じて、通常処理によるMAC生成と、参照暗号文を用いたMAC生成とを切り替えて実行する。   The MAC generation unit 33 generates a MAC using a common key when the received message is a processing target and a MAC authentication target. The MAC generation unit 33 corresponds to a generation unit that generates a MAC. The common key is an encryption key that is common between transmission and reception devices. The common key is stored in the common key storage unit 34. The MAC generation unit 33 performs switching between MAC generation by normal processing and MAC generation using a reference ciphertext according to conditions.

先ず、通常処理について説明する。MAC生成部33は、ブロック暗号ベース認証アルゴリズムを適用してMACを生成する。本実施形態では、CMAC(Cipher based MAC)を適用する。通常処理は、CMACとして知られた手法である。   First, normal processing will be described. The MAC generation unit 33 generates a MAC by applying a block cipher based authentication algorithm. In this embodiment, CMAC (Cipher based MAC) is applied. Normal processing is a technique known as CMAC.

MAC生成部33は、先ずメッセージ本体を、図4に示すように一定の長さ(所定ビット)を有する複数のブロックM、M、…、M に分割する。以下、一定の長さを暗号長と示す。M が暗号長を満たす場合、図4に示すように、M と共通鍵Kとの排他的論理和(XOR)を、最終ブロックMとする。一方、M が暗号長に満たない場合、図示を省略するが、空きビットに先頭を1、以降を0とするデータをパディング(付け足し)する。そして、パディングしたM と共通鍵Kとの排他的論理和(XOR)を、最終ブロックMとする。 First, the MAC generation unit 33 divides the message body into a plurality of blocks M 1 , M 2 ,..., M n * having a certain length (predetermined bits) as shown in FIG. Hereinafter, a certain length is referred to as an encryption length. When M n * satisfies the encryption length, as shown in FIG. 4, the exclusive OR (XOR) of M n * and the common key K is set as the final block M n . On the other hand, when M n * is less than the encryption length, although not shown in the figure, padding (adding) data with a leading bit of 1 and a trailing bit of 0 is omitted. Then, the exclusive OR (XOR) of the padded M n * and the common key K is defined as the final block M n .

なお、図4は、以下の公知の先行文献より引用した。
NIST, Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication, Special Publication 800-38B.
MAC生成部33は、最初(1番目)のブロックMから、共通鍵Kを用いて暗号化処理CIPHを実行する。i番目(iは2以上の正数)のブロックについては、(i−1)番目の暗号化処理CIPHの結果との排他的論理和を計算し、この排他的論理和を共通鍵Kを用いて暗号化処理CIPHする。図5に示す例では、最終ブロックMと(n−1)番目のブロックMn−1の暗号化処理CIPHの結果との排他的論理和を計算し、この排他的論理和を共通鍵Kを用いて暗号化処理CIPHする。そして、暗号化処理CIPHにより得られたビット列を、左からMACサイズであるTlenビット分、切り出す処理を実行し、得られた値TをMAC値とする。通常処理では、ブロック数と同じn回分の暗号化処理CIPHを実行して、MACを生成する。
FIG. 4 is cited from the following known prior art.
NIST, Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication, Special Publication 800-38B.
MAC generation unit 33, the block M 1 of the first (1st), executes encryption processing CIPH K using the common key K. For the i-th block (i is a positive number equal to or greater than 2), an exclusive OR with the result of the (i−1) -th encryption process CIPH K is calculated, and this exclusive OR is calculated as the common key K. Use the encryption process CIPH K. In the example shown in FIG. 5, the exclusive OR of the final block M n and the result of the encryption process CIPH K of the (n−1) -th block M n−1 is calculated, and this exclusive OR is used as the common key. The encryption process CIPH K is performed using K. Then, a process of cutting out the bit string obtained by the encryption process CIPH K by Tlen bits having the MAC size from the left is executed, and the obtained value T is set as the MAC value. In the normal process, the encryption process CIPH K for n times the number of blocks is executed to generate a MAC.

より詳しくは、MAC生成部33が、M が暗号長を満たす場合に、共通鍵Kより算出される副鍵K1を用いてMACを生成する。M が暗号長に満たない場合に、共通鍵Kより算出される副鍵K2を用いてMACを生成する。しかしながら、本実施形態では、便宜上、副鍵と共通鍵との区別をせず、単に共通鍵として記載する。このため、図4においても、副鍵K1ではなく共通鍵Kと示している。 More specifically, the MAC generation unit 33 generates a MAC using the sub key K1 calculated from the common key K when M n * satisfies the encryption length. When M n * is less than the encryption length, a MAC is generated using the sub key K2 calculated from the common key K. However, in this embodiment, for the sake of convenience, the sub key and the common key are not distinguished, and are simply described as the common key. Therefore, also in FIG. 4, the common key K is shown instead of the subkey K1.

次に、参照暗号文を用いた処理について説明する。上記したように、データフィールドには、メッセージ本体の末尾に耐再送攻撃データが設定されている。したがって、少なくとも最終ブロックMには、耐再送攻撃データが含まれる。また、耐再送攻撃データは、所定の規則で更新されるデータである。したがって、耐再送攻撃データを含むブロックを共通鍵Kを用いて暗号化処理CIPHした結果は、常に同じとはならない。一方、保護対象データのみを含むブロックについては、データが同じであれば、共通鍵Kを用いて暗号化処理CIPHした結果も同じとなる。 Next, processing using a reference ciphertext will be described. As described above, in the data field, anti-replay attack data is set at the end of the message body. Therefore, at least the last block M n includes anti-retransmission attack data. Further, anti-retransmission attack data is data that is updated according to a predetermined rule. Therefore, the result of the encryption process CIPH K using the common key K for the block including the anti-retransmission attack data is not always the same. On the other hand, for blocks including only protection target data, if the data is the same, the result of encryption processing CIPH K using the common key K is also the same.

そこで、保護対象データのみを含むブロックであって、最初のブロックMからj番目(jは2以上の正数)のブロックMまでを基準ブロックとし、該基準ブロックの保護対象データを基準データとする。そして、基準データと、ブロックMまでの共通鍵Kを用いた暗号化処理CIPHの結果、すなわち上記した通常処理によるMACの途中演算結果である暗号文との対応関係を示す参照テーブルが、参照テーブル記憶部35に記憶されている。基準データは平文であり、途中演算結果はその暗号文である。参照テーブル記憶部35が、参照テーブルを記憶する記憶部に相当する。 Therefore, a block that contains only protected data, j-th from the first block M 1 (j is 2 or more positive) and reference block up to the block M j of reference data protected data of said reference block And Then, a reference table showing a correspondence relationship between the reference data and the result of the encryption process CIPH K using the common key K up to the block M j , that is, the ciphertext that is the midway calculation result of the MAC by the normal process described above, It is stored in the reference table storage unit 35. The reference data is plain text, and the intermediate calculation result is the cipher text. The reference table storage unit 35 corresponds to a storage unit that stores a reference table.

本実施形態では、図5に示すように、最終ブロックMのみに耐再送攻撃データが含まれている。保護対象データは、最初のブロックMから最終ブロックMまで含まれている。そして、(n−1)番目のブロックMn−1までの保護対象データを基準データとしている。すなわち、保護対象データのみを含むすべてのブロックのデータを、基準データとしている。また、(n−1)番目のブロックMn−1までの暗号化処理CIPHの結果を、基準データに対応する途中演算結果としている。参照テーブルは、固定値として予め記憶されている。 In the present embodiment, as shown in FIG. 5, only the last block M n includes anti-retransmission attack data. Protected data includes the first block M 1 to the last block M n. The protection target data up to the (n−1) th block M n−1 is used as reference data. That is, the data of all blocks including only the protection target data is used as the reference data. Further, the result of the encryption process CIPH K up to the (n−1) th block M n−1 is used as an intermediate calculation result corresponding to the reference data. The reference table is stored in advance as a fixed value.

MAC生成部33は、メッセージ本体の基準データ、換言すれば基準データが格納されたブロックを抽出する。そして、抽出した基準データが参照テーブルに登録されているか探査する。受信したメッセージの基準データが参照テーブルに登録されている場合、対応する途中演算結果の暗号文を参照する。すなわち、この暗号文を(n−1)番目のブロックMn−1までの暗号化処理CIPHの結果として用いる。そして、参照した暗号文と、最終ブロックMとの排他的論理和を計算し、この排他的論理和を、共通鍵Kを用いて暗号化処理CIPHする。以降は、通常処理と同じ処理を実行する。すなわち、暗号化処理CIPHにより得られたビット列を、左からMACサイズであるTlenビット分、切り出す処理を実行し、得られた値TをMAC値とする。 The MAC generation unit 33 extracts the reference data of the message body, in other words, the block in which the reference data is stored. Then, it is searched whether the extracted standard data is registered in the reference table. When the standard data of the received message is registered in the reference table, the corresponding ciphertext of the intermediate calculation result is referred to. That is, this ciphertext is used as a result of the encryption process CIPH K up to the (n−1) -th block M n−1 . Then, an exclusive OR of the ciphertext referred to and the final block Mn is calculated, and this exclusive OR is subjected to encryption processing CIPH K using the common key K. Thereafter, the same processing as the normal processing is executed. That is, the bit string obtained by the encryption process CIPH K is extracted from the left by Tlen bits having the MAC size, and the obtained value T is set as the MAC value.

このように、参照暗号文を用いた処理では、参照テーブルに登録された基準データに対応する途中演算結果(暗号文)を参照することで、通常処理よりも少ない回数の演算で、MACを生成する。本実施形態では、2回の排他的論理和と1回の暗号化処理CIPHにより、MACを生成する。 As described above, in the process using the reference ciphertext, the MAC is generated with a smaller number of calculations than in the normal process by referring to the intermediate calculation result (ciphertext) corresponding to the reference data registered in the reference table. To do. In this embodiment, the MAC is generated by two exclusive ORs and one encryption process CIPH K.

判定部36は、受信したメッセージが、処理対象であり、且つ、MACによる認証対象である場合に、MAC生成部33により生成されたMACと、受信部32により受信されたメッセージのデータフィールドに設定されたMACとを比較する。そして、両MACが一致するか否かを判定する。   The determination unit 36 sets the MAC generated by the MAC generation unit 33 and the data field of the message received by the reception unit 32 when the received message is a processing target and an authentication target by the MAC. Compared to the MAC. Then, it is determined whether or not both MACs match.

さらにマイコン31は、メッセージを送信する機能部として、上記したMAC生成部33及び共通鍵記憶部34に加えて、メッセージ本体生成部37、フレーム生成部38、及び送信部39を備えている。   Furthermore, the microcomputer 31 includes a message main body generation unit 37, a frame generation unit 38, and a transmission unit 39 in addition to the MAC generation unit 33 and the common key storage unit 34 described above as functional units that transmit messages.

メッセージ本体生成部37は、ECU30がメッセージを送信する際に、メッセージ本体を生成する。すなわち、保護対象データ及び耐再送攻撃データを生成する。MAC生成部33は、メッセージ本体生成部37により生成されたメッセージ本体について、上記した通常処理、すなわち共通鍵を用いた暗号化処理を実行することで、MACを生成する。   The message body generation unit 37 generates a message body when the ECU 30 transmits a message. That is, the data to be protected and the anti-retransmission attack data are generated. The MAC generation unit 33 generates a MAC by executing the above-described normal processing, that is, encryption processing using a common key, on the message body generated by the message body generation unit 37.

フレーム生成部38は、データフレームのデータフィールドに、メッセージ本体生成部37により生成されたメッセージ本体及びMAC生成部33により生成されたMACを設定する。また、IDフィールドにIDを設定する、これら処理により、送信可能なデータフレーム、すなわちメッセージを生成する。そして、送信部39から、CANバス20に対してメッセージを送信する。   The frame generation unit 38 sets the message body generated by the message body generation unit 37 and the MAC generated by the MAC generation unit 33 in the data field of the data frame. In addition, a data frame that can be transmitted, that is, a message is generated by these processes of setting an ID in the ID field. Then, a message is transmitted from the transmission unit 39 to the CAN bus 20.

次に、図6に基づき、マイコン31が実行する受信処理について説明する。   Next, the reception process executed by the microcomputer 31 will be described with reference to FIG.

受信部32がメッセージを受信し、受信したメッセージが、処理対象であり、且つ、MACによる認証対象である場合に、以下に示す処理を実行する。   When the receiving unit 32 receives a message, and the received message is a processing target and a MAC authentication target, the following processing is executed.

先ずMAC生成部33が、受信したメッセージのデータフィールドに設定されたメッセージ本体から、基準データを抽出する(ステップS10)。次いで、MAC生成部33は、参照テーブルを探査し(ステップS20)、抽出した基準データが、参照テーブルに登録されているか否かを判定する(ステップS30)
ステップS30において参照テーブルに登録されていると判定すると、MAC生成部33は、参照テーブルから抽出した基準データに対応する暗号文、すなわち途中演算結果を参照する(ステップS40)。そして、上記した参照暗号文を用いた処理を実行して、MACを生成する(ステップS50)。
First, the MAC generation unit 33 extracts reference data from the message body set in the data field of the received message (step S10). Next, the MAC generation unit 33 searches the reference table (step S20) and determines whether or not the extracted reference data is registered in the reference table (step S30).
If it determines with having registered in the reference table in step S30, the MAC production | generation part 33 will refer to the ciphertext corresponding to the reference | standard data extracted from the reference table, ie, an intermediate calculation result (step S40). Then, the process using the reference ciphertext is executed to generate the MAC (step S50).

本実施形態では、参照した暗号文を(n−1)番目のブロックMn−1までの暗号化処理CIPHの結果として用い、最終ブロックMとの排他的論理和を計算する。そして、この排他的論理和を共通鍵Kを用いて暗号化処理CIPHし、暗号化処理CIPHにより得られたビット列を、左からMACサイズであるTlenビット分、切り出す処理を実行してMACを生成する。 In the present embodiment, the ciphertext referred to is used as a result of the encryption process CIPH K up to the (n−1) th block M n−1, and an exclusive OR with the final block M n is calculated. Then, the exclusive OR of the common key K encryption process using CIPH K, a bit string obtained by the encryption process CIPH K, running Tlen bits, cut processing is the MAC size from the left MAC Is generated.

一方、ステップS30において登録されていないと判定すると、MAC生成部33は、上記した通常処理を実行して、MACを生成する(ステップS60)。   On the other hand, if it determines with having not registered in step S30, the MAC production | generation part 33 will perform the above-mentioned normal process, and produces | generates MAC (step S60).

ステップS50又はステップS60の処理が終了すると、次いで判定部36が、ステップS50又はステップS60の処理により生成されたMACが、受信したメッセージのデータフィールドに設定されたMACと一致するか否かを判定する(ステップS70)。   When the process of step S50 or step S60 ends, the determination unit 36 then determines whether or not the MAC generated by the process of step S50 or step S60 matches the MAC set in the data field of the received message. (Step S70).

ステップS70において一致すると判定すると、判定部36は、受信したメッセージが正当なメッセージであると判断する(ステップS80)。このとき、判定部36は、たとえば正当であることを示す信号を出力する。これにより、ECU30は、受信したメッセージの保護対象データを用いた処理を実行することとなる。   If it is determined in step S70 that they match, the determination unit 36 determines that the received message is a valid message (step S80). At this time, the determination unit 36 outputs a signal indicating that it is valid, for example. Thereby, ECU30 will perform the process using the protection object data of the received message.

ステップS70において一致しないと判定すると、判定部36は、受信したメッセージが不正なメッセージであると判断する(ステップS90)。このとき、判定部36は、不正であることを示す信号を出力する。これにより、ECU30は、受信したメッセージを処理しない。そして、ステップS80又はステップS90の処理が終了すると、一連の受信処理を終了する。   If it is determined in step S70 that they do not match, the determination unit 36 determines that the received message is an unauthorized message (step S90). At this time, the determination unit 36 outputs a signal indicating fraud. Thereby, ECU30 does not process the received message. Then, when the process of step S80 or step S90 ends, a series of reception processes ends.

次に、本実施形態のECU30及び通信システム10の効果について説明する。   Next, effects of the ECU 30 and the communication system 10 of the present embodiment will be described.

上記したように、耐再送攻撃データは、メッセージ本体の末尾に設定されている。そこで、保護対象データのみを含むブロックであって、最初のブロックMからj番目のブロックMまでを基準ブロックとし、該基準ブロックの保護対象データを基準データとする。ECU30には、基準データと、ブロックMまでの共通鍵Kを用いた暗号化処理CIPHの結果であるMACの途中演算結果(暗号文)との対応関係が、参照テーブルとして記憶されている。 As described above, the anti-retransmission attack data is set at the end of the message body. Therefore, a block that contains only protected data, from the first block M 1 to j-th block M j as the reference block, a reference data protected data of the reference block. The ECU 30 stores a correspondence relationship between the reference data and the MAC intermediate calculation result (ciphertext) that is the result of the encryption process CIPH K using the common key K up to the block M j as a reference table. .

ECU30は、受信したメッセージの基準データが参照テーブルに登録されている場合、対応する途中演算結果の暗号文を参照する。すなわち、この暗号文をj番目のブロックMまでの暗号化処理CIPHの結果として用いる。そして、参照した暗号文と、(j+1)番目のブロックMj+1との排他的論理和を計算し、この排他的論理和を、共通鍵Kを用いて暗号化処理CIPHする。以降は、通常処理と同じ処理を実行する。 When the standard data of the received message is registered in the reference table, the ECU 30 refers to the corresponding encrypted text of the intermediate calculation result. That is, this ciphertext is used as a result of the encryption process CIPH K up to the j-th block M j . Then, an exclusive OR between the ciphertext referred to and the (j + 1) -th block M j + 1 is calculated, and this exclusive OR is subjected to encryption processing CIPH K using the common key K. Thereafter, the same processing as the normal processing is executed.

このように、本実施形態のECU30によれば、受信したメッセージの基準データが参照テーブルに登録されている場合に、参照テーブルの途中演算結果(暗号文)を参照するため、通常処理の排他的論理和及び暗号化処理CIPHの一部を省略し、通常処理よりも少ない演算で、MACを生成することができる。したがって、メッセージの正当性を検証でき、且つ、処理負荷を低減することができる。 Thus, according to the ECU 30 of the present embodiment, when the standard data of the received message is registered in the reference table, the intermediate calculation result (ciphertext) of the reference table is referred to, so that the normal process is exclusive. A part of the logical sum and encryption processing CIPH K can be omitted, and the MAC can be generated with fewer operations than the normal processing. Therefore, the validity of the message can be verified and the processing load can be reduced.

また、保護対象データのみを含むすべてのブロックのデータを、基準データとしている。換言すれば、保護対象データのみを含むすべてのブロックを基準ブロックとしている。したがって、通常処理に対してより少ない演算で、MACを生成することができる。特に本実施形態では、n個のブロックのうち、最終ブロックMのみに耐再送攻撃データが含まれており、その他のブロックのデータを基準データとしている。したがって、2回の排他的論理和と1回の暗号化処理CIPHにより、MACを生成することができる。このように、処理負荷を効果的に低減することができる。 Further, the data of all blocks including only the protection target data is used as the reference data. In other words, all blocks including only the protection target data are set as the reference block. Therefore, the MAC can be generated with fewer operations than normal processing. In particular, in the present embodiment, of the n blocks, only the last block Mn includes anti-retransmission attack data, and data of other blocks is used as reference data. Therefore, a MAC can be generated by two exclusive ORs and one encryption process CIPH K. Thus, the processing load can be effectively reduced.

また、参照テーブルは、変更されない固定値として、予め参照テーブル記憶部35に記憶されている。これによっても、処理負荷を低減することができる。   The reference table is stored in advance in the reference table storage unit 35 as a fixed value that is not changed. This also can reduce the processing load.

(第2実施形態)
本実施形態は、先行実施形態を参照できる。このため、先行実施形態に示した通信システム10及びECU30と共通する部分についての説明は省略する。
(Second Embodiment)
This embodiment can refer to the preceding embodiment. For this reason, the description about the part which is common in the communication system 10 and ECU30 which were shown to prior embodiment is abbreviate | omitted.

図7に示すように、本実施形態のECU30は、参照テーブルを編集する編集部40をさらに備えている。編集部40は、マイコン31の機能部として構成されている。編集部40は、受信回数が所定値以上となった未登録の基準データ及び該基準データに対応する途中演算結果を、参照テーブル記憶部35の参照テーブルに追加登録する編集処理を実行する。参照テーブル記憶部35は、フラッシュメモリ等の書き換え可能な不揮発性メモリにて構成されている。   As shown in FIG. 7, the ECU 30 of the present embodiment further includes an editing unit 40 that edits the reference table. The editing unit 40 is configured as a functional unit of the microcomputer 31. The editing unit 40 executes an editing process for additionally registering unregistered reference data whose number of receptions is equal to or greater than a predetermined value and a midway calculation result corresponding to the reference data in the reference table of the reference table storage unit 35. The reference table storage unit 35 is configured by a rewritable nonvolatile memory such as a flash memory.

編集部40は、たとえば初期的に参照テーブルに登録されていない基準データ及び該基準データに対応する途中演算結果を、上記基準データの受信回数(抽出回数)と関連付けて、たとえばRAMに記憶する。編集部40は、MAC生成部33から、抽出された基準データと、通常処理による基準データ分の途中演算結果を取得する。受信回数は、MAC生成部33が基準データを抽出し、MACを生成する毎に更新される。受信回数については、MAC生成部33側で計数してもよいし、編集部40側で計数してもよい。   The editing unit 40 stores, for example, in the RAM, the reference data that is not initially registered in the reference table and the intermediate calculation result corresponding to the reference data in association with the number of receptions (extraction number) of the reference data. The editing unit 40 acquires the extracted reference data and the intermediate calculation result for the reference data by the normal process from the MAC generation unit 33. The number of receptions is updated every time the MAC generation unit 33 extracts reference data and generates a MAC. The number of receptions may be counted on the MAC generation unit 33 side or on the editing unit 40 side.

図8は、マイコン31が実行する受信処理を示している。ステップS65の処理が追加されている点が、先行実施形態(図6)と異なる。図8では、ステップS60の処理が終了した後に、参照テーブルを編集する処理を実行する(ステップS65)。このタイミングで、MAC生成部33からステップS10で抽出した基準データ及び該基準データに対応する途中演算結果を取得し、受信回数と関連付けてRAMに記憶する。そして、受信回数が所定値以上となった未登録の基準データ及び該基準データに対応する途中演算結果があれば、RAMから参照テーブルに追加登録する。そして、一連の処理を終了する。受信回数が所定値以上となった未登録の基準データがなければ、追加登録をせずに処理を終了する。   FIG. 8 shows a reception process executed by the microcomputer 31. The point that the process of step S65 is added is different from the preceding embodiment (FIG. 6). In FIG. 8, after the process of step S60 is complete | finished, the process which edits a reference table is performed (step S65). At this timing, the reference data extracted in step S10 and the midway calculation result corresponding to the reference data are acquired from the MAC generation unit 33, and stored in the RAM in association with the number of receptions. Then, if there is unregistered reference data whose number of receptions is equal to or greater than a predetermined value and an intermediate calculation result corresponding to the reference data, it is additionally registered from the RAM to the reference table. Then, a series of processing ends. If there is no unregistered reference data whose number of receptions exceeds a predetermined value, the process ends without performing additional registration.

たとえば図9では、初期的に参照テーブルに登録されていない基準データとして、RAMに4つのデータが記憶されている。このうち、3つの基準データについては、すでに所定値である500回を超えており、参照テーブルに追加登録されている。ステップS65のタイミングで、未登録の基準データDDDDDDの受信回数が所定値に到達したため、基準データDDDDDD及び対応する途中演算結果WWWWWWを参照テーブルに追加登録する。   For example, in FIG. 9, four data are stored in the RAM as reference data that is not initially registered in the reference table. Of these, the three reference data have already exceeded the predetermined value of 500 times and are additionally registered in the reference table. At the timing of step S65, since the number of receptions of the unregistered reference data DDDDDD has reached a predetermined value, the reference data DDDDD and the corresponding midway calculation result WWWWW are additionally registered in the reference table.

このように、本実施形態によれば、参照テーブルに初期的に登録されていなくても、受信頻度が増加した基準データ及び対応する途中演算結果を、参照テーブルに追加登録することができる。したがって、途中で受信頻度が増加する場合でも、処理負荷を低減することができる。   As described above, according to the present embodiment, the reference data whose reception frequency has increased and the corresponding intermediate calculation result can be additionally registered in the reference table even if they are not initially registered in the reference table. Therefore, even when the reception frequency increases halfway, the processing load can be reduced.

なお、編集処理を実行するタイミングは、図8に示した例に限定されない。MAC生成部33から基準データ及び途中演算結果を取得可能なタイミングであればよい。したがって、ステップS60以降であればよい。たとえば、ステップS80又はステップS90の処理終了後に、編集処理を実行してもよい。   Note that the timing of executing the editing process is not limited to the example shown in FIG. Any timing may be used as long as the reference data and the intermediate calculation result can be acquired from the MAC generation unit 33. Therefore, what is necessary is just after Step S60. For example, the editing process may be executed after the process of step S80 or step S90 is completed.

RAMにおいて、参照テーブルに追加登録された基準データ及び対応する途中演算結果については、削除してもよい。   In the RAM, the reference data additionally registered in the reference table and the corresponding intermediate calculation result may be deleted.

初期的に参照テーブルに登録されている基準データ及び対応する途中演算結果についてもRAMに記憶させ、受信回数を更新するようにしてもよい。すなわち、ステップS10で抽出されるすべての基準データ及び該基準データに対応する途中演算結果をRAMに記憶するようにしてもよい。登録済みの基準データについては、MAC生成部33から、抽出された基準データ及び参照された途中演算結果を取得することとなる。   The reference data initially registered in the reference table and the corresponding intermediate calculation result may also be stored in the RAM, and the number of receptions may be updated. That is, all the reference data extracted in step S10 and intermediate calculation results corresponding to the reference data may be stored in the RAM. For the registered reference data, the extracted reference data and the referred midway calculation result are acquired from the MAC generation unit 33.

(第3実施形態)
本実施形態は、先行実施形態を参照できる。このため、先行実施形態に示した通信システム10及びECU30と共通する部分についての説明は省略する。
(Third embodiment)
This embodiment can refer to the preceding embodiment. For this reason, the description about the part which is common in the communication system 10 and ECU30 which were shown to prior embodiment is abbreviate | omitted.

本実施形態において、編集部40は、所定期間におけるMAC生成部33による参照回数が所定値を下回る基準データ及び該基準データに対応する途中演算結果を、参照テーブルから削除する編集処理を実行する。参照回数は、MAC生成部33が参照テーブルから途中演算結果を参照する度に更新される。参照回数は、MAC生成部33によって計数される。そして、図10に示すように、基準データに関連付けられて参照テーブルに記憶される。MAC生成部33は、例えばステップS40の処理において、途中演算結果(暗号文)を参照するとともに、参照した途中演算結果に対応する参照テーブルの参照回数をインクリメント(+1)する。   In the present embodiment, the editing unit 40 executes editing processing for deleting, from the reference table, the reference data in which the number of times of reference by the MAC generation unit 33 during a predetermined period is less than a predetermined value and the intermediate calculation result corresponding to the reference data. The reference count is updated each time the MAC generation unit 33 refers to the midway calculation result from the reference table. The reference count is counted by the MAC generation unit 33. Then, as shown in FIG. 10, it is stored in the reference table in association with the reference data. For example, in the process of step S40, the MAC generation unit 33 refers to the intermediate calculation result (ciphertext), and increments (+1) the reference table reference number corresponding to the referred intermediate calculation result.

編集部40は、記した所定期間ごと、すなわち所定の周期で編集処理を実行する。編集部40は、参照テーブルの参照回数が所定値を下回る基準データ及び該基準データに対応する途中演算結果があれば、参照テーブルから削除する。そして、参照テーブルの参照回数をクリアする。図10では、基準データDDDDDDの受信回数が所定値である500回を下回ったため、基準データDDDDDD及び対応する途中演算結果WWWWWWを参照テーブルから削除する。また、他の基準データについて参照回数をクリアする。   The editing unit 40 executes the editing process every predetermined period, that is, at a predetermined cycle. The editing unit 40 deletes from the reference table any reference data whose reference table reference count is less than a predetermined value and intermediate calculation results corresponding to the reference data. Then, the reference count in the reference table is cleared. In FIG. 10, since the number of receptions of the reference data DDDDDD falls below the predetermined value of 500, the reference data DDDDDD and the corresponding midway calculation result WWWWWW are deleted from the reference table. Also, the reference count is cleared for other reference data.

このように、本実施形態によれば、参照頻度が低下した基準データ及び対応する途中演算結果を、参照テーブルから削除することができる。これにより、参照テーブルの探査時間を短縮することができる。   Thus, according to the present embodiment, it is possible to delete the reference data whose reference frequency has decreased and the corresponding intermediate calculation result from the reference table. Thereby, the search time for the reference table can be shortened.

なお、所定の時間を所定期間としても良い。たとえば受信部32が受信するメッセージの総数が一定値に達する期間を所定期間としてもよい。   The predetermined time may be a predetermined period. For example, a period in which the total number of messages received by the receiving unit 32 reaches a certain value may be set as a predetermined period.

(第4実施形態)
本実施形態は、先行実施形態を参照できる。このため、先行実施形態に示した通信システム10及びECU30と共通する部分についての説明は省略する。
(Fourth embodiment)
This embodiment can refer to the preceding embodiment. For this reason, the description about the part which is common in the communication system 10 and ECU30 which were shown to prior embodiment is abbreviate | omitted.

本実施形態において、編集部40は、MAC生成部33による参照回数の多い基準データを早く探し出すことができるように、参照回数に応じて参照テーブルを編集する処理を実行する。ここでも、参照回数は、MAC生成部33が参照テーブルから途中演算結果を参照する度に更新される。参照回数は、MAC生成部33によって計数される。そして、図11に示すように、基準データに関連付けられて参照テーブルに記憶される。MAC生成部33は、例えばステップS40の処理において、途中演算結果(暗号文)を参照するとともに、参照した途中演算結果に対応する参照テーブルの参照回数をインクリメント(+1)する。   In the present embodiment, the editing unit 40 executes a process of editing the reference table in accordance with the reference count so that the reference data with a large reference count by the MAC generation unit 33 can be found quickly. Again, the reference count is updated each time the MAC generation unit 33 refers to the midway calculation result from the reference table. The reference count is counted by the MAC generation unit 33. Then, as shown in FIG. 11, it is stored in the reference table in association with the reference data. For example, in the process of step S40, the MAC generation unit 33 refers to the intermediate calculation result (ciphertext), and increments (+1) the reference table reference number corresponding to the referred intermediate calculation result.

編集部40は、たとえば所定の周期で、編集処理を実行する。編集部40は、参照テーブルの参照回数に応じて、基準データ及び対応する途中演算結果を並び替える。具体的には、図11に示すように、参照回数の多い途中演算結果に対応する基準データほど探査順が早くなるように、基準データ及び対応する途中演算結果を並び替える。   The editing unit 40 executes an editing process at a predetermined cycle, for example. The editing unit 40 rearranges the reference data and the corresponding midway calculation results according to the reference table reference count. Specifically, as shown in FIG. 11, the reference data and the corresponding intermediate calculation result are rearranged so that the reference data corresponding to the intermediate calculation result with a larger number of references has a faster search order.

このように、本実施形態によれば、参照回数に応じて参照テーブルを編集することができる。これにより、参照テーブルの探査時間を短縮することができる。   Thus, according to the present embodiment, the reference table can be edited according to the reference count. Thereby, the search time for the reference table can be shortened.

なお、編集処理を実行するタイミングは、上記した例に限定されない。MAC生成部33により参照テーブルの参照回数が更新される毎に、すなわち受信処理を実行する毎に、編集処理を実行してもよい。たとえばステップS80又はステップS90の処理が終了した後に、編集処理を実行してもよい。   Note that the timing for executing the editing process is not limited to the above example. The editing process may be executed every time the MAC table 33 updates the reference table reference count, that is, every time the reception process is executed. For example, the editing process may be executed after the process of step S80 or step S90 is completed.

(第5実施形態)
本実施形態は、先行実施形態を参照できる。このため、先行実施形態に示した通信システム10及びECU30と共通する部分についての説明は省略する。
(Fifth embodiment)
This embodiment can refer to the preceding embodiment. For this reason, the description about the part which is common in the communication system 10 and ECU30 which were shown to prior embodiment is abbreviate | omitted.

本実施形態では、受信したメッセージの基準データが所定長さ以下の場合、MAC生成部33が、参照テーブルを探査することなく、通常処理によってMACを生成する。   In the present embodiment, when the reference data of the received message is equal to or shorter than a predetermined length, the MAC generation unit 33 generates a MAC by normal processing without searching the reference table.

図12は、マイコン31が実行する受信処理を示している。ステップS15の処理が追加されている点が、先行実施形態(図6)と異なる。図12では、ステップS10の処理が終了した後に、MAC生成部33が、抽出した基準データが所定長さ以上であるか否かを判定する(ステップS15)。   FIG. 12 shows a reception process executed by the microcomputer 31. The point that the process of step S15 is added is different from the preceding embodiment (FIG. 6). In FIG. 12, after the process of step S10 is complete | finished, the MAC production | generation part 33 determines whether the extracted reference | standard data is more than predetermined length (step S15).

ここで、基準データが所定長さ以上であると、途中演算結果(暗号文)を参照したほうが通常処理よりも処理負荷が低くなる。一方、基準データが所定長さ未満であると、途中演算結果を参照したほうが通常処理よりも処理負荷が高くなる。このように、処理負荷を考慮して所定長さが設定され、予めメモリに記憶されている。   Here, when the reference data is equal to or longer than the predetermined length, referring to the midway calculation result (ciphertext) reduces the processing load compared to the normal processing. On the other hand, if the reference data is less than the predetermined length, the processing load is higher than the normal processing when referring to the intermediate calculation result. In this way, the predetermined length is set in consideration of the processing load and is stored in the memory in advance.

ステップS15において所定長さ以上であると判定すると、MAC生成部33は、ステップS20以降の処理を実行する。すなわち、参照テーブルを探査し、抽出した基準データが登録されている場合に、途中演算結果(暗号文)を参照してMACを生成する。基準データが登録されていない場合には、通常処理を実行してMACを生成する。   If it determines with it being beyond predetermined length in step S15, the MAC production | generation part 33 will perform the process after step S20. That is, when a reference table is searched and the extracted standard data is registered, the MAC is generated with reference to the midway calculation result (ciphertext). If the reference data is not registered, normal processing is executed to generate a MAC.

一方、ステップS15において所定長さ未満であると判定すると、ステップS20及びステップS30の処理を実行することなく、ステップS60の処理、すなわち通常処理を実行してMACを生成する。   On the other hand, if it is determined in step S15 that the length is less than the predetermined length, the process of step S60, that is, the normal process is performed without executing the processes of step S20 and step S30, and the MAC is generated.

このように、本実施形態によれば、基準データが長い場合に参照暗号文による処理を実行し、基準データが短い場合に通常処理を実行する。このように、基準データの長さに応じてMAC生成の処理を切り替えることができる。   As described above, according to the present embodiment, the process using the reference ciphertext is executed when the reference data is long, and the normal process is executed when the reference data is short. In this way, the MAC generation process can be switched according to the length of the reference data.

この明細書の開示は、例示された実施形態に制限されない。開示は、例示された実施形態と、それらに基づく当業者による変形態様を包含する。たとえば、開示は、実施形態において示された要素の組み合わせに限定されない。開示は、多様な組み合わせによって実施可能である。開示される技術的範囲は、実施形態の記載に限定されない。開示されるいくつかの技術的範囲は、特許請求の範囲の記載によって示され、さらに特許請求の範囲の記載と均等の意味及び範囲内でのすべての変更を含むものと解されるべきである。   The disclosure of this specification is not limited to the illustrated embodiments. The disclosure encompasses the illustrated embodiments and variations by those skilled in the art based thereon. For example, the disclosure is not limited to the combination of elements shown in the embodiments. The disclosure can be implemented in various combinations. The technical scope disclosed is not limited to the description of the embodiments. The several technical scopes disclosed are indicated by the description of the claims, and should be understood to include all modifications within the meaning and scope equivalent to the description of the claims. .

受信部32、MAC生成部33、共通鍵記憶部34、参照テーブル記憶部35、判定部36、メッセージ本体生成部37、フレーム生成部38、送信部39、及び編集部40が、マイコン31の機能部として構成される例を示したが、これに限定されない。実体的なメモリ装置に記録されたソフトウェア及びそれを実行するコンピュータ、ソフトウェアのみ、ハードウェアのみ、あるいはそれらの組合せによって提供することができる。ハードウェアである回路によって提供される場合、それは多数の論理回路を含むデジタル回路、またはアナログ回路によって提供することができる。   The reception unit 32, the MAC generation unit 33, the common key storage unit 34, the reference table storage unit 35, the determination unit 36, the message body generation unit 37, the frame generation unit 38, the transmission unit 39, and the editing unit 40 are functions of the microcomputer 31. Although the example comprised as a part was shown, it is not limited to this. Software recorded in a substantial memory device and a computer that executes the software, software only, hardware only, or a combination thereof can be provided. When provided by a circuit that is hardware, it can be provided by a digital circuit including multiple logic circuits, or an analog circuit.

しかしながら、MAC生成部33は、通常処理時に、排他的論理和及び暗号化処理CIPHをそれぞれ複数回実行する。したがって、ハードウェアで構成すると、コストが高くなる。これに対し、本実施形態に示すように、マイコン31の機能部とすると、コストを低減しつつ、処理負荷を低減することができる。 However, the MAC generation unit 33 executes exclusive OR and encryption processing CIPH K a plurality of times during normal processing. Therefore, when configured with hardware, the cost increases. On the other hand, as shown in this embodiment, when the function unit of the microcomputer 31 is used, the processing load can be reduced while reducing the cost.

10…通信システム、
20…CANバス、
30…ECU(電子制御装置)、
31…マイコン、
32…受信部、
33…MAC生成部、
34…共通鍵記憶部、
35…参照テーブル記憶部、
36…判定部、
37…メッセージ本体生成部、
38…フレーム生成部、
39…送信部、
40…編集部
10: Communication system,
20 ... CAN bus,
30 ... ECU (electronic control unit),
31 ... Microcomputer,
32 ... receiving part,
33 ... MAC generator,
34 ... common key storage unit,
35 ... Reference table storage unit,
36 ... determination part,
37 ... Message body generation unit,
38 ... Frame generation unit,
39: Transmitter,
40 ... Editor

Claims (8)

他の装置とともにネットワークに接続される電子制御装置であって、
前記他の装置から送信され、保護対象である保護対象データに続いて再送攻撃を防ぐためのデータが設定されたメッセージ本体と、前記メッセージ本体に基づいて算出されたメッセージ認証コードと、を含むメッセージを受信する受信部(32)と、
前記受信部により受信された前記メッセージのうちの前記メッセージ本体を、一定の長さを有する複数のブロックに分割し、共通鍵を用いた演算によりメッセージ認証コードを生成する生成部(33)と、
前記生成部により生成された前記メッセージ認証コードと、前記受信部により受信された前記メッセージに含まれる前記メッセージ認証コードとが一致するか否かを判定する判定部(36)と、
前記保護対象データのみを含むブロックであって、最初のブロックからj番目(jは2以上の正数)のブロックまでの前記保護対象データである基準データと、前記基準データを前記共通鍵によって暗号化してなり、前記メッセージ認証コードの演算の途中結果である暗号文との対応関係を示す参照テーブルを記憶する記憶部(35)と、
を備え、
前記生成部は、前記参照テーブルを探査して、前記受信部により受信された前記メッセージの基準データと一致するデータが前記参照テーブルに登録されていると判定すると、前記基準データに対応する暗号文を前記参照テーブルから参照して、参照した前記暗号文と、前記共通鍵と、前記参照テーブルに登録されていない残りのブロックのデータとにより、前記メッセージ認証コードを生成する電子制御装置。
An electronic control device connected to a network together with other devices,
A message including a message body that is transmitted from the other device and in which data for preventing a replay attack is set subsequent to the protection target data that is a protection target, and a message authentication code calculated based on the message body Receiving unit (32) for receiving
A generating unit (33) that divides the message body of the message received by the receiving unit into a plurality of blocks having a certain length and generates a message authentication code by a calculation using a common key;
A determination unit (36) for determining whether or not the message authentication code generated by the generation unit and the message authentication code included in the message received by the reception unit match;
A block including only the protection target data, the reference data that is the protection target data from the first block to the jth block (j is a positive number of 2 or more), and the reference data is encrypted with the common key A storage unit (35) for storing a reference table indicating a correspondence relationship with a ciphertext that is an intermediate result of the calculation of the message authentication code,
With
When the generation unit searches the reference table and determines that data matching the reference data of the message received by the reception unit is registered in the reference table, the ciphertext corresponding to the reference data The electronic control device generates the message authentication code by referring to the ciphertext, the common key, and the remaining block data not registered in the reference table.
前記基準データは、前記保護対象データのみを含むすべてのブロックの前記保護対象データである請求項1に記載の電子制御装置。   The electronic control device according to claim 1, wherein the reference data is the protection target data of all blocks including only the protection target data. 前記参照テーブルは、固定値として前記記憶部に予め記憶されている請求項1又は請求項2に記載の電子制御装置。   The electronic control device according to claim 1, wherein the reference table is stored in advance in the storage unit as a fixed value. 前記参照テーブルを編集する編集部(40)をさらに備える請求項1〜3いずれか1項に記載の電子制御装置。   The electronic control device according to any one of claims 1 to 3, further comprising an editing unit (40) for editing the reference table. 前記編集部は、受信回数が所定値以上の基準データ及び該基準データに対応する暗号文を、前記参照テーブルに追加登録する請求項4に記載の電子制御装置。   The electronic control device according to claim 4, wherein the editing unit additionally registers reference data having a reception count equal to or greater than a predetermined value and a ciphertext corresponding to the reference data in the reference table. 前記編集部は、所定期間における参照回数が所定値を下回る基準データ及び該基準データに対応する暗号文を、前記参照テーブルから削除する請求項4に記載の電子制御装置。   The electronic control device according to claim 4, wherein the editing unit deletes, from the reference table, standard data whose number of references in a predetermined period is less than a predetermined value and ciphertext corresponding to the standard data. 前記編集部は、前記生成部が参照回数の多い基準データを早く探し出すことができるように、前記参照回数に応じて前記参照テーブルを編集する請求項4に記載の電子制御装置。   The electronic control device according to claim 4, wherein the editing unit edits the reference table according to the reference count so that the generation unit can quickly find reference data having a high reference count. 前記受信部により受信された前記メッセージの基準データが所定長さ未満の場合、前記生成部は、前記参照テーブルを探査することなく、演算によって前記メッセージ認証コードを生成する請求項1〜7いずれか1項に記載の電子制御装置。   The said authentication part produces | generates the said message authentication code by calculation, without searching the said reference table, when the reference | standard data of the said message received by the said receiving part are less than predetermined length. The electronic control device according to item 1.
JP2017161571A 2017-08-24 2017-08-24 Electronic control device Active JP6958114B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017161571A JP6958114B2 (en) 2017-08-24 2017-08-24 Electronic control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017161571A JP6958114B2 (en) 2017-08-24 2017-08-24 Electronic control device

Publications (2)

Publication Number Publication Date
JP2019041228A true JP2019041228A (en) 2019-03-14
JP6958114B2 JP6958114B2 (en) 2021-11-02

Family

ID=65725846

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017161571A Active JP6958114B2 (en) 2017-08-24 2017-08-24 Electronic control device

Country Status (1)

Country Link
JP (1) JP6958114B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020213744A1 (en) * 2019-04-19 2020-10-22 日立オートモティブシステムズ株式会社 Computation device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013065241A1 (en) * 2011-10-31 2013-05-10 日本電気株式会社 Incremental mac tag generation device, method, and program, and message authentication device
JP2013115570A (en) * 2011-11-28 2013-06-10 Oki Electric Ind Co Ltd Multi-hop communication system, communication device, and communication program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013065241A1 (en) * 2011-10-31 2013-05-10 日本電気株式会社 Incremental mac tag generation device, method, and program, and message authentication device
JP2013115570A (en) * 2011-11-28 2013-06-10 Oki Electric Ind Co Ltd Multi-hop communication system, communication device, and communication program

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020213744A1 (en) * 2019-04-19 2020-10-22 日立オートモティブシステムズ株式会社 Computation device
JP2020177504A (en) * 2019-04-19 2020-10-29 日立オートモティブシステムズ株式会社 Arithmetic unit
CN113711213A (en) * 2019-04-19 2021-11-26 日立安斯泰莫株式会社 Arithmetic device
JP7306865B2 (en) 2019-04-19 2023-07-11 日立Astemo株式会社 Arithmetic unit
US12019787B2 (en) 2019-04-19 2024-06-25 Hitachi Astemo, Ltd. Arithmetic device

Also Published As

Publication number Publication date
JP6958114B2 (en) 2021-11-02

Similar Documents

Publication Publication Date Title
Wang et al. VeCure: A practical security framework to protect the CAN bus of vehicles
EP3038318B1 (en) Communication control apparatus, communication control method and communication control program
CN104025506B (en) Message authentication method in communication system and communication system
US10862670B2 (en) Automotive nonce-misuse-resistant authenticated encryption
US20160006570A1 (en) Generating a key derived from a cryptographic key using a physically unclonable function
CN110059089B (en) Data synchronization method and device, storage medium and electronic equipment
JP2012186635A (en) Vehicle network system
JP2007089147A (en) Method for authentication
JP6693577B2 (en) Encryption key distribution system, key distribution ECU, key distribution program, and encryption key distribution method
US10122755B2 (en) Method and apparatus for detecting that an attacker has sent one or more messages to a receiver node
CN112636898B (en) Communication method, device and system based on communication network
CN111865557B (en) Verification code generation method and device
JP2010510756A (en) A processing method for message integrity with tolerance for non-sequential arrival of message data
JP6534913B2 (en) Information processing apparatus and fraudulent message detection method
CN112600838B (en) CAN bus data encryption method and device, storage medium and electronic equipment
EP1615370A1 (en) Authentication of short messages
CN113489589A (en) Data encryption and decryption method and device and electronic equipment
JP6958114B2 (en) Electronic control device
KR101358473B1 (en) Wireless communication apparatus and wireless communication method
Ansari et al. IntelliCAN: Attack-resilient controller area network (CAN) for secure automobiles
US10608822B2 (en) Efficient calculation of message authentication codes for related data
Khairallah Forgery attack on mixfeed in the nonce-misuse scenario
JP2019080241A (en) In-vehicle system and data transmission/reception method in in-vehicle system
CN112740726B (en) Data transmission method and device
JP2006173735A (en) Message authentication method, message authentication device using the same, and message authentication system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200717

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210326

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210406

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210601

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: 20210907

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210920

R151 Written notification of patent or utility model registration

Ref document number: 6958114

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151