CN100353274C - A device for encrypting and protecting a program with a protection bit code - Google Patents
A device for encrypting and protecting a program with a protection bit code Download PDFInfo
- Publication number
- CN100353274C CN100353274C CNB2004100018213A CN200410001821A CN100353274C CN 100353274 C CN100353274 C CN 100353274C CN B2004100018213 A CNB2004100018213 A CN B2004100018213A CN 200410001821 A CN200410001821 A CN 200410001821A CN 100353274 C CN100353274 C CN 100353274C
- Authority
- CN
- China
- Prior art keywords
- program
- bit code
- protection bit
- protection
- insertion position
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Storage Device Security (AREA)
Abstract
Description
技术领域technical field
本发明是关于处理器资料保护技术,尤指一种以保护位元码对一程序进行加密保护的装置。The invention relates to processor data protection technology, in particular to a device for encrypting and protecting a program with protection bit codes.
背景技术Background technique
在这重视智财权的时代,厂商为了保护其辛苦开发的程序、资料等相关的智慧财产,会于离线(off-line)时将该等资料、程序先进行一加密(encrypting)处理,再将加密后的资料予以储存至一非挥发性储存器或其他储存媒体,他人即使拿到存有该加密资料的非挥发性储存器或其他储存媒体,由于无法知道该加密处理的过程及处理方法,亦无法正确去还原该等资料、程序,由此而达到保护的目的。In this era where intellectual property rights are valued, in order to protect the intellectual property related to the programs and data developed by the manufacturers, they will first encrypt the data and programs when they are offline (off-line), and then encrypt them. The encrypted data is stored in a non-volatile storage or other storage media. Even if others get the non-volatile storage or other storage media with the encrypted data, since they cannot know the encryption process and processing method, It is also impossible to restore the data and programs correctly, so as to achieve the purpose of protection.
针对此种资料保护方式,于;美国USP6,408,073号专利公告中,使用一虚拟乱数产生器(Pseudo Random Generator)及依据一初始值(seed1/seed2),来对只读储存器(Read Only Memory,ROM)的资料(ROMdata)进行编码以产生编码资料(Encoded data),然而此种资料保护方式因使用乱数做加密处理的参数,需有同步的乱数产生器用以进行解码。需要非常多的乱数的样型(pattern),才能有效防止他人还原该等资料、程序,这意味著编码及解码的虚拟乱数产生器需要相当复杂的电路,此会增加许多成本。若使用较简单的编码及解码的虚拟乱数产生器,虽然可节省成本,但却容易被他人还原该等资料、程序,因此,公知处理器的条件指令处理方法设计仍有诸多缺失而有予以改进的必要。For this kind of data protection method, in; USP6,408,073 patent announcement, use a virtual random number generator (Pseudo Random Generator) and according to an initial value (seed1/seed2), come to read-only memory (Read Only Memory) , ROM) to encode the data (ROMdata) to generate encoded data (Encoded data), but this data protection method requires a synchronous random number generator for decoding due to the use of random numbers as encryption parameters. A lot of random number patterns are needed to effectively prevent others from restoring the data and programs, which means that the virtual random number generator for encoding and decoding requires a rather complicated circuit, which will increase a lot of cost. If a virtual random number generator with simpler encoding and decoding is used, although it can save costs, it is easy to restore the data and programs by others. Therefore, the design of the conditional instruction processing method of the known processor still has many deficiencies and has been improved. necessary.
发明内容Contents of the invention
本发明的目的在于提供一种以保护位元码对一程序进行加密保护的装置,以避免公知技术使用复杂的虚拟乱数产生器,而达可节省成本的目的。同时,由于保护位元码的产生及去除硬件相当简易,以减少加密处理时间,而增进整体系统效率。The purpose of the present invention is to provide a device for encrypting and protecting a program with a protection bit code, so as to avoid the use of a complicated virtual random number generator in the known technology and achieve the purpose of saving costs. At the same time, since the generation and removal of the protection bit code is relatively simple, the encryption processing time is reduced and the overall system efficiency is improved.
依据本发明的一特色,提出一种以保护位元码对一程序进行加密保护的装置,该程序具有复数个指令,每一指令具有I位元,该I为正整数,该装置包含:According to a feature of the present invention, a device for encrypting and protecting a program with a protection bit code is proposed. The program has a plurality of instructions, and each instruction has I bits, and the I is a positive integer. The device includes:
一保护位元码产生装置,依据该程序的复数个指令以产生对应的复数个保护位元码,每一保护位元码具有P个位元,该P为正整数;A protection bit code generating device, according to the plurality of instructions of the program to generate a corresponding plurality of protection bit codes, each protection bit code has P bits, and the P is a positive integer;
一第一保护位元码位置产生装置,其依据执行该程序时处理器状态以产生每一保护位元码的插入位置N,该N为正整数,其中,该第一保护位元码位置产生装置包含:A first protected bit code position generating device, which generates the insertion position N of each protected bit code according to the state of the processor when executing the program, where N is a positive integer, wherein the first protected bit code position is generated The device contains:
一位置状态暂存器,用以指示该处理器存取资料区段或是存取程序区段;a location status register, used to instruct the processor to access data segments or access program segments;
一程序状态暂存器,用以指示该处理器所处状态;a program state register, used to indicate the state of the processor;
复数个插入位置产生装置,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating devices to generate insertion positions according to their predetermined functions; and
一多工器,其具有复数个输入端,以耦合至该复数个插入位置产生装置的输出端,并依据该位置状态暂存器及该程序状态暂存器,由复数个输入端中选择一插入位置以做为输出;以及A multiplexer, which has a plurality of input terminals to be coupled to the output terminals of the plurality of insertion position generating devices, and selects one of the plurality of input terminals according to the position state register and the program state register insert position as output; and
一保护位元码插入装置,依据该第一保护位元码位置产生装置所产生的插入位置N,分别将每一保护位元码插入该程序对应指令第N-1位元与第N位元之中,以产生一加密程序。A protection bit code insertion device, according to the insertion position N generated by the first protection bit code position generating device, respectively inserts each protection bit code into the N-1th bit and the Nth bit of the corresponding instruction of the program Among them, an encryption program is generated.
依据本发明的另一特色,提出一种对一加密程序进行解密的装置,该加密程序将保护位元码插置于原始程序中而加密,该加密程序具有复数指令,该装置包含:According to another feature of the present invention, a device for decrypting an encrypted program is proposed. The encrypted program is encrypted by inserting a protection bit code into the original program. The encrypted program has multiple instructions. The device includes:
一第二保护位元码位置产生装置,其依据执行该程序时处理器状态以产生该复数个保护位元码的插入位置,其中该第二保护位元码位置产生装置包含:A second protection bit code position generation device, which generates the insertion positions of the plurality of protection bit codes according to the state of the processor when executing the program, wherein the second protection bit code position generation device includes:
一位置状态暂存器,用以指示该处理器存取资料区段或是存取程序区段;a location status register, used to instruct the processor to access data segments or access program segments;
一程序状态暂存器,用以指示该处理器所处的状态;a program status register, used to indicate the status of the processor;
复数个插入位置产生装置,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating devices to generate insertion positions according to their predetermined functions; and
一多工器,其具有复数个输入端,以耦合至该复数个插入位置产生装置的输出端,并依据该位置状态暂存器及该程序状态暂存器,由复数个输入端中选择一插入位置以做为输出;以及A multiplexer, which has a plurality of input terminals to be coupled to the output terminals of the plurality of insertion position generating devices, and selects one of the plurality of input terminals according to the position state register and the program state register insert position as output; and
一保护位元码去除装置,输入该程序,并依据该第二保护位元码位置产生装置所产生的插入位置N,以将该程序对应指令的第N位元去除。A protection bit code removal device inputs the program, and removes the Nth bit of the corresponding instruction of the program according to the insertion position N generated by the second protection bit code position generation device.
依据本发明的又一特色,提出一种对一加密程序进行解密的装置,该加密程序将两组保护位元码插置于原始程序中而加密,该加密程序具有复数指令,其中一个字组可包含二个加密指令,该装置包含:According to another feature of the present invention, a device for decrypting an encrypted program is proposed. The encrypted program inserts two sets of protection bit codes into the original program for encryption. The encrypted program has multiple instructions, one of which is Can contain two encryption instructions, the device contains:
一第三保护位元码位置产生装置,其依据执行该程序时处理器状态以产生该复数个保护位元码的第三插入位置,其中该第三保护位元码位置产生装置包含:A third protected bit code position generating device, which generates the third insertion position of the plurality of protected bit codes according to the state of the processor when executing the program, wherein the third protected bit code position generating device includes:
一位置状态暂存器,用以指示该处理器存取资料区段或是存取程序区段;a location status register, used to instruct the processor to access data segments or access program segments;
一程序状态暂存器,用以指示该处理器所处的状态;a program status register, used to indicate the status of the processor;
复数个插入位置产生装置,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating devices to generate insertion positions according to their predetermined functions; and
一多工器,其具有复数个输入端,以耦合至该复数个插入位置产生装置的输出端,并依据该位置状态暂存器及该程序状态暂存器,由复数个输入端中选择一插入位置以做为输出;A multiplexer, which has a plurality of input terminals to be coupled to the output terminals of the plurality of insertion position generating devices, and selects one of the plurality of input terminals according to the position state register and the program state register insert position as output;
一第四保护位元码位置产生装置,其依据执行该程序时处理器状态以产生该复数个保护位元码的第四插入位置,其中该第四保护位元码位置产生装置包含:A fourth protection bit code position generation device, which generates the fourth insertion position of the plurality of protection bit codes according to the state of the processor when executing the program, wherein the fourth protection bit code position generation device includes:
一位置状态暂存器,用以指示该处理器存取资料区段或是存取程序区段;a location status register, used to instruct the processor to access data segments or access program segments;
一程序状态暂存器,用以指示该处理器所处的状态;a program status register, used to indicate the status of the processor;
复数个插入位置产生装置,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating devices to generate insertion positions according to their predetermined functions; and
一多工器,其具有复数个输入端,以耦合至该复数个插入位置产生装置的输出端,并依据该位置状态暂存器及该程序状态暂存器,由复数个输入端中选择一插入位置以做为输出;以及A multiplexer, which has a plurality of input terminals to be coupled to the output terminals of the plurality of insertion position generating devices, and selects one of the plurality of input terminals according to the position state register and the program state register insert position as output; and
一第三保护位元码去除装置,输入该加密程序的低半字组,并依据该第三保护位元码位置产生装置所产生的该第三插入位置N1,以将该程序对应指令的第0位元至K-1位元的第N1位元去除;以及A third protection bit code removing device, input the low half word group of the encryption program, and according to the third insertion position N1 generated by the third protection bit code position generating device, to correspond the program to the first bit of the instruction the removal of the N1-th bit from
一第四保护位元码去除装置,输入该加密程序的高半字组,并依据该第四保护位元码位置产生装置所产生的第四插入位置N2,以将该程序对应指令的第K位元至2K-1位元的第N2位元去除。A fourth protection bit code removal device, input the upper half word group of the encrypted program, and according to the fourth insertion position N2 produced by the fourth protection bit code position generating device, to correspond the program to the Kth instruction The N2th bit of bits to 2K-1 bits is removed.
依据本发明的再一特色,提出一种以保护位元码对一程序进行加密保护的方法,该程序具有复数个指令,每一指令具有I位元,该I为正整数,该方法包含下列步骤:According to another characteristic of the present invention, a method for encrypting and protecting a program with a protection bit code is proposed, the program has a plurality of instructions, each instruction has I bits, and the I is a positive integer, the method includes the following step:
一保护位元码产生步骤,依据该程序复数个指令以产生对应的复数个保护位元码,每一保护位元码具有P个位元,该P为正整数;A protection bit code generating step, generating a plurality of corresponding protection bit codes according to the plurality of instructions of the program, each protection bit code has P bits, and the P is a positive integer;
一第一保护位元码位置产生步骤,其依据执行该程序时处理器状态以产生每一保护位元码的插入位置N,该N为正整数,其中一位置状态旗标用以指示该处理器存取资料区段或是存取程序区段,一程序状态旗标用以指示该处理器所处的状态,该第一保护位元码位置产生步骤还包含下列步骤:A first protection bit code position generating step, which generates the insertion position N of each protection bit code according to the state of the processor when executing the program, where N is a positive integer, wherein a position status flag is used to indicate the processing The device accesses the data segment or accesses the program segment, and a program status flag is used to indicate the status of the processor. The step of generating the first protection bit code position also includes the following steps:
复数个插入位置产生步骤,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating steps to generate insertion positions according to their predetermined functions; and
一多工步骤,依据该位置状态旗标及该程序状态旗标,由复数个插入位置产生步骤的输出,选择一插入位置以做为输出;以及a multiplexing step, according to the position state flag and the program state flag, the output of the step is generated from a plurality of insertion positions, and an insertion position is selected as the output; and
一保护位元码插入步骤,依据该第一保护位元码位置产生步骤所产生的插入位置N,分别将每一保护位元码插入该程序对应指令的第N-1位元与第N位元之中,以产生一加密程序。A protection bit code insertion step, according to the insertion position N generated by the first protection bit code position generation step, respectively inserting each protection bit code into the N-1th bit and the Nth bit of the corresponding instruction of the program Among the elements, an encryption program is generated.
依据本发明的还一特色,提出一种对一加密程序进行解密的方法,该加密程序将保护位元码插置于原始程序中而加密,该加密程序具有复数指令,每一指令具有I位元,每一保护位元码具有P个位元,该方法包含下列步骤:According to another characteristic of the present invention, a method for decrypting an encrypted program is proposed. The encrypted program is encrypted by inserting the protection bit code into the original program. The encrypted program has a plurality of instructions, and each instruction has 1 bit Yuan, each protection bit code has P bits, and this method comprises the following steps:
一第二保护位元码位置产生步骤,其依据执行该程序时处理器状态以产生该复数个保护位元码的插入位置,其中,一位置状态旗标用以指示该处理器存取资料区段或是存取程序区段,一程序状态旗标用以指示该处理器所处的状态,该第二保护位元码位置产生步骤还包含下列步骤:A second protection bit code position generation step, which generates the insertion positions of the plurality of protection bit codes according to the state of the processor when executing the program, wherein a position status flag is used to instruct the processor to access the data area A segment or an access program segment, a program state flag is used to indicate the state of the processor, and the step of generating the second protection bit code position also includes the following steps:
复数个插入位置产生步骤,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating steps to generate insertion positions according to their predetermined functions; and
一多工步骤,依据该位置状态旗标及该程序状态旗标,由复数个插入位置产生步骤的输出,选择一插入位置以做为输出;以及a multiplexing step, according to the position state flag and the program state flag, the output of the step is generated from a plurality of insertion positions, and an insertion position is selected as the output; and
一保护位元码去除步骤,输入该程序,并依据该第二保护位元码位置产生步骤所产生的插入位置N,以将该程序对应指令的第N位元去除。A protection bit code removal step, inputting the program, and removing the Nth bit of the corresponding instruction of the program according to the insertion position N generated by the second protection bit code position generation step.
依据本发明的又一特色,提出一种对一加密程序进行解密的方法,该加密程序将两组保护位元码插置于原始程序中而加密,该加密程序具有复数的指令,其中一个字组可包含二个加密指令,该方法包含下列步骤:According to yet another feature of the present invention, a method for decrypting an encrypted program is proposed. The encrypted program inserts two sets of protection bit codes into the original program for encryption. The encrypted program has a plurality of instructions, one of which is A group may contain two encryption instructions, the method includes the following steps:
一第三保护位元码位置产生步骤,其依据执行该程序时处理器状态以产生该复数个保护位元码的第三插入位置,其中,一位置状态旗标用以指示该处理器存取资料区段或是存取程序区段,一程序状态旗标用以指示该处理器所处的状态,该第三保护位元码位置产生步骤还包含下列步骤:A third protection bit code position generation step, which generates the third insertion position of the plurality of protection bit codes according to the state of the processor when executing the program, wherein a position status flag is used to indicate the processor access In the data segment or the access program segment, a program status flag is used to indicate the status of the processor, and the step of generating the third protection bit code position also includes the following steps:
复数个插入位置产生步骤,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating steps to generate insertion positions according to their predetermined functions; and
一多工步骤,依据该位置状态旗标及该程序状态旗标,由复数个插入位置产生步骤的输出,选择一插入位置以做为输出;A multiplexing step, according to the position state flag and the program state flag, the output of the step is generated from a plurality of insertion positions, and an insertion position is selected as the output;
一第四保护位元码位置产生步骤,其依据执行该程序时处理器状态以产生该复数个保护位元码的第四插入位置,其中,一位置状态旗标用以指示该处理器存取资料区段或是存取程序区段,一程序状态旗标用以指示该处理器所处的状态,该第四保护位元码位置产生步骤还包含下列步骤:A fourth protection bit code position generation step, which generates the fourth insertion position of the plurality of protection bit codes according to the state of the processor when executing the program, wherein a position status flag is used to indicate the processor access In the data section or the access program section, a program state flag is used to indicate the state of the processor, and the step of generating the fourth protection bit code position also includes the following steps:
复数个插入位置产生步骤,依据其预定的功能以产生插入位置;以及a plurality of insertion position generating steps to generate insertion positions according to their predetermined functions; and
一多工步骤,依据该位置状态旗标及该程序状态旗标,由复数个插入位置产生步骤的输出,选择一插入位置以做为输出;以及a multiplexing step, according to the position state flag and the program state flag, the output of the step is generated from a plurality of insertion positions, and an insertion position is selected as the output; and
一第三保护位元码去除步骤,输入该加密程序的低半字组,并依据该第三保护位元码位置产生步骤所产生的第三插入位置N1,以将该程序对应指令的第0位元至K-1位元的第N1位元去除;以及A third protection bit code removal step, inputting the low half word group of the encryption program, and according to the third insertion position N1 generated by the third protection bit code position generation step, to correspond the program to the 0th of the instruction N1 bit removal of bits to K-1 bits; and
一第四保护位元码去除步骤,输入该加密程序的高半字组,并依据该第四保护位元码位置产生步骤所产生的第四插入位置N2,以将该程序对应指令的第K位元至2K-1位元的笫N2位元去除。A fourth protection bit code removal step, inputting the upper half word group of the encryption program, and according to the fourth insertion position N2 produced by the fourth protection bit code position generation step, to correspond the program to the Kth instruction Bits N2 to 2K-1 bits are removed.
附图说明Description of drawings
图1:本发明以保护位元码对一程序进行加密保护装置方块图。Fig. 1: A block diagram of a device for encrypting and protecting a program with a protected bit code according to the present invention.
图2:本发明第二保护位元码位置产生装置的电路图。Fig. 2: The circuit diagram of the second protection bit code position generating device of the present invention.
图3-图4:本发明第二保护位元码位置产生装置所产生插入位置的示意图。FIG. 3-FIG. 4: Schematic diagrams of insertion positions generated by the second protection bit code position generating device of the present invention.
图5:本发明保护位元码去除装置的电路图。Fig. 5: The circuit diagram of the protection bit code removing device of the present invention.
图6:本发明以保护位元码对一程序进行加密保护的装置另一实施例方块图Fig. 6: The block diagram of another embodiment of the device for encrypting and protecting a program with the protection bit code of the present invention
具体实施方式Detailed ways
图1显示本发明以保护位元码对一程序进行加密保护装置的方块图,其包含一保护位元码产生装置110、一第一保护位元码位置产生装置120、一保护位元码插入装置130、一第二保护位元码位置产生装置210及一保护位元码去除装置220。而被加密的程序具有复数的指令,每一个指令具有I个位元(I为正整数),而保护位元码具有P个位元(P正整数),在本实施例中,I为31位元,P为1位元,即I+P为32位元,亦可I为32位元,P为1位元。Fig. 1 shows the block diagram that the present invention carries out encryption protection device to a program with protection bit code, and it comprises a protection bit
该保护位元码产生装置110依据该程序的每一个指令以分别产生相对应的保护位元码,该保护位元码可为同位检查位元(Parity bit)、错误更正码(Error Correction Code、ECC)或是指令执行时处理器模式的指示位元。The protection
该第一保护位元码位置产生装置120依据执行该程序时的处理器状态以产生每一保护位元码的插入位置N(N为正整数)。该保护位元码插入装置130是依据该第一保护位元码位置产生装置120所产生的插入位置N,分别将每一保护位元码插入该程序对应指令的第N-1与第N位元之中,以产生一加密程序。The first protected bitcode position generator 120 generates the insertion position N (N is a positive integer) of each protected bitcode according to the state of the processor when the program is executed. The protection bit
该第二保护位元码位置产生装置210依据执行该程序时处理器状态以产生该每一保护位元码的插入位置。该保护位元码去除装置220输入一加密程序,该加密程序是将保护位元码插置于原始程序中而予以加密,并依据该第二保护位元码位置产生装置210所产生的每一插入位置N,以将该加密程序的每一指令中的保护位元码去除。The second protection bit code position generating device 210 generates the insertion position of each protection bit code according to the state of the processor when the program is executed. This protection bit
该第一保护位元码位置产生装置120及该第二保护位元码位置产生装置210是依据执行该程序时处理器状态以产生插入位置,图2为其电路图。每一第一及第二保护位元码位置产生装置包含一存取状态暂存器(AccessStatus Register、ASR)310、一程序状态暂存器(Program Status Register、PSR)320、一多工器330及复数个插入位置产生装置340-380。The first protected bitcode position generating device 120 and the second protected bitcode position generating device 210 generate insertion positions according to the state of the processor when the program is executed. FIG. 2 is a circuit diagram thereof. Each first and second protection bit code position generating device includes an access status register (AccessStatus Register, ASR) 310, a program status register (Program Status Register, PSR) 320, a
该存取状态暂存器(ASR)310为1位元,其值为1时,代表处理器存取资料区段,其值为0时,代表处理器存取程序区段。该程序状态暂存器(PSR)320为3位元,其值为1xx时,代表处理器重置后进入自动开机执行BIOS程序状态;其值为01x时,代表处理器处在作业系统核心(OS Kernel)状态;其值为001时,代表处理器处在一特殊认证程序状态;其值为000时,代表处理器处在一个一般使用者程序状态。The access status register (ASR) 310 is 1 bit. When the value is 1, it means the processor accesses the data segment, and when the value is 0, it means the processor accesses the program segment. The program state temporary register (PSR) 320 is 3 bits, and when its value is 1xx, it means that the processor enters the state of automatically booting to execute the BIOS program after being reset; when its value is 01x, it means that the processor is in the core of the operating system ( OS Kernel) state; when its value is 001, it represents that the processor is in a special authentication program state; when its value is 000, it represents that the processor is in a general user program state.
图2中的PPG_Mode讯号是用来选择该多工器330的输出讯号PBP与输入讯号之间的关系。该PPG_Mode讯号是由该存取状态暂存器(ASR)310及该程序状态暂存器(PSR)320所组合而成,亦即PPG_Mode={ASR,PSR[2:0])。当处理器存取资料区段时,该存取状态暂存器(ASR)310的值为1,PPG_Mode=1xxx,该多工器330会选择插入位置产生装置380输出做为该多工器330的输出讯号PBP。而当处理器重置后,进入自动开机执行BIOS程序状态时,该存取状态暂存器(ASR)310的值为0,该程序状态暂存器(PSR)320的值为1xx,该多工器330会选择插入位置产生装置340输出做为该多工器330的输出讯号PBP。The PPG_Mode signal in FIG. 2 is used to select the relationship between the output signal PBP and the input signal of the
该复数个插入位置产生装置340-380是依据其预定的功能以产生插入位置。其中,该插入位置产生装置380可为一空装置,以表示无插入位置,其输出讯号为000000b。该插入位置产生装置340是将一给定值x经由模数运算以产生插入位置,亦即,F1(x)=(x mod 32)。该插入位置产生装置350将一第一给定值减去经由模数运算的一第二给定值,以产生插入位置,亦即,F2(x)=31-(x mod 32)。The plurality of insertion position generating devices 340-380 generate insertion positions according to their predetermined functions. Wherein, the insertion
该插入位置产生装置360将一第一给定值与该处理器的部分位址线值结合后,再经由模数运算,以产生插入位置,亦即,F3(x,a)=[(x+{a[0],a[1],a[2],a[3],a[4]})mod 32]。该插入位置产生装置370将一给定值x[4:0]反置,以产生插入位置,亦即,F4(x)={x[0],x[1],x[2],x[3],x[4]}。该插入位置产生装置亦可将该存取状态暂存器(ASR)310与该程序状态暂存器(PSR)320结合后,以产生插入位置,或是将该位置状态暂存器与该程序状态暂存器结合后,再经由模数运算,以产生插入位置。The insertion
图2中的K1、K2、K3及K4分别对该复数个插入位置产生装置340-380提供一给定值,其可先予以烧录至一硬件电路,亦可为暂存器,而由系统去设定。如此,可对不同程序及处理器所处状态产生不同的保护位元码插入位置。K1, K2, K3 and K4 among Fig. 2 provide a given value respectively to this plurality of insertion position generating devices 340-380, and it can burn into a hardware circuit earlier, also can be register, and by the system Go to settings. In this way, different protection bit code insertion positions can be generated for different programs and states of the processor.
图3显示K1=K2=K3=K4=3时,该复数个插入位置产生装置340、350及380所产生不同的保护位元码插入位置。其中,F1(x)=(x mod 32)=3,代表处理器重置后,进入自动开机执行BIOS程序状态时,其保护位元码插入位置为位元3。F2(x)=[31-(x mod 32)]=28,代表处理器处在作业系统核心(OS Kernel)状态时,其保护位元码插入位置为位元28。F4(x)={x[0],x[1],x[2],x[3],x[4]}={11000b}=24,代表处理器处在一个一般使用者程序状态时,其保护位元码插入位置为位元24。FIG. 3 shows that when K1=K2=K3=K4=3, the multiple
图4显示K3=3时,该插入位置产生装置360所产生不同的保护位元码插入位置。F3(x,a)=(x+{a[0],a[1],a[2],a[3],a[4]})mod 32=(3+{a[0],a[1],a[2],a[3],a[4]})mod 32。代表处理器处在一个认证程序时,其保护位元码插入位置将会呈现如图4所示的变化,而使得该认证程序码难以盗取或解译。FIG. 4 shows that when K3=3, the insertion
该多工器330的输出讯号PBP(P-bit Bit Position)为由6个位元所组成,其中PBP[5]的布林值代表PBP[4:0]中是否为保护位元码插入位置。当PBP[5:0]=0xxxxxb时,表示PBP[4:0]无保护位元码插入位置。当PBP[5:0]=100101b时,表示PBP[4:0]为保护位元码插入位置,且该保护位元码插入位置在00101b=5的位置。由于该复数个插入位置产生装置340-370均会产生保护位元码插入位置,故其输出讯号会与一高电位组合,而形成该多工器330的输出讯号PBP[5:0],其中,该高电位形成PBP[5](即PBP[5]=1),以表示PBP[4:0]为保护位元码插入位置。而该复数个插入位置产生装置380为一空装置,以表示无插入位置,故其输出讯号为000000b,表示PBP[4:0]无保护位元码插入位置。The output signal PBP (P-bit Bit Position) of the
图5为该保护位元码去除装置220的电路图,其主要包含多工器510、520及530。其输入端540输入一32位元的加密程序,该加密程序将保护位元码插置于原始程序中而予以加密,并依据该第二保护位元码位置产生装置210所产生的复数个插入位置PBP[4:0],以将该加密程序的复数指令中的保护位元码去除。当PBP[5]=0时,表示PBP[4:0]无保护位元码插入位置,故该多工器510则将输入端540直接输出。当PBP[5]=1时,表示PBP[4:0]为保护位元码插入位置,该多工器520依据该PBP[4:0]讯号,而输出该保护位元码,该多工器530依据该PBP[4:0]讯号,输出不具有该保护位元码的指令,该保护位元码与该不具有该保护位元码的指令又组合成一32位元字组,而该多工器510因PBP[5]=1,则将其接输出。FIG. 5 is a circuit diagram of the protection bit
于本实施例中,该保护位元码产生装置110、第一保护位元码位置产生装置120、及保护位元码插入装置130可以使用硬件予以实现,亦可以使用软件离线处理,而产生一加密程序。该保护位元码去除装置220及该第二保护位元码位置产生装置210可与一处理器核心结合,该保护位元码去除装置220输入该加密程序,并依据该第二保护位元码位置产生装置210所产生的复数个插入位置N,以将该加密程序的复数个指令中的保护位元码去除。如此,该处理器核心可正确执行该解密后的程序,而加密的程序则不必担心轻易被他人所破解,而达到保护的目的。In this embodiment, the protection bit
图6为本发明的另一实施例,是对将两组保护位元码插置于原始程序中的加密程序进行解密的装置,该加密程序具有复数的指令,其中一个字组可包含二个加密指令,每一加密指令为16位元。该装置包含一第三保护位元码位置产生装置610、一第四保护位元码位置产生装置620、一第三保护位元码去除装置630及一第四保护位元码去除装置640。Fig. 6 is another embodiment of the present invention, which is a device for decrypting an encrypted program that inserts two groups of protection bit codes into the original program. The encrypted program has multiple instructions, and one word group can contain two Encrypted instructions, each encrypted instruction is 16 bits. The device includes a third protected bit code
该第三保护位元码位置产生装置610及第四保护位元码位置产生装置620分别依据执行该程序时的处理器状态以产生每一保护位元码的第三插入位置PBP1[4:0]及第四插入位置PBP2[4:0]。The third protected bit code
该第三保护位元码去除装置630输入该加密程序的低半字组(low halfword),并依据该第三保护位元码位置产生装置630所产生的每一第三插入位置PBP1[4:0],以将该程序复数指令的第0至15位元的第PBP1[4:0]位元去除。该第四保护位元码去除装置640输入该加密程序的高半字组(high half word),并依据该第四保护位元码位置产生装置所产生的每一第四插入位置PBP2[4:0],以将该程序对应指令的第16至31位元的第PBP2[4:0]位元去除。The third protection bit
由上述说明可知,本发明的技术仅需简易的硬件即可达成加密及解密的功能,无需像公知技术使用复杂的虚拟乱数产生器,而可节省成本,同时,保护位元码的产生及去除硬件相当简易,并不会如公知技术一般会增加加密及解密处理时间,而远较公知技术需花费的加密及解密处理时间为少,故其执行效能远较公知技术更好。It can be seen from the above description that the technology of the present invention can achieve the functions of encryption and decryption only with simple hardware, and does not need to use a complicated virtual random number generator like the known technology, which can save costs, and at the same time, protect the generation and removal of bit codes. The hardware is quite simple, and does not increase the processing time of encryption and decryption as in the known technology, but is far less than the time spent in the processing of encryption and decryption in the known technology, so its execution performance is much better than that of the known technology.
应注意的是,上述诸多实施例仅是为了便于说明而举例而已,本发明所主张的权利范围自应以申请专利范围所述为准,而非仅限于上述实施例。It should be noted that the above-mentioned embodiments are only examples for convenience of description, and the scope of rights claimed by the present invention should be determined by the scope of the patent application, rather than limited to the above-mentioned embodiments.
Claims (48)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2004100018213A CN100353274C (en) | 2004-01-14 | 2004-01-14 | A device for encrypting and protecting a program with a protection bit code |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2004100018213A CN100353274C (en) | 2004-01-14 | 2004-01-14 | A device for encrypting and protecting a program with a protection bit code |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1641514A CN1641514A (en) | 2005-07-20 |
| CN100353274C true CN100353274C (en) | 2007-12-05 |
Family
ID=34867207
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB2004100018213A Expired - Fee Related CN100353274C (en) | 2004-01-14 | 2004-01-14 | A device for encrypting and protecting a program with a protection bit code |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN100353274C (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5515307A (en) * | 1994-08-04 | 1996-05-07 | Bell Communications Research, Inc. | Pseudo-random generator |
| CN1180466A (en) * | 1996-03-04 | 1998-04-29 | 诺基亚电信公司 | Improving security of packet-mode transmission in mobile communication system |
| CN1216653A (en) * | 1996-03-18 | 1999-05-12 | 株式会社东芝 | encoding device and decoding device |
| US6104811A (en) * | 1996-08-16 | 2000-08-15 | Telcordia Technologies, Inc. | Cryptographically secure pseudo-random bit generator for fast and secure encryption |
-
2004
- 2004-01-14 CN CNB2004100018213A patent/CN100353274C/en not_active Expired - Fee Related
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5515307A (en) * | 1994-08-04 | 1996-05-07 | Bell Communications Research, Inc. | Pseudo-random generator |
| CN1180466A (en) * | 1996-03-04 | 1998-04-29 | 诺基亚电信公司 | Improving security of packet-mode transmission in mobile communication system |
| CN1216653A (en) * | 1996-03-18 | 1999-05-12 | 株式会社东芝 | encoding device and decoding device |
| US6104811A (en) * | 1996-08-16 | 2000-08-15 | Telcordia Technologies, Inc. | Cryptographically secure pseudo-random bit generator for fast and secure encryption |
Also Published As
| Publication number | Publication date |
|---|---|
| CN1641514A (en) | 2005-07-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20070101158A1 (en) | Security region in a non-volatile memory | |
| CN102163268B (en) | The term of execution verifying software code the method and apparatus of integrality | |
| EP4116830A1 (en) | Memory integrity | |
| KR101216995B1 (en) | A code encryption and decryption device against reverse engineering based on indexed table and the method thereof | |
| WO2017112282A1 (en) | Memory integrity with error detection and correction | |
| JP2008530663A (en) | Microprocessor data security method and system | |
| CN111008407B (en) | Cryptographic circuitry for performing virtual cryptographic operations | |
| US10797857B2 (en) | Data interleaving scheme for an external memory of a secure microcontroller | |
| CN112069551A (en) | Electronic circuit | |
| JP2023130311A (en) | Method for protecting electronic computer against side-channel attacks, and electronic computer | |
| CN1307563C (en) | Encryption device, encryption system, decryption device and a semiconductor system | |
| CN102306253B (en) | Microprocessor, security method and method for revoking first password | |
| TWI249666B (en) | Device using parity check bit to carry out data encryption protection and method thereof | |
| CN100353274C (en) | A device for encrypting and protecting a program with a protection bit code | |
| TWI221966B (en) | Device for encrypting/protecting program with protection bit codes | |
| Zeh et al. | RISC-V cryptographic extension proposals volume I: Scalar & entropy source instructions | |
| KR20180059217A (en) | Apparatus and method for secure processing of memory data | |
| AU2021100948A4 (en) | Enhancing cyber security using high speed hybrid authentication technique | |
| EP3907633B1 (en) | System and method for obfuscating opcode commands in a semiconductor device | |
| CN111291389B (en) | Method and system for protecting full life cycle of computer core program | |
| CN114237492A (en) | Non-volatile memory protection method and device | |
| US11651086B2 (en) | Method for executing a computer program by means of an electronic apparatus | |
| JP2008135893A (en) | Encryption device and program for creating encrypted document attached with disposable encryption key | |
| US12088722B2 (en) | Method for executing a computer program by means of an electronic apparatus | |
| CN119989430B (en) | An encryption and decryption circuit system and method based on RISC-V architecture |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20071205 Termination date: 20150114 |
|
| EXPY | Termination of patent right or utility model |