Safe starting method of MCU (Microprogrammed Control Unit) and storage medium
By executing bootrom and bootloader on the MCU, combining the loading and security detection of user programs, the security problems during the MCU startup process are solved, and the secure boot of the MCU and the integrity protection of the firmware are achieved.
Patent Information
- Application Number
- CN202411531698.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-14
AI Technical Summary
The lack of a secure boot method for the MCU in the existing technical solutions, resulting in security problems in the startup process of the MCU.
By booting the bootloader after executing bootrom on the MCU, the user bootloader program reads the startup parameters for judgment, and loads the user program through the preset user program address, and upgrades, verifications, integrity detection and decryption in the process, and finally performs the start up.
It realizes secure startup of the MCU to prevent the firmware from being illegally tampered during the upgrade process, and ensures the integrity and security of the firmware after the product leaves the factory.
Smart Images

Figure CN119440664A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of processor startup technology, for example, to a secure startup method and storage medium for an MCU. Background Art
[0002] With the development of server technology, blade servers are widely used in special application industries and high-density computing environments due to their advantages such as high density and high availability. In order to obtain the operating status of the server (current and voltage information of each node) and more flexibly control the power-on of the server and peripheral devices, blade servers usually use general-purpose MCUs to implement EC (power control) functions and sensor acquisition functions. As used in some special and secure scenarios, the implementation of EC must be secure. This includes firmware security and operational security. Firmware security means that when an illegal user burns the tampered firmware to the MCU, the MCU should be able to detect the illegal firmware and terminate the upgrade. Operational security means that during the boot loading stage, the integrity and correctness of the firmware can be checked to run the correct firmware to ensure security.
[0003] However, in the existing technical solutions, there is no method for securely booting the MCU, which causes security issues in the booting process of the MCU.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0006] The present disclosure provides a secure boot method for an MCU, which includes:
[0007] After the MCU is powered on, the bootrom is executed first, and then the bootloader is booted, and the user bootloader program is executed by executing a fixed address;
[0008] The user bootloader program reads the startup parameters to make judgments, and then loads the user program through the preset configurable user program address. During this process, it performs upgrades, verification, integrity checks, and decryption before starting.
[0009] In some embodiments, during the process of loading the user program, the secure firmware used is obtained based on asymmetric encryption;
[0010] After the security firmware is encrypted, the encrypted firmware is burned into the user program area through the upgrade software, and the public key is burned into the startup parameter area at the same time.
[0011] In some embodiments, the verification includes checking the correctness of the parameter area to ensure the correctness of the startup parameters.
[0012] In some embodiments, the decryption includes decrypting the firmware using a public key in the boot parameter area.
[0013] In some embodiments, the integrity check includes performing an integrity check on the firmware by means of CRC16.
[0014] In some embodiments, verifying the correctness of the parameter region includes:
[0015] Check the mandatory items in the parameter area, parameter format, data type, parameter range and constraints, and logical consistency.
[0016] In some embodiments, decrypting the firmware using the public key of the startup parameter area includes:
[0017] The public key of the startup parameter area is read and verified;
[0018] Based on the verified public key, the firmware is decrypted using a symmetric encryption algorithm;
[0019] Verify the hash value of the decrypted firmware to ensure that the content of the firmware is consistent with the signature;
[0020] The decrypted data that passes the hash check is used as the decrypted firmware.
[0021] In some embodiments, the storage medium stores program instructions, and when the program instructions are run, the secure boot method of the MCU in the above embodiment is executed.
[0022] The secure boot method and storage medium of the MCU provided in the embodiments of the present disclosure can achieve the following technical effects:
[0023] It can ensure that the MCU starts the correct and secure firmware to prevent the product from being illegally tampered with after leaving the factory. The secure firmware update provides a safe mechanism to prevent the firmware from being illegally tampered with during the upgrade process.
[0024] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0026] Figure 1 It is a flowchart of a secure boot method of an MCU provided by an embodiment of the present disclosure;
[0027] Figure 2 It is a schematic diagram of a traditional operation process provided by an embodiment of the present disclosure;
[0028] Figure 3 is a schematic diagram of the operation process of a two-level guidance mechanism provided by an embodiment of the present disclosure;
[0029] Figure 4 It is a schematic diagram of manufacturing a secure firmware provided by an embodiment of the present disclosure;
[0030] Figure 5 It is a schematic diagram of a process of Bootloader security upgrade provided by an embodiment of the present disclosure;
[0031] Figure 6 It is a structural diagram of a secure boot system for an MCU provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0033] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0034] Unless otherwise stated, the term "plurality" means two or more.
[0035] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0036] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0037] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0038] The secure boot method and storage medium of the MCU provided by the embodiments of the present disclosure are described below in conjunction with the accompanying drawings.
[0039] Figure 1 It is a flowchart of a secure boot method for an MCU provided in an embodiment of the present disclosure.
[0040] like Figure 1 As shown, the secure boot method of the MCU may include:
[0041] S01, after the MCU is powered on, it first executes the bootrom, then boots the bootloader, and executes the user bootloader program by executing a fixed address;
[0042] S02, the user bootloader program makes a judgment by reading the startup parameters, and then loads the user program through the preset configurable user program address, during which it performs upgrading, verification, integrity detection and decryption, and then starts.
[0043] The secure boot method of the MCU disclosed in the present invention can ensure that the MCU boots correct and secure firmware to prevent illegal tampering of the product after leaving the factory. The secure firmware update provides a secure mechanism to prevent the firmware from being illegally tampered with during the upgrade process.
[0044] In some embodiments, during the process of loading the user program, the secure firmware used is obtained based on asymmetric encryption;
[0045] After the security firmware is encrypted, the encrypted firmware is burned into the user program area through the upgrade software, and the public key is burned into the startup parameter area at the same time.
[0046] In some embodiments, the verification includes checking the correctness of the parameter area to ensure the correctness of the startup parameters.
[0047] In some embodiments, the decryption includes decrypting the firmware using a public key in the boot parameter area.
[0048] In some embodiments, the integrity check includes performing an integrity check on the firmware by means of CRC16.
[0049] In some embodiments, verifying the correctness of the parameter region includes:
[0050] Check the mandatory items in the parameter area, parameter format, data type, parameter range and constraints, and logical consistency.
[0051] In some embodiments, decrypting the firmware using the public key of the startup parameter area includes:
[0052] The public key of the startup parameter area is read and verified;
[0053] Based on the verified public key, the firmware is decrypted using a symmetric encryption algorithm;
[0054] Verify the hash value of the decrypted firmware to ensure that the content of the firmware is consistent with the signature;
[0055] The decrypted data that passes the hash value verification is used as the decrypted firmware.
[0056] In a specific example, the secure boot method of the MCU may mainly include:
[0057] 1. MCU storage partition division
[0058] Traditional MCU programs only have single programs, which can be run directly after the MCU is powered on.
[0059] In order to achieve secure boot, a two-level boot mechanism needs to be designed. That is, after the MCU is powered on, the bootloader is first booted, and then the bootloader boots and loads the user program. At the same time, a storage area is required to save some boot and upgrade parameters. In this case, the MCU's memory needs to be allocated into at least three partitions: the bootloader area, the parameter area, and the user program area.
[0060] 2. Bootloader Design
[0061] The design of the bootloader based on the secure boot process is special in that it performs firmware integrity detection and firmware decryption before booting.
[0062] 3. Design of user program
[0063] It mainly involves address remapping of the user program during the startup process to adapt to the startup of the bootloader.
[0064] In addition, it should be noted that Figure 1 The firmware used in the method may be a securely updated firmware, and the secure firmware update method may include encrypted packaging of the firmware, a firmware update method, key generation during the firmware upgrade process, and the like.
[0065] Combination Figures 2 to 4 ,right Figure 1 The method is further described in .
[0066] (1) Flash storage area allocation
[0067] Traditional MCUs will have a bootrom code fixed in the flash when they leave the factory. This code will load the program at the specified address (usually the user program). For example, after GD32F303VG is powered on, it will load the program at address 0x08000000 through the bootrom. The user only needs to burn the binary file to the address 0x08000000 through the burner to achieve the normal operation of the program. The operation process is as follows: Figure 2 shown.
[0068] In order to achieve secure boot, the present disclosure designs a two-level boot mechanism, that is, booting the user bootloader first and then booting the user program through the user bootloader. In this way, functions such as upgrade, verification, integrity detection, encryption and decryption can be completed in the bootloader. The operation process is as follows: Figure 3 shown.
[0069] like Figure 3 As shown in the figure, the bootrom will be executed first after the MCU is powered on, and then the user bootloader program will be executed by executing the fixed address 0x08000000. The user bootloader program makes a judgment by reading the startup parameters, and then loads the user program through a "configurable user program address". During this process, the security check of the program will be implemented.
[0070] (2) Secure firmware production and upgrade software design
[0071] a. The production of secure firmware requires the encryption of the firmware. Generally, we use asymmetric encryption, such as Figure 4 As shown in the figure, a public key and a private key are generated when making the firmware. After encryption is completed, the encrypted firmware is burned into the user program area by upgrading the software, and the public key is burned into the startup parameter area. In this way, when the user bootloader is restarted, the public key can be used to decrypt the firmware for booting and loading.
[0072] b. The upgrade software is designed with versatility in mind, with variant design based on ymodem and good stability.
[0073] (3) Bootloader security upgrade and secure boot process design
[0074] Combination Figure 5 As shown, the Bootloader security upgrade process is as follows:
[0075] 1. Parameter area verification
[0076] The main purpose is to check the correctness of the parameter area, such as integrity, to ensure the correctness of the startup parameters.
[0077] 2. Check the correctness of the boot address
[0078] Because the user address is configurable, an address check is required through the parameter area.
[0079] 3. Firmware decryption
[0080] The firmware is decrypted using the public key in the parameter area.
[0081] 4. Firmware integrity check
[0082] The firmware integrity is checked using CRC16.
[0083] 5. Startup Boot
[0084] Boot the user program.
[0085] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0086] Combination Figure 6 As shown, the embodiment of the present disclosure provides a secure boot system 600 for an MCU, including a processor 604 and a memory 601. Optionally, the system may also include a communication interface 602 and a bus 603. Among them, the processor 604, the communication interface 602, and the memory 601 can communicate with each other through the bus 603. The communication interface 602 can be used for information transmission. The processor 604 can call the logic instructions in the memory 601 to execute the secure boot method of the MCU in the above embodiment.
[0087] In addition, the logic instructions in the memory 601 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0088] The memory 601 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 604 executes the functional application and data processing by running the program instructions / modules stored in the memory 601, that is, the secure boot method of the MCU in the above embodiment is implemented.
[0089] The memory 601 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 601 may include a high-speed random access memory and may also include a non-volatile memory.
[0090] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute a secure boot method for an MCU.
[0091] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0092] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0093] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. As used in the description of the embodiments, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or including (comprising) refer to the existence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or these groups. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same or similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0094] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the systems, devices and units described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0095] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0096] The flowchart and block diagram in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A secure boot method for MCU, characterized in that: The method comprises: After the MCU is powered on, the bootrom is executed first, and then the bootloader is booted, and the user bootloader program is executed by executing a fixed address; The user bootloader program reads the startup parameters to make judgments, and then loads the user program through the preset configurable user program address. During this process, it performs upgrades, verification, integrity checks, and decryption before starting.
2. The method according to claim 1, characterized in that: In the process of loading user programs, the secure firmware used is obtained based on asymmetric encryption; After the security firmware is encrypted, the encrypted firmware is burned into the user program area through the upgrade software, and the public key is burned into the startup parameter area at the same time.
3. The method according to claim 2, characterized in that The verification includes checking the correctness of the parameter area to ensure the correctness of the startup parameters.
4. The method according to claim 2, characterized in that: The decryption includes decrypting the firmware using a public key in the startup parameter area.
5. The method according to claim 2, characterized in that: The integrity check includes performing integrity check on the firmware by means of CRC16.
6. The method according to claim 3, characterized in that The correctness of the verification parameter area includes: Check the mandatory items in the parameter area, parameter format, data type, parameter range and constraints, and logical consistency.
7. The method according to claim 4, characterized in that The decryption process of the firmware using the public key of the startup parameter area includes: The public key of the startup parameter area is read and verified; Based on the verified public key, the firmware is decrypted using a symmetric encryption algorithm; Verify the hash value of the decrypted firmware to ensure that the content of the firmware is consistent with the signature; The decrypted data that passes the hash check is used as the decrypted firmware.
8. A storage medium storing program instructions, characterized in that: When the program instructions are run, the secure boot method for the MCU as described in any one of claims 1 to 7 is executed.
Citation Information
Cited By
MCU (Microprogrammed Control Unit) safe starting method integrating function safety
CN120891769A