A Device Secure Boot and Authentication Method and Apparatus Based on Hierarchical Encryption
By hierarchically encrypting and verifying the kernel and file system firmware in the BL3 of the SOC chip, the problem of single encryption methods and insufficient flexibility in the secure boot solution of the SOC chip is solved, and the safe and reliable authentication of the equipment and network authentication are achieved.
Patent Information
- Application Number
- CN202210677685.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-06-16
AI Technical Summary
In the prior art, the device security boot solution of SOC chips has problems such as single encryption means, insufficient flexibility, inability to update the secret key, and inability to implement differentiated device authentication.
The hierarchical encryption method is adopted to realize the security verification of the kernel and file system firmware in BL3, generate multiple sets of private keys and certificates, verify the validity of the device security information file, kernel firmware and file system firmware through the boot loader BL3, and pass the device serial number and MAC address for network authentication.
It improves system security and flexibility, prevents equipment information from being tampered with, provides safe and reliable equipment authentication information, and reduces dependence on SOC manufacturers.
Smart Images

Figure CN115062292B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of embedded device security technology, and in particular to a device security startup and authentication method and device based on hierarchical encryption. Background Art
[0002] With the widespread application of embedded systems, the system security of embedded devices has attracted more and more attention from manufacturers. In order to prevent the system software of embedded devices from being maliciously tampered with and protect intellectual property rights, chip manufacturers have proposed a device security boot solution based on SOC chips (SOC is the abbreviation of System on Chip, called system-level chip). The solution uses RSA asymmetric encryption technology to perform security verification on all boot firmware. Since the verification program is fixed in BL0 (boot loader 0) in SOC, there are problems such as single encryption / verification means and insufficient flexibility.
[0003] In view of the above situation, how to overcome the defects of the existing technology and solve the problem that all firmware in the SOC manufacturer's security policy uses the same set of verification methods, has a single means, insufficient flexibility, cannot update the secret key, and cannot achieve differentiated authentication of the device, is a difficult problem to be solved in this technical field. Summary of the invention
[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a device secure startup and authentication method and device based on hierarchical encryption, which implements security verification of kernel and file system firmware in BL3 (boot loader 3), adds a unique security information file for each device as the verification basis of the firmware, and achieves the hierarchical verification of the firmware and the differentiated authentication of the device. In addition, it can also implement security verification of BL3, solve the problem of single encryption means, and enhance the security of the system.
[0005] The embodiment of the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a device secure startup and authentication method based on hierarchical encryption, comprising:
[0007] After the device is powered on, it enters the SOC's boot loader and pulls up boot loader BL1, boot loader BL2, and boot loader BL3 in sequence;
[0008] Verify the validity of the device security information file, the validity of the kernel firmware, and the validity of the file system firmware in sequence through the boot loader BL3;
[0009] After all verifications are valid, the boot loader BL3 pulls up the kernel and passes the device serial number and MAC address to the kernel for network authentication of the device.
[0010] Further, it also includes grading and encrypting device information during the device production stage, specifically:
[0011] Generate a preset number of private keys and certificates, including a corresponding first private key and first certificate, second private key and second certificate, and third private key and third certificate;
[0012] Generate a device security information file, encrypted firmware for the bootloader, encrypted firmware for the kernel, and encrypted firmware for the file system based on the private keys and certificates;
[0013] Install the generated device security information file and each encrypted firmware onto the device, and write the certificates and device-related information into the SOC.
[0014] Further, the specific process of writing the certificates and device-related information into the SOC includes:
[0015] Write the hash value of the first certificate into the programmable read-only memory in the SOC;
[0016] Calculate the hash values of the device serial number and MAC address, encrypt the hash values using the AES algorithm, and write them into the programmable read-only memory in the SOC;
[0017] The bootloader BL0 decrypts the encrypted values stored in the programmable read-only memory using the AES algorithm;
[0018] Encrypt the hash value of the second certificate using the AES algorithm and write it into the bootloader BL3.
[0019] Further, the composition content of the device security information file includes one or more of a magic word, device serial number, MAC address, encrypted value of the third certificate, digital signature, and the second certificate. Among them, the generation of the digital signature specifically includes: signing a specified number of fields of the security information file using the RSA algorithm and the second private key; correspondingly, the specific process of verifying the validity of the device security information file through the bootloader BL3 includes:
[0020] Verify the validity of the second certificate, encrypt the hash value of the second certificate using AES, and compare and verify it with the AES-encrypted value in the bootloader BL3;
[0021] Verify the digital signature through the RSA algorithm and the second certificate;
[0022] Calculate the hash values of the device serial number and MAC address, and compare and verify them with the encrypted values decrypted by the AES algorithm of the bootloader BL0 in the SOC.
[0023] Further, the generation of the encrypted firmware of the bootloader specifically includes: using the RSA algorithm and the first private key to sign the three firmware of the bootloader BL1, the bootloader BL2, and the bootloader BL3 respectively, and adding the header description information and the first certificate respectively to generate the corresponding encrypted firmware.
[0024] Further, after the device is powered on and enters the bootloader of the SOC, the specific process of sequentially starting the bootloader BL1, the bootloader BL2, and the bootloader BL3 includes:
[0025] After the device is powered on, it enters the bootloader BL0 of the SOC;
[0026] Read and verify the bootloader BL1 based on the SOC chip policy. After the verification passes, start BL1;
[0027] Read and verify the bootloader BL2 based on the SOC chip policy. After the verification passes, start BL2;
[0028] Read and verify the bootloader BL3 based on the SOC chip policy. After the verification passes, start BL3.
[0029] Further, the generation of the encrypted firmware of the kernel and the encrypted firmware of the file system specifically includes: using the RSA algorithm and the third private key to sign the firmware of the kernel and the file system respectively, and adding the header description information and the third certificate respectively to generate the corresponding encrypted firmware.
[0030] Further, the specific process of verifying the validity of the kernel firmware through the bootloader BL3 includes:
[0031] Parse the header description information of the encrypted firmware of the kernel, verify the third certificate in the encrypted firmware of the kernel, compare and verify the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verify the digital signature of the encrypted firmware of the kernel using the RSA algorithm and the third certificate.
[0032] Further, the specific process of verifying the validity of the file system firmware through the bootloader BL3 includes:
[0033] Parse the header description information of the encrypted firmware of the file system, verify the third certificate in the encrypted firmware of the file system, compare and verify the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verify the digital signature of the encrypted firmware of the file system using the RSA algorithm and the third certificate.
[0034] On the other hand, the present invention provides a device secure boot and authentication apparatus based on hierarchical encryption, specifically including: at least one processor and a memory, the at least one processor and the memory are connected through a data bus, the memory stores instructions executable by the at least one processor, and after the instructions are executed by the processor, they are used to complete the method for device secure boot and authentication based on hierarchical encryption in the first aspect.
[0035] Compared with the prior art, the beneficial effects of the present invention are as follows: By using multiple sets of keys and hierarchical encryption, it effectively prevents the tampering of device information, improves the system security, and the key pairs are replaceable, which improves the flexibility. The security verification of the kernel and the file system firmware is implemented in BL3, and a unique security information file is added for each device as the verification basis for the firmware, achieving the purpose of hierarchical verification of the firmware and differential authentication of the devices, providing secure and reliable device authentication information, providing reliable support for the network authentication of the devices, and reducing the dependence on SOC manufacturers. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly introduced below. Obviously, the following described drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings according to these drawings without creative efforts.
[0037] Figure 1 It is a flowchart of a method for device secure boot and authentication based on hierarchical encryption provided in Embodiment 1 of the present invention;
[0038] Figure 2 It is a flowchart of hierarchical encryption of device information provided in Embodiment 1 of the present invention;
[0039] Figure 3 It is a schematic structural diagram of an encrypted firmware provided in Embodiment 1 of the present invention;
[0040] Figure 4 It is a schematic diagram of the composition content of the device security information file provided in Embodiment 1 of the present invention;
[0041] Figure 5 It is a schematic diagram of the device production stage process provided in Embodiment 2 of the present invention;
[0042] Figure 6 It is a schematic diagram of the device startup stage process provided in Embodiment 2 of the present invention;
[0043] Figure 7 It is a schematic structural diagram of a device secure boot and authentication apparatus based on hierarchical encryption provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0045] The present invention is an architecture of a specific function system. Therefore, in specific embodiments, the functional logic relationships of each structural module are mainly described, and the specific software and hardware implementation manners are not limited.
[0046] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other. The present invention will be described in detail below with reference to the drawings and embodiments.
[0047] Embodiment 1:
[0048] As Figure 1 shown, Embodiment 1 of the present invention provides a device secure boot and authentication method based on hierarchical encryption. The method includes the following steps:
[0049] Step 100: After the device is powered on, enter the bootloader of the SOC, and sequentially start the bootloaders BL1, BL2, and BL3. In this step, the firmware of the bootloaders BL1, BL2, and BL3 needs to be encrypted respectively during the device production stage to produce corresponding encrypted firmware. When entering the bootloader of the SOC, first enter the bootloader BL0, and then sequentially verify and start the bootloaders BL1 and BL2 until the bootloader BL3 is verified and started.
[0050] Step 200: The bootloader BL3 sequentially verifies the validity of the device security information file, the kernel firmware, and the file system firmware. In this step, the validity of the device security information file, the device kernel, and the file system firmware is verified in the bootloader BL3. First, it is necessary to encrypt the device information, the device kernel firmware, and the file system firmware respectively during the device production stage to produce the encrypted firmware of the device security information file, the kernel, and the file system. Then, after the device is powered on and the bootloader BL3 is started, the device security information file, the device kernel, and the file system firmware are verified respectively.
[0051] Step 300: After all validations are passed, the bootloader BL3 launches the kernel and passes the device serial number and MAC address to the kernel for network authentication of the device. This step is carried out only after it is determined that all validations in Step 100 and Step 200 are passed. After the bootloader BL3 passes the device serial number and MAC address to the kernel, the user can obtain the device serial number and MAC address from the kernel for network authentication of the device.
[0052] By adopting the above steps, in the embodiment of the present invention, the security validation of the kernel and the file system firmware is implemented in BL3, a unique security information file is added for each device as the validation basis of the firmware, the hierarchical validation of the firmware and the differential authentication of the device are achieved, secure and reliable device authentication information is provided, reliable support is provided for the network authentication of the device, and the dependence on the SOC manufacturer is reduced.
[0053] It should also be noted that the above three steps are the steps for device secure startup and authentication. Before this, during the device production stage, the device information needs to be hierarchically encrypted. Specifically, as Figure 2 shown, the steps for hierarchical encryption of device information specifically include:
[0054] Step 10: Generate a preset number of pairs of RSA private keys and corresponding certificates, including a first private key and a first certificate, a second private key and a second certificate, and a third private key and a third certificate that correspond to each other. In this step, the number of pairs of RSA private keys and certificates includes but is not limited to the above three pairs. According to needs, more pairs can be added to achieve more levels of encryption. It should also be noted that in addition to using RSA private keys and corresponding certificates, other asymmetric encryption algorithms can be used to replace them in this embodiment, such as DSA and ECC, as long as the algorithms meet the conditions: asymmetric encryption, can encrypt and decrypt data, and support private key encryption + public key decryption. In addition, the usage methods of other algorithms need to be considered, and corresponding modifications need to be made when generating encrypted firmware. For example, ECC encryption and decryption rely on elliptic curves, and the curve needs to be added to the encrypted firmware. In this embodiment, only the RSA algorithm is used for illustration for the time being.
[0055] Step 20: Generate a device security information file, encrypted firmware for the bootloader, encrypted firmware for the kernel, and encrypted firmware for the file system based on the RSA private key and the certificate. This step encrypts the device information and each firmware according to the RSA private key and the certificate set in Step 10. Specifically, it includes encrypting the device information to generate a device security information file, encrypting the firmware of bootloader BL1, bootloader BL2, and bootloader BL3 to generate encrypted firmware for bootloader BL1, encrypted firmware for bootloader BL2, and encrypted firmware for bootloader BL3, encrypting the kernel firmware of the device to generate encrypted firmware for the kernel, and encrypting the file system firmware to generate encrypted firmware for the file system.
[0056] Step 30: Install the generated device security information file and each encrypted firmware onto the device, and write the certificate and device-related information into the SOC. This step needs to write the hash value of the certificate to be used and the encrypted value of the device-related information into the SOC for subsequent verification calls. It also needs to install the device security information file generated in Step 20, the encrypted firmware for bootloader BL1, the encrypted firmware for bootloader BL2, the encrypted firmware for bootloader BL3, the encrypted firmware for the kernel, and the encrypted firmware for the file system onto the device for subsequent verification calls.
[0057] For Step 30 of this embodiment, writing the certificate and device-related information into the SOC specifically includes the following process: Write the hash value of the first certificate into the programmable read-only memory in the SOC; Calculate the hash values of the device serial number and MAC address, encrypt the hash values using the AES algorithm and write them into the programmable read-only memory in the SOC; The bootloader BL0 decrypts the encrypted value stored in the programmable read-only memory through the AES algorithm; Encrypt the hash value of the second certificate through the AES algorithm and write it into the bootloader BL3.
[0058] For step 20 of this embodiment, the generation of the encrypted firmware of the bootloader specifically includes: using the RSA algorithm and the first private key to sign the three firmware of the bootloader BL1, the bootloader BL2, and the bootloader BL3 respectively, and adding the header description information and the first certificate respectively to generate the corresponding encrypted firmware. That is, using the RSA algorithm and the first private key to sign the firmware of the bootloader BL1 and adding the header description information and the first certificate to generate the encrypted firmware of the bootloader BL1; using the RSA algorithm and the first private key to sign the firmware of the bootloader BL2 and adding the header description information and the first certificate to generate the encrypted firmware of the bootloader BL2; using the RSA algorithm and the first private key to sign the firmware of the bootloader BL3 and adding the header description information and the first certificate to generate the encrypted firmware of the bootloader BL3. The structure of each finally formed encrypted firmware is as Figure 3 shown, which includes four information: header description, original firmware, digital signature, and certificate. It should be noted that for the encryption of the bootloader BL1, the bootloader BL2, and the bootloader BL3, different private key certificates (for example, adding two pairs of different private key certificates) can also be used to encrypt the firmware of the three respectively, so that the hierarchical encryption of this embodiment is more complex and reliable. In this case, the bootloader BL1 and the bootloader BL2 also need to increase the ability of hierarchical verification (similar to the ability of the bootloader BL3).
[0059] Correspondingly, in step 100 of this embodiment, "after the device is powered on, enter the bootloader of the SOC, and pull up the bootloader BL1, the bootloader BL2, and the bootloader BL3 in sequence" specifically includes the following process: after the device is powered on, enter the bootloader BL0 of the SOC; read and verify the bootloader BL1 based on the SOC chip policy, and pull up BL1 after passing the verification; read and verify the bootloader BL2 based on the SOC chip policy, and pull up BL2 after passing the verification; read and verify the bootloader BL3 based on the SOC chip policy, and pull up BL3 after passing the verification. For the verification of the bootloader BL1, the bootloader BL2, and the bootloader BL3, the following method can be specifically used. In the production stage: the encrypted firmware of the bootloader BL1, the bootloader BL2, and the bootloader BL3 will include: header description, original firmware, digital signature, and the first certificate (refer to Figure 3 ). In the verification stage: (taking the bootloader BL1 as an example, the bootloader BL2 and the bootloader BL3 are the same) load the encrypted firmware BL1; verify the first certificate by comparing the certificate hash value stored in the SOC; verify the digital signature through the RSA algorithm and the first certificate.
[0060] For step 20 of this embodiment, the composition content of the generated device security information file is as follows Figure 4 shown, specifically including: magic word, device serial number, MAC address, encrypted value (hash value) of the third certificate, digital signature, and the second certificate. Among them, the encrypted value of the third certificate is obtained by hashing the third certificate and encrypting it using AES; the generation of the digital signature specifically includes: using the RSA algorithm and the second private key to sign a specified number of fields of the security information file (in this embodiment, the first 4 fields). The explanations and examples of the composition content of the device security information file are as follows. Magic word: used to mark the format of the device security information file, for example: 0x7f454c66. Device serial number: the hardware serial number of the device, and the serial number of each device is different, similar to an ID card, for example: 98328328432. MAC address: the physical address of the network card, for example: 8d:2c:3d:56:0c:22. The device serial number and MAC address can uniquely identify a single device. Encrypted value of the third certificate: the encrypted value obtained by encrypting the hash value of the third certificate using AES, used to verify the kernel encrypted firmware and the file system encrypted firmware.
[0061] Correspondingly, in step 200 of this embodiment, the process of verifying the validity of the device security information file by the bootloader BL3 specifically includes the following process: verifying the validity of the second certificate, encrypting the hash value of the second certificate using AES, and comparing and verifying it with the AES encrypted value in the bootloader BL3; verifying the digital signature through the RSA algorithm and the second certificate; calculating the hash values of the device serial number and MAC address, and comparing and verifying them with the values obtained by decrypting the device-related information stored in the programmable read-only memory of the SOC through the loaded bootloader BL0 using AES.
[0062] For step 20 of this embodiment, the generation of the encrypted firmware of the kernel and the encrypted firmware of the file system specifically includes: using the RSA algorithm and the third private key to sign the firmware of the kernel and the file system respectively, and adding header description information and the third certificate respectively to generate the corresponding encrypted firmware. That is, using the RSA algorithm and the third private key to sign the firmware of the kernel and adding header description information and the third certificate to generate the encrypted firmware of the kernel; using the RSA algorithm and the third private key to sign the firmware of the file system and adding header description information and the third certificate to generate the encrypted firmware of the file system. The structure of the encrypted firmware of the kernel and the encrypted firmware of the file system is also as follows Figure 3 shown, including four pieces of information: header description, original firmware, digital signature, and certificate. It should be noted that in order to achieve more hierarchical verification in this embodiment, another set of RSA private key and certificate pair (the fourth private key and the fourth certificate) can be added specifically for hierarchical encryption verification of the file system firmware. That is to say, the key pairs in this embodiment are expandable and replaceable, which is beneficial to improving the flexibility of hierarchical encryption.
[0063] Correspondingly, in step 200 of this embodiment, the process of verifying the validity of the kernel firmware through the bootloader BL3 specifically includes the following steps: parsing the header description information of the encrypted firmware of the kernel, verifying the third certificate in the encrypted firmware of the kernel, comparing and verifying the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verifying the digital signature of the encrypted firmware of the kernel using the RSA algorithm and the third certificate. The process of verifying the validity of the file system firmware through the bootloader BL3 specifically includes the following steps: parsing the header description information of the encrypted firmware of the file system, verifying the third certificate in the encrypted firmware of the file system, comparing and verifying the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verifying the digital signature of the encrypted firmware of the file system using the RSA algorithm and the third certificate. It should be noted that if the fourth private key and the fourth certificate are used during the encryption of the file system, the fourth certificate is also used for verification during the verification process.
[0064] In summary, through the above steps, the embodiment of the present invention uses multiple sets of keys for hierarchical encryption, effectively preventing the tampering of device information, improving system security, and the key pairs are replaceable, improving flexibility. Implementing security verification of the kernel and file system firmware in BL3, adding a unique security information file for each device as the verification basis for the firmware, achieving hierarchical verification of the firmware and differential authentication of the device, providing secure and reliable device authentication information, providing reliable support for the network authentication of the device, and reducing the dependence on the SOC manufacturer.
[0065] Embodiment 2:
[0066] Based on the device security startup and authentication method based on hierarchical encryption provided in Embodiment 1, this Embodiment 2 uses a comparative method to further illustrate the differences between the "device security startup and authentication method based on hierarchical encryption" of the present invention and the traditional SOC security policy.
[0067] The SOC manufacturer's security policy (traditional SOC security policy) of a certain router device is as follows.
[0068] Device production stage: Use the OPENSSL tool to generate a pair of RSA private keys (key) and certificates (cert). Use the RSA algorithm and the private key key to sign the firmware, and add the header description information and the certificate cert to generate the encrypted firmware, which can refer to Figure 3 the encrypted firmware structure. Write the hash value of the certificate cert into the field programmable read-only memory (FPROM) of the SOC chip. Install the encrypted firmware onto the device.
[0069] Device startup phase: After the device is powered on, it enters the bootloader BL0 of the SOC. Read and verify the bootloader BL1, and if the verification passes, pull up BL1. Using the same method as the previous step, verify and pull up the subsequent firmware in sequence. If the verification fails, stop the startup process.
[0070] The specific implementation manners of the embodiments of the present invention are as follows.
[0071] As Figure 5 shown, in the device production phase:
[0072] First, use the OPENSSL tool to generate 3 groups of RSA private keys (the first private key key1, the second private key key2, the third private key key3) and certificates (the first certificate cert1, the second certificate cert2, the third certificate cert3). It should be noted that the private key and the public key (certificate) are in a one-to-one correspondence relationship. For example: Key1 corresponds to cert1, key2 corresponds to cert2, and key3 corresponds to cert3. The private key and the public key are used for encrypting and decrypting data. For example: The private key key1 encrypts data, and the public key cert1 decrypts data. In this embodiment: Key1 is used to encrypt BL1, BL2, and BL3, and cert1 is used to verify BL1, BL2, and BL3; Key2 is used to encrypt the device security information file, and cert2 is used to verify this file; Key3 is used to encrypt the kernel firmware and the file system, and cert3 is used to verify the kernel firmware and the file system.
[0073] Generate a device security information file, which contains: magic word, device serial number, MAC address (MAC), encrypted value of the third certificate cert3 (cert3 is hashed and encrypted using AES), digital signature, and the second certificate cert2. Among them, the specific content of the digital signature is: Use the RSA algorithm and the second private key key2 to sign the first 4 fields of the security information file. For reference, see Figure 2 the content of the device security information file. The device security information file in this embodiment can be updated. By updating the security information file, the purpose of replacing the RSA key pair of the system firmware can be achieved.
[0074] Generate the encrypted firmware of the bootloader: Use the RSA algorithm and the first private key key1 to sign the three firmware of the bootloader BL1, the bootloader BL2, and the bootloader BL3 respectively, and add the header description information and the first certificate cert1 respectively to generate the corresponding encrypted firmware. For reference, see Figure 3 the structure of the encrypted firmware.
[0075] Generate encrypted firmware for the kernel and file system: Sign the kernel and file system firmware separately using the RSA algorithm and the third private key key3, and add the header description information and the third certificate cert3 respectively to generate the corresponding encrypted firmware. Refer to Figure 3 for the encrypted firmware structure.
[0076] Write the hash value of the first certificate cert1 into the programmable read-only memory (FPROM) in the SOC.
[0077] Calculate the hash values of the device serial number and MAC address, encrypt the hash values using the AES algorithm, and write them into the programmable read-only memory (FPROM) in the SOC.
[0078] Install the encrypted firmware and the encrypted device security information file generated in the above steps onto the device.
[0079] Encrypt the hash value of the second certificate cert2 using the AES algorithm and write it into the bootloader BL3. The bootloader BL3 in this embodiment needs to have the capabilities of parsing the disk security file, RSA algorithm verification, and AES algorithm encryption.
[0080] Decrypt the encrypted value stored in the programmable read-only memory (FPROM) using the AES algorithm. The bootloader BL0 in this embodiment needs to support the AES decryption capability.
[0081] As Figure 6 shown, during the device startup phase:
[0082] After the device is powered on, it enters the bootloader BL0 of the SOC.
[0083] Based on the SOC chip policy, verify the validity of the bootloader BL1 and pull up BL1. Specifically, read and verify the bootloader BL1, and pull up the bootloader BL1 after the verification passes.
[0084] Based on the SOC chip policy, verify the validity of the bootloader BL2 and pull up BL2. Specifically, read and verify the bootloader BL2, and pull up the bootloader BL2 after the verification passes.
[0085] Based on the SOC chip policy, verify the validity of the bootloader BL3 and pull up BL3. Specifically, read and verify the bootloader BL3, and pull up the bootloader BL3 after the verification passes.
[0086] The bootloader BL3 verifies the device security information file: verifies the validity of the second certificate cert2 (compares the hash value of the second certificate cert2 encrypted by AES with the AES-encrypted value in the bootloader BL3 for verification); verifies the digital signature through the RSA algorithm + the second certificate cert2; calculates the hash values of the device serial number and MAC address and compares and verifies them with the encrypted value decrypted by AES in the SOC (the last step of the device production stage).
[0087] The bootloader BL3 verifies the validity of the kernel firmware: parses the encrypted firmware header description information of the kernel, verifies the third certificate cert3 in the encrypted firmware (compares the encrypted value of the hash value of the third certificate cert3 encrypted by AES with the encrypted value of the third certificate cert3 in the device security information file for verification), and uses the RSA algorithm and the third certificate cert3 to verify the digital signature of the encrypted firmware.
[0088] The bootloader BL3 verifies the validity of the file system firmware: parses the encrypted firmware header description information of the file system, verifies the third certificate cert3 in the encrypted firmware (compares the encrypted value of the hash value of the third certificate cert3 encrypted by AES with the encrypted value of the third certificate cert3 in the device security information file for verification), and uses the RSA algorithm and the third certificate cert3 to verify the digital signature of the encrypted firmware.
[0089] The bootloader BL3 starts the kernel and passes the valid device serial number and MAC address to the kernel. The kernel provides the device serial number and MAC address that are valid based on chip-level verification for the user program, and the user can obtain the device serial number and MAC address from the kernel for network authentication of the device.
[0090] In summary, the embodiment of the present invention realizes the hierarchical encryption verification ability of the firmware through the development of the bootloader BL3 and the use of multiple groups of RSA key pairs. The embodiment of the present invention can achieve the purpose of replacing the RSA key pair of the system firmware by updating the security information file. The embodiment of the present invention can be combined with the SOC manufacturer's strategy to implement a chip-level device authentication strategy. The embodiment of the present invention includes implementing hierarchical encryption verification for all firmware after the bootloader BL3. For example, adding a group of RSA private key pairs (the fourth private key key4 and the fourth certificate cert4) for hierarchical encryption verification of the file system firmware.
[0091] Embodiment 3:
[0092] Based on the device security startup and authentication method based on hierarchical encryption provided in the above Embodiment 1 and Embodiment 2, the present invention also provides a device security startup and authentication device based on hierarchical encryption that can be used to implement the above method, such as Figure 7As shown, it is a schematic diagram of the device architecture according to an embodiment of the present invention. The device for secure startup and authentication of a device based on hierarchical encryption in this embodiment includes one or more processors 21 and a memory 22. Among them, Figure 7 Take one processor 21 as an example.
[0093] The processor 21 and the memory 22 can be connected through a bus or other means. Figure 7 Take the connection through the bus as an example.
[0094] The memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the methods for secure startup and authentication of a device based on hierarchical encryption in Embodiments 1 and 2. By running the non-volatile software programs, instructions, and modules stored in the memory 22, the processor 21 executes various functional applications and data processing of the device for secure startup and authentication of a device based on hierarchical encryption, that is, implements the methods for secure startup and authentication of a device based on hierarchical encryption in Embodiments 1 and 2.
[0095] The memory 22 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 22 may optionally include a memory remotely disposed relative to the processor 21, and these remote memories may be connected to the processor 21 through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0096] The program instructions / modules are stored in the memory 22 and, when executed by one or more processors 21, execute the methods for secure startup and authentication of a device based on hierarchical encryption in Embodiments 1 and 2 above. For example, execute the Figures 1-2 , Figures 5-6 each step shown above.
[0097] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: Read-Only Memory (abbreviated as: ROM), Random Access Memory (abbreviated as: RAM), a magnetic disk, an optical disc, etc.
[0098] The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention. The content not detailedly described in this specification belongs to the prior art well-known to those skilled in the art.
Claims
1. A device secure boot and authentication method based on hierarchical encryption, characterized in that, Including: After the device is powered on, it enters the bootloader of the SOC, and sequentially starts up the bootloader BL1, the bootloader BL2, and the bootloader BL3; Through the bootloader BL3, it sequentially verifies the validity of the device security information file, the kernel firmware, and the file system firmware; After all validations are passed, the bootloader BL3 starts up the kernel and passes the device serial number and MAC address to the kernel for network authentication of the device.
2. The device security startup and authentication method based on hierarchical encryption according to claim 1, characterized in that, It also includes, during the device production stage, hierarchically encrypting the device information. Specifically: Generating a preset number of private keys and certificates, including the corresponding first private key and first certificate, second private key and second certificate, and third private key and third certificate; Generating a device security information file, encrypted firmware of the bootloader, encrypted firmware of the kernel, and encrypted firmware of the file system according to the private keys and certificates; Installing the generated device security information file and each encrypted firmware into the device, and writing the certificates and device-related information into the SOC.
3. The device security startup and authentication method based on hierarchical encryption according to claim 2, characterized in that The specific process of writing the certificates and device-related information into the SOC includes: Writing the hash value of the first certificate into the programmable read-only memory in the SOC; Calculating the hash values of the device serial number and MAC address, encrypting the hash value of the MAC address using the AES algorithm, and writing it into the programmable read-only memory in the SOC; The bootloader BL0 decrypts the encrypted value stored in the programmable read-only memory through the AES algorithm; Writing the hash value of the second certificate into the bootloader BL3 after encrypting it through the AES algorithm.
4. The device security startup and authentication method based on hierarchical encryption according to claim 2, characterized in that, The composition content of the device security information file includes one or more of a magic word, a device serial number, a MAC address, an encrypted value of the third certificate, a digital signature, and the second certificate. Among them, the generation of the digital signature specifically includes: signing a specified number of fields of the security information file using the RSA algorithm and the second private key; correspondingly, the specific process of verifying the validity of the device security information file through the bootloader BL3 includes: Verifying the validity of the second certificate, encrypting the hash value of the second certificate through AES, and comparing and verifying it with the AES encrypted value in the bootloader BL3; Verifying the digital signature through the RSA algorithm and the second certificate; Calculating the hash values of the device serial number and MAC address, and comparing and verifying them with the encrypted value after AES decryption by the bootloader BL0 of the SOC.
5. The device security startup and authentication method based on hierarchical encryption according to claim 2, wherein The generation of the encrypted firmware of the bootloader specifically includes: signing the three firmware of the bootloader BL1, the bootloader BL2, and the bootloader BL3 respectively using the RSA algorithm and the first private key, and respectively adding header description information and the first certificate to generate the corresponding encrypted firmware.
6. The device security startup and authentication method based on hierarchical encryption according to claim 5, characterized in that, The process that after the device is powered on, it enters the bootloader of the SOC and sequentially starts up the bootloader BL1, the bootloader BL2, and the bootloader BL3 specifically includes: After the device is powered on, it enters the bootloader BL0 of the SOC; Reading and verifying the bootloader BL1 based on the SOC chip policy. After the verification passes, it starts up BL1; Read and verify the bootloader BL2 based on the SOC chip policy. After successful verification, start BL2. Read and verify the bootloader BL3 based on the SOC chip policy. After successful verification, start BL3.
7. The device security startup and authentication method based on hierarchical encryption according to claim 2, characterized in that, The generation of the encrypted firmware of the kernel and the encrypted firmware of the file system specifically includes: using the RSA algorithm and the third private key to sign the firmware of the kernel and the file system respectively, and adding the header description information and the third certificate respectively to generate the corresponding encrypted firmware.
8. The device security startup and authentication method based on hierarchical encryption according to claim 7, characterized in that, The specific steps for verifying the validity of the kernel firmware through the bootloader BL3 include: Parse the header description information of the encrypted firmware of the kernel, verify the third certificate in the encrypted firmware of the kernel, compare and verify the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verify the digital signature of the encrypted firmware of the kernel using the RSA algorithm and the third certificate.
9. The device security startup and authentication method based on hierarchical encryption according to claim 7, characterized in that, The specific steps for verifying the validity of the file system firmware through the bootloader BL3 include: Parse the header description information of the encrypted firmware of the file system, verify the third certificate in the encrypted firmware of the file system, compare and verify the encrypted value obtained by encrypting the hash value of the third certificate using AES with the encrypted value of the third certificate in the device security information file, and verify the digital signature of the encrypted firmware of the file system using the RSA algorithm and the third certificate.
10. A device security startup and authentication device based on hierarchical encryption, characterized in that: It includes at least one processor and a memory. The at least one processor and the memory are connected through a data bus. The memory stores instructions that can be executed by the at least one processor. After the instructions are executed by the processor, they are used to complete the device security startup and authentication method based on hierarchical encryption according to any one of claims 1-9.
Citation Information
Patent Citations
Embedded type partition image security certification and kernel trusted boot method and equipment thereof
CN104794393A
KR20200020627A