Chip encryption method, decryption method, device, storage medium and chip

By integrating a random generator into the chip, obtaining chip characteristics and code characteristics, generating keys and encrypting the encryption code, the problem of low security of existing encryption chips is solved and the chip's security is improved.

CN118940328BActive Publication Date: 2025-02-18SHENZHEN HANGSHUN CHIP TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411415105.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-02-18
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

Existing encryption chips are encrypted using fixed passwords, which are easy to crack and have low security.

Method used

By integrating a random generator into the chip, obtaining chip characteristics and code characteristics, using the key generator to generate a key, encrypt the encryption code, and generate a code ciphertext.

Benefits of technology

It improves the difficulty of cracking code ciphertexts, enhances the security of the chip, and ensures that different keys are generated every time the program is burned, avoiding key leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940328B_ABST
    Figure CN118940328B_ABST
Patent Text Reader

Abstract

The present application discloses a chip encryption method, a decryption method, a device, a storage medium and a chip, wherein the chip encryption method includes obtaining the chip characteristics of the chip when a burner is used to burn the chip; when the number of bits of the program code transmitted by the burner reaches a preset encryption number, the program code reaching the preset encryption number is stored in the original text buffer area as the code to be encrypted; the code characteristics of the code to be encrypted are obtained; the chip characteristics and the code characteristics are input into a key generator to generate a key; the key is used to encrypt the code to be encrypted to obtain the code ciphertext. This scheme can improve the security of the chip.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip security technology, and in particular to a chip encryption method, decryption method, device, storage medium and chip. Background Art

[0002] With the rapid development of computer technology and data communication technology, more and more important information or private information is transmitted and stored in digital form. In order to avoid data leakage or illegal interception, existing electronic products use encryption chips for encryption protection.

[0003] However, the current encryption algorithm uses a fixed password to encrypt the important code (core code) of the chip, which is easy to be cracked and has low security. Summary of the invention

[0004] The embodiments of the present application provide a chip encryption method, a decryption method, a device, a storage medium and a chip, which can improve the security of the chip.

[0005] In a first aspect, an embodiment of the present application provides a chip encryption method, comprising:

[0006] When a chip is burned by a burner, a chip feature of the chip is obtained;

[0007] When the number of bits of the program code transmitted by the burner reaches the preset encryption number, the program code reaching the preset encryption number is stored in the original text buffer area as the code to be encrypted;

[0008] Obtaining code features of the code to be encrypted;

[0009] Inputting the chip feature and the code feature into a key generator to generate a key;

[0010] Encrypting the code to be encrypted using the key to obtain a code ciphertext;

[0011] The code ciphertext is stored in a program memory.

[0012] In the chip encryption method provided in the embodiment of the present application, a random generator is integrated inside the chip, and the chip feature includes a random number generated by the random generator;

[0013] When the chip is programmed by a programmer, before obtaining the chip characteristics of the chip, the method further includes:

[0014] An erasing operation is performed on the chip to clear the data stored on the chip and update the random generator to generate random numbers.

[0015] In the chip encryption method provided in the embodiment of the present application, the chip features also include a chip identification.

[0016] In the chip encryption method provided in the embodiment of the present application, the step of obtaining the code feature of the code to be encrypted includes:

[0017] Obtaining the random feature currently generated by the random generator;

[0018] The random feature is used as the code feature of the code to be encrypted.

[0019] In the chip encryption method provided in the embodiment of the present application, the step of obtaining the code feature of the code to be encrypted includes:

[0020] Obtaining address information of the code to be encrypted;

[0021] The address information is used as the code feature of the code to be encrypted.

[0022] In the chip encryption method provided in the embodiment of the present application, while storing the code ciphertext in the program memory, it also includes:

[0023] The code signature is stored in a program memory.

[0024] In the chip encryption method provided in the embodiment of the present application, the step of inputting the chip feature and the code feature into a key generator to generate a key includes:

[0025] Performing hash processing on the chip feature and the code feature to generate a hash value;

[0026] The preset key generation algorithm is used to generate the corresponding key by taking the hash value as input.

[0027] In a second aspect, an embodiment of the present application provides a chip decryption method, comprising:

[0028] During the program instruction fetching process, when the number of bits of the code ciphertext read from the bus reaches the preset number of decryption bits, the code ciphertext reaching the preset number of decryption bits is used as the code to be decrypted;

[0029] Acquire the code features of the code to be decrypted and the chip features of the chip;

[0030] Inputting the chip feature and the code feature into a key generator to generate a key;

[0031] The code to be decrypted is decrypted using the key to obtain a program code.

[0032] In a third aspect, an embodiment of the present application provides a chip encryption device, including:

[0033] A first acquisition unit, used for acquiring chip characteristics of the chip when the chip is programmed by a programmer;

[0034] A code cache unit, used for storing the program code that has reached the preset encryption bit number as a code to be encrypted in the original text cache area when the number of bits of the program code transmitted by the burner reaches the preset encryption bit number;

[0035] A second acquisition unit, used to acquire the code feature of the code to be encrypted;

[0036] A key generating unit, used for inputting the chip feature and the code feature into a key generator to generate a key;

[0037] The code encryption unit is used to encrypt the code to be encrypted using the key to obtain a code ciphertext.

[0038] In a fourth aspect, an embodiment of the present application provides a chip decryption device, including:

[0039] A program instruction fetch unit, used for, in the process of program instruction fetching, when the number of bits of the code ciphertext read from the bus reaches a preset number of decryption bits, using the code ciphertext reaching the preset number of decryption bits as the code to be decrypted;

[0040] A feature acquisition unit, used to acquire the code feature of the code to be decrypted and the chip feature of the chip;

[0041] A key generating unit, used for inputting the chip feature and the code feature into a key generator to generate a key;

[0042] The code decryption unit is used to decrypt the code to be decrypted using the key to obtain a program code.

[0043] In a fifth aspect, the present application provides a storage medium storing a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute any of the methods described above.

[0044] In a sixth aspect, the present application provides a chip comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.

[0045] In summary, the chip encryption method provided in the embodiment of the present application includes obtaining the chip characteristics of the chip when the chip is burned by a burner; when the number of bits of the program code transmitted by the burner reaches the preset encryption bit number, the program code reaching the preset encryption bit number is stored in the original text buffer area as the code to be encrypted; the code characteristics of the code to be encrypted are obtained; the chip characteristics and the code characteristics are input into the key generator to generate a key; the code to be encrypted is encrypted using the key to obtain the code ciphertext. This scheme generates a key according to the chip characteristics and the code characteristics, and then encrypts the code to be encrypted, so that the code ciphertexts generated on different chips are different. Even if the same set of program codes is burned multiple times in the same chip, the key generated each time is different, so that the code ciphertext generated each time is also different. That is, this scheme can increase the difficulty of cracking the code ciphertext, thereby improving the security of the chip. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0047] Figure 1 It is a flowchart of the chip encryption method provided in the embodiment of the present application.

[0048] Figure 2 This is a flow chart of the chip decryption method provided in the embodiment of the present application.

[0049] Figure 3 It is a schematic diagram of the structure of the chip encryption device provided in an embodiment of the present application.

[0050] Figure 4 It is a schematic diagram of the structure of the chip decryption device provided in an embodiment of the present application.

[0051] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] 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.

[0053] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.

[0054] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0056] In the description of the present application, it should be noted that the terms "upper", "lower", "left", "right", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0057] The current encryption algorithm uses a fixed password to encrypt the important code (core code) of the chip, which is easy to be cracked and has low security.

[0058] Based on this, the embodiments of the present application provide a chip encryption method, a decryption method, a device, a storage medium and a chip. Specifically, the chip encryption device and the chip decryption device can be integrated in a chip, and the chip can be integrated in an electronic device. The electronic device can be a server or a terminal. Among them, the terminal can include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, and a personal computer (PC), etc.; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0059] The technical solutions shown in the present application will be described in detail below through specific embodiments. It should be noted that the description order of the following embodiments is not intended to limit the priority order of the embodiments.

[0060] See also Figure 1 , Figure 1 : is a schematic diagram of the process of the chip encryption method provided in the embodiment of the present application. The specific process of the chip encryption method can be as follows:

[0061] 101. When a chip is programmed using a programmer, a chip feature of the chip is obtained.

[0062] The chip in the embodiment of the present application is a chip that can be erased multiple times, such as FLASH and EEPROM. A random generator and a key generator are integrated in the chip.

[0063] In some embodiments, the chip feature may include a random number generated by a random generator.

[0064] It should be noted that each time the chip is erased, the random generator will randomly generate a random number and store it in the chip as input to the key generator to ensure that the generated key is different each time the chip is programmed. In addition, the saved random number is not readable by the user.

[0065] That is, before step 101, the process may further include: performing an erasing operation on the chip to clear the data stored on the chip, and updating the random generator to generate random numbers.

[0066] In addition, the chip characteristics may also include chip identification, such as the chip's unique identifier (UID), chip trust root, or Mac address.

[0067] 102. When the number of bits of the program code transmitted by the burner reaches the preset number of encryption bits, the program code reaching the preset number of encryption bits is stored in the original text buffer area as the code to be encrypted.

[0068] The preset encryption bit number can be set according to actual conditions. For example, the preset encryption bit number can be 16 bits, 32 bits, 64 bits, 128 bits, etc.

[0069] It is understandable that the length of the original text buffer is the same as the length of the code to be encrypted. For example, when the length of the code to be encrypted is 16 bits, the length of the original text buffer is also 16 bits. When the length of the code to be encrypted is 32 bits, the length of the original text buffer is also 32 bits.

[0070] 103. Obtain code features of the code to be encrypted.

[0071] In some embodiments, after the code to be encrypted is stored in the original text buffer, the random generator will randomly generate a random feature corresponding to the code to be encrypted. At this time, the random feature can be used as the code feature of the code to be encrypted, and the corresponding key is different each time encryption and decryption.

[0072] That is, step 102 may include: obtaining the random feature currently generated by the random generator; and using the random feature as the code feature of the code to be encrypted.

[0073] In a programming environment, each piece of program code has its own unique physical or logical location, which is usually identified by address information. This address information can be a memory address, an offset in the file system, or any identifier that can uniquely refer to a code fragment.

[0074] Therefore, in some embodiments, the address information of the code to be encrypted can be used as the code feature of the code to be encrypted. Using the address information as the code feature is not only the content of the encrypted code, but also the location information of the encrypted code in the program or file structure, thereby increasing the difficulty of cracking.

[0075] That is, step 102 may include: obtaining address information of the code to be encrypted; and using the address information as a code feature of the code to be encrypted.

[0076] The address information can be obtained in many ways. For example, the address information of the program code can be obtained through the command line or API. For example, in some projects, the address information may be stored in the configuration file. For example, package.json (for Node.js projects) or pom.xml (for Maven projects) may contain the address information of dependencies or modules.

[0077] 104. Input the chip features and code features into a key generator to generate a key.

[0078] In some embodiments, the key generator may use a preset key generation algorithm to directly process chip features and code features to generate a key.

[0079] In another embodiment, the key generator may also pre-process the chip features and code features to generate input data for the key generation algorithm, and then use the key generation algorithm to process the input data to generate the corresponding key. For example, the chip features and code features may be hashed to generate a hash value; then the preset key generation algorithm may be used to take the hash value as input to generate the corresponding key.

[0080] In some embodiments, a timestamp can be introduced as another input parameter in the process of generating a key. The addition of a timestamp can ensure that each encryption operation is unique. Even if the chip features and code features remain unchanged, the generated keys will be different due to different timestamps, thereby increasing the difficulty of cracking.

[0081] The preset key generation algorithm is a symmetric encryption algorithm, such as data discretization, "data scrambling" and other algorithms. It should be noted that in the embodiment of the present application, the key is not saved but generated in real time.

[0082] 105. The key is used to encrypt the code to be encrypted to obtain the code ciphertext.

[0083] Encryption refers to the process of converting plaintext (code to be encrypted) into ciphertext (code ciphertext) using an encryption algorithm and a key. This conversion process is irreversible, or in other words, without the correct key, the ciphertext cannot be easily deciphered back into plaintext.

[0084] In the embodiments of the present application, the encryption algorithm is not the focus, so the encryption algorithm is not limited. The encryption process corresponding to different encryption algorithms is different. For example, taking the Advanced Encryption Standard (AES) encryption algorithm as an example, the encryption process may include initialization vector generation, key expansion, round function and ciphertext generation.

[0085] It can be understood that after obtaining the code ciphertext, the code ciphertext can be stored in the program memory.

[0086] It is understandable that when the code feature of the code to be encrypted is a random feature generated by a random generator, it is necessary to store the code feature in the program memory at the same time as the code ciphertext is stored in the program memory, so that the code feature can be directly obtained from the program memory during the subsequent decryption process. When the code feature is the address information of the code to be encrypted, there is no need to store the code feature additionally.

[0087] In summary, the chip encryption method provided by the embodiment of the present application includes obtaining the chip characteristics of the chip when the chip is burned by a burner; when the number of bits of the program code transmitted by the burner reaches the preset encryption number, the program code reaching the preset encryption number is stored as the code to be encrypted in the original text buffer area; the code characteristics of the code to be encrypted are obtained; the chip characteristics and the code characteristics are input into the key generator to generate a key; the key is used to encrypt the code to be encrypted to obtain the code ciphertext. This scheme generates a key according to the chip characteristics and the code characteristics, and then encrypts the code to be encrypted, so that the code ciphertexts generated on different chips are different. Even if the same set of program codes is burned multiple times in the same chip, the key generated each time is different, so that the code ciphertext generated each time is also different. That is, this scheme can increase the difficulty of cracking the code ciphertext, thereby improving the security of the chip. In addition, the key is generated each time the program is burned, which is invisible to developers and users, avoiding the problem of key leakage, and further improving the security of the chip.

[0088] See also Figure 2 , the embodiment of the present application also provides a chip decryption method. The meanings of the terms are the same as those in the above chip encryption method, and the specific implementation details can be described in the chip encryption method embodiment. The specific process of the chip decryption method can be as follows:

[0089] 201. During the program instruction fetching process, when the number of bits of the code ciphertext read from the bus reaches a preset number of decryption bits, the code ciphertext reaching the preset number of decryption bits is used as the code to be decrypted.

[0090] The program execution process includes the process of program instruction fetching, instruction parsing and instruction execution. In the embodiment of the present application, decryption only involves the program instruction fetching part.

[0091] The preset decryption bit number can be set according to actual conditions. For example, the preset decryption bit number can be 16 bits, 32 bits, 64 bits, 128 bits, etc. It is understandable that the preset decryption bit number is the same as the preset encryption bit number.

[0092] It is understandable that during the program fetch process, the program memory communicates with the processor via the bus. The processor reads instructions stored in the program memory via the bus. In the embodiment of the present application, the processor reads the ciphertext (code ciphertext) from the bus and then decrypts the ciphertext, which can effectively prevent the cover from being opened and cracked.

[0093] 202. Obtain code features of the code to be decrypted and chip features of the chip.

[0094] The code features of the code to be decrypted and the chip features of the chip are the same as the code features of the code to be encrypted and the chip features of the chip in the embodiment of the chip encryption method.

[0095] It is understandable that when the code feature is a random feature generated by a random generator, since the code feature has been stored in the program memory during the encryption process, it can be directly obtained from the program memory. When the code feature is address information, the code feature can be obtained in the manner described in the chip encryption method embodiment, which will not be described in detail here.

[0096] 203. Input the chip features and code features into a key generator to generate a key.

[0097] It can be understood that the key generation process is the same as the chip encryption method embodiment.

[0098] 204. Decrypt the code to be decrypted using the key to obtain the program code.

[0099] Specifically, an encryption algorithm corresponding to the encryption algorithm can be used to decrypt the code to be decrypted. This is not the focus of this application and will not be elaborated here.

[0100] After obtaining the program code, the program code may be stored in an original text buffer area.

[0101] In the chip decryption method in the embodiment of the present application, since the encrypted code is transmitted on the bus, the possibility of opening the cover and pirating is effectively prevented. That is, this solution can improve the security of the chip.

[0102] In order to better implement the chip encryption method provided in the embodiment of the present application, the embodiment of the present application also provides a chip encryption device, wherein the meanings of the terms are the same as those in the above chip encryption method, and the specific implementation details can refer to the description in the method embodiment.

[0103] See also Figure 3 , Figure 330 is a schematic diagram of the structure of the chip encryption device provided in the embodiment of the present application. The chip encryption device may include a first acquisition unit 301, a code cache unit 302, a second acquisition unit 303, a key generation unit 304 and a code encryption unit 305.

[0104] The first acquisition unit 301 is used to acquire chip characteristics of the chip when the chip is programmed by a programmer;

[0105] The code buffer unit 302 is used for storing the program code reaching the preset encryption bit number as the code to be encrypted in the original text buffer area when the number of bits of the program code transmitted by the burner reaches the preset encryption bit number;

[0106] The second acquisition unit 303 is used to acquire the code feature of the code to be encrypted;

[0107] The key generation unit 304 is used to input the chip characteristics and the code characteristics into the key generator to generate a key;

[0108] The code encryption unit 305 is used to encrypt the code to be encrypted using a key to obtain a code ciphertext. The specific implementation of each of the above units can refer to the above chip encryption method embodiment, which will not be described one by one here.

[0109] In summary, the chip encryption device provided in the embodiment of the present application can obtain the chip characteristics of the chip by the first acquisition unit 301 when the chip is burned by the burner; when the number of bits of the program code transmitted by the burner reaches the preset encryption bit number, the code cache unit 302 stores the program code reaching the preset encryption bit number as the code to be encrypted in the original text cache area; the second acquisition unit 303 obtains the code characteristics of the code to be encrypted; the key generation unit 304 inputs the chip characteristics and code characteristics into the key generator to generate a key; the code encryption unit 305 uses the key to encrypt the code to be encrypted to obtain the code ciphertext. This scheme generates a key according to the chip characteristics and code characteristics, and then encrypts the code to be encrypted, so that the code ciphertexts generated on different chips are different. Even if the same set of program codes is burned multiple times in the same chip, the key generated each time is different, so that the code ciphertext generated each time is also different. That is, this scheme can increase the difficulty of cracking the code ciphertext, thereby improving the security of the chip. In addition, the key is generated each time the program is burned and is invisible to developers and users, avoiding the problem of key leakage and further improving the security of the chip.

[0110] In order to better implement the chip decryption method provided in the embodiment of the present application, the embodiment of the present application also provides a chip decryption device, wherein the meanings of the terms are the same as those in the above chip decryption method, and the specific implementation details can refer to the description in the method embodiment.

[0111] See also Figure 4 , Figure 4 401 is a schematic diagram of the structure of a chip decryption device provided in an embodiment of the present application. The chip decryption device may include a program instruction fetching unit 401, a feature acquisition unit 402, a key generation unit 403 and a code decryption unit 404.

[0112] The program instruction fetching unit 401 is used to, when the number of bits of the code ciphertext read from the bus reaches a preset number of decryption bits during the program instruction fetching process, use the code ciphertext reaching the preset number of decryption bits as the code to be decrypted;

[0113] A feature acquisition unit 402 is used to acquire code features of the code to be decrypted and chip features of the chip;

[0114] The key generation unit 403 is used to input the chip characteristics and the code characteristics into the key generator to generate a key;

[0115] The code decryption unit 404 is used to decrypt the code to be decrypted using a key to obtain a program code.

[0116] The specific implementation of each of the above units can refer to the above-mentioned embodiment of the chip encryption method, which will not be described one by one here.

[0117] In the chip decryption device in the embodiment of the present application, since the encrypted code is transmitted on the bus, the possibility of opening the cover and pirating is effectively prevented. That is, this solution can improve the security of the chip.

[0118] The embodiment of the present application also provides a chip, in which the chip decryption device and chip encryption device provided in the embodiment of the present application can be integrated. The chip includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above chip encryption method or chip decryption method when executing the computer program.

[0119] The present application also provides an electronic device, in which the chip of the present application can be integrated, such as Figure 5 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0120] The electronic device may include components such as a radio frequency (RF) circuit 501, a memory 502 including one or more computer-readable storage media, an input unit 503, a display unit 504, a sensor 505, an audio circuit 506, a wireless fidelity (WiFi) module 507, a processor 508 including one or more processing cores, and a power supply 509. Those skilled in the art will appreciate that Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0121] The RF circuit 501 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 508 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 501 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (Subscriber Identity Module, SIM) card, a transceiver, a coupler, a low noise amplifier (LowNoiseAmplifier, LNA), a duplexer, etc. In addition, the RF circuit 501 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General PacketRadio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.

[0122] The memory 502 can be used to store software programs and modules. The processor 508 executes various functional applications and information processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 502 may also include a memory controller to provide the processor 508 and the input unit 503 with access to the memory 502.

[0123] The input unit 503 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, in a specific embodiment, the input unit 503 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touch pad, can collect the user's touch operations on or near it (such as the user's operation on or near the touch-sensitive surface using any suitable object or accessory such as a finger, a stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 508, and can receive and execute the command sent by the processor 508. In addition, the touch-sensitive surface can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 503 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0124] The display unit 504 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 504 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 508 to determine the type of touch event. The processor 508 then provides a corresponding visual output on the display panel according to the type of touch event. Although in Figure 5 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.

[0125] The electronic device may also include at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; As for other sensors that can be configured in electronic devices, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0126] The audio circuit 506, the speaker, and the microphone can provide an audio interface between the user and the electronic device. The audio circuit 506 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 506 and converted into audio data, and then the audio data is output to the processor 508 for processing, and then sent to another electronic device through the RF circuit 501, or the audio data is output to the memory 502 for further processing. The audio circuit 506 may also include an earplug jack to provide communication between an external headset and the electronic device.

[0127] WiFi is a short-range wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through WiFi module 507. It provides users with wireless broadband Internet access. Figure 5 , a WiFi module 507 is shown, but it is understandable that it is not a necessary component of the electronic device and can be omitted as needed without changing the essence of the invention.

[0128] The processor 508 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 502 and calling data stored in the memory 502, it executes various functions of the electronic device and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 508 may include one or more processing cores; preferably, the processor 508 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 508.

[0129] The electronic device also includes a power supply 509 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 508 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 509 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0130] Although not shown, the electronic device may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 508 in the electronic device will load the executable files corresponding to the processes of one or more applications into the memory 502 according to the following instructions, and the processor 508 will run the application stored in the memory 502 to achieve various functions, such as:

[0131] When a chip is programmed using a programmer, the chip characteristics of the chip are obtained;

[0132] When the number of bits of the program code transmitted by the burner reaches the preset encryption number, the program code reaching the preset encryption number is stored in the original text buffer area as the code to be encrypted;

[0133] Obtain code features of the code to be encrypted;

[0134] Input the chip features and code features into a key generator to generate a key;

[0135] The code to be encrypted is encrypted using a key to obtain a code ciphertext.

[0136] or,

[0137] During the program instruction fetching process, when the number of bits of the code ciphertext read from the bus reaches the preset number of decryption bits, the code ciphertext reaching the preset number of decryption bits is used as the code to be decrypted;

[0138] Obtaining code features of the code to be decrypted and chip features of the chip;

[0139] Input the chip features and code features into a key generator to generate a key;

[0140] The key is used to decrypt the code to be decrypted to obtain the program code.

[0141] In summary, the electronic device provided by the embodiment of the present application can generate a key according to the chip features and the code features, and then encrypt the code to be encrypted, so that the code ciphertexts generated on different chips are different. Even if the same set of program codes is burned multiple times in the same chip, the key generated each time is different, so that the code ciphertext generated each time is also different. That is, this scheme can increase the difficulty of cracking the code ciphertext, thereby improving the security of the chip. In addition, the key is generated each time the program is burned, which is invisible to developers and users, avoiding the problem of key leakage, and further improving the security of the chip. In addition, since the ciphertext code is transmitted on the bus, the possibility of opening the cover and pirating is effectively prevented.

[0142] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the chip encryption method and decryption method above, which will not be repeated here.

[0143] It should be noted that, for the chip encryption method and decryption method in the embodiments of the present application, those skilled in the art can understand that all or part of the processes of implementing the chip encryption method and decryption method in the embodiments of the present application can be completed by controlling the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, such as stored in a memory of an electronic device, and executed by at least one processor in the electronic device. During the execution process, it can include processes such as the embodiments of the chip encryption method and decryption method.

[0144] For the chip encryption device and decryption device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.

[0145] To this end, the present application embodiment provides a storage medium, which stores multiple instructions, which can be loaded by a processor to execute the steps in any chip encryption method and decryption method provided in the present application embodiment. The storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.

[0146] The chip encryption method, decryption method, device, storage medium and chip provided by the present application are respectively introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the core idea of ​​the present application; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A chip encryption method, characterized in that: The chip is internally integrated with a random generator, and the chip encryption method includes: Performing an erasing operation on the chip to clear the data stored on the chip and update the random generator to generate a random number; When a chip is programmed using a programmer, a chip feature of the chip is obtained, wherein the chip feature includes the random number; When the number of bits of the program code transmitted by the burner reaches the preset encryption number, the program code reaching the preset encryption number is stored in the original text buffer area as the code to be encrypted; Obtaining a random feature currently generated by the random generator and corresponding to the code to be encrypted; Using the random feature as the code feature of the code to be encrypted; Inputting the chip feature and the code feature into a key generator to generate a key; The key is used to encrypt the code to be encrypted to obtain a code ciphertext.

2. The chip encryption method according to claim 1, characterized in that: The chip characteristics also include a chip identification.

3. A chip decryption method, used to decrypt a chip encrypted by the chip encryption method according to any one of claims 1 to 2, characterized in that: The chip decryption method comprises: During the program instruction fetching process, when the number of bits of the code ciphertext read from the bus reaches the preset number of decryption bits, the code ciphertext reaching the preset number of decryption bits is used as the code to be decrypted; Acquire the code features of the code to be decrypted and the chip features of the chip; Inputting the chip feature and the code feature into a key generator to generate a key; The code to be decrypted is decrypted using the key to obtain a program code.

4. A chip encryption device, characterized in that: The chip is internally integrated with a random generator, and the chip encryption device comprises: The first acquisition unit is used to perform an erasing operation on the chip to clear the data stored on the chip and update the random generator to generate a random number; obtain the chip characteristics of the chip, the chip characteristics including the random number; when the chip is burned by a burner, the chip characteristics of the chip are obtained, the chip characteristics including the random number; A code cache unit, used for storing the program code that has reached the preset encryption bit number as a code to be encrypted in the original text cache area when the number of bits of the program code transmitted by the burner reaches the preset encryption bit number; A second acquisition unit is used to acquire the random feature currently generated by the random generator and corresponding to the code to be encrypted; and use the random feature as the code feature of the code to be encrypted; A key generating unit, used for inputting the chip feature and the code feature into a key generator to generate a key; The code encryption unit is used to encrypt the code to be encrypted using the key to obtain a code ciphertext.

5. A chip decryption device, used for decrypting a chip encrypted by the chip encryption method according to any one of claims 1 to 2, characterized in that: include: A program instruction fetch unit, used for, in the process of program instruction fetching, when the number of bits of the code ciphertext read from the bus reaches a preset number of decryption bits, using the code ciphertext reaching the preset number of decryption bits as the code to be decrypted; A feature acquisition unit, used to acquire the code feature of the code to be decrypted and the chip feature of the chip; A key generating unit, used for inputting the chip feature and the code feature into a key generator to generate a key; The code decryption unit is used to decrypt the code to be decrypted using the key to obtain a program code.

6. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the method according to any one of claims 1-2 or 3.

7. A chip, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 2 or 3 when executing the computer program.

Citation Information

Patent Citations

  • Firmware burning method, device and system for micro-control chip and storage medium

    CN115544464A

  • Firmware encrypting and decrypting method and an apparatus using the same

    CN1641717A