Kernel image verification methods, devices, electronic equipment, and storage media
By introducing a central server in embedded devices to remotely sign and verify kernel images, the problems of high computational load and inflexible deployment during the secure boot process of embedded devices are solved, achieving an efficient secure boot process and improving device performance and communication security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2026-04-03
AI Technical Summary
Existing secure boot mechanisms for embedded devices rely on local image signature verification, resulting in heavy computational load, prolonged boot time, degraded device performance, and poor deployment flexibility.
A central server is introduced to perform kernel image signature verification. A symmetric encryption mechanism using the verification public key and the signing private key is used to perform remote verification by receiving sampling data from embedded devices and signing node information, thereby reducing the local computing burden.
It significantly improves the secure boot efficiency of embedded devices, reduces boot time, enhances device performance, optimizes network bandwidth usage, and ensures communication security and authentication reliability.
Smart Images

Figure CN119646813B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded operating system technology, and in particular to a method, apparatus, electronic device, and storage medium for verifying kernel images. Background Technology
[0002] Secure Boot refers to the process and mechanism that ensures the integrity of programs running on a platform. The Secure Boot process establishes a trust relationship between the firmware and applications. When Secure Boot is enabled, unverified kernel image files cannot be loaded onto the device, thus protecting subsequent operating systems built upon those kernel image files from malicious attacks.
[0003] Existing secure boot mechanisms for embedded devices rely on local image signature verification, which typically involves complex asymmetric encryption algorithms. These operations are computationally demanding for resource-constrained embedded devices, leading to prolonged boot times and degraded device performance. Summary of the Invention
[0004] This invention provides a kernel image verification method, apparatus, electronic device, and storage medium to improve the efficiency of embedded devices during secure boot, reduce boot time, and improve device performance.
[0005] This invention provides a kernel image verification method, applied to a central server, comprising the following steps:
[0006] The device receives kernel image sampling data and kernel image signature node information sent by an embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signature node information is obtained by the embedded device signing the sampled hash data based on its signature private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, which is a kernel image file obtained during the production process of the embedded device.
[0007] Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the kernel image file verification process is executed, and the obtained verification result is sent to the embedded device; wherein, the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0008] According to a kernel image verification method provided by the present invention, based on the kernel image sampling data, the kernel image signature node information, and the signature verification public key, the verification process of the kernel image file is performed, including:
[0009] Based on the signature verification public key, the kernel image signature node information is verified to obtain the sampled hash data;
[0010] The target hash value is obtained by performing a hash calculation on the kernel image sample data;
[0011] The target hash value is compared with the sampled hash data, and the verification result of the kernel image file is determined based on the comparison result.
[0012] According to a kernel image verification method provided by the present invention, before receiving kernel image sampling data and kernel image signature node information sent by an embedded device, the method further includes:
[0013] The first authentication request message is received and decrypted based on the symmetric key shared with the embedded device. The first authentication request message is generated by encrypting the device identifier of the embedded device and a first random number randomly generated by the embedded device.
[0014] The embedded device's identity is authenticated based on the decrypted information. After successful authentication, the first random number and a randomly generated second random number are encrypted using the symmetric key to generate a return message, which is then sent to the embedded device. Upon receiving the return message, the embedded device decrypts it using the symmetric key and verifies the first random number obtained after decryption. If the verification is successful, the second random number obtained after decryption is encrypted using the symmetric key to generate a second authentication request message, which is then sent to the central server.
[0015] The system receives the second authentication request message, decrypts the second authentication request message based on the symmetric key, and verifies the second random number obtained after decryption to authenticate the central server.
[0016] This invention also provides a method for verifying a kernel image, applied to embedded devices, comprising the following steps:
[0017] The kernel image sampling data and kernel image signing node information are sent to the central server. The central server, based on the received kernel image sampling data and kernel image signing node information, and a verification public key pre-stored in its storage space, performs a kernel image file verification process and sends the verification result to the embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device using a signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key.
[0018] Receive the verification result sent by the central server.
[0019] According to a kernel image verification method provided by the present invention, the process of determining the kernel image sampling data includes:
[0020] Determine multiple nodes in the tree data structure of the kernel image file, where each node corresponds to a type of data in the kernel image file;
[0021] Based on a preset sampling ratio, data is sampled from the data corresponding to each node to obtain multiple sampled encoding sequences;
[0022] The sampled encoding sequences are merged to obtain the kernel image sampled data.
[0023] According to a kernel image verification method provided by the present invention, before sampling data from the kernel image file loaded during the secure boot process of the embedded device, the method further includes:
[0024] Based on the symmetric key shared with the central server, mutual authentication with the central server is performed, and authentication is confirmed to be successful.
[0025] This invention also provides a kernel image verification device, applied to a central server, comprising the following modules:
[0026] A receiving module is used to receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device;
[0027] The verification module is used to perform the verification process of the kernel image file based on the kernel image sampling data, the kernel image signing node information, and the verification public key, and send the obtained verification result to the embedded device; wherein, the verification public key is pre-stored in the storage space of the central server, and the verification public key corresponds to the signing private key.
[0028] The present invention also provides a kernel image verification device for embedded devices, comprising the following modules:
[0029] The sending module is used to send kernel image sampling data and kernel image signing node information to the central server, so that the central server, based on the received kernel image sampling data and kernel image signing node information, and the verification public key pre-stored in the central server's storage space, performs a kernel image file verification process and sends the obtained verification result to the embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device based on the signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key.
[0030] The receiving module is used to receive the verification result sent by the central server.
[0031] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the verification method of the kernel image as described above.
[0032] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the verification method of the kernel image as described above.
[0033] The kernel image verification method, apparatus, electronic device, and storage medium provided by this invention establish a central server. Based on the kernel image sampling data and kernel image signature node information received from the embedded device, as well as the signature verification public key stored in the central server's storage space, the kernel image file loaded by the embedded device is verified. This offloads the signature verification task of the kernel image file during the secure boot process of the embedded device, significantly improving the efficiency of the embedded device during secure boot, reducing boot time, and enhancing device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure secure communication and reliable identity authentication between the embedded device and the central server. Simultaneously, image verification is performed using sampling data extracted from the image, rather than transmitting the complete image or large blocks of data, thereby optimizing network bandwidth usage. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0035] Figure 1 This is a schematic diagram of the conceptual process for secure boot provided by the relevant methods.
[0036] Figure 2 This is a schematic diagram of the secure boot process for embedded devices provided by the relevant methods.
[0037] Figure 3 This is a schematic diagram of the Secure Boot (RoT) process provided by the relevant methods.
[0038] Figure 4 This is a schematic diagram of the CoT phase process provided by the relevant method.
[0039] Figure 5 This is a schematic diagram illustrating the generation process of the FIT format kernel image provided by the relevant methods.
[0040] Figure 6 This is one of the flowcharts illustrating the kernel image verification method provided by this invention.
[0041] Figure 7 This is a schematic diagram of the kernel image file verification process provided by the present invention.
[0042] Figure 8 This is a schematic diagram of mutual authentication provided by the present invention.
[0043] Figure 9 This is the second flowchart of the kernel image verification method provided by the present invention.
[0044] Figure 10 This is a schematic diagram of the authentication public key embedding and registration process provided by the present invention.
[0045] Figure 11 This is a schematic diagram of the image signature node generation process provided by the present invention.
[0046] Figure 12 This is a sampling diagram provided by the present invention.
[0047] Figure 13 This is one of the structural schematic diagrams of the kernel image verification device provided by the present invention.
[0048] Figure 14 This is the second schematic diagram of the structure of the kernel image verification device provided by the present invention.
[0049] Figure 15 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0051] Secure Boot is the process and mechanism that ensures the integrity of programs running on a platform. Secure Boot establishes a trust relationship between the firmware and applications. When Secure Boot is enabled, unsigned firmware or programs will not be able to run on the device. In this way, the operating system running on it is protected from malicious attacks; that is, the operating system is trusted and has not been maliciously tampered with. Secure Boot typically uses asymmetric encryption systems to verify the legitimacy of the firmware and application signatures. The basic concepts can be summarized as follows: Figure 1 The conceptual flowchart of the secure boot process provided by the relevant method is shown in the figure. In Secure Boot, the hardware is first verified and loaded, and then the operating system kernel and applications are verified and loaded based on the system software Bootloader.
[0052] Specifically for embedded devices, the startup process is as follows: Figure 2 The schematic diagram of the secure boot process for embedded devices provided by the relevant methods shows that the boot process generally starts from bootrom and loads spl, uboot, linux, and applications level by level. In this boot process, when each boot program loads the next level boot image, it implements the image verification and authentication function, which can be described as secure boot.
[0053] In related methods, secure booting of embedded devices is divided into two phases: Root of Trust (RoT) and Software Chain of Trust (CoT). During secure boot, the system begins by starting with a pre-trusted root RoT. The RoT is typically embedded in hardware and only trusts the certified bootloader. As the boot process progresses, each step verifies the signature of the code to be loaded. Only when the digital signature of the code matches the public key stored in the device will the system continue loading the next piece of code. The subsequent CoT involves the Secondary Program Loader (spl) verifying the signature of the U-BOOT image and U-BOOT verifying the signature of the kernel image.
[0054] The secure boot (RoT) process for embedded devices is as follows: Figure 3 As shown in the schematic diagram of the secure boot RoT process provided by the relevant method, the signed spl image is stored in spl or eMMC memory, and the public key used for verification is stored in one-time programmable (OTP) memory. After the device is powered on, the firmware on the device uses this verification public key to perform verification operation on the loaded spl image. If the verification is successful, the spl is started. This is the general process of RoT.
[0055] According to the device boot process, CoT is divided into two stages: the spl stage for booting U-Boot and the u-boot stage for booting the Kernel.
[0056] CoT functions such as Figure 4 The CoT phase flowchart provided by the relevant method is shown in the figure.
[0057] u-boot defines the FIT (Flattened Image Tree) image format, under which nodes can be added with signature attributes and other information, providing conditions for image signature verification.
[0058] For the u-boot signature verification kernel image part, the kernel image must be in FIT format and signed with a private key, while the corresponding signature verification public key is stored in the u-boot device tree file.
[0059] For the spl signature verification of the u-boot image, the u-boot image must be in FIT format and signed with a private key, while the corresponding signature verification public key is stored in the spl device tree file.
[0060] The Secure Boot (CoT) phase involves three boot entities (spl, u-boot, and Kernel). The images to be securely booted are the u-boot and Kernel images. In the context of Secure Boot (CoT), building these two images means adding signature information to them. The generation process for the FIT format Kernel image is as follows: Figure 5 The diagram illustrates the generation process of the FIT format kernel image provided by the relevant methods.
[0061] After the kernel is compiled from source code, it outputs the kernel binary file, device tree file, and rootfs root filesystem. To generate a FIT format kernel image, an .its file needs to be written to describe the contents of the FIT image. Once the relevant .its file and all the compiled kernel files are ready, the `mkimage` tool included with the u-boot project is used. Taking these files as input, it outputs a kernel FIT image. Depending on the `mkimage` options configured, the image may not yet be signed. When signing the FIT image using the `mkimage` tool, a key pair for signing and verification must be prepared in advance. Taking this key pair and the FIT image as input, and setting the appropriate `mkimage` options, it outputs a FIT image with a signing node added and adds the verification public key to the specified u-boot device tree file.
[0062] The drawback of the relevant methods is that:
[0063] High computational load: Secure boot mechanisms rely on local image signature verification on the embedded device, which typically involves complex asymmetric encryption algorithms. These operations place a heavy computational load on resource-constrained embedded devices (such as industrial controllers), leading to prolonged boot times and degraded device performance.
[0064] Poor deployment flexibility: During secure boot, embedded devices typically have their boot images and corresponding verification data fixed during the production phase. This means that if the image needs to be updated or replaced, the device must be reconfigured or redeployed. This approach lacks flexibility, especially in environments requiring frequent updates or maintenance, leading to cumbersome and error-prone operations.
[0065] To address the shortcomings of related methods, this invention proposes a kernel image verification method. Figure 6 This is one of the flowcharts illustrating the kernel image verification method provided by the present invention, see reference. Figure 6 The kernel image verification method provided by this invention is applied to a central server, and the method includes the following steps:
[0066] Step 610: Receive kernel image sampling data and kernel image signature node information sent by the embedded device; wherein, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device;
[0067] Step 620: Based on the kernel image sampling data, the kernel image signing node information, and the verification public key, perform the verification process of the kernel image file and send the obtained verification result to the embedded device; wherein, the verification public key is pre-stored in the storage space of the central server, and the verification public key corresponds to the signing private key.
[0068] The central server in this invention is pre-configured and located on the same local area network as the embedded device, and is used to handle the signature verification task of the kernel image.
[0069] The following section uses the verification method of the kernel image provided by this invention executed by the central server as an example to explain the technical solution of this invention in detail.
[0070] In step 610, the embedded device sends kernel image sampling data and kernel image signature node information; wherein, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device.
[0071] In the process of secure booting, the kernel image file refers to the executable code containing the operating system kernel.
[0072] The kernel image file can be a FIT format kernel image. FIT format is a structured tree data structure containing multiple nodes, each typically storing a specific type of data. Common nodes include:
[0073] The / images node contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0074] The / configurations node contains startup configurations and points to the specific image data.
[0075] The / signatures node contains signature information used to verify the integrity of the image.
[0076] After obtaining the kernel image file, the bootloader of an embedded device samples the kernel image file. This sampling is done to extract representative bit strings from the kernel image file, effectively reflecting the entire kernel image file.
[0077] It's important to note that the signing private key and the verification public key are a pair of keys in cryptography, playing a crucial role in secure boot and software verification. The signing private key is used to digitally sign the software image (such as a FIT format kernel image). The verification public key, the public key corresponding to the signing private key, is pre-stored on a central server and used by the central server to verify the digital signature of the software image. This key pair ensures that the kernel image file has not been tampered with during distribution and confirms that the software image was signed by a trusted entity holding the private key. Because the holder of the signing private key is unique, the signature serves as proof of the software's origin, and the holder cannot deny their signing.
[0078] After determining the kernel image sampling data, the kernel image sampling data and the kernel image signature node information obtained from the embedded device's storage space are sent to the central server.
[0079] The kernel image signature node information is determined in advance during the embedded device manufacturing process and then stored in the embedded device's storage space.
[0080] The specific process for determining kernel image signature node information can be as follows:
[0081] During the manufacturing process of embedded devices, secure kernel image files are produced. These secure kernel image files are kernel image files that have undergone security certification and can be used in the subsequent secure boot process.
[0082] After obtaining the secure kernel image file, data sampling is performed on the secure kernel image file to obtain kernel image sampling data of the secure kernel image file. Then, hash calculation is performed on the kernel image sampling data of the secure kernel image file to obtain sampling hash data.
[0083] After obtaining the sampled hash data, the sampled hash data is signed based on the signing private key to obtain the kernel image signing node information.
[0084] Understandably, due to the heavy workload and high resource consumption of asymmetric encryption and the verification process, a central server can be pre-set in the local area network of the embedded device to handle the signature verification task of the kernel image file. This distributed verification mechanism can significantly reduce the computational load on the embedded device. The central server pre-stores the signature verification public key in its storage space.
[0085] After obtaining the kernel image signature node information and kernel image sampling data, the bootloader of the embedded device sends the kernel image signature node information and kernel image sampling data to the central server.
[0086] The central server receives kernel image signature node information and kernel image sampling data sent by the embedded device.
[0087] In step 620, based on the kernel image sampling data, the kernel image signing node information, and the verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein, the verification public key is pre-stored in the storage space of the central server, and the verification public key corresponds to the signing private key.
[0088] The central server receives kernel image signing node information and kernel image sampling data. Based on the kernel image sampling data, kernel image signing node information, and pre-stored verification public key, the kernel image file verification process is implemented.
[0089] Optionally, the specific verification process may include:
[0090] Based on the signature verification public key, the signature node information of the kernel image is verified to obtain sampled hash data; the sampled kernel image data is hashed to obtain the target hash value; the target hash value is compared with the sampled hash data, and the verification result of the kernel image file is determined based on the comparison result.
[0091] After determining the verification result, the central service sends the verification result to the embedded device so that the embedded device's bootloader can execute the subsequent secure boot process based on the verification result.
[0092] The kernel image verification method provided by this invention establishes a central server. Based on the kernel image sampling data and kernel image signature node information received from the embedded device, as well as the signature verification public key stored in the central server's storage space, the method verifies the kernel image file loaded by the embedded device. This offloads the signature verification task of the kernel image file during the secure boot process of the embedded device, significantly improving the efficiency of the embedded device during secure boot, reducing boot time, and enhancing device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure secure communication and reliable authentication between them. Simultaneously, image verification is performed using sampling data extracted from the image, rather than transmitting the complete image or large blocks of data, thereby optimizing network bandwidth usage.
[0093] In one embodiment, the verification process of the kernel image file is performed based on the kernel image sampling data, the kernel image signing node information, and the verification public key, including: verifying the kernel image signing node information based on the verification public key to obtain the sampling hash data; performing hash calculation on the kernel image sampling data to obtain a target hash value; comparing the target hash value with the sampling hash data, and determining the verification result of the kernel image file based on the comparison result.
[0094] Optionally, the specific verification process can be as follows: Figure 7 The kernel image file verification process provided by this invention is illustrated in the diagram. The specific process is as follows:
[0095] Generation of kernel image sampling data: The bootloader of the embedded device loads the kernel image file and extracts kernel image sampling data from the image according to predefined rules:
[0096] ;
[0097] in, Sampling data for the kernel image, This is a kernel image file.
[0098] In this step, kernel image sampling data bits are bit sequences extracted from the image according to a specific algorithm or predetermined positions, and are used for subsequent verification processes.
[0099] The bootloader of an embedded device determines the kernel image signature node information, signature_node, from the kernel image file. This kernel image signature node information also contains metadata related to signature data and signature algorithms.
[0100] The bootloader of the embedded device packages the following data and transmits it to the central server via an encrypted channel:
[0101] ;
[0102] in, For encrypted packaged data, It is a symmetric key shared between the embedded device and the central server, used to encrypt transmitted data and ensure that the data is not tampered with or stolen during transmission.
[0103] The verification process of the central server is as follows:
[0104] Extract the signature verification public key:
[0105] The central server retrieves the public key (public_key_certificate) associated with the kernel image file from the local database or secure storage.
[0106] Verify signature:
[0107] The central server uses `public_key_certificate` to verify the kernel image signature node information `signature_node`. The verification process yields sampled hash data. :
[0108] The Verify function is the core of the signature verification operation, used to decrypt the signature data and calculate its hash value.
[0109] Calculate the target hash value of the kernel image sampled data:
[0110] The central server samples kernel image data received from embedded devices. Calculate its target hash value :
[0111] ;
[0112] Compare hash values:
[0113] The central server will and The two are compared. If they match, it means that the kernel image file and the signing node data are complete and have not been tampered with.
[0114] ;
[0115] If the comparison results match, the verification is successful, and the central server can return a verification success message:
[0116] ;
[0117] If the comparison fails, a verification failure message will be returned:
[0118] ;
[0119] In one embodiment, before receiving kernel image sampling data and kernel image signature node information sent by the embedded device, the method further includes: receiving a first authentication request message and decrypting the received first authentication request message based on a symmetric key shared with the embedded device, wherein the first authentication request message is generated by encrypting the device identifier of the embedded device and a first random number randomly generated by the embedded device; authenticating the identity of the embedded device based on the decrypted information, and after successful authentication, encrypting the first random number and a second randomly generated random number based on the symmetric key to generate a return message, and sending the return message to the embedded device, so that after receiving the return message, the embedded device decrypts the return message based on the symmetric key and verifies the first random number obtained after decryption; if the verification is successful, encrypting the second random number obtained after decryption based on the symmetric key to generate a second authentication request message, and sending the generated second authentication request message to the central server; receiving the second authentication request message, decrypting the second authentication request message based on the symmetric key, and verifying the second random number obtained after decryption to authenticate the central server.
[0120] Specifically, the mutual verification process can be as follows: Figure 8 The mutual authentication diagram provided by this invention illustrates the specific process as follows:
[0121] Key sharing: Embedded devices and the central server share a symmetric key in advance. It is used for mutual authentication and secure communication.
[0122] u-boot sends an authentication request message to the central server, including a device identifier and a first random number. and use encryption:
[0123] ;
[0124] After receiving the message, the central server decrypts it. And generate a new second random number R2, which is compared with the first random number. After encryption, the encrypted data is returned to the embedded device.
[0125] ;
[0126] Decrypting the bootloader of embedded devices The system verifies the consistency of R1 to confirm the server's identity. Then, the embedded device's bootloader uses R2 for encryption and sends it back to the central server to verify its identity.
[0127] ;
[0128] Central server decryption Verify that R2 is consistent and complete mutual authentication.
[0129] Figure 9 The second flowchart illustrating the kernel image verification method provided by this invention is shown below. Figure 9 The kernel image verification method provided by this invention is applied to embedded devices, and the method includes the following steps:
[0130] Step 910: The kernel image sampling data and kernel image signing node information are sent to the central server. The central server, based on the received kernel image sampling data and kernel image signing node information, and the verification public key pre-stored in the central server's storage space, performs the verification process of the kernel image file and sends the verification result to the embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device using a signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key.
[0131] Step 920: Receive the verification result sent by the central server.
[0132] This invention enables the verification of the kernel image by executing a secure boot loader on an embedded device. The secure boot loader, also known as U-boot (Universal Boot Loader), is an open-source boot loader primarily used in embedded devices, supporting various computer architectures and boot protocols. During secure boot, U-boot verifies the digital signature of the firmware (such as operating system images, device trees, and kernels) stored on the device. This ensures that the firmware has not been tampered with before booting. This invention primarily focuses on the U-Boot kernel image file verification stage during secure boot.
[0133] The central server is pre-configured and located on the same local area network as the embedded devices, and is used to handle the signature verification task of the kernel image.
[0134] The following example illustrates the technical solution of this invention by using the verification method of executing the kernel image provided by this invention through a bootloader that performs secure boot on an embedded device.
[0135] Optionally, the system architecture of the embedded device may include:
[0136] Root of Trust (RoT): The root of the chain of trust used for initial secure boot;
[0137] SPL and bootloader: Responsible for loading the bootloader and verifying the kernel image file within the bootloader;
[0138] Symmetric key for authentication: The bootloader holds a symmetric key used for mutual authentication and encrypted communication with the central server. The bootloader also holds the public key for the asymmetric key system used to verify the signature of the kernel image.
[0139] The architecture of the central server includes:
[0140] Mirror verification module: It can perform hash calculations on sampled data and also complete the signature verification.
[0141] Identity authentication module: Uses a symmetric encryption system to encrypt and decrypt communication information, ensuring secure communication with the device and ensuring that both parties are authenticated.
[0142] Symmetric key set: The set of symmetric keys held by all embedded devices connected to this central server for authentication. It is usually added to the central server during the manufacturing process of the embedded devices.
[0143] Verification public key certificate set: The set of public keys used to verify the signature of kernel image files, which is usually added to the central server during the "registration" phase.
[0144] A mapping table between symmetric keys and signature verification public keys: This table is used to select the signature verification public key to be used during the mirror verification phase. This table is typically updated during the "registration" phase with the central server.
[0145] Embedded device manufacturing and deployment specifically include:
[0146] The initial RoT phase and the secure boot process from SPL to the bootloader phase maintain consistency with relevant methods to ensure the initial trust chain of the system remains unaffected. This means that during the embedded device's manufacturing phase, there is little difference from the original implementation; confidential information is incorporated during manufacturing as the root of trust for RoT, used to verify and sign the bootloader SPL. The SPL also embeds a public key certificate for verifying and signing the bootloader.
[0147] However, the bootloader embeds a symmetric key that can be used to uniquely identify the device. This key must be securely transmitted to the central server during the device deployment phase, meaning that the device is "registered" with the central server. The general process is as follows: Figure 10 The schematic diagram of the authentication public key embedding and registration process provided by this invention is shown.
[0148] During the secure boot process of the relevant method, in the kernel image file generation stage, after the kernel image file in FIT format is generated using the mkimage tool, this tool and the specified signing private key are used again to sign the hash value of the newly generated kernel image file, generate a signing node and put it into the kernel image file, and finally embed the corresponding public key certificate of the signing private key into the device tree file of the bootloader.
[0149] Improvements to the present invention, such as Figure 11 The diagram illustrating the image signature node generation process provided by this invention shows an improvement: before signing the hash value of the kernel image file using the private key, the data of the kernel image file is sampled once, and a hash calculation is performed on the sampled data. This reduces the size of the input data used to calculate the hash value, thereby reducing the size of the image data transmitted to the central server during the signature verification stage, saving bandwidth, and reducing processing time.
[0150] The signature verification public key is not embedded in the bootloader image, but is sent to the central server. The message format can be (device identifier, signature verification public key), and the public key in this message is encrypted using the device's authentication key. After receiving the message, the central server selects the corresponding authentication symmetric key based on the device identifier in the message to decrypt it and obtain the signature verification public key.
[0151] Because the signature verification public key is no longer embedded in the bootloader image, the FIT format kernel image file can be burned into the device at the factory stage or embedded during the deployment stage.
[0152] Specifically, in step 910, kernel image sampling data and kernel image signing node information are sent to the central server. The central server, based on the received kernel image sampling data and kernel image signing node information, and a verification public key pre-stored in its storage space, performs a verification process for the kernel image file and sends the verification result to the embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signing node information is pre-stored in the embedded device's storage space and is obtained by signing the sampled hash data of the embedded device using a signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key.
[0153] During the secure boot process of an embedded device, a kernel image is a file that contains executable code containing the operating system kernel.
[0154] The kernel image file can be a FIT format kernel image. FIT format is a structured tree data structure containing multiple nodes, each typically storing a specific type of data. Common nodes include:
[0155] The / images node contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0156] The / configurations node contains startup configurations and points to the specific image data.
[0157] The / signatures node contains signature information used to verify the integrity of the image.
[0158] After obtaining the kernel image file, data sampling is performed on it. Data sampling is used to extract representative bit strings from the kernel image file, which can effectively reflect the entire kernel image file.
[0159] It's important to note that the signing private key and the verification public key are a pair of keys in cryptography, playing a crucial role in secure boot and software verification. The signing private key is used to digitally sign the software image (such as a FIT format kernel image). The verification public key, the public key corresponding to the signing private key, is pre-stored on a central server and used by the central server to verify the digital signature of the software image. This key pair ensures that the kernel image file has not been tampered with during distribution and confirms that the software image was signed by a trusted entity holding the private key. Because the holder of the signing private key is unique, the signature serves as proof of the software's origin, and the holder cannot deny their signing.
[0160] Data is sampled from the kernel image file loaded during the secure boot process of the embedded device to obtain kernel image sampling data. After determining the kernel image sampling data, the kernel image sampling data and the kernel image signature node information obtained from the embedded device's storage space are sent to the central server.
[0161] The kernel image signature node information is determined in advance during the embedded device manufacturing process and then stored in the embedded device's storage space.
[0162] The specific process for determining kernel image signature node information can be as follows:
[0163] During the manufacturing process of embedded devices, secure kernel image files are produced. These secure kernel image files are kernel image files that have undergone security certification and can be used in the subsequent secure boot process.
[0164] After obtaining the secure kernel image file, data is sampled from the secure kernel image file to obtain sampled data of the secure kernel image file. Then, the sampled data of the secure kernel image file is hashed to obtain sampled hash data.
[0165] After obtaining the sampled hash data, the sampled hash data is signed based on the signing private key to obtain the kernel image signing node information.
[0166] Understandably, due to the heavy workload and high resource consumption of asymmetric encryption and the verification process, a central server can be pre-set in the local area network of the embedded device to handle the signature verification task of the kernel image file. This distributed verification mechanism can significantly reduce the computational load on the embedded device. The central server pre-stores the signature verification public key in its storage space.
[0167] After receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, the central server performs the verification process of the kernel image file based on the kernel image sampling data, kernel image signature node information, and pre-stored signature verification public key.
[0168] Optionally, the specific verification process may include:
[0169] Based on the signature verification public key, the signature node information of the kernel image is verified to obtain sampled hash data; the sampled kernel image data is hashed to obtain the target hash value; the target hash value is compared with the sampled hash data, and the verification result of the kernel image file is determined based on the comparison result.
[0170] In step 920, the embedded device executes a secure boot loader to receive the verification result sent by the central server, and executes subsequent secure boot procedures based on the verification result.
[0171] The kernel image verification method provided by this invention establishes a central server. Based on the kernel image sampling data and kernel image signature node information received from the embedded device, as well as the signature verification public key stored in the central server's storage space, the method verifies the kernel image file loaded by the embedded device. This offloads the signature verification task of the kernel image file during the secure boot process of the embedded device, significantly improving the efficiency of the embedded device during secure boot, reducing boot time, and enhancing device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure secure communication and reliable authentication between them. Simultaneously, image verification is performed using sampling data extracted from the image, rather than transmitting the complete image or large blocks of data, thereby optimizing network bandwidth usage.
[0172] In one embodiment, the process of determining kernel image sampling data includes: determining multiple nodes in the tree data structure of the kernel image file, each node corresponding to a type of data in the kernel image file; sampling the data corresponding to each node based on a preset sampling ratio to obtain multiple sampling encoding sequences; and merging the sampling encoding sequences to obtain the kernel image sampling data.
[0173] Kernel image files can be in FIT (Flattened Image Tree) format. FIT format is a structured tree data structure containing multiple nodes, each corresponding to a specific type of data within the kernel image file. Common nodes include:
[0174] The / images node contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0175] The / configurations node contains startup configurations and points to the specific image data.
[0176] The / signatures node contains signature information used to verify the integrity of the image.
[0177] After determining the nodes, the data corresponding to each node is sampled according to the preset sampling ratio.
[0178] Optionally, the specific sampling process can be as follows: Figure 12 The sampling diagram provided by this invention shows the specific sampling process as follows:
[0179] The design principles for sampling rules are as follows:
[0180] Covering key nodes: Sampling rules should ensure that encoded sequences are extracted from key nodes (such as / images, / configurations) to guarantee that the resulting encoded sequences represent the integrity of the entire image. Uniform distribution: Sampling points should be evenly distributed within each node to avoid bias from local sampling. Dynamic adjustment: Sampling rules should be adaptable to different FIT image sizes and structures, providing a degree of flexibility.
[0181] The specific node selection is based on the principle of prioritizing key nodes, selecting the two critical nodes / images and / configurations for sampling. The / images node may contain multiple image files (such as kernel, fdt, RAMdisk, etc.), and sampling should be performed from each of its child nodes.
[0182] The sampling ratio setting process is as follows:
[0183] For each critical node, a preset sampling ratio is set, for example, extracting 0.1% of the data length from each node as the basis for the sampled encoding sequence. This ratio can be adjusted according to specific needs to balance sampling accuracy and computational load.
[0184] The specific sampling process is as follows:
[0185] For each sub-image (such as kernel, fdt, RAMdisk) under the / images node, select several encoded sequences from each image data block for sampling.
[0186] For example, suppose a kernel image file is N bytes in size, and several data blocks are selected from it, with each block having a selected encoded sequence for sampling:
[0187] ;
[0188] in, This refers to all sampled encoded sequences obtained from the / images node. For a single sampled encoded sequence in the / images node.
[0189] The selection strategy can be a fixed interval (e.g., sampling one bit every m bytes) or random selection.
[0190] For the ` / configurations` node, sample startup configuration-related information, especially references to image data and configuration directives. A fixed-interval sampling strategy can be used.
[0191] After sampling is complete, the sampled encoded sequences are merged. The bit strings extracted from the / images and / configurations nodes are combined to generate the final sampled data.
[0192] ;
[0193] Where bits represent the final sampled data. This refers to all sampled encoded sequences obtained from the / images node, while bits_configurations refers to all sampled encoded sequences obtained from the / configurations node.
[0194] The merged sampled data should cover multiple key parts of the image, representing the integrity of the entire kernel image file.
[0195] After sampling is completed, the generated sampled data is hashed to obtain a hash value H (bits): H (bits) = SHA - 256 (bits). This hash value will be used in the subsequent image verification process.
[0196] Optional node weight adjustment: The sampling ratio of each node can be dynamically adjusted according to the needs of different application scenarios. For example, if the content of the / images node is crucial to the system, its sampling ratio can be increased. For kernel image files of different sizes and complexities, the sampling strategy can be flexibly adjusted to ensure that representative sampling encoding sequences can be effectively generated under different conditions.
[0197] In one embodiment, before sampling data from the kernel image file loaded during the secure boot process of the embedded device, the method further includes: performing mutual authentication with the central server based on a symmetric key shared with the central server, and determining that the authentication is successful.
[0198] The process of mutual authentication based on a shared symmetric key between embedded devices and a central server is a mechanism to ensure the reliability of the identities of communicating parties in a distributed system.
[0199] Symmetric-key encryption is a method of encrypted communication in which the same key is used for both encryption and decryption. This key must be kept secret and can only be shared by the two parties communicating.
[0200] By using a shared symmetric key for mutual authentication, embedded devices and a central server can establish a secure communication environment. This method simplifies key management, as only one key needs to be maintained. Successful execution of the authentication process ensures the confidentiality and integrity of the kernel image file verification.
[0201] Optionally, during the sharing of symmetric keys between the embedded device and the central server, a secure channel (such as TLS / SSL) can be used for key exchange to ensure confidentiality and integrity during key transmission.
[0202] During key exchange, embedded devices and the central server can use a key exchange protocol for key negotiation. Each party selects a private value, calculates a public value, and then exchanges the public values. Based on the received public value and their own private values, they calculate an identical shared key.
[0203] Before sharing the symmetric key, the identities of the embedded devices and the central server are verified through a secure authentication mechanism (such as digital certificates or pre-shared keys) to ensure that only legitimate devices can participate in the key exchange.
[0204] Figure 13 This is one of the structural schematic diagrams of the kernel image verification device provided by the present invention. (Refer to...) Figure 13 The kernel image verification device provided by this invention includes:
[0205] The receiving module 1310 is used to receive kernel image sampling data and kernel image signature node information sent by the embedded device; wherein, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device;
[0206] The verification module 1320 is used to perform the verification process of the kernel image file based on the kernel image sampling data, the kernel image signing node information and the verification public key, and send the obtained verification result to the embedded device; wherein, the verification public key is pre-stored in the storage space of the central server, and the verification public key corresponds to the signing private key.
[0207] The kernel image verification device provided by this invention verifies the kernel image file loaded by the embedded device by establishing a central server. This server receives kernel image sampling data and kernel image signature node information sent by the embedded device, along with the verification public key stored in the central server's storage space. This offloads the signature verification task of the kernel image file during the secure boot process of the embedded device, significantly improving the efficiency of the embedded device during secure boot, reducing boot time, and enhancing device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure secure communication and reliable authentication between them. Simultaneously, image verification is performed using sampling data extracted from the image, rather than transmitting the complete image or large blocks of data, thereby optimizing network bandwidth usage.
[0208] In one embodiment, the verification module 1320 is specifically used for:
[0209] Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the verification process of the kernel image file is performed, including:
[0210] Based on the signature verification public key, the kernel image signature node information is verified to obtain the sampled hash data;
[0211] The target hash value is obtained by performing a hash calculation on the kernel image sample data;
[0212] The target hash value is compared with the sampled hash data, and the verification result of the kernel image file is determined based on the comparison result.
[0213] In one embodiment, the receiving module 1310 is specifically used for:
[0214] Before receiving kernel image sampling data and kernel image signature node information sent by the embedded device, the process also includes:
[0215] The first authentication request message is received and decrypted based on the symmetric key shared with the embedded device. The first authentication request message is generated by encrypting the device identifier of the embedded device and a first random number randomly generated by the embedded device.
[0216] The embedded device's identity is authenticated based on the decrypted information. After successful authentication, the first random number and a randomly generated second random number are encrypted using the symmetric key to generate a return message, which is then sent to the embedded device. Upon receiving the return message, the embedded device decrypts it using the symmetric key and verifies the first random number obtained after decryption. If the verification is successful, the second random number obtained after decryption is encrypted using the symmetric key to generate a second authentication request message, which is then sent to the central server.
[0217] The system receives the second authentication request message, decrypts the second authentication request message based on the symmetric key, and verifies the second random number obtained after decryption to authenticate the central server.
[0218] Figure 14 This is a second schematic diagram of the structure of the verification device for the kernel image provided by the present invention. (Refer to...) Figure 14 The kernel image verification device provided by this invention includes:
[0219] The sending module 1410 is used to send kernel image sampling data and kernel image signing node information to a central server, so that the central server, based on the received kernel image sampling data and kernel image signing node information, and the verification public key pre-stored in the central server's storage space, performs a verification process for the kernel image file, and sends the obtained verification result to the embedded device. The kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device based on the signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key.
[0220] The receiving module 1420 is used to receive the verification result sent by the central server.
[0221] The kernel image verification device provided by this invention verifies the kernel image file loaded by the embedded device by establishing a central server. This server receives kernel image sampling data and kernel image signature node information sent by the embedded device, along with the verification public key stored in the central server's storage space. This offloads the signature verification task of the kernel image file during the secure boot process of the embedded device, significantly improving the efficiency of the embedded device during secure boot, reducing boot time, and enhancing device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure secure communication and reliable authentication between them. Simultaneously, image verification is performed using sampling data extracted from the image, rather than transmitting the complete image or large blocks of data, thereby optimizing network bandwidth usage.
[0222] In one embodiment, the sending module 1410 is specifically used for:
[0223] The process of determining kernel image sampling data includes:
[0224] Determine multiple nodes in the tree data structure of the kernel image file, where each node corresponds to a type of data in the kernel image file;
[0225] Based on a preset sampling ratio, data is sampled from the data corresponding to each node to obtain multiple sampled encoding sequences;
[0226] The sampled encoding sequences are merged to obtain the kernel image sampled data.
[0227] In one embodiment, the sending module 1410 is further configured to:
[0228] Before sampling data from the kernel image file loaded during the secure boot process of the embedded device, the method further includes:
[0229] Based on the symmetric key shared with the central server, mutual authentication with the central server is performed, and authentication is confirmed to be successful.
[0230] Figure 15 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 15As shown, the electronic device may include: a processor 1510, a communications interface 1520, a memory 1530, and a communication bus 1540, wherein the processor 1510, the communications interface 1520, and the memory 1530 communicate with each other through the communication bus 1540. The processor 1510 can call logical instructions in the memory 1530 to execute a kernel image verification method. This method includes: receiving kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device; the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on a signature private key; the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device; and the secure kernel image file is a kernel image file obtained during the production process of the embedded device.
[0231] Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the kernel image file verification process is executed, and the obtained verification result is sent to the embedded device; wherein, the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0232] Furthermore, the logical instructions in the aforementioned memory 1530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0233] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the kernel image verification method provided by the above methods. The method includes: receiving kernel image sampling data and kernel image signature node information sent by an embedded device; wherein, the kernel image sampling data is obtained by sampling data from a kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on a signature private key. The sampled hash data is obtained by hashing the sampled data of a secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device.
[0234] Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the kernel image file verification process is executed, and the obtained verification result is sent to the embedded device; wherein, the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0235] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for verifying a kernel image provided by the methods described above. This method includes: receiving kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling a kernel image file loaded during the secure boot process of the embedded device; the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on a signature private key; the sampled hash data is obtained by hashing the sampled data of a secure kernel image file of the embedded device; and the secure kernel image file is a kernel image file obtained during the production process of the embedded device.
[0236] Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the kernel image file verification process is executed, and the obtained verification result is sent to the embedded device; wherein, the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0237] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0238] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0239] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions 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 invention.
Claims
1. A method for verifying a kernel image, characterized in that, Applied to a central server, the method includes: The embedded device receives kernel image sampling data and kernel image signature node information. The kernel image sampling data is obtained by sampling key nodes of the loaded kernel image file during the secure boot process of the embedded device. The encoded sequence obtained from the data sampling in the key nodes is used to represent the complete kernel image file. The kernel image signature node information is obtained by the embedded device signing the sampled hash data based on its signature private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, which is a kernel image file obtained during the production process of the embedded device. Based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key, the kernel image file verification process is executed, and the obtained verification result is sent to the embedded device; wherein, the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
2. The kernel image verification method according to claim 1, characterized in that, The process of verifying the kernel image file based on the kernel image sampling data, the kernel image signing node information, and the signature verification public key includes: Based on the signature verification public key, the kernel image signature node information is verified to obtain the sampled hash data; The target hash value is obtained by performing a hash calculation on the kernel image sample data; The target hash value is compared with the sampled hash data, and the verification result of the kernel image file is determined based on the comparison result.
3. The kernel image verification method according to claim 1, characterized in that, Before receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, the method further includes: The first authentication request message is received and decrypted based on the symmetric key shared with the embedded device. The first authentication request message is generated by encrypting the device identifier of the embedded device and a first random number randomly generated by the embedded device. The embedded device's identity is authenticated based on the decrypted information. After successful authentication, the first random number and a randomly generated second random number are encrypted using the symmetric key to generate a return message, which is then sent to the embedded device. Upon receiving the return message, the embedded device decrypts it using the symmetric key and verifies the first random number obtained after decryption. If the verification is successful, the second random number obtained after decryption is encrypted using the symmetric key to generate a second authentication request message, which is then sent to the central server. The system receives the second authentication request message, decrypts the second authentication request message based on the symmetric key, and verifies the second random number obtained after decryption to authenticate the central server.
4. A method for verifying a kernel image, characterized in that, Applied to embedded devices, the method includes: The kernel image sampling data and kernel image signing node information are sent to the central server. The central server, based on the received kernel image sampling data and kernel image signing node information, and a verification public key pre-stored in its storage space, performs a kernel image file verification process and sends the verification result to the embedded device. The kernel image sampling data is obtained by sampling key nodes of the kernel image file loaded during the secure boot process of the embedded device. The encoded sequence obtained from the data sampling in the key nodes is used to represent the complete kernel image file. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device using a signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key. Receive the verification result sent by the central server.
5. The kernel image verification method according to claim 4, characterized in that, The process of determining the kernel image sampling data includes: Determine multiple nodes in the tree data structure of the kernel image file, where each node corresponds to a type of data in the kernel image file; Based on a preset sampling ratio, data is sampled from the data corresponding to each node to obtain multiple sampled encoding sequences; The sampled encoding sequences are merged to obtain the kernel image sampled data.
6. The kernel image verification method according to claim 4, characterized in that, Before sampling data from the kernel image file loaded during the secure boot process of the embedded device, the method further includes: Based on the symmetric key shared with the central server, mutual authentication with the central server is performed, and authentication is confirmed to be successful.
7. A kernel image verification device, characterized in that, The device, applied to a central server, includes: A receiving module is used to receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein, the kernel image sampling data is obtained by sampling key nodes of the loaded kernel image file during the secure boot process of the embedded device, and the encoded sequence obtained by sampling the data in the key nodes is used to represent the complete kernel image file; the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signing private key, and the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device; The verification module is used to perform the verification process of the kernel image file based on the kernel image sampling data, the kernel image signing node information, and the verification public key, and send the obtained verification result to the embedded device; wherein, the verification public key is pre-stored in the storage space of the central server, and the verification public key corresponds to the signing private key.
8. A kernel image verification device, characterized in that, Applied to embedded devices, the device includes: The sending module is used to send kernel image sampling data and kernel image signing node information to a central server, so that the central server, based on the received kernel image sampling data and kernel image signing node information, and the verification public key pre-stored in the central server's storage space, performs a kernel image file verification process and sends the obtained verification result to the embedded device. The kernel image sampling data is obtained by sampling data from key nodes of the kernel image file loaded during the secure boot process of the embedded device. The encoded sequence obtained from the data sampling in the key nodes is used to represent the complete kernel image file. The kernel image signing node information is obtained by signing the sampled hash data of the embedded device based on the signing private key. The sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device. The secure kernel image file is a kernel image file obtained during the production process of the embedded device. The verification public key corresponds to the signing private key. The receiving module is used to receive the verification result sent by the central server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the kernel image verification method as described in any one of claims 1 to 3, or implements the kernel image verification method as described in any one of claims 4 to 6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the kernel image verification method as described in any one of claims 1 to 3, or the kernel image verification method as described in any one of claims 4 to 6.
Citation Information
Patent Citations
Embedded system secure start method
CN104156659A
SoC chip security design method and hardware platform
CN112784280A