Embedded software encryption/decryption system and method
Technical Field
The invention belongs to the computer security technology, and particularly relates to an embedded software encryption/decryption system and method.
Background
With the continuous development and improvement of weapon systems in China, more and more products are exported abroad, and embedded software filled in the products is extremely easy to acquire and crack without encryption, so that the core design and key technology are stolen, and the national defense benefits and safety of China are threatened, so that the encryption of the embedded software is particularly important.
At present, under the traditional embedded computer system architecture, the method for encrypting the software is limited, and the software encrypting link and the software decrypting link are executed separately. The software encryption is executed outside the computer system, and the off-line encryption is carried out by a PC or other equipment to form a software ciphertext which is solidified into a computer memory; the software decryption is performed by a computer system before the software runs, and the software plaintext is stored and loaded for use by a computer processor; the method adopts two links of off-line encryption and on-line decryption to realize the encryption/decryption process of the software, the software is cracked due to the fact that any link leaks the secret, the independent processes of software decryption and plaintext storage are needed, and the software loading instantaneity is not high.
Disclosure of Invention
The invention aims to provide an embedded software encryption/decryption system and method, which can strengthen the real-time performance of software encryption and decryption processes and improve the difficulty of software decryption, thereby improving the security of core software.
The technical scheme of the invention is as follows:
the embedded software encryption/decryption system comprises a processor unit, a logic encryption unit, an external memory unit and a debugging unit, wherein the processor unit is connected with the data transmission end of the logic encryption unit and mutually transmits a processor unit simulation debugging signal a and a processor unit bus signal c; meanwhile, the logic encryption unit is connected with the data transmission end of the external memory unit and mutually transmits a bus encryption signal d; the logic encryption unit is connected with the data transmission end of the debugging unit and mutually transmits an emulation debugging encryption signal b; and the processor unit receives the reset signal transmitted by the logic encryption unit.
In the above embedded software encryption/decryption system: the processor unit is realized by a BGA encapsulated digital signal processor and runs embedded software; the logic encryption unit is realized by utilizing BGA encapsulation and a programmable logic device with a password protection function, completes encryption and decryption of the simulation debugging interface and completes real-time encryption and decryption of the embedded software; the external memory unit is realized by packaging a FLASH memory by using a BGA (ball grid array) and is used for storing an embedded software ciphertext; the debugging unit is connected with the external integrated development environment of the system and is used for online debugging and simulation of software.
An encryption/decryption method for embedded software, comprising the following steps:
step 1, encrypting and solidifying a software plaintext; the upper computer writes a Boot Loader code into a computer system through a signal f, and the code is used for loading embedded software;
step 2, encrypting a Boot Loader code transmitted by the interface signal f into a ciphertext by the logic encryption unit, and writing the ciphertext into an external memory unit through a signal d for solidification storage;
step 3, the upper computer writes the plain text of the embedded software into the computer system through an interface signal f;
step 4, encrypting an embedded software plaintext transmitted by an interface signal f transmitted by an upper computer into a ciphertext by the logic encryption unit, and writing the ciphertext into an external memory unit through a signal d for solidification storage;
step 5, the logic encryption unit transmits a reset signal e to the processor unit, and software ciphertext decryption and loading processes are started;
step 6, the logic encryption unit reads a Boot Loader code ciphertext of the external memory unit through a signal d, decrypts the Boot Loader code ciphertext into a plaintext in real time, and transmits the plaintext to the processor unit through a signal c;
and 7: the processor unit runs Boot Loader codes and starts to load embedded software, the logic encryption unit reads an embedded software ciphertext of the external memory unit through a signal d, decrypts the embedded software ciphertext into a plaintext in real time and transmits the plaintext to the processor unit through a signal c;
and 8, running the embedded software by the processor unit.
In the above method for encrypting/decrypting embedded software, step 9 is performed after step 8, and after the computer system normally operates, the generated data to be stored can be transmitted to the logic encryption unit for encryption in real time through signal c, and then is solidified in the external memory unit through signal d.
In the above method for encrypting/decrypting embedded software, the interface use authorization of the debugging unit is obtained before step 1.
In the above method for encrypting/decrypting embedded software, before step 1, the embedded software is developed and compiled in an integrated development environment, and is connected with a computer system through a debugging unit to perform online debugging.
The invention has the following remarkable effects:
1. the encryption and decryption of the software are completed in the logic encryption unit, so that the centralized control management of the online encryption and the online decryption is realized, an independent encryption process is avoided, the intermediate flow is simplified, and the decryption difficulty is increased.
2. The bus signals and the simulation debugging signals execute an encryption algorithm in the logic encryption unit, the encryption algorithm and the decryption algorithm are realized by adopting a programmable logic device, the configuration of the encryption algorithm and the decryption algorithm is flexible, the execution efficiency is high, the cracking difficulty is high, and no additional hardware resource is needed.
3. The encryption/decryption process is physically realized, no processor or software participates, the speed is high, and the synchronous decryption and synchronous operation of the software are realized.
Drawings
FIG. 1 is a schematic diagram of an embedded software encryption/decryption system;
FIG. 2 is a schematic diagram of an embedded software encryption/decryption system;
in the figure: a. simulating a debugging signal by the processor unit; b. simulating and debugging the encrypted signal; c. a processor unit bus signal; d. a bus encryption signal; e. a reset signal; f. an interface signal; 1. a processor unit; 2. a logical encryption unit; 3. an external memory unit; 4. a debugging unit; 5. an integrated development environment; 6. and (4) an upper computer.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1 and 2, the embedded software encryption/decryption system includes a processor unit 1, a logic encryption unit 2, an external memory unit 3, and a debugging unit 4. The processor unit 1 and the logic encryption unit 2 mutually transmit a processor unit simulation debugging signal a and a processor unit bus signal c, the logic encryption unit 2 and the external memory unit 3 mutually transmit a bus encryption signal d, and the logic encryption unit 2 and the debugging unit 4 mutually transmit a simulation debugging encryption signal b. At the same time, the processor unit 1 accepts the reset signal transmitted by the logic encryption unit 2.
The processor unit 1 is implemented by a BGA package digital signal processor, running embedded software.
The processor unit 1 transmits a processor unit simulation debugging signal a to the logic encryption unit 2; the processor unit 1 transmits a processor unit bus signal c connection into the logical encryption unit 2.
The logic encryption unit 2 is realized by utilizing BGA encapsulation and a programmable logic device with a password protection function, completes encryption and decryption of the simulation debugging interface and completes real-time encryption and decryption of the embedded software.
The logic encryption unit 2 converts the received multi-bit signal lines of the unit simulation debugging signals a into simulation debugging encryption signals b after reordering, and transmits the simulation debugging encryption signals b to the debugging unit 4, so that a data channel between the processor unit 1 and the debugging unit 4 is encrypted, the processor unit simulation debugging signals a are encrypted, and online program file acquisition and software solidification state tampering are prevented.
The logic encryption unit 2 converts the received simulation debugging encryption signal b (transmitted to the logic encryption unit 2 by the debugging unit 4) into a signal a, and realizes the embedded software decryption process of online debugging.
The logic encryption unit 2 converts the received multi-bit signal line of the processor unit bus signal c into a bus encryption signal d after reordering, and connects the bus encryption signal d into the external memory unit 3, so that the data channel between the processor unit 1 and the external memory unit 3 is encrypted to realize the encryption of the embedded software.
The logic encryption unit 2 converts the received bus encryption signal d (transmitted from the external memory unit 3 to the logic encryption unit 2) into a processor unit bus signal c, so as to realize decryption conversion from the embedded software stored in the external memory unit 3 to the processor unit 1.
The output of the logic encryption unit 2 transmits a processor reset signal e to the processor unit 1 as a start signal for software loading.
In order to prevent on-line signal monitoring and reading program plaintext, the signal transmission channels among all the modules are wired in the inner layer of the printed board.
The external memory unit 3 is implemented by utilizing BGA package FLASH memory and is used for storing the embedded software cryptograph.
The debugging unit 4 is connected with an external integrated development environment 5 of the system and is used for online debugging and simulation of software.
The embedded software encryption/decryption method designed based on the system comprises the following steps:
step 1: acquiring the interface use authorization of the debugging unit 4;
the software plaintext of the running memory is prevented from being obtained through the interface of the debugging unit 4 under the condition of unauthorized or the program file is prevented from being randomly changed.
Step 2: embedded software development and compilation are carried out in the integrated development environment 5, and online debugging is carried out by connecting the embedded software with a computer system through a debugging unit 4.
The writing-in of the integrated development environment instruction is completed by converting a signal b into a signal a through the logic encryption unit 2, and the transmission of a response signal of the processor is completed by converting the signal a into the signal b through the logic encryption unit 2, so that the communication connection between the computer system and the development environment is established; the online running of the embedded software in the processor unit 1 is realized by converting the signal b into the signal a, and the debugging and the development of the embedded software are completed.
And step 3: after the online debugging is finished, encrypting and solidifying the software plaintext; and the upper computer 6 writes the Boot Loader code into the computer system through a signal f, and the code is used for loading the embedded software.
And 4, step 4: and the computer system logic encryption unit encrypts the Boot Loader code transmitted by the signal f into a ciphertext, and writes the ciphertext into an external memory unit through a signal d for solidification storage.
And 5: after the embedded software is debugged, a final executable file, namely an embedded software plaintext, is formed; and the upper computer writes the plain text of the embedded software into the computer system through the signal f.
Step 6: the logic encryption unit 2 of the computer system encrypts an embedded software plaintext transmitted by an interface signal f transmitted by the upper computer 6 into a ciphertext, and writes the ciphertext into the external memory unit 3 through a signal d for solidification and storage, so that the encryption and solidification of the software plaintext are completed.
And 7: after a computer system is powered on, the logic encryption unit 2 transmits a reset signal e to the processor unit 1, software ciphertext decryption and loading processes including Boot Loader codes and embedded software are started, and the software decryption process and the loading process are carried out synchronously.
And 8: the logic encryption unit reads the Boot Loader code ciphertext of the external memory unit 3 through a signal d, decrypts the code ciphertext into a plaintext in real time, and transmits the plaintext to the processor unit through a signal c to complete the first-stage loading of the system.
And step 9: the processor unit 1 runs Boot Loader codes, completes corresponding function initialization, and starts to load embedded software. The logic encryption unit 2 reads the embedded software ciphertext of the external memory unit 3 through the signal d, decrypts the embedded software ciphertext into a plaintext in real time, and transmits the plaintext to the processor unit 1 through the signal c to complete the secondary loading of the system. At this point, the decryption and loading of the software ciphertext is completed.
Step 10: the processor unit 1 runs embedded software to realize the functions of a computer system.
Step 11: after the computer system normally operates, the generated data to be stored can be transmitted to the logic encryption unit 2 for encryption in real time through the signal c, and then is solidified in the external memory unit 3 through the signal d.