Security bootloader method and device based on national cryptographic algorithm and medium
The firmware is encrypted and verified through the hybrid encryption and decryption method of the national secret algorithm (SM2, SM3, SM4), which solves the problem of the lack of encryption and verification of the traditional bootloader, improves the security and reliability of the embedded system, and achieves domestic Autonomous and controllable safe startup and operation.
Patent Information
- Application Number
- CN202410655589.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-03
AI Technical Summary
Traditional bootloaders lack encryption and verification of firmware, resulting in low security and reliability of embedded systems.
The mixed encryption and decryption method of the national secret algorithm (SM2, SM3, SM4) is used to encrypt and verify the firmware, including obtaining the compiled firmware, encrypted packaging, downloading, verification, decryption and final verification to ensure the security and safety of the firmware. reliability.
Through the hybrid encryption and decryption method of the national secret algorithm, the security and reliability of the embedded system are improved, ensuring the safe startup and operation of the firmware under domestic independent control.
Smart Images

Figure CN118586003A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of embedded software technology, and in particular to a secure bootloader method, device and storage medium based on a national secret algorithm. Background Art
[0002] The national secret algorithm refers to the cryptographic algorithm standard independently developed by China, which is used to protect the country's information security and data security. The national secret algorithm mainly includes symmetric cryptographic algorithms, asymmetric cryptographic algorithms, hash algorithms and digital signature algorithms, such as SM2 algorithm (asymmetric encryption algorithm), SM3 algorithm (hash algorithm) and SM4 algorithm (symmetric encryption algorithm).
[0003] Bootloader (boot loader) is a program that is responsible for initializing the system's hardware devices and transferring control to the operating system or other executable programs after the computer hardware is started. The main functions include reading and loading the operating system kernel, initializing the hardware, configuring system parameters, and performing error detection. Secure Bootloader is the first line of defense for embedded system security. The main function of traditional Bootloader is to boot the operating system. When the embedded system is powered on or restarted, the Bootloader first loads and runs, initializes the hardware peripherals, loads and starts the operating system, and can update the system through interfaces such as the network and serial port. However, the lack of encryption and verification of the firmware leads to low security and reliability of the embedded system. Summary of the invention
[0004] The present invention provides a secure bootloader method, device and medium based on a national secret algorithm to ensure that the security and reliability of an embedded system are improved under domestic independent and controllable conditions.
[0005] The present invention provides a secure bootloader method based on a national secret algorithm, comprising:
[0006] When the system starts, get the compiled firmware;
[0007] Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image;
[0008] Downloading the encrypted image to DDR, and verifying the encrypted image in DDR;
[0009] If the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image;
[0010] Verify the decrypted image;
[0011] If the decrypted image is successfully verified, the decrypted image is burned into the Flash, and the system is reset to read the firmware from the Flash and run it.
[0012] Furthermore, the firmware is encrypted and packaged using a hybrid encryption method to obtain an encrypted image, specifically:
[0013] The firmware includes header information and firmware information; the firmware information includes a data summary;
[0014] Encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary;
[0015] The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key;
[0016] Adding the encrypted data summary and the key to the header information to obtain encrypted firmware;
[0017] Encrypt the header information using the SM2 algorithm to obtain encrypted header information;
[0018] Using the encrypted header information as header data;
[0019] The header data and the encrypted firmware are combined to obtain an encrypted image.
[0020] Further, downloading the encrypted image to DDR is specifically:
[0021] Read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition;
[0022] If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol.
[0023] Further, the checking of the encrypted image in the DDR is specifically as follows:
[0024] Check whether the encrypted image has header data;
[0025] If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data;
[0026] If they are consistent, the encrypted image is verified successfully.
[0027] Further, the encrypted image is decrypted to obtain a decrypted image, specifically:
[0028] Use the SM2 algorithm to solve the encrypted header information of the encrypted firmware in the encrypted image to solve the header information of the encrypted firmware;
[0029] According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware;
[0030] The calculated header information and firmware information are used as the decrypted firmware.
[0031] Furthermore, the decrypted image is verified as follows:
[0032] Use the SM3 algorithm to calculate the data digest of the decrypted firmware;
[0033] Get the header data in the decrypted image;
[0034] It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
[0035] As a preferred solution, the Bootloader in the present invention mainly uses a hybrid encryption and decryption method of the SM2 algorithm (asymmetric encryption algorithm), SM3 algorithm (hash algorithm), and SM4 algorithm (symmetric encryption algorithm) in the national secret algorithm to encrypt and verify the firmware, so as to ensure the improvement of the security and reliability of the embedded system under domestic independent and controllable conditions.
[0036] Other features and advantages of the present invention will be described in detail in the following detailed description.
[0037] Accordingly, the present invention also provides a secure bootloader device based on a national secret algorithm, comprising: an encryption and packaging module, a download and decryption module, and an operation module;
[0038] The encryption packaging module is used to obtain the compiled firmware after the system is started; the firmware includes header information and firmware information; the firmware information includes a data summary;
[0039] Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image;
[0040] The download decryption module is used to download the encrypted image to the DDR and verify the encrypted image in the DDR;
[0041] If the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image;
[0042] Verify the decrypted image;
[0043] The operation module is used to burn the decrypted image into the Flash if the decrypted image is successfully verified, and reset the system to read the firmware from the Flash and run it.
[0044] Further, the encryption packaging module includes: an encryption packaging unit;
[0045] The encryption packaging unit is used to encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary;
[0046] The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key;
[0047] Adding the encrypted data summary and the key to the header information to obtain encrypted firmware;
[0048] Encrypt the header information using the SM2 algorithm to obtain encrypted header information;
[0049] Using the encrypted header information as header data;
[0050] The header data and the encrypted firmware are combined to obtain an encrypted image.
[0051] Further, the download decryption module includes a download unit, a verification unit, a decryption unit and a verification unit;
[0052] The download unit is used to read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition;
[0053] If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol;
[0054] The verification unit is used to check whether the encrypted image has header data;
[0055] If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data;
[0056] If they are consistent, the encrypted image is verified successfully;
[0057] The decryption unit is used to use the SM2 algorithm to decrypt the encrypted header information of the encrypted firmware in the encrypted image to calculate the header information of the encrypted firmware;
[0058] According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware;
[0059] The calculated header information and firmware information are used as the decrypted firmware;
[0060] The verification unit is used to calculate the data summary of the decrypted firmware using the SM3 algorithm;
[0061] Get the header data in the decrypted image;
[0062] It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
[0063] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute a secure bootloader method based on a national secret algorithm as described in the content of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a flowchart of an embodiment of a secure bootloader method based on a national secret algorithm provided by the present invention;
[0065] Figure 2 It is a structural schematic diagram of an encrypted image of an embodiment of a secure bootloader method based on a national secret algorithm provided by the present invention;
[0066] Figure 3 It is a structural schematic diagram of an embodiment of a secure bootloader device based on a national secret algorithm provided by the present invention. DETAILED DESCRIPTION
[0067] 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.
[0068] Embodiment 1
[0069] This embodiment is preferably applied to a Pingtou Ge multi-core heterogeneous platform based on the RT-Thread operating system, in which drivers such as Flash, network and serial port are written.
[0070] Please refer to Figure 1 , a secure bootloader method based on a national secret algorithm provided in an embodiment of the present invention, comprising steps S101-S103:
[0071] Step S101: when the system is started, the compiled firmware is obtained; the firmware includes header information and firmware information; the firmware information includes a data summary;
[0072] Step S102: Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image;
[0073] Furthermore, this example uses a hybrid encryption method of the SM2 algorithm (asymmetric encryption algorithm), SM3 algorithm (hash algorithm), and SM4 algorithm (symmetric encryption algorithm) in the national encryption algorithm to encrypt the firmware.
[0074] The firmware is encrypted and packaged using a hybrid encryption method to obtain an encrypted image, specifically:
[0075] Encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary;
[0076] The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key;
[0077] Adding the encrypted data summary and the key to the header information to obtain encrypted firmware;
[0078] Encrypt the header information using the SM2 algorithm to obtain encrypted header information;
[0079] Using the encrypted header information as header data;
[0080] The header data and the encrypted firmware are combined to obtain an encrypted image.
[0081] Please refer to Figure 2 It is a structural diagram of an encrypted image, wherein the encrypted image includes: header data and encrypted firmware;
[0082] Wherein, the encrypted firmware includes encrypted header information and encrypted firmware information;
[0083] The header information includes a corresponding key (firmware SM4 key) generated by encrypting the firmware information using the SM4 algorithm, and an encrypted data digest (firmware SM3 data digest) encrypted using the SM3 algorithm;
[0084] The header data stores encrypted header information obtained by encrypting the header information using the SM2 algorithm; the encrypted header information contains the encrypted firmware SM3 data digest obtained by encrypting the firmware SM3 data digest using the SM2 algorithm.
[0085] Step S103: downloading the encrypted image to DDR, and verifying the encrypted image in DDR;
[0086] Further, downloading the encrypted image to DDR is specifically:
[0087] Read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition;
[0088] If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol.
[0089] Further, the checking of the encrypted image in the DDR is specifically as follows:
[0090] Check whether the encrypted image has header data;
[0091] If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data;
[0092] If they are consistent, the encrypted image is verified successfully.
[0093] In this embodiment, the encrypted image is verified by using the SM3 algorithm in the national encryption algorithm to calculate whether the data summary of the entire encrypted image is consistent with the header data, to ensure that the image has not been tampered with.
[0094] Step S104: if the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image;
[0095] Further, the encrypted image is decrypted to obtain a decrypted image, specifically:
[0096] Use the SM2 algorithm to solve the encrypted header information of the encrypted firmware in the encrypted image to solve the header information of the encrypted firmware;
[0097] According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware;
[0098] The calculated header information and firmware information are used as the decrypted firmware.
[0099] In this embodiment, the SM2 algorithm (asymmetric encryption algorithm), SM3 algorithm (hash algorithm), and SM4 algorithm (symmetric encryption algorithm) in the national secret algorithm are encryption and decryption algorithms that can both encrypt and decrypt.
[0100] Step S105: verifying the decrypted image;
[0101] Furthermore, the decrypted image is verified as follows:
[0102] Use the SM3 algorithm to calculate the data digest of the decrypted firmware;
[0103] Get the header data in the decrypted image;
[0104] It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
[0105] In this embodiment, if the data digest calculated using the SM3 algorithm is consistent with the data digest in the header data, it means that the firmware is correct and the firmware can be burned into the Flash.
[0106] Step S106: If the decrypted image is successfully verified, the decrypted image is burned into the Flash, and the system is reset to read the firmware from the Flash and run it.
[0107] In this embodiment, after the system is restarted, the system will automatically read the firmware from the Flash and run it.
[0108] Implementing the embodiments of the present invention has the following effects:
[0109] The Bootloader in the present invention mainly uses a hybrid encryption and decryption method of the SM2 algorithm (asymmetric encryption algorithm), SM3 algorithm (hash algorithm), and SM4 algorithm (symmetric encryption algorithm) in the national secret algorithm to encrypt and verify the firmware, so as to ensure the improvement of the security and reliability of the embedded system under domestic independent and controllable conditions.
[0110] Embodiment 2
[0111] Please refer to Figure 2 , a secure bootloader device based on a national secret algorithm provided by an embodiment of the present invention, comprising: an encryption and packaging module 201, a download and decryption module 202, and an operation module 203;
[0112] The encryption packaging module is used to obtain the compiled firmware after the system is started; the firmware includes header information and firmware information; the firmware information includes a data summary;
[0113] Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image;
[0114] The download decryption module is used to download the encrypted image to the DDR and verify the encrypted image in the DDR;
[0115] If the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image;
[0116] Verify the decrypted image;
[0117] The operation module is used to burn the decrypted image into the Flash if the decrypted image is successfully verified, and reset the system to read the firmware from the Flash and run it.
[0118] Further, the encryption packaging module includes: an encryption packaging unit;
[0119] The encryption packaging unit is used to encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary;
[0120] The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key;
[0121] Adding the encrypted data summary and the key to the header information to obtain encrypted firmware;
[0122] Encrypt the header information using the SM2 algorithm to obtain encrypted header information;
[0123] Using the encrypted header information as header data;
[0124] The header data and the encrypted firmware are combined to obtain an encrypted image.
[0125] Further, the download decryption module includes a download unit, a verification unit, a decryption unit and a verification unit;
[0126] The download unit is used to read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition;
[0127] If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol;
[0128] The verification unit is used to check whether the encrypted image has header data;
[0129] If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data;
[0130] If they are consistent, the encrypted image is verified successfully;
[0131] The decryption unit is used to use the SM2 algorithm to decrypt the encrypted header information of the encrypted firmware in the encrypted image to calculate the header information of the encrypted firmware;
[0132] According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware;
[0133] The calculated header information and firmware information are used as the decrypted firmware;
[0134] The verification unit is used to calculate the data summary of the decrypted firmware using the SM3 algorithm;
[0135] Get the header data in the decrypted image;
[0136] It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
[0137] The above-mentioned secure bootloader device based on the national secret algorithm can implement the secure bootloader method based on the national secret algorithm of the above-mentioned method embodiment. The optional options in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here. The rest of the contents of the embodiment of this application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.
[0138] Embodiment 3
[0139] Correspondingly, the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the secure bootloader method based on the national secret algorithm as described in any one of the above embodiments.
[0140] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the terminal device.
[0141] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0142] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0143] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile terminal, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0144] Wherein, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0145] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A secure bootloader method based on a national secret algorithm, characterized in that: include: When the system starts, get the compiled firmware; Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image; Downloading the encrypted image to DDR, and verifying the encrypted image in DDR; If the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image; Verify the decrypted image; If the decrypted image is successfully verified, the decrypted image is burned into the Flash, and the system is reset to read the firmware from the Flash and run it.
2. A secure bootloader method based on a national secret algorithm as claimed in claim 1, characterized in that: The firmware is encrypted and packaged using a hybrid encryption method to obtain an encrypted image, specifically: The firmware includes header information and firmware information; the firmware information includes a data summary; Encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary; The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key; Adding the encrypted data summary and the key to the header information to obtain encrypted firmware; Encrypt the header information using the SM2 algorithm to obtain encrypted header information; Using the encrypted header information as header data; The header data and the encrypted firmware are combined to obtain an encrypted image.
3. A secure bootloader method based on a national secret algorithm as claimed in claim 1, characterized in that: The step of downloading the encrypted image to the DDR is as follows: Read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition; If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol.
4. A secure bootloader method based on a national secret algorithm as claimed in claim 1, characterized in that: The verifying of the encrypted image in the DDR is specifically as follows: Check whether the encrypted image has header data; If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data; If they are consistent, the encrypted image is verified successfully.
5. A secure bootloader method based on a national secret algorithm as claimed in claim 2, characterized in that: Decrypting the encrypted image to obtain the decrypted image is specifically as follows: Use the SM2 algorithm to solve the encrypted header information of the encrypted firmware in the encrypted image to solve the header information of the encrypted firmware; According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware; The calculated header information and firmware information are used as the decrypted firmware.
6. A secure bootloader method based on a national secret algorithm as claimed in claim 5, characterized in that: The verification of the decrypted image is specifically as follows: Use the SM3 algorithm to calculate the data digest of the decrypted firmware; Get the header data in the decrypted image; It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
7. A secure bootloader device based on a national secret algorithm, characterized in that: include: Encryption and packaging module, download and decryption module, and operation module; The encryption packaging module is used to obtain the compiled firmware after the system is started; the firmware includes header information and firmware information; the firmware information includes a data summary; Encrypting and packaging the firmware using a hybrid encryption method to obtain an encrypted image; The download decryption module is used to download the encrypted image to the DDR and verify the encrypted image in the DDR; If the encrypted image is successfully verified, the encrypted image is decrypted to obtain a decrypted image; Verify the decrypted image; The operation module is used to burn the decrypted image into the Flash if the decrypted image is successfully verified, and reset the system to read the firmware from the Flash and run it.
8. A secure bootloader device based on a national secret algorithm as claimed in claim 7, characterized in that: The encryption packaging module includes: an encryption packaging unit; The encryption packaging unit is used to encrypt the data summary using the SM3 algorithm to obtain an encrypted data summary; The firmware information is encrypted using the SM4 algorithm to obtain encrypted firmware information and a corresponding key; Adding the encrypted data summary and the key to the header information to obtain encrypted firmware; Encrypt the header information using the SM2 algorithm to obtain encrypted header information; Using the encrypted header information as header data; The header data and the encrypted firmware are combined to obtain an encrypted image.
9. A secure bootloader device based on a national secret algorithm as claimed in claim 7, characterized in that: The download decryption module includes a download unit, a verification unit, a decryption unit and a verification unit; The download unit is used to read the set Flash partition table, connect to the host computer through the network, and determine whether the size of the encrypted image to be downloaded exceeds the size of the storage partition; If the size of the encrypted image is smaller than the storage partition size, the encrypted image of the host computer is downloaded to the DDR via the http protocol; The verification unit is used to check whether the encrypted image has header data; If there is header data, use SM3 to calculate the data summary of the encrypted image, and determine whether the data summary of the encrypted image is consistent with the data summary in the header data; If they are consistent, the encrypted image is verified successfully; The decryption unit is used to use the SM2 algorithm to decrypt the encrypted header information of the encrypted firmware in the encrypted image to calculate the header information of the encrypted firmware; According to the header information of the encrypted firmware, the firmware information of the encrypted firmware in the encrypted image is solved using the SM4 algorithm to solve the firmware information of the encrypted firmware; The calculated header information and firmware information are used as the decrypted firmware; The verification unit is used to calculate the data summary of the decrypted firmware using the SM3 algorithm; Get the header data in the decrypted image; It is determined whether the data summary of the decrypted firmware is consistent with the data summary in the header data. If so, the decrypted image is successfully verified.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute a secure bootloader method based on a national secret algorithm as described in any one of claims 1 to 6.
