Implementation method for flashing high-safety embedded controller diagnostic instrument
By using session mode switching, key verification and data packet encryption verification in automotive electronic control unit diagnosis and communication, and using CRC-32 and AES-128 algorithms, the problem of insufficient flash data transmission security in the existing technology is solved. , achieving high-security data transmission.
Patent Information
- Application Number
- CN202410887138.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The flash implementation method in the existing standard protocol for diagnosis and communication of automotive electronic control units lacks data transmission security guarantee, resulting in poor data transmission security.
Through session mode switching, key verification, and data packet encryption and verification, CRC-32 and AES-128 algorithms are used to ensure the confidentiality and integrity of data transmission, including sending session mode switching requests, generating and verifying keys, and verifying data. The packet undergoes CRC check and AES-128 encryption and decryption.
The confidentiality and security of flash data transmission are improved, while maintaining high implementability and ensuring the integrity and security of data transmission.
Smart Images

Figure CN118760125A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of flashing an embedded controller diagnostic instrument, and in particular relates to a method for implementing flashing an embedded controller diagnostic instrument with high security. Background Art
[0002] With the continuous changes in the functional requirements of vehicle electronic control units, functional updates, and vulnerability fixes, it is particularly important to ensure the security and reliability of data transmission.
[0003] The implementation standard of the standard protocol for automotive electronic control unit diagnosis and communication has been widely used in the industry as a unified channel to achieve security and reliability of data transmission.
[0004] Currently, the flashing implementation method in the standard protocol for automotive electronic control unit diagnosis and communication generally only includes identity authentication, and does not take any measures to ensure the security of flashing data transmission, resulting in poor data transmission security of the flashing implementation method.
[0005] In view of this, a high-security embedded controller diagnostic instrument flashing implementation method is designed to solve the above problems. Summary of the invention
[0006] To solve the problems raised in the above background technology, the present invention provides a method for implementing flashing of a highly secure embedded controller diagnostic instrument, which has the characteristics of being able to simultaneously improve the confidentiality and security of flashing data transmission and being highly feasible.
[0007] To achieve the above object, the present invention provides the following technical solution: a method for implementing flashing of a high-security embedded controller diagnostic instrument, comprising the following steps:
[0008] S1: The embedded controller diagnostic instrument sends a session mode switching request to the lower computer. The lower computer receives the sent session mode switching request and gives a positive response. The session mode switching is successful and the subsequent flashing process is executed. Otherwise, a negative response is given. The session mode switching fails and the subsequent flashing process is exited.
[0009] S2: The embedded controller diagnostic instrument sends a security access request to the lower computer, requesting a random seed number. The lower computer receives the security access request, generates a random number seed, and sends it to the embedded controller diagnostic instrument. The embedded controller diagnostic instrument receives the sent random number seed, and generates a key based on a predefined security algorithm and the received random number seed. The embedded controller diagnostic instrument sends the generated key to the lower computer. The lower computer receives the sent generated key, and generates a key based on a predefined security algorithm and a random number seed generated by itself. The two keys are compared. If the two keys are the same, a positive response is given and the subsequent flashing process is executed. Otherwise, a negative response is given and the subsequent flashing process is exited.
[0010] S3: The embedded controller diagnostic instrument transmits data to the lower computer, first checks the data packet through the CRC algorithm, fills the check result at the end of the data packet, and then encrypts the data packet filled with CRC check bits through the AES-128 algorithm. When the lower computer receives the data packet, it first decrypts the received data packet in a reverse manner, and compares the sequence number of the decrypted data packet with the sequence number of the previous data packet. If the sequence is correct, the decryption is considered to be valid, and a positive response is given to execute the subsequent flashing process. Otherwise, a negative response is given and the subsequent flashing process is exited. The received data packet is then checked through the CRC algorithm, and the check result is compared with the end data bit of the received data packet. If the sequence is correct, the data packet is considered to be complete, and a positive response is given to execute the flashing process. Otherwise, a negative response is given and the flashing program is exited.
[0011] Furthermore, in step S2, the predefined security algorithm can be customized according to specific usage conditions.
[0012] Furthermore, in step S3, the CRC algorithm uses CRC-32, and the mask involved in the calculation can be customized according to the specific usage. The polynomial is 04C11DB7, and the formula is as follows:
[0013] x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1.
[0014] Furthermore, in step S3, the specific steps of encrypting the data packet filled with CRC check bits using the AES-128 algorithm include:
[0015] S31: Round key addition
[0016] Perform an XOR operation on the round key and the state matrix, where the round key used in the initial round key addition operation is the original key of the algorithm itself, and the length of the round key is equal to the length of the data packet, that is, 128 bits;
[0017] S32: Byte Replacement
[0018] Each byte of the state matrix is replaced respectively, which is the only nonlinear transformation in the round transformation. This nonlinear transformation is also called an S-box, where the input byte form is a hexadecimal S-box table of xy;
[0019] S33: Row Shift Transform
[0020] In units of bytes, each row of the state matrix is circularly shifted by different displacement amounts. In AES, the first row is not shifted, the second row is circularly shifted by one unit, the third row is circularly shifted by two units, and the fourth row is circularly shifted by three units.
[0021] S34: Mixed Column Transformation
[0022] The elements on each column of the state matrix are mixed, a column of the state matrix is transformed, and this column is multiplied with a matrix, and then the remainder is taken, where the modulus of the remainder is a polynomial: m(x)=x8+x4+x3+x+1.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] The present invention realizes flashing through session mode switching results, key verification results, transmission data packet encryption verification results and transmission data packet integrity results. Compared with the prior art, this method can simultaneously improve the confidentiality and security of flashing data transmission and has high feasibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flowchart based on key authentication of the present invention;
[0026] Figure 2 The present invention is a flow chart based on data packet transmission encryption and integrity verification. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] The flashing environment of this embodiment is composed of a bus adapter, a flashing program, a compiled lower computer, a hex / .bin file, a connecting harness, a DB9 connector and a 12v / 24v DC regulated power supply.
[0029] See also Figure 1-2The present invention provides the following technical solution: a method for implementing flashing of a high-security embedded controller diagnostic instrument, comprising the following steps:
[0030] S1: The embedded controller diagnostic instrument sends a session mode switching request to the lower computer. The lower computer receives the sent session mode switching request and gives a positive response. The session mode switching is successful and the subsequent flashing process is executed. Otherwise, a negative response is given. The session mode switching fails and the subsequent flashing process is exited.
[0031] S2: The embedded controller diagnostic instrument sends a security access request to the lower computer, requesting a random seed number. The lower computer receives the security access request, generates a random number seed, and sends it to the embedded controller diagnostic instrument. The embedded controller diagnostic instrument receives the sent random number seed, and generates a key based on a predefined security algorithm and the received random number seed. The embedded controller diagnostic instrument sends the generated key to the lower computer. The lower computer receives the sent generated key, and generates a key based on a predefined security algorithm and a random number seed generated by itself. The two keys are compared. If the two keys are the same, a positive response is given and the subsequent flashing process is executed. Otherwise, a negative response is given and the subsequent flashing process is exited.
[0032] S3: The embedded controller diagnostic instrument transmits data to the lower computer, first checks the data packet through the CRC algorithm, fills the check result at the end of the data packet, and then encrypts the data packet filled with CRC check bits through the AES-128 algorithm. When the lower computer receives the data packet, it first decrypts the received data packet in a reverse manner, and compares the sequence number of the decrypted data packet with the sequence number of the previous data packet. If the sequence is correct, the decryption is considered to be valid, and a positive response is given to execute the subsequent flashing process. Otherwise, a negative response is given and the subsequent flashing process is exited. The received data packet is then checked through the CRC algorithm, and the check result is compared with the end data bit of the received data packet. If the sequence is correct, the data packet is considered to be complete, and a positive response is given to execute the flashing process. Otherwise, a negative response is given and the flashing program is exited.
[0033] Specifically, in step S2, the predefined security algorithm can be customized according to specific usage conditions.
[0034] Specifically, in step S3, the CRC algorithm uses CRC-32, and the mask involved in the calculation can be customized according to the specific usage. The polynomial is 04C11DB7, and the formula is as follows:
[0035] x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1.
[0036] Specifically, in step S3, the specific steps of encrypting the data packet filled with CRC check bits using the AES-128 algorithm include:
[0037] S31: Round key addition
[0038] Perform an XOR operation on the round key and the state matrix, where the round key used in the initial round key addition operation is the original key of the algorithm itself, and the length of the round key is equal to the length of the data packet, that is, 128 bits;
[0039] example:
[0040]
[0041] S32: Byte Replacement
[0042] Each byte of the state matrix is replaced respectively, which is the only nonlinear transformation in the round transformation. This nonlinear transformation is also called an S-box, where the input byte form is a hexadecimal S-box table of xy;
[0043] example:
[0044]
[0045] S33: Row Shift Transform
[0046] In units of bytes, each row of the state matrix is circularly shifted by different displacement amounts. In AES, the first row is not shifted, the second row is circularly shifted by one unit, the third row is circularly shifted by two units, and the fourth row is circularly shifted by three units.
[0047] example:
[0048]
[0049] S34: Mixed Column Transformation
[0050] Mix the elements on each column of the state matrix, transform a column of the state matrix, perform multiplication operation on the column and a matrix, and then take the remainder, where the modulus of the remainder is: m(x)=x8+x4+x3+x+1;
[0051] example:
[0052]
[0053] This method can be applied to the company's compressor control board to meet the reliability and security requirements of data when the embedded program of the compressor control board is upgraded;
[0054] This method can be applied to vehicle electronic controllers to meet their needs for data transmission security and fault tolerance in situations such as function upgrades, problem repairs, and function configuration adjustments;
[0055] The method can be applied to the program upgrade of an electronic control unit containing CAN / LIN bus message processing to meet its requirements for data reliability and security.
[0056] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for implementing flashing of a high-security embedded controller diagnostic instrument, characterized in that: The following steps are involved: S1: The embedded controller diagnostic instrument sends a session mode switching request to the lower computer. The lower computer receives the sent session mode switching request and gives a positive response. The session mode switching is successful and the subsequent flashing process is executed. Otherwise, a negative response is given. The session mode switching fails and the subsequent flashing process is exited. S2: The embedded controller diagnostic instrument sends a security access request to the lower computer, requesting a random seed number. The lower computer receives the security access request, generates a random number seed, and sends it to the embedded controller diagnostic instrument. The embedded controller diagnostic instrument receives the sent random number seed, and generates a key based on a predefined security algorithm and the received random number seed. The embedded controller diagnostic instrument sends the generated key to the lower computer. The lower computer receives the sent generated key, and generates a key based on a predefined security algorithm and a random number seed generated by itself. The two keys are compared. If the two keys are the same, a positive response is given and the subsequent flashing process is executed. Otherwise, a negative response is given and the subsequent flashing process is exited. S3: The embedded controller diagnostic instrument transmits data to the lower computer, first checks the data packet through the CRC algorithm, fills the check result at the end of the data packet, and then encrypts the data packet filled with CRC check bits through the AES-128 algorithm. When the lower computer receives the data packet, it first decrypts the received data packet in a reverse manner, and compares the sequence number of the decrypted data packet with the sequence number of the previous data packet. If the sequence is correct, the decryption is considered to be valid, and a positive response is given to execute the subsequent flashing process. Otherwise, a negative response is given and the subsequent flashing process is exited. The received data packet is then checked through the CRC algorithm, and the check result is compared with the end data bit of the received data packet. If the sequence is correct, the data packet is considered to be complete, and a positive response is given to execute the flashing process. Otherwise, a negative response is given and the flashing program is exited.
2. The method for implementing flashing of a high-security embedded controller diagnostic instrument according to claim 1, characterized in that: In step S2, the predefined security algorithm can be customized according to specific usage conditions.
3. The method for implementing flashing of a high-security embedded controller diagnostic instrument according to claim 1, characterized in that: In step S3, the CRC algorithm uses CRC-32, and the mask involved in the calculation can be customized according to the specific usage. The polynomial is 04C11DB7, and the formula is as follows: x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1.
4. The method for implementing flashing of a high-security embedded controller diagnostic instrument according to claim 1, characterized in that: In step S3, the specific steps of encrypting the data packet filled with CRC check bits using the AES-128 algorithm include: S31: Round key addition Perform an XOR operation on the round key and the state matrix, where the round key used in the initial round key addition operation is the original key of the algorithm itself, and the length of the round key is equal to the length of the data packet, that is, 128 bits; S32: Byte Replacement Each byte of the state matrix is replaced respectively, which is the only nonlinear transformation in the round transformation. This nonlinear transformation is also called an S-box, where the input byte form is a hexadecimal S-box table of xy; S33: Row Shift Transform In units of bytes, each row of the state matrix is circularly shifted by different displacement amounts. In AES, the first row is not shifted, the second row is circularly shifted by one unit, the third row is circularly shifted by two units, and the fourth row is circularly shifted by three units. S34: Mixed Column Transformation The elements on each column of the state matrix are mixed, a column of the state matrix is transformed, and this column is multiplied with a matrix, and then the remainder is taken, where the modulus of the remainder is a polynomial: m(x)=x8+x4+x3+x+1.
