Verification method, device and equipment for CPU (Central Processing Unit) startup mirror image packaging file and medium

By verifying the mirror during the CPU startup stage, the startup risk problem caused by the lack of mirror verification in the existing technology is solved, and mirror integrity detection and source identification are realized to ensure the normal operation of the CPU.

CN119227079APending Publication Date: 2024-12-31SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411272289.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing technology lacks mirror verification during the CPU startup stage, resulting in a high startup risk and is unable to effectively prevent mirror corruption and malicious tampering.

Method used

On the power-on startup BootROM stage on the CPU, obtain the startup image packaging file, and determine whether the verification operation is required based on the verification flag in the target memory. By verifying the public key and the mirror summary, ensure that the verification result is passed Run the boot mirror in a secure boot state.

Benefits of technology

The integrity of the startup image is detected in the first stage of the CPU, preventing the CPU from being unable to start or boot abnormalities, ensuring the CPU is running normally, and improving the check-up efficiency, preventing image corruption and malicious tampering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227079A_ABST
    Figure CN119227079A_ABST
Patent Text Reader

Abstract

The invention discloses a verification method, device and equipment for a CPU (Central Processing Unit) startup mirror image packaging file and a medium. The method comprises the following steps: when a CPU (Central Processing Unit) is electrified to start a BootROM (Read Only Memory), acquiring a startup mirror image packaging file, and judging whether a signature verification operation needs to be carried out or not according to a signature verification flag bit in a target memory; when it is determined that signature verification operation needs to be carried out, according to the starting mirror image packaging file and a target memory in a CPU, a public key and a mirror image abstract are verified, and a signature verification result is obtained; and when it is determined that the signature verification is passed according to the signature verification result, running the starting mirror image in a safe starting state. By the adoption of the technical scheme, the starting mirror image can be verified in the BootROM stage after the CPU is started, the integrity of the starting mirror image can be detected in the first stage of CPU starting, and therefore the problem that the CPU cannot be started or is started abnormally is avoided, and normal operation of the CPU is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip security technology, and in particular to a verification method, device, equipment and medium for a CPU startup image encapsulation file. Background Art

[0002] In embedded devices, if the CPU (Central Processing Unit) boot image is incomplete or maliciously tampered with, the CPU will fail to boot or start abnormally, thus endangering the normal operation of the CPU. Image signature is a digital signature technology that calculates the CPU boot image digest and embeds it into the image header field to ensure the integrity of the image. It also allows the CPU to identify the source and validity of the file. This information can be loaded on the CPU and verified when the CPU starts, thereby preventing unnecessary losses caused by image damage and malicious tampering.

[0003] In the prior art, most chip manufacturers have a relatively simple design for the BootROM startup phase of the chip. They do not add image verification in the BootROM startup phase, but add software verification in the subsequent Uboot startup phase or after the ATF startup phase. This verification method cannot cover the image verification before the Uboot startup phase or the ATF startup phase, which makes the CPU startup phase risky. Summary of the invention

[0004] The present invention provides a method, device, equipment and medium for verifying a CPU startup image encapsulation file, which can verify the startup image in the BootROM stage after the CPU is started, and can detect the integrity of the startup image in the first stage of CPU startup, thereby avoiding the problem that the CPU cannot be started or starts abnormally, and ensuring the normal operation of the CPU.

[0005] According to one aspect of the present invention, a method for verifying a CPU startup image encapsulation file is provided, characterized in that it includes:

[0006] When the CPU is powered on and the BootROM is started, the boot image encapsulation file is obtained, and the signature verification flag in the target memory is used to determine whether a signature verification operation is required;

[0007] When it is determined that a signature verification operation is required, the public key and the image digest are verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained;

[0008] When it is determined according to the signature verification result that the signature verification passes, the startup image is run in a secure startup state.

[0009] Optionally, the startup image encapsulation file includes a public key, a startup image, and an image signature.

[0010] Optionally, according to the boot image encapsulation file and the target memory in the CPU, the public key and the image digest are verified respectively, and the signature verification result is obtained, including:

[0011] Obtaining a first public key hash value according to the startup image encapsulation file, and verifying the first public key hash value and a second public key hash value in the target memory;

[0012] After determining that the public key hash value verification passes, verifying the image summary according to the startup image encapsulation file;

[0013] When it is determined that the image summary verification passes, the signature verification result is determined to be signature verification passed.

[0014] Optionally, obtaining a first public key hash value according to the startup image encapsulation file, and verifying the first public key hash value and a second public key hash value in the target memory includes:

[0015] The public key in the boot image encapsulation file is operated by the SHA256 algorithm to generate a first public key hash value, and a second public key hash value is obtained in the target memory;

[0016] Determine whether the first public key hash value and the second public key hash value are the same;

[0017] If yes, it is determined that the public key hash value verification passes; if not, the infinite loop statement is executed.

[0018] Optionally, verifying the image summary according to the startup image encapsulation file includes:

[0019] The boot image in the boot image file is operated by the SHA256 algorithm to generate a first image digest, and the image signature in the boot image file is calculated by the RSA2408 algorithm according to the public key to generate a second image digest;

[0020] Determining whether the first image digest and the second image digest are the same;

[0021] If yes, it is determined that the image summary verification passes; if not, the infinite loop statement is executed.

[0022] Optionally, after determining whether a signature verification operation is required according to the signature verification flag bit in the target memory, the method further includes:

[0023] When it is determined that the signature verification operation is not required, the boot image is run in a non-secure boot state; wherein, in the non-secure boot state, the boot image does not configure the digital signal processor DSP in the CPU; in the secure boot state, the boot image configures the target core in the DSP according to the pre-loaded configuration information.

[0024] Optionally, the boot image encapsulation file is pre-generated by a computer and stored in a target storage unit of the CPU;

[0025] The image signature in the boot image encapsulation file is calculated by the computer using the SHA256 algorithm to generate an image digest, and the image digest is encrypted and calculated using the private key and the RSA2048 algorithm.

[0026] According to another aspect of the present invention, a device for verifying a CPU startup image encapsulation file is provided, characterized in that it includes:

[0027] The signature verification operation judgment module is used to obtain the boot image encapsulation file when the CPU is powered on to start the BootROM, and determine whether the signature verification operation is required according to the signature verification flag bit in the target memory;

[0028] A verification module is used to verify the public key and the image summary according to the boot image encapsulation file and the target memory in the CPU, and obtain the signature verification result when it is determined that a signature verification operation is required;

[0029] The startup image running module is used to run the startup image in a secure startup state when it is determined that the signature verification is passed according to the signature verification result.

[0030] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0031] at least one processor; and

[0032] a memory communicatively connected to the at least one processor; wherein,

[0033] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for verifying a CPU startup image encapsulation file described in any embodiment of the present invention.

[0034] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for verifying a CPU startup image encapsulation file described in any embodiment of the present invention when executed.

[0035] The technical solution of the embodiment of the present invention obtains the boot image encapsulation file and determines whether a signature verification operation is required when the CPU is powered on to start the BootROM. When it is determined that the signature verification operation is required, the public key and the image summary are respectively verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained. When it is determined that the signature verification passes according to the signature verification result, the boot image is run in a secure boot state. The image signature can be verified in the first stage after the CPU is powered on, that is, the BootROM stage, thereby ensuring the integrity of the boot image. At the same time, the CPU can also identify the source and validity of the boot image, improve the signature verification efficiency, effectively prevent image damage and malicious tampering from causing unnecessary losses, and ensure that the CPU can operate normally.

[0036] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 This is a flowchart of a method for verifying a CPU startup image encapsulation file provided according to Embodiment 1 of the present invention;

[0039] Figure 2 is a flow chart of generating an image signature according to an embodiment of the present invention;

[0040] Figure 3 is a schematic diagram of the structure of a startup image encapsulation file provided according to an embodiment of the present invention;

[0041] Figure 4 is a flowchart of another method for verifying a CPU startup image encapsulation file provided according to Embodiment 2 of the present invention;

[0042] Figure 5 A flowchart of verifying a CPU boot image encapsulation file provided according to an embodiment of the present invention;

[0043] Figure 6 It is a structural schematic diagram of a verification device for a CPU startup image encapsulation file provided according to Embodiment 3 of the present invention;

[0044] Figure 7 The present invention is a schematic diagram of the structure of an electronic device for implementing the verification method of the CPU startup image encapsulation file according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. 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 device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0047] Embodiment 1

[0048] Figure 1 This is a flow chart of a method for verifying a CPU boot image package file provided in the first embodiment of the present invention. This embodiment is applicable to the case where the boot image package file is verified in the BootROM stage after the CPU is started. The method can be executed by a CPU boot image package file verification device. The CPU boot image package file verification device can be implemented in the form of hardware and / or software and can generally be configured in the CPU. Figure 1 As shown, the method includes:

[0049] S110: When the CPU is powered on and the BootROM is started, the boot image encapsulation file is obtained, and it is determined whether a signature verification operation is required according to the signature verification flag bit in the target memory.

[0050] Optionally, the startup image encapsulation file includes a public key, a startup image, and an image signature.

[0051] Optionally, the boot image encapsulation file is generally generated by the developer in advance on the PC (Personal Computer), and then the boot image encapsulation file is copied to the storage unit in the CPU. During the startup phase of the CPU, the boot image encapsulation file is directly read from the storage unit of the CPU and verified.

[0052] Optionally, the target memory may be an eFuse in the CPU. The eFuse is a one-time programmable memory into which chip-related information will be written before the chip is shipped.

[0053] Optionally, BootROM (Boot Read-Only-Memory) stores the first program executed when the CPU is powered on or reset. This program is burned when the CPU leaves the factory and is an unmodifiable code. This program can be used to initialize the security mechanism.

[0054] Optionally, the signature verification flag may be represented in binary. For example, when the signature verification flag is 1, it is determined that a signature verification operation is required, and when the signature verification flag is 0, no signature verification operation is required.

[0055] Optionally, if the signature verification operation is not required, the signature verification process is skipped, and the first status word is written at the boot mode status word address of the SRAM (static random access memory) to control the boot image to run in a non-secure boot state. In the CPU, the boot image can be the bl1.bin file in the boot image package file. The bl1.bin file can be used to initialize other hardware devices on the PCB (Printed Circuit Board), map memory space to the external RAM (Random Access Memory), load verification from the external storage medium, and execute the next boot program.

[0056] Optionally, in a non-secure boot state, the boot image does not perform any configuration on the DSP (Digital Signal Processing, digital signal processor), and all DSPs are enabled by default.

[0057] S120: When it is determined that a signature verification operation is required, the public key and the image digest are verified according to the boot image encapsulation file and the target memory in the CPU, and a signature verification result is obtained.

[0058] Optionally, after the signature verification flag in uFuse determines that a signature verification operation is required, you need to close CMD (Commander) first, and then verify the image signature. CMD is a human-computer interaction interface. Operators can enter commands through CMD to obtain and modify the version, status, and parameters of the CPU, RAM, ROM (Read-Only Memory), and CPU peripheral devices. The purpose of closing the CMD operation interface is to increase the security of the chip.

[0059] Optionally, in the process of verifying the image signature, the public key is verified first. When the public key verification passes, the image summary is verified. When both the public key and the image summary are verified, the signature verification result is determined to be passed. Otherwise, the signature verification result is determined to be failed.

[0060] Figure 2 This is an optional image signature generation flow chart. Figure 2 As shown, IMG is an unsigned boot image file. The SHA256 algorithm is executed on IMG to generate IMG_DIGEST, which is the image summary. After obtaining the image summary, the private key CHIP_DS_PRIV_KEY is used to encrypt IMG_DIGEST with RSA2048 to generate IMG_DS, which is the image signature.

[0061] Optionally, after the PC encrypts the image digest with the private key CHIP_DS_PRIV_KEY, it needs to use the corresponding public key to decrypt it during the CPU startup phase.

[0062] Optionally, after obtaining the image signature, the PC encapsulates the image signature, the boot image, the public key corresponding to the private key CHIP_DS_PRIV_KEY, and other configuration information into a boot image encapsulation file, and copies it to a storage unit in the CPU before the CPU starts.

[0063] Figure 3 This is a schematic diagram of the structure of an optional boot image encapsulation file. Figure 3 As shown in the figure, CHIP_DS_PUB_KEY indicates the public key used to encrypt the image summary, and the size of the public key is 512b. IMG_DS indicates the image signature, and the size of the image signature is 256b. pad, bl1.bin crc, and bl1 size are all configuration information, and bl1.bin is the image signature file.

[0064] Optionally, a hash value of the public key is pre-stored in the target memory eFuse. Since the public key is directly stored in the boot image encapsulation file, it is necessary to first perform a hash operation on the public key using SHA256, and compare the operation result with the public key hash value stored in the target memory. If they are equal, it is determined that the public key hash value verification has passed, and the public key in the target memory can be used to decrypt the image signature. If they are not equal, the verification fails. At this time, the CPU is stopped at while(1). while(1) is an infinite loop statement. Executing while(1) is equivalent to the CPU not executing any tasks or operating any CPU peripheral devices, thereby avoiding damage to the hardware.

[0065] Optionally, after the public key hash value verification is successful, the image signature and the boot image can be obtained from the boot image encapsulation file, the boot image is normally calculated using SHA256, the image signature is reversely calculated using the public key and RSA2048, the image digests corresponding to the boot image and the image signature are calculated respectively, and it is determined whether the two image digests are the same. If they are the same, it means that the boot image matches the image signature, and the signature verification result is determined to be passed. Otherwise, it is determined that the signature verification has failed, and the while(1) statement is executed.

[0066] S130: When it is determined according to the signature verification result that the signature verification passes, the boot image is run in a secure boot state.

[0067] Optionally, after determining that the signature verification has passed, a second status word is written at the boot mode status word address of the SRAM to control the boot image to run in a secure boot state. In the secure boot state, the boot image can determine the target DSP core to be shut down according to the configuration information in the boot image encapsulation file, and shut down the target DSP core.

[0068] The technical solution of the embodiment of the present invention obtains the boot image encapsulation file and determines whether a signature verification operation is required when the CPU is powered on to start the BootROM. When it is determined that the signature verification operation is required, the public key and the image summary are respectively verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained. When it is determined that the signature verification passes according to the signature verification result, the boot image is run in a secure boot state. The image signature can be verified in the first stage after the CPU is powered on, that is, the BootROM stage, thereby ensuring the integrity of the boot image. At the same time, the CPU can also identify the source and validity of the boot image, improve the signature verification efficiency, effectively prevent image damage and malicious tampering from causing unnecessary losses, and ensure that the CPU can operate normally.

[0069] Embodiment 2

[0070] Figure 4This is a flow chart of a method for verifying a CPU boot image package file provided by Embodiment 2 of the present invention. Based on the above embodiments, this embodiment specifically describes a method for verifying a CPU boot image package file. Figure 4 As shown, the method includes:

[0071] S210, when the CPU is powered on and the BootROM is started, the boot image encapsulation file is obtained, and it is determined whether a signature verification operation is required according to the signature verification flag in the target memory; if so, step S220 is executed; if not, step S250 is executed.

[0072] Optionally, the boot image encapsulation file is pre-generated by a computer and stored in a target storage unit of the CPU;

[0073] The image signature in the startup image encapsulation file is calculated by the computer using the SHA256 algorithm to generate an image digest, and the image digest is encrypted and calculated using the private key and the RSA2048 algorithm.

[0074] S220: When it is determined that a signature verification operation is required, obtain the first public key hash value according to the startup image encapsulation file, and verify the first public key hash value and the second public key hash value in the target memory.

[0075] Optionally, obtaining a first public key hash value according to the startup image encapsulation file, and verifying the first public key hash value and a second public key hash value in the target memory includes:

[0076] The public key in the boot image encapsulation file is operated by the SHA256 algorithm to generate a first public key hash value, and a second public key hash value is obtained in the target memory;

[0077] Determine whether the first public key hash value and the second public key hash value are the same;

[0078] If yes, it is determined that the public key hash value verification passes; if not, the infinite loop statement is executed.

[0079] Figure 5 This is a flow chart for checking an optional CPU boot image package file. Figure 5 As shown in the figure, the data to be verified is the boot image encapsulation file, CHIP_DS_PUB_KEY indicates the public key used to encrypt the image summary, IMG_DS indicates the image signature, IMG indicates the image signature, and pad+dsp enable+bl1 size are all configuration information.

[0080] exist Figure 5In the example shown, CHIP_DS_PUB_KEY_HSH′ obtained by performing hash calculation according to CHIP_DS_PUB_KEY may represent the first public key hash value, and CHIP_DS_PUB_KEY_HSH stored in the eFuse may represent the second public key hash value.

[0081] S230: After determining that the public key hash value verification passes, verify the image summary according to the startup image encapsulation file.

[0082] Optionally, verifying the image summary according to the startup image encapsulation file includes:

[0083] The boot image in the boot image file is operated by the SHA256 algorithm to generate a first image digest, and the image signature in the boot image file is calculated by the RSA2408 algorithm according to the public key to generate a second image digest;

[0084] Determining whether the first image digest and the second image digest are the same;

[0085] If yes, it is determined that the image summary verification passes; if not, the infinite loop statement is executed.

[0086] In such Figure 5 In the example shown, IMG_DIGEST' obtained by performing RSA2048 calculation based on IMG_DS can represent the second image digest, and IMG_DIGEST obtained by performing SHA256 calculation based on IMG can represent the first image digest.

[0087] S240. When it is determined that the image digest verification passes, the signature verification result is determined to be signature verification passed; and step S260 is executed.

[0088] S250: When it is determined that the signature verification operation is not required, the boot image is run in a non-secure boot state.

[0089] Optionally, in a non-secure boot state, the boot image does not configure the digital signal processor DSP in the CPU.

[0090] S260: When it is determined according to the signature verification result that the signature verification passes, the boot image is run in a secure boot state.

[0091] Optionally, in the secure boot state, the boot image configures the target core in the DSP according to the pre-loaded configuration information.

[0092] In such Figure 5 In the example shown, the target core to be configured in the DSP can be determined in the corresponding field in dsp enable in the startup image encapsulation file, and the target core can be turned off.

[0093] The technical solution of the embodiment of the present invention obtains the boot image encapsulation file and determines whether a signature verification operation is required when the CPU is powered on to start the BootROM. When it is determined that the signature verification operation is required, the public key and the image summary are respectively verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained. When it is determined that the signature verification passes according to the signature verification result, the boot image is run in a secure boot state. The image signature can be verified in the first stage after the CPU is powered on, that is, the BootROM stage, thereby ensuring the integrity of the boot image. At the same time, the CPU can also identify the source and validity of the boot image, improve the signature verification efficiency, effectively prevent image damage and malicious tampering from causing unnecessary losses, and ensure that the CPU can operate normally.

[0094] Embodiment 3

[0095] Figure 6 A schematic diagram of a CPU boot image package file verification device provided in Embodiment 3 of the present invention. Figure 6 As shown, the device includes: a signature verification operation judgment module 310, a verification module 320 and a boot image running module 330.

[0096] The signature verification operation determination module 310 is used to obtain the boot image encapsulation file when the CPU is powered on to start the BootROM, and determine whether a signature verification operation is required according to the signature verification flag bit in the target memory.

[0097] The verification module 320 is used to verify the public key and the image digest according to the boot image encapsulation file and the target memory in the CPU, and obtain the signature verification result when it is determined that the signature verification operation needs to be performed.

[0098] The startup image running module 330 is used to run the startup image in a secure startup state when it is determined that the signature verification is passed according to the signature verification result.

[0099] The technical solution of the embodiment of the present invention obtains the boot image encapsulation file and determines whether a signature verification operation is required when the CPU is powered on to start the BootROM. When it is determined that the signature verification operation is required, the public key and the image summary are respectively verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained. When it is determined that the signature verification passes according to the signature verification result, the boot image is run in a secure boot state. The image signature can be verified in the first stage after the CPU is powered on, that is, the BootROM stage, thereby ensuring the integrity of the boot image. At the same time, the CPU can also identify the source and validity of the boot image, improve the signature verification efficiency, effectively prevent image damage and malicious tampering from causing unnecessary losses, and ensure that the CPU can operate normally.

[0100] Based on the above embodiments, the startup image encapsulation file includes a public key, a startup image and an image signature.

[0101] Based on the above embodiments, the verification module 320 may include:

[0102] A hash value verification unit, configured to obtain a first public key hash value according to the boot image encapsulation file, and verify the first public key hash value and a second public key hash value in the target memory;

[0103] An image summary verification unit, configured to verify the image summary according to the startup image encapsulation file after determining that the public key hash value verification passes;

[0104] The signature verification result determining unit is used to determine that the signature verification result is passed when it is determined that the image digest verification passes.

[0105] Based on the above embodiments, the hash value verification unit can be specifically used for:

[0106] The public key in the boot image encapsulation file is operated by the SHA256 algorithm to generate a first public key hash value, and a second public key hash value is obtained in the target memory;

[0107] Determine whether the first public key hash value and the second public key hash value are the same;

[0108] If yes, it is determined that the public key hash value verification passes; if not, the infinite loop statement is executed.

[0109] Based on the above embodiments, the image summary verification unit may be specifically used for:

[0110] The boot image in the boot image file is operated by the SHA256 algorithm to generate a first image digest, and the image signature in the boot image file is calculated by the RSA2408 algorithm according to the public key to generate a second image digest;

[0111] Determining whether the first image digest and the second image digest are the same;

[0112] If yes, it is determined that the image summary verification passes; if not, the infinite loop statement is executed.

[0113] On the basis of the above embodiments, a non-safe startup state operation module may also be included, which is specifically used to:

[0114] When it is determined that the signature verification operation is not required, the boot image is run in a non-secure boot state; wherein, in the non-secure boot state, the boot image does not configure the digital signal processor DSP in the CPU; in the secure boot state, the boot image configures the target core in the DSP according to the pre-loaded configuration information.

[0115] On the basis of the above embodiments, the boot image encapsulation file is pre-generated by a computer and stored in a target storage unit of a CPU;

[0116] The image signature in the boot image encapsulation file is calculated by the computer using the SHA256 algorithm to generate an image digest, and the image digest is encrypted and calculated using the private key and the RSA2048 algorithm.

[0117] The CPU boot image package file verification device provided in the embodiment of the present invention can execute the CPU boot image package file verification method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0118] Embodiment 4

[0119] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0120] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0121] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0122] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as the CPU startup image packaging file verification method. That is:

[0123] When the CPU is powered on and the BootROM is started, the boot image encapsulation file is obtained, and the signature verification flag in the target memory is used to determine whether a signature verification operation is required;

[0124] When it is determined that a signature verification operation is required, the public key and the image digest are verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained;

[0125] When it is determined according to the signature verification result that the signature verification passes, the startup image is run in a secure startup state.

[0126] In some embodiments, the verification method of the CPU boot image encapsulation file can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the verification method of the CPU boot image encapsulation file described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the verification method of the CPU boot image encapsulation file in any other appropriate manner (for example, by means of firmware).

[0127] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0128] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0129] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0130] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0131] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0132] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0133] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0134] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for verifying a central processing unit (CPU) boot image package file, characterized in that: include: When the CPU is powered on and the BootROM is started, the boot image encapsulation file is obtained, and the signature verification flag in the target memory is used to determine whether a signature verification operation is required; When it is determined that a signature verification operation is required, the public key and the image digest are verified according to the boot image encapsulation file and the target memory in the CPU, and the signature verification result is obtained; When it is determined according to the signature verification result that the signature verification passes, the startup image is run in a secure startup state.

2. The method according to claim 1, characterized in that: The startup image encapsulation file includes a public key, a startup image, and an image signature.

3. The method according to claim 2, characterized in that According to the boot image encapsulation file and the target memory in the CPU, the public key and the image summary are verified respectively, and the signature verification result is obtained, including: Obtaining a first public key hash value according to the startup image encapsulation file, and verifying the first public key hash value and a second public key hash value in the target memory; After determining that the public key hash value verification passes, verifying the image summary according to the startup image encapsulation file; When it is determined that the image summary verification passes, the signature verification result is determined to be signature verification passed.

4. The method according to claim 3, characterized in that According to the boot image encapsulation file, obtaining a first public key hash value, and verifying the first public key hash value and a second public key hash value in the target memory, including: The public key in the boot image encapsulation file is operated by the SHA256 algorithm to generate a first public key hash value, and a second public key hash value is obtained in the target memory; Determine whether the first public key hash value and the second public key hash value are the same; If yes, it is determined that the public key hash value verification passes; if not, the infinite loop statement is executed.

5. The method according to claim 3, characterized in that: According to the boot image encapsulation file, the image summary is verified, including: The boot image in the boot image file is operated by the SHA256 algorithm to generate a first image digest, and the image signature in the boot image file is calculated by the RSA2408 algorithm according to the public key to generate a second image digest; Determining whether the first image digest and the second image digest are the same; If yes, it is determined that the image summary verification passes; if not, the infinite loop statement is executed.

6. The method according to claim 1, characterized in that After determining whether a signature verification operation is required according to the signature verification flag bit in the target memory, the method further includes: When it is determined that the signature verification operation is not required, the boot image is run in a non-secure boot state; wherein, in the non-secure boot state, the boot image does not configure the digital signal processor DSP in the CPU; in the secure boot state, the boot image configures the target core in the DSP according to the pre-loaded configuration information.

7. The method according to any one of claims 2 to 5, characterized in that: The boot image encapsulation file is pre-generated by the computer and stored in the target storage unit of the CPU; The image signature in the startup image encapsulation file is calculated by the computer using the SHA256 algorithm to generate an image digest, and the image digest is encrypted and calculated using the private key and the RSA2048 algorithm.

8. A CPU boot image package file verification device, characterized in that: include: The signature verification operation judgment module is used to obtain the boot image encapsulation file when the CPU is powered on to start the BootROM, and determine whether the signature verification operation is required according to the signature verification flag bit in the target memory; A verification module is used to verify the public key and the image summary according to the boot image encapsulation file and the target memory in the CPU when it is determined that a signature verification operation is required, and obtain a signature verification result; The startup image running module is used to run the startup image in a secure startup state when it is determined that the signature verification is passed according to the signature verification result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for verifying a CPU startup image encapsulation file according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for verifying a CPU startup image encapsulation file according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • Embedded device management and control method and electronic device

    CN121579033A