Secondary encryption startup method, device and equipment for hardware security system
By adopting a secondary encryption startup method in the hardware security system and using the first and second preset keys to encrypt and decrypt the firmware, the problem of high risk of key leakage in the existing technology is solved and higher encryption is achieved. Key security.
Patent Information
- Application Number
- CN202411479709.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In existing hardware security systems, the encryption keys used by upper and lower computers are consistent with the decryption keys, resulting in high risk of key leakage, complex process and high cost.
Use the second encryption startup method to encrypt the firmware by using the first preset key, and record it to the flash memory memory. Then read the second preset key in the safety startup mode, encrypt the plainte text firmware into a second second to the second second to second to second. Ceduct the firmware and record it to the flash memory to replace the first -plus firmware.
By distinguishing the encryption key of the host computer from the decryption key of the lower computer, the risk of key leakage is reduced and the key security of the hardware security system is improved.
Smart Images

Figure CN119004490B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of vehicle-mounted controllers, and in particular, to a secondary encryption startup method, apparatus, computer equipment and storage medium for a hardware security system. Background Art
[0002] In the hardware security system secure boot solution, a symmetric algorithm is used to encrypt the firmware running on the lower computer. The symmetric algorithm requires the same key for decryption and decryption, so the upper computer software encryption and the lower computer need to have the same key. The lower computer key is burned once by the upper computer into the one-time programmable voice chip or one-time programmable memory of the lower computer. However, when updating the firmware, the upper computer key needs to be encrypted with the same key, so this key needs to be used frequently. In this case, it is easier to leak in the internal development link or in the case of third-party customers. Now, to solve this problem, key encryption keys and data encryption keys are used. The key encryption key is used as the root key to encrypt or encapsulate the data encryption key, and the data encryption key is used to encrypt the firmware. In this way, one or more layers of keys are used to increase the length of the trust chain and improve the security of the key. A more secure approach is to place the key encryption key in a remote server. When the firmware needs to be packaged, it is uploaded to the server for encryption, then downloaded locally and burned to the lower computer.
[0003] Existing technologies try to minimize the chances of people coming into contact with keys, which also complicates the process and increases costs. The encryption key and decryption key used by the upper and lower computers are still the same. Once the key of one party is leaked, it will bring security risks. Therefore, the upper and lower computers need to have the same key. In this way, there is still a great risk of key leakage, and the encryption key of the upper computer and the decryption key of the lower computer cannot be separated. Summary of the invention
[0004] Embodiments of the present application provide a secondary encryption startup method, apparatus, computer equipment, and storage medium for a hardware security system.
[0005] A first aspect of an embodiment of the present application provides a secondary encryption startup method for a hardware security system, comprising:
[0006] Encrypting the firmware using a first preset key, and burning the encrypted first encrypted firmware into a preset flash memory;
[0007] Burning the first preset key into a preset one-time programmable memory;
[0008] When a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on, reading a second preset key;
[0009] The first encrypted firmware in the flash memory is read using a first preset key, and the read first encrypted firmware is decrypted into plaintext firmware, the plaintext firmware is encrypted into a second encrypted firmware using a second preset key, and the second encrypted firmware is burned to the flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
[0010] In an optional embodiment of the present application, the step of reading the second preset key when the secure boot enable bit in the preset programmable memory is set includes:
[0011] In the case where a secure boot enable bit in a preset programmable memory is set, based on a preset boot code, a secure boot mode is entered according to the secure boot enable bit;
[0012] Reading a valid status bit of a second preset key;
[0013] When the valid state bit of the second preset key is 0, a true random number is generated as the second key, and the second key is burned into the preset programmable memory, and the valid state bit of the second preset key is set;
[0014] When the valid state bit of the second preset key is not 0, the second preset key is read.
[0015] In an optional embodiment of the present application, the step of reading the first encrypted firmware in the flash memory using the first preset key and decrypting the read first encrypted firmware into plaintext firmware includes:
[0016] According to the size of the preset firmware block, the first encrypted firmware in the flash memory is read and decrypted into the preset static random access memory using the preset first key to obtain a plurality of plaintext firmware blocks.
[0017] In an optional embodiment of the present application, the size of the preset firmware block is determined by the following steps:
[0018] Load the ciphertext of the smallest sector of the preset flash memory;
[0019] The size of the ciphertext of the smallest sector of the preset flash memory is used as the size of the preset firmware block.
[0020] In an optional embodiment of the present application, the method of encrypting the plaintext firmware into a second encrypted firmware using a second preset key and burning the second encrypted firmware into a flash memory includes:
[0021] Each plaintext firmware block is encrypted into an encrypted firmware block using a second preset key, and each encrypted firmware block is burned into the flash memory as a second encrypted firmware.
[0022] In an optional embodiment of the present application, after burning the second encrypted firmware block to the flash memory, the method further includes:
[0023] Determining whether the step of burning the second encrypted firmware to the flash memory is completed;
[0024] When the step of burning the second encrypted firmware to the flash memory is completed, the hardware security system is powered on or reset, and the second encrypted firmware is decrypted into a preset static random access memory using a second preset key for execution, or the second encrypted firmware is directly decrypted in the flash memory and the decrypted firmware is executed.
[0025] In an optional embodiment of the present application, the step of determining whether the second encrypted firmware is burned into the flash memory is completed is implemented through a level signal of an output pin.
[0026] A second aspect of an embodiment of the present application provides a secondary encryption startup device for a hardware security system, comprising:
[0027] An encryption module, used to encrypt the firmware using a first preset key, and burn the encrypted first encrypted firmware into a preset flash memory;
[0028] A burning module, used for burning the first preset key into a preset one-time programmable memory;
[0029] A reading module, configured to read a second preset key when a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on;
[0030] A replacement module is used to use a first preset key to read a first encrypted firmware in a flash memory, decrypt the read first encrypted firmware into plaintext firmware, encrypt the plaintext firmware into a second encrypted firmware using a second preset key, and burn the second encrypted firmware to the flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
[0031] A third aspect of an embodiment of the present application provides a computer device, comprising: a memory and a processor, the memory storing a computer program, and the processor implementing any of the steps of the secondary encryption startup method for a hardware security system when executing the computer program.
[0032] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the secondary encryption startup method for a hardware security system as described in any one of the above items are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0034] Figure 1 A flowchart of a secondary encryption startup method for a hardware security system provided by an embodiment of the present application;
[0035] Figure 2 A practical application flow chart of a secondary encryption startup method for a hardware security system provided by an embodiment of the present application;
[0036] Figure 3 A schematic diagram of the structure of a secondary encryption startup device for a hardware security system provided in one embodiment of the present application. DETAILED DESCRIPTION
[0037] In the process of implementing the present application, the inventors discovered that the encryption key and decryption key used by the upper and lower computers in the current hardware security system are consistent. Once the key of one party is leaked, it will bring security risks.
[0038] In response to the above problems, an embodiment of the present application provides a secondary encryption startup method for a hardware security system, including: encrypting the firmware using a first preset key, and burning the first encrypted firmware obtained after encryption to a preset flash memory; burning the first preset key to a preset one-time programmable memory; when the secure boot enable bit in the preset one-time programmable memory is set and the hardware security system is powered on, reading the second preset key; reading the first encrypted firmware in the flash memory using the first preset key, and decrypting the read first encrypted firmware into plaintext firmware, encrypting the plaintext firmware into second encrypted firmware using the second preset key, and burning the second encrypted firmware to the flash memory, the second encrypted firmware is used to replace the first encrypted firmware, ensuring that the encryption key of the upper computer and the decryption key used for the startup of the lower computer are different, which can improve the security of the key of the hardware security system.
[0039] The solutions in the embodiments of the present application can be implemented using various computer languages, for example, the process-oriented programming language C language, etc.
[0040] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0041] See also Figure 1The secondary encryption startup method for a hardware security system provided in an embodiment of the present application includes the following steps S1 to S4:
[0042] S1, encrypt the firmware using a first preset key, and burn the encrypted first encrypted firmware into a preset flash memory.
[0043] In an optional embodiment of the present application, the firmware may be encrypted using a first preset key on a host computer of the hardware security system.
[0044] S2, burning the first preset key into a preset one-time programmable memory.
[0045] In an optional embodiment of the present application, a preset one-time programmable memory may be set in a lower computer of the hardware security system.
[0046] S3, reading a second preset key when a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on.
[0047] In an optional embodiment of the present application, the second preset key can be read in a lower computer of the hardware security system.
[0048] In an optional embodiment of the present application, a first preset key slot, a second preset key slot, a secure boot enable bit, and a valid status bit of a second preset key are set on the preset one-time programmable memory.
[0049] In an optional embodiment of the present application, in step S3, reading the second preset key when the secure boot enable bit in the preset programmable memory is set includes:
[0050] In the case where a secure boot enable bit in a preset programmable memory is set, based on a preset boot code, a secure boot mode is entered according to the secure boot enable bit;
[0051] Reading a valid status bit of a second preset key;
[0052] When the valid state bit of the second preset key is 0, a true random number is generated as the second key, and the second key is burned into the preset programmable memory, and the valid state bit of the second preset key is set;
[0053] When the valid state bit of the second preset key is not 0, the second preset key is read.
[0054] S4, use the first preset key to read the first encrypted firmware in the flash memory, and decrypt the read first encrypted firmware into plaintext firmware, use the second preset key to encrypt the plaintext firmware into second encrypted firmware, burn the second encrypted firmware to the flash memory, and the second encrypted firmware is used to replace the first encrypted firmware.
[0055] In an optional embodiment of the present application, a first encrypted firmware in a flash memory can be read using a first preset key on a lower computer of a hardware security system, and the read first encrypted firmware can be decrypted into plaintext firmware, and the plaintext firmware can be encrypted into a second encrypted firmware using a second preset key, and the second encrypted firmware can be burned to the flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
[0056] In an optional embodiment of the present application, in step S4, the step of reading the first encrypted firmware in the flash memory using the first preset key and decrypting the read first encrypted firmware into plaintext firmware includes:
[0057] According to the size of the preset firmware block, the first encrypted firmware in the flash memory is read and decrypted into the preset static random access memory using the preset first key to obtain a plurality of plaintext firmware blocks.
[0058] In an optional embodiment of the present application, the size of the preset firmware block is determined by the following steps:
[0059] Load the ciphertext of the smallest sector of the preset flash memory;
[0060] The size of the ciphertext of the smallest sector of the preset flash memory is used as the size of the preset firmware block.
[0061] In an optional embodiment of the present application, in step S4, encrypting the plaintext firmware into a second encrypted firmware using a second preset key, and burning the second encrypted firmware to a flash memory includes:
[0062] Each plaintext firmware block is encrypted into an encrypted firmware block using a second preset key, and each encrypted firmware block is burned into the flash memory as a second encrypted firmware.
[0063] In an optional embodiment of the present application, in step S4, after burning the second encrypted firmware block to the flash memory, the method further includes:
[0064] Determining whether the step of burning the second encrypted firmware to the flash memory is completed;
[0065] When the step of burning the second encrypted firmware to the flash memory is completed, the hardware security system is powered on or reset, and the second encrypted firmware is decrypted into a preset static random access memory using a second preset key for execution, or the second encrypted firmware is directly decrypted in the flash memory and the decrypted firmware is executed.
[0066] In an optional embodiment of the present application, in step S4, the step of determining whether the step of burning the second encrypted firmware to the flash memory is completed is implemented by outputting a level signal of the pin.
[0067] See also Figure 2In practical applications, the hardware security system includes basic on-chip system components such as chips, one-time programmable memory (efuse), read-only closed-source programs solidified inside the chip, etc. In the one-time programmable memory, two key slots, a valid status bit flag of the second preset key and a secure boot enable bit can be designed: a key slot for storing the first preset key dek_pc, with a length of 128 bits or 256 bits; a key slot for storing the second preset key dek_trng, with a length of 128 bits or 256 bits; the valid status bit flag of the second preset key occupies one bit, which is used to determine whether the second preset key expression dek_trng is valid; the secure boot enable bit occupies one bit, which is used to enable the secure boot mode; the algorithm for encrypting the firmware is a symmetric encryption algorithm, which can be an AES algorithm or an SM4 algorithm. After the chip leaves the factory, dek_pc is first burned into the key slot of the one-time programmable memory. The upper computer uses the same key to encrypt the firmware of the lower computer and generate ciphertext from the plain text. This encryption is mainly to ensure the confidentiality of the encrypted firmware during transmission. There is a special third-party burning factory for burning. After burning dek_pc and firmware, it is also necessary to set the secure boot mode enable bit in the one-time programmable memory, and then power on again. The startup code solidified in the read-only closed-source program inside the chip first enters the secure boot mode according to the secure boot mode bit in the one-time programmable memory; then judge and read the valid status bit of dek_trng. If it is 0, configure the true random number generator to generate a true random key, and then call the one-time programmable memory in the startup code to drive the burning. One-time programmable memory, set the valid status bit of dek_trng; the boot code first uses the dek_pc in the one-time programmable memory to read the firmware in the flash memory according to the size of the firmware block (which can be 4KB, usually determined by the minimum page of the flash memory) into the static random access memory (sram) in the hardware security system, and uses dek_pc to decrypt the firmware block into plaintext, and then uses dek_trng to encrypt it into a secondary ciphertext block, and then burns it into the corresponding page of the flash memory, replacing it with the source ciphertext block, and so on, using the ciphertext firmware encrypted by the dek_trng key to replace the source ciphertext firmware. This process requires decryption, encryption and burning of the flash memory, and the process may be slow. A general input and output port can also be agreed to determine whether this process is completed correctly. If it is completed, there is no need to power on or reset again, and you can directly start using the dek-trng regular secure boot process. If it is after reset or power on again, the boot code reads the dek_trng status bit, determines that dek_trng is already valid, and uses dek_trng to decrypt the firmware to the static random access memory for execution or in-situ execution.
[0068] In the secondary encryption startup method for a hardware security system disclosed in the present invention, the firmware encryption key is generated inside the hardware security system, and the host computer encryption key is only used for the security during firmware transmission. After being burned into the chip, this key is invalid. The real firmware key cannot be accessed by the user, which will reduce the risk of key leakage and key randomness and improve security.
[0069] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0070] See also Figure 3 An embodiment of the present application provides a secondary encryption startup device for a hardware security system, comprising:
[0071] The encryption module 11 is used to encrypt the firmware using a first preset key, and burn the first encrypted firmware obtained after encryption into a preset flash memory;
[0072] A burning module 12, used for burning the first preset key into a preset one-time programmable memory;
[0073] A reading module 13, configured to read a second preset key when a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on;
[0074] The replacement module 14 is used to use the first preset key to read the first encrypted firmware in the flash memory, decrypt the read first encrypted firmware into plaintext firmware, encrypt the plaintext firmware into second encrypted firmware using the second preset key, and burn the second encrypted firmware to the flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
[0075] In an optional embodiment of the present application, the encryption module may be provided on a host computer of the hardware security system.
[0076] In an optional embodiment of the present application, the burning module can be set on the host computer of the hardware security system.
[0077] In an optional embodiment of the present application, the reading module may be provided on a lower computer of the hardware security system.
[0078] In an optional embodiment of the present application, a preset one-time programmable memory may be set in a lower computer of the hardware security system.
[0079] In an optional embodiment of the present application, a first preset key slot, a second preset key slot, a secure boot enable bit, and a valid status bit of a second preset key are set on the preset one-time programmable memory.
[0080] In an optional embodiment of the present application, the replacement module can be set on a lower computer of the hardware security system.
[0081] In an optional embodiment of the present application, the reading module is further used for:
[0082] In the case where a secure boot enable bit in a preset programmable memory is set, based on a preset boot code, a secure boot mode is entered according to the secure boot enable bit;
[0083] Read the valid state bit of the second preset key; when the valid state bit of the second preset key is 0, generate a true random number as the second key, burn the second key into the preset programmable memory, and set the valid state bit of the second preset key;
[0084] When the valid state bit of the second preset key is not 0, the second preset key is read.
[0085] In an optional embodiment of the present application, the replacement module is further used for:
[0086] According to the size of the preset firmware block, the first encrypted firmware in the flash memory is read and decrypted into the preset static random access memory using the preset first key to obtain a plurality of plaintext firmware blocks.
[0087] In an optional embodiment of the present application, the size of the preset firmware block is determined by the following steps:
[0088] Load the ciphertext of the smallest sector of the preset flash memory;
[0089] The size of the ciphertext of the smallest sector of the preset flash memory is used as the size of the preset firmware block.
[0090] In an optional embodiment of the present application, the replacement module is further used for:
[0091] Each plaintext firmware block is encrypted into an encrypted firmware block using a second preset key, and each encrypted firmware block is burned into the flash memory as a second encrypted firmware.
[0092] In an optional embodiment of the present application, the secondary encryption startup device for the hardware security system further includes:
[0093] A judging module, used for judging whether the step of burning the second encrypted firmware to the flash memory is completed;
[0094] A reset module is used to power on or reset the hardware security system again after completing the step of burning the second encrypted firmware to the flash memory, and use the second preset key to decrypt the second encrypted firmware to the preset static random access memory for execution, or directly decrypt the second encrypted firmware in the flash memory and execute the decrypted firmware.
[0095] In an optional embodiment of the present application, the function of the judgment module is realized by a level signal of an output pin.
[0096] See also Figure 2, the data exchange process between the lower computer and the upper computer of the hardware security system is as follows: on the one-time programmable memory set in the lower computer of the hardware security system, two key slots, a valid status bit flag of the second preset key and a secure boot enable bit can be designed: a key slot for storing the first preset key dek_pc, with a length of 128bit or 256bit; a key slot for storing the second preset key dek_trng, with a length of 128bit or 256bit; the valid status bit flag of the second preset key occupies one bit, which is used to determine whether the second preset key expression dek_trng is valid; the secure boot enable bit, which occupies one bit, is used to enable the secure boot mode. The host computer of the hardware security system burns dek_pc into the key slot of the one-time programmable memory, and uses the same key to encrypt the firmware of the lower computer, generating ciphertext from plaintext. This encryption is mainly to ensure the confidentiality of the encrypted firmware during transmission. There is a special third-party burning factory for burning. After burning dek_pc and firmware, it is also necessary to set the secure boot mode enable bit in the one-time programmable memory, and then power on again. The startup code in the read-only closed-source program solidified inside the chip first enters the secure boot mode according to the secure boot mode bit in the one-time programmable memory; then judge and read the valid status bit of dek_trng. If it is 0, configure the true random number generator to generate a true random key, and then call the one-time programmable memory in the startup code to drive the burning. One-time programmable memory, set the valid status bit of dek_trng; the boot code first uses the dek_pc in the one-time programmable memory to read the firmware in the flash memory according to the size of the firmware block (which can be 4KB, usually determined by the minimum page of the flash memory) into the static random access memory (sram) in the hardware security system, and uses dek_pc to decrypt the firmware block into plaintext, and then uses dek_trng to encrypt it into a secondary ciphertext block, and then burns it into the corresponding page of the flash memory, replacing it with the source ciphertext block, and so on, using the ciphertext firmware encrypted by the dek_trng key to replace the source ciphertext firmware. This process requires decryption, encryption and burning of the flash memory, and the process may be slow. A general input and output port can also be agreed to determine whether this process is completed correctly. If it is completed, there is no need to power on or reset again, and you can directly start using the dek-trng regular secure boot process. If it is after reset or power on again, the boot code reads the dek_trng status bit, determines that dek_trng is already valid, and uses dek_trng to decrypt the firmware to the static random access memory for execution or in-situ execution.
[0097] For the specific definition of the secondary encryption startup device for the hardware security system, please refer to the definition of the secondary encryption startup method for the hardware security system mentioned above, which will not be repeated here. Each module in the above device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0098] In one embodiment, a computer device is provided, which includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a secondary encryption startup method for a hardware security system as described above is implemented. It includes: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, any step in the secondary encryption startup method for a hardware security system as described above is implemented.
[0099] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the secondary encryption startup method for a hardware security system as described above can be implemented.
[0100] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0101] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0104] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0105] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A secondary encryption startup method for a hardware security system, characterized in that: include: Encrypting the firmware using a first preset key, and burning the encrypted first encrypted firmware into a preset flash memory; Burning the first preset key into a preset one-time programmable memory; When a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on, reading a second preset key; The first encrypted firmware in the preset flash memory is read using the first preset key, and the read first encrypted firmware is decrypted into plaintext firmware, the plaintext firmware is encrypted into the second encrypted firmware using the second preset key, and the second encrypted firmware is burned to the preset flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
2. The method according to claim 1, characterized in that The step of reading the second preset key when the secure boot enable bit in the preset one-time programmable memory is set and the hardware security system is powered on includes: When a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on, entering a secure boot mode according to the secure boot enable bit based on a preset boot code; Reading a valid status bit of a second preset key; When the valid state bit of the second preset key is 0, generate a true random number as the second preset key, burn the second preset key into the preset one-time programmable memory, and set the valid state bit of the second preset key; When the valid state bit of the second preset key is not 0, the second preset key is read.
3. The method according to claim 1, characterized in that The method of reading the first encrypted firmware in the preset flash memory using the first preset key and decrypting the read first encrypted firmware into plaintext firmware includes: According to the size of the preset firmware block, the first encrypted firmware in the preset flash memory is read and decrypted into the preset static random access memory using the first preset key to obtain a plurality of plaintext firmware blocks.
4. The method according to claim 3, characterized in that The size of the preset firmware block is determined by the following steps: Load the ciphertext of the smallest sector of the preset flash memory; The size of the ciphertext of the smallest sector of the preset flash memory is used as the size of the preset firmware block.
5. The method according to claim 3, characterized in that: The method of encrypting the plaintext firmware into a second encrypted firmware by using a second preset key, and burning the second encrypted firmware into a preset flash memory includes: Each plaintext firmware block is encrypted into an encrypted firmware block using a second preset key, and each encrypted firmware block is burned into a preset flash memory as a second encrypted firmware.
6. The method according to claim 1, characterized in that After burning the second encrypted firmware to the preset flash memory, the method further includes: Determining whether the step of burning the second encrypted firmware to the preset flash memory is completed; After completing the step of burning the second encrypted firmware to the preset flash memory, the hardware security system is powered on or reset, and the second encrypted firmware is decrypted into the preset static random access memory using the second preset key for execution, or the second encrypted firmware is directly decrypted in the preset flash memory and the decrypted firmware is executed.
7. The method according to claim 6, characterized in that The step of determining whether the second encrypted firmware is burned into the preset flash memory is completed is achieved through the level signal of the output pin.
8. A secondary encryption startup device for a hardware security system, characterized in that: include: An encryption module, used to encrypt the firmware using a first preset key, and burn the encrypted first encrypted firmware into a preset flash memory; A burning module, used for burning the first preset key into a preset one-time programmable memory; A reading module, configured to read a second preset key when a secure boot enable bit in a preset one-time programmable memory is set and the hardware security system is powered on; A replacement module is used to use a first preset key to read a first encrypted firmware in a preset flash memory, decrypt the read first encrypted firmware into plaintext firmware, encrypt the plaintext firmware into a second encrypted firmware using a second preset key, and burn the second encrypted firmware to the preset flash memory, where the second encrypted firmware is used to replace the first encrypted firmware.
9. A computer device comprising: It comprises a memory and a processor, the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the secondary encryption startup method for a hardware security system described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the secondary encryption startup method for a hardware security system according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method for securely storing and loading firmware and electronic device
CN113656086A
Firmware deployment system and method for embedded hardware security module
CN115080075A