Method, electronic device and storage medium for upgrading signed firmware

CN115828255BActive Publication Date: 2026-08-07FUZHOU ROCKCHIP SEMICON
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FUZHOU ROCKCHIP SEMICON
Filing Date
2022-11-01
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

这类方法通常复杂性较高,同时在某些情况下,设备启动引导程序和系统之间无法有效传递这种公钥信息,例如没有额外的软硬资源的情况下

Benefits of technology

[0007]根据本发明,将公钥参数信息、数字签名算法类型和消息摘要算法类型保存在启动引导程序固件中,在对固件校验之前,对公钥参数信息进行了三次验证,并将数字摘要、消息摘要算法类型和数字签名算法类型写入命令行参数,实现了公钥参数信息合法性和正确性的多重验证,在确保了公钥信息本身是合法正确的前提下再对待升级固件进行校验,且无需依赖启动引导程序传递公钥参数,既解决了升级没签名或者错误签名的固件导致升级后设备无法启动问题,也解决了设备启动引导程序和系统之间没有额外的软硬资源而无法有效传递公钥信息的问题,从而提高了签名固件升级的可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115828255B_ABST
    Figure CN115828255B_ABST
Patent Text Reader

Abstract

The application discloses a method for upgrading signed firmware, an electronic device and a storage medium, wherein public key parameter information, a digital signature algorithm type and a message digest algorithm type are stored in a startup boot program firmware, the public key parameter information is verified three times before the firmware is checked, and the digital digest, the message digest algorithm type and the digital signature algorithm type are written into a command line parameter, so that multiple verifications of the legality and correctness of the public key parameter information are realized, the firmware to be upgraded is checked on the premise that the public key information itself is legal and correct, and the public key parameter does not need to be transmitted by the startup boot program, which not only solves the problem that the device cannot be started after the firmware with no signature or with an error signature is upgraded, but also solves the problem that the public key information cannot be effectively transmitted due to the lack of additional software and hardware resources between the device startup boot program and the system, thereby improving the reliability of the signed firmware upgrade.
Need to check novelty before this filing date? Find Prior Art

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] Devices supporting Secure Boot require firmware signing. The signature information in the firmware is stored as an integral part of the firmware in the device's storage medium and is verified step by step during device startup. The firmware to be upgraded must be a complete signed firmware containing the signature information. Existing firmware upgrade schemes for Secure Boot devices mainly fall into two categories: (1) direct upgrade, regardless of whether the firmware is signed or not. This type of scheme requires the user to ensure that the firmware itself is correctly signed; (2) special processing for signed firmware. This type of scheme requires the device itself to provide a mechanism, such as a device tree, so that the public key information corresponding to the signed firmware can be securely transferred from the bootloader to the system, thereby enabling the firmware upgrade program to be used. These methods are usually quite complex, and in some cases, the bootloader and the system cannot effectively transfer this public key information, such as when there are no additional hardware or software resources. Summary of the Invention

[0003] This invention provides a method, electronic device, and storage medium for upgrading signed firmware, which can improve the reliability of signed firmware upgrades.

[0004] In one aspect of the present invention, a method for upgrading signed firmware is provided. The method includes the steps of: obtaining public key parameter information, a digital signature algorithm type, and a message digest algorithm type from the bootloader firmware in the signed firmware to be upgraded; calculating a digital digest corresponding to the public key parameter information based on the message digest algorithm type; performing a first verification on the public key parameter information based on the digital digest and a pre-stored digital digest; if the first verification passes, writing the digital digest, the message digest algorithm type, and the digital signature algorithm type into command-line parameters; performing a second verification on the public key parameter information based on the command-line parameters and the pre-stored digital digest; if the second verification passes, performing a third verification on the public key parameter information based on the bootloader firmware and the command-line parameters; and if the third verification passes, obtaining a system marker and upgrading the signed firmware to be upgraded based on the system marker.

[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 this invention, the public key parameter information, digital signature algorithm type, and message digest algorithm type are stored in the bootloader firmware. Before firmware verification, the public key parameter information is verified three times, and the digital digest, message digest algorithm type, and digital signature algorithm type are written into the command line parameters. This achieves multiple verifications of the legality and correctness of the public key parameter information. Verification of the firmware to be upgraded is performed only after ensuring that the public key information itself is legal and correct. Furthermore, it does not rely on the bootloader to transmit the public key parameters. This solves the problem of the device failing to boot after upgrading due to unsigned or incorrectly signed firmware, and also solves the problem of the inability to effectively transmit public key information between the device bootloader and the system due to the lack of additional hardware and software resources. This improves the reliability 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, firmware upgrade solutions for secure boot devices are either direct upgrades that do not distinguish whether the firmware is signed or not, requiring users to ensure that the firmware itself is correctly signed; or special processing is performed on signed firmware, requiring the device itself to provide a mechanism, such as a device tree, so that the public key information corresponding to the signed firmware can be securely transferred from the bootloader to the system, which relies on device trees and related technical facilities.

[0013] To address at least the aforementioned technical problems, this disclosure provides a method for upgrading signed firmware. According to this disclosure, public key parameter information, digital signature algorithm type, and message digest algorithm type are stored in the bootloader firmware. Before firmware verification, the public key parameter information is verified three times, and the digital digest, message digest algorithm type, and digital signature algorithm type are written into command-line parameters. In this manner, embodiments of this disclosure enable multi-level verification of the legality and correctness of the public key parameter information. Verification of the firmware to be upgraded is performed only after ensuring the public key information itself is legal and correct, and it does not rely on the bootloader to transmit the public key parameters. This solves the problem of devices failing to boot after upgrading unsigned or incorrectly signed firmware, and also addresses the issue of insufficient hardware and software resources between the device bootloader and the system to effectively transmit public key information, thereby improving the reliability 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 1 This 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 108.

[0016] In step 102, the public key parameter information, digital signature algorithm type, and message digest algorithm type are obtained from the bootloader firmware in the signed firmware to be upgraded, and a digital digest corresponding to the public key parameter information is calculated according to the message digest algorithm type. In some embodiments, the device starts up and loads and verifies the corresponding signed firmware to be upgraded from the boot storage medium (such as eMMC, embedded Multi Media Card) level by level. When the verification is successful, the corresponding signed firmware to be upgraded is executed. When the bootloader firmware is successfully verified and booted, the public key parameter information, digital signature algorithm type, and message digest algorithm type are obtained from the bootloader firmware in the signed firmware to be upgraded, and a digital digest corresponding to the public key parameter information is calculated according to the message digest algorithm type.

[0017] In some embodiments, before obtaining the public key parameter information, digital signature algorithm type, and message digest algorithm type from the bootloader firmware in the signed firmware to be upgraded, the method further includes: signing the firmware to be upgraded to obtain the signed firmware to be upgraded; writing the public key parameter information, the digital signature algorithm type, and the message digest algorithm type into a preset location in the bootloader firmware of the signed firmware to be upgraded; and storing the signed firmware to be upgraded into a firmware upgrade package. This ensures that firmware signature information can be obtained through the bootloader firmware.

[0018] In step 104, the public key parameter information is verified for the first time based on the digital digest and the pre-stored digital digest. If the first verification passes, the digital digest, the message digest algorithm type, and the digital signature algorithm type are written into the command-line parameters. In some embodiments, the calculated digital digest is compared with the pre-stored digital digest stored in the device; if the comparison result is consistent, the first verification result is determined to be successful; and if the comparison result is inconsistent, the upgrade process is exited, and the first verification result is determined to be unsuccessful. In some embodiments, the pre-stored digital digest is the digital digest corresponding to the public key parameter information stored in the OTP (One-Time Programmable) or efuse (one-time programmable memory) of the device SoC chip. In this way, the security and validity of the public key parameter information in the bootloader firmware are ensured.

[0019] In step 106, the public key parameter information is verified a second time based on the command-line parameters and the pre-stored digital digest. If the second verification passes, the public key parameter information is verified a third time based on the bootloader firmware and the command-line parameters. In some embodiments, when a firmware upgrade is detected, the digital digest, message digest algorithm type, and digital signature algorithm type in the command-line parameters are read, and the pre-stored digital digest stored in the device is read; the digital digest in the command-line parameters is compared with the pre-stored digital digest; if the comparison result is consistent, the second verification result is determined to be successful; and if the comparison result is inconsistent, the upgrade process is exited, and the second verification result is determined to be unsuccessful. In this way, the accuracy and security of the public key parameter information written in the command-line parameters are ensured.

[0020] In some embodiments, the bootloader firmware is read to obtain public key parameter information, digital signature algorithm type, and message digest algorithm type from the bootloader firmware. The digital signature algorithm type and message digest algorithm type from the bootloader firmware are compared with the digital signature algorithm type and message digest algorithm type from the command-line parameters. If the comparison result is consistent, the bootloader firmware is signed using the digital signature algorithm type and public key parameter information from the bootloader firmware. If the verification result is successful, the third verification result is determined to be passed; if the verification result is failed, the upgrade process is exited, and the third verification result is determined to be failed. Furthermore, if the comparison result is inconsistent, the upgrade process is exited, and the third verification result is determined to be failed. In this way, by comparing the bootloader firmware with the public key information in the command-line parameters, multiple verifications of the public key information are achieved, improving the security and reliability of the public key information.

[0021] In some embodiments, if the comparison results are consistent, a digital digest corresponding to the public key parameter information in the bootloader firmware is calculated according to the message digest algorithm type, and the digital digest in the read command line parameters is compared with the calculated digital digest. If the comparison results are consistent, the bootloader firmware is signed and verified using the digital signature algorithm type and the public key parameter information in the bootloader firmware. If the verification result is successful, the result of the third verification is determined to be passed. If the verification result is failed, the upgrade process is exited, and the result of the third verification is determined to be failed. If the comparison results are inconsistent, the upgrade process is exited; and if the comparison results are inconsistent, the upgrade process is exited, and the result of the third verification is determined to be failed.

[0022] In step 108, if the third verification passes, a system marker is obtained, and the signed firmware to be upgraded is upgraded based on the system marker. In some embodiments, if the system marker is a dual-system marker, the address of the new firmware version in the firmware upgrade server is determined, and the address is passed to the dual-system firmware upgrade engine; the dual-system streaming firmware upgrade process is started to complete the dual-system upgrade; the current data slot of the dual system is determined, and the other data slot corresponding to the current data slot is determined as the data slot to be upgraded, and the binary data of each signed firmware to be upgraded (such as uboot, trust) in the data slot to be upgraded is read sequentially; the binary data of the signed firmware to be upgraded is verified using the digital signature algorithm type and the public key parameter information in the bootloader firmware; if each verification result is successful, the dual-system upgrade is set to successful; and if any verification result is unsuccessful, the upgrade process is exited. In some embodiments, if the system is marked as a single system, the firmware upgrade package is obtained; it is determined whether the firmware upgrade package contains a bootloader firmware with public key parameter information. If it does not exist, the device is guided into firmware upgrade mode (such as recovery) for upgrade. If it exists, the bootloader firmware containing public key parameter information is extracted to memory or a read / write file system partition, and the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware of the firmware upgrade package are compared with the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware of the signed firmware to be upgraded. If the comparison result is consistent, the verification result is determined to be successful, and the device is guided into firmware upgrade mode for upgrade. If the comparison result is inconsistent, the verification result is determined to be unsuccessful, and the upgrade process is exited. In some embodiments, the single system is marked as a non-A / B system, and the dual system is marked as an A / B system. This approach facilitates the verification of all signed firmware in the slot to be upgraded after the A / B system upgrade is completed, thereby enabling seamless integration with the A / B system streaming upgrade and improving firmware upgrade efficiency.

[0023] In some embodiments, the device is booted into firmware upgrade mode, and public key parameter information, digital signature algorithm type, and message digest algorithm type are read from the bootloader firmware. The digital digest calculated based on the message digest algorithm type is compared with a pre-stored digital digest in the device. The digital digest read from the command line parameters is compared with the pre-stored digital digest in the device. The digital signature algorithm type and message digest algorithm type read from the bootloader firmware are compared with the digital signature algorithm type and message digest algorithm type read from the command line parameters. Based on the message digest algorithm type read from the bootloader firmware, a digital digest corresponding to the public key parameter information read from the bootloader firmware is calculated, and the calculated digital digest is compared with the digital digest read from the command line parameters. If the result of each comparison is consistent, a firmware upgrade is performed.

[0024] The following will describe, through examples, the application scenarios of the method and device for upgrading signed firmware according to embodiments of the present invention.

[0025] Figure 2 This is a flowchart illustrating a method for upgrading signed firmware according to an embodiment of the present invention, including steps 202 to 229.

[0026] In step 201, the firmware to be upgraded is signed to obtain the signed firmware to be upgraded; the public key parameter information, digital signature algorithm type and message digest algorithm type are written into the preset location of the bootloader firmware in the signed firmware to be upgraded, and the signed firmware to be upgraded is stored in the firmware upgrade package.

[0027] In step 202, during device startup, the corresponding signed firmware to be upgraded is loaded and verified step by step from the boot storage medium (such as eMMC). Once verification is successful, the corresponding firmware is executed. After successful verification and booting of the bootloader firmware, the public key parameter information, digital signature algorithm type, and message digest algorithm type are obtained from the bootloader firmware. Then, a digital digest of the public key parameter information is calculated based on the message digest algorithm type and compared with the digital digest in the OTP or efuse in the device's SoC chip. If the comparison result is consistent, the digital digest, message digest algorithm type, and digital signature algorithm type are written to the command-line parameters.

[0028] In step 203, the bootloader verifies the boot firmware (such as boot) in the storage medium to be booted. If the verification is successful, the boot firmware is booted.

[0029] In step 204, when the device detects that a new version of firmware needs to be upgraded, it reads the digital digest, message digest algorithm type, digital signature algorithm type from the command line parameters, as well as the digital digest from the OTP or efuse in the device's SoC chip.

[0030] In step 205, determine whether the reading was successful. If yes, proceed to step 206; otherwise, proceed to step 207.

[0031] In step 206, it is determined whether the digital digest in the command line parameter is consistent with the digital digest in the OTP or efuse in the device SoC chip. If yes, step 207 is executed; otherwise, the upgrade process is exited.

[0032] In step 207, it is determined whether the digital signature algorithm type and message digest algorithm type in the bootloader firmware are completely consistent with the digital signature algorithm type and message digest algorithm type in the command line parameters. If yes, step 208 is executed; otherwise, the upgrade process is exited.

[0033] In step 208, the digital digest corresponding to the public key parameter information in the bootloader firmware is calculated according to the obtained message digest algorithm type, and it is determined whether the calculated digital digest is consistent with the digital digest in the read command line parameters. If yes, step 209 is executed; otherwise, the upgrade process is exited.

[0034] In step 209, the bootloader firmware is signed and verified using the digital signature algorithm type and public key parameter information in the bootloader firmware, and it is determined whether the verification is successful. If it is, step 210 is executed; otherwise, the upgrade process is exited.

[0035] In step 210, the A / B system tag is obtained, and it is determined whether the current system is an A / B system based on the A / B system tag. If it is, steps 211 to 215 are executed; otherwise, steps 216 to 217 are executed.

[0036] In step 211, the address of the new firmware version in the firmware upgrade server is determined and the address is passed to the A / B system firmware upgrade engine.

[0037] In step 212, the A / B system streaming firmware upgrade process is initiated to complete the A / B system upgrade.

[0038] In step 213, the current slot of the A / B system is determined, and the other slot corresponding to the current slot is determined as the slot to be upgraded. The binary data of the firmware to be upgraded after each signature in the slot to be upgraded is read in sequence. For example, if the A / B system includes slot a and slot b, and the current slot is slot a, then slot b is determined as the slot to be upgraded, and vice versa.

[0039] In step 214, the binary data of the signed firmware to be upgraded is verified using the digital signature algorithm type and public key parameter information in the bootloader firmware.

[0040] In step 215, determine whether each verification is successful. If yes, the A / B system upgrade is successful; otherwise, exit the upgrade process.

[0041] In step 216, it is determined whether there is a bootloader firmware containing public key parameter information in the firmware upgrade package. If not, step 218 is executed. If it exists, the bootloader firmware containing public key parameter information is extracted to memory or a read / write file system partition, and the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware in the firmware upgrade package are compared with the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware in the signed firmware to be upgraded.

[0042] In step 217, determine whether the comparison result is consistent. If yes, proceed to step 218; otherwise, exit the upgrade process.

[0043] In step 218, the device is guided into firmware upgrade mode for upgrade.

[0044] In step 219, during device startup, the corresponding signed firmware to be upgraded is loaded and verified step by step from the boot storage medium (such as eMMC). Once verification is successful, the corresponding firmware is executed. After successful verification and booting of the bootloader firmware, the public key parameter information, digital signature algorithm type, and message digest algorithm type are obtained from the bootloader firmware. Then, a digital digest of the public key parameter information is calculated based on the message digest algorithm type and compared with the digital digest in the OTP or efuse in the device's SoC chip. If the comparison result is consistent, the digital digest, message digest algorithm type, and digital signature algorithm type are written to the command-line parameters.

[0045] In step 220, the bootloader is started to verify the upgrade mode firmware (such as recovery) in the storage medium to be booted. After the verification is successful, the upgrade mode firmware is booted.

[0046] In step 221, in firmware upgrade mode, the digital digest, message digest algorithm type, digital signature algorithm type, and digital digest in the OTP or efuse in the command line parameters are read.

[0047] In step 222, determine whether the reading was successful. If yes, proceed to step 223; otherwise, proceed to step 224.

[0048] In step 223, it is determined whether the digital digest in the command line parameter is consistent with the digital digest in the OTP or efuse in the device SoC chip. If yes, step 224 is executed; otherwise, the upgrade process is exited.

[0049] In step 224, it is determined whether the digital signature algorithm type and message digest algorithm type in the bootloader firmware are completely consistent with the digital signature algorithm type and message digest algorithm type in the command line parameters. If yes, step 225 is executed; otherwise, the upgrade process is exited.

[0050] In step 225, the digital digest corresponding to the public key parameter information in the bootloader firmware is calculated according to the obtained message digest algorithm type, and it is determined whether the calculated digital digest is consistent with the digital digest in the read command line parameters. If yes, step 226 is executed; otherwise, the upgrade process is exited.

[0051] In step 226, it is determined whether there is a bootloader firmware containing public key parameter information in the firmware upgrade package. If not, step 228 is executed. If it exists, the bootloader firmware containing public key parameter information is extracted to memory or a read / write file system partition, and the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware in the firmware upgrade package are compared with the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware in the signed firmware to be upgraded.

[0052] In step 227, determine whether the comparison result is consistent. If yes, proceed to step 228; otherwise, exit the upgrade process.

[0053] In step 228, the binary data of the signed firmware to be upgraded is extracted sequentially from the firmware upgrade package into memory or a read / write file system partition, and the digital signature algorithm type and public key parameter information in the bootloader firmware are used to verify the binary data of the signed firmware to be upgraded.

[0054] In step 229, it is determined whether each verification is successful. If so, the firmware upgrade process is executed to complete the device firmware upgrade. If not, the upgrade process is exited.

[0055] According to another aspect of the invention, Figure 3 This is a schematic diagram illustrating an upgrade device 300 for 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 signature firmware upgrade method as described above.

[0056] 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 signature firmware upgrade method as described above.

[0057] In summary, the signature firmware upgrade method, electronic device, and storage medium provided by this invention store public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware. Before firmware verification, the public key parameter information is verified three times, and the digital digest, message digest algorithm type, and digital signature algorithm type are written into command line parameters. This achieves multiple verifications of the legality and correctness of the public key parameter information. Verification of the firmware to be upgraded is performed only after ensuring that the public key information itself is legal and correct. Furthermore, it does not rely on the bootloader to transmit public key parameters. This solves the problem of the device failing to boot after upgrading unsigned or incorrectly signed firmware, and also solves the problem of the inability to effectively transmit public key information between the device bootloader and the system due to the lack of additional hardware and software resources. In addition, by verifying all signature firmware of the slot to be upgraded after the A / B system upgrade is completed, it can be seamlessly integrated with the A / B system streaming upgrade, improving the efficiency of firmware upgrade and thus improving the reliability of signature firmware upgrade.

[0058] 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 public key parameter information, digital signature algorithm type, and message digest algorithm type from the bootloader firmware in the signed firmware to be upgraded, and calculate the digital digest corresponding to the public key parameter information according to the message digest algorithm type; The public key parameter information is verified for the first time based on the digital digest and the pre-stored digital digest. If the result of the first verification is successful, the digital digest, the message digest algorithm type and the digital signature algorithm type are written into the command line parameters. The public key parameter information is verified a second time based on the command line parameters and the pre-stored digital digest. If the result of the second verification is successful, the public key parameter information is verified a third time based on the bootloader firmware and the command line parameters. as well as If the third verification passes, a system tag is obtained, and the signed firmware to be upgraded is upgraded based on the system tag. The first verification of the public key parameter information based on the digital digest and the pre-stored digital digest includes: comparing the calculated digital digest with the pre-stored digital digest stored in the device; If the comparison results are consistent, the result of the first verification is determined to be successful; if the comparison results are inconsistent, the upgrade process is exited and the result of the first verification is determined to be unsuccessful.

2. The method according to claim 1, characterized in that, Before obtaining the public key parameter information, digital signature algorithm type, and message digest algorithm type from the bootloader firmware in the signed firmware to be upgraded, the process also includes: Sign the firmware to be upgraded to obtain the signed firmware to be upgraded. Write the public key parameter information, the digital signature algorithm type, and the message digest algorithm type into a preset location in the bootloader firmware of the signed firmware to be upgraded; and The signed firmware to be upgraded is stored in the firmware upgrade package.

3. The method according to claim 1, characterized in that, The second verification of the public key parameter information based on the command-line parameters and the pre-stored digital digest includes: When a firmware upgrade is detected, the digital digest, message digest algorithm type, and digital signature algorithm type in the command line parameters are read, and the pre-stored digital digest stored in the device is also read. Compare the digital digest in the command-line parameters with the pre-stored digital digest; If the comparison results are consistent, then the result of the second verification is determined to be a pass; and If the comparison results are inconsistent, the upgrade process is terminated, and the result of the second verification is determined to be unsuccessful.

4. The method according to claim 1, characterized in that, The third verification of the public key parameter information based on the bootloader firmware and the command-line parameters includes: Read the bootloader firmware to obtain the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware; The digital signature algorithm type and the message digest algorithm type in the bootloader firmware are compared with the digital signature algorithm type and the message digest algorithm type in the command line parameters; If the comparison results are consistent, the bootloader firmware is signed using the digital signature algorithm type and public key parameter information in the bootloader firmware. If the verification result is successful, the third verification result is determined to be passed; if the verification result is failed, the upgrade process is exited, and the third verification result is determined to be failed. If the comparison results are inconsistent, the upgrade process is terminated, and the result of the third verification is determined to be unsuccessful.

5. The method according to claim 1, characterized in that, Upgrading the signed firmware based on the system identifier includes: If the system is marked as a dual-system mark, then the address of the new firmware version in the firmware upgrade server is determined, and the address is passed to the dual-system firmware upgrade engine; Initiate the dual-system streaming firmware upgrade process and complete the dual-system upgrade; The current data slot of the dual system is determined, and the other data slot corresponding to the current data slot is determined as the data slot to be upgraded. The binary data of the firmware to be upgraded after each signature in the data slot to be upgraded is read in sequence. The digital signature algorithm type and public key parameter information in the bootloader firmware are used to verify the binary data of the signed firmware to be upgraded. If each of the aforementioned verifications results in success, then the dual-system upgrade is successful; and If any of the aforementioned verifications fails, the upgrade process will be terminated.

6. The method according to claim 1, characterized in that, Upgrading the signed firmware based on the system identifier includes: If the system is marked as a single system, then obtain the firmware upgrade package; Determine whether the firmware upgrade package contains a bootloader firmware with public key parameter information. If not, guide the device into firmware upgrade mode for upgrade. If it does, extract the bootloader firmware containing public key parameter information to memory or a read / write file system partition, and compare the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware of the firmware upgrade package with the public key parameter information, digital signature algorithm type, and message digest algorithm type in the bootloader firmware of the signed firmware to be upgraded. If the comparison results are consistent, the comparison is considered successful, and the device is guided into firmware upgrade mode for upgrade; and If the comparison results are inconsistent, the comparison is determined to be a failure, and the upgrade process is terminated.

7. The method according to claim 6, characterized in that, Upgrading the signed firmware based on the system identifier includes: The device is guided into firmware upgrade mode, and public key parameter information, digital signature algorithm type and message digest algorithm type are read from the bootloader firmware. The digital digest calculated according to the message digest algorithm type is compared with the pre-stored digital digest in the device. The digital digest read from the command-line parameters is compared with the pre-stored digital digest stored in the device; The digital signature algorithm type and message digest algorithm type read from the bootloader firmware are compared with the digital signature algorithm type and message digest algorithm type read from the command line parameters; Based on the message digest algorithm type read from the bootloader firmware, calculate a digital digest corresponding to the public key parameter information read from the bootloader firmware, and compare the calculated digital digest with the digital digest read from the command-line parameters; and If the results of each comparison are consistent, then a firmware upgrade is performed.

8. 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 7.

9. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Signature firmware upgrading method and device and computer readable medium

    CN114547620A