Safe starting method and device, electronic equipment and storage medium

By utilizing various keys in the bootloader firmware for security verification during the startup process of electronic devices, the problem of secure startup in existing technologies for devices that do not support TrustZone technology is solved, and a fast and reliable secure startup method is achieved. , suitable for many device types.

CN118734289APending Publication Date: 2024-10-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310320926.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-28
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing system secure boot methods rely on TrustZone technology and cannot meet the secure boot requirements of systems that do not support TrustZone technology. Moreover, keys are stored in eFUSE, which limits the number of keys and security verification efficiency.

Method used

During the startup process of the electronic device, the bootloading firmware is run, and a variety of keys are used to perform security verification on the firmware to be verified. If it passes, the firmware to be verified is run. The key is stored in the bootloading firmware to avoid Reading from other storage areas supports the storage and use of multiple keys.

Benefits of technology

It realizes fast and safe verification of firmware to be verified, and is suitable for devices that support and do not support TrustZone technology, reducing production costs and improving the efficiency and reliability of secure boot.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734289A_ABST
    Figure CN118734289A_ABST
Patent Text Reader

Abstract

The invention discloses a safe starting method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method is applied to the electronic equipment and comprises the steps that in the starting process of the electronic equipment, boot loading firmware is operated, and multiple secret keys in the boot loading firmware are used for conducting safety verification on firmware to be verified; and if the security verification is passed, running the to-be-verified firmware. Therefore, the secret key for security verification is stored in the boot loading firmware, so that when the boot loading firmware is operated, the secret key can be directly obtained, the secret key does not need to be read from other storage areas of the electronic equipment, and security verification of the to-be-verified firmware can be realized more quickly; moreover, for electronic equipment which supports the TrustZone technology and does not support the TrustZone technology, various secret keys can be safely stored, and the to-be-verified firmware can be subjected to signature verification and operation by quickly utilizing the various secret keys; that is to say, a more universal secure startup method independent of hardware of the electronic device is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a secure startup method, device, electronic device and storage medium. Background Art

[0002] System security is a complete set of software and hardware solutions to support secure boot and ensure that the system runs in a trusted environment. System security solutions based on the ARM (Advanced RISC Machines) architecture are usually composed of secure boot (SecureBoot) and trust zone (TrustZone) technologies. TrustZone is a hardware architecture developed by ARM for device security. It divides the system into two environments - Non Secure world and Secureworld through hardware isolation. The software that can run in the Non Secure world environment is relatively rich and complex, such as Linux. The software running in the Secureworld environment is very "small" and generally provides security service functions. The secure boot of the system is the trusted root of the entire system security. Only by ensuring the security of the system boot can the security of other components of the system be guaranteed.

[0003] In the related art, when the system is securely booted, the system generally verifies the signature step by step, and guides the subsequent process after the verification passes. Usually after the system is powered on, it executes the Boot Rom to read the key stored in the eFUSE (one-time programmable memory), and based on the key, it implements the step-by-step signature verification of the subsequent firmware, thereby achieving secure boot. However, only the Secure World can access the storage content in the eFUSE, that is, the secure boot of the system is too dependent on the system's own hardware, resulting in the secure boot method can only be applied to systems that support the TrustZone technology, and cannot meet the secure boot of systems of more business types. Summary of the invention

[0004] The present application proposes a secure boot method, device, electronic device and storage medium to provide a more universal secure boot mode.

[0005] In a first aspect, an embodiment of the present application provides a secure boot method, which is applied to an electronic device. The method includes: during the startup process of the electronic device, running a boot loader firmware, and using multiple keys in the boot loader firmware to perform a security check on the firmware to be verified; if the security check passes, running the firmware to be verified.

[0006] In the second aspect, the embodiment of the present application provides a secure boot device, which is applied to an electronic device, and the device includes: a security verification module and a firmware running module. The security verification module is used to run the boot loading firmware during the startup process of the electronic device, and use multiple keys in the boot loading firmware to perform security verification on the firmware to be verified; the firmware running module is used to run the firmware to be verified if the security verification passes.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.

[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the above method.

[0009] In the solution provided by the present application, during the startup process of the electronic device, the boot loading firmware is run, and the multiple keys in the boot loading firmware are used to perform security verification on the firmware to be verified; if the security verification passes, the firmware to be verified is run. In this way, the key used for security verification is stored in the boot loading firmware, and then when the boot loading firmware is run, the key can be directly obtained without reading the key from other storage areas of the electronic device, so that the security verification of the firmware to be verified can be achieved more quickly; and for electronic devices that support TrustZone technology and those that do not support TrustZone technology, multiple keys can be securely stored, and multiple keys can be quickly used to verify and run the firmware to be verified; that is, a more general secure startup method that does not rely on the hardware of the electronic device itself is provided. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0011] Figure 1 A schematic diagram of a process flow of a secure startup method provided in an embodiment of the present application is shown.

[0012] Figure 2 A schematic flow chart of a secure startup method provided in another embodiment of the present application is shown.

[0013] Figure 3 Shows Figure 2 A schematic flow chart of the sub-steps of step S220 in one implementation manner.

[0014] Figure 4 A schematic diagram of a mirror image verification process provided in an embodiment of the present application is shown.

[0015] Figure 5 A schematic diagram of another image verification process provided by an embodiment of the present application is shown.

[0016] Figure 6 A schematic flow chart of a secure startup method provided in yet another embodiment of the present application is shown.

[0017] Figure 7 A schematic diagram of a process flow of a firmware level-by-level security verification provided by an embodiment of the present application is shown.

[0018] Figure 8 A schematic diagram of another process of firmware level-by-level security verification provided by an embodiment of the present application is shown.

[0019] Fig. 9 A schematic diagram of a process flow of another firmware level-by-level security verification provided in an embodiment of the present application is shown.

[0020] Fig.10 A schematic diagram of the architecture of a secure boot system provided by an embodiment of the present application is shown.

[0021] Fig.11 It is a block diagram of a secure startup device provided according to an embodiment of the present application.

[0022] Fig.12 It is a block diagram of an electronic device for executing a secure boot method according to an embodiment of the present application.

[0023] Fig.13 It is a storage unit of an embodiment of the present application for storing or carrying a program code for implementing a secure boot method according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0025] It should be noted that in some processes described in the specification, claims and the above-mentioned drawings of the present application, multiple operations that appear in a specific order are included, and these operations may not be executed or executed in parallel in the order in which they appear in this article. The sequence numbers of operations such as S110, S120, etc. are only used to distinguish different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or less operations, and these operations may be executed in sequence or in parallel. And, the terms "first", "second", etc. in the specification, claims and the above-mentioned drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or sub-modules is not necessarily limited to those steps or sub-modules explicitly listed, but may include other steps or sub-modules that are not explicitly listed or that are inherent to these processes, methods, products, or devices.

[0026] The inventor proposes a secure boot method, device, electronic device and storage medium. During the boot process of the electronic device, the boot loading firmware is run, and the firmware to be verified is security-verified using multiple keys in the boot loading firmware; if the security verification passes, the firmware to be verified is run. The secure boot method provided by the embodiment of the present application is described in detail below.

[0027] Please refer to Figure 1 , Figure 1 A schematic diagram of a secure boot method provided in an embodiment of the present application is applied to an electronic device. Figure 1 The secure boot method provided in the embodiment of the present application is described in detail. The secure boot method may include the following steps:

[0028] Step S110: During the startup process of the electronic device, the boot loader firmware is run, and the firmware to be verified is security verified using multiple keys in the boot loader firmware.

[0029] In this embodiment, the electronic device may be a device with data processing functions, including but not limited to smart watches, smart bracelets, smart collars, smart glasses, smart gloves, smart clothing, smart phones, tablet computers, laptop computers, desktop computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert compression standard audio layer 3) players and MP4 (Moving Picture Experts Group AudioLayer IV, dynamic image expert compression standard audio layer 4) players, etc. Firmware refers to the device "driver" stored in the electronic device, and can also be commonly understood as program code. The boot loading firmware (i.e., BootLoader) is the program code used to guide the subsequent loading and running of other firmware. The firmware to be verified is the formal microcontroller unit (MCU) firmware in the electronic device. The formal MCU firmware includes but is not limited to system code programs and application code programs. The system code program can be the system code program of the Android system, or it can be the system code program of the real-time operating system (Real Time Operating System, RTOS) that is only used to schedule real-time tasks; the application code program includes but is not limited to the application code programs of various applications such as sports applications, alarm clock applications, music applications, navigation applications, and desktop applications.

[0030] It is understandable that in order to prevent the leakage of user's privacy data or the theft of property when the system program or application program in the electronic device is maliciously modified by a third party, the system firmware and application firmware in the electronic device can be security checked every time the electronic device is powered on. Specifically, the key in the boot-loaded firmware can be used to verify whether the firmware to be checked is legal, that is, the firmware to be checked can be security checked.

[0031] Among them, the key used for security verification of the firmware is obtained in advance from the signature server and stored in the boot-loaded firmware in the form of code. In this way, the possibility of the key being replaced can be further reduced, that is, the security of the key is guaranteed, and then the reliability of the security verification results of the firmware to be verified based on the key is guaranteed.

[0032] Optionally, since the firmware to be verified may include multiple types of firmware, and each type of firmware may have different requirements for security verification, the corresponding keys of different types of firmware can be obtained from the signature server in advance and stored in the boot-loaded firmware in the form of code. In this way, when performing security verification on different types of firmware to be verified, the corresponding adapted key can be quickly determined from the multiple keys in the boot-loaded firmware for verification, thereby improving the efficiency of firmware security verification and startup.

[0033] In this embodiment, in response to the power-on instruction, the electronic device generally first runs the trusted root firmware (i.e., BootRom), and uses the trusted root firmware to perform a security check on the boot loading firmware; if the boot loading firmware passes the security check, the content in the aforementioned step S110 is executed. Among them, the trusted root firmware can be understood as a program written by the chip manufacturer of the electronic device in a memory address in the read-only memory (ROM) of the electronic device before the electronic device leaves the factory. The program cannot be changed or replaced. If the outside world attempts to write content to or modify the content of the memory address, an error will occur or there will be no effect. In other words, the trusted root firmware is a completely trusted program that can be run without security verification. In this way, after the security check of the boot loading firmware passes through the trusted root firmware, the boot loading firmware is used to perform a security check on the subsequent firmware to be verified, which further ensures the reliability of the security check of the subsequent firmware, and avoids the problem that the boot loading firmware is maliciously tampered with, resulting in unreliable security checks on the subsequent firmware.

[0034] In some embodiments, before step S110, the electronic device can obtain the boot loader firmware, and store the boot loader firmware in the target storage area, and then lock the target storage area, and the content in the locked target storage area cannot be modified. Among them, the target storage area can be a storage area in ROM, or a storage area in flash memory, and this embodiment is not limited to this. Optionally, the aforementioned target storage area can be locked through a memory protection mechanism to ensure that the content in the target storage area cannot be modified. In this way, the running trusted root firmware cannot be modified, and the boot loader firmware cannot be modified, which is equivalent to the boot loader firmware also becoming the trusted root of the secure startup of the electronic device at this time, thereby improving the reliability of the security inspection of the subsequent firmware to be verified by the boot loader firmware.

[0035] The keys in the prior art are generally stored in eFUSE to protect the security of the keys. eFUSE is a very small one-time programmable storage module with a size of about 1KB. It can generally only store one public key. Even if the data size of the public key is large, eFUSE cannot completely store the larger public key. Obviously, in this application, multiple keys can be compiled into the boot loader firmware in the form of code, and a storage area can be divided in the ROM area for storing the boot loader firmware, and then the storage area can be locked. In this way, multiple keys can be stored and the security of multiple keys can be guaranteed at the same time; and the keys are directly stored in the boot loader firmware, and the keys can be obtained when the boot loader firmware is running, and the keys are used for security verification, without the need to read the keys from other storage areas as in the prior art, which improves the speed of key acquisition and thus improves the speed of security verification.

[0036] In other embodiments, after the electronic device obtains the boot loading firmware and stores the boot loading firmware in the target storage area, the target storage area can also be locked for permissions; for example, only data interaction is allowed between the target storage area and the interface with operation permissions, and no response is given to data or instructions sent by other interfaces without operation permissions. In this way, it is ensured that the boot loading firmware in the target storage area cannot be maliciously modified by a third party, and at the same time, the user corresponding to the interface with operation permissions can regularly update the key in the boot loading firmware according to the actual application scenario.

[0037] Step S120: If the security check passes, run the firmware to be checked.

[0038] Optionally, if the security check passes, it indicates that the firmware to be checked has not been maliciously tampered with by a third party, and the firmware to be checked can be run.

[0039] Optionally, if the security check of the firmware to be checked fails, it indicates that the firmware to be checked has been maliciously tampered by a third party. For example, if the firmware to be checked is a payment application firmware, if the payment application firmware is run, the user may cause the user's payment account and password to be leaked when using the payment function in the payment application, and then cause the user's property to be stolen by a third party. Based on this, when the security check of the firmware to be checked is passed, a target prompt information can be displayed, wherein the target prompt information is used to prompt that the firmware to be checked has a security problem. Reflected on the visual interface of the electronic device, taking the electronic device as a smart watch as an example, during the startup process of the smart watch, if the payment application firmware fails to pass the security check, the display interface of the smart watch can display the target prompt information to prompt that the payment application has a security problem and cannot be used. It is recommended that the user uninstall the payment application and re-download the payment application in the official software downloaded by the application. In this way, the privacy and property security of the user are guaranteed to a great extent.

[0040] In this embodiment, the key used for security verification is stored in the boot loading firmware, and then when the boot loading firmware is run, the key can be directly obtained without reading the key from other storage areas of the electronic device, so that the security verification of the firmware to be verified can be achieved more quickly; and for electronic devices that support TrustZone technology and do not support TrustZone technology, multiple keys can be securely stored, and multiple keys can be quickly used to verify and run the firmware to be verified; that is, a more general security boot method that does not rely on the hardware of the electronic device itself is provided. In addition, using the security boot method provided by this embodiment, manufacturers can replace the chip of electronic devices using chips that support TrustZone technology with MCU chips that do not support TrustZone technology at a lower cost, and on the basis of reducing production costs, the security boot of electronic devices can be efficiently guaranteed, and for electronic devices that originally use MCU chips that do not support TrustZone technology, a more secure power-on startup can be achieved without increasing costs.

[0041] See also Figure 2 , Figure 2 A schematic diagram of a safe startup method provided in another embodiment of the present application is applied to an electronic device. Figure 2 The secure boot method provided in the embodiment of the present application is described in detail. The secure boot method may include the following steps:

[0042] Step S210: During the startup process of the electronic device, the bootloader firmware is run, and a key matching the firmware type of the target firmware is determined from multiple keys as the target key, and the target firmware is any firmware among multiple firmwares to be verified.

[0043] In this embodiment, the multiple keys may include a first key, a second key, and a third key. Among them, the first key is used to perform security verification on the official firmware. The official firmware is the system firmware and application firmware developed by the manufacturer corresponding to the electronic device. At this time, the first key is used to verify the firmware; the second key is used to perform security verification on the system firmware and application firmware developed by a third-party manufacturer. The third-party manufacturer is a manufacturer other than the manufacturer corresponding to the electronic device. At this time, the second key is used to verify the public key certificate of the firmware; the third key is used to perform security verification on the dynamic loading library, that is, to verify the updated firmware plug-in. The firmware types of the firmware to be verified include a first target type, a second target type, and a third target type. The first target type matches the first key, the second target type matches the second key, and the third target type matches the third key.

[0044] Based on this, before performing security verification on any firmware (i.e., target firmware) among the multiple firmwares to be verified, it is necessary to first determine the key that matches the firmware type of the target firmware from the multiple keys. For example, if the target firmware is the official firmware, the first key among the multiple keys is determined to be the target key corresponding to the target firmware. For another example, if the target firmware is a third-party firmware, the second key among the multiple keys is determined to be the target key corresponding to the target firmware.

[0045] Step S220: Using the target key, perform security verification on the target firmware.

[0046] In some embodiments, see Figure 3 , step S220 may include the contents of step S221 to step S222:

[0047] Step S221: acquiring the image data corresponding to the target firmware from the storage address corresponding to the target firmware as the target image data.

[0048] In this embodiment, the firmware to be verified is generally stored in the flash memory of the electronic device. To perform a security check on the target firmware, it is first necessary to obtain the image data corresponding to the target firmware from the storage address corresponding to the target firmware in the flash memory as the target image data, and perform a security check based on the target image data.

[0049] Step S222: Using the target key, perform security verification on the target image data.

[0050] In some implementations, the firmware type of the target firmware is a first target type, which is used to be a firmware type corresponding to the official firmware. In this case, the target key obtained is the first key mentioned above. Figure 4 , Figure 4 A schematic diagram of a process of using a first key to perform security verification on target image data of an official firmware is shown. Specifically, using the target key, the encrypted hash value in the target image data is decrypted to obtain a first hash value; based on the target image data, a second hash value currently corresponding to the target image data is obtained; further, whether the first hash value matches the second hash value is checked. If the first hash value is the same as the second hash value, it is determined that the first hash value matches the second hash value, and then it is determined that the security verification of the target firmware has passed; if the first hash value is different from the second hash value, it is determined that the first hash value does not match the second hash value, and then it is determined that the security verification of the target firmware has failed.

[0051] The calculation of the second hash value can be calculated using a message digest algorithm and the current target image data. The message digest algorithm is a process of converting the content of a message into another fixed-length message through a one-way hash function, and the message generated by the calculation is called a hash value. The message digest algorithm includes but is not limited to the MD5 message digest algorithm (Message Digest Algorithm MD5), Secure Hash Algorithm 1 (Secure Hash Algorithm1, sha1), sha256, sha512, sha3 and other algorithms. The calculation of the first hash value is the hash value calculated when applying for a signature to the signature server for the target firmware. The encrypted hash value is the encrypted value calculated by the signature server using the first private key corresponding to the first key (i.e., the first public key) for the hash value. The first public key and the first private key are a set of asymmetric keys pre-generated by the signature server.

[0052] Moreover, since any input message of any length will output a hash value of fixed length, and the hash function is unidirectional, and the original message cannot be calculated back through the hash value, different input messages will have different output hash values, that is, it has strong anti-collision properties, and the length of the hash value is fixed, it takes up little space, and has a fast calculation speed. Therefore, by calculating the hash value of the target image data and comparing the current second hash value with the first hash value obtained by decryption to see if they are the same, to verify whether the target image data is complete and has not been modified, it is possible to quickly identify whether the target image data has been tampered with, that is, to quickly identify whether the target firmware has been tampered with, and quickly implement security verification of the target firmware.

[0053] In some other implementations, the firmware type of the target firmware is the second target type, and the second target type is used for the firmware type corresponding to the third-party firmware. In this case, the acquired target key is the second key mentioned above. Figure 5 , Figure 5The schematic diagram of the process of using the second key to perform security verification on the target image data of the third-party firmware is shown. Specifically, first, the encrypted public key in the target image data is decrypted using the target key to obtain the decrypted public key; if the decrypted public key matches the target public key, the encrypted hash value in the target image data is decrypted using the decrypted public key to obtain the third hash value; and based on the target image data, the fourth hash value of the target image data at the current moment is obtained; if the third hash value matches the fourth hash value, it is determined that the security verification of the target firmware has passed; if the third hash value does not match the fourth hash value, it is determined that the security verification of the target firmware has not passed; if the decrypted public key does not match the target public key, it is determined that the security verification of the target firmware has not passed. Wherein, if the third hash value is the same as the fourth hash value, it is determined that the third hash value matches the fourth hash value, otherwise, it does not match.

[0054] In some other embodiments, the firmware type of the target firmware is a third target type, and the third target type is used as the firmware type in the dynamic loading library. At this time, the target key obtained is the third key mentioned above. The security verification method for the target firmware using the third key can be the same as the verification method of the first key, or the same as the verification method of the second key. The specific verification method can refer to the content of the aforementioned embodiment, which will not be repeated here.

[0055] In some further embodiments, different keys may be used for encryption for the same type of firmware (e.g., official firmware) with different security levels, thereby achieving different degrees of encryption protection. Specifically, the multiple keys may include the aforementioned first key, second key, and third key. The first key may be divided into multiple first subkeys, and the multiple first subkeys correspond one-to-one to the multiple first security levels corresponding to the official firmware; the second key may also be divided into multiple second subkeys, and the multiple second subkeys correspond one-to-one to the multiple second security levels corresponding to the third-party firmware; the third key may also be divided into multiple third subkeys, and the multiple third subkeys correspond one-to-one to the multiple third security levels corresponding to the dynamic loading library. Based on this, the target key corresponding to the target firmware can be determined based on the firmware type of the target firmware and the security level of the target firmware in the firmware type.

[0056] Step S230: If the security check passes, run the target firmware.

[0057] In this embodiment, the specific implementation of step S230 can refer to the content of the above-mentioned embodiment, which will not be repeated here.

[0058] In this embodiment, during the startup process of the electronic device, for multiple firmware to be verified, different types of firmware to be verified are security verified using keys adapted thereto, thereby ensuring the effectiveness and reliability of the security verification, thereby improving the security of user use after the electronic device is successfully started.

[0059] See also Figure 6 , Figure 6 A flowchart of a secure boot method provided in another embodiment of the present application is shown below. Figure 6 The secure boot method provided in the embodiment of the present application is described in detail. The secure boot method may include the following steps:

[0060] Step S310: During the startup process of the electronic device, the bootloader firmware is run. If the number of firmware is greater than the target number, the security verification of the multiple firmwares to be verified is performed in sequence according to the target firmware verification order and based on the multiple keys.

[0061] Step S320: If the security check passes, run the multiple firmwares to be checked in sequence.

[0062] In some implementations, the boot loader firmware sequentially performs security verification on multiple firmwares to be verified, such as Figure 7 As shown, a total of n firmwares to be verified are included. In response to the power-on instruction, the electronic device performs security verification on the boot loading firmware through the trusted root firmware. If the security verification of the boot loading firmware passes, the boot loading firmware is run, and the security verification is performed on multiple firmwares to be verified in sequence according to the target firmware verification order, that is, security verification is performed on firmware 1 to firmware 2 to firmware n to be verified in sequence, and the firmwares to be verified that pass the security verification are run in sequence; if the security verification of a firmware to be verified fails, the firmware to be verified that fails the security verification is not run, and a prompt message is output to prompt that the firmware to be verified has a security problem; at the same time, the boot loading firmware can still continue to verify other firmware to be verified that is located after the firmware to be verified that fails the security verification. In this way, the trusted boot loading firmware performs security verification on multiple firmware to be verified, so that the firmware to be verified that fails the security verification will not affect the security verification process of other firmware to be verified that has not yet been security verified, ensuring the smooth progress of the security verification, and then ensuring that the firmware to be verified that passes the security verification can run normally.

[0063] In this manner, the multiple firmwares to be verified are generally of the same type, that is, the operation of any firmware to be verified will not affect other firmwares to be verified. For example, the multiple firmwares to be verified do not include system firmware, but only include multiple application firmwares, such as application firmwares of multiple applications such as sports applications, alarm clock applications, music applications, navigation applications, and desktop applications.

[0064] In other implementations, the trusted boot loader firmware may first perform a security check on the first firmware to be checked in the target firmware verification sequence. After the first firmware to be checked passes the security check, the first firmware to be checked performs a security check on the second firmware to be checked. Then, the firmware that passes the security check sequentially performs security checks on subsequent firmware to be checked. Figure 8 As shown, a total of n firmwares to be verified are included. In response to the power-on instruction, the electronic device performs a security check on the boot-loaded firmware through the trusted root firmware. If the security check on the boot-loaded firmware passes, the boot-loaded firmware is run, and the security checks on the multiple firmwares to be verified are performed in sequence according to the target firmware verification order, that is, the security check on the firmware 1 to be verified is performed in sequence. After the security check on the firmware 1 to be verified passes, the firmware 1 to be verified performs a security check on the firmware 2 to be verified, and the verification is performed step by step to the firmware n to be verified. That is to say, after the electronic device is powered on, the boot-loaded firmware and multiple firmwares to be verified are verified step by step starting from the trusted root firmware. In the process of step-by-step verification, if any level of verification fails, the device startup fails. If all levels of verification pass, the safe startup of the device is completed. In this way, the trusted root firmware, boot loading firmware and multiple firmwares to be verified constitute a startup trust chain. The trusted program of the next level must be loaded by the trusted program, that is, the program at each level must be trusted to achieve the safe startup of the electronic device; the security of the electronic device is greatly improved, that is, as long as the electronic device can be successfully started, all the firmware it runs is trusted, that is, safe, and it fundamentally avoids the problem that the privacy of the user of the electronic device is leaked or the property is stolen after the device is started when there is firmware tampered by a third party.

[0065] In this way, the multiple firmwares to be verified generally include at least system firmware and at least one application firmware. It is understandable that the operation of the system firmware will affect the operation of the subsequent application firmware. Therefore, if the security check of the system firmware fails, it is determined that the electronic device has failed to start safely. Among them, the system firmware is generally located at the first position in the firmware check order of the multiple firmwares to be verified. Based on this, please refer to Fig. 9, multiple firmwares to be verified may include system firmware and n application firmwares, where n is a positive integer. It can be seen that the trusted root firmware, boot loading firmware, system firmware and n application firmwares constitute n trusted chains; that is, after the electronic device is powered on, when the trusted root firmware, boot loading firmware and system firmware all pass the security check, the system firmware performs security checks on the n application firmwares in turn. If there is a firmware to be verified that fails the security check, the firmware to be verified that fails the security check will not be run, and a prompt message is output to prompt that the firmware to be verified has a security problem; at the same time, the system firmware can continue to verify other application firmwares located after the application firmware that fails the security check. In this way, the trusted system firmware performs security checks on multiple application firmwares, so that the application firmware that fails the security check will not affect the security check process of other application firmware that has not yet been security checked, ensuring that the security check is smoothly carried out on the premise that the system corresponding to the system firmware can run safely, that is, ensuring that the application firmware that can pass the security check can run normally.

[0066] In some embodiments, before step S310, if the number of firmwares to be verified is greater than the target number, the order of historical usage frequency can be determined from high to low according to the historical usage frequency of each firmware to be verified, as the target firmware verification order. In this way, after the electronic device is started, the firmware to be verified with high user usage frequency is first security verified and then run, so that the user can use the functions of the firmware to be verified that he often uses after the electronic device is started.

[0067] In other embodiments, before step S310, if the number of multiple firmwares to be verified is greater than the target number, the order of security levels from low to high is determined according to the security level of each firmware to be verified as the target firmware verification order. It can be understood that the encryption of the firmware to be verified with a higher security level is more complex, and correspondingly, the decryption operation of the firmware to be verified for security verification is more time-consuming. Therefore, the firmware to be verified with a lower security level can be checked first, and then the firmware to be verified that takes less time for security verification can be checked first and run, so that the firmware to be verified with the most security verification can be completed in the shortest time after the electronic device receives the power-on command.

[0068] In some implementations, if the number of multiple firmwares to be verified is less than the target number, the boot loader firmware can simultaneously perform security verification on the multiple firmwares to be verified to improve the efficiency of security verification and increase the speed of secure booting.

[0069] In this embodiment, during the power-on process of the electronic device, multiple firmwares to be verified can be security verified according to the target firmware verification sequence, wherein the target firmware verification sequence can be determined in a variety of ways, and then the verification can be performed using a verification sequence that is more compatible with the actual application, so as to improve the effect of security verification and thus improve the user experience of the electronic device.

[0070] See also Fig.10 , Fig.10 A schematic diagram of the architecture of a secure boot system provided in another embodiment of the present application. Fig.10 The secure boot system provided in the embodiments of the present application is described in detail.

[0071] In this embodiment, the secure boot system 40 includes a signature server 401, a computer device 402, and an electronic device 403. The signature server 401 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms; the computer device 402 may be a device with data processing and code compilation functions, such as a tablet computer, a laptop computer, a desktop computer, etc. There is a communication connection between the signature server 401 and the computer device 402, and the communication connection may be a wired communication connection or a wireless communication connection; there is also a communication connection between the computer device 402 and the electronic device 403, and the communication connection may be a wired communication connection or a wireless communication connection.

[0072] The signature server 401 is generally a server corresponding to the manufacturer of the electronic device 403. The signature server 401 plays the role of certificate issuance and firmware signing. Its role is similar to that of a certificate authority (CA), so it must be absolutely safe and trustworthy. It has a strict network protection mechanism, a whitelist access mechanism, a trusted execution environment (TEE), a true random number generator (TRNG), etc. At the same time, it should also have the ability to deal with intrusion methods such as exhaustive attacks and side-channel attacks. When the signature server 401 is started for the first time, it will use TRNG to generate a symmetric key Z, which will be stored in the TrustZone area of ​​the signature server 401. Since the symmetric key Z is randomly generated, it is guaranteed that no one knows the key and it cannot be exported, which ensures the security of the symmetric key Z.

[0073] Furthermore, the signature server 401 can load the signature program and necessary network services. The signature program will generate multiple groups of asymmetric keys when it is started for the first time. Each group of asymmetric keys includes a public key and a private key. The private key is used for data encryption, and the public key is used to decrypt the encrypted data encrypted by the private key. Among them, the private key in each group of asymmetric keys can be used to encrypt the object of the signature. The firmware can be official firmware or released by a third-party partner. Different private keys can be used for signature encryption for different firmware. For example, taking the three groups of asymmetric keys of Group A, Group B and Group C as examples, private key A: used to issue certificates, that is, the public key provided by the manufacturer for encrypting the third-party firmware. The third-party manufacturer provides us with their verification public key, and our private key A signs their verification public key as a public key certificate. The public key certificate signed by us can also be used as the public key for firmware verification. This verification process can also be called a secondary signature. Private key B is used to issue firmware, that is, to encrypt official firmware. The official firmware is released internally by the manufacturer of the electronic device. Therefore, the signature server 401 can be directly accessed, and then the public key B specifically used to issue firmware can be directly used for signing, which can also be called a primary signature. Private key C is used to issue dynamic loading libraries, etc.

[0074] Among them, the private keys of multiple groups of asymmetric keys are encrypted with key Z and saved in the TrustZone area of ​​the signature server 401. Since these three groups of asymmetric keys are also generated by the signature server 401 itself, they will not be known by anyone, thus greatly ensuring the storage security of the three groups of generated asymmetric keys. At this time, the signature program in the signature server will listen on a certain port, waiting for the signature request, and use the private key to encrypt the firmware applying for signature, and decrypt the public key corresponding to the private key with the symmetric key Z, and then send it to the device that initiated the signature request.

[0075] The computer device 402 is used by the developer to construct the boot loading firmware mentioned in the above embodiment, and initiate a public key application to the signature server 401 by compiling the boot loading firmware; correspondingly, the signature server 401 can respond to the public key application, and decrypt the public key in the multiple sets of asymmetric keys after decrypting with the symmetric key Z, and then feedback to the computer device 402; finally, after the computer device 402 obtains the public key in the multiple sets of asymmetric keys, it compiles it into the boot loading firmware in the form of code. Among them, the boot loading firmware is pre-written with a code segment for storing the public key, which is used to write the public key into the boot loading firmware in the form of code.

[0076] Furthermore, after the computer device 402 has constructed the boot loading firmware containing multiple sets of public keys, the boot loading firmware can be sent to the electronic device 403 for storage and locking. Specifically, the boot loading firmware can be sent through the communication connection between the two aforementioned devices, or the boot loading firmware can be copied from the computer device 402 through a third-party tool, and then the copied boot loading firmware is imported into the target storage area in the electronic device 403, such as a ROM memory, through the third-party tool. Then, the electronic device 403 can use a memory protection mechanism to lock the storage space address of the boot loading firmware to ensure that the content in the storage space address cannot be modified, further reducing the possibility of the public key being replaced or tampered with.

[0077] Finally, the electronic device 403 can respond to the power-on command issued by the user, and the trusted root firmware can perform a security check on the boot loading firmware. The boot loading firmware that passes the security check can then use multiple keys in itself to perform a security check on the subsequent firmware to be verified, so as to achieve secure startup of the electronic device.

[0078] In this embodiment, the key used for security verification is stored in the boot loading firmware, and then when the boot loading firmware is run, the key can be directly obtained without reading the key from other storage areas of the electronic device, so that the security verification of the firmware to be verified can be achieved more quickly; and for electronic devices that support TrustZone technology and do not support TrustZone technology, multiple keys can be securely stored, and multiple keys can be quickly used to verify and run the firmware to be verified; that is, a more general security boot method that does not rely on the hardware of the electronic device itself is provided. In addition, using the security boot method provided by this embodiment, manufacturers can replace the chip of electronic devices using chips that support TrustZone technology with MCU chips that do not support TrustZone technology at a lower cost, and on the basis of reducing production costs, the security boot of electronic devices can be efficiently guaranteed, and for electronic devices that originally use MCU chips that do not support TrustZone technology, a more secure power-on startup can be achieved without increasing costs.

[0079] Please refer to Fig.11 , which shows a structural block diagram of a secure boot device 500 provided in an embodiment of the present application, which is applied to electronic equipment. The device 500 may include: a security verification module 510 and a firmware running module 520.

[0080] The security verification module 510 is used to run the boot loading firmware during the startup process of the electronic device, and use multiple keys in the boot loading firmware to perform security verification on the firmware to be verified.

[0081] The firmware running module 520 is used to run the firmware to be checked if the security check passes.

[0082] In some embodiments, there are multiple firmwares to be verified, and the security verification module 510 may include: a key determination unit and a verification unit. The key determination unit may be used to determine a key that matches the firmware type of the target firmware from the multiple keys as the target key, and the target firmware is any firmware in the multiple firmwares to be verified. The verification unit may be used to perform security verification on the target firmware using the target key.

[0083] In this manner, the firmware type is a first target type, and the verification unit can be specifically used to: use the target key to decrypt the encrypted hash value in the target image data to obtain a first hash value; based on the target image data, obtain a second hash value currently corresponding to the target image data; if the first hash value matches the second hash value, determine that the security verification of the target firmware has passed; if the first hash value does not match the second hash value, determine that the security verification of the target firmware has failed.

[0084] In this manner, the firmware type is the second target type, and the verification unit can be specifically used to: use the target key to decrypt the encrypted public key in the target image data to obtain a decrypted public key; if the decrypted public key matches the target public key, use the decrypted public key to decrypt the encrypted hash value in the target image data to obtain a third hash value; based on the target image data, obtain a fourth hash value of the target image data at the current moment; if the third hash value matches the fourth hash value, determine that the security verification of the target firmware has passed; if the third hash value does not match the fourth hash value, determine that the security verification of the target firmware has failed; if the decrypted public key does not match the target public key, determine that the security verification of the target firmware has failed.

[0085] In some embodiments, the secure boot device 600 may further include: a trusted root execution module. The trusted root execution module may be used to run the trusted root firmware before running the boot loading firmware, and use the trusted root firmware to perform a security check on the boot loading firmware. In this manner, the security check module 510 may be specifically used to execute the step of running the boot loading firmware if the security check on the boot loading firmware passes, and use multiple keys in the boot loading firmware to perform a security check on the firmware to be checked.

[0086] In some embodiments, there are multiple firmwares to be verified, and the security verification module 510 can be specifically used to: if the number of firmwares is greater than the target number, perform security verification on the multiple firmwares to be verified in sequence according to the target firmware verification order and based on the multiple keys.

[0087] In this manner, the secure boot device 500 may further include: a verification sequence determination module. The verification sequence determination module may be specifically used to determine the order of the historical usage frequencies from high to low as the target firmware verification order before sequentially performing security verification on the multiple firmwares to be verified according to the target firmware verification order and based on the multiple keys if the number of the firmwares is greater than the target number, according to the historical usage frequencies of each firmware to be verified.

[0088] In this manner, the secure boot device 500 may further include: a verification sequence determination module. The verification sequence determination module may be specifically used to determine the order of the security level from low to high as the target firmware verification sequence before sequentially performing security verification on the multiple firmwares to be verified according to the target firmware verification sequence and based on the multiple keys if the number of the firmwares is greater than the target number, according to the security level of each firmware to be verified.

[0089] In some embodiments, the secure boot device 500 may further include: a boot firmware acquisition module and a locking module. The boot firmware acquisition module may be used to run the boot loading firmware during the startup process of the electronic device, and use multiple keys in the boot loading firmware to obtain the boot loading firmware before performing security verification on the firmware to be verified. The locking module may be used to store the boot loading firmware in a target storage area and lock the target storage area, and the content in the locked target storage area cannot be modified.

[0090] In some embodiments, the secure boot device 500 may further include: a prompt module. The prompt module may be used to run the boot loader firmware during the boot process of the electronic device, and use multiple keys in the boot loader firmware to perform security verification on the firmware to be verified. If the security verification of the firmware to be verified fails, a target prompt information is displayed, and the target prompt information is used to prompt that the firmware to be verified has a security problem.

[0091] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0092] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.

[0093] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0094] In summary, during the startup process of the electronic device, the bootloader firmware is run, and the multiple keys in the bootloader firmware are used to perform security verification on the firmware to be verified; if the security verification passes, the firmware to be verified is run. In this way, the key used for security verification is stored in the bootloader firmware, and then when the bootloader firmware is run, the key can be directly obtained without reading the key from other storage areas of the electronic device, so that the security verification of the firmware to be verified can be achieved more quickly; and for electronic devices that support TrustZone technology and those that do not support TrustZone technology, multiple keys can be securely stored, and multiple keys can be quickly used to verify and run the firmware to be verified; that is, a more general secure startup method that does not rely on the hardware of the electronic device itself is provided.

[0095] The following will be combined Fig.12 An electronic device provided by the present application is described.

[0096] Reference Fig.12 , Fig.12 A structural block diagram of an electronic device 600 provided in an embodiment of the present application is shown. The above method provided in an embodiment of the present application can be executed by the electronic device 600.

[0097] The electronic device 600 in the embodiment of the present application may include one or more of the following components: a processor 601, a memory 602, and one or more applications, wherein the one or more applications may be stored in the memory 602 and configured to be executed by one or more processors 601, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.

[0098] The processor 601 may include one or more processing cores. The processor 601 uses various interfaces and lines to connect the various parts of the entire electronic device 600, and executes various functions and processes data of the electronic device 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 602, and calling data stored in the memory 602. Optionally, the processor 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 601 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem can also be integrated into the processor 601 and implemented separately through a communication chip.

[0099] The memory 602 may include a random access memory (RAM) or a read-only memory (ROM). The memory 602 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as the various corresponding relationships described above) created by the electronic device 600 during use.

[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0101] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.

[0102] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0103] Please refer to Fig.13 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 700 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0104] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 810 that performs any method step of the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.

[0105] In some embodiments, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the steps in the above-mentioned method embodiments.

[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A secure boot method, characterized in that: Applied to electronic equipment, the method comprises: During the startup process of the electronic device, the boot loading firmware is run, and the firmware to be checked is security checked by using multiple keys in the boot loading firmware; If the security check passes, the firmware to be checked is run.

2. The method according to claim 1, characterized in that: The firmware to be verified has a plurality of firmwares, and the firmware to be verified is security verified by using a plurality of keys in the boot loading firmware, including: Determine a key that matches the firmware type of the target firmware from the multiple keys as the target key, wherein the target firmware is any firmware among the multiple firmwares to be verified; The target firmware is security-verified using the target key.

3. The method according to claim 2, characterized in that The using the target key to perform security verification on the target firmware includes: Acquire the image data corresponding to the target firmware from the storage address corresponding to the target firmware as the target image data; The target image data is security-verified using the target key.

4. The method according to claim 3, characterized in that The firmware type is a first target type, and the use of the target key to perform security verification on the target image data includes: Decrypting the encrypted hash value in the target image data using the target key to obtain a first hash value; Based on the target image data, obtaining a second hash value currently corresponding to the target image data; If the first hash value matches the second hash value, determining that the security check on the target firmware passes; If the first hash value does not match the second hash value, it is determined that the security check on the target firmware fails.

5. The method according to claim 3, characterized in that: The firmware type is a second target type, and the use of the target key to perform security verification on the target firmware includes: Decrypting the encrypted public key in the target image data using the target key to obtain a decrypted public key; If the decrypted public key matches the target public key, decrypt the encrypted hash value in the target image data using the decrypted public key to obtain a third hash value; Based on the target image data, obtaining a fourth hash value of the target image data at a current moment; If the third hash value matches the fourth hash value, it is determined that the security check on the target firmware passes; If the third hash value does not match the fourth hash value, determining that the security check on the target firmware fails; If the decrypted public key does not match the target public key, it is determined that the security check on the target firmware fails.

6. The method according to any one of claims 1 to 5, characterized in that: Before the running boot loading firmware, the method further includes: Running the trusted root firmware, and using the trusted root firmware to perform security verification on the boot loading firmware; If the boot loading firmware passes the security check, the step of running the boot loading firmware and using the multiple keys in the boot loading firmware to perform a security check on the firmware to be checked is performed.

7. The method according to any one of claims 1 to 5, characterized in that: The firmware to be verified has a plurality of firmwares, and the firmware to be verified is security verified by using a plurality of keys in the boot loading firmware, including: If the number of the firmware is greater than the target number, security verification is performed on the multiple firmwares to be verified in sequence according to the target firmware verification order and based on the multiple keys.

8. The method according to claim 7, characterized in that Before the step of performing security verification on the plurality of firmwares to be verified in sequence according to the target firmware verification order and based on the plurality of keys if the number of the firmwares is greater than the target number, the method further comprises: If the number of firmwares is greater than the target number, the order of the historical usage frequencies from high to low is determined according to the historical usage frequencies of each of the firmwares to be verified as the verification order of the target firmwares.

9. The method according to claim 7, characterized in that: Before the step of performing security verification on the plurality of firmwares to be verified in sequence according to the target firmware verification order and based on the plurality of keys if the number of the firmwares is greater than the target number, the method further comprises: If the number of the firmware is greater than the target number, the order of the security levels from low to high is determined according to the security level of each of the firmware to be verified as the verification order of the target firmware.

10. The method according to any one of claims 1 to 5, characterized in that: During the startup process of the electronic device, the boot loading firmware is run, and before the firmware to be checked is security checked using multiple keys in the boot loading firmware, the method further includes: Obtaining the boot loader firmware; The boot loading firmware is stored in a target storage area, and the target storage area is locked, so that the content in the locked target storage area cannot be modified.

11. The method according to any one of claims 1 to 5, characterized in that: During the startup process of the electronic device, after running the boot loading firmware and using multiple keys in the boot loading firmware to perform security verification on the firmware to be verified, the method further includes: If the security check of the firmware to be checked fails, target prompt information is displayed, and the target prompt information is used to prompt that the firmware to be checked has a security problem.

12. A safety starting device, characterized in that: Applied to electronic equipment, the device comprises: A security verification module, used to run the boot loading firmware during the startup process of the electronic device, and use multiple keys in the boot loading firmware to perform security verification on the firmware to be verified; The firmware running module is used to run the firmware to be checked if the security check passes.

13. A computer device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 11.

Citation Information

Cited By

  • Hardware acceleration signature verification method based on plug-in encryption module and related equipment

    CN119885178A

  • Server firmware starting system based on distributed security module

    CN119885191A