CN115080998A - Method, system, electronic device and storage medium for preventing firmware from being illegally copied - Google Patents

Method, system, electronic device and storage medium for preventing firmware from being illegally copied Download PDF

Info

Publication number
CN115080998A
CN115080998A CN202210622264.5A CN202210622264A CN115080998A CN 115080998 A CN115080998 A CN 115080998A CN 202210622264 A CN202210622264 A CN 202210622264A CN 115080998 A CN115080998 A CN 115080998A
Authority
CN
China
Prior art keywords
calculation result
firmware
random number
control unit
judging
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210622264.5A
Other languages
Chinese (zh)
Inventor
王小军
杨高铸
张菲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Li Chuangpu Power Supply Technology Co ltd
Original Assignee
Shenzhen Li Chuangpu Power Supply Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Li Chuangpu Power Supply Technology Co ltd filed Critical Shenzhen Li Chuangpu Power Supply Technology Co ltd
Priority to CN202210622264.5A priority Critical patent/CN115080998A/en
Publication of CN115080998A publication Critical patent/CN115080998A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to a method, a system, an electronic device and a storage medium for preventing firmware from being illegally copied, which comprises the following steps: the control unit generates a first random number and sends the first random number to the encryption unit; the encryption unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit; the control unit calculates based on the first random number to obtain a second calculation result; the control unit judges whether a first calculation result returned by the encryption unit is received within a preset time period; if the first calculation result is received, whether the second calculation result is matched with the first calculation result is judged; if so, judging that the firmware is legal; if not, judging that the firmware is illegal; and if the first calculation result is not received, judging that the firmware is illegal. The invention can effectively prevent the firmware from being illegally copied or copied, reduce the risk and loss and effectively protect the intellectual property rights of the firmware owner.

Description

Method, system, electronic device and storage medium for preventing firmware from being illegally copied
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method, a system, an electronic device, and a storage medium for preventing firmware from being illegally copied.
Background
With the wide application of intelligent electronic products, MCU-based embedded systems are increasingly widely used. The software that directs the MCU to run, known as "firmware", constitutes the core intellectual property of the product and is also the core competitiveness of the product plant. Because the hardware is easy to be cracked and copied, and the software determines various details of product control, the principle of the product control cannot be directly known by people. In addition, in the development period of the product, the workload of software development is far greater than that of hardware, once the software is cracked and copied, product manufacturers suffer great loss, and therefore the problem that the firmware of the product is protected from being illegally copied is very much paid attention to by all embedded system product manufacturers.
For a simple MCU, a Flash memory is arranged in the MCU to store firmware, and the firmware can be prevented from being illegally read out only by setting a programmer to prevent reading out during burning, so that the firmware can be written into other MCU chips, and the protection is not a problem. However, for a complex MCU, the firmware is very complex and huge, the corresponding Flash volume requirement is also very large, and due to the IC manufacturing process limitation, the MCU built-in Flash cannot be satisfied, and only a dedicated Flash memory, namely NAND Flash, is used, however, the content of NAND Flash is very easy to read, and thus, there is still a risk that the firmware of the complex MCU is illegally copied.
Disclosure of Invention
The present invention is directed to a method, a system, an electronic device, and a storage medium for preventing firmware from being illegally copied.
The technical scheme adopted by the invention for solving the technical problem is as follows: a method for preventing firmware from being illegally copied is constructed, and the method comprises the following steps:
the control unit generates a first random number and sends the first random number to the encryption unit;
the encryption unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit;
the control unit calculates based on the first random number to obtain a second calculation result;
the control unit judges whether a first calculation result returned by the encryption unit is received within a preset time period;
if the first calculation result is received, judging whether the second calculation result is matched with the first calculation result;
if so, judging that the firmware is legal;
if not, judging that the firmware is illegal;
and if the first calculation result is not received, judging that the firmware is illegal.
In the method for preventing firmware from being illegally copied according to the present invention, the method further includes:
if the firmware is judged to be illegal, not executing all or part of functions of the firmware;
and if the firmware is judged to be legal, the firmware normally runs.
In the method for preventing firmware from being illegally copied, the encrypting unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit, and the method comprises the following steps:
the encryption unit calculates the first random number according to a pre-stored key and a preset algorithm, obtains the first calculation result and sends the first calculation result to the control unit;
the control unit performs calculation based on the first random number, and obtaining a second calculation result includes:
and the control unit calculates the first random number according to a pre-stored secret key and a preset algorithm to obtain the second calculation result.
The present invention also provides a system for preventing firmware from being illegally copied, comprising: a control unit, an encryption unit in communication with the control unit;
the control unit is used for: generating a first random number, sending the first random number to the encryption unit, and calculating based on the first random number to obtain a second calculation result;
the control unit is further configured to: judging whether a first calculation result returned by the encryption unit is received within a preset time period; if the first calculation result is received, judging whether the second calculation result is matched with the first calculation result; if so, judging that the firmware is legal; if not, judging that the firmware is illegal; if the first calculation result is not received, judging that the firmware is illegal;
the encryption unit is configured to: and receiving the first random number, calculating the first random number to obtain a first calculation result, and returning the first calculation result to the control unit.
The present invention also provides an electronic device comprising: a memory and a processor; the memory is for storing program instructions and the processor is for performing the steps of the method as described above in accordance with the program instructions stored by the memory.
The invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method as described above.
The method, the system, the electronic equipment and the storage medium for preventing the firmware from being illegally copied have the following beneficial effects: the method comprises the following steps: the control unit generates a first random number and sends the first random number to the encryption unit; the encryption unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit; the control unit calculates based on the first random number to obtain a second calculation result; the control unit judges whether a first calculation result returned by the encryption unit is received within a preset time period; if the first calculation result is received, whether the second calculation result is matched with the first calculation result is judged; if so, judging that the firmware is legal; if not, judging that the firmware is illegal; and if the first calculation result is not received, judging that the firmware is illegal. The invention can effectively prevent the firmware from being illegally copied or copied, reduce the risk and loss and effectively protect the intellectual property rights of the firmware owner.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flowchart illustrating a first embodiment of a method for preventing firmware from being illegally copied according to the present invention;
fig. 2 is a schematic structural diagram of a system for preventing firmware from being illegally copied according to the present invention.
Detailed Description
For a more clear understanding of the technical features, objects and effects of the present invention, embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a first embodiment of a method for preventing firmware from being illegally copied according to the present invention is shown.
As shown in fig. 1, the method for preventing firmware from being illegally copied includes the steps of:
in step S101, the control unit 20 generates a first random number and transmits the first random number to the encryption unit 40.
The memory 30 is a memory 30 in the system, and is used for storing firmware.
Optionally, in the embodiment of the present invention, the control unit 20 may be a main MCU. The control unit 20 may generate the first random number by using a preset method at startup or before reading the firmware, and send the generated first random number to the encryption unit 40.
Optionally, in the embodiment of the present invention, the preset random number generation method may include, but is not limited to, contents of a random chapter in a memory, a timer code, and the like when the host MCU is powered on, or may be a combination of the contents.
Optionally, in this embodiment of the present invention, the encryption unit 40 may be an encryption chip. The encryption chip can be a simple MCU with a built-in Flash, or can also adopt an MCU with one-time write (OTP). By adopting this type of MCU, the device cost can be greatly reduced, and the procedure is relatively simple. In other embodiments, the cryptographic chip may also perform other functions, such as storing operational parameters of the device.
In the embodiment of the present invention, the encryption chip and the main MCU may be in communication connection through various interfaces, for example, but not limited to, a standard IIC, an SPI, a UART, a custom interface, and the like may be adopted, or a custom communication format may also be adopted, as long as bidirectional reliable communication can be achieved.
The invention can effectively prevent the firmware from being illegally copied by adopting the simple MCU as the encryption chip.
Optionally, in some embodiments, the encryption chip is not only used for encryption, but also can share part of the processing load of the MCU.
Optionally, if the encryption chip is missing or damaged, and the MCU considers the firmware to be illegal, the function of the firmware may be partially or completely disabled. Any MCU behavior is different due to the existence of the encryption chip, and the method belongs to the protection scope of the invention.
In step S102, the encryption unit 40 receives the first random number, calculates the first random number, obtains a first calculation result, and sends the first calculation result to the control unit 20.
In some embodiments, the encrypting unit 40 receives the first random number, calculates the first random number, and sends the first calculation result to the control unit 20, including: the encryption unit 40 calculates the first random number according to the pre-stored key and the preset algorithm, obtains a first calculation result, and sends the first calculation result to the control unit 20.
Optionally, in some embodiments, the predetermined algorithm may include, but is not limited to, an exclusive or operation, a square operation, a shift operation, an addition and subtraction operation, a multiplication and division operation, and a permutation and combination thereof.
In step S103, the control unit 20 performs calculation based on the first random number to obtain a second calculation result.
Optionally, in some embodiments, the controlling unit 20 performs calculation based on the first random number, and obtaining the second calculation result includes: the control unit 20 calculates the first random number according to the pre-stored secret key and the preset algorithm to obtain a second calculation result.
Specifically, in the embodiment of the present invention, when the encryption unit 40 performs the calculation of the first calculation result, the control unit 20 also performs the same operation based on the pre-stored key (the pre-stored key is the same as the key pre-stored by the encryption unit 40), that is, calculates the first random number and the pre-stored key by using the preset algorithm, and obtains the second calculation result.
In step S104, the control unit 20 determines whether the first calculation result returned by the encryption unit 40 is received within a preset time period.
The preset time period may be determined according to actual use, and the present invention is not particularly limited.
Step S105, if the first calculation result is received, whether the second calculation result is matched with the first calculation result is judged.
And step S106, if the firmware is matched with the firmware, judging that the firmware is legal.
And step S107, if the firmware is not matched with the firmware, judging that the firmware is illegal.
And step S108, if the first calculation result is not received, judging that the firmware is illegal.
Further, in some embodiments, if the firmware is determined to be illegal, all or part of the functions of the firmware are not executed, i.e., when the firmware is determined to be illegal, all or part of the functions of the firmware cannot be executed. And if the firmware is judged to be legal, the firmware normally runs.
Specifically, the firmware continues to execute the firmware or refuses to execute the firmware according to the judgment result of the validity.
In the embodiment of the invention, the data communication can be prevented from being monitored by an exhaustive method when the firmware runs by adopting a random number method, so that the feedback information of the encryption chip can be simulated. Wherein, the more the digit of the random number (such as the first random number of the present invention) is, the more difficult the monitoring becomes. Therefore, the invention can set the digit of the random number according to the actual requirement.
Furthermore, in the embodiment of the invention, the encryption chip with the built-in Flash is adopted, and the built-in Flash of the encryption chip cannot be read, so that the firmware cannot be copied or copied as long as the algorithm is leaked, and the aim of preventing the firmware from being illegally copied or copied can be achieved.
Referring to fig. 2, a schematic structural diagram of an alternative embodiment of the system for preventing firmware from being copied according to the present invention is shown.
The system for preventing the firmware from being illegally copied can prevent the firmware from being illegally copied by the method for preventing the firmware from being illegally copied, which is disclosed by the embodiment of the invention.
Specifically, as shown in fig. 2, the system for preventing firmware from being illegally copied includes: a control unit 20, an encryption unit 40 in communication with the control unit 20.
The control unit 20 is configured to: generates a first random number and sends the first random number to the encryption unit 40, and performs calculation based on the first random number to obtain a second calculation result.
Further, in this embodiment of the present invention, the control unit 20 is further configured to: judging whether a first calculation result returned by the encryption unit 40 is received within a preset time period; if the first calculation result is received, whether the second calculation result is matched with the first calculation result is judged; if the firmware is matched with the firmware, judging that the firmware is legal; and if not, judging that the firmware is illegal.
The encryption unit 40 is configured to: the first random number is received and calculated to obtain a first calculation result, and the first calculation result is returned to the control unit 20.
The firmware can continue to execute or refuse to execute according to the judgment result of the legality.
Further, as shown in fig. 2, the system for preventing firmware from being illegally copied may further include an output device 50, an input device 60, and the like.
Optionally, in some embodiments, the output device 50 may include a display device such as a display screen, for example, and may include, but is not limited to, a liquid crystal display, a TFT liquid crystal display, an OLED display, an AMOLED display, a speaker, a vibrator, and the like.
Alternatively, in some embodiments, the input device 60 may receive entered numeric or character information and generate key signal inputs relating to user settings and function controls of the data protection apparatus. Input devices 60 may include, but are not limited to, keys, a keyboard, a mouse, a touch screen, a microphone, a camera, etc., among others. Alternatively, the input device 60 may be a detection device, such as a sensor or the like. Optionally, in the embodiment of the present invention, the system for preventing the firmware from being illegally copied may be an embedded system or another complex system.
By adding a simple MCU as an encryption chip to the embedded system and adding a proper algorithm, the firmware can be protected from being illegally copied, and economic benefits are effectively maintained. The mode can not bring extra operation burden to a production line, and is convenient for large-scale production of products.
The present invention also provides an electronic device comprising: a memory 30 and a processor; the memory 30 is used for storing program instructions and the processor is used for executing the steps of the method disclosed by the embodiment of the invention according to the program instructions stored in the memory 30.
The invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method as disclosed in embodiments of the invention.
The above embodiments are merely illustrative of the technical ideas and features of the present invention, and are intended to enable those skilled in the art to understand the contents of the present invention and implement the present invention, and not to limit the scope of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be covered by the claims of the present invention.

Claims (6)

1. A method for preventing firmware from being illegally copied, comprising the steps of:
the control unit generates a first random number and sends the first random number to the encryption unit;
the encryption unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit;
the control unit calculates based on the first random number to obtain a second calculation result;
the control unit judges whether a first calculation result returned by the encryption unit is received within a preset time period;
if the first calculation result is received, judging whether the second calculation result is matched with the first calculation result;
if so, judging that the firmware is legal;
if not, judging that the firmware is illegal;
and if the first calculation result is not received, judging that the firmware is illegal.
2. The method for preventing firmware from being illegally copied according to claim 1, wherein the method further comprises:
if the firmware is judged to be illegal, not executing all or part of functions of the firmware;
and if the firmware is judged to be legal, the firmware normally runs.
3. The method for preventing firmware from being illegally copied according to claim 1, wherein the encrypting unit receives the first random number, calculates the first random number, obtains a first calculation result and sends the first calculation result to the control unit, and the method comprises the following steps:
the encryption unit calculates the first random number according to a pre-stored key and a preset algorithm, obtains the first calculation result and sends the first calculation result to the control unit;
the control unit performs calculation based on the first random number, and obtaining a second calculation result includes:
and the control unit calculates the first random number according to a pre-stored secret key and a preset algorithm to obtain the second calculation result.
4. A system for preventing firmware from being illegally copied, comprising: a control unit, an encryption unit in communication with the control unit;
the control unit is used for: generating a first random number, sending the first random number to the encryption unit, and calculating based on the first random number to obtain a second calculation result;
the control unit is further configured to: judging whether a first calculation result returned by the encryption unit is received within a preset time period; if the first calculation result is received, judging whether the second calculation result is matched with the first calculation result; if so, judging that the firmware is legal; if not, judging that the firmware is illegal; if the first calculation result is not received, judging that the firmware is illegal;
the encryption unit is configured to: and receiving the first random number, calculating the first random number to obtain a first calculation result, and returning the first calculation result to the control unit.
5. An electronic device, comprising: a memory and a processor; the memory is configured to store program instructions and the processor is configured to perform the steps of the method of any of claims 1-3 in accordance with the program instructions stored by the memory.
6. A storage medium having a computer program stored thereon, the computer program, when being executed by a processor, performing the steps of the method according to any one of claims 1-3.
CN202210622264.5A 2022-06-02 2022-06-02 Method, system, electronic device and storage medium for preventing firmware from being illegally copied Pending CN115080998A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210622264.5A CN115080998A (en) 2022-06-02 2022-06-02 Method, system, electronic device and storage medium for preventing firmware from being illegally copied

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210622264.5A CN115080998A (en) 2022-06-02 2022-06-02 Method, system, electronic device and storage medium for preventing firmware from being illegally copied

Publications (1)

Publication Number Publication Date
CN115080998A true CN115080998A (en) 2022-09-20

Family

ID=83248229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210622264.5A Pending CN115080998A (en) 2022-06-02 2022-06-02 Method, system, electronic device and storage medium for preventing firmware from being illegally copied

Country Status (1)

Country Link
CN (1) CN115080998A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115987589A (en) * 2022-12-14 2023-04-18 深圳市富临通实业股份有限公司 Method for preventing MCU internal program from being copied

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115987589A (en) * 2022-12-14 2023-04-18 深圳市富临通实业股份有限公司 Method for preventing MCU internal program from being copied
CN115987589B (en) * 2022-12-14 2023-08-29 深圳市富临通实业股份有限公司 Method for preventing MCU internal program from being copied

Similar Documents

Publication Publication Date Title
US7389536B2 (en) System and apparatus for limiting access to secure data through a portable computer to a time set with the portable computer connected to a base computer
CN104156642B (en) A kind of security password input system and method based on safe touch screen control chip
CN1229513B (en) Method and apparatus for protecting flash memory
JP5014726B2 (en) Enhanced execution environment by preventing unauthorized boot loader execution
CN107431924B (en) Device theft protection associating device identifiers with user identifiers
CN109657448B (en) Method and device for acquiring Root authority, electronic equipment and storage medium
RU2632122C2 (en) Method and password verification device for inspecting input password and computer system containing password verification device
WO2018090818A1 (en) Version check method, apparatus and terminal device
US10503931B2 (en) Method and apparatus for dynamic executable verification
CN101578609A (en) Secure booting a computing device
CN109614798B (en) Safe starting method and device and terminal equipment
US20130067236A1 (en) Systems for validating hardware devices
US7392398B1 (en) Method and apparatus for protection of computer assets from unauthorized access
CN103649964A (en) Secure hosted execution architecture
CN110598384B (en) Information protection method, information protection device and mobile terminal
JP2007012029A (en) Communication terminal device and computer device
CN115080998A (en) Method, system, electronic device and storage medium for preventing firmware from being illegally copied
EP1635242B1 (en) Password verification system
CN102982265A (en) Authentication method for storing basic input and output system (BIOS) setting
CN103617128A (en) Embedded system and implementation method of secure operating system
EP2169586A1 (en) Key protecting method and a computing apparatus
CN104361280A (en) Method for carrying out credible certification on USB storage device through SMI interrupt
US20220277182A1 (en) Duplication device for key fobs
CN110677242B (en) Key processing method, key processing device and terminal equipment
CN112446063A (en) Mobile terminal PIN input method, computer storage medium and terminal device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination