A DSP program file double encryption method, device, equipment and medium
By double-encrypting the functional program files in DSP and scattering them to multiple off-chip FLASHs, combined with key management in the secondary boot program, the security problem caused by insufficient FLASH space on the DSP is solved, and the program files are improved Security.
Patent Information
- Application Number
- CN202410728011.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-06-06
AI Technical Summary
The insufficient on-chip FLASH space of the c2000 series DSP leads to low security of program files. Attackers can obtain program file code by decompiling the internal data of FLASH.
The DSP program file dual encryption method is used to determine whether the size of the functional program file exceeds the remaining space of the on-chip FLASH. If it exceeds the amount, it is encrypted and solidified into multiple off-chip FLASHs, and the key is stored in the secondary boot program. Make sure the decryption key is not leaked.
Improve the security of DSP function program files stored in off-chip FLASH, prevent attackers from deciphering encrypted files, and enhance the security of the program.
Smart Images

Figure CN118586051B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and provides a DSP program file double encryption method, device, equipment and medium. Background Art
[0002] A digital signal processor (DSP) is a microprocessor or application-specific integrated circuit designed to efficiently process digital signals. When using a c2000 series DSP, if the program file is large and the DSP's on-chip FLASH memory space is insufficient, you can connect a large-capacity off-chip FLASH to store the program file.
[0003] The code security module (CSM) of the c2000 series DSP can encrypt the on-chip FLASH, but generally cannot encrypt the off-chip FLASH. An attacker can read the internal data of the FLASH and decompile it to obtain the program file code, so the security is very low. Summary of the invention
[0004] The present application provides a DSP program file double encryption method, device, equipment and medium, which are used to solve the program file security problem caused by insufficient FLASH space on the DSP chip.
[0005] In a first aspect, a DSP program file double encryption method is provided, which is applied to a digital signal processor DSP, wherein the DSP includes a code security module CSM and an on-chip FLASH, and the DSP is connected to N off-chip FLASH, where N is a positive integer greater than 0; the method includes:
[0006] Determine whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH;
[0007] If the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, the DSP function program file is encrypted to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the N off-chip FLASH;
[0008] The key is stored in the secondary boot program, the secondary boot program is fixed into the on-chip Flash, and the on-chip Flash is encrypted through the CSM; the key is used to decrypt the encrypted DSP function program file.
[0009] Optionally, encrypting the DSP function program file to obtain the encrypted DSP function program file, and fixing the encrypted DSP function program file into the N off-chip FLASHs includes:
[0010] When N>1, splitting the DSP function program file into N function program files;
[0011] Using N different keys to encrypt the N function program files respectively, to obtain N encrypted program files;
[0012] The N encrypted program files are solidified into the N off-chip FLASHs.
[0013] Optionally, the step of fixing the N encrypted program files into the N off-chip FLASHs includes:
[0014] The N encrypted program files are respectively solidified into the N off-chip FLASHs; each off-chip FLASH stores an encrypted program file.
[0015] Optionally, the step of fixing the N encrypted program files into the N off-chip FLASHs includes:
[0016] Splitting each of the N encrypted program files into N parts to obtain N encrypted subprogram files of each encrypted program file;
[0017] The N encrypted subprogram files of each encrypted program file are respectively solidified into the N off-chip FLASHs; each off-chip FLASH stores a part of the subprogram files of each encrypted program file.
[0018] Optionally, storing the key in a secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM includes:
[0019] Obtain a CSM encrypted assembly file; the CSM encrypted assembly file includes a 128-bit password;
[0020] Write 0 into the upper 64 bits of the 128-bit password, and write a non-zero value into the lower 64 bits of the 128-bit password, to obtain a CSM encrypted assembly file after the password is modified;
[0021] Put the CSM encrypted assembly file after the password is modified and the key into the secondary boot program and compile them together to generate a burning file of the secondary boot program;
[0022] The burning file of the secondary boot program is solidified into the on-chip FLASH.
[0023] Optionally, after determining whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, the method further includes:
[0024] If the size of the DSP function program file does not exceed the remaining memory space of the on-chip FLASH, the DSP function program file is encrypted by the CSM to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the on-chip Flash.
[0025] Optionally, after storing the key in the secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash by the code security module, the method further includes:
[0026] Obtaining the key from the on-chip Flash through the secondary boot program;
[0027] Decrypt the encrypted DSP function program file using the key to obtain the DSP function program file;
[0028] Run the DSP function program file.
[0029] In a second aspect, a DSP program file double encryption device is provided, wherein the device is arranged in a digital signal processor DSP, wherein the DSP comprises a code security module CSM and an on-chip FLASH, and the DSP is connected to N off-chip FLASHs, where N is a positive integer greater than 0; the device comprises:
[0030] A judging module, used for judging whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH;
[0031] An encryption module, used for encrypting the DSP function program file if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH to obtain the encrypted DSP function program file;
[0032] A curing module, used for curing the encrypted DSP function program file into the N off-chip FLASH;
[0033] The curing module is further used to store the key in the secondary boot program and to cure the secondary boot program into the on-chip Flash; the key is used to decrypt the encrypted DSP function program file;
[0034] The encryption module is also used to encrypt the on-chip Flash through the CSM.
[0035] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program file, and the processor executes the computer program file to implement the DSP program file double encryption method described in the first aspect.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program file stored thereon, and a processor executes the computer program file to implement the DSP program file double encryption method described in the first aspect.
[0037] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows:
[0038] The present application provides a DSP program file double encryption method, which is applied to a digital signal processor DSP. The DSP includes a code security module and an on-chip FLASH. The DSP is connected to N off-chip FLASHes, where N is a positive integer greater than 0. The method includes: judging whether the size of a DSP function program file exceeds the remaining memory space of the on-chip FLASH; if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, encrypting the DSP function program file to obtain the encrypted DSP function program file, and fixing the encrypted DSP function program file into N off-chip FLASHes; storing a key in a secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the code security module to ensure that the burned file of the secondary boot program will not be read back, thereby ensuring that the key used to decrypt the encrypted DSP function program file will not be leaked, so as to achieve double-layer encryption of the DSP function program file, and an attacker cannot obtain the key used to decrypt the encrypted DSP function program file, and cannot decrypt the encrypted DSP function program file, thereby improving the security of the DSP function program file stored in the off-chip FLASH. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0040] Attached Figure 1 A schematic diagram of the structure of the DSP provided in the embodiment of the present application;
[0041] Attached Figure 2 A schematic diagram of a flow chart of a double encryption method for DSP program files provided in an embodiment of the present application;
[0042] Attached Figure 3 A storage schematic diagram of an off-chip FLSH provided in an embodiment of the present application;
[0043] Attached Figure 4 Another storage schematic diagram of the off-chip FLSH provided in the embodiment of the present application;
[0044] Attached Figure 5 A schematic diagram of a process flow of program restoration provided in an embodiment of the present application;
[0045] Attached Figure 6 Another flowchart of program restoration provided in an embodiment of the present application;
[0046] Attached Figure 7 A schematic diagram of the structure of a DSP program file double encryption device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0048] In order to solve the problem of program file security caused by insufficient FLASH space on the DSP chip, the embodiment of the present application provides a DSP program file double encryption method, which is applied to the DSP. Figure 1 , is a schematic diagram of the structure of a DSP provided in an embodiment of the present application. The DSP includes a code security module and an on-chip FLASH, and the DSP is connected to N off-chip FLASH and an off-chip synchronous dynamic random access memory (SDRAM).
[0049] The Code Security Module (CSM) is used to prevent unauthorized access to the on-chip FLASH, that is, to prohibit the code from being copied and reversed, and to prevent security threats such as software piracy, malicious tampering and cracking.
[0050] On-chip FLASH refers to the FLASH memory embedded inside the DSP chip, which is usually used to store the DSP's firmware, operating system, application file code and other necessary data. DSP can be connected to N off-chip FLASH, N is a positive integer greater than 0, and off-chip FLASH refers to an independent FLASH memory connected to the DSP chip through an external interface (such as SPI, SD card interface, etc.), which is used to store large-capacity data, program file code, configuration files, etc. Both on-chip FLASH and off-chip FLASH are non-volatile memories, that is, data can still be maintained even after power failure, and no regular refresh is required.
[0051] Off-chip SDRAM refers to a volatile memory connected to the DSP chip through an external interface, that is, the data will be lost after power failure and needs to be refreshed regularly to maintain data integrity.
[0052] Based on the DSP of the aforementioned embodiment, the following is an Figure 2 The double encryption method of DSP program files shown is introduced.
[0053] S201, determine whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH.
[0054] The DSP function program file is a program file used to implement the DSP function. The DSP function program file is implemented by the user according to actual needs. The DSP function program file can refer to a single program file or a project or library composed of multiple related program files.
[0055] In the specific implementation process, the size of the DSP function program file can be obtained through the executable file generated by the compiler or the corresponding development tool chain, and the remaining memory space of the on-chip FLASH can also be obtained through the chip manual on the development board, related development tools or hardware debugging tools. The remaining memory space is the difference between the total capacity of the on-chip FLASH and the used memory space. After obtaining the size of the DSP function program file and the remaining memory space of the on-chip FLASH respectively, the size of the DSP function program file is compared with the remaining memory space of the on-chip FLASH.
[0056] S202, if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, encrypt the DSP function program file to obtain the encrypted DSP function program file, and fix the encrypted DSP function program file into N off-chip FLASH.
[0057] In the specific implementation process, if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, it means that the remaining memory space of the on-chip FLASH is insufficient, and the DSP function program file cannot be completely loaded into the on-chip FLASH, which may cause compilation or download failure, or memory overflow during runtime. Therefore, by calling the OpenSSL library, the DSP function program file can be conveniently encrypted using the Advanced Encryption Standard (AES) algorithm with a symmetric key, and the encrypted DSP function program file can be solidified into N off-chip FLASH.
[0058] The AES algorithm supports three key lengths: 128 bits, 192 bits, and 256 bits. The longer the key length, the higher the security, but the corresponding encryption performance is worse. The encryption modes of the AES algorithm include the Electronic Code Book Mode (ECB) and the Cipher Block Chaining Mode (CBC). The CBC mode has high security and is suitable for encryption of large amounts of data, while the ECB mode has low security and is not suitable for encryption of large amounts of data. Therefore, the CBC mode is selected by default for encryption. The encryption S-BOX table and decryption S-BOX table used by the AES algorithm are fixed. The encryption S-Box table is used for byte replacement in the AES encryption process, and the decryption S-BOX table is used for byte replacement in the AES decryption process.
[0059] The user can pre-select the key length to set the key and encryption mode according to actual needs, and then the DSP can encrypt the DSP function program files according to the encryption S-BOX table built into the AES algorithm, the user's pre-defined key and encryption mode.
[0060] S203, storing the key in the secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM.
[0061] In a possible embodiment, a CSM encrypted assembly file is obtained; the CSM encrypted assembly file includes a 128-bit password; 0 is written to the upper 64 bits of the 128-bit password, and a non-zero value is written to the lower 64 bits of the 128-bit password to obtain the CSM encrypted assembly file with the modified password; the CSM encrypted assembly file with the modified password and the key are put into the secondary boot program and compiled together to generate a burning file for the secondary boot program; the burning file of the secondary boot program is solidified into the on-chip FLASH; the key is used to decrypt the encrypted DSP function program file.
[0062] In the specific implementation process, the CSM encryption assembly file is obtained from TI. In the file, PWL0~PWL7 are the set passwords. Each PWL has 16 bits, so the password is 128 bits in total. Setting all 128-bit passwords to 1 means no encryption, and setting all 128-bit passwords to 0 means permanent encryption. At this time, the chip cannot be decrypted, that is, it can no longer be programmed, and the program files and data in it cannot be read.
[0063] In the embodiment of the present application, the high 64-bit password of the 128-bit password is written to 0, and the low 64-bit password is written to a value other than 0, which triggers the simulation code security logic (ECSL) function. At this time, when using the simulator to connect, it is necessary to enter the password in the encrypted assembly file in the simulation settings to perform software simulation and memory reading. The CSM encrypted assembly file with the modified password is put into the secondary boot program and compiled together, and the burning file of the compiled secondary boot program is solidified into the on-chip FLASH, and the startup mode of the DSP is changed to the on-chip FLASH startup, and the on-chip FLASH encryption function is completed.
[0064] It should be noted that when using the CSM function, it is necessary to ensure that all addresses between 0x33FF80 and 0x33FFF5 in the on-chip FLASH cannot be used to store program code or data. These locations must be written to 0x0000 to enhance the security and stability of the system.
[0065] In the embodiment of the present application, modifying the DSP startup mode to on-chip Flash startup means that after the system is powered on, the DSP chip will load and execute the program code from the on-chip Flash, ensuring that the system can correctly load the encrypted program code at startup, and implement access control and security verification of the on-chip Flash during the startup process.
[0066] Since the DSP can be connected to one or more off-chip FLASH, S202 includes multiple situations, which are introduced below respectively.
[0067] In the first case, when N=1, the DSP is only connected to one off-chip FLASH.
[0068] A key is used to encrypt the DSP function program file to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the off-chip FLASH.
[0069] In the second case, when N>1, the DSP is connected to multiple off-chip FLASH.
[0070] For the second case, there are multiple ways to encrypt and solidify the process, which are introduced below.
[0071] The first method is to determine the target FLASH with the largest memory space from N off-chip FLASHes, use a key to encrypt the DSP function program file, obtain the encrypted DSP function program file, and fix the encrypted DSP function program file into the target FLASH.
[0072] It should be noted that the sizes of the memory spaces of the N off-chip FLASHes may be the same or different. When the sizes of the memory spaces of the N off-chip FLASHes are the same, the target FLASH is any one of the N off-chip FLASHes. When the sizes of the memory spaces of the N off-chip FLASHes are different, the target FLASH is the one with the largest memory space among the N off-chip FLASHes.
[0073] In the embodiment of the present application, the DSP function program file is encrypted and stored in an off-chip FLASH to facilitate subsequent search and execution.
[0074] The second method is to split the DSP function program file into N function program files; use N different keys to encrypt the N function program files respectively to obtain N encrypted program files; and fix the N encrypted program files into N off-chip FLASH.
[0075] If the DSP function program file is a single program file, the single program file can be split into N function program files evenly. If the DSP function program file is a project or library composed of multiple related program files, the DSP function program file can be split into multiple functionally independent program files.
[0076] In an embodiment of the present application, each subprogram file is encrypted using a different key. Even if an attacker successfully obtains the key of a subprogram file, the security of other subprogram files remains unaffected, and the entire DSP function program cannot be restored, thereby avoiding the risk of leakage of the DSP function program. Each subprogram file has independent key management, which allows system administrators to flexibly manage and update keys as needed.
[0077] In the second method, there are multiple ways to solidify N encrypted subroutine files into N off-chip FLASH, which are introduced below.
[0078] Method 1: N encrypted program files are fixed into N off-chip FLASHs respectively; each off-chip FLASH stores an encrypted program file.
[0079] Please refer to the attached Figure 3 , is a storage diagram of an off-chip FLSH provided in an embodiment of the present application. Figure 3 Introduction method one.
[0080] The DSP function program file is split into N function program files, and the N function program files are encrypted using key 1, key 2, ..., key N respectively to obtain N encrypted program files, including encrypted program file 1, encrypted program file 2, ..., encrypted program file N, and the encrypted program file 1 is solidified into the external FLASH_1, the encrypted program file 2 is solidified into the external FLASH_2, and so on, and the encrypted program file N is solidified into the external FLASH_N.
[0081] It should be noted that N encrypted program files can be fixed into N off-chip FLASH files respectively according to the order predefined by the user. Figure 3 The encryption program file 1 is fixed into the off-chip FLASH_N, the encryption program file 2 is fixed into the off-chip FLASH_N-1, and so on, the encryption program file N is fixed into the off-chip FLASH_1.
[0082] In an embodiment of the present application, a complete encrypted program file is stored in an off-chip FLASH, so that each off-chip FLASH stores continuous data, and the subsequent restoration of the data in all off-chip FLASH is faster and more efficient.
[0083] Method 2: Split each of the N encrypted program files into N parts to obtain N encrypted subprogram files of each encrypted program file; solidify the N encrypted subprogram files of each encrypted program file into N off-chip FLASHs respectively; each off-chip FLASH stores part of the subprogram files of each encrypted program file.
[0084] Please refer to the attached Figure 4 , which is another storage schematic diagram of the off-chip FLSH provided in the embodiment of the present application. Figure 4 Introduction method 2.
[0085] The DSP function program file is split into N function program files, and the N function program files are encrypted using key 1, key 2, ..., key N respectively, to obtain encrypted program file 1, encrypted program file 2, ..., encrypted program file N. The encrypted program file 1 is split into encrypted subprogram file 1-1, encrypted subprogram file 1-2, ..., encrypted subprogram file 1-N, and the encrypted program file 2 is split into encrypted subprogram file 2-1, encrypted subprogram file 2-2, ..., encrypted subprogram file 2-N, and so on, and the encrypted program file N is split into encrypted subprogram file N-1, encrypted subprogram file N-2, ..., encrypted subprogram file NN.
[0086] Further, the encryption subroutine file 1-1, encryption subroutine file 2-1, ..., encryption subroutine file N-1 are solidified into the external FLASH_1, the encryption subroutine file 1-2, encryption subroutine file 2-2, ..., encryption subroutine file N-2 are solidified into the external FLASH_2, and so on, the encryption subroutine file 1-N, encryption subroutine file 2-N, ..., encryption subroutine file NN are solidified into the external FLASH_N.
[0087] It should be noted that the N encrypted subprogram files of each encrypted program file can be solidified into N off-chip FLASHs respectively according to the order predefined by the user. Figure 4 The order shown, or any other order.
[0088] In the embodiment of the present application, N encrypted subprogram files of the same encrypted program file are stored in different off-chip FLASHs in a dispersed manner, so that the data stored in each off-chip FLASH is not actually a continuous encrypted program file. Even if an attacker obtains data stored in a certain off-chip Flash, he cannot completely obtain a complete encrypted program file, thereby enhancing the security of the program. Even if an attacker cracks all the data stored in the off-chip FLASH, it is difficult to restore the complete DPS function program file without knowing the storage order of all the encrypted subprogram files, further enhancing the security of the program.
[0089] In a possible embodiment, before executing the first method or the second method, it can also be determined whether the size of the DSP function program file exceeds the memory space of the target FLASH. If it is determined that the size of the DSP function program file does not exceed the memory space of the target FLASH, the first method is executed; if it is determined that the size of the DSP function program file does not exceed the memory space of the target FLASH, the second method is executed.
[0090] In a possible embodiment, after executing S201, if the size of the DSP function program file does not exceed the remaining memory space of the on-chip FLASH, the DSP function program file is encrypted through the CSM to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the on-chip Flash.
[0091] In the embodiment of the present application, if the size of the DSP function program file does not exceed the remaining memory space of the on-chip FLASH, it means that the remaining memory space of the on-chip FLASH is sufficient, and the DSP function program file can be directly encrypted and stored in the on-chip Flash. The reading speed is faster than the off-chip FLASH, which can improve the performance and response speed of the system.
[0092] In a possible embodiment, after executing S203, a key is obtained from the on-chip Flash through the secondary boot program; the encrypted DSP function program file is decrypted using the key to obtain the DSP function program file; and the DSP function program file is run.
[0093] In the specific implementation process, since the DSP startup mode is changed to on-chip Flash startup, when the system starts, the BOOT program is run, jumps to the on-chip Flash, starts and executes the secondary boot program, obtains the key from the on-chip Flash through the secondary boot program, and uses the built-in decryption S-BOX table and key of the AES encryption algorithm to decrypt the encrypted DSP function program file.
[0094] In the first case mentioned above, when N=1, there is a key stored in the on-chip FLASH, and the key is used to decrypt the encrypted DSP function program file in the off-chip FLASH to obtain the DSP function program file; the DSP function program file is moved to the connected off-chip SDRAM, and the jump is made to the location of the DSP function program file in the off-chip SDRAM to run the DSP function program file.
[0095] In the second case mentioned above, N>1. For the first method mentioned above, a key is stored in the on-chip FLASH, and the key is used to decrypt the encrypted DSP function program file in the target FLASH to obtain the DSP function program file; the DSP function program file is moved to the connected off-chip SDRAM, and the jump is made to the location of the DSP function program file in the off-chip SDRAM to run the DSP function program file.
[0096] For the aforementioned second method, N different keys are stored in the on-chip FLASH. Since the second method includes method one and method two, the corresponding program restoration process is also divided into multiple methods, which are introduced below.
[0097] For the aforementioned method one, the encrypted program files in the N off-chip FLASH are decrypted using the corresponding keys to obtain N functional program files, and the N functional program files are moved to the off-chip SDRAM in a user-defined order to restore them into complete DSP functional program files, and jump to the location of the DSP functional program file in the SDRAM to run the DSP functional program file.
[0098] Please refer to the attached Figure 5 , is a flowchart of a program restoration provided in an embodiment of the present application. Figure 5 Describes the process of restoring a program.
[0099] The system starts, runs the BOOT program, jumps to the on-chip FLASH, runs the secondary boot program, the secondary boot program obtains key 1, key 2, ..., key N from the on-chip FLASH, uses key 1 to decrypt the encrypted program file 1 in the off-chip FLASH_1, and obtains the functional program file 1, uses key 2 to decrypt the encrypted program file 2 in the off-chip FLASH_2, and obtains the functional program file 2, and so on, uses key N to decrypt the encrypted program file N in the off-chip FLASH_N, and obtains the functional program file N, and moves the functional program file 1, functional program file 2, ..., functional program file N to the off-chip SDRAM in sequence according to the order predefined by the user, and restores them to the complete DSP functional program file, the secondary boot program jumps to the location of the DSP functional program file in the SDRAM, and runs the DSP functional program.
[0100] For the aforementioned method 2, the encrypted subroutine files in N off-chip FLASH are moved to the off-chip SDRAM in a user-predefined order through the secondary boot program, and N encrypted program files are first reorganized to obtain N encrypted program files, and then the N encrypted program files are decrypted using the corresponding keys to obtain N functional program files, and the N functional program files are restored to a complete DSP functional program file, and then jump to the location of the DSP functional program file in the SDRAM to run the DSP functional program file.
[0101] Please refer to the attached Figure 6 , is another flowchart of program restoration provided in the embodiment of the present application. Figure 6 Describes the process of restoring a program.
[0102] The system starts, runs the BOOT program, jumps to the on-chip FLASH, runs the secondary boot program, and the secondary boot program obtains key 1, key 2, ..., key N from the on-chip FLASH. The secondary boot program moves the encrypted subprogram files in the N off-chip FLASH to the off-chip SDRAM in a user-defined order, and reassembles them to obtain encrypted program file 1, encrypted program file 2, ..., encrypted program file N. Use key 1 to decrypt encrypted program file 1 to obtain function program file 1, use key 2 to decrypt encrypted program file 2 to obtain function program file 2, and so on, use key N to decrypt encrypted program file N to obtain function program file N, move function program file 1, function program file 2, ..., function program file N to the off-chip SDRAM, and restore them to complete DSP function program files. The secondary boot program then jumps to the location of the DSP function program file in SDRAM and runs the DSP function program file.
[0103] In summary, the embodiment of the present application also provides a method for double encryption of DSP program files. To solve the program security problem caused by the DSP function program being too large and insufficient on-chip FLASH space with encryption function, multiple off-chip FLASH with large enough memory capacity are connected to jointly store the DSP function program files, and the original DSP function program files are encrypted using the AES encryption algorithm. At the same time, the decryption key is stored in the on-chip FLASH, and the encryption function of the on-chip FLASH is used to encrypt the key. In the startup phase of the program, the key stored in the on-chip FLASH is obtained through the secondary boot program, and the encrypted DSP function program file in the off-chip FLASH is decrypted, which reduces the risk of leakage of the DSP function program and improves the security of the program.
[0104] Based on the same inventive concept, as shown in the attached Figure 7 As shown, the embodiment of the present application also provides a DSP program file double encryption device; the device is arranged in a digital signal processor DSP, the DSP includes a code security module CSM and an on-chip FLASH, the DSP is connected to N off-chip FLASH, N is a positive integer greater than 0; the device includes:
[0105] A judgment module is used to judge whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH;
[0106] The encryption module is used to encrypt the DSP function program file if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH to obtain the encrypted DSP function program file;
[0107] A curing module is used to cure the encrypted DSP function program files into N off-chip FLASHs;
[0108] The curing module is also used to store the key into the secondary boot program and to cure the secondary boot program into the on-chip Flash; the key is used to decrypt the encrypted DSP function program file;
[0109] The encryption module is also used to encrypt the on-chip Flash through the CSM.
[0110] It should be noted that each module in the DSP program file double encryption device in this embodiment corresponds one-to-one to each step in the DSP program file double encryption method in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned DSP program file double encryption method, which will not be repeated here.
[0111] In addition, in one embodiment, the present application also provides a computer device, which includes a processor, a memory, and a computer program file stored in the memory, and the computer program file implements the aforementioned DSP program file double encryption method when executed by the processor.
[0112] In addition, in one embodiment, the present application also provides a computer storage medium, on which a computer program file is stored, and when the computer program file is executed by a processor, the aforementioned DSP program file double encryption method is implemented.
[0113] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.
[0114] In some embodiments, executable instructions may be in the form of program files, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone program files or as modules, components, subroutines or other units suitable for use in a computing environment.
[0115] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other program files or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program file in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutine files, or code portions).
[0116] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0117] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0118] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0119] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0120] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A DSP program file double encryption method, characterized in that: Applied in a digital signal processor DSP, the DSP includes a code security module CSM and an on-chip FLASH, and the DSP is connected to N off-chip FLASH, where N is a positive integer greater than 0; the method includes: Determine whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH; If the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, the DSP function program file is encrypted to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the N off-chip FLASH; The key is stored in the secondary boot program, the secondary boot program is fixed into the on-chip Flash, and the on-chip Flash is encrypted by the CSM; the key is used to decrypt the encrypted DSP function program file; The method of storing the key in the secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM includes: obtaining a CSM encrypted assembly file; the CSM encrypted assembly file includes a 128-bit password; writing 0 to the high 64-bit password of the 128-bit password, and writing a non-zero value to the low 64-bit password of the 128-bit password, to obtain the CSM encrypted assembly file after the password is modified; putting the CSM encrypted assembly file after the password is modified and the key into the secondary boot program and compiling them together to generate a burning file of the secondary boot program; fixing the burning file of the secondary boot program into the on-chip FLASH; After storing the key in the secondary boot program, solidifying the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM, the method also includes: when the system starts, running the BOOT program, jumping to the on-chip Flash, starting and executing the secondary boot program, obtaining the key from the on-chip Flash through the secondary boot program; using the key to decrypt the encrypted DSP function program file to obtain the DSP function program file; running the DSP function program file.
2. The DSP program file double encryption method as claimed in claim 1, characterized in that: The encrypting the DSP function program file to obtain the encrypted DSP function program file, and fixing the encrypted DSP function program file into the N off-chip FLASHs, comprises: When N>1, splitting the DSP function program file into N function program files; Using N different keys to encrypt the N function program files respectively, to obtain N encrypted program files; The N encrypted program files are solidified into the N off-chip FLASHs.
3. The DSP program file double encryption method as claimed in claim 2, characterized in that: The step of solidifying the N encrypted program files into the N off-chip FLASHs includes: The N encrypted program files are respectively solidified into the N off-chip FLASHs; each off-chip FLASH stores an encrypted program file.
4. The DSP program file double encryption method as claimed in claim 2, characterized in that: The step of solidifying the N encrypted program files into the N off-chip FLASHs includes: Splitting each of the N encrypted program files into N parts to obtain N encrypted subprogram files of each encrypted program file; The N encrypted subprogram files of each encrypted program file are respectively solidified into the N off-chip FLASHs; each off-chip FLASH stores a part of the subprogram files of each encrypted program file.
5. The DSP program file double encryption method as claimed in claim 1, characterized in that: After determining whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH, the method further includes: If the size of the DSP function program file does not exceed the remaining memory space of the on-chip FLASH, the DSP function program file is encrypted by the CSM to obtain the encrypted DSP function program file, and the encrypted DSP function program file is solidified into the on-chip Flash.
6. A DSP program file double encryption device, characterized in that: The device is arranged in a digital signal processor DSP, the DSP includes a code security module CSM and an on-chip FLASH, the DSP is connected to N off-chip FLASH, N is a positive integer greater than 0; the device includes: A judging module, used for judging whether the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH; An encryption module, used for encrypting the DSP function program file if the size of the DSP function program file exceeds the remaining memory space of the on-chip FLASH to obtain the encrypted DSP function program file; A curing module, used for curing the encrypted DSP function program file into the N off-chip FLASH; The curing module is further used to store the key in the secondary boot program and to cure the secondary boot program into the on-chip Flash; the key is used to decrypt the encrypted DSP function program file; The encryption module is further used to encrypt the on-chip Flash through the CSM; The method of storing the key in the secondary boot program, fixing the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM includes: obtaining a CSM encrypted assembly file; the CSM encrypted assembly file includes a 128-bit password; writing 0 to the high 64-bit password of the 128-bit password, and writing a non-zero value to the low 64-bit password of the 128-bit password, to obtain the CSM encrypted assembly file after the password is modified; putting the CSM encrypted assembly file after the password is modified and the key into the secondary boot program and compiling them together to generate a burning file of the secondary boot program; fixing the burning file of the secondary boot program into the on-chip FLASH; After storing the key in the secondary boot program, solidifying the secondary boot program into the on-chip Flash, and encrypting the on-chip Flash through the CSM, it also includes: when the system starts, running the BOOT program, jumping to the on-chip Flash, starting and executing the secondary boot program, obtaining the key from the on-chip Flash through the secondary boot program; using the key to decrypt the encrypted DSP function program file to obtain the DSP function program file; running the DSP function program file.
7. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein the memory stores a computer program file, and the processor executes the computer program file to implement the DSP program file double encryption method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program file, and the processor executes the computer program file to implement the DSP program file double encryption method according to any one of claims 1 to 5.
