Firmware Signature and Processor Booting Method and Device
By derive the shared key of the negotiated public key and the root private key in the processor, and isolate the processor root private key and the signed private key, the key speculation problem in processor secure boot is solved, ensuring the security of processor startup and the trustworthiness of the system.
Patent Information
- Application Number
- CN202210755858.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-06-29
AI Technical Summary
In the prior art, the processor root key participates in data signature or encryption calculation of off-chip firmware, resulting in malicious attackers being able to speculate on the key and threaten the processor to start securely.
The random number and the processor root private key are used to derive a negotiation public key, generate a first shared key, derive a first signed private key, sign the firmware, and store it in an off-chip storage device to isolate the processor root private key and the first signed private key.
Ensure the security of the processor startup process, prevent the root private key from being leaked, ensure firmware legality, and avoid the risk of leakage during system startup.
Smart Images

Figure CN115168813B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of processor secure boot, and in particular to a firmware signature, as well as a processor boot method and device. Background Art
[0002] With the increasing complexity of processor logic, the latest processors all adopt system-on-chip design. Processors usually have on-chip firmware (ROM) built-in, and an integrity verification circuit is designed for the on-chip firmware. Thus, based on the on-chip firmware as the root of trust, after successively loading and verifying off-chip firmware, the off-chip firmware will be executed. To ensure the security of the processor, a secure boot method needs to be adopted. Secure boot means ensuring that the off-chip firmware executed on the processor is the firmware certified by the processor manufacturer. Therefore, it is necessary to verify the off-chip firmware. If the off-chip firmware is maliciously tampered with, the system startup will be blocked. In the prior art, when verifying the off-chip firmware, the processor root key participates in the actual data signature or encryption calculation, which will cause malicious attackers to infer the key based on the original data and the result data. Summary of the Invention
[0003] The firmware signature, as well as the processor boot method and device provided by the present invention, can effectively isolate the processor root private key and the first signature private key for verifying the firmware legality, which can not only ensure the security of the processor boot process, but also ensure the unpredictability of the processor root private key.
[0004] In a first aspect, the present invention provides a firmware signature method, which is applied to the signature process of off-chip firmware by a processor manufacturer, and includes:
[0005] Obtain a random number, and determine a negotiation public key based on the random number;
[0006] Obtain a first public key corresponding to the root private key of the target processor, and determine a first shared key based on the first public key and the random number;
[0007] Derive a first signature private key based on the first shared key;
[0008] Use the first signature private key to perform at least one level of signature on the firmware to determine a first signature;
[0009] Store the negotiation public key, the firmware, and the first signature in an off-chip storage device.
[0010] Optionally, it further includes:
[0011] Obtain an encryption key for encrypting the firmware and store it in the off-chip storage device;
[0012] Derive a second shared key based on the first shared key;
[0013] Encrypt the encryption key using the second shared key.
[0014] Optionally, it further includes:
[0015] Derive a second signature private key based on the first shared key;
[0016] Sign the encryption key using the second signature private key to obtain a second signature, and store the second signature in an off-chip storage device.
[0017] Optionally, perform at least one level of signature on the firmware using the first signature private key to determine that the first signature includes:
[0018] Obtain a third signature private key, and sign the firmware using the third signature private key to obtain a third signature corresponding to the firmware;
[0019] Sign the third verification public key corresponding to the third signature private key using the first signature private key to obtain a first signature corresponding to the third verification public key.
[0020] In a second aspect, the present invention provides a processor startup method, which is applied to the processor startup process and includes:
[0021] Read the negotiated public key from an off-chip storage device, and determine the first shared key based on the negotiated public key and the root private key of the processor;
[0022] Derive a first verification public key based on the first shared key;
[0023] Perform at least one level of verification on the firmware based on the first verification public key to determine the legality of the firmware;
[0024] When the firmware is legal, determine to load the firmware.
[0025] Optionally, it further includes:
[0026] Derive a second shared key based on the first shared key;
[0027] Decrypt the encryption key using the second shared key;
[0028] Decrypt the firmware using the encryption key.
[0029] Optionally, it further includes:
[0030] Derive a second verification public key based on the first shared key;
[0031] Verify the encryption key using the second verification public key to determine the legality of the encryption key;
[0032] When the encryption key is legal, decrypt the firmware using the encryption key.
[0033] Optionally, at least one level of signature verification of the firmware is performed according to the first signature verification public key to determine the legality of the firmware, including:
[0034] Verify the first signature of the third signature verification public key using the first signature verification public key to determine the legality of the third signature verification public key;
[0035] When the third signature verification public key is legal, verify the third signature of the firmware using the third signature verification public key to determine the legality of the firmware.
[0036] In a third aspect, the present invention provides a firmware signature device, which is applied to the signature process of off-chip firmware by a processor manufacturer, including:
[0037] A negotiation public key module, configured to obtain a random number and determine a negotiation public key according to the random number;
[0038] A first shared key module, configured to obtain the first public key corresponding to the root private key of the target processor and determine a first shared key according to the first public key and the random number;
[0039] A first signature private key module, configured to derive a first signature private key according to the first shared key;
[0040] A first signature acquisition module, configured to perform at least one level of signature on the firmware using the first signature private key to determine a first signature;
[0041] A storage module, configured to store the negotiation public key, the firmware, and the first signature in an off-chip storage device.
[0042] Optionally, it further includes:
[0043] An encryption key module, configured to obtain an encryption key for encrypting the firmware and store it in the off-chip storage device;
[0044] A second shared key module, configured to derive a second shared key according to the first shared key;
[0045] An encryption execution module, configured to encrypt the encryption key using the second shared key.
[0046] Optionally, it further includes:
[0047] A second signature private key module, configured to derive a second signature private key according to the first shared key;
[0048] A key signature module, configured to sign the encryption key using the second signature private key to obtain a second signature and store the second signature in the off-chip storage device.
[0049] Optionally, the first signature acquisition module includes:
[0050] A first signature sub-module, configured to obtain a third signature private key, and sign the firmware with the third signature private key to obtain a third signature of the corresponding firmware;
[0051] A second signature sub-module, configured to sign a third signature verification public key corresponding to the third signature private key with the first signature private key to obtain a first signature of the corresponding third signature verification public key.
[0052] Fourthly, the present invention provides a processor startup device, which is applied to the processor startup process and includes:
[0053] A shared negotiation module, configured to read a negotiation public key from an off-chip storage device, and determine a first shared key according to the negotiation public key and the root private key of the processor;
[0054] A first signature verification public key module, configured to derive a first signature verification public key according to the first shared key;
[0055] A first signature verification module, configured to perform at least one-level verification on the firmware according to the first signature verification public key to determine the legality of the firmware;
[0056] A firmware loading module, configured to determine to load the firmware when the firmware is legal.
[0057] Optionally, it further includes:
[0058] A second shared key derivation module, configured to derive a second shared key according to the first shared key;
[0059] A key decryption module, configured to decrypt the encryption key with the second shared key;
[0060] A firmware decryption module, configured to decrypt the firmware with the encryption key.
[0061] Optionally, it further includes:
[0062] A second signature verification public key module, configured to derive a second signature verification public key according to the first shared key;
[0063] A key verification module, configured to verify the encryption key with the second signature verification public key to determine the legality of the encryption key;
[0064] A decryption execution module, configured to decrypt the firmware with the encryption key when the encryption key is legal.
[0065] Optionally, the first signature verification module includes:
[0066] The first signature verification sub-module is used to verify the first signature of the third signature verification public key by using the first signature verification public key to determine the legitimacy of the third signature verification public key;
[0067] The second signature verification sub-module is used to verify the third signature of the firmware by using the third signature verification public key to determine the legitimacy of the firmware when the third signature verification public key is legitimate.
[0068] In the technical solution provided by the present invention, the root private key of the processor and the negotiated public key are used for key derivation. Thus, the root private key of the processor and the first signature private key can be effectively isolated, the security of the processor startup process can be guaranteed, and the root private key can also be made unpredictable, avoiding the risk of root private key leakage. At the same time, the first signature private key is derived based on the root private key and the negotiated public key, and the first signature private key can be changed by changing the negotiated public key. Even if the single negotiated public key is leaked, the security of the processor startup can be guaranteed. In the technical solution provided by the present invention, based on the signature and verification mechanism of the asymmetric encryption algorithm, it can effectively ensure that the firmware executed on the processor is legitimate and not tampered with, thereby ensuring the credibility of the entire system startup process. Since the derivation of the first signature private key and the first signature verification public key are separately executed by the manufacturer server and the processor, and there is no need for interaction between the two, the risk of leakage of the first signature private key and the first signature verification public key during the generation process is avoided. Description of the Drawings
[0069] Figure 1 It is a flowchart of a firmware signature method according to an embodiment of the present invention;
[0070] Figure 2 It is a flowchart of encrypting an encryption key in a firmware signature method according to another embodiment of the present invention;
[0071] Figure 3 It is a flowchart of signing an encryption key in a firmware signature method according to another embodiment of the present invention;
[0072] Figure 4 It is a flowchart of performing a secondary signature in a firmware signature method according to another embodiment of the present invention;
[0073] Figure 5 It is a flowchart of a processor startup method according to an embodiment of the present invention;
[0074] Figure 6 It is an interaction diagram of a processor startup method according to another embodiment of the present invention;
[0075] Figure 7 It is a flowchart of decrypting an encryption key in a processor startup method according to another embodiment of the present invention;
[0076] Figure 8Flowchart for verifying the signature of an encryption key in the processor startup method according to another embodiment of the present invention;
[0077] Figure 9 Interaction diagram for encrypting and verifying the signature of an encryption key in the processor startup method according to another embodiment of the present invention;
[0078] Figure 10 Flowchart for performing secondary signature verification in the firmware signature method according to another embodiment of the present invention;
[0079] Figure 11 Interaction diagram for performing secondary signature verification in the firmware signature method according to another embodiment of the present invention;
[0080] Figure 12 Interaction diagram for performing tertiary signature verification in the firmware signature method according to another embodiment of the present invention;
[0081] Figure 13 Schematic diagram of a firmware signature device according to an embodiment of the present invention;
[0082] Figure 14 Schematic diagram of a firmware signature device according to another embodiment of the present invention;
[0083] Figure 15 Schematic diagram of a firmware signature device according to another embodiment of the present invention;
[0084] Figure 16 Flowchart of the first signature private key module of a firmware signature device according to another embodiment of the present invention;
[0085] Figure 17 Flowchart of a processor startup device according to an embodiment of the present invention;
[0086] Figure 18 Schematic diagram of a processor startup device according to another embodiment of the present invention;
[0087] Figure 19 Schematic diagram of a processor startup device according to another embodiment of the present invention;
[0088] Figure 20 Flowchart of the first signature private key module of a processor startup device according to another embodiment of the present invention. Detailed implementation manners
[0089] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are only some of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0090] An embodiment of the present invention provides a firmware signature method, which is applied to the signature process of off-chip firmware by a processor manufacturer. As Figure 1 shown, it includes:
[0091] Step 110: Obtain a random number and determine a negotiation public key based on the random number. In some embodiments, the random number is randomly generated. According to the generation rule of the asymmetric encryption algorithm, the random number is used as the negotiation private key, and the negotiation public key is generated based on the negotiation private key.
[0092] Step 120: Obtain a first public key corresponding to the root private key of the target processor, and determine a first shared key based on the first public key and the random number. In some embodiments, the root private key of the processor is secret information of the processor. When generating the first shared key, the manufacturer server first needs to obtain the first public key corresponding to the root private key of the processor, and then calculate the first shared key based on the first public key and the random number. The formation process of the first shared key can be implemented by software, hardware, or software calling a hardware module. The algorithm flow of key negotiation depends on the specific asymmetric cryptographic algorithm. For example, the calculation method of the first shared key based on an elliptic curve is as follows: SK = SP * R, where "*" represents point multiplication, SK is the first shared key, SP is the first public key corresponding to the root private key of the processor, and R is the random number.
[0093] Step 130: Derive a first signature private key based on the first shared key. In some embodiments, the first shared key is subjected to derivation calculation to obtain the first signature private key, which is used to directly or indirectly sign the firmware. The key derivation process can be implemented by software, hardware, or software calling a hardware module. A preferred embodiment of the key derivation process is as follows: Based on Hash calculation: K = Hash(SK). Another preferred embodiment of the key derivation process is as follows: Based on encryption and decryption calculation: Split SK into multiple data blocks, one data block as the original data, one data block as the key, and one data block as the encryption and decryption parameter, and obtain the signature private key K through encryption and decryption calculation. Another preferred implementation of the key derivation process is as follows: Combine Hash calculation and encryption and decryption calculation: First perform Hash on SK and then perform encryption and decryption calculation; or first perform encryption and decryption calculation and then calculate Hash. In the foregoing various preferred implementation manners, K is the first signature private key, and SK is the first shared key.
[0094] Step 140, perform at least one - level signature on the firmware using the first signature private key to determine the first signature; in some embodiments, when signing the firmware, the first signature private key can be directly used as the first - level private key to sign the firmware, that is, perform first - level signature. It is also possible to use the first signature private key as the first - level private key to obtain a second - level private key for signing the firmware. First, sign the firmware with the second - level private key, and then sign the second - level public key corresponding to the second - level private key with the first signature private key, that is, perform second - level signature. In this case, the first signature should include the first - level signature and the second - level signature. It is also possible to sign the firmware with a third - level private key.
[0095] Step 150, store the negotiated public key, the firmware, and the first signature in an off - chip storage device. In some embodiments, the negotiated public key is stored in the off - chip storage device. When the processor needs to perform signature verification, after obtaining the negotiated public key, the first signature private key can be generated based on the root private key and the negotiated public key, and then the first verification public key is formed using the first signature private key to verify the first signature.
[0096] In the technical solution provided by the embodiment of the present invention, the first public key corresponding to the root private key of the processor and a random number are used for key derivation. Thus, it is possible to effectively isolate the processor root private key and the first signature private key, ensure the security of the processor startup process, and make the root private key unpredictable, avoiding the risk of root private key leakage. At the same time, the first signature private key is derived based on the first public key corresponding to the root private key and a random number, and the first signature private key can be changed by changing the random number. Even if the single - time first signature private key is leaked, the security of the processor startup can still be guaranteed. In the technical solution provided by the embodiment of the present invention, based on the signature and signature - verification mechanism of the asymmetric encryption algorithm, it is possible to effectively ensure that the firmware executed on the processor is legal and has not been tampered with, thus ensuring the credibility of the entire system startup process. Since the derivation of the first signature private key and the first verification public key are separately executed by the manufacturer's server and the processor, without the need for interaction between the two, the risk of leakage during the generation process of the first signature private key and the first verification public key is avoided.
[0097] As an alternative implementation, as Figure 2 shown, it further includes:
[0098] Step 161, obtain the encryption key for encrypting the firmware and store it in the off - chip storage device; in some embodiments, to ensure the security of the firmware, the firmware can be further encrypted. Therefore, an encryption key can be obtained to encrypt the firmware. The encryption key can be randomly generated or preset in advance.
[0099] Step 162: Derive a second shared key based on the first shared key. In some embodiments, the second shared key is derived in the processor manufacturer's server based on the first shared key. When the processor decrypts the firmware, the second shared key can be independently derived based on the first shared key.
[0100] Step 163: Encrypt the encryption key using the second shared key. In some embodiments, to ensure the security of the encryption key, the encryption key is encrypted using the second shared key. Since the processor can independently generate the second shared key, during the decryption process of the encryption key, the second shared key can be obtained without interaction. During the decryption process, the processor first decrypts the encryption key using the second shared key, and then decrypts the firmware using the encryption key for firmware loading.
[0101] As an alternative implementation, as Figure 3 shown, it further includes:
[0102] Step 171: Derive a second signature private key based on the first shared key. In some embodiments, the first shared key is a key shared by the processor manufacturer's server and the processor. Therefore, the processor manufacturer's server derives the second signature private key based on the first shared key, which can ensure that the processor can also independently derive the second verification public key in the same way.
[0103] Step 172: Sign the encryption key using the second signature private key to obtain a second signature, and store the second signature in an off-chip storage device. In some embodiments, the encryption key is signed using the second signature private key. During the processor startup process, the second signature can be verified using the corresponding second verification public key to determine the integrity of the encryption key.
[0104] As an alternative implementation, as Figure 4 shown, in step 140, at least one level of signature is performed on the firmware using the first signature private key to determine that the first signature includes:
[0105] Step 141: Obtain a third signature private key, and sign the firmware using the third signature private key to obtain a third signature for the corresponding firmware. In some embodiments, the third signature private key can be randomly generated or preset. Sign the firmware using the third signature private key to obtain the third signature. During the processor startup process, verify the third signature of the firmware using the third verification public key to determine the integrity of the firmware.
[0106] Step 142: Sign the third verification public key corresponding to the third signature private key with the first signature private key to obtain a first signature corresponding to the third verification public key. In some embodiments, during the processor startup process, the first verification public key is generated based on the first signature private key, and the first signature of the third verification public key is verified using the first verification public key to determine the integrity of the third signature private key.
[0107] In this embodiment, a specific solution for two-level signature is provided, with the first signature private key as the first-level private key and the third signature private key as the second-level private key. This embodiment can further ensure the legality of the firmware through a secure transmission method.
[0108] An embodiment of the present invention provides a processor startup method, which is applied to the processor startup process, as Figure 5-6 shown, and includes:
[0109] Step 210: Read the negotiated public key from the off-chip storage device, and determine the first shared key based on the negotiated public key and the root private key of the processor; in some embodiments, the negotiated public key is read from the off-chip storage device, and the root private key of the processor is the secret information of the processor. When generating the first shared key, the processor first needs to obtain the root private key of the processor, and then calculate the first shared key based on the root private key of the processor and the negotiated public key. The formation process of the first shared key can be implemented by software, or by hardware, or by software calling a hardware module. The algorithm flow of key negotiation depends on the specific asymmetric cryptography algorithm. For example, the calculation method of the first shared key based on elliptic curve is as follows: SK = S * P, where "*" represents point multiplication, SK is the first shared key, S is the root private key of the processor, and P is the negotiated public key P. In this calculation process, since the negotiated public key P is obtained according to the calculation method that conforms to the commutative law based on the aforementioned random number R and the elliptic curve base point G, for example, when using the point multiplication method, P = R * G; at this time, the first shared key SK = S * R * G. In the process of firmware signature, the calculated first shared key SK = SP * R, where "*" represents point multiplication, SK is the first shared key, SP is the first public key corresponding to the root private key of the processor, and R is the random number. In this calculation process, the first public key SP is obtained according to the calculation method that conforms to the commutative law based on the root private key S and the elliptic curve base point G, for example, when using the point multiplication method, SP = S * G; at this time, the first shared key SK = S * G * R. Since the calculation method that conforms to the commutative law is used in the calculation process of the first shared key, therefore, after exchanging with the commutative law, the first shared key SK = S * R * G = S * G * R formed during the processor startup process; that is, the first shared key formed during the processor startup process is the same as the first shared key formed during the signature process of the off-chip firmware by the processor manufacturer.
[0110] Step 220: Derive a first signature verification public key based on the first shared key. In some embodiments, perform a derivation calculation on the first shared key to obtain a first signature private key, and then use an asymmetric encryption algorithm to generate a first signature verification public key based on the first signature private key. The key derivation process can be implemented by software, by hardware, or by software invoking a hardware module. A preferred embodiment of the key derivation process is as follows: Based on Hash calculation: K = Hash(SK). Another preferred embodiment of the key derivation process is as follows: Based on encryption and decryption calculation: Split SK into multiple data blocks, use one data block as the original data, one data block as the key, and one data block as the encryption and decryption parameter, and obtain the signature private key K through encryption and decryption calculation. Another preferred implementation of the key derivation process is as follows: Combine Hash calculation and encryption and decryption calculation: First perform Hash on SK and then perform encryption and decryption calculation; or first perform encryption and decryption calculation and then calculate Hash. In the foregoing various preferred embodiments, K is the first signature private key, and SK is the first shared key.
[0111] Step 230: Perform at least one level of signature verification on the firmware based on the first signature verification public key to determine the legality of the firmware. In some embodiments, when signing the firmware, the first signature private key can be directly used as the first-level private key to sign the firmware, that is, perform first-level signature. In this case, during the signature verification process, the first signature verification public key is used to verify the first signature of the firmware, and the signature verification process is as Figure 6 shown. It is also possible to use the first signature private key as the first-level private key to obtain a second-level private key for signing the firmware. First, use the second-level private key to sign the firmware, and then use the first signature private key to sign the second-level public key corresponding to the second-level private key, that is, perform second-level signature. At this time, the first signature includes both the signature of the second-level private key on the firmware and the signature of the first signature private key on the second-level public key; in this case, during the signature verification process, the first signature verification public key verifies the signature of the second-level public key. After ensuring the legality of the second-level public key, then verify the signature of the firmware based on the second-level public key to determine the legality of the firmware, and the signature verification process is as Figure 11 shown. It is also possible to use a third-level private key to sign the firmware, use the second-level private key to sign the third-level public key corresponding to the third-level private key, and use the first signature private key as the first-level private key to sign the second-level public key corresponding to the second-level private key, that is, perform third-level signature. At this time, the first signature includes the signature of the third-level private key on the firmware, the signature of the second-level private key on the third-level public key, and also includes the signature of the first signature private key on the second-level public key; in this case, it is necessary to first use the first signature verification public key to verify the signature of the public key to determine the legality of the second-level public key, then verify the legality of the third-level public key based on the second-level public key, and then verify the legality of the firmware based on the third-level public key, and the signature verification process is as Figure 12As shown in the figure. The specific signature verification process is determined by the corresponding asymmetric encryption algorithm. The signature verification can be implemented by software, by hardware, or by software calling a hardware module.
[0112] Step 240, when the firmware is legal, determine to load the firmware. In some embodiments, if the signature verification passes, switch to the first firmware for execution. The first firmware is responsible for loading other firmwares according to the system startup process and using the signature verification public key to verify the legality of their signatures. Only after the signature verification passes, switch to the corresponding firmware for execution.
[0113] In the technical solution provided by the embodiments of the present invention, the root private key of the processor and the negotiated public key are used for key derivation. Thus, it is possible to effectively isolate the root private key of the processor and the first signature private key, ensure the security of the processor startup process, and make the root private key unpredictable, avoiding the risk of root private key leakage. At the same time, the first signature private key is derived based on the root private key and the negotiated public key, and the first signature private key can be changed by changing the negotiated public key. Even if the single first signature private key is leaked, the security of the processor startup can be ensured. In the technical solution provided by the embodiments of the present invention, based on the signature and signature verification mechanism of the asymmetric encryption algorithm, it is possible to effectively ensure that the firmware executed on the processor is legal and has not been tampered with, thereby ensuring the credibility of the entire system startup process. Since the derivation of the first signature private key and the first signature verification public key are separately executed by the manufacturer server and the processor, and the two do not need to interact, the risk of leakage during the generation process of the first signature private key and the first signature verification public key is avoided.
[0114] As an alternative implementation, as Figure 7 and Figure 9 shown, it further includes:
[0115] Step 251, derive a second shared key based on the first shared key; in some embodiments, the second shared key is used to encrypt the encryption key. To ensure that the processor can obtain the second shared key, the processor and the processor manufacturer server derive the second shared key based on the first shared key. Since the first shared key formed by the processor and the processor manufacturer server is the same, and the same derivation algorithm is used for derivation, the same second shared key can be generated.
[0116] Step 252, decrypt the encryption key using the second shared key; in some embodiments, after decrypting the encryption key, it is the plaintext encryption key, which can be used for the encryption and decryption processes of the firmware.
[0117] Step 252, decrypt the firmware using the encryption key. In some embodiments, after decrypting the firmware, the firmware is in an available state.
[0118] In this embodiment, to ensure the security of the firmware, the firmware can be further encrypted. Therefore, an encryption key can be used to encrypt the firmware. The encryption key can be randomly generated or preset in advance. To further ensure the security of the encryption key, the encryption key is encrypted and stored in an off-chip storage device. Since the processor can independently generate a second shared key, during the process of decrypting the encryption key, the second shared key can be obtained without interaction. During the decryption process, the processor first decrypts the encryption key using the second shared key, and then decrypts the firmware using the encryption key to load the firmware.
[0119] As an alternative embodiment, as Figure 8 and Figure 9 shown, it further includes:
[0120] Step 261: Derive a second signature verification public key based on the first shared key; in some embodiments, the second signature verification public key is used to verify the second signature of the encryption key. Since the first shared key is a key shared by the processor manufacturer's server and the processor, the processor manufacturer's server derives a second signature private key based on the first shared key; the processor can independently derive a second signature private key in the same way, and then use the second signature private key to generate the second signature verification public key, thereby ensuring the smooth progress of the signature verification process.
[0121] Step 262: Verify the encryption key using the second signature verification public key to determine the legitimacy of the encryption key; in some embodiments, the chip manufacturer's server uses the second signature private key to sign the encryption key. During the startup process of the processor, the corresponding second signature verification public key can be used to verify the second signature, thereby determining the integrity of the encryption key.
[0122] Step 263: When the encryption key is legitimate, decrypt the firmware using the encryption key. In some embodiments, when the encryption key is legitimate, it indicates that the current encryption key is available, and the firmware can be decrypted using the encryption key, so that the firmware is in an available state.
[0123] As an alternative embodiment, as Figure 10-11 shown, in step 230, performing at least one-level verification of the firmware based on the first signature verification public key to determine the legitimacy of the firmware includes:
[0124] Step 231: Verify the first signature of the third verification public key using the first verification public key to determine the legitimacy of the third verification public key. In some embodiments, sign the third verification public key using the first signature private key. During the processor startup process, generate the first verification public key based on the first signature private key, and verify the first signature of the third verification public key using the first verification public key to determine the integrity of the third verification public key.
[0125] Step 232: When the third verification public key is legitimate, verify the first signature of the firmware using the third verification public key to determine the legitimacy of the firmware. In some embodiments, the processor manufacturer's server signs the firmware using the third signature private key to obtain the first signature. During the processor startup process, verify the first signature of the firmware using the third verification public key to determine the integrity of the firmware. The third signature private key is randomly generated by the processor manufacturer's server or can be preset.
[0126] In this embodiment, as Figure 11 shown, a specific verification scheme for two - level signature is provided. The first signature private key is used as the first - level private key, and the third signature private key is used as the second - level private key. During the verification process, first verify the third verification public key using the first verification public key, and then verify the firmware using the third verification public key after the verification passes. Among them, the first verification public key is the verification public key attached Figure 11 in, and the third verification public key is the second - level public key attached Figure 11 in. This embodiment can further ensure the legitimacy of the firmware through a secure transfer method. Of course, a three - level signature process can also be adopted. When using a three - level signature, the verification process adopts a three - level verification process, and the specific process is as Figure 12 shown.
[0127] The present invention provides a firmware signature device applied to the signature process of off - chip firmware by a processor manufacturer, as Figure 13 shown, including:
[0128] A negotiation public key module, configured to obtain a random number and determine a negotiation public key based on the random number. In some embodiments, the random number is randomly generated. According to the generation rule of the asymmetric encryption algorithm, the random number is used as the negotiation private key, and the negotiation public key is generated based on the negotiation private key.
[0129] The first shared key module is used to obtain the first public key corresponding to the root private key of the target processor, and determine the first shared key based on the first public key and a random number. In some embodiments, the root private key of the processor is the secret information possessed by the processor. When generating the first shared key, the manufacturer server first needs to obtain the first public key corresponding to the root private key of the processor, and then calculate the first shared key based on the first public key of the processor and the random number. The formation process of the first shared key can be implemented by software, by hardware, or by software calling a hardware module. The algorithm flow of key negotiation depends on the specific asymmetric cryptography algorithm. For example, the calculation method of the first shared key based on an elliptic curve is as follows: SK = SP * R, where "*" represents point multiplication, SK is the first shared key, S is the first public key corresponding to the root private key of the processor, and R is the random number.
[0130] The first signature private key module is used to derive the first signature private key based on the first shared key. In some embodiments, through derivation calculation on the first shared key, the first signature private key is obtained, and the first signature private key is used to directly or indirectly sign the firmware. The key derivation process can be implemented by software, by hardware, or by software calling a hardware module. A preferred embodiment of the key derivation process is as follows: Based on Hash calculation: K = Hash(SK). Another preferred embodiment of the key derivation process is as follows: Based on encryption and decryption calculation: Split SK into multiple data blocks, use one data block as the original data, one data block as the key, and one data block as the encryption and decryption parameter, and obtain the signature private key K through encryption and decryption calculation. Another preferred implementation manner of the key derivation process is as follows: Combine Hash calculation and encryption and decryption calculation: First perform Hash on SK and then perform encryption and decryption calculation; or first perform encryption and decryption calculation and then calculate Hash. In the foregoing various preferred implementation manners, K is the first signature private key, and SK is the first shared key.
[0131] The first signature acquisition module is used to perform at least one-level signature on the firmware using the first signature private key to determine the first signature. In some embodiments, when signing the firmware, the first signature private key can be directly used as the first-level private key to sign the firmware, that is, perform the first-level signature. It is also possible to use the first signature private key as the first-level private key to obtain a second-level private key for signing the firmware. First, use the second-level private key to sign the firmware, and then use the first signature private key to sign the second-level public key corresponding to the second-level private key, that is, perform the second-level signature. In this case, the first signature should include the first-level signature and the second-level signature. It is also possible to use a third-level private key to sign the firmware.
[0132] A storage module for storing the negotiated public key, firmware, and the first signature in an off-chip storage device. In some embodiments, the negotiated public key is stored in an off-chip storage device. When the processor needs to perform signature verification, after obtaining the negotiated public key, the first signature private key can be generated based on the root private key and the negotiated public key, and then the first signature verification public key can be formed using the first signature private key to verify the first signature.
[0133] In the technical solution provided by the embodiments of the present invention, the first public key corresponding to the root private key of the processor and a random number are used for key derivation. Thus, the processor root private key and the first signature private key can be effectively isolated, the security of the processor startup process can be guaranteed, and the root private key can also be made unpredictable, avoiding the risk of root private key leakage. At the same time, the first signature private key is derived based on the first public key and a random number, and the first signature private key can be changed by changing the random number. Even if the single first negotiated private key is leaked, the security of the processor startup can still be guaranteed. In the technical solution provided by the embodiments of the present invention, based on the signature and signature verification mechanism of the asymmetric encryption algorithm, it can effectively ensure that the firmware executed on the processor is legal and has not been tampered with, thus ensuring the credibility of the entire system startup process. Since the derivation of the first signature private key and the first signature verification public key are separately executed by the manufacturer's server and the processor, and there is no need for interaction between the two, the risk of leakage during the generation of the first signature private key and the first signature verification public key is avoided.
[0134] As an alternative embodiment, as Figure 14 shown, it further includes:
[0135] An encryption key module for obtaining the encryption key for encrypting the firmware and storing it in the off-chip storage device; In some embodiments, to ensure the security of the firmware, the firmware can be further encrypted. Therefore, an encryption key can be obtained to encrypt the firmware. The encryption key can be randomly generated or preset in advance.
[0136] A second shared key module for deriving a second shared key based on the first shared key; In some embodiments, the second shared key is derived based on the first shared key in the processor manufacturer's server. When the processor decrypts the firmware, the second shared key can be derived independently based on the first shared key.
[0137] An encryption execution module for encrypting the encryption key using the second shared key. In some embodiments, to ensure the security of the encryption key, the encryption key is encrypted using the second shared key. Since the processor can independently generate the second shared key, during the decryption process of the encryption key, the second shared key can be obtained without interaction. During the decryption process, the processor first decrypts the encryption key using the second shared key, and then decrypts the firmware using the encryption key for firmware loading.
[0138] As an alternative implementation, as Figure 15 shown, it further includes:
[0139] A second signature private key module for deriving a second signature private key based on the first shared key; in some embodiments, the first shared key is a key shared by the processor manufacturer's server and the processor. Therefore, the processor manufacturer's server deriving the second signature private key based on the first shared key can ensure that the processor can also independently derive the second verification public key in the same way.
[0140] A key signature module for signing the encryption key using the second signature private key to obtain a second signature and storing the second signature in an off-chip storage device. In some embodiments, signing the encryption key using the second signature private key allows the corresponding second verification public key to be used to verify the second signature during the processor startup process, thereby determining the integrity of the encryption key.
[0141] As an alternative implementation, as Figure 16 shown, the first signature acquisition module includes:
[0142] A first signature sub-module for obtaining a third signature private key and signing the firmware using the third signature private key to obtain a third signature for the corresponding firmware; in some embodiments, the third signature private key can be randomly generated or preset. Signing the firmware using the third signature private key to obtain the third signature allows the third verification public key to be used to verify the third signature of the firmware during the processor startup process to determine the integrity of the firmware.
[0143] A second signature sub-module for signing the third verification public key corresponding to the third signature private key using the first signature private key to obtain a first signature for the corresponding third verification public key. In some embodiments, signing the third verification public key using the first signature private key allows, during the processor startup process, the first verification public key to be generated based on the first signature private key and used to verify the first signature of the third verification public key to determine the integrity of the third verification public key.
[0144] In this embodiment, a specific solution for secondary signature is provided. The first signature private key is used as the primary private key, and the third signature private key is used as the secondary private key. This embodiment can further ensure the legitimacy of the firmware through a secure transfer method.
[0145] An embodiment of the present invention provides a processor startup device, which is applied to the processor startup process, as Figure 17 shown, including:
[0146] A shared negotiation module, configured to read a negotiation public key from an off-chip storage device, and determine a first shared key according to the negotiation public key and the root private key of the processor; in some embodiments, the negotiation public key is read from the off-chip storage device, and the root private key of the processor is secret information possessed by the processor. When generating the first shared key, the processor first needs to obtain the root private key of the processor, and then calculate the first shared key according to the root private key of the processor and the negotiation public key. The formation process of the first shared key can be implemented by software, hardware, or software calling a hardware module. The algorithm flow of key negotiation depends on a specific asymmetric cryptographic algorithm. For example, the calculation method of the first shared key based on an elliptic curve is as follows: SK = S * P, where "*" represents point multiplication, SK is the first shared key, S is the root private key of the processor, and P is the negotiation public key P.
[0147] A first signature verification public key module, configured to derive a first signature verification public key according to the first shared key; in some embodiments, perform a derivation calculation on the first shared key to obtain a first signature private key, and then generate a first signature verification public key according to the first signature private key through an asymmetric encryption algorithm. The key derivation process can be implemented by software, hardware, or software calling a hardware module. A preferred embodiment of the key derivation process is as follows: based on Hash calculation: K = Hash(SK). Another preferred embodiment of the key derivation process is as follows: based on encryption and decryption calculation: split SK into multiple data blocks, use one data block as the original data, one data block as the key, and one data block as the encryption and decryption parameter, and obtain the signature private key K through encryption and decryption calculation. Another preferred implementation manner of the key derivation process is as follows: combine Hash calculation and encryption and decryption calculation: first perform Hash on SK and then perform encryption and decryption calculation; or first perform encryption and decryption calculation and then calculate Hash. In the foregoing various preferred implementation manners, K is the first signature private key, and SK is the first shared key.
[0148] The first signature verification module is used to perform at least one - level signature verification on the firmware according to the first verification public key to determine the legality of the firmware; in some embodiments, when signing the firmware, the first signature private key can be directly used as the first - level private key to sign the firmware, that is, perform first - level signature. In this case, during the signature verification process, the first verification public key is used to verify the first signature of the firmware, and the signature verification process is as Figure 6 shown. It is also possible to use the first signature private key as the first - level private key to obtain a second - level private key for signing the firmware. First, the second - level private key is used to sign the firmware, and then the first signature private key is used to sign the second - level public key corresponding to the second - level private key, that is, perform second - level signature. At this time, the first signature includes both the signature of the second - level private key on the firmware and the signature of the first signature private key on the second - level public key; in this case, during the signature verification process, the first verification public key verifies the first signature of the second - level public key. After ensuring the legality of the second - level public key, the signature of the firmware is verified according to the second - level public key to determine the legality of the firmware, and the signature verification process is as Figure 11 shown. It is also possible to use a third - level private key to sign the firmware, use the second - level private key to sign the third - level public key, and use the first signature private key as the first - level private key to sign the second - level public key, that is, perform third - level signature. At this time, the first signature includes the signature of the third - level private key on the firmware, the signature of the second - level private key on the third - level public key, and also the signature of the first signature private key on the second - level public key; in this case, it is necessary to first use the first verification public key to verify the signature of the second - level public key to determine the legality of the second - level private key, then use the second - level public key to verify the legality of the third - level public key, and then verify the legality of the firmware according to the third - level public key, and the signature verification process is as Figure 12 shown. The specific signature verification process is determined by the corresponding asymmetric encryption and decryption algorithm. Signature verification can be implemented by software, by hardware, or by software calling a hardware module.
[0149] The firmware loading module is used to determine to load the firmware when the firmware is legal. In some embodiments, if the signature verification passes, the system switches to execute the first firmware. The first firmware is responsible for loading other firmware according to the system startup process and using the verification public key to verify the legality of its signature. Only after the signature verification passes can the system switch to execute the corresponding firmware.
[0150] In the technical solution provided by the embodiment of the present invention, the root private key and the negotiated public key of the processor are used for key derivation. Thus, the root private key of the processor and the first signature private key can be effectively isolated, the security of the processor startup process can be ensured, and the root private key can also be made unpredictable, avoiding the risk of root private key leakage. At the same time, the first signature private key is derived based on the root private key and the negotiated public key, and the first signature private key can be changed by changing the negotiated public key. Even if the single first signature private key is leaked, the security of the processor startup can be ensured. In the technical solution provided by the embodiment of the present invention, based on the signature and verification mechanism of the asymmetric encryption algorithm, it can effectively ensure that the firmware executed on the processor is legal and has not been tampered with, thereby ensuring the credibility of the entire system startup process. Since the derivation of the first signature private key and the first verification public key are separately executed by the manufacturer server and the processor, and the two do not need to interact, the risk of leakage during the generation of the first signature private key and the first verification public key is avoided.
[0151] As an alternative embodiment, as Figure 18 shown, it further includes:
[0152] A second shared derivation module, configured to derive a second shared key according to the first shared key; in some embodiments, the second shared key is used to encrypt the encryption key. To ensure that the processor can obtain the second shared key, the processor and the processor manufacturer server derive the second shared key according to the first shared key.
[0153] A key decryption module, configured to decrypt the encryption key with the second shared key; in some embodiments, after decrypting the encryption key, it is the plaintext encryption key, which can be used for the encryption and decryption processes of the firmware.
[0154] A firmware decryption module, configured to decrypt the firmware with the encryption key. In some embodiments, after decrypting the firmware, the firmware is in an available state.
[0155] In this embodiment, to ensure the security of the firmware, the firmware can be further encrypted. Therefore, the encryption key can be used to encrypt the firmware. The encryption key can be randomly generated or preset. To further ensure the security of the encryption key, the encrypted encryption key is stored in an off-chip storage device. Since the processor can independently generate the second shared key, during the process of decrypting the encryption key, the second shared key can be obtained without interaction. During the decryption process, the processor first decrypts the encryption key with the second shared key, and then decrypts the firmware with the encryption key to load the firmware.
[0156] As an alternative embodiment, asFigure 19 As shown, it further includes:
[0157] A second signature verification public key module, which is used to derive a second signature verification public key based on the first shared key; in some embodiments, the second signature verification public key is used to verify the second signature of the encryption key. Since the first shared key is the key shared by the processor manufacturer's server and the processor, the processor manufacturer's server derives the second signature private key based on the first shared key; the processor can independently derive the second signature private key in the same way, and then use the second signature private key to generate the second signature verification public key, thereby ensuring the smooth progress of the signature verification process.
[0158] A key signature verification module, which is used to verify the encryption key with the second signature verification public key to determine the legality of the encryption key; in some embodiments, the chip manufacturer's server uses the second signature private key to sign the encryption key, and during the processor startup process, the corresponding second signature verification public key can be used to verify the second signature, thereby determining the integrity of the encryption key.
[0159] A decryption execution module, which is used to decrypt the firmware with the encryption key when the encryption key is legal. In some embodiments, when the encryption key is legal, it indicates that the current encryption key is available, and the firmware can be decrypted with the encryption key, so that the firmware is in an available state.
[0160] As an optional implementation manner, as Figure 20 shown, the first signature verification module includes:
[0161] A first signature verification sub-module, which is used to verify the first signature of the third signature verification public key with the first signature verification public key to determine the legality of the third signature verification public key; in some embodiments, the first signature private key is used to sign the third signature private key, and during the processor startup process, the first signature verification public key is generated based on the first signature private key, and the first signature of the third signature verification public key is verified with the first signature verification public key to determine the integrity of the third signature verification public key.
[0162] A second signature verification sub-module, which is used to verify the third signature of the firmware with the third signature verification public key to determine the legality of the firmware when the third signature verification public key is legal. In some embodiments, the processor manufacturer's server uses the third signature private key to sign the firmware to obtain the third signature, and during the processor startup process, the third signature of the firmware is verified with the third signature verification public key to determine the integrity of the firmware. The third signature private key is randomly generated by the processor manufacturer's server or can also be preset.
[0163] In this embodiment, as Figure 11As shown, a specific scheme for verifying a second-level signature is provided. The first signature private key is used as the first-level private key, and the third signature private key is used as the second-level private key. During the signature verification process, the first verification public key is first used to verify the third verification public key. After the verification passes, the firmware is then verified through the third verification public key. Among them, the first verification public key is the verification public key attached in Figure 11 , and the third verification public key is the second-level public key attached in Figure 11 . This embodiment can further ensure the legality of the firmware through a secure transmission method. Of course, a three-level signature process can also be adopted. When a three-level signature is used, a three-level signature verification process is adopted for the signature verification process. The specific process is as shown in Figure 12 .
[0164] Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0165] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A firmware signature method, characterized in that, Applied to the signature process of off-chip firmware by processor manufacturers, including: Obtain a random number and determine a negotiation public key based on the random number; Obtain a first public key corresponding to the root private key of the target processor, and determine a first shared key based on the first public key and the random number; Derive a first signature private key based on the first shared key; Perform at least one level of signature on the firmware using the first signature private key to determine a first signature; Store the negotiation public key, the firmware, and the first signature in an off-chip storage device.
2. The method according to claim 1, wherein Also includes: Obtain an encryption key for encrypting the firmware and store it in the off-chip storage device; Derive a second shared key based on the first shared key; Encrypt the encryption key using the second shared key.
3. The method according to claim 2, wherein Also includes: Derive a second signature private key based on the first shared key; Sign the encryption key using the second signature private key to obtain a second signature, and store the second signature in an off-chip storage device.
4. The method according to claim 1, wherein Performing at least one level of signature on the firmware using the first signature private key to determine a first signature includes: Obtain a third signature private key, and sign the firmware using the third signature private key to obtain a third signature of the corresponding firmware; Sign the third verification public key corresponding to the third signature private key using the first signature private key to obtain a first signature of the corresponding third verification public key.
5. A processor startup method, characterized in that, Applied to the processor startup process, including: Read the negotiation public key from the off-chip storage device, and determine a first shared key based on the negotiation public key and the root private key of the processor; Derive a first verification public key based on the first shared key; Perform at least one level of verification on the firmware based on the first verification public key to determine the legality of the firmware; When the firmware is legal, determine to load the firmware.
6. The method according to claim 5, wherein Also includes: Derive a second shared key based on the first shared key; Decrypt the encryption key using the second shared key; Decrypt the firmware using the encryption key.
7. The method according to claim 6, wherein Also includes: Derive a second verification public key based on the first shared key; Verify the second signature of the encryption key using the second verification public key to determine the legality of the encryption key; When the encryption key is legal, decrypt the firmware using the encryption key.
8. The method according to claim 5, characterized in that, Performing at least one level of verification on the firmware based on the first verification public key to determine the legality of the firmware includes: Verify the first signature of the third verification public key using the first verification public key to determine the legality of the third verification public key; When the third verification public key is legal, verify the third signature of the firmware using the third verification public key to determine the legality of the firmware.
9. A firmware signature device, characterized in that, Applied to the signature process of off-chip firmware by processor manufacturers, including: A negotiation public key module, used to obtain a random number and determine a negotiation public key based on the random number; A first shared key module, used to obtain a first public key corresponding to the root private key of the target processor, and determine a first shared key based on the first public key and the random number; A first signature private key module, used to derive a first signature private key based on the first shared key; A first signature acquisition module, used to perform at least one level of signature on the firmware using the first signature private key to determine a first signature; A storage module for storing the negotiated public key, firmware, and the first signature in an off-chip storage device.
10. The device according to claim 9, wherein, It further includes: An encryption key module for obtaining an encryption key for encrypting the firmware and storing it in the off-chip storage device; A second shared key module for deriving a second shared key based on the first shared key; An encryption execution module for encrypting the encryption key using the second shared key.
11. The device according to claim 10, characterized in that, It further includes: A second signature private key module for deriving a second signature private key based on the first shared key; A key signature module for signing the encryption key using the second signature private key to obtain a second signature and storing the second signature in the off-chip storage device.
12. The device according to claim 9, characterized in that, The first signature acquisition module includes: A first signature sub-module for obtaining a third signature private key and signing the firmware using the third signature private key to obtain a third signature corresponding to the firmware; A second signature sub-module for signing using the first signature private key and the third verification public key corresponding to the third signature private key to obtain a first signature corresponding to the third verification public key.
13. A processor startup device, characterized in that, Applied to the processor startup process, it includes: A shared negotiation module for reading the negotiated public key from the off-chip storage device and determining the first shared key based on the negotiated public key and the root private key of the processor; A first verification public key module for deriving a first verification public key based on the first shared key; A first signature verification module for performing at least one level of verification on the firmware based on the first verification public key to determine the legitimacy of the firmware; A firmware loading module for determining to load the firmware when the firmware is legitimate.
14. The device according to claim 13, characterized in that, It further includes: A second shared derivation module for deriving a second shared key based on the first shared key; A key decryption module for decrypting the encryption key using the second shared key; A firmware decryption module for decrypting the firmware using the encryption key.
15. The device according to claim 14, characterized in that It further includes: A second verification public key module for deriving a second verification public key based on the first shared key; A key verification module for verifying the second signature of the encryption key using the second verification public key to determine the legitimacy of the encryption key; A decryption execution module for decrypting the firmware using the encryption key when the encryption key is legitimate.
16. The device according to claim 13, characterized in that, The first signature verification module includes: A first verification sub-module for verifying the first signature of the third verification public key using the first verification public key to determine the legitimacy of the third verification public key; A second verification sub-module for verifying the third signature of the firmware using the third verification public key when the third verification public key is legitimate to determine the legitimacy of the firmware.
Citation Information
Patent Citations
Parallel signature system and method based on key generation
CN112258169A
Solid state disk updating method, solid state disk and background server
CN114296756A