Electronic control unit, MAC transmission method, storage medium, and electronic control system
An electronic control unit is configured to generate a MAC on a basis of transmission data, divide the MAC into a plurality of partial MACs, generate individual identification information items which are information items indicating respective portions of the MAC occupied by the individual partial MACs, store the transmission data in at least one of a plurality of frames and store the individual partial MACs and the individual identification information items corresponding thereto in the plurality of respective fames, and transmit the plurality of frames.
1 . An electronic control unit comprising:
at least one of (i) a circuit and (ii) a processor with a memory storing computer program code executable by the processor, the at least one of the circuit and the processor configured to cause the electronic control unit to implement:
a message authentication code (MAC) generation unit that is configured to generate a MAC on a basis of transmission data;
a MAC division unit that is configured to divide a single MAC generated for the transmission data into a plurality of partial MACs, each partial MAC corresponding to a different portion of the single MAC;
an identification information generation unit that is configured to generate individual identification information items which are information items indicating respective portions of the MAC occupied by the individual partial MACs;
a frame generation unit that is configured to store the transmission data in at least one of a plurality of frames and store the individual partial MACs and the individual identification information items corresponding thereto in the plurality of respective frames;
a MAC range determination unit that is configured to select between a case where all of the plurality of partial MACs are transmitted and a case where only a part of the plurality of partial MACs are transmitted, on a basis of a type of the transmission data or a transmission destination of the transmission data, and to determine selection; and
a transmission unit that is configured to transmit the plurality of frames.
2 . The electronic control unit according to claim 1 , wherein
the identification information item indicates an absolute position of the partial MAC in the MAC.
3 . The electronic control unit according to claim 1 , wherein
the identification information item indicates an order of the partial MAC starting at a head of the MAC.
4 . The electronic control unit according to claim 1 , wherein
the identification information item stored in the one of the plurality of frames that is last in an order of transmission from the transmission unit serves also as termination information indicating that the order of transmission is last.
5 . The electronic control unit according to claim 4 , wherein
the termination information is a maximum one of values that can be taken by the identification information items.
6 . The electronic control unit according to claim 1 , wherein
the frame generation unit stores termination information indicating that an order of transmission from the transmission unit is last in the one of the plurality of frames that is last in the order of transmission.
7 . The electronic control unit according to claim 1 , wherein
when the frames generated by the frame generation unit are based on a controller area network communication protocol, the identification information items are assigned to data length codes stored in control fields of the frames.
8 . The electronic control unit according to claim 7 , wherein
the identification information items assigned to the data length codes are numerical values in a range of eight to fifteen.
9 . The electronic control unit according to claim 1 , wherein
the identification information items are stored in data fields of the frames.
10 . The electronic control unit according to claim 1 , wherein
when the frames generated by the frame generation unit are based on a controller area network communication protocol, the identification information items are assigned to identifiers stored in arbitration fields of the frames.
11 . The electronic control unit according to claim 1 , wherein:
when the MAC range determination unit determines not to transmit all of the plurality of partial MACs, the transmission unit transmits the frame storing the transmission data and at least one of the plurality of partial MACs.
12 . The electronic control unit according to claim 1 , wherein
the electronic control unit is mounted on a movable object.
13 . The electronic control unit according to claim 1 , wherein when the type of the transmission data relates to a behavior of a movable object, all of the plurality of partial MACs are transmitted.
14 . The electronic control unit according to claim 1 , wherein when the type of the transmission data is not directly related to traveling, a part of the plurality of partial MACs is transmitted.
15 . The electronic control unit according to claim 1 , wherein when the transmission destination of the transmission data is not capable of reconstructing the MAC from the partial MACs, the partial MAC that is first in order among the plurality of partial MACs is transmitted.
16 . A message authentication code (MAC) transmission method to be implemented by an electronic control unit, the MAC transmission method comprising:
generating a MAC on a basis of transmission data;
dividing a single MAC generated for the transmission data into a plurality of partial MACs, each partial MAC corresponding to a different portion of the single MAC;
generating individual identification information items which are information items indicating respective portions of the MAC occupied by the individual partial MACs;
storing the transmission data in at least one of a plurality of frames, while storing the individual partial MACs and the individual identification information items in the plurality of respective frames;
selecting between a case where all of the plurality of partial MACs are transmitted and a case where only a part of the plurality of partial MACs are transmitted, on a basis of a type of the transmission data or a transmission destination of the transmission data, and determining selection; and
transmitting the plurality of frames.
17 . A non-transitory computer readable storage medium storing a message authentication code (MAC) transmission program executable by an electronic control unit, the MAC transmission program causing the electronic control unit to:
generate the MAC on a basis of transmission data;
divide a single MAC generated for the transmission data into a plurality of partial MACs, each partial MAC corresponding to a different portion of the single MAC;
generate individual identification information items which are information items indicating respective portions of the MAC occupied by the individual partial MACs;
store the transmission data in at least one of a plurality of frames, while storing the individual partial MACs and the individual identification information items in the plurality of respective frames;
select between a case where all of the plurality of partials MACs are transmitted and a case where only a part of the plurality of partial MACs are transmitted, on a basis of a type of the transmission data or a transmission destination of the transmission data, and determine selection; and
transmit the plurality of frames.
18 . An electronic control system comprising:
a first electronic control unit; and
a second electronic control unit;
wherein:
the first electronic control unit includes:
a first message authentication code (MAC) generation unit that generates a first MAC on a basis of transmission data;
a MAC division unit that divides a single MAC generate for the transmission data into a plurality of partial MACs, each partial MAC corresponding to a different portion of the single MAC;
an identification information generation unit that generates individual identification information items which are information items indicating respective portions of the MAC occupied by the individual partial MACs;
a frame generation unit that stores the transmission data in at least one of a plurality of frames, while storing the individual partial MACs and the individual identification information items in the plurality of respective frames;
a MAC range determination unit that selects between a case where all of the plurality of partial MACs are transmitted and a case where only a part of the plurality of partial MACs are transmitted, on a basis of a type of the transmission data or a transmission destination of the transmission data, and determines selection; and
a transmission unit that transmits the plurality of frames, and the second electronic control unit includes:
a reception unit that receives the plurality of frames;
a MAC restoration unit that uses the individual partial MACs and the individual identification information items which are stored in the plurality of respective frames to generate a second MAC;
a second MAC generation unit that generates a third MAC on a basis of the transmission data stored in at least one of the plurality of frames received by the reception unit; and
an authentication unit that compares the second MAC to the third MAC to authenticate the transmission data.
19 . The electronic control system according to claim 18 , wherein
the second electronic control unit further includes:
a MAC range determination unit that determines, on a basis of a type of the transmission data stored in at least one of the plurality of frames received by the reception unit, whether or not to perform authentication by using all of the individual partial MACs,
wherein:
when the MAC range determination unit determines not to use all of the individual partial MACs,
the MAC restoration unit extracts the identification information item and a first partial MAC which is the partial MAC included in one of the plurality of frames,
the MAC generation unit generates a second partial MAC on a basis of the transmission data and the identification information item each stored in at least one of the plurality of frames received by the reception unit, and
the authentication unit compares the first partial MAC to the second partial MAC to authenticate the transmission data.