Method, electronic device and storage medium for upgrading signed firmware
By storing and encrypting public key information in a trusted operating system, the problem of insufficient security in signed firmware upgrades is solved, a safe and reliable upgrade process is achieved, and device security and development efficiency are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FUZHOU ROCKCHIP SEMICON
- Filing Date
- 2023-01-09
- Publication Date
- 2026-06-02
AI Technical Summary
Existing signature firmware upgrade solutions transmit public key information in untrusted environments, which cannot guarantee the security of the upgrade and cannot meet the application scenarios with high security requirements.
The public key parameter information and digital signature algorithm type are stored in secure storage through a trusted operating system. The message digest is calculated, encrypted, and written to the command line parameters. The signature firmware is verified based on the encrypted message digest, and the upgrade is only performed after the verification is successful.
It improves the security of public key information, ensures the security of signature firmware upgrades, solves the problem of devices failing to power on after a fuse blows, and improves the efficiency of development and debugging before devices leave the factory.
Smart Images

Figure CN116257839B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded device technology, and in particular to methods for upgrading signed firmware, electronic devices, and storage media. Background Technology
[0002] In existing upgrade solutions for secure boot signed firmware, the public key information for verifying the signed firmware is usually transmitted in an untrusted environment, which cannot guarantee the security of the signed firmware upgrade and thus cannot meet the needs of some application scenarios with high security requirements. Summary of the Invention
[0003] Embodiments of the present invention provide a method, electronic device, and storage medium for upgrading signed firmware, which can effectively improve the security of signed firmware upgrades.
[0004] In one aspect of the present invention, a method for upgrading signed firmware is provided. The method includes: obtaining public key parameter information and a digital signature algorithm type from the bootloader firmware in the signed firmware to be upgraded; having a trusted operating system save the public key parameter information and the digital signature algorithm type to secure storage; having the trusted operating system calculate a message digest corresponding to the public key parameter information and encrypt the message digest; writing the encrypted message digest into command-line parameters; verifying the signed firmware to be upgraded based on the public key parameter information and the digital signature algorithm type in the secure storage and the encrypted message digest in the command-line parameters; and if the verification result is successful, upgrading the signed firmware to be upgraded.
[0005] In another aspect of the invention, an electronic device is provided. The electronic device includes a memory configured to store a computer program; and a processor configured to execute the computer program to perform the aforementioned method for upgrading and signing firmware.
[0006] In another aspect of the invention, a computer-readable medium is provided. This medium stores a computer program that is executed by a processor to implement the above-described method for upgrading signed firmware.
[0007] According to an embodiment of the present invention, a trusted operating system stores public key parameter information and digital signature algorithm type in secure storage. The trusted operating system calculates a message digest corresponding to the public key parameter information, encrypts the message digest, and writes the encrypted message digest into command line parameters. Subsequently, the signed firmware to be upgraded is verified based on the public key parameter information and digital signature algorithm type in secure storage, as well as the encrypted message digest in the command line parameters. Only after successful verification is the upgrade performed. This improves the security of public key information, and the encrypted message digest in the command line parameters serves as a communication credential with the trusted operating system, thereby effectively improving the security of signed firmware upgrades. Attached Figure Description
[0008] Figure 1 This is a flowchart of the steps of a method for upgrading signed firmware according to an embodiment of the present invention;
[0009] Figure 2 This is a flowchart illustrating a method for upgrading signed firmware according to an embodiment of the present invention;
[0010] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0011] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0012] In existing technologies, the public key information for verifying signed firmware is usually transmitted in an untrusted environment, which cannot guarantee the security of signed firmware upgrades.
[0013] To address at least the aforementioned technical problems, this disclosure provides a method for upgrading signed firmware. According to this disclosure, a trusted operating system stores public key parameter information and digital signature algorithm type in secure storage. The trusted operating system calculates a message digest corresponding to the public key parameter information, encrypts the message digest, and writes the encrypted message digest into command-line parameters. Subsequently, the signed firmware to be upgraded is verified based on the public key parameter information and digital signature algorithm type in secure storage, as well as the encrypted message digest in the command-line parameters. Upgrading only proceeds upon successful verification. The encrypted message digest in the command-line parameters serves as a communication credential with the trusted operating system. In this manner, embodiments of this disclosure improve the security of public key information, thereby effectively enhancing the security of signed firmware upgrades.
[0014] In the following, the technical solutions according to this disclosure will be described with reference to specific embodiments and in conjunction with the accompanying drawings.
[0015] Figure 1This is a flowchart illustrating a method 100 for upgrading signed firmware according to an embodiment of the present disclosure. (Refer to...) Figure 1 The method 100 includes the following steps 102 to 110.
[0016] In step 102, the public key parameter information and digital signature algorithm type are obtained from the bootloader firmware in the signed firmware to be upgraded. In some embodiments, the device securely boots, loads and verifies the corresponding signed firmware to be upgraded from the boot storage medium (such as eMMC, embedded Multi Media Card), and after securely booting the bootloader and trusted operating system, the bootloader reads the public key parameter information and digital signature algorithm type contained in the bootloader firmware in the signed firmware to be upgraded.
[0017] In some embodiments, the method 100 may further include: signing the firmware to be upgraded to obtain a signed firmware to be upgraded; writing public key parameter information and digital signature algorithm type into a preset location of the bootloader firmware in the signed firmware to be upgraded; and storing the signed firmware to be upgraded into a firmware upgrade package. In this way, it is ensured that firmware signature information can be obtained through the bootloader firmware.
[0018] In some embodiments, the method 100 may further include: generating a first instruction by the bootloader based on the digital signature algorithm type and the public key parameters, and sending the first instruction to a static trusted application (static TA) in the trusted operating system.
[0019] In step 104, the trusted operating system saves the public key parameter information and digital signature algorithm type to secure storage. The trusted operating system calculates a message digest corresponding to the public key parameter information and encrypts the message digest. In some embodiments, a static trusted application in the trusted operating system receives a first instruction and obtains the public key parameter information and digital signature algorithm type based on the first instruction; the static trusted application saves the public key parameter information and digital signature algorithm type to secure storage. In some embodiments, the static trusted application calculates a message digest corresponding to the public key parameter information using a preset message digest algorithm; and the static trusted application encrypts the calculated message digest using a preset symmetric encryption algorithm and a key. In some embodiments, the preset message digest algorithm is the SHA256 algorithm. In some embodiments, if the storage medium is eMMC, the secure storage is the RPMB (Replay Protected Memory Block) area of the eMMC. In this way, the public key information in secure storage can only be accessed by a trusted secure operating system, and non-secure operating systems (i.e., general-purpose operating systems, such as Android) cannot directly access the secure storage, thereby improving the security of the public key information.
[0020] In step 106, the encrypted message digest is written to the command-line parameters. In some embodiments, the bootloader can write the circuit breaker flag and the encrypted message digest to the command-line parameters. In some embodiments, the bootloader can also write the circuit breaker flag (such as fuse.programmed) and the system flag (such as androidboot.slot_suffix) together with the encrypted message digest to the command-line parameters. In this way, it is convenient for subsequent client applications to use the encrypted message digest in the command-line parameters as a communication credential with the static trusted application, so that the static trusted application can authenticate the client application and ensure that the communication is secure and legitimate.
[0021] In some embodiments, the method 100 may further include: determining whether verification is required based on the system flag (e.g., androidboot.slot_suffix in / proc / cmdline) and the fuse flag (e.g., fuse.programmed in / proc / cmdline) in the command-line parameters. In some embodiments, it is determined whether the system flag indicates that the device is a dual-system device; if so, it is determined whether the fuse flag indicates that the device is fuse-broken; if the device is fuse-broken, it is determined that verification is required; and if the device is not fuse-broken, it is determined that verification is not required, and the method further includes directly upgrading the signed firmware to be upgraded. In some embodiments, it is determined whether the system flag indicates that the device is a single-system device; if so, it is determined whether the fuse flag indicates that the device is fuse-broken; if the device is fuse-broken, it is determined that verification is required; and if the device is not fuse-broken, it is determined that verification is not required, and the method further includes directly upgrading the signed firmware to be upgraded. In some embodiments, the single-system device is a non-A / B system, i.e., it has one set of firmware, and the dual-system device is an A / B system, i.e., it has two sets of firmware. In this way, A / B systems can be upgraded directly without entering upgrade mode, while non-A / B systems need to enter upgrade mode before upgrading. The corresponding firmware verification process is executed according to the fuse flag, which improves verification efficiency.
[0022] In step 108, the signed firmware to be upgraded is verified based on the public key parameter information and digital signature algorithm type in the secure storage and the encrypted message digest in the command line parameters. In some embodiments, the static trusted application receives a second instruction and obtains the encrypted message digest based on the second instruction; the static trusted application decrypts the encrypted message digest to obtain a decrypted message digest; the static trusted application reads the public key parameter information from the secure storage and calculates a verification message digest corresponding to the read public key parameter information; the static trusted application determines whether the decrypted message digest is consistent with the verification message digest; if consistent, the upgrade program client obtains the public key parameter information and the digital signature algorithm type; and the upgrade program client uses the obtained public key parameter information and the digital signature algorithm type to verify the signed firmware to be upgraded.
[0023] In some embodiments, a client application corresponding to the static trusted application generates a second instruction based on the encrypted message digest in the command-line parameters and sends the second instruction to the static trusted application in the trusted operating system; the static trusted application decrypts the encrypted message digest in the second instruction to obtain a decrypted message digest; the static trusted application reads the public key parameter information from the secure storage and calculates a verification message digest corresponding to the read public key parameter information; the static trusted application determines whether the decrypted message digest and the verification message digest are consistent; if they are inconsistent, the verification result is determined to be a failure, and the upgrade program client determines whether to exit the upgrade process based on the circuit breaker flag; if they are consistent, the static trusted application sends the public key parameter information and the digital signature algorithm type from the secure storage to the client application; the client application then processes the public key parameter... The information and the digital signature algorithm type are encrypted to obtain encrypted public key parameter information and digital signature algorithm type; the client application stores the encrypted public key parameter information and digital signature algorithm type in the first location of the boot communication partition; the upgrade program client reads the encrypted public key parameter information and digital signature algorithm type from the first location of the boot communication partition and decrypts the encrypted public key parameter information and digital signature algorithm type to obtain decrypted public key parameter information and digital signature algorithm type; the upgrade program client sequentially selects the firmware to be verified from the firmware upgrade package and writes the binary file of the firmware to be verified into memory or a read / write file system partition; the upgrade program client uses the decrypted public key parameter information and digital signature algorithm type to verify the firmware to be verified; if the verification fails, a circuit breaker flag is used to determine whether to exit the upgrade process; and if the verification succeeds, the verification result is determined to be successful.
[0024] In some embodiments, it is determined whether the fuse mark indicates that the device has been fused; if it indicates that the device has been fused, the upgrade process is exited; if it indicates that the device has not been fused, a risk warning is output, and user feedback corresponding to the risk warning is obtained; if the user feedback is to continue the upgrade, the signed firmware to be upgraded is upgraded; if the user feedback is not to continue the upgrade, the upgrade process is exited. This method solves the problem of the device failing to boot after being fused and upgraded with unsigned or incorrectly signed firmware. Simultaneously, even when the device has not been fused, it supports upgrading legitimate upgrade packages that are unsigned or incorrectly signed, improving the development and debugging efficiency before the device leaves the factory.
[0025] In step 110, if the verification result is successful, the signed firmware to be upgraded is upgraded. In some embodiments, if the system flag in the command line parameters indicates that the device is a dual-system device, the signed firmware to be upgraded undergoes a normal dual-system upgrade process, and after the upgrade is completed, garbled characters are written to the first location of the boot communication partition; if the system flag in the command line parameters indicates that the device is a single-system device, the device is guided into firmware upgrade mode for upgrade. In this way, the insecure operating system needs to interact with a specific CA (client application) and the corresponding TA in a trusted secure environment to obtain the content stored in secure storage. The CA (i.e., the insecure environment) obtains the key from the TA (i.e., the secure environment), writes garbled characters to erase it after use in the insecure environment, and does not permanently store it in the insecure environment. Before each upgrade, the CA obtains the message digest information of the encrypted public key from the command line parameters as a communication credential with the TA, so that the TA can authenticate the CA and ensure that the communication is secure and legitimate, thereby improving the security of signed firmware upgrades.
[0026] The following will describe, through examples, the application scenarios of the signature firmware upgrade method and device according to embodiments of the present invention.
[0027] Figure 2 This is a flowchart illustrating a method for upgrading signed firmware according to an embodiment of the present invention, including steps 201 to 230.
[0028] In step 201, the firmware to be upgraded is signed, and the signed firmware to be upgraded is placed into the firmware upgrade package. When signing the bootloader firmware, the public key parameter information and digital signature algorithm type are written into the preset location of the bootloader firmware.
[0029] In step 202, the device securely boots, loading and verifying the corresponding firmware step by step from the boot storage medium (such as eMMC). After the secure bootloader and trusted operating system are securely booted, the bootloader reads the digital signature algorithm type and public key parameters from the bootloader firmware, and generates instruction 1 using the digital signature algorithm type and public key parameters as input parameters.
[0030] In step 203, instruction 1 is sent to a static TA in the trusted operating system.
[0031] In step 204, after receiving instruction 1, the static TA in the trusted operating system obtains the digital signature algorithm type and public key parameters, calculates the message digest corresponding to the public key parameter information using a preset message digest algorithm, and encrypts the calculated message digest using a preset symmetric encryption algorithm and key.
[0032] In step 205, the static TA saves the digital signature algorithm type and public key parameters to secure storage and returns the encrypted message digest to the bootstrap program.
[0033] In step 206, the bootloader writes the returned encrypted message digest to the command-line parameters, and also writes the circuit breaker flag and system flag to the command-line parameters.
[0034] In step 207, the bootloader is started to verify the boot firmware (such as boot) in the storage medium to be booted. After the verification is successful, the boot firmware is booted.
[0035] In step 208, the CA (client application) corresponding to the static TA and the firmware upgrade program client are started.
[0036] In step 209, when the upgrade program client detects that a new firmware version needs to be upgraded, it extracts the circuit breaker flag and system flag from the command line parameters.
[0037] In step 210, determine whether the system flag is an A / B system. If it is, proceed to step 211; otherwise, proceed to step 213. For example, if androidboot.slot_suffix in / proc / cmdline is _a or _b, it indicates an A / B system; if it is empty, it indicates a non-A / B system.
[0038] In step 211, determine whether the fuse mark indicates that the device has blown. If yes, proceed to step 213; otherwise, proceed to step 212.
[0039] In step 212, the normal A / B system upgrade process is performed.
[0040] In step 213, the upgrade program client obtains the complete firmware upgrade package, checks the legality of the firmware upgrade package, and executes step 214 after the check is confirmed to be legal.
[0041] In step 214, the upgrade program client sends a public key parameter information retrieval instruction to the CA.
[0042] In step 215, the CA obtains the encrypted message digest from the command line parameters, uses the encrypted message digest as input to generate instruction 2, and sends instruction 2 to the corresponding TA in the trusted operating system.
[0043] In step 216, TA uses a preset symmetric encryption algorithm and key to decrypt the encrypted message digest in instruction 2 to obtain message digest 1, and reads the public key parameter information from secure storage, and uses a preset message digest algorithm to calculate the message digest corresponding to the public key parameter information to obtain message digest 2.
[0044] In step 217, it is determined whether message digest 1 and message digest 2 are consistent. If they are, step 220 is executed; otherwise, steps 218 to 219 are executed.
[0045] In step 218, an error message is returned to the CA, and the CA returns the error message to the upgrade program client.
[0046] In step 219, the upgrade program client determines whether the fuse flag indicates that the device has blown. If so, it prompts the user to exit the upgrade process. If not, it outputs a risk warning and obtains user feedback corresponding to the risk warning. If the user feedback is to continue the upgrade, step 224 is executed. If the user feedback is not to continue the upgrade, the upgrade process is exited.
[0047] In step 220, the digital signature algorithm type and public key parameter information are read from the secure storage and returned to the CA. The CA uses a preset symmetric encryption algorithm and key to encrypt the digital signature algorithm type and public key parameter information obtained from the TA to obtain ciphertext, and stores the ciphertext in location 1 of the boot communication partition, and returns a success message to the upgrade program client.
[0048] In step 221, the upgrade program client reads the ciphertext from location 1 of the boot communication partition, decrypts the ciphertext using a preset symmetric encryption algorithm and key, and obtains the digital signature algorithm type and public key parameter information. Then, it sequentially extracts the firmware to be verified from the firmware upgrade package and writes the binary file of the firmware to be verified into memory or a read / write file system partition.
[0049] In step 222, the obtained digital signature algorithm type and public key parameter information are used to verify the firmware to be verified.
[0050] In step 223, determine whether all firmware to be verified in the firmware upgrade package has passed verification. If yes, proceed to step 224; otherwise, proceed to step 219.
[0051] In step 224, determine whether the system tag is an A / B system. If it is, use the verified firmware upgrade package to perform the normal A / B system upgrade process, and write the garbled characters to position 1 of the boot communication partition after the upgrade is completed to overwrite the ciphertext storing the digital signature algorithm type and public key parameter information. If not, proceed to step 225.
[0052] In step 225, the device is guided into firmware upgrade mode (such as recovery) to perform the upgrade.
[0053] In step 226, the device securely boots, loading and verifying the corresponding firmware step by step from the boot storage medium. After the secure bootloader starts, it writes the fuse flag to the command-line parameters, then verifies the upgrade mode firmware (such as recovery) in the storage medium to be booted. If the verification passes, it boots the upgrade mode firmware.
[0054] In step 227, in firmware upgrade mode, read the fuse flag in the command line parameters and determine whether the fuse flag indicates that the device is fused. If not, execute the firmware upgrade process to complete the device firmware upgrade and write the garbled characters to position 1 of the boot communication partition after the upgrade is completed. If yes, execute step 228.
[0055] In step 228, the ciphertext is read from position 1 of the boot communication partition, and decrypted using a preset symmetric encryption algorithm and key to obtain the digital signature algorithm type and public key parameter information. Finally, the firmware to be verified is extracted sequentially from the firmware upgrade package, and the binary file of the firmware to be verified is written to memory or a read / write file system partition.
[0056] In step 229, the obtained digital signature algorithm type and public key parameter information are used to verify the firmware to be verified.
[0057] In step 230, it is determined whether all firmware to be verified in the firmware upgrade package has passed verification. If so, the firmware upgrade process is executed to complete the device firmware upgrade, and the garbled characters are written to position 1 of the boot communication partition after the upgrade is completed. If not, the user is prompted that the verification has failed and the upgrade process is exited.
[0058] The method for upgrading signed firmware of the present invention is more suitable for upgrading larger firmware.
[0059] According to another aspect of the invention, Figure 3 This is a schematic diagram illustrating a device 300 for upgrading signed firmware according to an embodiment of the present invention. (Refer to...) Figure 3 The electronic device 300 includes a memory 302, a processor 304, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the method for upgrading signed firmware as described above.
[0060] According to another aspect of the present invention, a computer-readable medium is provided. The computer-readable medium stores a computer program that is executed by a processor to implement the method for upgrading signed firmware as described above.
[0061] In summary, the signature firmware upgrade method, electronic device, and storage medium provided by this invention obtain public key parameter information and digital signature algorithm type from the bootloader firmware in the signed firmware to be upgraded; a trusted operating system saves the public key parameter information and digital signature algorithm type to secure storage; the trusted operating system calculates a message digest corresponding to the public key parameter information; the message digest is encrypted and written into command line parameters; the signed firmware to be upgraded is verified based on the public key parameter information and digital signature algorithm type in the secure storage and the encrypted message digest in the command line parameters; and if the verification result is successful, the signed firmware to be upgraded is upgraded. This solves the problem of the device failing to boot after a circuit breaker is triggered by upgrading unsigned or incorrectly signed firmware. Furthermore, even without a circuit breaker, it supports upgrading legitimate upgrade packages that are unsigned or incorrectly signed, improving the development and debugging efficiency before the device leaves the factory. It also enhances the security of public key information and uses the encrypted message digest in the command line parameters as a communication credential with the trusted operating system, thereby effectively improving the security of signature firmware upgrades.
[0062] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for upgrading signed firmware, characterized in that, include: Obtain the public key parameter information and digital signature algorithm type from the bootloader firmware in the signed firmware to be upgraded; The trusted operating system saves the public key parameter information and the digital signature algorithm type to secure storage, which is the replay protection memory block (RPMB) area of the embedded multimedia card (eMMC). The static trusted application in the trusted operating system calculates a message digest corresponding to the public key parameter information using a preset message digest algorithm, and the static trusted application encrypts the calculated message digest using a preset symmetric encryption algorithm and a key. Write the encrypted message digest to the command-line parameters; The signed firmware to be upgraded is verified based on the public key parameter information in the secure storage, the digital signature algorithm type, and the encrypted message digest in the command line parameters. as well as If the verification result is successful, the signed firmware to be upgraded will be upgraded.
2. The method according to claim 1, characterized in that, The public key parameter information and digital signature algorithm type can be obtained from the bootloader firmware in the signed firmware to be upgraded, including: After the secure bootloader and the trusted operating system are started, the bootloader reads the public key parameter information and digital signature algorithm type contained in the bootloader firmware to be upgraded, which is included in the signed firmware.
3. The method according to claim 2, characterized in that, Also includes: The bootloader generates a first instruction based on the digital signature algorithm type and the public key parameters, and sends the first instruction to the static trusted application in the trusted operating system.
4. The method according to claim 3, characterized in that, The trusted operating system saves the public key parameter information and the digital signature algorithm type to secure storage, including: A first instruction is received by a statically trusted application in a trusted operating system, and the public key parameter information and the digital signature algorithm type are obtained based on the first instruction; and The static trusted application saves the public key parameter information and the digital signature algorithm type to the secure storage.
5. The method according to claim 4, characterized in that, Verification of the signed firmware to be upgraded based on the public key parameter information in the secure storage, the digital signature algorithm type, and the encrypted message digest in the command line parameters includes: The static trusted application receives the second instruction and obtains the encrypted message digest based on the second instruction; The encrypted message digest is decrypted by the static trusted application to obtain the decrypted message digest. The static trusted application reads the public key parameter information from the secure storage and calculates a verification message digest corresponding to the read public key parameter information; The static trusted application determines whether the decrypted message digest is consistent with the verification message digest. If they match, the upgrade program client obtains the public key parameter information and the digital signature algorithm type; and The upgrade program client uses the obtained public key parameter information and the digital signature algorithm type to verify the signed firmware to be upgraded.
6. The method according to claim 1, characterized in that, Also includes: The bootloader writes the circuit breaker flag and system flag, along with the encrypted message digest, into the command-line parameters.
7. The method according to claim 6, characterized in that, Also includes: Whether verification is required is determined based on the system flag and the circuit breaker flag in the command-line parameters.
8. The method according to claim 7, characterized in that, Determining whether verification is required based on the system flag and the circuit breaker flag in the command-line parameters includes: Determine whether the system flag indicates that the device is a dual-system device; If so, determine whether the fuse mark indicates that the device has blown; If the device indicates a blown fuse, then verification is required; and If the device is not found to be faulty, then it is determined that no verification is required, and the method also includes directly upgrading the signed firmware to be upgraded.
9. The method according to claim 7, characterized in that, Determining whether verification is required based on the system flag and the circuit breaker flag in the command-line parameters includes: Determine whether the system flag indicates that the device is a single system; If so, determine whether the fuse mark indicates that the device has blown; If the device indicates a blown fuse, then verification is required; and If the device is not found to be faulty, then it is determined that no verification is required, and the method also includes directly upgrading the signed firmware to be upgraded.
10. The method according to claim 4, characterized in that, Verification of the signed firmware to be upgraded based on the public key parameter information in the secure storage, the digital signature algorithm type, and the encrypted message digest in the command line parameters includes: The client application corresponding to the static trusted application generates a second instruction based on the encrypted message digest in the command line parameters, and sends the second instruction to the static trusted application in the trusted operating system; The static trusted application decrypts the encrypted message digest in the second instruction to obtain the decrypted message digest. The static trusted application reads the public key parameter information from the secure storage and calculates a verification message digest corresponding to the read public key parameter information; The static trusted application determines whether the decrypted message digest and the verification message digest are consistent. If there is a discrepancy, the result of the verification is determined to be a failure, and the upgrade program client determines whether to exit the upgrade process based on the circuit breaker flag. If they match, the static trusted application will send the public key parameter information and the digital signature algorithm type from the secure storage to the client application. The client application encrypts the public key parameter information and the digital signature algorithm type to obtain the encrypted public key parameter information and digital signature algorithm type. The client application stores the encrypted public key parameter information and digital signature algorithm type in the first location of the boot communication partition; The upgrade program client reads the encrypted public key parameter information and digital signature algorithm type from the first position of the boot communication partition, and decrypts the encrypted public key parameter information and digital signature algorithm type to obtain the decrypted public key parameter information and digital signature algorithm type; The upgrade program client selects the firmware to be verified sequentially from the firmware upgrade packages in the upgrade program client, and writes the binary file of the firmware to be verified into memory or a read / write file system partition; The upgrade program client uses the decrypted public key parameter information and digital signature algorithm type to verify the firmware to be verified; If verification fails, the decision to exit the upgrade process is based on the circuit breaker flag; and If the verification is successful, the result of the verification is determined to be successful.
11. The method according to claim 10, characterized in that, Determining whether to exit the upgrade process based on the circuit breaker flag includes: Determine whether the fuse mark indicates that the device has blown; If the device indicates a blown fuse, the upgrade process will be terminated. If the device is not found to have blown, a risk warning is output and user feedback corresponding to the risk warning is obtained. If the user feedback indicates a desire to continue upgrading, then the signed firmware to be upgraded will be upgraded. If the user feedback indicates they do not wish to continue the upgrade, then the upgrade process will be terminated.
12. The method according to claim 6, characterized in that, Upgrading the signed firmware to be upgraded includes: If the system flag in the command line parameters indicates that the device is a dual system, then the normal dual system upgrade process is performed on the signed firmware to be upgraded, and after the upgrade is completed, the garbled characters are written to the first position of the boot communication partition. If the system flag in the command-line parameters indicates that the device is a single system, then the device is guided into firmware upgrade mode for upgrade.
13. The method according to claim 1, characterized in that, Also includes: Sign the firmware to be upgraded to obtain the signed firmware to be upgraded. Write the public key parameter information and the digital signature algorithm type into the preset location of the bootloader firmware in the signed firmware to be upgraded; as well as The signed firmware to be upgraded is stored in the firmware upgrade package.
14. An electronic device, characterized in that, include: Memory, configured to store computer programs; as well as A processor is configured to execute the computer program to perform the method according to any one of claims 1 to 13.
15. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program is executed to implement the method according to any one of claims 1 to 13.