Anti-cracking method of chip, security chip and program product
By generating initial protection data and deriveing storage protection data, the chip firmware is encrypted, and the problem of low protection security in the existing technology is solved, and higher protection security and simplified management processes are achieved.
Patent Information
- Application Number
- CN202411553824.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, chip firmware protection is not very safe, and there is a risk of being spyed by physical sections, firmware reverse analysis, social engineering attacks, etc., and firmware key management increases additional workload, and there is a risk of key leakage. .
By generating initial protection data and deriveing the storage protection data of the firmware based on the data, the storage protection data is used to encrypt the firmware data, and the encrypted data is written to the preset storage location of the chip. The initial protection data is stored in an unchangeable area to prevent protection data from being snooped and copied.
Improves the security of chip firmware protection, reduces the risk of being cracked and copied, ensures the security of firmware keys, and simplifies the firmware management process.
Smart Images

Figure CN119416274A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of chip security technology, and in particular to a chip anti-cracking method, a security chip, and a program product. Background Art
[0002] With the development of the Internet of Things and intelligent manufacturing, the application and value of security chips in the embedded field have further expanded. Firmware security is a key link to ensure chip security. Security chips should have a complete firmware key management mechanism, firmware security storage and import mechanism and other security protection measures.
[0003] Typical security chip firmware protection solutions usually include key generation solutions, firmware encryption solutions, firmware import solutions, secure boot solutions, etc.
[0004] However, in the related art, there is a problem that the security of chip firmware protection is not high. Summary of the invention
[0005] The embodiments of the present application provide a chip anti-cracking method, a security chip, and a program product to achieve the effect of improving the chip firmware protection security.
[0006] In a first aspect, an embodiment of the present application provides a chip anti-cracking method, the method comprising:
[0007] Generate initial protection data of the chip through a protection data generator, and store the initial protection data in a one-time storage area;
[0008] Based on the initial protection data, storage protection data of the firmware is obtained; wherein the storage protection data is temporarily stored in the RAM storage area during the chip operation phase;
[0009] The chip uses the storage protection data to encrypt the firmware data generated by the host computer, and writes the encrypted firmware data to the preset storage location of the chip.
[0010] In a possible implementation, before the chip uses the storage protection data to encrypt the firmware data generated by the host computer, the process includes:
[0011] The chip obtains the firmware data encrypted and transmitted by the host computer;
[0012] The chip uses the firmware's transmission protection data to decrypt the encrypted firmware data, and the chip obtains the firmware data.
[0013] In a possible implementation, the encrypted transmitted firmware data is obtained by using an auxiliary application to encrypt the firmware data using transmission protection data, and the firmware data is obtained by compiling the source code on a host computer.
[0014] In a possible implementation manner, determining initial protection data of a chip by a protection data generator includes:
[0015] Generate random data through a random number generator;
[0016] Use random data as initial protection data.
[0017] Among them, the data length of the initial protection data is not less than 128 bits.
[0018] In a possible implementation, obtaining firmware data includes:
[0019] Get the chip instructions sent by the host computer;
[0020] When the chip instruction is a firmware import instruction, the firmware data is obtained from the firmware import instruction.
[0021] In a possible implementation, after writing the encrypted firmware data to a preset storage location of the chip, the method further includes:
[0022] When the firmware data is received, the signature data corresponding to the firmware data is determined and the signature data is stored;
[0023] If the firmware data is not received completely, return to the step of obtaining the chip instruction sent by the host computer.
[0024] In a possible implementation manner, after obtaining the chip instruction sent by the host computer, the method further includes:
[0025] When the chip instruction is a firmware erasing instruction, erasing the firmware area corresponding to the firmware erasing instruction;
[0026] Returns the erase completed reply message.
[0027] In a possible implementation, the method further includes:
[0028] Responding to the connection establishment request sent by the host computer, establishing a connection relationship with the host computer;
[0029] When a connection relationship is established with the host computer, a firmware burning program transmitted from the host computer is obtained; wherein the firmware burning program is used to write firmware data into a preset storage location of the chip;
[0030] When the firmware burning program is started, the startup completion information is returned to the host computer.
[0031] In a possible implementation, encrypting firmware data using storage protection data includes:
[0032] Encrypt the firmware data using a preset encryption algorithm and storage protection data to obtain encrypted firmware data; wherein the encryption algorithm includes at least one of a symmetric encryption algorithm, a hash algorithm, and an asymmetric encryption algorithm;
[0033] Determine the signature data corresponding to the encrypted firmware data, where the signature data is used to prevent the firmware data from being cracked.
[0034] In a possible implementation manner, after obtaining the encrypted firmware data, the method further includes:
[0035] When the encryption algorithm is an asymmetric encryption algorithm, obtaining public protection data corresponding to the asymmetric encryption algorithm; the public protection data is used to verify the signature data;
[0036] The public protection data is stored.
[0037] In a possible implementation, the method further includes:
[0038] After the firmware data is written into the chip, it enters the safe state;
[0039] In the security state, if the identity authentication data is received and passed, the temporary debugging state is entered; the temporary debugging state is used to indicate that the firmware data is updated;
[0040] In the temporary debugging state, in response to a reset signal or a power-on signal, the safe state is restored.
[0041] In a second aspect, an embodiment of the present application provides a security chip, the security chip comprising: a memory, a RAM storage area and a processor;
[0042] The memory stores firmware data;
[0043] The RAM storage area temporarily stores storage protection data;
[0044] The processor controls the security chip to execute various possible implementations of the above method.
[0045] In a third aspect, an embodiment of the present application provides a host computer program product for a security chip, including a host computer program, which, when executed by a processor, acts as a host computer to implement various possible methods such as the above method.
[0046] The chip anti-cracking method, security chip, and program product provided by the embodiments of the present application can derive the storage protection data of the firmware through the initial protection data, and can generate highly secure storage protection data for the second time to improve the protection security of the chip. In addition, the initial protection data is generated once and cannot be repeated, which ensures that the initial protection data is the only protection data and the protection security of the chip. By encrypting the firmware data using the storage protection data, the encrypted firmware data can be written to the preset storage location of the chip, thereby improving the protection security of the chip. The present application generates the initial protection data once and can store it in an unchangeable area to prevent the protection data from being spied on and copied, and can temporarily store the storage protection data in the RAM storage area when the chip is running, avoiding long-term storage risks and improving security. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0048] Figure 1 Schematic diagram of the chip anti-cracking method provided in this application Figure 1 ;
[0049] Figure 2 Schematic diagram of the chip anti-cracking method provided in this application Figure 2 ;
[0050] Figure 3 A functional diagram of the auxiliary application provided for this application;
[0051] Figure 4 Schematic diagram of the chip anti-cracking method provided in this application Figure 3 ;
[0052] Figure 5 Schematic diagram of the chip anti-cracking method provided in this application Figure 4 ;
[0053] Figure 6 Schematic diagram of the chip anti-cracking method provided in this application Figure 5 ;
[0054] Figure 7 A schematic diagram of the process of importing firmware data into the chip provided by this application;
[0055] Figure 8 A flowchart of the lifecycle management mechanism provided for this application;
[0056] Fig. 9 A schematic diagram of the structure of the chip anti-cracking device provided in this application;
[0057] Fig.10 This is a schematic diagram of the structure of the security chip provided in this application.
[0058] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0059] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0060] With the development of the Internet of Things and intelligent manufacturing, the application and value of security chips in the embedded field have been further expanded. Firmware security is a key link in ensuring chip security. Security chips should have a complete firmware key management mechanism, firmware security storage and import mechanism and other security protection measures, and at the same time have a certain degree of software development convenience. The existing firmware protection technology still has shortcomings.
[0061] Typical security chip firmware protection solutions usually include key generation solutions, firmware encryption solutions, firmware import solutions, secure boot solutions, etc., such as:
[0062] Key generation: Security chips with firmware encryption storage functions generally have a one-time storage area that can be used to store key chip keys. These keys are imported before the chip leaves the factory or uniformly imported by the chip downstream product development manufacturer. The key import process is generally only performed once and has certain read protection, tampering protection and other measures.
[0063] Firmware encryption: Generally, the developed plaintext firmware is encrypted and signed with a pre-specified firmware key to generate secure firmware. The firmware key is generally managed by a professional administrator or software system and corresponds to the chip batch serial number. The firmware key can be pre-imported into the key storage area of the chip, or it can be encrypted by the chip root key and packaged with the firmware ciphertext and imported into the chip as secure firmware.
[0064] Firmware import: Generally, the firmware import is completed by executing a specific firmware import process through the boot firmware solidified in the chip, and stored in the firmware storage area specified by the security chip. If the firmware is stored in the on-chip Flash, it is generally stored in plain text after being decrypted by the firmware key during import, and may be protected by HASH or signature. If it is stored in non-volatile storage outside the chip, it should be encrypted and stored with a specific external storage key.
[0065] Chip secure boot: After the secure firmware is imported, the chip is generally configured to set the chip to a specific chip security state. After reset, the boot firmware embedded in the chip executes the secure boot process and loads the secure firmware.
[0066] However, the above scheme has a certain degree of protection, but it still has shortcomings. The chip may be subject to physical slice snooping attacks, firmware reverse analysis, social engineering attacks, etc., and there is a risk of being cracked and copied in batches. At the same time, the management of firmware keys adds additional workload and there is also the risk of key and firmware leakage. At the same time, the reliability design of the security chip makes the product development process more complicated. In order to simplify user use, a variety of additional security auxiliary tools must be developed, such as key file generation tools, firmware encryption tools, firmware import software tools, mass production auxiliary tools, etc.
[0067] In summary, in the related art, there is a problem that the security of chip firmware protection is not high.
[0068] The chip anti-cracking method, security chip, and program product provided by the present application can derive the storage protection data of the firmware through the initial protection data. The initial protection data generated once can be stored in an unchangeable area to prevent the protection data from being spied on and copied. The protection data can also be temporarily stored in the RAM storage area while the chip is running to avoid long-term storage risks, thereby solving the technical problem of how to improve the security of chip protection.
[0069] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0070] Figure 1 Schematic diagram of the chip anti-cracking method provided in this application Figure 1 The chip anti-cracking method provided in the embodiment of the present application can be applied to the application environment of the chip and the host computer associated with the chip. Figure 1 As shown, the method is applied to a chip as an example for explanation, including the following S101 to S103. Among them:
[0071] S101. Generate initial protection data of the chip through a protection data generator, and store the initial protection data in a one-time storage area.
[0072] Among them, the protection data generator refers to a generator for generating protection data. For example, the generator for generating protection data can be called a protection data generator. The protection data can be data used for chip security protection, or parameters used to encrypt and decrypt data. For example, the protection data can be the key of the chip. The key can be a string, a number, or other forms of data. The specific implementation form can depend on the encryption algorithm used. The initial protection data refers to the originally generated protection data, which can be unprocessed protection data. The initial protection data can be a hardware-unique key inside the chip. The one-time storage area refers to a storage area for immutable data in the chip. As an example, the initial protection data is stored in the one-time storage area and cannot be changed.
[0073] Exemplarily, a protection data generator can be used to generate unique protection data for the hardware inside the chip as the initial protection data of the present application, and the initial protection data can be stored in a one-time storage area to make it unchangeable, and the data length of the initial protection data can be set to be no less than a preset length to ensure the uniqueness of the chip hardware and the uniqueness of the protection data.
[0074] Optionally, a hardware unique key (initial protection data) can be generated inside the chip through a hardware random number generator (protection data generator), and the hardware unique key can be stored in a one-time storage area to make it unchangeable. The hardware unique key can be generated once when the chip leaves the factory, and the process cannot be repeated. The data length of the hardware unique key is not less than 128 bits, making the hardware of each chip unique. In this way, the uniqueness and unchangeable nature of the hardware unique key reduce the risk of the chip key being snooped and copied.
[0075] S102. Based on the initial protection data, storage protection data of the firmware is obtained; wherein the storage protection data is temporarily stored in the RAM storage area during the chip operation phase.
[0076] The storage protection data may be protection data used for firmware storage encryption. The RAM storage area refers to an area in the chip used for temporary storage of data.
[0077] Exemplarily, during the chip operation phase, the initial protection data can be used to derive the storage protection data of the firmware, and the storage protection data can be temporarily stored in the RAM storage area to be read and used, so as to achieve the purpose of using the storage protection data and ensure the security of the firmware's storage protection data.
[0078] Optionally, the hardware unique key can be derived through a specific or preset algorithm to obtain a firmware storage key, which is used for firmware storage encryption. The firmware storage key can be derived during the chip operation phase and temporarily stored in the RAM storage area for reading and use, thereby improving the security of the firmware key.
[0079] S103: The chip encrypts the firmware data generated by the host computer using the storage protection data, and writes the encrypted firmware data into a preset storage location of the chip.
[0080] The firmware data refers to the data of the firmware that needs to be written into the chip. The firmware may refer to the software embedded in the chip, and the firmware may provide the basic operation and functions of the chip. The preset storage location may be a preset location for storing the firmware. For example, the firmware may be stored in a non-volatile memory, such as a ROM (read-only memory), an EPROM (erasable programmable read-only memory), or a flash memory.
[0081] Among them, firmware data can generally be imported through the host computer: firmware data is usually generated by the host computer and transmitted to the chip through some communication interface (such as debugging interface, JTAG interface, SPI interface, etc.).
[0082] Exemplarily, a firmware burning algorithm may be pre-set in the chip, and the firmware burning algorithm may be run on the chip to implement the import of the firmware. The firmware burning algorithm may be a program running on the chip RAM, and the chip may be connected to the firmware data imported by an external device (e.g., a host computer) through an interface, and the firmware burning algorithm may be used to encrypt the firmware data by storing protection data, and write the encrypted firmware data to a specified storage location.
[0083] Optionally, the present application provides a firmware burning algorithm that can run on a security chip and a software auxiliary tool on the PC side, both of which can be used to import chip firmware (for example, binary firmware). The firmware burning algorithm can be a program running on the RAM of the chip. The firmware burning algorithm is imported into the chip before the firmware is burned and is used to receive firmware data sent by an external device (for example, a host computer) through a debugging interface, and the firmware burning algorithm can call the storage controller of the chip to encrypt the received firmware data and write it to a specified storage location. The firmware burning algorithm can be used in conjunction with the software auxiliary tool on the PC. The software auxiliary tool on the PC can block the user's binary firmware and encrypt and encapsulate it into a firmware burning instruction and transmit it to the chip. The firmware burning algorithm receives and parses the firmware data in the instruction, decrypts it with the firmware transmission key, and then encrypts it with the firmware key and stores it in the specified firmware storage location. The software auxiliary tool on the PC can be called after each binary firmware is compiled and generated, generates a key for this firmware transmission, and uses the generated key to encrypt the original firmware to obtain a ciphertext firmware. The firmware transmission key is loaded into the RAM of the chip before the firmware is imported, wherein the firmware transmission key can be one of the implementation forms of the firmware's transmission protection data.
[0084] In this embodiment, the chip anti-cracking method provided by the present application generates initial protection data once to make it non-repeatable, and ensures that the initial protection data is the only protection data. In this way, the uniqueness and unchangeable nature of the initial protection data reduce the risk of the chip's protection data being spied on and copied, thereby ensuring the protection security of the chip. And through the initial protection data, the storage protection data of the firmware can be derived during the chip operation phase, and the storage protection data can be temporarily stored in the RAM storage area for reading and use, thereby improving the security of the firmware key. In this way, the protection security of the chip can be improved by generating storage protection data with high security for a second time. Compared with traditional technologies, the present application encrypts the firmware data through the storage protection data obtained above, and can write the encrypted firmware data to the preset storage location of the chip, thereby improving the protection security of the chip.
[0085] In an exemplary embodiment, Figure 2 Schematic diagram of the chip anti-cracking method provided in this application Figure 2 ,like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, the step S103 is described in detail. In the step S103, before the chip uses the storage protection data to encrypt the firmware data generated by the host computer, it can specifically include S201 to S202, wherein:
[0086] S201, the chip obtains firmware data encrypted and transmitted by the host computer.
[0087] S202, the chip decrypts the encrypted firmware data using the firmware transmission protection data to obtain the firmware data;
[0088] The transmission protection data may be generated by an auxiliary application for chip protection in a host computer.
[0089] The transmission protection data may be data generated by an external device (eg, a host computer) for transmission encryption, and the transmission protection data may also be used to decrypt the transmitted data.
[0090] Among them, the firmware transmission key (transmission protection data) is generated in the upper computer software to encrypt the data to ensure transmission security; after the firmware transmission key (transmission protection data) is transmitted to the chip, the firmware transmission key will be used in the chip (that is, both the firmware data and the key are transmitted to the chip), and the data is decrypted in the chip using the key. After decryption in the chip, the firmware data / instructions can be executed and analyzed; when storing the firmware data, the chip encrypts it again.
[0091] Exemplarily, the host computer generates encrypted firmware data for transmission, encapsulates it into firmware burning instructions, and transmits it to the chip.
[0092] The chip can receive the firmware data encrypted and transmitted by the host computer through the debugging interface through the firmware burning algorithm. And the chip can decrypt the encrypted firmware data using the firmware transmission protection data through the firmware burning algorithm to obtain the decrypted firmware data. In this way, the chip can complete the reception of the firmware data, and further burn, store and process the firmware data.
[0093] Optionally, the transmission protection data can be generated by an auxiliary application of the host computer, for example, the auxiliary application of the host computer can be a software auxiliary tool on a PC. Before the firmware data is imported into the chip, the transmission protection data can be loaded into the RAM storage area of the chip to decrypt the encrypted firmware data and improve the decryption basis.
[0094] In this embodiment, by obtaining the encrypted transmitted firmware data and decrypting the encrypted transmitted firmware data using the pre-imported or loaded transmission protection data, firmware data that can be burned in the chip can be obtained, thereby ensuring the normal burning of the firmware data, and ensuring the security of the firmware through encrypted transmission to prevent data tampering, thereby further improving the protection security of the chip.
[0095] Optionally, the encrypted firmware data is transmitted in binary form.
[0096] Exemplarily, the firmware data of the chip may be binary firmware, and the binary firmware of the chip may be divided into blocks and encrypted and packaged into firmware burning instructions and transmitted to the chip. The chip may obtain the firmware data by loading the firmware burning instructions.
[0097] In practical applications, processing firmware data in binary form can ensure the correctness of the firmware data, and transmitting firmware data in binary form can ensure the effective transmission of the firmware. The binary firmware method provided in this application is conducive to effectively burning the chip firmware. Combined with the methods of the above-mentioned embodiments, the protection security of the chip can be improved.
[0098] Optionally, the encrypted transmitted firmware data is obtained by encrypting the firmware data using transmission protection data through an auxiliary application, and the firmware data is obtained by compiling the source code through a host computer.
[0099] The auxiliary application may be an application in the host computer, which is used to assist in burning the firmware data of the chip. The auxiliary application may be a software auxiliary tool on the PC side.
[0100] Among them, during the firmware transmission process, the PC-side software auxiliary tool will generate a firmware transmission key, and use this key to encrypt the firmware to form a ciphertext firmware and transmit it to the chip. After the chip receives the ciphertext, it needs to use the firmware transmission key to decrypt it so that the plaintext firmware can be obtained and stored. The decrypted firmware is encrypted with a hardware-unique key when stored to further enhance the security of the firmware. In this way, even if unauthorized users can obtain data during transmission, they cannot use the data directly because they are encrypted when stored.
[0101] The firmware storage key and the firmware transmission key are separate. The firmware transmission key is mainly used to protect data during firmware transmission, while the firmware storage key (hardware-unique key) is used for encryption operations when storing firmware inside the chip. This separation can reduce the risk of firmware leakage and reverse analysis.
[0102] Exemplarily, the host computer (PC end) can compile the source code to obtain the required firmware data. The auxiliary application of the host computer can be used to generate transmission protection data, and use the transmission protection data to encrypt the aforementioned firmware data to obtain encrypted firmware data, and the encrypted firmware data can be transmitted to the chip.
[0103] In practical applications, Figure 3 A functional diagram of the auxiliary application provided for this application; Figure 3 As shown, the functional architecture of the auxiliary application includes:
[0104] S301, compile firmware using a general integrated development environment; wherein the source code is compiled using the general integrated development environment to obtain firmware. As an example, the firmware may be a binary firmware.
[0105] S302, generating transmission protection data; wherein the transmission protection data may be generated through an auxiliary application.
[0106] S303, encryption / signature; wherein the auxiliary application can encrypt the firmware by transmitting protection data to obtain ciphertext firmware. As an example, the ciphertext firmware is the encrypted firmware data.
[0107] S304, importing firmware into a general integrated development environment; wherein the ciphertext firmware may be imported into the chip so that the chip can burn the firmware data.
[0108] In this embodiment, the firmware data is encrypted by using the transmission protection data through the auxiliary application, so that the encrypted firmware data can be obtained, which is conducive to ensuring the security protection of the firmware data transmission and improving the protection security of the chip.
[0109] Optionally, the PC-side software auxiliary tool (auxiliary application) designed by the present application can be executed in the bash environment of Windows or Linux, providing the functions of firmware transmission key generation, block encryption of binary firmware and firmware import. This makes it convenient for chip software developers to build a secure chip development environment in a general Windows integrated development environment or a Linux development environment.
[0110] The chip software integrated development environment of Windows generally provides a method to automatically load a user-defined firmware burning program. The design method of the firmware burning algorithm (firmware burning program) provided in this application can be easily applied to the development of such burning programs. The chip integrated development environment of Windows generally provides a function to execute a post-build instruction at the end of program compilation, through which some customized scripts or instructions can be executed, such as running the software auxiliary tool designed by the present invention in the form of an instruction to complete the generation of the key file required for chip firmware transmission, and use this key to encrypt the firmware. The chip integrated development environment of Windows generally also provides a function to automatically load a user-defined initialization script before executing firmware burning. The key file generated by Post-build can be automatically imported into the RAM of the chip during this process for the import of secure firmware, and then the firmware burning function of the integrated development environment is used to complete the secure import of the firmware. The Linux development environment is more flexible. Developers can execute the Linux version of the software auxiliary tool in the bash environment, and cooperate with the firmware burning algorithm to complete the generation of the firmware transmission key and the firmware import.
[0111] The chip's software development kit provides a firmware burning algorithm, software auxiliary tools on the PC, post-build scripts, and initialization scripts before firmware import. Users do not need to pay too much attention to the firmware import process and details of the security chip, so that the software operation method required for the security chip is basically the same as the operation method for developing a non-security chip, and the firmware's encrypted transmission and encrypted storage can be completed safely and reliably. In this way, this application provides a PC-side software auxiliary tool that supports a multi-platform environment, provides convenient firmware import and encryption functions, and further simplifies the development process.
[0112] In an exemplary embodiment, Figure 4 Schematic diagram of the chip anti-cracking method provided in this application Figure 3 ,like Figure 4 As shown, in this embodiment Figure 1 Based on the embodiment, step S101 is described in detail. In step S101, the initial protection data of the chip is determined by a protection data generator, including S401 to S402, wherein:
[0113] S401. Generate random data through a random number generator.
[0114] S402: Use random data as initial protection data.
[0115] The random number generator may be a generator for generating hardware random numbers, and the random data refers to a plurality of random numbers generated to form data.
[0116] Exemplarily, random data can be generated inside the chip through a random number generator, and after obtaining the random data, the chip can use the random data as initial protection data, that is, use the random data as the only protection data of the hardware, and store the random data in a one-time storage area to make it unchangeable.
[0117] In practical applications, random data is generated through a random number generator as initial protection data, which can ensure the randomness and uniqueness of the generated initial protection data, thereby improving the protection security of the chip firmware.
[0118] Optionally, the data length of the initial protection data is not less than 128 bits.
[0119] Exemplarily, the data length of the initial protection data can be set to no less than 128 bits, so that the initial protection data of the hardware of each chip is unique, ensuring the uniqueness and unchangeable nature of the hardware unique protection data, reducing the risk of the chip's protection data being spied on and copied, thereby improving the security of the chip.
[0120] In an exemplary embodiment, Figure 5 Schematic diagram of the chip anti-cracking method provided in this application Figure 4 ,like Figure 5 As shown, in this embodiment Figure 1 Based on the embodiment, step S103 is described in detail. In step S103, the firmware data is obtained, which may specifically include S501 to S502, wherein:
[0121] S501, obtaining chip instructions sent by the host computer;
[0122] S502: When the chip instruction is a firmware import instruction, obtain firmware data from the firmware import instruction.
[0123] The chip instruction may be an instruction for controlling the chip, and the firmware import instruction may be an instruction for importing firmware into the chip.
[0124] Exemplarily, the host computer can send a chip instruction to the chip, and the chip receives the instruction and determines whether the chip instruction is a firmware import instruction. If the chip instruction is a firmware import instruction, the firmware data transmitted by the host computer is obtained from the firmware import instruction. As an example, the firmware data here can be encrypted firmware data, and the implementation method of encrypted transmission can be implemented through the above-mentioned embodiment.
[0125] In this embodiment, the chip responds to the chip instruction, and when the chip instruction is a firmware import instruction, the firmware data is obtained from the firmware import instruction. In this way, the correctness of the chip map firmware can be ensured, firmware import errors can be avoided, and the risk of the chip firmware being spied on can be avoided, thereby improving the protection security of the chip.
[0126] Alternatively, if Figure 5 As shown, after writing the encrypted firmware data to a preset storage location of the chip, the method further includes:
[0127] S503: When the firmware data is received, determine the signature data corresponding to the firmware data, and store the signature data.
[0128] S504: When the firmware data is not received completely, return to the step of obtaining the chip instruction sent by the host computer.
[0129] The signature data may be a signature calculated for the encrypted firmware data. As an example, the signature data may refer to a signature value.
[0130] Exemplarily, after receiving the firmware data in the firmware import instruction, the chip can determine whether the firmware data has been received. If the firmware data has been received, the signature corresponding to the firmware data can be calculated. The signature is used to protect the firmware data of the anti-cracking chip, and the chip can store the signature data. For example, the signature data can be stored in a non-volatile memory, such as a ROM (read-only memory), EPROM (erasable programmable read-only memory) or flash memory.
[0131] If the firmware data is not completely received, the chip can continue to receive chip instructions sent by the host computer, and can continue to receive the firmware data until the firmware data is not completely received.
[0132] In actual applications, whether the firmware has been received can be determined by whether the host computer is still sending chip instructions, or by other means.
[0133] In this embodiment, by determining the signature data corresponding to the firmware data and storing the signature data when the firmware data is received, and by returning to the step of obtaining the chip instructions sent by the host computer when the firmware data is not received, the complete reception of the firmware data can be ensured, and the accuracy of the firmware imported into the chip can be ensured.
[0134] Alternatively, if Figure 5 As shown, after obtaining the chip instruction sent by the host computer, it also includes:
[0135] S505: When the chip instruction is a firmware erasing instruction, erase the firmware area corresponding to the firmware erasing instruction.
[0136] S506: Return the reply message indicating that erasure is completed.
[0137] The firmware erasing instruction may be an instruction for erasing chip firmware. The firmware area may be an area for storing firmware.
[0138] For example, the host computer can send a chip instruction to the chip, and the chip receives the instruction and determines whether the chip instruction is a firmware import instruction. If the chip instruction is a firmware erase instruction, the chip can erase the firmware data according to the firmware erase instruction, and after erasing the firmware data corresponding to the firmware erase instruction, the chip can return the information of erasure completion, so that the host computer can determine whether the chip has completed erasing the firmware data that needs to be erased. Ensure the correctness of erasing firmware data.
[0139] In actual applications, by erasing the firmware area corresponding to the firmware erase instruction when the chip instruction is a firmware erase instruction, the firmware data can be effectively erased, and by returning the reply information of the erasure completion, the accuracy of the firmware data erasure can be guaranteed.
[0140] Optionally, Figure 6 Schematic diagram of the chip anti-cracking method provided in this application Figure 5 ,like Figure 6 As shown, a chip anti-cracking method is described in detail, and the method includes:
[0141] S601, driver initialization: Initialize the chip driver.
[0142] S602, firmware key derivation: During the chip operation phase, the firmware storage protection data can be derived based on the initial protection data.
[0143] S603, command reception: The chip can receive commands transmitted by the host computer.
[0144] S604, determine whether it is a firmware import instruction, if so, execute S605; if not, execute S610.
[0145] S605, obtaining firmware data at the end of the instruction; the chip can obtain the firmware data at the end of the firmware import instruction.
[0146] S606, encrypting and hashing the current firmware data: the chip may encrypt the currently acquired firmware data, and determine hash data of the encrypted firmware data.
[0147] S607, the current firmware data ciphertext is written into the storage area; the chip can write the current encrypted firmware data into the storage area.
[0148] S608, determine whether the firmware is received; if so, execute S609, if not, execute S603.
[0149] S609, calculating the firmware signature and storing the signature; the chip can determine the signature of the encrypted firmware data and store the signature.
[0150] S610, determine whether it is a firmware erase instruction; if so, execute S611; if not, execute S612.
[0151] S611, erasing the firmware area as needed; the chip can erase the firmware data corresponding to the firmware erasing instruction.
[0152] S612: Determine whether it is other instructions; if so, execute S613, wherein the other instructions may be chip instructions other than the firmware import instruction and the firmware erase instruction.
[0153] S613, instruction processing: The chip can execute action processing corresponding to other instructions.
[0154] For example, steps S601 to S613 may be implemented by corresponding methods in various embodiments provided in this application. The embodiments provided in this application can be used to explain Figure 6 The various steps in .
[0155] In this embodiment, through the above steps S601 to S613, the firmware of the chip can be imported, and the security of the chip firmware is guaranteed, and the protection security of the chip is improved by deriving the firmware key. In addition, the instruction processing method other than the firmware import instruction provided in this embodiment can ensure the correct processing of various chip instructions.
[0156] In an exemplary embodiment, the method further comprises:
[0157] Responding to the connection establishment request sent by the host computer, establishing a connection relationship with the host computer;
[0158] When a connection relationship is established with the host computer, a firmware burning program transmitted from the host computer is obtained; wherein the firmware burning program is used to write firmware data into a preset storage location of the chip;
[0159] When the firmware burning program is started, the startup completion information is returned to the host computer.
[0160] The connection establishment request may be a request for establishing a connection. For example, the host computer may establish a connection with the chip through a debugger.
[0161] Exemplarily, the chip can obtain a connection establishment request sent by the host computer, and in response to the request, can establish a connection with the host computer through a debugger. After the chip and the host computer are connected, the chip can obtain the firmware burning program transmitted by the host computer. Through the firmware burning program, the transmitted encrypted firmware data can be decrypted, and the decrypted firmware data can be encrypted using storage protection data, and the encrypted firmware data can be written to the preset storage location of the chip.
[0162] After receiving the firmware burning program, the chip can start the firmware burning program to provide a program basis for importing firmware into the chip. After the firmware burning program is started, the chip can return the information of the startup completion to the host computer.
[0163] In this embodiment, by establishing a connection relationship with the host computer, and obtaining the firmware burning program transmitted from the host computer when the connection relationship is established with the host computer, it is possible to return the startup completion information to the host computer when the firmware burning program is started. In this way, it can be ensured that the import of the firmware burning program is completed, which is conducive to the subsequent import of the chip firmware.
[0164] Optionally, Figure 7 The flowchart of the firmware data imported into the chip provided by this application is as follows: Figure 7 As shown, the steps of importing firmware data into the chip may include:
[0165] S701. Establish a connection with the chip through a debugger; wherein the chip can establish a connection with a software development kit of a host computer through debugging.
[0166] S702, import the firmware burning algorithm into RAM; wherein, the chip software development kit can import the firmware burning algorithm (firmware burning program) into the chip, and the chip can store the imported firmware data into the RAM storage area. The chip can derive the firmware key (storage protection data) through the firmware burning algorithm.
[0167] S703, the firmware burning algorithm is started and completed; wherein, after the firmware burning algorithm (firmware burning program) is started and completed, the startup completion information can be returned to the chip software development kit.
[0168] S704, firmware area erase; wherein, if the chip software development kit sends a firmware erase instruction to the chip, the chip can erase the firmware area corresponding to the firmware erase instruction.
[0169] S705, reply of erasure completion; wherein, after the firmware erasure is completed, the chip can return the information of firmware erasure completion to the chip software development kit.
[0170] S706, firmware data block encrypted transmission; the chip software development kit can import the encrypted firmware data into the chip, and the chip can decrypt the encrypted firmware data, and after decryption, use the derived firmware key to write the firmware data to a preset storage location. The firmware data encrypted by the firmware key can also be used to calculate the signature and save the signature value.
[0171] S707, the current block data is written; wherein, after the current firmware data is imported, the chip can return the information that the current firmware data import is completed to the chip software development kit.
[0172] For example, steps S701 to S707 may be implemented by corresponding methods in various embodiments provided in this application. The embodiments provided in this application can be used to explain Figure 7 The various steps in .
[0173] In this embodiment, through the above steps S701 to S707, the firmware import and erasure of the chip can be realized, and the security of the chip firmware is guaranteed by encrypted transmission and the firmware key is derived in the chip, thereby improving the protection security of the chip. At the same time, the above method provided in this embodiment also ensures the correct processing of firmware erasure.
[0174] In an exemplary embodiment, in step S103, encrypting the firmware data using the storage protection data includes:
[0175] Encrypt the firmware data using a preset encryption algorithm and storage protection data to obtain encrypted firmware data; wherein the encryption algorithm includes at least one of a symmetric encryption algorithm, a hash algorithm, and an asymmetric encryption algorithm;
[0176] Determine the signature data corresponding to the encrypted firmware data, where the signature data is used to prevent the firmware data from being cracked.
[0177] Exemplarily, the chip uses a combination of symmetric cryptographic algorithms, hash algorithms, asymmetric cryptographic algorithms, or custom encryption logic to encrypt firmware data and calculate hash values. In addition, the firmware can be signed using an asymmetric algorithm, and the signature can be verified after the chip receives it to ensure the correctness and integrity of the firmware.
[0178] It can be understood that after each firmware data is encrypted, the hash value of the firmware data can be calculated using a hash algorithm. After the last firmware data is encrypted and hashed, the signature value of the hash value of the final firmware data is calculated to protect the confidentiality and integrity of the firmware. Similarly, firmware storage can also encrypt, hash, and sign the firmware to prevent attackers from destroying the firmware or maliciously tampering with it.
[0179] In this embodiment, by encrypting the firmware data using a preset encryption algorithm, and the encryption algorithm includes at least one of a symmetric cryptographic algorithm, a hash algorithm, and an asymmetric cryptographic algorithm; it is possible to ensure that the firmware data is effectively encrypted, thereby ensuring the security of the firmware protection. In addition, the firmware data is prevented from being cracked using signature data, further improving the firmware protection security of the chip. By using a combination of symmetric, asymmetric cryptographic algorithms and hash algorithms, the firmware data is encrypted and the hash value is calculated, and the firmware is signed and verified, further enhancing the security and integrity of the firmware.
[0180] Optionally, after obtaining the encrypted firmware data, the method further includes:
[0181] When the encryption algorithm is an asymmetric encryption algorithm, obtaining public protection data corresponding to the asymmetric encryption algorithm; the public protection data is used to verify the signature data;
[0182] The public protection data is stored.
[0183] The public protection data may be encryption data and protection data for verifying a signature. For example, the public protection data may be a public key.
[0184] Exemplarily, a security chip that uses an asymmetric algorithm signature to ensure firmware integrity must store at least one public key for firmware signature verification. After all firmware data is received by the chip, the firmware signature value is checked to ensure the correctness and integrity of the firmware transmission phase.
[0185] In this embodiment, when an asymmetric cryptographic algorithm is used, public protection data is used to verify the signature data, which is beneficial to ensuring the protection security of the firmware data.
[0186] Optionally, the method further comprises:
[0187] After the firmware data is written into the chip, it enters the safe state;
[0188] In the security state, if the identity authentication data is received and passed, the temporary debugging state is entered; the temporary debugging state is used to indicate that the firmware data is updated;
[0189] In the temporary debugging state, in response to a reset signal or a power-on signal, the safe state is restored.
[0190] Exemplarily, the method provided in the present application is applicable to a specific security chip. The security chip may have a certain life cycle management mechanism. The chip life cycle state must include the factory state, the security state, and optionally the temporary debugging state. In the factory state, the chip debugging is in an open state and can be used for chip testing, hardware unique key generation, firmware development, etc. The chip has imported a specific security configuration and can enter the safe state from the factory state. In the safe state, the chip has a debugging protection function, the debugger cannot debug the chip, and cannot read the firmware or keys. A security chip with a temporary debugging state must include at least one identity authentication key for entering the temporary debugging mode. Only managers who have been authenticated by the identity authentication key can perform key import, firmware import, firmware update, chip and other operations. The chip in the temporary debugging state is restored to the safe state after being reset or powered on again.
[0191] In practical applications, Figure 8 A flow chart of the life cycle management mechanism provided for this application is as follows: Figure 8 As shown, lifecycle management mechanisms may include:
[0192] S801, after firmware import is completed, the chip is configured to enter a safe mode; wherein, when the firmware data is written into the chip, the chip enters a safe state from a factory state.
[0193] S802, the identity authentication is legal to start temporary debugging; wherein, in a safe state, if the identity authentication data is received and the identity authentication data passes, the temporary debugging state is entered.
[0194] S803, restore to a safe state after power-off reset; wherein, in a temporary debugging state, the safe state is restored in response to a reset signal or a power-on signal.
[0195] In this embodiment, after the firmware data is written, the security state is entered; when the identity authentication data passes, the temporary debugging state is entered from the security state, and the firmware data can be updated. In the temporary debugging state, the security state can be restored to the security state in response to a reset signal or a power-on signal. In this way, the life cycle management of the chip can be completed, including factory, security and temporary debugging states, providing debugging protection and identity authentication functions, and further enhancing security and management convenience.
[0196] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0197] Fig. 9 The schematic diagram of the chip anti-cracking device provided in this application is as follows: Fig. 9 As shown, the chip anti-cracking device 90 provided in this embodiment includes:
[0198] The generating module 901 is used to generate initial protection data of a certain chip through a protection data generator, and store the initial protection data in a one-time storage area.
[0199] The derivation module 902 is used to obtain the storage protection data of the firmware based on the initial protection data; wherein the storage protection data is temporarily stored in the RAM storage area during the chip operation phase.
[0200] The writing module 903 is used for the chip to encrypt the firmware data generated by the host computer using the storage protection data, and write the encrypted firmware data into a preset storage location of the chip.
[0201] In an exemplary embodiment, the write module 903 is used for the chip to obtain the firmware data transmitted encrypted by the host computer; the chip uses the firmware's transmission protection data to decrypt the encrypted firmware data to obtain the firmware data; wherein the transmission protection data is generated by an auxiliary application in the host computer for chip protection.
[0202] In an exemplary embodiment, the encrypted firmware data is transmitted in binary form.
[0203] In an exemplary embodiment, the encrypted transmitted firmware data is obtained by using an auxiliary application to encrypt the firmware data using transmission protection data, and the firmware data is obtained by compiling the source code on a host computer.
[0204] In an exemplary embodiment, the generation module 901 is used to generate random data through a random number generator; and use the random data as initial protection data; wherein the data length of the initial protection data is not less than 128 bits.
[0205] In an exemplary embodiment, the writing module 903 is used to obtain a chip instruction sent by a host computer; when the chip instruction is a firmware import instruction, the firmware data is obtained from the firmware import instruction.
[0206] In an exemplary embodiment, the write module 903 is used to determine the signature data corresponding to the firmware data and store the signature data when the firmware data is received; if the firmware data is not received, return to the step of obtaining the chip instruction sent by the host computer.
[0207] In an exemplary embodiment, the writing module 903 is used to erase the firmware area corresponding to the firmware erasing instruction when the chip instruction is a firmware erasing instruction; and return a reply message indicating that the erasing is completed.
[0208] In an exemplary embodiment, the write module 903 is used to establish a connection relationship with the host computer in response to a connection establishment request sent by the host computer; when a connection relationship is established with the host computer, obtain a firmware burning program transmitted from the host computer; wherein the firmware burning program is used to write firmware data to a preset storage location of the chip; when the firmware burning program is started, the startup completion information is returned to the host computer.
[0209] In an exemplary embodiment, the write module 903 is used to encrypt the firmware data using a preset encryption algorithm and storage protection data to obtain encrypted firmware data; wherein the encryption algorithm includes at least one of a symmetric encryption algorithm, a hash algorithm, and an asymmetric encryption algorithm; determine the signature data corresponding to the encrypted firmware data, and the signature data is used to prevent the firmware data from being cracked.
[0210] In an exemplary embodiment, the writing module 903 is used to obtain public protection data corresponding to an asymmetric cryptographic algorithm when the encryption algorithm is an asymmetric cryptographic algorithm; the public protection data is used to verify the signature data; and the public protection data is stored.
[0211] In an exemplary embodiment, the device also includes a management module, which is used to enter a safe state when the firmware data is completed being written to the chip; in the safe state, if identity authentication data is received and the identity authentication data passes, it enters a temporary debugging state; the temporary debugging state is used to indicate an update to the firmware data; in the temporary debugging state, in response to a reset signal or a power-on signal, the safe state is restored.
[0212] The chip anti-cracking device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.
[0213] Fig.10 This is a schematic diagram of the structure of the security chip provided in this application. Fig.10 As shown, the security chip 100 provided in this embodiment includes: at least one processor 1001, a memory 1002 and a RAM storage area. Optionally, the device 100 also includes a communication component 1003. The processor 1001, the memory 1002 and the communication component 1003 are connected via a bus 1004. The RAM storage area temporarily stores protection data, and the memory stores firmware data.
[0214] In a specific implementation process, at least one processor 1001 controls the security chip to execute the computer execution instructions stored in the memory 1002, so that at least one processor 1001 controls the security chip to execute the above method.
[0215] The specific implementation process of the processor 1001 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0216] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0217] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0218] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0219] The present application also provides a host computer program product of a security chip, including a computer program, which implements the above method when executed by a processor.
[0220] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0221] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0222] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0223] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0224] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0225] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0226] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0227] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0228] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A chip anti-cracking method, characterized in that: The method comprises: Generate initial protection data of the chip through a protection data generator, and store the initial protection data in a one-time storage area; Based on the initial protection data, storage protection data of the firmware is obtained; wherein the storage protection data is temporarily stored in the RAM storage area during the chip operation phase; The chip uses the storage protection data to encrypt the firmware data generated by the host computer, and writes the encrypted firmware data into a preset storage location of the chip.
2. The method according to claim 1, characterized in that Before the chip uses the storage protection data to encrypt the firmware data generated by the host computer, the method includes: The chip obtains firmware data encrypted and transmitted by the host computer; The chip decrypts the encrypted firmware data using the firmware's transmission protection data, and the chip obtains the firmware data.
3. The method according to claim 2, characterized in that The encrypted transmitted firmware data is obtained by encrypting the firmware data using the transmission protection data through the auxiliary application, and the firmware data is obtained by compiling the source code through the host computer.
4. The method according to claim 1, characterized in that: The step of determining the initial protection data of the chip by means of a protection data generator includes: Generate random data through a random number generator; Using the random data as the initial protection data; Among them, the data length of the initial protection data is not less than 128 bits.
5. The method according to claim 1, characterized in that The obtaining of firmware data comprises: Get the chip instructions sent by the host computer; In the case where the chip instruction is a firmware import instruction, the firmware data is obtained from the firmware import instruction.
6. The method according to claim 5, characterized in that: After writing the encrypted firmware data into a preset storage location of the chip, the method further includes: When the firmware data is received, determining signature data corresponding to the firmware data, and storing the signature data; If the firmware data is not received completely, return to the step of obtaining the chip instruction sent by the host computer.
7. The method according to claim 6, characterized in that After obtaining the chip instruction sent by the host computer, the method further includes: In the case where the chip instruction is a firmware erasing instruction, erasing the firmware area corresponding to the firmware erasing instruction; Returns the erase completed reply message.
8. The method according to claim 1, characterized in that The method further comprises: In response to a connection establishment request sent by the host computer, establishing a connection relationship with the host computer; When a connection relationship is established with the host computer, a firmware burning program transmitted from the host computer is obtained; wherein the firmware burning program is used to write firmware data into a preset storage location of the chip; When the firmware burning program is started up successfully, information indicating that the program has started up is returned to the host computer.
9. The method according to claim 1, characterized in that: The encrypting the firmware data by using the storage protection data includes: Encrypting the firmware data using a preset encryption algorithm and storage protection data to obtain the encrypted firmware data; wherein the encryption algorithm includes at least one of a symmetric encryption algorithm, a hash algorithm, and an asymmetric encryption algorithm; Determine signature data corresponding to the encrypted firmware data, where the signature data is used to prevent the firmware data from being cracked.
10. The method according to claim 9, characterized in that After obtaining the encrypted firmware data, the method further includes: When the encryption algorithm is the asymmetric cryptographic algorithm, obtaining public protection data corresponding to the asymmetric cryptographic algorithm; the public protection data is used to verify the signature data; The public protection data is stored.
11. The method according to any one of claims 1 to 10, characterized in that: The method further comprises: When the firmware data is written into the chip, entering a safe state; In the security state, if identity authentication data is received and the identity authentication data passes, a temporary debugging state is entered; the temporary debugging state is used to indicate that the firmware data is updated; In the temporary debugging state, the safe state is restored in response to a reset signal or a power-on signal.
12. A security chip, characterized in that: The security chip includes: a memory, a RAM storage area and a processor; The memory stores firmware data; The RAM storage area temporarily stores the protection data; The processor controls the security chip to execute the method according to any one of claims 1-11.
13. A host computer program product for a security chip, characterized in that: It includes a host computer program, which, when executed by a processor, acts as a host computer to implement the method described in any one of claims 1-11.