Tamper-proof security start control method
By sorting software in the automotive ECU and verifying the code segment using the AES algorithm, the problem of insufficient information security in the automotive system is solved, fast and secure startup is achieved, the attack surface is reduced, and the system security is improved.
Patent Information
- Application Number
- CN202411019088.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-12-27
AI Technical Summary
The existing automotive chips and software systems have shortcomings in information security, which leads to the system being easily invaded and maliciously manipulated, causing the risk of car theft or accidents. The excessive verification code content during safe startup violates the ECU's rapid operation requirements.
By classifying the software in the ECU, setting up a secure boot table, and using the AES algorithm to calculate the CMAC value of each code, store it in non-volatile memory, randomly verifying core and non-core code segments, reducing the amount of code per verification , expand the scope of verification.
While reducing verification time, the scope of code verification is increased, the attack surface is reduced, and the security of the automotive system is improved.
Smart Images

Figure CN119203140A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of steering systems, in particular to a tamper-proof safety startup control method. Background Art
[0002] The safety mechanism of automobiles actually mainly includes two aspects: functional safety (Safety) and information security (Security). In the early design of automobile chips and software systems, information security was not considered too much. As automobiles become more intelligent and networked, information security is playing an increasingly important role. Once the system is illegally hacked, the automobile system may be maliciously manipulated, which may cause the car to be stolen or even a vehicle accident. Therefore, safe startup is very necessary, but the more code content is verified during safe startup, the more times it is needed, which is contrary to the requirement that the ECU run as quickly as possible. After thinking about the above problems, this solution optimizes the above problems, which can simultaneously reduce the verification time, expand the verification scope, and reduce the attack surface. Summary of the invention
[0003] In order to overcome the deficiencies of the prior art, the present invention provides a tamper-proof secure startup control method, which can increase the scope of verified codes while reducing the time for verifying codes.
[0004] To achieve the above purpose, a tamper-proof secure startup control method is designed, including software in the ECU, which is characterized by: the specific method is as follows:
[0005] S1, first, classify the software to be run in the ECU and distinguish the software A in the ECU as needed; S2, secondly, each time the software A is flashed to the ECU, set the secure boot table and store it in the non-volatile memory; S3, finally, after the flashing is completed, each time the ECU is powered on, when entering the software running stage, it is necessary to randomly verify the data in the secure boot table set in step S2.
[0006] The specific process of step S1 is as follows:
[0007] S11, distinguishing a code range B that needs to be protected from attacks and a code range F that does not need to be protected from attacks from software A in the ECU;
[0008] S12, distinguishing the core code C1 and the non-core code C2 from the code range B that needs to be protected from attacks;
[0009] S13, divide the core code C1 into N parts, namely K1, K2, K3, ..., K N ;
[0010] S14, divide the non-core code C2 into M parts, namely D1, D2, D3, ..., DM .
[0011] The specific process of step S2 is as follows:
[0012] S21, take out the core code C1, divide the core code C1 into N parts, and use the AES algorithm to calculate the CMAC value R1, R2, R3, ... R of each part of the code. N ;
[0013] S22, take out the non-core code C2, divide the non-core code C2 into M parts, and use the AES algorithm to calculate the CMAC value R of each part of the code N+1 , R N+2 ,...R N+M ;
[0014] S23, set up an independent secure boot table, and store the CMAC values of the core code C1 and the non-core code C2 calculated in steps S21 and S22 in the secure boot table, and store the secure boot table in the non-volatile access memory of the MCU.
[0015] The specific process of step S3 is as follows:
[0016] S31, verify whether the core code C1 has been tampered with: after power-on, randomly select K copies of the core code C1 from the N copies of the core code C1, and use the AES algorithm to calculate the CMAC value V1, V2, ... V of each of the K copies of the code. K ;
[0017] S32, the CMAC values V1, V2, ... V calculated in step 31 are K and the CMAC values R1, R2, R3, ... R calculated in step S21 N Perform a one-to-one comparison of the corresponding serial numbers. If the two are not equal, the verification is considered to have failed, and post-processing is performed to determine if the code has been tampered with. If the two are equal, the core code C1 segment verification is considered to have succeeded.
[0018] S33, similarly, in the non-core code C2, J codes are randomly selected from the M codes of the non-core code C2, and the CMAC value V1, V2, ... V of each code in the J codes is calculated using the AES algorithm. J ;
[0019] S34, the CMAC values V1, V2, ... V calculated in step 33 are J The CMAC value R calculated in step S22 N+1 , R N+2 ,...R N+MThe corresponding serial numbers are compared one by one. If the two are not equal, the verification is considered to have failed, and post-processing of the code being tampered is performed; if the two are equal, the non-core code C2 segment verification is considered to have succeeded; S35, after the security boot table verification is successful, this security boot verification is successful, and the ECU internal code continues to run.
[0020] In the step S3, the running stage is before entering the boot program or before entering the APPL application; the boot program is a boot startup program.
[0021] Said K≤N, J≤M.
[0022] The secure boot table includes a number, a start and end address of a code segment corresponding to the number, a CMAC value of the code segment corresponding to the start and end address obtained by an AES algorithm, and a key.
[0023] The key is a primary key or a self-generated key.
[0024] The non-volatile access memory is the EE area of the HSM core.
[0025] Compared with the prior art, the present invention provides a tamper-proof secure startup control method, which can verify less code each time, can disperse the verification of codes in different address segments, and expand the scope of verification, thereby reducing the attack surface. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of the process of the present invention.
[0027] Figure 2 It is a schematic diagram of the process of step S3 of the present invention. DETAILED DESCRIPTION
[0028] The present invention will be further described below with reference to the accompanying drawings.
[0029] like Figure 1 , Figure 2 As shown, a tamper-proof secure startup control method, the specific method is as follows:
[0030] S1, first, classify the software to be run in the ECU and distinguish the software A in the ECU as needed; S2, secondly, each time the software A is flashed to the ECU, set the secure boot table and store it in the non-volatile memory; S3, finally, after the flashing is completed, each time the ECU is powered on, when entering the software running stage, it is necessary to randomly verify the data in the secure boot table set in step S2.
[0031] The specific process of step S1 is as follows:
[0032] S11, distinguishing a code range B that needs to be protected from attacks and a code range F that does not need to be protected from attacks from software A in the ECU;
[0033] S12, distinguishing the core code C1 and the non-core code C2 from the code range B that needs to be protected from attacks;
[0034] S13, divide the core code C1 into N parts, namely K1, K2, K3, ..., K N ;
[0035] S14, divide the non-core code C2 into M parts, namely D1, D2, D3, ..., D M .
[0036] The specific process of step S2 is as follows:
[0037] S21, take out the core code C1, divide the core code C1 into N parts, and use the AES algorithm to calculate the CMAC value R1, R2, R3, ... R of each part of the code. N ;
[0038] S22, take out the non-core code C2, divide the non-core code C2 into M parts, and use the AES algorithm to calculate the CMAC value R of each part of the code N+1 , R N+2 ,...R N+M ;
[0039] S23, set up an independent secure boot table, and store the CMAC values of the core code C1 and the non-core code C2 calculated in steps S21 and S22 in the secure boot table, and store the secure boot table in the non-volatile access memory of the MCU.
[0040] The specific process of step S3 is as follows:
[0041] S31, verify whether the core code C1 has been tampered with: after power-on, randomly select K copies of the core code C1 from the N copies of the core code C1, and use the AES algorithm to calculate the CMAC value V1, V2, ... V of each of the K copies of the code. K ;
[0042] S32, the CMAC values V1, V2, ... V calculated in step 31 are K and the CMAC values R1, R2, R3, ... R calculated in step S21 N Perform a one-to-one comparison of the corresponding serial numbers. If the two are not equal, the verification is considered to have failed, and post-processing is performed to determine if the code has been tampered with. If the two are equal, the core code C1 segment verification is considered to have succeeded.
[0043] S33, similarly, in the non-core code C2, J codes are randomly selected from the M codes of the non-core code C2, and the CMAC value V1, V2, ... V of each code in the J codes is calculated using the AES algorithm. J ;
[0044] S34, the CMAC values V1, V2, ... V calculated in step 33 are J The CMAC value R calculated in step S22 N+1 , R N+2 ,...R N+M The corresponding serial numbers are compared one by one. If the two are not equal, the verification is considered to have failed, and post-processing of the code being tampered is performed; if the two are equal, the non-core code C2 segment verification is considered to have succeeded; S35, after the security boot table verification is successful, this security boot verification is successful, and the ECU internal code continues to run.
[0045] In the step S3, the running stage is before entering the boot program or before entering the APPL application; the boot program is a boot startup program.
[0046] Said K≤N, J≤M.
[0047] The secure boot table includes the number, the start and end addresses of the code segment corresponding to the number, the CMAC value of the code segment corresponding to the start and end addresses obtained by the AES algorithm, and the key.
[0048] The key is a primary key or a self-generated key.
[0049] The non-volatile access memory is the EE area of the HSM core. The HSM core, such as the HSM core of Infineon, is a core with encryption and decryption functions, regardless of chip companies and product chips.
[0050] For example:
[0051] Requirement: Before power-on, the 5M code must be verified, with a time limit of 60ms.
[0052] Existing strategy: Select 2M code from 5M for verification. However, no matter which 2M is selected from the 5M, the remaining 3M cannot be verified, which may lead to attacks.
[0053] Based on the strategies in this plan, one approach is as follows:
[0054] Calculate the correct CMAC value and store the corresponding information: divide the 4M core code into 10 parts, numbered 1-10, with the verification code starting address S1-S10, the verification code ending address E1-E10, and the secret key K1-K10; divide the 1M non-core code into 10 parts, numbered 11-20, with the verification code starting address S11-S20, the verification code ending address E10-E20, and the secret key K10-K20. The encrypted key can use the first-level key or generate the key yourself.
[0055] The 20 divided code segments are encrypted and calculated to obtain CMAC values, that is, the CMAC values of the codes in the start and end address range corresponding to the correct code are R1-R20, and are stored in the non-volatile access memory of the MCU (such as EE of the HSM core) according to the number ID, named Table A. The number i in the table, the start address Si of the corresponding code segment, the end address Ei, the secret key Ki, and the CMAC value Ri are in a one-to-one correspondence.
[0056] Table A
[0057]
[0058]
[0059] After power on, check whether the code in the current memory is the correct code:
[0060] When powered on for the first time, assume that four random numbers 1, 5, 7, 9 between 1-10 and four random numbers 11, 15, 17, 19 between 11-20 are generated. The code start address Si and end address Ei corresponding to numbers 1, 5, 7, 9, 11, 15, 17, 19 are obtained through Table A. The CMAC values Vi of these address segments are calculated respectively through the secret key Ki. By comparing the values of Vi and Ri, it can be verified whether the code segment corresponding to the current number i has been tampered with. This power-on will verify whether the code segment corresponding to numbers 1, 5, 7, 9, 11, 15, 17, 19 has been tampered with. In this way, the total verification time is still 60ms, and the verification code is still 2M each time, as shown in Table B.
[0061] Table B
[0062]
[0063] When the power is turned on for the second time, four random numbers i1, i2, i3, i4 between 1 and 10 and four random numbers i5, i6, i7, i8 between 11 and 20 are generated. The above verification process is repeated to verify whether the code segments numbered i1, i2, i3, i4, i5, i6, i7, i8 in the current memory have been tampered with.
[0064] The above verification process is repeated each time the power is turned on. In this way, the total verification time after each power-on is still 60ms, and the verification code is still 2M each time, but the part of the code verified after each power-on is the code in the random range. In this way, 4M of core code and 1M of non-core code can be verified after multiple power-on cycles, which can increase the verification range in a very short time, reduce the attack surface, and greatly improve security.
Claims
1. A tamper-proof secure startup control method, comprising software in an ECU, characterized in that: The specific method is as follows: S1, first, classify the software to be run in the ECU, and differentiate the software A in the ECU as needed; S2, secondly, every time software A is flashed to the ECU, the secure boot table is set and stored in the non-volatile memory; S3. Finally, after the flashing is completed, each time the ECU is powered on and starts, when entering the software running phase, it is necessary to randomly verify the data in the secure boot table set in step S2.
2. The tamper-proof secure startup control method according to claim 1, characterized in that: The specific process of step S1 is as follows: S11, distinguishing a code range B that needs to be protected from attacks and a code range F that does not need to be protected from attacks from software A in the ECU; S12, distinguishing the core code C1 and the non-core code C2 from the code range B that needs to be protected from attacks; S13, divide the core code C1 into N parts, namely K1, K2, K3, ..., K N; S14, divide the non-core code C2 into M parts, namely D1, D2, D3, ..., D M .
3. The tamper-proof secure startup control method according to claim 1, characterized in that: The specific process of step S2 is as follows: S21, take out the core code C1, divide the core code C1 into N parts, and use the AES algorithm to calculate the CMAC value R1, R2, R3, ... R of each part of the code. N ; S22, take out the non-core code C2, divide the non-core code C2 into M parts, and use the AES algorithm to calculate the CMAC value R of each part of the code N+1 , R N+2 ,...R N+M ; S23, set up an independent secure boot table, and store the CMAC values of the core code C1 and the non-core code C2 calculated in steps S21 and S22 in the secure boot table, and store the secure boot table in the non-volatile access memory of the MCU.
4. The tamper-proof secure startup control method according to claim 1, characterized in that: The specific process of step S3 is as follows: S31, verify whether the core code C1 has been tampered with. After power-on, randomly select K pieces of code from the N pieces of core code C1 in the core code C1, and use the AES algorithm to calculate the CMAC value V1, V2, ... V of each piece of code in the K pieces of code. K ; S32, the CMAC values V1, V2, ... V calculated in step 31 are K and the CMAC values R1, R2, R3, ... R calculated in step S21 N Perform a one-to-one comparison of the corresponding serial numbers. If the two are not equal, the verification is considered to have failed, and post-processing is performed to determine if the code has been tampered with. If the two are equal, the core code C1 segment verification is considered to have succeeded. S33, similarly, in the non-core code C2, J codes are randomly selected from the M codes of the non-core code C2, and the CMAC value V1, V2, ... V of each code in the J codes is calculated using the AES algorithm. J ; S34, the CMAC values V1, V2, ... V calculated in step 33 are J The CMAC value R calculated in step S22 N+1 , R N+2 ,...R N+M Perform a one-to-one comparison of the corresponding serial numbers. If the two are not equal, it is considered that the verification has failed and the code is tampered with. If the two are equal, it is considered that the non-core code C2 segment verification has succeeded; S35, after the secure boot table is successfully verified, the secure boot verification is successful and the ECU internal code continues to run.
5. The tamper-proof secure startup control method according to claim 1, characterized in that: In the step S3, the running stage is before entering the boot program or before entering the APPL application; the boot program is a boot startup program.
6. The tamper-proof secure startup control method according to claim 4, characterized in that: Said K≤N, J≤M.
7. The tamper-proof secure startup control method according to claim 3 or 4, characterized in that: The secure boot table includes a number, a start and end address of a code segment corresponding to the number, a CMAC value of the code segment corresponding to the start and end address obtained by an AES algorithm, and a key.
8. The tamper-proof secure startup control method according to claim 7, characterized in that: The key is a primary key or a self-generated key.
9. The tamper-proof secure startup control method according to claim 3 or 4, characterized in that: The non-volatile access memory is the EE area of the HSM core.
Citation Information
Cited By
System based on hybrid algorithm protection, protection method, BIOS (Basic Input / Output System) and computer
CN119918081A
