Firmware tamper-proof method and system based on security chip

By prefabricating the terminal root certificate on the security chip and performing signature authentication and verification, the problems in the existing technology are solved, and the problem of high debugging difficulties and the inability to change the private key is realized, and the high-security firmware tamper-proof is ensured, ensuring the stability of the device and Security.

CN114640461BActive Publication Date: 2024-11-05SHENZHEN UROVO TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202210143308.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-16
Publication Date
2024-11-05
Estimated Expiration
2042-02-16

AI Technical Summary

Technical Problem

The existing fuse solution is difficult to debug, high early import cost, and the private key cannot be changed, and it cannot be saved after leakage.

Method used

Adopt the firmware tamper-proof method based on security chips, prefabricated terminal root certificates and solidified on security chips, signature authentication is performed on the server, terminal equipment verifies the signature and certificate legality, if passed, firmware is allowed to be run, and replacement is read in the replacement step The public key of the root certificate.

Benefits of technology

Improves the security of the root certificate, and even if the private key is leaked, it can be debugged by replacing the public key, reducing the cost of early import and debugging difficulties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114640461B_ABST
    Figure CN114640461B_ABST
Patent Text Reader

Abstract

The present invention discloses a firmware tamper-proof method and system based on a security chip. The method comprises the following steps: a prefabrication step: a terminal root certificate is prefabricated and solidified in a security chip end of a terminal device; a signature authentication step: a signature authentication is performed on the firmware on a server to obtain the firmware after signature authentication, including a source file, a signature and a firmware certificate; a verification step: a root certificate is used on the terminal device to verify the legitimacy of the firmware certificate. If the firmware certificate is legitimate, the firmware certificate is used to verify the signature. If the signature is passed, the firmware is allowed to run. Thus, the root certificate has high security. Even if the private key is leaked, the public key can be replaced by reading and replacing the root certificate, and debugging can be performed at any time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of firmware tamper-proofing, and in particular to a firmware tamper-proofing method and system based on a security chip. Background Art

[0002] Secure Boot refers to a boot sequence that establishes a trusted platform for running verified applications. It starts with an immutable sequence that uses a cryptographic authentication code source so that only authorized software is executed. The boot sequence puts the device in a known secure state, preventing attacks from binary manipulation and flashing of software.

[0003] The system adds certificate checks to each stage of the boot process. This process verifies all secure software images before they are executed on the device. This additional check prevents any unauthorized or maliciously modified software from running on the phone. It is enabled through hardware-set fuses, and for code to be executed, it must be signed by a trusted entity identified in the fuse.

[0004] In simple terms, its function is to ensure that our mobile phones can only run the system software we release, so as to prevent flashing and hacker attacks to ensure the stability and security of the phone.

[0005] However, the current fuse solution has many problems. For example, debugging is very difficult after the fuse is set. The machine after the fuse must be signed with the private key of the fuse before it can be downloaded for debugging, which increases the initial introduction cost of the product. The private key of the fuse solution cannot be changed. After it is fixed, only the original private key can be used. Once the private key is leaked, it cannot be saved. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a firmware tamper-proof method and system based on a security chip in view of at least one defect in the prior art.

[0007] The technical solution adopted by the present invention to solve the technical problem is: constructing a firmware tamper-proof method based on a security chip, comprising the following steps:

[0008] Pre-production steps: Pre-production of terminal root certificate and fixation in the security chip of the terminal device;

[0009] Signature authentication step: Signature authentication is performed on the server to obtain the signed firmware, including the source file, signature, and firmware certificate.

[0010] Verification step: Use the root certificate on the terminal device to verify the legitimacy of the firmware certificate. If it is legitimate, use the firmware certificate to verify the signature. If it passes, the firmware is allowed to run.

[0011] Preferably, in the firmware tamper-proof method based on a security chip described in the present invention, the prefabrication step includes:

[0012] A terminal root certificate including a first public key is prefabricated and fixed in the security chip of the terminal device; wherein the first public key can verify the firmware certificates authenticated by multiple first private keys.

[0013] Preferably, in the firmware tamper-proof method based on a security chip described in the present invention, the signature authentication step includes:

[0014] Encrypting the hash value of the source file of the firmware using a second private key corresponding to the second public key on the server to obtain the signature;

[0015] The hash value of the second public key is encrypted using a first private key corresponding to the first public key to obtain the firmware certificate.

[0016] Preferably, in the firmware tamper-proof method based on a security chip of the present invention, the verification step further includes:

[0017] Burning steps:

[0018] Burn the image of the firmware after signature authentication into the memory, and extract the source file, the signature and the firmware certificate;

[0019] The firmware certificate and the second public key are loaded into the terminal device.

[0020] Preferably, in the firmware tamper-proof method based on a security chip described in the present invention, the verification step includes:

[0021] Decrypting the firmware certificate using the first public key of the root certificate on the terminal device, and comparing the decrypted firmware certificate with the calculated hash value of the second public key to determine whether the firmware certificate is legal;

[0022] If it is legal, the second public key in the firmware certificate is used to decrypt the signature and compare it with the calculated hash value of the source file to determine whether the source file has been tampered with. If not, the firmware is run.

[0023] Preferably, in the firmware tamper-proof method based on a security chip described in the present invention, the method further includes:

[0024] Replacement step: if the first private key is leaked, read and replace the first public key of the root certificate on the security chip.

[0025] The present invention also constructs a firmware tamper-proof system based on a security chip, comprising:

[0026] Prefabricated module, used to prefabricate terminal root certificates and fix them in the security chip of the terminal device;

[0027] The signature authentication module is used to authenticate the firmware on the server and obtain the firmware after signature authentication, including the source file, signature and firmware certificate;

[0028] The verification module is used to verify the legitimacy of the firmware certificate using the root certificate on the terminal device. If it is legitimate, the firmware certificate is used to verify the signature. If it passes, the firmware is allowed to run.

[0029] Preferably, in the security chip-based firmware anti-tampering system described in the present invention, the prefabricated module is further used to prefabricate a terminal root certificate containing a first public key, and solidify it on the security chip end of the terminal device; wherein, the first public key can verify the firmware certificates authenticated by multiple first private keys.

[0030] Preferably, in the firmware tamper-proof system based on a security chip described in the present invention, the signature authentication module includes:

[0031] A signature module, configured to encrypt the hash value of the source file of the firmware using a second private key corresponding to the second public key on the server to obtain the signature;

[0032] An authentication module is used to encrypt the hash value of the second public key by using a first private key corresponding to the first public key to obtain the firmware certificate.

[0033] Preferably, in the firmware tamper-proof system based on a security chip of the present invention, the verification module comprises:

[0034] a certificate verification module, configured to decrypt the firmware certificate using the first public key of the root certificate on the terminal device, and compare the decrypted firmware certificate with the calculated hash value of the second public key to determine whether the firmware certificate is legal;

[0035] The signature authentication module is used to decrypt the signature using the second public key in the firmware certificate if the firmware certificate is legal, and compare it with the calculated hash value of the source file to determine whether the source file has been tampered with. If not, run the firmware.

[0036] By implementing the present invention, the following beneficial effects are achieved:

[0037] The present invention includes the following steps: prefabricating a terminal root certificate and solidifying it in a security chip end of a terminal device; a signature authentication step: performing signature authentication on a firmware on a server to obtain the firmware after signature authentication, including a source file, a signature and a firmware certificate; and a verification step: using a root certificate on a terminal device to verify the legitimacy of a firmware certificate. If the certificate is legitimate, the firmware certificate is used to verify the signature. If the signature is passed, the firmware is allowed to run. Thus, the root certificate has high security. Even if a private key is leaked, the public key can be replaced by reading and replacing the root certificate, and debugging can be performed at any time. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0039] Figure 1 It is a flow chart of the firmware tamper-proof method based on a security chip of the present invention;

[0040] Figure 2 It is a hardware design diagram of the security chip of the present invention;

[0041] Figure 3 It is a system diagram of signature authentication of the present invention;

[0042] Figure 4 It is a flow chart of verification of the present invention;

[0043] Figure 5 It is a module block diagram of the firmware tamper-proof system based on the security chip of the present invention. DETAILED DESCRIPTION

[0044] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.

[0045] It should be noted that the flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0046] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0047] like Figure 1 and 4 As shown, the present invention discloses a firmware tamper-proof method based on a security chip, comprising the following steps:

[0048] Pre-production steps: Pre-production of terminal root certificate and fixation in the security chip of the terminal device;

[0049] Signature authentication step: Signature authentication is performed on the server to obtain the signed firmware, including the source file, signature, and firmware certificate.

[0050] Verification steps: Use the root certificate on the terminal device to verify the legitimacy of the firmware certificate. If it is legitimate, use the firmware certificate to verify the signature. If it passes, the firmware is allowed to run.

[0051] like Figure 2 As shown, the security chip SE is a chip certified by a national security agency, has high security, is separately configured, and is connected to the CPU of the terminal device, and the root certificate in the security chip can be read and replaced. Therefore, in some embodiments, the method also includes a replacement step: if the first private key is leaked, the first public key of the root certificate on the security chip end is read and replaced.

[0052] In this embodiment, the prefabrication step includes: prefabricating a terminal root certificate containing a first public key and solidifying it in a security chip of the terminal device; wherein the first public key can verify a plurality of firmware certificates authenticated by first private keys. In some embodiments, the first public key is a CA public key, and the first private key is a CA private key.

[0053] In this embodiment, the signature authentication step includes:

[0054] The server uses the second private key corresponding to the second public key to encrypt the hash value of the source file of the firmware to obtain a signature. Figure 3 As shown, the second public key is public key F, the second private key is private key F, and the signature is signature D;

[0055] The first private key corresponding to the first public key is used to encrypt the hash value of the second public key to obtain the firmware certificate. Figure 3 As shown, the first private key is private key R, the first public key is public key R, and the private key R corresponding to the public key R is used to encrypt the hash value of the public key F to obtain the signature F, that is, the firmware certificate, to form the firmware after signature authentication, including the source file, signature D and firmware certificate (signature F).

[0056] In some embodiments, the firmware protected by the primary signature includes: bootloader, boot.img, system.img, logo.img, update.zip, and corresponding verification must be performed in fastboot mode and recovery mode.

[0057] In some embodiments, the verification step also includes a burning step before:

[0058] Burn the signed and authenticated firmware image into the memory and extract the source file, signature and firmware certificate;

[0059] The firmware certificate is loaded into the terminal device together with the second public key.

[0060] In this embodiment, the verification step includes:

[0061] The first public key of the root certificate is used on the terminal device to decrypt the firmware certificate and compare it with the calculated hash value of the second public key to determine whether the firmware certificate is legal. If the hash value of the decrypted second public key is equal to the hash value of the calculated second public key, the firmware certificate is legal; if they are not equal, the firmware certificate is illegal and is not allowed to be downloaded or enters an abnormal state.

[0062] If it is legal, the second public key in the firmware certificate is used to decrypt the signature and compare it with the calculated hash value of the source file to determine whether the source file has been tampered with. If the hash value of the decrypted source file is equal to the calculated hash value of the source file, the source file has not been tampered with, and the firmware is run, such as downloading or starting. If they are not equal, the source file has been tampered with, and downloading is not allowed or it enters an abnormal state.

[0063] like Figure 5 and 4 As shown, the present invention also discloses a firmware tamper-proof system based on a security chip, comprising:

[0064] Prefabricated module, used to prefabricate terminal root certificates and fix them in the security chip of the terminal device;

[0065] The signature authentication module is used to authenticate the firmware on the server and obtain the firmware after signature authentication, including the source file, signature and firmware certificate;

[0066] The verification module is used to verify the legitimacy of the firmware certificate using the root certificate on the terminal device. If it is legitimate, the firmware certificate is used to verify the signature. If it passes, the firmware is allowed to run.

[0067] like Figure 2 As shown, the security chip SE is a chip certified by a national security agency, has high security, is separately configured, and is connected to the CPU of the terminal device, and the root certificate in the security chip can be read and replaced. Therefore, in some embodiments, the method also includes a replacement module for reading and replacing the first public key of the root certificate on the security chip end if the first private key is leaked.

[0068] In this embodiment, the prefabricated module is further used to prefabricate a terminal root certificate containing a first public key and solidify it in the security chip of the terminal device; wherein the first public key can verify the firmware certificates authenticated by multiple first private keys. In some embodiments, the first public key is a CA public key, and the first private key is a CA private key.

[0069] In this embodiment, the signature authentication module includes:

[0070] The signature module is used to encrypt the hash value of the source file of the firmware using the second private key corresponding to the second public key on the server to obtain a signature. Figure 3 As shown, the second public key is public key F, the second private key is private key F, and the signature is signature D;

[0071] The authentication module is used to encrypt the hash value of the second public key using the first private key corresponding to the first public key to obtain the firmware certificate. Figure 3 As shown, the first private key is private key R, the first public key is public key R, and the private key R corresponding to the public key R is used to encrypt the hash value of the public key F to obtain the signature F, that is, the firmware certificate, to form the firmware after signature authentication, including the source file, signature D and firmware certificate (signature F).

[0072] In some embodiments, the firmware protected by the primary signature includes: bootloader, boot.img, system.img, logo.img, update.zip, and corresponding verification must be performed in fastboot mode and recovery mode.

[0073] In some embodiments, the system further includes a burning module for burning the image of the signed and authenticated firmware into memory, extracting the source file, signature and firmware certificate, and loading the firmware certificate together with the second public key into the terminal device.

[0074] In this embodiment, the verification module includes:

[0075] The certificate verification module is used to use the first public key of the root certificate to decrypt the firmware certificate on the terminal device, and compare it with the hash value of the calculated second public key to determine whether the firmware certificate is legal. If the hash value of the decrypted second public key is equal to the hash value of the calculated second public key, the firmware certificate is legal; if they are not equal, the firmware certificate is illegal and is not allowed to be downloaded or enters an abnormal state;

[0076] The signature authentication module is used to decrypt the signature using the second public key in the firmware certificate if the firmware certificate is legal, and compare it with the hash value of the source file calculated to determine whether the source file has been tampered with. If the hash value of the decrypted source file is equal to the hash value of the calculated source file, the source file has not been tampered with, and the firmware is run, such as downloading or starting; if they are not equal, the source file has been tampered with, and downloading is not allowed or it enters an abnormal state.

[0077] By implementing the present invention, the following beneficial effects are achieved:

[0078] The present invention includes the following steps: prefabricating a terminal root certificate and solidifying it in a security chip end of a terminal device; a signature authentication step: performing signature authentication on a firmware on a server to obtain the firmware after signature authentication, including a source file, a signature and a firmware certificate; and a verification step: using a root certificate on a terminal device to verify the legitimacy of a firmware certificate. If the certificate is legitimate, the firmware certificate is used to verify the signature. If the signature is passed, the firmware is allowed to run. Thus, the root certificate has high security. Even if a private key is leaked, the public key can be replaced by reading and replacing the root certificate, and debugging can be performed at any time.

[0079] It can be understood that the above embodiments only express the preferred implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the patent scope of the present invention. It should be pointed out that, for ordinary technicians in this field, the above technical features can be freely combined without departing from the concept of the present invention, and several deformations and improvements can be made, which all belong to the protection scope of the present invention. Therefore, all equivalent changes and modifications made to the scope of the claims of the present invention should belong to the coverage of the claims of the present invention.

Claims

1. A firmware tamper-proof method based on a security chip, characterized in that: The following steps are involved: Prefabrication step: prefabricate a terminal root certificate containing a first public key and solidify it in a security chip end of a terminal device, wherein the security chip end is connected to a CPU of the terminal device; wherein the first public key can verify a plurality of firmware certificates authenticated by the first private key; Replacement step: if the first private key is leaked, read and replace the first public key of the root certificate on the security chip end; Signature authentication step: Signature authentication is performed on the server to obtain the signed firmware, including the source file, signature, and firmware certificate. Verification step: using the root certificate to verify the legitimacy of the firmware certificate on the terminal device, if it is legitimate, using the firmware certificate to verify the signature, if it passes, allowing the firmware to run; The signature authentication step includes: Encrypting the hash value of the source file of the firmware using a second private key corresponding to the second public key on the server to obtain the signature; The hash value of the second public key is encrypted using a first private key corresponding to the first public key to obtain the firmware certificate.

2. The firmware tamper-proof method based on a security chip according to claim 1, characterized in that: The verification step also includes: Burning steps: Burn the image of the firmware after signature authentication into the memory, and extract the source file, the signature and the firmware certificate; The firmware certificate and the second public key are loaded into the terminal device.

3. The firmware tamper-proof method based on a security chip according to claim 1 or 2, characterized in that: The verification step includes: Decrypting the firmware certificate using the first public key of the root certificate on the terminal device, and comparing the decrypted firmware certificate with the calculated hash value of the second public key to determine whether the firmware certificate is legal; If it is legal, the second public key in the firmware certificate is used to decrypt the signature and compare it with the calculated hash value of the source file to determine whether the source file has been tampered with. If not, the firmware is run.

4. A firmware anti-tampering system based on a security chip, characterized in that: include: A prefabricated module, used to prefabricate a terminal root certificate containing a first public key, and solidify it in a security chip end of a terminal device, wherein the security chip end is connected to a CPU of the terminal device; wherein the first public key can verify a plurality of firmware certificates authenticated by first private keys; A replacement module, used for reading and replacing a first public key of a root certificate on the security chip end if the first private key is leaked; The signature authentication module is used to authenticate the firmware on the server and obtain the firmware after signature authentication, including the source file, signature and firmware certificate; A verification module, used to verify the legitimacy of the firmware certificate using the root certificate on the terminal device, and if it is legitimate, verify the signature using the firmware certificate, and if it passes, allow the firmware to run; Wherein, the signature authentication module includes: A signature module, configured to encrypt the hash value of the source file of the firmware using a second private key corresponding to the second public key on the server to obtain the signature; An authentication module is used to encrypt the hash value of the second public key by using a first private key corresponding to the first public key to obtain the firmware certificate.

5. The firmware tamper-proof system based on a security chip according to claim 4, characterized in that: The verification module comprises: a certificate verification module, configured to decrypt the firmware certificate using the first public key of the root certificate on the terminal device, and compare the decrypted firmware certificate with the calculated hash value of the second public key to determine whether the firmware certificate is legal; The signature authentication module is used to decrypt the signature using the second public key in the firmware certificate if the firmware certificate is legal, and compare it with the calculated hash value of the source file to determine whether the source file has been tampered with. If not, run the firmware.

Citation Information

Patent Citations

  • Burnt chip mirror image signature verification method and terminal and burnt chip mirror image burning method and system

    CN106407814A

  • Method and apparatus for verifying firmware signature

    CN108347332A

  • Firmware anti-counterfeiting method based on security element and security element

    CN110086623A

  • Firmware upgrading method and system for POS equipment based on android system

    CN111240709A

  • Chip security boot method and device, security chip and computer equipment

    CN112733208A