A random encryption method applied to an automobile ECU controller

By using a software-based random encryption method to generate encryption keys during the initialization phase of the automotive ECU controller, the problems of hardware dependence and complex key updates in existing technologies are solved, thereby improving cost-effectiveness and security.

CN114793159BActive Publication Date: 2025-10-17CHANGCHUN AUTOMOBILE IND INST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210499404.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-09
Publication Date
2025-10-17
Estimated Expiration
2042-05-09

AI Technical Summary

Technical Problem

Existing encryption methods for automotive ECU controllers rely on hardware encryption chips, which increases costs and the complexity of key updates, and requires users to actively participate in key updates.

Method used

The software random encryption method is adopted, which uses the Freescale S12(X) series MCU to generate encryption keys during the initialization phase and encrypts and updates them through internal instructions, thus avoiding dependence on external devices, including host computers and encryption chips.

Benefits of technology

It reduces hardware costs, simplifies the key update process, improves encryption security and difficulty, and reduces the workload for users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114793159B_ABST
    Figure CN114793159B_ABST
Patent Text Reader

Abstract

The application discloses a random encryption method applied to an automobile ECU controller, and comprises the following steps: 1, reading a random key of a key storage space, running a backdoor access key command to decrypt the MCU; 2, after decryption, a random encryption key is generated, the encryption key value is stored in a specified key storage space on one hand, and is updated to a backdoor access key stored in a P-Flash configuration domain on the other hand; 3, after the encryption key is updated successfully, the access authority of the storage key space is modified through a register to ensure that user code cannot access the content in the protected area in the P-Flash sector; 4, after decryption fails, a fixed encryption key value is generated, the encryption key value is updated to the key storage space on one hand, and is updated to the backdoor access key stored in the P-Flash configuration domain on the other hand. The application not only reduces the cost of hardware, but also increases the cracking difficulty of encryption.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of basic software and relates to an encryption method, in particular to a random encryption method applied to an automobile ECU controller. BACKGROUND

[0002] In order to protect the intellectual property (IP) of the MCU software of a customer, an encryption (Secure) mechanism is introduced in the automobile-level MCU of Freescale, which aims to prevent hackers or pirates from accessing the on-chip memory through a BDM debugging interface and reading software code.

[0003] There are many methods for MCU software encryption. Chip UID encryption is a user-initiated encryption method. Almost all processors currently contain a UID inside, which can be read through direct addressing or IAP instructions. After the user reads the UID, the information after the UID is encrypted by a private key is written to a specific address of the Flash, for example, the last sector of the Flash. When the program starts, the chip UID is first read and calculated through the same key and algorithm, and then compared with the value in the Flash to determine whether to start. The MCU program encryption method disclosed in CN111062007A is such an encryption method. This method needs the host computer to read the UID value to generate a key and then write it back to the flash. The process is complex and depends on the chip UID value. Using an external encryption chip to implement MCU chip encryption is also a commonly used method. The external chip implements the encryption and decryption functions of the MCU code. However, this encryption method depends on an external chip, increasing the cost of hardware. In addition, the update of the encryption key needs to be actively implemented by the user through a tool, undoubtedly increasing the cost and complexity of the upgrade. SUMMARY

[0004] In view of the defects in the prior art, the present application provides a random encryption method applied to an automobile ECU controller. The present application takes the automobile-level S12(X) series MCU of Freescale as an application example, and the software on the MCU is randomly encrypted. This encryption method does not need to depend on a hardware encryption chip, nor does it need to develop a BootLoader to connect a host computer to generate an encryption key. The encryption process is completed in the program initialization phase. The encryption key is randomly generated and stored in a designated key storage space, and does not need to be actively updated by the user. On the one hand, this reduces the workload of key update, and on the other hand, it also improves the difficulty of key cracking.

[0005] The object of the present application is achieved by the following technical solutions:

[0006] A random encryption method applied to an automobile ECU controller, comprising the following steps:

[0007] Step 1: in the initialization phase, firstly, a random key of a key storage space is read, and then a verification backdoor access key command is run to decrypt the MCU, and the specific steps are as follows: the backdoor access key command is used to verify whether the backdoor access key input by the user is the same as the backdoor access key stored in the P-Flash configuration domain, if consistent, the MCU is decrypted, and step 2 is executed; if inconsistent, the MCU decryption fails, and step 4 is executed, which is a step of resetting the random key to prevent the hardware from being unable to start again due to the key verification failure;

[0008] Step 2: after decryption, an encryption key is randomly generated, and the encryption key value is stored in the specified key storage space on the one hand, and is updated to the backdoor access key stored in the P-Flash configuration domain on the other hand, to update the encryption key data for the next decryption;

[0009] Step 3: after the encryption key is updated successfully, the access permission of the storage key space is modified by setting the register to ensure that the user code cannot access the content in the protected area in the P-Flash sector, and the purpose of this step is to prevent the misoperation of the storage key space during the running of the user code after decryption;

[0010] Step 4: after decryption failure, a fixed encryption key value is generated, and the encryption key value is updated to the key storage space on the one hand, and is updated to the backdoor access key stored in the P-Flash configuration domain on the other hand.

[0011] Compared with the prior art, the present application has the following advantages:

[0012] 1) The software encryption process of the present application does not need to be connected to the host computer, and the encryption key is randomly generated in the program initialization phase and is updated to the key storage space through instructions, which reduces the dependence on the external environment (host computer, encryption chip), and the encryption method based on the host computer depends on the BootLoader of the software, and the software of the present application does not need to develop the BootLoader program of the chip additionally.

[0013] 2) The encryption key of the present application is randomly generated by software, and does not need to read the UID value of the chip, and does not need to realize encryption through an external encryption chip, which not only reduces the cost of hardware, but also increases the cracking difficulty of encryption.

[0014] 3) The update of the encryption key of the present application does not need to be actively realized by the user through a tool, the generation of the key is randomly generated and stored in the initialization phase of each board power-on running, the program automatically updates the key, which saves the workload of the user to actively update the key, and also increases the security of the code. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 is a random encryption flowchart;

[0016] Figure 2 Flow chart for writing command of flash sector in S12(X) series MCU. DETAILED DESCRIPTION

[0017] The technical solutions of the present application are further described below in combination with the drawings, but are not limited thereto, and any modification or equivalent replacement of the technical solutions of the present application without departing from the spirit and scope of the technical solutions of the present application shall be covered in the protection scope of the present application.

[0018] The present application provides a random encryption method applied to an automobile ECU controller, and a Freescale S12(X) series MCU is used as an application object in the specific implementation process, and the method comprises the following steps:

[0019] Step 1: firstly, an initialization function pFlashInit is called to initialize the entire FLASH, and the initialization process completes the initialization of the FLASH clock and the initialization of the state register. Then, a random key (8 bytes) of a key storage space is read, and then a Verify Backdoor Access Key command is run to decrypt the S12(X) series MCU; the Verify Backdoor Access Key command verifies whether the 8-byte backdoor access key input by the user is the same as the backdoor access key (0×FF00~0×FF07) stored in the P-Flash configuration domain, and if so, the MCU is decrypted, and the SEC[1:0] of the FSEC register is set to 10 'b (decrypted state).

[0020] Step 2: after decryption, a system function rand is called to randomly generate an encryption key, and if the key is 0×00 or 0×FF, the key is regenerated. The new key needs to be updated to the storage key space and the backdoor comparison register. The updating process is a re-encoding process of the FLASH, and before encoding, the sector corresponding to the encoding address needs to be erased first, and the size of the sector is 512 bytes, so the data of the sector needs to be read and placed in the cache before erasing the sector, and then the new data is written into the sector.

[0021] Step 3: In order to prevent the user code key storage space data from being accessed, the access control needs to be performed on the key storage space after the encryption key is updated. For the S12(X) series MCU, the FPROT register defines which P-Flash sectors are protected from programming and erasing operations, and the access control on the key storage space is achieved by configuring the FPROT register. After the storage space is protected, any attempt to change data in any protected area of the P-Flash sector will result in a protection violation error, and the FPVIOL bit will be set in the FSTAT register. If any P-Flash sector contained in the same P-Flash block is protected, the block erase of the P-Flash block is also prohibited. The P-Flash sector write command flow of the S12(X) series MCU is as shown in Figure 2

[0022] In summary, the whole random encryption process includes the decryption process and the key regeneration process, and the user does not need to participate in the key update, and the software is automatically completed. The randomness of the key generated by this method not only improves the security of the key, but also gets rid of the dependence of the key on the external environment, and saves the workload of product mass production.​

Claims

1. A random encryption method applied to automobile ECU controller, characterized in that The method comprises the following steps: Step 1: During the initialization phase, the random key in the key storage space is first read, and then the backdoor access key verification command is run to decrypt the MCU. The specific steps are as follows: The backdoor access key command verifies whether the backdoor access key entered by the user is the same as the backdoor access key stored in the P-Flash configuration domain. If they are consistent, the MCU is decrypted and step 2 is executed. If they are inconsistent, the MCU decryption fails and step 4 is executed. Step 4 is the step of resetting the random key to prevent the hardware from being unable to boot due to key verification failure. Step 2: After successful decryption, a random encryption key is generated. This encryption key value is stored in the designated key storage space and updated to the backdoor access key stored in the P-Flash configuration domain to update the encryption key data for the next decryption. Step 3: After the encryption key is successfully updated, the access rights of the storage key space are modified by setting registers to ensure that user code cannot access the contents of the protected area in the P-Flash sector; Step 4: After decryption fails, a fixed encryption key value is generated. This encryption key value is updated to the key storage space on the one hand, and to the backdoor access key stored in the P-Flash configuration domain on the other hand.

Citation Information

Patent Citations

  • MCU program encryption method, intelligent terminal and storage medium

    CN111062007A