WO2008010508A1 - dispositif de génération de commande - Google Patents

dispositif de génération de commande Download PDF

Info

Publication number
WO2008010508A1
WO2008010508A1 PCT/JP2007/064156 JP2007064156W WO2008010508A1 WO 2008010508 A1 WO2008010508 A1 WO 2008010508A1 JP 2007064156 W JP2007064156 W JP 2007064156W WO 2008010508 A1 WO2008010508 A1 WO 2008010508A1
Authority
WO
WIPO (PCT)
Prior art keywords
processing
instruction
instruction group
processing instruction
variable
Prior art date
Application number
PCT/JP2007/064156
Other languages
English (en)
French (fr)
Inventor
Taichi Sato
Rieko Asai
Original Assignee
Panasonic Corporation
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Panasonic Corporation filed Critical Panasonic Corporation
Priority to US12/373,956 priority Critical patent/US8302188B2/en
Priority to JP2008525875A priority patent/JP5118036B2/ja
Publication of WO2008010508A1 publication Critical patent/WO2008010508A1/ja

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/54Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by adding security routines or objects to programs

Definitions

  • the present invention relates to an instruction generation device that generates a computer program that can prevent unauthorized analysis and tampering.
  • Some conventional tampering prevention techniques use a tampering check.
  • the hash value Z checksum of the program in memory is calculated and calculated in advance.
  • FIG. 1 is a diagram showing a program including the process of the conventional tampering check.
  • Figure 1! /, ⁇ , the function fl indicates the processing instruction group subject to tampering check (protected object).
  • the function fl is a program held and executed on the memory of the computer, and is assumed to be held at the address 0300 to 0400 in the memory.
  • the function f 2 indicates tampering check processing.
  • the case of tmp indicates a process (hash calculation process) of repeating the operation from address 03 00 to 0400. By this processing, it is possible to calculate the sum (checksum) of the data from address 0300 to 0400.
  • SUM SUM) ⁇ exit (); ⁇ ” determines whether the calculated checksum is equal to SUM, and if it is true, the processing is continued, and if it is false Indicates the process of ending the process (judgment / termination process).
  • SUM is a check sum of the function fl calculated in advance. Therefore, if the function fl is not falsified, SUM and tmp have equal values, but if the function fl is falsified, SUM and tmp have different values. From this, it can be known whether or not the function fl is tampered with depending on whether SUM and tmp become equal values.
  • FIG. 2 is an explanatory diagram for explaining the processing of the conventional tampering-preventing processing generation device.
  • the conventional tampering prevention processing generation device obtains an tampering program by acquiring an input program including a code to be protected and adding tampering check processing to the input program.
  • Generate The code to be protected corresponds to the processing instruction group of the function fl described above, and the tampering prevention program corresponds to the program shown in FIG.
  • the conventional tampering-preventing processing generation device prevents the execution of the input program including the tampered protected code by adding the tampering check processing to the input program.
  • Patent Document 1 Japanese Patent Application Publication No. 2005-173903
  • the fraudulent analyst first tampers with the protection target code (function fl) of the tampering prevention program and executes the tampering prevention program. Then, the fraud analyst can easily find out the hash calculation processing in the tampering check processing by monitoring whether the tampered part is accessed as data. Specifically, finding a falsification check process is possible using a debugger that has a function to monitor reading as data to a specified address.
  • the present invention has been made in view of the above-mentioned problems, and it is an object of the present invention to provide an instruction generation device that generates a program capable of reliably protecting a protection target code. Means to solve the problem
  • an instruction generation device causes a plurality of instructions to be executed by the computer in order to protect a first processing instruction that causes a computer to substitute data into a substituted variable.
  • An instruction generating device for generating an output processing instruction group consisting of instructions, wherein the output processing instruction is a branch instruction for branching a processing path to the first processing instruction so that the computer executes the first processing instruction.
  • the data is predetermined depending on branch instruction generation means generated as part of a group and data substituted into the assigned variable indicating the result of execution of the first processing instruction according to the branch instruction by the computer.
  • the output processing command is a dependent processing instruction that causes the computer to execute predetermined processing to be performed after the output processing instruction group when the contents indicated are displayed.
  • the computer executes the first processing instruction by the branch instruction, and the execution result (data substituted into the substituted variable) by the dependent processing instruction. Perform dependent processing.
  • the computer executes the process determined in advance by the dependent process instruction, but if the first process instruction is falsified, the computer is determined in advance. Processing other than processing will be executed. Therefore, the first processing instruction can be protected from falsification.
  • the first processing instruction is not read as data, it is possible to make it difficult for an unauthorized analyst to find out the processing (output processing instruction group) which is trying to prevent tampering, and it is a protected code.
  • the first processing instruction can be reliably protected from tampering and fraud analysis.
  • the first processing instruction is used as a part of the output processing instruction group, and unauthorized analysis and tampering of the program (the first processing instruction, etc.) can be prevented.
  • the value is great.
  • the output processing instruction group does not perform the predetermined processing. That is, the falsification check of the first processing instruction can be achieved. Furthermore, even if falsification is performed to force data substituted by the first processing instruction to a predetermined content in order to avoid this falsification check, the first processing instruction may not be transmitted from other instruction groups. If it is also called, the instruction group will not operate normally. As a result, it is possible to detect that there has been tampering.
  • the dependent processing instruction generation unit acquires the second processing instruction for causing the computer to execute predetermined processing and converts the dependence processing instruction into the dependent processing instruction.
  • An instruction is generated, and the second processing is performed when the dependent processing instruction indicates that a value substituted into the assigned variable indicating a result of execution of the first processing instruction indicates a predetermined assumed value.
  • the computer may be characterized in that the same execution result as the instruction execution result is derived.
  • the instruction generating device acquires the second processing instruction
  • the second processing instruction can be obfuscated into the dependent processing instruction, and the first processing instruction can be protected surely.
  • the first processing instruction is also executed when the output processing instruction group (corresponding to the processing of the second processing instruction) for performing the predetermined processing is executed. Therefore, when analyzing the defined processing, the unauthorized analyst must analyze both the output processing instruction group and the first processing instruction, which can make the fraud analysis more difficult.
  • the instruction generation device further causes the computer to perform processing different from the second processing instruction using the first processing instruction and the second processing instruction not using the first processing instruction.
  • Acquisition means for acquiring an input program including a third processing instruction to be executed, and the dependent processing instruction generated by converting the second processing instruction of the input program by the dependent processing instruction generation unit;
  • the information processing apparatus may further comprise output means for outputting an output program including the output processing instruction group and the third processing instruction.
  • the program including the second processing instruction can be obfuscated.
  • the first processing instruction is an instruction that is also used for other purposes, and thus the code size
  • it can be concealed that the execution of the first process instruction is actually a process for performing a tampering check.
  • the instruction generation device further includes an assumed value calculation unit configured to calculate, as the assumed value, a value substituted into the substituted variable by the first processing instruction according to a predetermined condition.
  • the dependent processing instruction generation unit calculates the value substituted into the substituted variable indicating the result of execution of the first processing instruction by the assumed value calculation unit.
  • the dependent processing instruction may be generated to cause the computer to derive the same execution result as the execution result of the second processing instruction.
  • the instruction generation device further performs, by reference substitution, causing the computer to substitute a value into a referenced variable referred to by the first processing instruction when the computer executes the first processing instruction.
  • the reference value substitution processing generation unit generates a processing instruction as a part of the output processing instruction group, and the assumed value calculation unit treats a value substituted into the reference variable as the condition, and the reference variable The value to be substituted into the substituted variable by the first processing instruction is calculated as the assumed value according to the value of.
  • the value of the by-reference variable referred to when the computer executes the first processing instruction, and the value of the by-reference variable regarded as the condition when the assumed value calculation means calculates the assumed value are Since they are equal, if the first processing instruction is not falsified, it is possible to make the value of the substituted variable indicating the result of execution of the first processing instruction equal to the assumed value. As a result, if the value of the substituted variable is different from the assumed value, it can be determined that the first processing instruction is falsified, and the computer does not cause the computer to derive the same execution result as the execution result of the second processing instruction. It can be done.
  • the value of the referenced variable referred to when the computer executes the first processing instruction, and the value of the referenced variable regarded as the condition when the assumed value calculation means calculates the assumed value are equal. Because it is only necessary, the value of the referenced variable can be set to an arbitrary value rather than a fixed value.
  • the instruction generation device further includes a referenced specifying unit that identifies a referenced variable to be referenced by the first processing instruction, and the referenced substitution process generating unit is configured to connect the computer to the computer.
  • the reference substitution processing instruction may be generated to substitute a value into the reference variable specified by the reference specifying means.
  • the instruction generation device further includes value holding means for holding, as a set of referenced variable values, a plurality of values as candidates for values to be substituted for the referenced variable, Reference:
  • the substitution processing generation means is configured to select one of the values included in the set of referenced variable values as the reference.
  • the reference assignment processing instruction to be assigned to a reference variable may be generated.
  • the assumed value calculation means sets, as the set of assumed values, a set of values substituted into the assigned variable by the first processing instruction in accordance with each value included in the set of the referenced variable values.
  • the dependent processing instruction generation unit generates the dependent processing instruction using the set of the referenced variable values and the set of the assumed values, and the dependent processing instruction executes the first processing instruction. If the value of the assigned variable indicating the result is a value included in the set of assumed values, the computer is made to derive the same execution result as the execution result of the second processing instruction.
  • the value stored in the referenced variable can be made different each time the output processing instruction is executed. As a result, it can be made more difficult for fraudulent analysts to find out that the output processing instruction group is for protecting the first processing instruction.
  • the dependent processing instruction causes the computer to compare the value substituted for the substituted variable with a predetermined assumed value, and the value of the substituted variable is equal to the assumed value.
  • the computer may execute a predetermined process, and when the value of the variable to be substituted is different from the assumed value, the computer may be inhibited from executing the predetermined process. .
  • the computer can execute error processing, and the first processing instruction is modified. Wrinkle detection can be performed.
  • the instruction generating device further includes an assigned specifying unit that specifies the assigned variable included in the first processing instruction, and the dependent processing instruction generating unit includes the assigned specifying unit. May generate the dependent processing instruction that causes the computer to execute processing dependent on the data substituted into the assigned variable specified by the
  • the assigned identification unit (assigned variable analysis unit) identifies the assigned variable, so that the user does not specify which force is the assigned variable included in the first processing instruction.
  • An instruction can be generated.
  • the instruction generation device may further include: the first processing instruction; and the first processing instruction.
  • a branch destination of the first processing instruction is an acquisition unit that acquires an input program including a second subsequent instruction, and a first processing instruction when the first condition is satisfied and the second condition is satisfied.
  • Condition to branch the processing path from the first processing instruction to another instruction in different manners Conditional branch instruction generating means for generating a branch instruction, the first processing instruction, the first preceding instruction, the first subsequent instruction And output means for outputting an output program including the second processing instruction, wherein the dependent processing instruction generation means includes the second subsequent instruction when data of the assigned variable indicates a predetermined content.
  • the same execution result as And the branch instruction generation unit is configured to execute the first processing instruction again so as to execute the first processing instruction again after the computer executes the second processing instruction. Processing instruction force
  • the branch instruction to branch to the first processing instruction is generated, and the conditional branch instruction generation unit generates the first processing instruction as the first processing instruction when the first condition is satisfied.
  • An output unit outputs the output program including the dependent processing instruction, the branch instruction, and the conditional branch instruction, and the first condition is that the first processing instruction is executed by the computer.
  • the first preceding instruction is executed immediately before the execution of the first processing instruction
  • the second condition is that the first processing instruction is executed by the computer.
  • the second processing instruction may be executed immediately before the execution of the first processing instruction.
  • the second processing instruction and the second subsequent instruction may be executed between. That is, in the output program, the first processing instruction is also executed in an execution order different from the execution order in the input program.
  • the input program can be obfuscated, and even if an incorrect analyst actually moves the output program to perform analysis, the input program is executed. It becomes difficult to analyze order and context.
  • the input program includes a plurality of the first subsequent instructions, and the conditional branch instruction generating unit performs the first process when the first condition is satisfied.
  • the processing path is selected as the first subsequent instruction according to the third condition among the plurality of first subsequent instructions so that the first subsequent instruction is executed as the branch target first subsequent instruction.
  • the conditional branch instruction to branch from a processing instruction to the branch destination first subsequent instruction may be generated.
  • conditional branch instruction generation means is a value of a variable indicating whether the force satisfying the first condition is satisfied or not.
  • the conditional branch instruction for branching the processing path may be generated based on the value of a variable indicating whether the second condition is satisfied or not.
  • the input program includes a plurality of the second subsequent instructions
  • the dependent processing instruction converts each of the plurality of second subsequent instructions into the dependent processing instruction
  • the condition The branch instruction generation unit when the second condition is satisfied, determines that one of the plurality of dependent processing instructions is subjected to one of the plurality of dependent processing instructions according to a fourth condition after the first processing instruction is executed.
  • the conditional branch instruction may be generated to cause the processing path to branch from the first processing instruction to the branch destination dependent processing instruction so that the processing instruction is executed as a branch destination dependent processing instruction.
  • the fourth condition is a value substituted for a variable
  • the conditional branch instruction generation unit is configured to indicate a value of a variable indicating whether the first condition is satisfied
  • the conditional branch instruction may be generated to cause the processing path to branch based on the value of a variable indicating whether two conditions are satisfied.
  • the instruction generation device is further used for: variable generation means for generating an additional color variable that is used in the input program; and for the com- puter when the first condition is satisfied.
  • variable generation means for generating an additional color variable that is used in the input program; and for the com- puter when the first condition is satisfied.
  • a condition value substitution instruction generating unit for generating a second condition value substitution instruction to cause the conditional branch instruction generation unit to generate the processing condition when the value substituted into the additional variable is the first condition value; Is branched from the first processing instruction to the first subsequent instruction, and when the value substituted in the additional variable is the second condition value, the processing path is processed from the first processing instruction to the second dependent processing.
  • To instruction Yo it is characterized in that to generate the conditional branch instruction to Toki.
  • the additional variable used to confirm whether the first condition or the second condition is satisfied is not the variable included in the input program, the first condition or the second condition is It is possible to guarantee that the input program does not affect the execution of the processing that the input program should perform even if values are assigned to the additional variables.
  • the second subsequent instruction and the dependent processing instruction may be obtained at the time when the second processing instruction is executed, using the execution result obtained from the second processing instruction to execute the same processing.
  • An instruction to be executed by a computer wherein the instruction generation device is further adapted to execute the first processing instruction obtained as a result of execution of the second processing instruction.
  • the instruction generation device further converts at least one instruction out of the first processing instruction, the first preceding instruction, and the second processing instruction into an instruction equivalent to the instruction.
  • a conversion means may be provided, and the output means may output the instruction converted by the conversion means by being included in the output program instead of the instruction before conversion corresponding to the instruction. That is, the instruction or instruction group of the present invention also includes equivalent instructions obtained by obfuscating them by other obfuscation techniques different from the present invention, which are divided only by the instruction or the instruction group itself.
  • At least one instruction of the input program is replaced with an instruction equivalent to the instruction, so that the correspondence between the instruction of the input program and the instruction of the output program can be divided. It can be difficult. In other words, it is possible to increase the degree of obfuscation for the input program and make analysis of the output program more difficult.
  • the branch instruction generation unit searches for an instruction that calls the same API as the API as the second subsequent instruction, and The branch instruction may be generated to branch a processing path from the second processing instruction which is a branch source of a second subsequent instruction to the first processing instruction.
  • API Application Program Interface
  • the first processing instruction can be easily converted to a dependent processing instruction that depends on the data of the assigned variable.
  • the first processing instruction can be reliably protected from tampering and fraud analysis.
  • the instruction generation device further includes an acquisition unit that acquires an input program including the first processing instruction, the branch instruction generation unit, and the branch instruction generated by the dependent processing instruction generation unit. And adding the dependent processing instruction to the input program, thereby including the first processing instruction, the branch instruction, and the dependent processing instruction. And an output unit that generates and outputs an output program.
  • the input program can be converted into the output program, and the first processing instruction included in the output program can be surely protected.
  • the output program generated by the instruction generation device has a first processing instruction corresponding to the first function, a second processing instruction corresponding to the second function, and a computer. And a branch instruction for causing the computer to execute the first processing instruction, which is unnecessary for the second function, as a redundant processing when the second processing instruction is executed.
  • the present invention can be realized as such an instruction generation device, and a processing generation method for generating an output processing instruction group which is not possible, or causing a personal computer or the like to generate the output processing instruction group.
  • the present invention can also be realized as a program for recording, a recording medium recording the program, or an integrated circuit generating an output processing instruction group. Needless to say, the same effect as that of the instruction generation device can be obtained in this case as well.
  • the instruction generating device has an operation and effect that it can generate a program that can reliably protect a code to be protected.
  • FIG. 1 is a diagram showing a program including the process of the conventional tampering check.
  • FIG. 2 is an explanatory diagram for explaining the processing of the conventional tampering prevention processing generation device.
  • FIG. 3 is a diagram showing the configuration of a processing system according to Embodiment 1 of the present invention.
  • FIG. 4 is a diagram showing the configuration of an output processing instruction group of the same as the above.
  • FIG. 5A is a diagram showing a specific example of a first processing instruction group described in C language.
  • FIG. 5B is a diagram showing a specific example of a second processing instruction group described in C language.
  • FIG. 5C is a diagram showing a specific example of an output processing instruction group described in C language.
  • FIG. 6 is a diagram showing the configuration of a tampering prevention processing generation device of the same.
  • FIG. 7 is a flowchart showing the operation of the tampering prevention processing generation device of the same.
  • FIG. 8 is an explanatory view for explaining the effect of the tampering prevention processing generation device of the same.
  • FIG. 9 is a view showing a specific example of the output processing instruction group generated by the tampering prevention processing generation device in accordance with the sixth modification of the above.
  • FIG. 10 is a view showing the configuration of a tampering prevention process generating device according to the sixth modification of the above.
  • ⁇ 11 Fig. 11 is a diagram showing the configuration of a processing system according to a second embodiment of the present invention.
  • ⁇ ⁇ 12 Fig. 12 is a diagram showing the configuration of an output processing instruction group of the same.
  • Fig. 13 is a diagram showing a specific example of the output processing instruction group described in C language in the same.
  • FIG. 14 is a diagram showing the configuration of a tampering prevention processing generation device of the same.
  • Fig. 15 is an explanatory view for explaining the effect of the tampering prevention processing generation device same as above.
  • FIG. 16 is a diagram showing the configuration of a processing system according to a third embodiment of the present invention.
  • FIG. 17 shows the configuration of the above-mentioned input program.
  • Figure 18 shows a specific example of the input program in C language.
  • FIG. 19 is a diagram showing the configuration of the tampering prevention program of the same.
  • Fig. 20 is a diagram showing a specific example of the tampering prevention program expressed in C language in the same.
  • FIG. 21 is a diagram showing the process flow of the input program of the same.
  • FIG. 22 is a diagram showing the flow of processing of the tampering prevention program of the same.
  • FIG. 23 is a diagram showing the configuration of the tampering prevention processing generation device of the same.
  • FIG. 24 is a flowchart showing the operation of the tampering prevention processing generation device of the same.
  • FIG. 25 is a view showing the configuration of a tampering prevention program according to the above-mentioned modification.
  • FIG. 26 is a diagram showing a specific example of the tampering prevention program expressed in C language according to the above-mentioned modification.
  • FIG. 27 is a diagram showing the flow of processing of the tampering prevention program according to the variation above.
  • FIG. 28 is an explanatory diagram for explaining an operation in which a tampering prevention process generating device according to the modification of the above generates a tampering prevention program.
  • FIG. 29 is an explanatory diagram for explaining an operation in which a tampering prevention process generating device according to the modification of the above generates a tampering prevention program including an API.
  • FIG. 30 is an explanatory diagram for describing an effect when the first processing instruction group of the present invention is originally included in the execution processing device.
  • FIG. 31 is an explanatory diagram for describing an effect when the A instruction group of the present invention includes a characteristic operation.
  • FIG. 32 is a diagram showing an example of tampering by a fraud analyst.
  • FIG. 33 is a diagram showing an example in which the tampering prevention process generating device relating to the modification of the first to third embodiments of the present invention performs only the dependency.
  • FIG. 34 is a view showing an example of the configuration of a tampering prevention process generation device according to the modification of the above.
  • FIG. 35 is a flow chart showing an example of the operation of the tampering prevention process creation device according to the variation of the above. Explanation of sign
  • the instruction generating device according to the present invention will be described as a tampering prevention processing generating device.
  • FIG. 3 is a diagram showing the configuration of a processing system according to the first embodiment.
  • the processing system 100 includes a tampering prevention processing generation device (instruction generation device) 110 and an execution processing device 130.
  • the tampering prevention processing generation device 110 is a device that generates a program capable of reliably protecting the protection target code, and acquires the first processing instruction group 140 and the second processing instruction group 150 which are the protection target code. Then, an output processing instruction group 160 is generated. Note that the tampering prevention processing generation device 110 is configured as an obfuscation device that obfuscates the second processing instruction group 150 and generates the output processing instruction group 160. Unless otherwise specified, the instruction group in the present specification and the present invention is not limited to one including a plurality of instructions, and includes one having only one instruction.
  • the tampering prevention processing generation device 110 writes the generated output processing instruction group 160 and the first processing instruction group 140 in the recording medium 120.
  • the execution processor 130 reads out and executes the first processing instruction group 140 and the output processing instruction group 160 recorded on the recording medium 120.
  • the tampering prevention processing generation device 110 transmits the first processing instruction group 140 and the output processing instruction group 160 to the execution processing device 130 via the communication medium which does not write the recording processing instruction group 160 on the recording medium 120.
  • the first processing instruction group 140 is a processing instruction group to be executed by the execution processing device 130, and may be executed as part of the processing of the output processing instruction group 160, separately from that processing. It will be done.
  • the second processing instruction group 150 is a processing instruction group including an instruction for instructing the execution processing device 130 to perform a predetermined process.
  • first processing instruction group 140 receives the encrypted reproduction count of the content as an input, and instructs the process to decrypt this and output the plaintext reproduction count. Description will be made assuming that the instruction group is Further, in the present embodiment, the second processing instruction group 150 is described as an instruction group that inputs a compressed content, decompresses this, and instructs processing to be output.
  • An output processing instruction group 160 is an instruction group obtained by obfuscating the second processing instruction group 150, and is configured to call and use the first processing instruction group 140 in the middle of processing. That is, when the output processing instruction group 160 is executed by the execution processing unit 130, the instruction group included in the output processing instruction group 160 is executed first, and the first processing instruction group 140 is called and executed along the way. Then, the next processing instruction group of the output processing instruction group 160 is executed again.
  • FIG. 4 is a diagram showing the configuration of the output processing instruction group 160. As shown in FIG. 4
  • the output processing instruction group 160 includes a referenced variable value substitution processing instruction group 310 for setting values for various parameters necessary for calling and executing the first processing instruction group 140, and a first processing instruction. It comprises a branch processing instruction group 320 for calling the group 140 and a dependent processing instruction group 330 to be executed after the first processing instruction group 140 is called.
  • each processing instruction group is the reference variable value substitution processing instruction group 310, the branch processing instruction group 320, the first processing instruction group 140, and the dependent processing instruction group 330 in this order. Is executed.
  • the referenced variable value substitution processing instruction group 310 is processing for setting values to various parameters necessary for calling and executing the first processing instruction group 140. Specifically, for example, when the first processing instruction group 140 is a function, the referenced variable value substitution processing instruction group 310 is an instruction group that substitutes a value into a function argument. Also, for example, if the first processing instruction group 140 is an instruction group that refers to an external variable, the referenced variable value substitution processing instruction group 310 is an instruction group that substitutes a value into the external variable. Also, for example, if the first processing instruction group 140 is an instruction group that refers to the value of the stack, the referenced variable value substitution processing instruction group 310 is an instruction group that stores the value on the stack. Also, for example, if the first processing instruction group 140 is an instruction group that refers to the value stored at the position designated by the address variable, the by-reference variable value substitution processing instruction group 310 has a value for the referenced address variable. Are instructions that store
  • Branch processing instruction group 320 (1.2) Branch processing instruction group 320
  • the branch processing instruction group 320 is a processing instruction group which branches to the first processing instruction group 140. Specifically, for example, if the first processing instruction group 140 is a function, the branch processing instruction group 320 is a function call instruction, and if the first processing instruction group 140 is a subroutine, the branch processing instruction group 320 is a subroutine call instruction. If the first processing instruction group 140 is a group of processing instructions, the branch processing instruction group 320 is a branch instruction, and if the first processing instruction group 140 is exception processing, the branch processing instruction group 320 is an exception.
  • the branch processing instruction group 320 is a function call such as "CALL, RET", a jump instruction such as "JA, JMP, LOOP", or an interrupt instruction such as "IN Tj". It is.
  • the dependent processing instruction group 330 is a processing instruction group that is executed after calling the first processing instruction group 140, and is a program instruction group that performs processing equivalent to the second processing instruction group 150.
  • the second processing instruction group 150 is different from the second processing instruction group 150 in that the processing power of part of the second processing instruction group 150 is replaced by processing using the processing result of the first processing instruction group 140. The details of the replacement will be described in the description of the tampering prevention processing generation device 110, and an outline of the replacement will be described here.
  • the processing result of the first processing instruction group 140 is, for example, the return value of the function when the first processing instruction group 140 is a function. Also, for example, if the first process instruction group 140 is a process of setting a value to an external variable, the process result of the first process instruction group 140 is a value substituted for the external variable. Also, for example, if the first process instruction group 140 is a process of storing values in stacks, the process result of the first process instruction group 140 is a value stored in the stack. Further, for example, in the case where the first processing instruction group 140 is processing of storing a value at a position designated by an address variable, the processing result of the first processing instruction group 140 is the stored value.
  • the storage destination in which the processing result of the first processing instruction group 140 is stored is referred to as a substituted variable in the following description.
  • variable value substitution processing Only when the instruction group 310 is set, the value of the processing result can be known in advance. Specifically, for example, when the first processing instruction group 140 is executed after actually setting the values set by the referenced variable value substitution processing instruction group 310 as the referenced variable, the value of the processing result is known. Can. In the following description, this value is called an assumed value.
  • the dependent processing instruction group 330 is an instruction group that performs the same processing as the second processing instruction group when the value of the substituted variable is an assumed value.
  • the value of the assigned variable is not an assumed value, and in the case where the value of the assigned variable is an instruction group that performs processing different from the second processing instruction group.
  • the ones replaced by a * b; are dependent processing instructions.
  • FIG. 5A is a diagram showing a specific example of the first processing instruction group 140 described in C language.
  • FIG. 5B is a diagram showing a specific example of the second processing instruction group 150 described in C language.
  • FIG. 5C is a diagram showing a specific example of the output processing instruction group 160 described in C language.
  • operators such as "*”, “ ⁇ ", “I”, “'”, “ku”, “>>” are used, these operators used in the explanation of processing instruction group Indicates an operator in C unless otherwise noted.
  • each processing instruction group is added according to the language form of a function declaration or variable declaration language, but since this language form is known, the explanation will be omitted.
  • the first processing instruction group 140 receives the number of times of playback of the encrypted content "the number of times of playback of the content by inputting and decrypting encryptedDataJ (referenced variable)". It is a group of instructions including the process of outputting "plainDat a " (assigned variable).
  • the processing “plainData encryptedData“ OxOOFF ”which takes the number of times of reproduction of the encrypted content and the secret information“ 0x00FF ”is taken as the processing of decryption. Note that the head “0x” in “0x00FF” indicates that "00FF" is a hexadecimal number.
  • plainData and “encryptedData” are 16-bit values taking values from “OxOOOO to OxFFFF”, respectively. Also, plainData is the highest level when expressed in binary When the bit is 1, it indicates a negative value. That is, values up to "0x8000 to 0xFFFF" indicate negative numbers.
  • the second processing instruction group 150 is an instruction group including processing of outputting content data “decompressedData” by inputting and extracting compressed content data “compressedData” as shown in FIG. 5B. is there.
  • the process of outputting a binary number in which 1 continues by the number of values of the compressed content data “compressedData” is taken as the process of decompression.
  • compressedData is a value from 0 to 31 and “decompressedD ata” is a 32-bit value.
  • “DecompressedData” is "0x00000000” when “compressedData” power S “0”, “0x0000000 1” when “compressedData” power 1 ",” when compressedData “is” 31 " It becomes “0xFFFFFFFF”.
  • the output processing instruction group 160 is a processing instruction group that performs the same decompression processing as the second processing instruction group 150, as shown in FIG. 5C.
  • the output processing instruction group 160 is an instruction group after the second processing instruction group 150 has been obfuscated by the tampering prevention processing generation device 110. Details of the tampering prevention processing generation device 110 will be described later.
  • the expected value of the return value when the branch processing instruction group 320 is executed normally is the processing of the first processing instruction group 140 with the referenced variable “encryptedData” as the value “0xF022”.
  • the dependent processing instruction group 330 shows processing that performs processing equivalent to that of the second processing instruction group 150. However, in this process, unlike the second process instruction group 150, the process of the first process instruction group 140 is performed. It includes processing using the result "plainData".
  • the output processing instruction group 160 includes a referenced variable value substitution processing instruction group 310 for setting values for various parameters necessary for executing the first processing instruction group 140, and the first processing instruction group. It consists of a branch processing instruction group 320 for calling 140 and a dependent processing instruction group 330 to be executed after the first processing instruction group 140 is called.
  • conversion is performed by the tampering prevention processing generation device 110, and the second processing instruction group 150 does not call the first processing instruction group 140, but the output processing instruction group is an instruction group after conversion.
  • processing for calling the first processing instruction group 140 is added.
  • the processing (the decompression processing in the above embodiment) intended by the output processing instruction group 160 is inherently performed.
  • the unnecessary first processing instruction group 140 (decoding processing in the above embodiment) is also executed. Therefore, it becomes difficult to analyze whether the first process instruction group 140 is a function required for a plurality of processes or a function required for a single process.
  • the first processing instruction group is processing necessary for decoding, and is originally processing unnecessary for decompression.
  • the first processing instruction group 140 is processing necessary for both decoding and decompression.
  • the execution processing unit 130 when the output processing instruction group 160 is executed, the first processing instruction group 140 is also executed. Therefore, the unauthorized analyst who analyzes the output processing instruction group 160 does not analyze, and the processing increases as compared with the second processing instruction group 150.
  • the first processing instruction group 140 that performs the decoding process of the first embodiment is not the second processing instruction group 150 that performs the decompression process. It is needless to say that the process is a process also called from the instruction group (in fact, it is a process that should normally be called from other than the second process instruction group 150).
  • the instruction group that should originally call the first process instruction group 140 may be an instruction group included in the same program as the first process instruction group 140, and the first process instruction group 140 is a library etc. If so, different programs may be called.
  • first process instruction group 140 and the second process instruction group 150 may be included in the same program, or in the case where the first process instruction group 140 is a library or the like as described above, they are different programs. It may be included.
  • the program when included in the same program, it is desirable that the program is a program that performs some processing using the first processing instruction group 140 in order not to increase the program size as described above.
  • both processing instruction groups can be input by providing the program as an input. Furthermore, in this case, a program output unit or the like is further provided which replaces the second processing instruction group 150 in the program with the output processing instruction group 160 and outputs the input program into a program having the above-described features. It can be difficult to read.
  • the dependent processing instruction group 330 of the output processing instruction group 160 is an instruction group that performs processing depending on the processing result of the first processing instruction group 140. Therefore, fraudulent analysts do the first process When the instruction group 140 is tampered with, the processing of the output processing instruction group 160 is different from the original result. Specifically, for example, if the unauthorized analyst tampers with the first processing instruction group 140 that outputs the number of times of reproduction of the content in FIG. 5A, into “int decrypt (int encryptedData) ⁇ ret urn 100; ⁇ ”, The value of “plainData” in the dependent processing instruction group 330 is 100, which is a value different from “0xF0DD”.
  • the unauthorized analyst who tampered with the first processing instruction group 140 can not execute the content correctly unless the output processing instruction group 160 is also tampered with.
  • the first processing instruction group 140 and the second processing instruction group 150 are components of a large function such as reproduction of content, when some components are falsified, the other processing The behavior of the component will be strong. Therefore, it becomes difficult to tamper the function as the fraud analyst wants.
  • the tampering prevention processing generation device 110 is a device for converting the second processing instruction group 150 into the above-mentioned output processing instruction group 160.
  • FIG. 6 is a diagram showing the configuration of the tampering prevention process generation device 110. As shown in FIG. 6
  • the tampering prevention processing generation device 110 includes an input processing instruction group holding unit 210, a referenced variable analysis unit 220, a referenced variable information holding unit 230, a referenced variable value substitution processing instruction group generating unit 240, and a referenced variable value.
  • a dependent processing instruction group holding unit 202, a branch processing instruction group generation unit 203, a branch processing instruction group holding unit 204, an output processing instruction group generation unit 205, and an output processing instruction group holding unit 206 are provided.
  • the input processing instruction group holding unit 210 acquires the first processing instruction group 140 and the second processing instruction group 150, and holds each acquired instruction group.
  • the referenced variable analysis unit 220 analyzes what kind of variable such as an argument (referenced variable) needs to have a value set when executing the first processing instruction group 140.
  • the referenced variable information holding unit 230 holds information such as the variable name of the referenced variable obtained by analysis by the referenced variable analysis unit 220.
  • the referenced variable value substitution processing instruction group generation unit 240 generates a referenced variable value substitution processing instruction group 310 for substituting a value into the referenced variable.
  • the referenced variable value substitution processing instruction group holding unit 250 holds the referenced variable value substitution processing instruction group 310 generated by the referenced variable value substitution processing instruction group generation unit 240.
  • the referenced variable value holding unit 260 holds values to be substituted by the referenced variable value substitution processing instruction group 310 into the referenced variable.
  • the assigned variable analysis unit 270 analyzes what variable (assigned variable) the processing result of the first process instruction group 140 is assigned to.
  • the assigned variable information holding unit 280 holds information such as the variable name of the assigned variable obtained by analysis by the assigned variable analysis unit 270.
  • the assumed value calculation unit 290 takes the value of the referenced variable as the value held by the referenced variable value holding unit 260, and calculates the assumed value of the substituted variable obtained when the first processing instruction group 140 is executed. Do
  • the assumed value information holding unit 295 holds the assumed value calculated by the assumed value calculation unit 290.
  • the dependent-processing-instruction-group generating unit 201 generates a dependent-processing-instruction group 330 based on the second processing instruction group 150 and the assumed value.
  • the dependent process instruction group holding unit 202 holds the dependent process instruction group 330 generated by the dependent process instruction group generation unit 201.
  • the branch processing instruction group generation unit 203 generates a branch processing instruction group 320 for calling the first processing instruction group 140 held by the input processing instruction group holding unit 210.
  • the branch processing instruction group holding unit 204 holds the branch processing instruction group 320 generated by the branch processing instruction group generation unit 203.
  • the output processing instruction group generation unit 205 includes a referenced variable value substitution processing instruction group 310 held by the referenced variable value substitution processing instruction group holding unit 250 and a branch held by the branch processing instruction group holding unit 204.
  • An output processing instruction group 160 consisting of 330 is generated.
  • the output processing instruction group holding unit 206 holds the output processing instruction group 160 generated by the output processing instruction group.
  • the input processing instruction group holding unit 210 receives inputs of the first processing instruction group 140 and the second processing instruction group 150 from the outside. That is, the input processing instruction group holding unit 210 acquires the first processing instruction group 140 and the second processing instruction group 150. Further, the input processing instruction group holding unit 210 has an area for storing one or more processing instruction groups. The input processing instruction group holding unit 210 holds the first processing instruction group 140 and the second processing instruction group 150 which are input to the tamper-proof processing generation device 110. It goes without saying that the part that accepts input and the part that holds the input instruction group may be separately configured.
  • the referenced variable analysis unit 220 analyzes (specifies) parameters necessary for executing the first processing instruction group 140 held by the input processing instruction group holding unit 210, and analyzes (specifies) information to be referred variable It is stored in the information holding unit 230.
  • the referenced variable analysis unit 220 specifies the type, name, and number of arguments of the function. Also, for example, if the first processing instruction group 140 includes an instruction group that refers to an external variable, the referenced variable analysis unit 220 identifies the variable name and type of the external variable. Also, for example, if the first processing instruction group 140 is an instruction group including a process of referring to the value of the stack, the referenced variable analysis unit 220 specifies the size of the stack to be referred to.
  • the reference variable analysis unit 220 determines the address variable and the value to be stored. Identify the type of In the following description, information thus identified (analyzed information), that is, information on parameters necessary for executing the first processing instruction group 140 is generically referred to as referred variable information.
  • the referenced variable analysis unit 220 identifies the argument name of the function and the type “int encryptedData” of the argument (solution Analysis) and store this in the referenced variable information holding unit 230.
  • the argument name is "e ncryp tedData”
  • the type is "int”.
  • the referenced variable information holding unit 230 includes an area for storing the referenced variable information! /.
  • the referenced variable information holding unit 230 stores the referenced variable information of the first processing instruction group 140 specified by the referenced variable analysis unit 220.
  • the referenced variable information holding unit 230 records the argument name of the function and the type “int encryptedData”.
  • the referenced variable value substitution processing instruction group generation unit 240 generates a referenced variable value substitution processing instruction group 310, which is a processing instruction group for setting a value to a parameter necessary when executing the first processing instruction group 140, The generated processing instruction group is written in the referenced variable value substitution processing instruction group holding unit 250. Also, the referenced variable value substitution processing instruction group generation unit 240 writes the value to be set to the parameter in the referenced variable value holding unit 260.
  • the referenced variable value substitution processing instruction group generation unit 240 acquires the variable name held by the referenced variable information holding unit 230. Next, the referenced variable value substitution processing instruction group generation unit 240 determines a value to be substituted for the variable indicated by the acquired acquired variable name. Then, the referenced variable value substitution processing instruction group generation unit 240 writes the set of the acquired variable name and the determined value to the referenced variable value holding unit 260. Furthermore, the referenced variable value substitution processing instruction group generation unit 240 generates processing (referenced variable value substitution processing instruction group 310) for substituting the previously determined value into the variable, and the processing is referred to Variable value substitution processing instruction group holding unit 25 0
  • the referenced variable value substitution processing instruction group holding unit 250 includes an area for storing one or more processing instructions.
  • the referenced variable value substitution processing instruction group holding unit 250 stores the referenced variable value substitution processing instruction group 310 generated by the referenced variable value substitution processing instruction group generation unit 240 in the storage area. If there are a plurality of processing instructions generated by the referenced variable value substitution processing instruction group generation unit 240, the plurality of processing instructions are stored.
  • the referenced variable value holding unit 260 has an area for storing a value to be set to a parameter (referenced variable) necessary when executing the first processing instruction group 140.
  • the referenced variable value holding unit 260 includes an area for storing a plurality of pairs of variable names and values, and the variable name determined by the referenced variable value substitution processing instruction group generating unit 240. Store a set of and a value to be assigned to the variable corresponding to the variable name.
  • the referenced variable value holding unit 260 sets the variable “ Store the pair of "encirptedData” and the value "0xF022".
  • the assigned variable analysis unit 270 analyzes (specifies) a storage destination in which the processing result of the first processing instruction group 140 held by the input processing instruction group holding unit 210 is stored.
  • the substituted variable analysis unit 270 specifies the variable name and type of the return value of the function. Also, for example, if the first process instruction group 140 is a process of determining a value to an external variable, the assigned variable analysis unit 270 Identifies the variable name and type of that external variable. Also, for example, if the first processing instruction group 140 is an instruction group including processing for storing values in the stack, the assigned variable analysis unit 270 specifies the size of the stack and the position on the stack (stack pointer). Do. Also, for example, if the first process instruction group 140 includes an instruction group that stores the value at the position designated by the address variable, the assigned variable analysis unit 270 specifies the address to be stored.
  • the information specified in this way that is, the information of the storage destination where the processing result of the first processing instruction group 140 is stored, is generically referred to as assigned variable information. If the stack etc. is realized as a function of the OS (Operating System), the size of the stack pointer or stack may not appear explicitly in the program, but such values may also be assigned. It is variable information.
  • OS Operating System
  • the assigned variable analysis unit 270 stores the analyzed (specified) assigned variable information in the assigned variable information holding unit 280.
  • the to-be-assigned variable analysis unit 270 determines the variable name in which the return value of the function is stored and the type “int plainData "Int plainData" is stored in the assigned variable information holding unit 280.
  • the assigned variable information holding unit 280 stores the assigned variable information of the first processing instruction group 140 specified by the assigned variable analysis unit 270.
  • variable information holding unit 280 may determine which assigned variable is to be stored, or the assigned variable analysis unit 270 may decide. Also, there is no particular way to decide which variable to be substituted to store the substituted variable information, but for example, the first to be found is the substituted variable, or the found variable to be substituted is also random. You may decide to
  • the assigned variable information holding unit 280 stores the return value of the function.
  • Ru Store the variable name and type "int plainData".
  • the assumed value calculation unit 290 calculates the assumed value to be substituted into the substituted variable when the first processing instruction group 140 is executed by using the value of the referenced variable held by the referenced variable value holding unit 260. Get out.
  • the assumed value calculation unit 290 performs the processing shown in the following A) to E).
  • the assumed value calculation unit 290 reads the substituted variable information from the substituted variable information holding unit 280.
  • the expected value calculation unit 290 reads the referenced variable name and value from the referenced variable value holding unit 260.
  • the assumed value calculation unit 290 substitutes the read value into the referenced variable, and executes the first processing instruction group 140 held by the input processing instruction group holding unit 210.
  • the assumed value calculation unit 290 refers to the value of the substituted variable after execution of the first processing instruction group 140.
  • the assumed value calculation unit 290 writes, in the assumed value information holding unit 295, a set of the variable name of the to-be-assigned variable and the value of the referred to to-be-assigned variable.
  • the assumed value calculating unit 290 estimates a set of the variable name of each substituted variable information and the value thereof. Write to the fixed value information holding unit 295.
  • the assumed value calculating unit 290 performs the following A) to E). Do the processing.
  • the expected value calculation unit 290 reads the assigned variable information “int plainData” held by the assigned variable information holding unit 280.
  • the expected value calculation unit 290 executes “decrypt (0xF022);”. That is, calculation is performed by substituting the value "0xF022" into “encryptedData” of "decrypt (encryptedData);”.
  • the expected value calculation unit 290 calculates the value of the substituted variable “plainData” obtained as a result of executing “decrypt (0xF022);”.
  • the assumed value calculation unit 290 outputs “0xF022′0x
  • the variable name of the substituted variable is "plainData” and the value is "OxFODD”.
  • the assumed value information holding unit 295 includes an area for storing assumed value information.
  • the assumed value information is information such as the variable name for which the assumed value should be held and the assumed value.
  • the assumed value information holding unit 295 holds the assumed value calculated by the assumed value calculating unit 290 and the variable name as the above-described assumed value information.
  • the dependent processing instruction group generation unit 201 generates the dependent processing instruction group 330 based on the assumed value held by the assumed value information holding unit 295 and the second processing instruction group 150 held by the input processing instruction group holding unit 210.
  • the dependent processing instruction group 330 is a processing instruction group that performs processing equivalent to that of the second processing instruction group 150, and includes processing that refers to the processing result of the first processing instruction group 140, and part of the processing is performed. It is a processing instruction group that becomes processing using the value referred to.
  • the dependent process instruction group generation unit 201 performs, for example, the processes of A) to F) shown below.
  • the dependent processing instruction group generation unit 201 finds a constant included in the processing instruction included in the second processing instruction group 150.
  • the processing instruction including this constant is Or 1 and the value of the constant is Va 1.
  • the dependent processing instruction group generation unit 201 reads assumed value information held by the expected value information holding unit 295.
  • Vrl be the variable that should hold that expected value
  • Va2 be its expected value. Ru.
  • the dependent processing instruction group generation unit 201 calculates the processing instruction Or2 by calculating the value Val included in the processing instruction Or1 by subtracting the value Va3 from the variable Vrl (the variable to hold the value Va2). Generate That is, Or2 is "(Vrl-Va3)".
  • the dependent processing instruction group generation unit 201 generates a dependent processing instruction group 330 which is an instruction group in which the processing instruction Or 1 of the second processing instruction group 150 is replaced with the processing instruction Or 2.
  • the dependent process instruction group generation unit 201 performs the processes of A) to E) shown below.
  • the dependent processing instruction group generation unit 201 receives “int plainData” from the assumed value information holding unit 295.
  • the dependent processing instruction group generation unit 201 sets the variable Vrl as "plineDataJ” and the value Va2 as "0xF0DD".
  • the dependent processing instruction group generation unit 201 generates a dependent processing instruction group 330 which is an instruction group in which the processing instruction Orl of the second processing instruction group 150 is replaced with the processing instruction Or2. Since this embodiment is a C language program, it is necessary to add function declarations and variable declarations so that the dependency processing instruction group 330 operates properly as a C language program, in addition to the processing described above. There is. Thus, the same instruction group as the dependent processing instruction group 330 illustrated in FIG. 5C is generated.
  • Va3 Va2-Val
  • calculation or processing by another calculation formula may be performed. Specifically, operations such as exclusive OR and addition may be performed, and operations such as a function that performs more complex conversion may be performed. In that case, the calculation formula or process may be modified, a calculation formula or process for obtaining Va2 may be generated, and this may be replaced with Va2. That is, Va3 is calculated by performing an operation or process using Val and Va2, and a group of instructions for performing an operation or process to back calculate Va2 is generated from Va3 and Val obtained, and is replaced with Va2. Good.
  • the dependent processing instruction group holding unit 202 includes an area for storing one or more processing instructions.
  • the dependent processing instruction group holding unit 202 stores the dependent processing instruction group 330 generated by the dependent processing instruction group generation unit 201 in the storage area.
  • dependent processing instruction group holding unit 202 stores dependent processing instruction group 330 shown in FIG. 5C. .
  • Branch processing instruction group generation unit 203 (2. 13) Branch processing instruction group generation unit 203
  • the branch processing instruction group generation unit 203 generates a branch processing instruction group 320 for calling the first processing instruction group 140 held by the input processing instruction group holding unit 210.
  • the branch process instruction group generation unit 203 generates a function call instruction. If the first processing instruction group 140 is subroutine, the branch processing instruction group generation unit 203 generates a subroutine call instruction. If the first processing instruction group 140 is exception handling, the branch processing instruction group generation unit 203 generates a processing instruction that causes an exception.
  • Branch processing instruction group holding unit 204 (2.14) Branch processing instruction group holding unit 204
  • the branch processing instruction group holding unit 204 includes an area for storing one or more processing instructions.
  • the branch processing instruction group holding unit 204 is a branch processing instruction generated by the branch processing instruction group generation unit 203.
  • the group 320 is stored in the storage area.
  • the output processing instruction group generation unit 205 includes a referenced variable value substitution processing instruction group 310 held by the referenced variable value substitution processing instruction group holding unit 250 and a branch processing instruction group held by the branch processing instruction group holding unit 204. 320 and dependent processing instruction group held by the dependent processing instruction group holding unit 202
  • An output processing instruction group 160 consisting of 330 is generated.
  • the output processing instruction group generation unit when the processing up to the above (2. 14) is performed, the output processing instruction group generation unit
  • the output processing instruction group holding unit 206 has an area for storing one or more processing instruction groups.
  • the output processing instruction group holding unit 206 stores the output processing instruction group 160 generated by the output processing instruction group generation unit 205.
  • the output processing instruction group holding unit 206 stores the output processing instruction group 160 of FIG. 5C.
  • FIG. 7 is a flow chart showing the operation of the tampering prevention process generation device 110.
  • the referenced variable analysis unit 220 is an information processing related to the referenced variable that is a storage destination of a parameter necessary for executing the first processing instruction group 140 held by the input processing instruction group holding unit 210. Analyze (specify) reference variable information (Step S 100).
  • the referenced variable analysis unit 220 stores the identified (analyzed) referenced variable information in the referenced variable information holding unit 230 (step S 102).
  • the referenced variable value substitution processing instruction group generation unit 240 determines a value to be stored in the referenced variable identified (analyzed) in step S 100 (step S 104).
  • the referenced variable value substitution processing instruction group generation unit 240 stores the value to be stored in the referenced variable and the referenced variable name determined in step S 104 in the referenced variable value holding unit 260 (see FIG. Step SI 06).
  • the referenced variable value substitution processing instruction group generation unit 240 generates a referenced variable value substitution processing instruction group 310 which is a processing instruction group for storing the value determined in step S 104 in the referenced variable (step S 108).
  • the referenced variable value substitution processing instruction group generation unit 240 stores the referenced variable substitution processing instruction group 310 generated in step S 108 in the referenced variable value substitution processing instruction group holding unit 250 (step S 110). ).
  • the assumed value calculation unit 290 calculates the assumed value taken by the assigned variable when the first processing instruction group 140 is executed using the value of the referenced variable held by the referenced variable value holding unit 260 ( Step S 112).
  • the assigned variable analysis unit 270 analyzes the assigned variable before the step S 112 is performed, and stores the result in the assigned variable information holding unit 280. Therefore, in step S112, the assumed value calculating unit 290 obtains information on the assigned variable from the assigned variable information holding unit 280, and calculates the assumed value.
  • the assumed value calculation unit 290 stores the calculated assumed value and the substituted variable name in the assumed value information holding unit (step S114).
  • the dependent processing instruction group generation unit 201 generates the dependent processing instruction group 330 based on the assumed value held by the assumed value information holding unit 295 and the second processing instruction group 150 held by the input processing instruction group holding unit 210. (Step S116).
  • the dependent processing instruction group generation unit 201 stores the generated dependent processing instruction group 330 in the dependent processing instruction group holding unit 202 (step S118).
  • the branch processing instruction group generation unit 203 generates a branch processing instruction group 320 for calling the first processing instruction group 140 held by the input processing instruction group holding unit 210 (step S120).
  • the branch processing instruction group generation unit 203 stores the generated branch processing instruction group 320 in the branch processing instruction group holding unit 204 (step S122).
  • the output processing instruction group generation unit 205 includes the referenced variable value substitution processing instruction group 310 held by the referenced variable value substitution processing instruction group holding unit 250, and the branch held by the branch processing instruction group holding unit 204.
  • An output processing instruction group 160 including the processing instruction group 320 and the dependent processing instruction group 330 held by the dependent processing instruction group holding unit 202 is generated (step S124).
  • the output processing instruction group generation unit 205 stores the generated output processing instruction group 160 in the output processing instruction group holding unit 206 (step S 126).
  • the tampering prevention processing generation device 110 can generate an output processing instruction group 160 having the effect described in (1.5) from the first processing instruction group 140 and the second processing instruction group 150 given as inputs.
  • FIG. 8 is an explanatory diagram for explaining the effect of the tampering prevention process generation device 110.
  • the tampering prevention processing generation device 110 acquires an input program (original program) 101 including the first processing instruction group 140 and the second processing instruction group 150, and tampers with the input program 101. Convert to program 102 and output. At this time, the tampering prevention processing generation device 110 converts the second processing instruction group 150 of the input program 101 into the output processing instruction group 160 as described above.
  • the tampering prevention processing creation device 110 adds the call processing of the first processing instruction group 140 which is the code to be protected to the second processing instruction group 150, and decompresses the second processing instruction group 150.
  • the tampering prevention process is generated by making the process dependent on the process result of the first process instruction group 140 which is the code to be protected (depending process).
  • the reference variable value substitution processing instruction group 310 In the call processing of the protection target code (first processing instruction group 140), in the reference variable value substitution processing instruction group 310, the value “0x00 22” is substituted for the reference variable “encryptedData” of the protection target code. In state, protected code is called.
  • the code to be protected is falsified, the value of “plainData” is different from the assumed value “0xF0D Dj”. Therefore, when the output processing instruction group 160 of the falsification prevention program 102 is executed, the second processing instruction A process different from the decompression process of the group 150 is performed, that is, the process of the input program 101 included in the tampering prevention program 102 is not properly performed.
  • the fraudulent analyst executes the program multiple times and collects logs at each time to make a judgment Z termination process, that is, judgment based on the difference between the logs at each time. It is easy to find tamper-proof processing with Z-finish processing.
  • the second processing instruction group 150 can be obfuscated.
  • the tampering prevention process generating device 110 adds the process of calling the protection target code to the second processing instruction group 150 and generates the dependent process, thereby generating the protection target code.
  • An output processing instruction group 160 (falsification prevention program 102) can be generated which reliably prevents falsification.
  • the tamper-proof process generation device 110 according to the present embodiment can not read the code in the memory as data during execution! /, For a program described in a language such as Java (registered trademark) However, it is possible to prevent tampering with the protected code of the program.
  • variable which is the argument of the first processing instruction group 140 is used as it is as the variable for substituting the value in the reference variable value substitution processing instruction group 310 as it is, but it is not limited thereto.
  • the referenced variable value substitution processing instruction group generation unit 240 specifies the variable name used in the second processing instruction group 150, and the variable stored in the referenced variable information holding unit 230.
  • a group of instructions for performing processing of substituting a random value into a variable of a variable name, which is used in the second processing instruction group 150 may also be referred to as a referenced variable value substitution processing instruction group 310. If such a configuration is used, even if the variable name storing the return value in the first processing instruction group is used for other purposes in the second processing instruction group 150, the second processing instruction group 150 is obfuscated. It can be performed.
  • the first processing instruction group 140 and the second processing instruction group 150 are essentially instructions that do not need to exchange information, the processing result of the first processing instruction group 140 Even if variables for storing were directly used for obfuscation, it was not possible that the processing results would be correctly rewritten. However, if the second processing instruction group 150 originally includes an instruction for calling the first processing instruction group 140 and the instruction group uses the processing result, the obfuscation described above is simply performed. Since the processing result is rewritten by the variable value substitution processing instruction group 310, the normal operation can not be guaranteed.
  • variables not included in the second processing instruction group 150 variables used for obfuscation and the first processing instruction originally included in the second processing instruction group 150.
  • variable storing the processing result of the group 140 is a different variable, obfuscation can be performed without affecting the processing result. That is, even in the case where the second processing instruction group 150 includes processing for calling the first processing instruction group 140, the same obfuscation as described above can be performed.
  • the configuration of the tampering prevention process generation device 110 may be a configuration in which the value to be substituted or the assumed value is designated by the user.
  • the above-described processing is processing in which the return value of the first processing instruction group 140 is always assumed to be an assumed value.
  • the reproducible number of times output by the first processing instruction group 140 after falsification is “0xF0DD”.
  • “0xF0DD” is a negative value because the most significant bit in binary notation is 1. That is, since the number of reproducible times output by the first processing instruction group 140 is always a negative value, reproduction can not be performed even if the above falsification succeeds. Therefore, even if falsification is successful, even if it fails, reproduction can not be performed, and thus an unauthorized analyst can not judge whether falsification is successful or not. Also, even if the fraud analyst recognizes that the tampering has succeeded, the profit from the successful tampering is weak because the number of times of reproduction is always a negative value.
  • the estimated value calculated by the estimated value calculation unit 290 is “0x00FE”. Therefore, when the first processing instruction group 140 is falsified to the processing “int decrypt (int encryptedData) ⁇ return OxOOFE; ⁇ ”, the output processing instruction group 160 operates normally.
  • the number of reproducible times OxOOFE outputted by the first processing instruction group 140 after falsification is always a positive value because the most significant bit is 0. In this case, this is a desirable tampering for fraud analysts, as replay is always possible.
  • the tampering process generation device 110 may be configured such that the value to be substituted or the expected value is designated by the user.
  • the value of the referenced variable is randomly determined, and the assumed value corresponding to the value is calculated by the assumed value calculating unit 290.
  • the configuration may be such that an assumed value is given.
  • it may be configured to use information such as referenced variable information, referenced variable value, assumed value, and the like included in test data in a test performed after developing the first processing instruction group 140.
  • the tampering prevention process generation device 110 may not include the referenced variable analysis unit 220, the substituted variable analysis unit 270, and the assumed value calculation unit 290.
  • Such a configuration may be used in combination with another method of obfuscating each of a plurality of different programs using the same first processing instruction group 140, or in combination with other methods of adjusting the obfuscation strength. This is effective, for example, when obfuscation is attempted many times until an output processing instruction group 160 having appropriate execution speed and strength is obtained.
  • the tampering prevention processing generation device 110 does not include the referenced variable analysis unit 220 and the referenced variable information holding unit 230. , Also as a configuration! / ,.
  • the tampering prevention processing generation device 110 targets the C language, the reference variable value substitution processing instruction group holding unit 250 that holds the intermediate program, the branch processing instruction group holding unit 204, and the dependent processing.
  • An instruction group holding unit 202 and an output processing instruction group generation unit 205 are provided, and a C language program (output processing instruction group 160) having variable declarations and function declarations and the like is output from the intermediate program.
  • the tamper-resistant processing generation device 110 does not have these elements, and holds the output processing instruction group.
  • An intermediate program may be sequentially added to the unit 206 and the output processing instruction group 160 may be output.
  • a tampering prevention processing generation device 110a which is a modification of the tampering prevention processing generation device 110 will be described with reference to FIG. 9 and FIG.
  • the suffixes of the signs of the constituent elements (apparatus, unit, processing instruction group, etc.) of the first embodiment with “a” attached thereto are modifications of the constituent elements.
  • the tampering prevention process generation device 110a is a modification of the tampering prevention process generation device 110, which is a component of the first embodiment.
  • the constituent elements indicated by using the same names and numerals as those of the constituent elements in the first embodiment are the same as the constituent elements described in the first embodiment. .
  • the tampering prevention processing generation device 110 a is a device used in the processing system 100 in the same manner as the tampering prevention processing generation device 110.
  • the tampering prevention process generation device 110a receives the first process instruction group 140 and the second process instruction group 150, and outputs an output process instruction group 160a.
  • the output processing instruction group 160a and the tampering prevention processing generation device 110a will be described below.
  • FIG. 9 is a diagram showing a specific example of the output processing instruction group 160a generated by the tampering prevention processing generation device 110a.
  • the output processing instruction group 160a sets a referenced variable value substitution processing instruction group 310a for setting values to various parameters necessary for executing the first processing instruction group 140, and the first processing instruction group 14 0 And a dependent processing instruction group 330a to be executed after the first processing instruction group 140 is called. Each part will be described below using this specific example.
  • the referenced variable value substitution processing instruction group 310a is processing for setting values in various parameters necessary for calling and executing the first processing instruction group 140.
  • the value stored in the referenced variable “encryptedData” is always fixed as one value “0xF022”, but the referenced variable value substitution processing instruction group At 310 a, the stored value is not one fixed value.
  • the value stored in the referenced variable “encryptedData” is the value of “commpressedData”.
  • the value taken by the reference variable is expressed as ⁇ encryptedData
  • encryptedData 0x0 000, 0x0100,... ⁇ OxlFOO ⁇ using an expression of a set.
  • the branch processing instruction group 320 a is a processing instruction group which branches to the first processing instruction group 140.
  • Embodiment 1 when the output processing instruction group 160 is executed by the execution processing device 130, the value taken by the assigned variable “plainData” after the first processing instruction group 140 is called is always 1 Fixed values. The reason is that the variable that affects the processing result of the first processing instruction group 140 is the referenced variable, and in the first embodiment, it is a force that is always substituted for the referenced variable.
  • the portion to be focused on is the processing instruction group of "(compressedData ⁇ 8)" plainData'Ox 00 FE ".
  • the value stored in the substituted variable becomes a value that changes depending on the variable “compressed ed Dataj, which makes it difficult to analyze the unauthorized analyst. This will be described in detail below. .
  • the branch processing instruction group is executed.
  • the fraudulent analyst performs the analysis according to such a procedure, the fraudulent analyst can efficiently analyze the output processing instruction group 160 without analyzing the contents of the first processing instruction group 140.
  • the value of the assigned variable changes according to the value of "compressedData”. Therefore, such analysis can not be performed.
  • FIG. 10 is a diagram showing the configuration of the tampering prevention process generation device 110a.
  • the tampering prevention processing generation device 110a is the referenced variable substitution processing instruction group generation unit 240, the referenced variable value holding unit 260, the assumed value calculation unit 290, and the assumed value of the tampered processing execution processing unit 110 of FIG.
  • the information storage unit 295 and the dependent processing instruction group generation unit 201 are respectively a referenced variable substitution processing instruction group generation unit 240a, a referenced variable value holding unit 260a, an assumed value calculation unit 290a, an expected value information holding unit 295a, And the dependent processing instruction group generation unit 201a.
  • the referenced variable value substitution processing instruction group generation unit 240 a generates a referenced variable value substitution processing instruction group 310 a which is a processing instruction group for setting a value to a parameter necessary when executing the first processing instruction group 140. Writes the generated processing instruction group in the referenced variable value substitution processing instruction group holding unit 250. Also, the value to be set to the parameter is written to the referenced variable value holding unit 260a.
  • the referenced variable value substitution processing instruction group generation unit 240a acquires the variable name held by the referenced variable information holding unit 230, and for each acquired variable, the following A) Perform the processing of ⁇ D).
  • Reference Variable Value Substitution Processing Instruction Group Generation Unit 240a determines a reference variable value substitution processing instruction group 310a.
  • the referenced variable value substitution processing instruction group 310a may be randomly generated using the dependent variables of the second processing instruction group 150, or may be generated based on the template of the instruction group determined beforehand. Or the like may be applied.
  • Referenced Variable Value Substitution Processing Instruction Group Generation Unit 240 a writes the determined Reference Variable Value Substitution Processing Instruction Group 310 a in the Reference Variable Value Substitution Processing Instruction Group Holding Unit 250.
  • Referenced Variable Value Substitution Processing Instruction Group Generation Unit 240a is a reference variable value substitution processing instruction group A set of possible values of the referenced variable is obtained according to 310a.
  • the referenced variable value substitution processing instruction group generation unit 240a writes the obtained set to the referenced variable value holding unit 260a.
  • Referenced variable value substitution processing instruction group generation unit 240a is a reference variable value substitution processing instruction group
  • Referenced Variable Value Substitution Processing Instruction Group Generation Unit 240a is a reference variable value substitution processing instruction group
  • the referenced variable value substitution processing instruction group generation unit 240a writes the obtained set to the referenced variable value holding unit 260a.
  • the referenced variable value holding unit 260 a has an area for storing values to be set to parameters necessary for executing the first processing instruction group 140.
  • the referenced variable value holding unit 260a includes an area for storing a variable name and information of a set of values that can be taken by the variable name variable.
  • the referenced variable value holding unit 260a is a set ⁇ encryptedData
  • encryptedData compressedData w 8
  • compressedData 0x00, 0x01, ... hold ⁇ OxlF ⁇ .
  • the variable name is "encryp tedData""C
  • the content to be stored is Tool It may be a physical enumeration of values or a representation of a set.
  • the assumed value calculation unit 290a calculates the value of the assumed value to be substituted into the substituted variable when the first processing instruction group 140 is executed using the value of the referenced variable held by the referenced variable value holding unit 260a. Do. Here, since the value of the referenced variable is any value included in the set of values which is not one, the assumed value calculation unit 290a obtains the assumed values as a set.
  • the assumed value calculation unit 290a performs, for example, the following processing A) to C).
  • the expected value calculation unit 290 a reads the substituted variable information from the substituted variable information holding unit 280.
  • the expected value calculation unit 290a reads the referenced variable name and the set of values from the referenced variable value holding unit 260a, and sets the elements of the set of values, and the following (a) and (j8) Repeat the process in).
  • the assumed value calculation unit 290a substitutes the read value into the referenced variable, and executes the first processing instruction group 140 held by the input processing instruction group holding unit 210.
  • the expected value calculation unit 290a refers to the value of the assigned variable after the execution of the first processing instruction group 140.
  • the assumed value calculation unit 290a stores the set of values referred to in B) and the variable name of the assigned variable read in A) in the expected value information holding unit 295.
  • the assumed value calculation unit 290a performs the following processing.
  • the expected value calculation unit 290a reads the set ⁇ encryptedData
  • encryptedData compressed dData ⁇ 8
  • compressedData OxOO, 0x01,... ⁇ OxlF ⁇ .
  • the expected value calculation unit 290a repeats the following processing (H) and (B) in each of the cases where "compressedData” is "0x00, 0x01, ..., 0xlF".
  • the expected value calculation unit 290a calculates the value of “encryptedD ataj” when “compressedData” is each value, and further “encrypted” which is the result of processing by the first processing instruction group 140
  • Calculate Data '0x00FF'. (J8) Assumed Value Calculation Unit 290a refers to the calculated value.
  • the value of the assigned variable “plainData” is “0x0 OFF, 0x0 IFF,... ⁇ 0xlFFF” in each of the cases where compressedData is “0x00, 0x01, ⁇ , 0xlF”.
  • the expected value calculation unit 290 a stores ⁇ plainData
  • plainData 0x00FF, 0x0 IFF,..., 0 xlFFF ⁇ in the expected value information storage unit 295.
  • the above-described processing is processing in the case where a set of "plainData” values is represented by enumeration.
  • the expected value calculation unit 290 a uses the process “encrypedData 0x00FF” of the first process instruction group 140 instead of repeating the processes of and) (j8) ipiamData
  • the assumed value information holding unit 295a includes an area for storing assumed value information.
  • the assumed value information holding unit 295a holds the set of assumed values calculated by the assumed value calculation unit 290a and the variable name as the above-described assumed value information.
  • the ⁇ expected data calculation unit 290a ⁇ ⁇ plainData
  • plainData 0x00FF, 0x0 IFF , ⁇ ⁇ ⁇ ⁇
  • plainData 0x00FF, 0x0 IFF , ⁇ ⁇ ⁇ ⁇
  • plainData 0x00FF, 0x0 IFF , ... ⁇ OxlFFF ⁇ .
  • the expected values may be held in a form indicating a set that is not holding the assumed values in the form of listing the values as described above.
  • the expected value information storage unit 295a stores ⁇ plainData
  • the dependent processing instruction group generation unit 201a generates a dependent processing instruction group 330a based on the assumed value held by the assumed value information holding unit 295a and the second processing instruction group 150 held by the input processing instruction group holding unit 210.
  • the dependent processing instruction group 330a is a processing instruction group that performs processing equivalent to that of the second processing instruction group 150.
  • the processing instruction group is a processing instruction group that includes processing that refers to the processing result of the first processing instruction group 140, and a part of the processing becomes processing using the values that are referred to.
  • the dependent processing instruction group 330a performs the processing of the following A) to F).
  • the dependent processing instruction group generation unit 201a finds a constant included in the processing instruction included in the second processing instruction group 150.
  • the processing instruction containing this constant is Or 1 and the value of the constant is Val.
  • the dependent processing instruction group generation unit 201a reads the assumed value information held by the expected value information holding unit 295a.
  • the dependent processing instruction group generation unit 201a generates a processing instruction Or2 in which the value Val included in the processing instruction Or1 is replaced with “processing Va3 of mapping F”.
  • the dependent processing instruction group generation unit 201a generates a dependent processing instruction group 330 which is an instruction group obtained by replacing the processing instruction Or 1 of the second processing instruction group 150 with the processing instruction Or2.
  • the dependent processing instruction group generation unit 201a performs the following operations A) to F: Do the processing of).
  • the dependent processing instruction group generation unit 201 receives assumed value information from the assumed value information holding unit 295 ⁇ plain
  • the dependent processing instruction group generation unit 201a sets all elements of the set of assumed values to one value Va2.
  • the dependent processing instruction group generation unit 201a generates the value Val “0x0001” included in the processing instruction Orl.
  • the dependent processing instruction group generation unit 201 generates a dependent processing instruction group 330a, which is an instruction group in which the processing instruction Orl of the second processing instruction group 150 is replaced with the processing instruction Or2.
  • function declarations and variable declarations are added according to the language form of the C language.
  • mapping F in which all the elements of the set of assumed values are made to correspond to one value is shown, but other mappings may be used.
  • a configuration may be adopted in which several maps F can be registered in advance and one of them can be selected.
  • the mapping F may be designated by the user. Also in this case, as in the first embodiment, it is useful when obfuscation is performed many times using the same mapping.
  • mapping F for example, “(compressedData ⁇ 8) ′ plainData 'OxOOFEj force S in the dependent processing instruction group 330a of FIG. is there. As described above, the correct value "0x0001" can be obtained even with such a mapping.
  • the tampering prevention processing generation device 110 may receive inputs of a plurality of processing instruction groups, and select the first processing instruction group 140 and the second processing instruction group 150 from among them. For example, the tampering prevention processing generation device 110 acquires a processing instruction group Al, a processing instruction group A2,..., A processing instruction group An, and randomly selects a first processing instruction group 140 and a second processing instruction group 150 from among them. You may select a set of and perform obfuscation. Furthermore, the target of processing is not limited to one set. It is acceptable to repeat selection and obfuscation!
  • the tampering prevention processing generation device 110 randomly selects the second processing instruction group 150 from the processing instruction group other than the processing instruction group A1 with the first processing instruction group 140 as the processing instruction group A1.
  • the following process instruction groups A 2,..., An are also regarded as the first process instruction group 140, and the process instruction groups other than the process instruction group regarded as the first process instruction group 140.
  • the second processing instruction group 150 may be selected and obfuscated.
  • the processing instruction groups Al to An are intertwined in a complex manner, which can make tampering even more difficult.
  • the program includes the same configuration as the tampering prevention process creation device 110 as a part, and the program is executed after conversion by the tampering process creation device 110 at the time of program execution. It is also conceivable to implement an execution processor. In this case, if the execution processing apparatus has the same configuration as that of this modification, it becomes difficult to specify which processing instruction group is the first processing instruction group and the second processing instruction group. It can make analysis more difficult.
  • targets for which falsification should be prevented may be data that is not limited to instructions.
  • processing for branching to the instruction group is added, but when the protection target is data, processing for reading the data into a predetermined variable or the like Add
  • the first processing instruction If the data to be used by the group 140 is to be protected, processing to read the data to be protected is added instead of the branch processing instruction group 320, and the dependent processing instruction group 330 depends on the variable and If the stored value is an assumed value (here, data without falsification), it may be considered that the system operates properly.
  • protection target data can be protected in the same manner as the protection for the first processing instruction group 140 in the first embodiment.
  • the data to be protected is, for example, a device unique number such as a telephone number in a mobile phone.
  • a processing system 100b according to a second embodiment of the present invention will be described.
  • FIG. 11 is a diagram showing the configuration of a processing system 100b according to the second embodiment.
  • Processing system 100b is a system that receives input of first process instruction group 140b and generates output process instruction group 160b for the purpose of checking falsification of first process instruction group 140b. There is provided an anti-tamper processing generator 110b (instruction generator) and an execution processor 130b.
  • the tampering prevention process creation device 110b is a device that creates a program that can reliably protect the code to be protected. That is, the tampering prevention processing generation device 110b acquires a first processing instruction group 140b which is a protection target code, and generates an output processing instruction group 160b which performs tampering check processing of the protection target code. In addition, the tampering prevention processing generation device 110b writes the generated output processing instruction group 160b and the first processing instruction group 140b in the recording medium 120b.
  • the execution processing device 130b reads out and executes the first processing instruction group 140b and the output processing instruction group 160b recorded on the recording medium 120b.
  • the tampering prevention process generation device 110b executes an execution processing device via a communication medium that does not write the first process instruction group 140b and the output process instruction group 160b to the recording medium 120b. It may be sent to Ob.
  • the output processing instruction group 160b is configured to call the first processing instruction group 140b in the middle of the processing. That is, when the output processing instruction group 160b is executed by the execution processing unit 130b, the instruction group included in the output processing instruction group 160b is executed first, and the first processing instruction group 140b is called and executed along the way. Then, the next processing instruction group of the output processing instruction group 160b is executed again.
  • the first processing instruction group 140b is a processing instruction group to be executed by the execution processing device 130b, and may be executed in the middle of the processing of the output processing instruction group 160b. There is a case.
  • the first processing instruction group 140b is a process of taking the encrypted playable number of times of the content as input, decrypting it, and outputting the plaintext playable number of times.
  • the output processing instruction group 160b checks whether the first processing instruction group 140b is not falsified, and returns 0 if it is not falsified, and stops the processing being executed in the execution processing unit 130b if it is falsified. It is a processing instruction group.
  • FIG. 12 is a diagram showing the configuration of the output processing instruction group 160b.
  • the output processing instruction group 160b calls the first processing instruction group 140b and the referenced variable value substitution processing instruction group 310b for setting values to various parameters necessary for executing the first processing instruction group 140b. It comprises a branch processing instruction group 320b and a dependent processing instruction group 330b to be executed after the first processing instruction group 140b is called.
  • the processing instructions are in the order of the referenced variable value substitution processing instruction group 310b, the branch processing instruction group 320b, the first processing instruction group 140b, and the dependent processing instruction group 330b. Processing of the group is performed.
  • Branch processing instruction group 320b This is similar to branch processing instruction group 320 in the first embodiment.
  • the dependent processing instruction group 330b is a processing instruction group that is executed after calling the first processing instruction group 140b, and performs processing for checking for tampering based on the processing result of the first processing instruction group 140b.
  • the processing result of the first processing instruction group 140b is, for example, the return value of the function when the first processing instruction group 14 Ob is a function. Also, for example, if the first processing instruction group 140b is an instruction group that determines a value to an external variable, the processing result of the first processing instruction group 140b is a value substituted for the external variable. Also, for example, if the first processing instruction group 140b is an instruction group that stores values in stack, the processing result of the first processing instruction group 140b is a value stored in the stack. Also, for example, if the first processing instruction group 140b is an instruction group that stores a value at the position designated by the address variable, the processing result of the first processing instruction group 140b is the stored value.
  • the storage destination where the processing result of the first processing instruction group 140b is stored is referred to as a substituted variable, as in the first embodiment.
  • variable value substitution processing instructions Only when the value is set in the group 310b, the value of the processing result can be known in advance. Specifically, for example, if the first processing instruction group 140b is executed after actually setting the value set by the referenced variable value substitution processing instruction group 310b as the referenced variable, the value of the processing result is known. Can. In the following description, as in the first embodiment, this value is referred to as an assumed value.
  • FIG. 13 is a diagram showing a specific example of the output processing instruction group 160b described in C language.
  • the output processing instruction group 160b is an output processing instruction group when the processing instruction group equivalent to the first processing instruction group 140 in FIG. 5A is the first processing instruction group 140b, and the output processing instruction group 160b is the same as the first processing instruction group 140b. It is a processing instruction group that performs a revision check.
  • the reference variable value substitution processing instructions 310b r e ncryptedData 0xF022; "is an instruction group showing a process of assigning a value to an argument for calling a first processing instructions 140b. sand In other words, the referenced variable value substitution processing instruction group 310b substitutes the value "0xF022" for the variable "encryptedData”.
  • the dependent processing instruction group 330b determines whether the processing result of the first processing instruction group 140b is equal to the expected value, and returns 0 if it is equal, and if it is not equal, it is being executed by the execution processing unit 130b.
  • the process result of the first process instruction group 140b becomes a value different from the expected value.
  • the output processing instruction group 160b includes a referenced variable value substitution processing instruction group 310b for setting values for various parameters necessary for executing the first processing instruction group 140b, and a first processing instruction group 140b. And a dependent processing instruction group 330b to be executed after the first processing instruction group 140b is called.
  • the processing instruction of the first processing instruction group 140b is falsified, and if the processing result of the first processing instruction group 140b is equal to the expected value, it is determined The falsification of the first processing instruction group 140b can be detected.
  • FIG. 14 is a diagram showing the configuration of the tampering prevention process generation device 110b.
  • the tampering prevention processing generation device 110b is a device that generates an output processing instruction group 160b for performing a tampering check on the first processing instruction group 140b.
  • the falsification prevention processing generation device 110b includes an input processing instruction group holding unit 210b, a referenced variable analysis unit 220b, a referenced variable information holding unit 230b, a referenced variable value substitution processing instruction group generating unit 24 0b, a referenced variable Value substitution processing instruction group holding unit 250b, referenced variable value holding unit 260b, substituted variable analysis unit 270b, substituted variable information holding unit 280b, expected value information holding unit 295b, expected value calculation unit 290b, dependent processing instruction group generation A section 201b, a dependent processing instruction group holding section 202b, a branch processing instruction group generating section 203b, a branch processing instruction group holding section 204b, an output processing instruction group generating section 205b, and an output processing instruction group holding section 206b.
  • the input processing instruction group holding unit 210b acquires and holds the first processing instruction group 140b.
  • the referenced variable analysis unit 220b analyzes what kind of variable (referenced variable) such as an argument that needs to have a value set when executing the first processing instruction group 140b.
  • the referenced variable information holding unit 230b holds information such as the variable name of the referenced variable obtained by the analysis by the referenced variable analysis unit 220b.
  • the referenced variable value substitution processing instruction group generation unit 240 b generates a referenced variable value substitution processing instruction group 31 Ob that substitutes a value into a referenced variable.
  • the referenced variable value substitution processing instruction group holding unit 250b holds the referenced variable value substitution processing instruction group 310b generated by the referenced variable value substitution processing instruction group generation unit 240b.
  • the referenced variable value holding unit 260b holds a value that the referenced variable value substitution processing instruction group 310b substitutes for the referenced variable.
  • the assigned variable analysis unit 270 b is a variable into which the processing result of the first processing instruction group 140 b is substituted.
  • the assigned variable information holding unit 280b holds information such as the variable name of the assigned variable obtained by analysis by the assigned variable analysis unit 270b.
  • the assumed value calculation unit 290b uses the value of the referenced variable as the value held by the referenced variable value holding unit 260b, and calculates the assumed value of the substituted variable obtained when the first processing instruction group 140b is executed. Do.
  • the assumed value information holding unit 295b holds the assumed value calculated by the assumed value calculation unit 290b.
  • the dependent processing instruction group generation unit 201b generates a dependent processing instruction group 330b based on the assumed value.
  • the dependent processing instruction group holding unit 202b holds the dependent processing instruction group 330b generated by the dependent processing instruction group generation unit 201b.
  • the branch processing instruction group generation unit 203b generates a branch processing instruction group 320b for calling the first processing instruction group 140b held by the input processing instruction group holding unit 210b.
  • the branch processing instruction group holding unit 204b holds the branch processing instruction group 320b generated by the branch processing instruction group generation unit 203b.
  • the output processing instruction group generation unit 205b holds the referenced variable value substitution processing instruction group 310b held by the referenced variable value substitution processing instruction group holding unit 250b and the branch processing instruction held by the branch processing instruction group holding unit 204b.
  • the output processing instruction group holding unit 206b holds the output processing instruction group 160b generated by the output processing instruction group generation unit 205b.
  • the input processing instruction group holding unit 210b different from the first embodiment and the dependent processing instruction group generation unit 201b will be described below.
  • the other units perform the same processing as the corresponding units described in the first embodiment, and thus the description will be omitted.
  • the input processing instruction group holding unit 210b receives an input of the first processing instruction group 140b from the outside. That is, the input processing instruction group holding unit 210b acquires the first processing instruction group 140b. Further, the input processing instruction group holding unit 210b has an area for storing one or more processing instruction groups. The input processing instruction group holding unit 210b is input to the tampering prevention processing generation device 110b. The first processing instruction group 140b is held.
  • the dependent processing instruction group generation unit 201 b generates a dependent processing instruction group 330 b based on the assumed value held by the assumed value information holding unit 295 b.
  • the dependent processing instruction group generation unit 201b performs the following processing A) to D).
  • the dependent processing instruction group generation unit 201b reads assumed value information held by the expected value information holding unit 295b.
  • the dependent processing instruction group generation unit 201b sets a variable (assigned variable) to hold the assumed value as Vrl, and sets the assumed value as Val.
  • the dependent processing instruction group generation unit 201b compares the variable Vrl with the assumed value Val, and returns 0 if they are equal, and a processing instruction to stop the processing being executed in the execution processing unit 130b if equal. Generate a group.
  • the verification result is positive, and in the case where it is confirmed that there is no falsification in this case, the force of returning 0 is not limited to this. It may return a value other than 0, or it may return no value. That is, if it is confirmed that there is no falsification, any value may be returned as long as the processing in progress continues.
  • the dependent processing instruction group generation unit 201b stores the generated dependent processing instruction group 330b in the dependent processing instruction group holding unit 202b.
  • the dependent processing instruction group generation unit 201b performs the following A) to Perform process D).
  • the dependent processing instruction group generation unit 20 lb sets a variable “plainData” to hold the assumed value to Vrl, and sets the assumed value “0xF0DD” to Val.
  • the tampering prevention processing generation device 110b can generate a tampering check processing instruction group (output processing instruction group 160b) capable of checking tampering of a program without reading a program as data.
  • a tampering check processing instruction group output processing instruction group 160b
  • FIG. 15 is an explanatory diagram for explaining the effect of the tampering prevention process generation device 110b.
  • the tampering prevention process generation device 110 acquires the input program 101b including the first processing instruction group 140b, converts the input program 101b into the tampering prevention program 102b, and outputs the program. At this time, as described above, the tampering prevention processing generation device 110 generates the output processing instruction group 160b and adds it to the input program 101b.
  • the tampering prevention process generation device 110 executes the call process of the first process instruction group 14 Ob that is the code to be protected (the referenced variable value substitution process instruction group 310b and the branch process instruction group 320b) and the call process. Judgment processing for stopping the processing being executed by the execution processing unit 130b when the processing result of the first processing instruction group 140b performed is different from the expected value Z termination processing (dependent processing instruction group 330b) Is generated and added to the input program 101b.
  • the tampering prevention process generating device 110b generates the calling process and the determination Z end process of the protection target code to the input program 101b and performs the following process to generate the protection target. It is possible to prevent tampering with the code.
  • the tampering prevention processing generation device 11 Ob in the present embodiment can not read the code stored in the memory as data during the execution, and for a program described in a language such as Java (registered trademark) or the like. However, it is possible to reliably prevent tampering with the protected code of the program.
  • a processing system 1300 according to the third embodiment of the present invention will be described.
  • a processing system 1300 according to the third embodiment includes a first processing instruction group (corresponding to an A instruction group described later) and a second processing instruction group (a B instruction group described later and SUC-B described later) included in one input program. Use the command group) to perform the obfuscation of the input program.
  • the processing result of the first processing instruction group is obfuscated so as to be used also in the second processing instruction group.
  • the A instruction group The processing result of instruction group is not used in the SUC- B instruction group (second processing instruction group). That is, in the third embodiment, the processing of the second processing instruction group is branched to the first processing instruction group which is essentially unnecessary processing, and then the second processing instruction group is continued to make the control structure complicated.
  • the second processing instruction group is continued to make the control structure complicated.
  • the obfuscation (complication of control structure) of the input program makes it possible to ensure that the A instructions (the first processing instructions), which is the code to be protected, are tampered with. It can be protected.
  • Non-Patent Document 1 (Chenxi Wang, A security Architecture for Survivability Mechanisms, "Ph. D. Dissertation (2000)) Simple like technology
  • a method of replacing an unconditional branch instruction with a conditional branch instruction whose branch destination is difficult to divide and a method of dividing the program into a plurality of instruction groups and changing the arrangement order of the instruction groups. It is useful to be able to prevent fraud at the time of analysis, as the results of fraudulent analysis can be a clue in the subsequent fraudulent falsification.
  • the control structure is obfuscated as in the case where the execution order of the instruction group is a component even when the program is actually powered.
  • FIG. 16 is a diagram showing a configuration of a processing system 1300 according to the third embodiment.
  • the processing system 1300 includes a tampering prevention process generating device (instruction generating device) 1320 and an execution processing device 1340.
  • the tampering prevention processing creation device 1320 is a device that creates a program that can reliably protect the protection target code, obtains the input program 1310 including the protection target code, and obfuscates the input program 1310. As a result, a tampering prevention program 1330 is generated.
  • the tampering prevention process creation device 1320 writes the generated tampering prevention program 1330 in the recording medium 1350.
  • the execution processing device 1340 is a tampering prevention program 133 recorded in the recording medium 1350.
  • the tampering prevention process creation device 1320 is configured to use the tampering prevention program 1330 as a recording medium 135.
  • It may be sent to the execution processor 1340 via a communication medium that does not write to zero.
  • the input program 1310 is a PR consisting of one or more instructions.
  • E A instruction group, A—instruction group executed after PRE—A instruction group, and B instruction group are included.
  • FIG. 17 is a diagram showing the configuration of the input program 1310.
  • the input program 1310 includes an A instruction group 1420, an instruction group that is a branch source of the A instruction group 1420, a PRE-A instruction group 1410, and an A instruction group that is a branch destination instruction group SUC-A.
  • SUC B instruction which is the instruction group of the branch destination of instruction group 1430, B instruction group 1440, and B instruction group 1440 Including the command group 1450!
  • each instruction group is a set of instructions that have an instruction power of 0 or more. That is, some instruction groups may not exist. For example, if the A instruction group 1420 is the beginning of a program, the PRE-A instruction group 1410 may not exist. If the A instruction group 1420 or the B instruction group 1440 is the end of the program, the SUC-A instruction group 1430 or the SUC-B instruction group 1450 may not exist.
  • the Y instruction group is the branch destination of the X instruction group means that the Y instruction group is executed after the X instruction group.
  • the Y instruction group is disposed immediately after the X instruction group, or a case where the X instruction group includes a branch instruction to the Y instruction group.
  • the case where the Y instruction group is executed after the X instruction group is also referred to as a branch in this embodiment from the viewpoint of program notation.
  • instructions in a program are executed in order of upper priority, especially when there is no branch instruction.
  • the Y instruction group is executed after the X instruction group, so the Y instruction group is the branch destination of the X instruction group. Also, that the X instruction group is the branch source of the Y instruction group means that the Y instruction group is the branch destination of the X instruction group.
  • the branch instruction includes a conditional branch instruction, an unconditional branch instruction, a subroutine call, an instruction to generate an exception, and an instruction to generate an interrupt. That is, an instruction that transfers execution to another instruction group is equivalent to the branch instruction described in this specification.
  • an assembly language instruction it is a function call such as "CALL, RET", a jump instruction such as "JA, JMP, LOOP", or an interrupt instruction such as "INT”.
  • FIG. 18 is a diagram showing a specific example of the input program 1310 in C language.
  • the input program 1310 includes a PRE-A command group 1410, an A command group 1420, a SUC-A command group 1430, a B command group 1440, and a 311 th -8 command group 1450.
  • the tampering prevention program 1330 has an input program 1310 that is a tampering prevention processing creation device 132.
  • FIG. 19 shows the configuration of the tampering prevention program 1330.
  • the tampering prevention program 1330 includes a PRE-A instruction group 1410, an STR-A variable value substitution instruction group 1620, an A instruction group 1420, a! ⁇ -Eight conditional branch instruction group 1610, and a SUC.
  • the instruction group 145 0 is included.
  • the A instruction group 1420 was executed only after the PRE-A instruction group 1410 was executed.
  • the force tampering prevention program 1330 is also A after the B instruction group 1440.
  • the instruction set 1420 has been converted to be executed. More specifically, in the tampering prevention program 1330, processing of each instruction group may be executed in the order of PRE-A instruction group 1410, A instruction group 1420, and SUC-A instruction group 1430. Processing of each instruction group may be executed in the order of 1440, A instruction group 1420, SUC-B instruction group 1450. That is, execution of the A instruction group 1420 may be interrupted between the B instruction group 1440 and the SUC-B instruction group 1450.
  • FIG. 20 is a diagram showing a specific example of the tampering prevention program 1330 expressed in C language.
  • the tampering prevention program 1330 includes the following elements in addition to the elements included in the input program 1310. These elements can be added to the input program 1310 by the falsification prevention process generation device 1320. The details of this attachment process will be described later.
  • the BR—B branch instruction group 1660 is a branch instruction for executing the A instruction group 1420 after the B instruction group 1440.
  • CBR AB conditional branch instruction group 1610 is an instruction group for determining an appropriate branch destination after execution of the A instruction group 1420 and branching the process to the branch destination.
  • the instruction group executed after the A instruction group 1420 is always the SUC-A instruction group 1430.
  • the SUC-A instruction group 1430 and the SUC-B instruction group There are 1450 cases.
  • CBR The AB conditional branch instruction group 1610 determines which of the SUC-A instruction group 1430 and the SUC-B instruction group 1450 should branch to after the A instruction group 1 420 is executed, and processes it as an appropriate branch destination. Bifurcate.
  • STR—A variable group value substitution instruction group 1620, and STR—B variable group value substitution instruction group 1630 Is an instruction group for setting information (in the present embodiment, a value of a variable “var ⁇ abO” described later) used for determination of the CBR-AB conditional branch instruction group 1610.
  • the next instruction group to be executed is the SUC-A instruction group 1430 and the A instruction group 1420 is If executed after the B instruction group 144 0, the next instruction group to be executed is the SUC-B instruction group 1450.
  • the instruction group that leaves a force is the STR-A variable group value substitution instruction group 1620 and the STR-B variable group value substitution instruction group 1630.
  • the save instruction group 1640 is an instruction group for saving the already executed processing result so that the already executed processing result is not affected by the subsequent processing.
  • the return instruction group 1650 is an instruction group that restores the saved processing result.
  • a group of instructions for performing this save process is a save command group 1640.
  • the return instruction group 1650 returns the contents of the result on the way of the save instruction group 1640 when it returns to the SU C-B instruction group 1450.
  • An instruction group that performs processing for saving the intermediate result is a save instruction group 1640.
  • the save instruction group 1640 stores the values stored in the variables referenced in the instruction group executed after the S UC-B instruction group. It is a group of instructions stored in other variables.
  • the halfway result at the time when the B instruction group is executed SUC —B is taken over after the instruction group.
  • the execution of the A instruction group 1420 interrupts between the B instruction group 1440 and the SUC-B instruction group 1450 or later.
  • the instruction group 14 20 force SUC-B instruction group 1450 includes an instruction to change the same variable as that used by the instructions
  • the above-mentioned intermediate result is rewritten by the A instruction group 1420. If such a situation occurs, the execution result of the tampering prevention program 1330 will be different from the input program 1310. In order to avoid such a situation, it is necessary to save and restore the intermediate results before and after the A instruction group 1420 is executed.
  • variable “var— orgO” and the variable “var— orgl” are variables to which values are to be substituted.
  • the value of the variable is described as an example! /, But it is desirable to save the information which may be modified by the A instruction group 1420 besides the variable. Examples of such information include stacks, registers, and recorded contents of caches.
  • the return instruction group 1650 is evacuated by the save instruction group 1640 after processing of the A instruction group 1420 which has been interrupted between the B instruction group 1440 and the SUC-B instruction group 1450 due to obfuscation. Is a group of instructions to return the original value to the original variable.
  • CBR AB conditional branch instruction group 1610 consists of SUC A instruction group 1430 and SUC B instruction group 1 It is a conditional branch instruction that includes 450 as a conditional branch destination. If the tampering prevention program 1330 includes the return instruction group 1650, save and restore the contents, and then the SUC-B instruction group 1450 or later must be performed, so SUC- B. The return instruction group 1650 is taken as the conditional branch destination in place of the instruction group 1450. In FIG. 20, "SUC-B" and “SUC-B-" are attached to the SUC-B instruction group 1450 and the return instruction group 1650, respectively.
  • the CBR-AB conditional branch instruction group 1610 is a return instruction group If 1650 exists, a branch instruction group 1650 labeled "SUC-B-" is taken as a branch destination, and if not, a SUC-B instruction group 1450 tagged "SU C_BJ" is branched As the case where there is no return instruction group 1650, there may be a case where there is no result on the way to return.
  • the tampering prevention program 1330 illustrated in FIG. 20 includes a return instruction group 1650. Therefore, the conditional branch instruction group 1610 uses the SUC-A instruction group 1430 and the return instruction group 1650 as the conditional branch destination, and the branch destination is determined by the value of "variable var-abO".
  • the variable “var ⁇ abO” is a variable that is a clue indicating whether the force executed after the A instruction group 1420 force PRE ⁇ A instruction group 1410 or the B instruction group 1440 was executed, It corresponds to G-V AL-AB variable group described later.
  • the CBR-AB conditional branch instruction group 1610 executes the SUC-A instruction group 1430 after the A instruction group 1420, and if the A instruction group 1420 returns, the return instruction group 1650 (or SUC). — Control so that the B instruction group 1450) may occur.
  • the tampering prevention program 1330 is written in C language, so that the SUC-A instruction is explicitly included in the conditional branch instruction group 1610.
  • the CBR-AB conditional branch instruction group 1610 substantially indicates a branch as to which of the SUC-A instruction group 1430 and the SUC-B instruction group 1450 is to be executed. Note that an explicit branch instruction such as "else goto SUC-A;" is described immediately after CBR-AB conditional branch instruction group 1610 in Fig. 20. Even good, not to mention.
  • STR-A variable group value substitution instruction group 1620 has a value in the variable so that the conditional branch destination is determined as the SUC-A instruction group 1430. It is a group of instructions to substitute. That is, when this instruction group is executed, it is when the A instruction group 1420 is executed after the PRE-A instruction group 1410 is executed, and then the CBR-AB conditional branch instruction group 1610 is executed thereafter. Because of this, the STR-A variable group value substitution instruction group 1620 leaves information indicating that as the value of the variable. This variable is called G- VAL- AB variable group in the following.
  • the G- VAL- AB variable group may be a set of multiple variables that need to be one variable.
  • any instruction group may be used as long as it is an instruction group that can perform processing that can leave a clue to determination.
  • This G- VAL- AB variable group is used in deciding which instruction the CBR-AB conditional instruction group 1610 should branch to. In the specific example shown in FIG. 20, the G- VAL- AB variable group is the variable "var-abO".
  • the SUC A instruction group 1430 is performed (instead of the SUC B instruction group 1450). To do this, use the STR-A variable value assignment instruction group 1620.
  • STR—B variable group value substitution instruction group 1630 is G VAL AB so that the conditional branch destination is determined as the SUC B instruction group 1450 in the CBR-AB conditional branch instruction group 1610 described above. It is an instruction group that substitutes values into variables included in a variable group. That is, when this instruction group is executed, A instruction group 1420 is executed after B instruction group 1440 is executed, and then CBR-AB conditional branch instruction group 1610 is executed after that.
  • the STR-B variable value assignment instruction group 1630 leaves information indicating that as the value of the variable.
  • the STR-A variable group value substitution instruction group 1620 may be used. It is similar.
  • a STR-B variable group value substitution instruction group 1630 is used.
  • the STR-B variable group value substitution instruction group 1630 is executed after the B instruction group 1440 is executed, the A instruction group 1420 is executed, and then the SUC_B instruction group 1450 is executed. Instructions that set the value of the variable to
  • the BR-B branch instruction group 1660 in FIG. 20 is an instruction group which branches from the B instruction group 1440 to the A instruction group 1420.
  • the tampering prevention program 1330 includes a save instruction group 1640, it is necessary to save an intermediate result before branching to the A instruction group 1420. Therefore, after processing by the save instruction group 1640 is completed, the A instruction It becomes an instruction group which branches to a group 1420.
  • the tampering prevention program 1330 illustrated in FIG. 20 includes the save instruction group 1640, the branch instruction branch to branch to the A instruction group 1420 after the BR-B branch instruction group 1660 is processed by the save instruction group 1640. It is represented as the group "goto A;".
  • FIG. 21 is a diagram showing a flow of processing of the input program 1310.
  • the input program 1310 is a simple one that does not include a branch, as shown in FIG.
  • the execution processing unit 1340 first executes the PRE-A instruction group 1410 (step S200) and executes the A instruction group 1420 (step S202). Furthermore, the execution processing unit 1340 executes the SUC_A instruction group 1430 (step S204), executes the B instruction group 1440 (step S206), and executes the SUC-B instruction group 1450 (step S208).
  • FIG. 22 is a diagram showing a flow of processing of the tampering prevention program 1330.
  • the tampering prevention program 1330 includes branching and merging as shown in FIG.
  • the execution processing unit 1340 executes the tampering prevention program 1330, first, it executes the PRE-A instruction group 1410 (step S300), and then executes the STR-A variable value substitution instruction group 1620 (step S300). S302) Then, A instruction group 1420 is executed (step S304).
  • the execution processing unit 1340 substitutes “1” into the variable “var_abO” by executing the STR—A variable group value substitution instruction group 1620 in step S302.
  • the execution processing unit 1340 executes the SUC-A instruction group 1430 (step S308), and then executes the B instruction group 1440 (step S310), and further, the STR-B variable group value
  • the assignment instruction group 1630 is executed (step S312).
  • the execution processing unit 1340 substitutes 8 into the variable “var—abO”.
  • the execution processor 1340 executes the save instruction group 1640 (step S314), and After that, when the BR_B branch instruction group 1660 is executed (step S316), the A instruction group 1420 is executed again (step S304).
  • the execution processor 1340 executes the return instruction group 1650 (step S318), and then executes the SUC-B instruction group 1450 (step S320).
  • the A instruction group 1420 is executed after the STR-A variable group value substitution instruction group 1620 and after the BR-B branch instruction group 1660. That is, when the execution processing unit 1340 executes the input program 1310, the A instruction group 1420 is executed only once, whereas when the execution processing unit 1340 executes the tampering prevention program 1330, A The instruction group 1420 will be executed twice. Therefore, in the case where the tampering prevention program 1330 is executed by the execution processing unit 1 340 and the case where the execution processing unit 1340 is executed by the input program 1310 which is a program before obfuscation, the instruction groups are arranged in different order. To be executed.
  • the fraudulent analyst uses the tampering prevention program. Even if the execution order of 1330 is analyzed, it becomes difficult to analyze the execution order of the input program before obfuscation. In addition, since the execution order of the tampering prevention program 1330 is more complicated than the execution order of the input program 1310, analysis and tampering can be made difficult. As a result, the protection target code A instruction group 1420 can be protected reliably.
  • the A instruction group 1420 is a process necessary for the program before the obfuscation process (input program 1310) which is no more than a mere redundant process. Therefore, if A instruction group 1420 is deleted, the process which used A instruction group 1420 in the program before obfuscation will not be executed.
  • an unauthorized analyst knows the control structure of a particular part of the program, and uses that knowledge to conduct an attack to find out that particular part (an example of such a control structure). May be a known encryption algorithm or the like).
  • the object to be obfuscated (input program 1310) is a program that uses secret information, and the unauthorized analyst knows the specific operation included in the program, and finds that operation in order to find the secret information.
  • An attack is also conceivable.
  • the control structure of the tampering prevention program 1330 in the present embodiment is different from the control structure known to the fraud analyst, the tampering prevention program based on the control structure known to the fraud analyst is Analysis of the control structure of program 1330 becomes difficult.
  • the tampering prevention process creation device 1320 is a device that generates an obscurity / fake tampering prevention program 1330 for the input program 1310.
  • FIG. 23 is a diagram showing a configuration of the tampering prevention process generating device 1320.
  • the tampering prevention process generation device 1320 includes an input unit 2010, an input program holding unit 2020, an assigned variable analysis unit 2030, a substituted variable information holding unit 2040, a saved variable analysis unit 2050, and Save variable information holding unit 2060, save instruction group generation unit 2070, save instruction group holding unit 2080, return instruction group generation unit 2090, return instruction group holding unit 2091, conditional branch instruction group generation unit 2092 A branch condition storage unit 2093, a conditional branch instruction group storage unit 2094, a variable group value substitution instruction group generation unit 2095, a variable group value substitution instruction group storage unit 2096, a branch instruction group generation unit 2097, a branch instruction A group holding unit 2098, a tampering prevention program generating unit 2099, A tamper-proof program output unit 2100 is provided.
  • Input section 2010 branches A instruction group 1420 with SUC-A instruction group 1430 as a branch destination, PRE-A instruction group 1410 with A instruction group 1420 as a branch destination, and SUC- B instruction group 1450.
  • An input program 1310 (for example, the program shown in FIG. 18) including the preceding B instruction group 1440 is accepted.
  • the input program holding unit 2020 holds the input program 1310 accepted by the input unit 2010.
  • the assigned variable analysis unit 2030 is a variable included in the A instruction group 1420 in the input program 1310 held by the input program holding unit 2020, and is a variable (value-assigned variable) to which a value is to be assigned. Analyze (specify).
  • the assigned variable information holding unit 2040 holds information such as the variable name of the assigned variable obtained by analysis by the assigned variable analysis unit 2030.
  • the saved variable analysis unit 2050 analyzes (specifies) a variable (referenced variable) which is a variable included in the SUC-B instruction group 1450 and to which a value is referred. Furthermore, the evacuated variable analysis unit 2050 identifies a variable (hereinafter referred to as evacuated variable) which is an implanted variable held by the implanted variable information holding unit 2040 and is also a referred variable.
  • the to-be-saved variable information holding unit 2060 holds information such as the variable name of the to-be-saved variable specified by the to-be-saved variable analysis unit 2050.
  • the save instruction group generation unit 2070 saves a save instruction group 1640, which is an instruction group for saving the value held by the saved variable into a save variable (in the present embodiment, the variable “var_saveO” or the like). Generate.
  • the save instruction group holding unit 2080 holds the save instruction group 1640 generated by the save instruction group generation unit 2070.
  • the restoration instruction group generation unit 2090 generates a restoration instruction group 1650 which is an instruction group for returning the value saved in the save variable to the saved variable.
  • the restoration instruction group holding unit 2091 is a restoration instruction group generated by the restoration instruction group generation unit 2090.
  • the conditional branch instruction group generation unit 2092 includes a SUC A instruction group 1430 and a SUC B instruction group 1450 And a conditional branch destination, and the branch destination is determined based on the value of the G- VAL- AB variable group (in this embodiment, the variable "var-abO" etc.) CBR-AB Condition branch instruction group 1610 is generated.
  • the branch condition storage unit 2093 includes a CBR—AB conditional branch instruction group 1610 that is a SUC—A instruction group 1
  • conditional branch instruction group holding unit 2094 is a CBR generated by the conditional branch instruction group generation unit 2092.
  • variable group value substitution instruction group generation unit 2095 generates the G- VAL- AB variable group (in the present embodiment,
  • variable group value substitution instruction group holding unit 2096 holds the instruction group generated by the variable group value substitution instruction group generation unit 2095.
  • the branch instruction group generation unit 2097 generates a BR—B branch instruction group 1660 that controls the A instruction group 1420 to be executed after the B instruction group 1440.
  • Branch instruction group holding unit 2098 holds BR-B branch instruction group 1660 generated by branch instruction group generation unit 2097.
  • the tampering prevention program generation unit 2099 generates the tampering prevention program 1330 using the input program 1310 held by the input program holding unit 2020 and the instruction group held by each instruction group holding unit.
  • the tampering prevention program output unit 2100 records the tampering prevention program 1330 generated by the tampering prevention program generating unit 2099 in the recording medium 1350.
  • Input section 2010 receives an input program 1310.
  • Input program 1310 includes A instruction group 1420, PRE-A instruction group 1410, SUC-A instruction group 1430, B instruction group 1440, and SUC-B instruction group 1450 as described in the configuration of input program 1310.
  • the input unit 2010 further includes any partial force A instruction group 1420, PRE-A instruction group 1410, SUC-A instruction group 1430, B instruction group 1440, or SUC-B instruction group 1450 of the input program 1310. Accept the specification of whether there is.
  • the input program holding unit 2020 has an area for storing an instruction group.
  • the input program holding unit 2020 holds the input program 1310 accepted by the input unit 2010.
  • the assigned variable analysis unit 2030 analyzes (specifies) a storage destination in which some processing result is stored in the A instruction group 1420 in the input program 1310 held by the input program holding unit 2020.
  • the assigned variable analysis unit 2030 analyzes (specifies) the variable name and type of the variable. Also, for example, if the A instruction group 1420 includes the process of specifying a relative value from the stack pointer and storing the value on the stack, the assigned variable analysis unit 2030 determines the stack pointer, stack, or stack. Parse (specify) the size of and relative values from the stack pointer. Also, for example, if the A instruction group 1420 includes a process of storing a value at a position designated by an address variable, the assigned variable analysis unit 2030 analyzes (specifies) the address stored.
  • assigned variable information information on the storage destination in which some processing result of the A instruction group 1420 is stored is generically referred to as assigned variable information.
  • information on a storage destination in which some processing result is stored is referred to as assigned variable information.
  • the stack etc. is realized as a function of the OS
  • the stack pointer and the size of the stack may not appear explicitly in the A instruction group 1420, but such values are also assigned variable information It is.
  • the assigned variable analysis unit 2030 stores the analyzed assigned variable information in the assigned variable information holding unit 2040.
  • the substitution variable analysis unit 2030 identifies the variable name “var— orgO” and the variable “var— org 2” to which value substitution is performed, and the types “int var— orgO” and “int var— org 2”, respectively. Are stored in the assigned variable information holding unit 2040.
  • the range of the A instruction group 1420 in the input program 1310 is the label “A:” force starts, and before the next other label appears.
  • each instruction group has some label strength and the next label appears It shall be the range up to before.
  • This label may be attached by designation of user's power via the input unit 2010, and the input program 1310 may also be powered by!, Or the label may be used! ,.
  • the assigned variable information holding unit 2040 stores the assigned variable information of the A instruction group 14 20 analyzed by the assigned variable analysis unit 2030. If there are a plurality of substituted variables, 1st stored variable information is stored for each substituted variable.
  • the assigned variable analysis unit 2030 analyzes the A instruction group 1420 in FIG. 18, the assigned variable information holding unit 2040 determines the type of each assigned variable. And the variable names “int var— org 0” and “int var— org 2” are stored.
  • the saved variable analysis unit 2050 analyzes (specifies) variables that affect the processing result of the SUC-B instruction group 1450 and subsequent instruction groups and whose values are changed in the A processing instruction group. .
  • the analysis target of the evacuated variable analysis unit 2050 includes, in the same manner as the analysis target of the substituted variable analysis unit 2030, variables other than those directly appearing in the A instruction group 1420. If such a variable is analyzed and the value of the variable is saved, the processing instruction group A is executed before the SU C-B instruction group 1450. As described above, the result will be different from the input program 1310.
  • the saved variable analysis unit 2050 actually executes the SUC B instruction group 1450 and the SUC B instruction group 1450 in the input program 1310 held by the input program holding unit 2020. Identify the variables needed to do this
  • the variable required for execution is the variable that is used in the SUC-B instruction group 1450 or later when the B instruction group 1440 finishes executing, ie, SUC- B.
  • the saved variable analysis unit 2050 takes the variable as the saved variable, Information such as variable name is stored in the saved variable information holding unit 2060. That is, the saved variable analysis unit 2050 substitutes a value in the A instruction group 1420, and extracts, as a saved variable, a variable necessary for the SUC-B instruction group 1450 and subsequent instruction groups.
  • the saved variable analysis unit 2050 analyzes (specifies) the variable name and type of that variable. Do. Also, for example, if the SUC-B instruction group 1450 is an instruction group including a process of referring to the value of the stack, the evacuated variable analysis unit 2050 analyzes (specifies) the size of the stack to be referred to. Also, for example, if the SUC-B instruction group 1450 includes a process of referring to the value stored at the position designated by the address variable, the saved variable analysis unit 2050 determines the type of the address variable or the value to be stored. Analyze (specify) In the following description, information on parameters and variables necessary to execute these SUC-B instruction groups 1450 is generically referred to as referenced variable information, and the parameters and variables themselves are referred to as referenced variables.
  • the evacuated variable analysis unit 2050 sets the variable as the evacuated variable and the evacuated variable
  • the stored variable information holding unit 2060 stores information such as the variable name of the
  • the value of "var-org2" is referenced. Therefore, the saved variable analysis unit 2050 sets the variable “var—orgl” and the variable “var—org2” as referenced variables, and sets “int var—orgl” and “int var—org2” as referenced variable information.
  • int var— orgl is the assigned variable It is not held in the information holding unit 2040, and "int var-org 2" is held.
  • variable "var-org2" of the int var_org2j which is held, is a variable that affects the processing result of the SUC-B instruction group 1450, and the value is A in the A instruction group 1420. It is a variable to be changed. Therefore, the value of the variable “var-org2” must be saved before processing the A instruction group 1420 and returned before processing the SUC-B instruction group 1450.
  • the to-be-saved variable analysis unit 2050 stores “int var ⁇ org 2” as the to-be-saved variable information in the to-be-saved variable information holding unit 2060.
  • the saved variable analysis unit 2050 may extract a variable held in the to-be-substituted variable information holding unit 2040 and search whether it is included in the SUC-B instruction group 1450 or later. Also, the to-be-saved variable analysis unit 2050 directly takes out the variable whose value is changed by the A instruction group 1420 from the input program 1310 held by the input program holding unit 2020 without using the substituted variable information holding unit 2040. It is also good.
  • the to-be-saved variable information holding unit 2060 has an area for storing to-be-saved variable information! / Scold.
  • the to-be-saved variable information holding unit 2060 stores the to-be-saved variable information analyzed by the to-be-saved variable analysis unit 2050. If there are a plurality of saved variables, the saved variable information holding unit 2060 stores the saved variable information for each saved variable.
  • the saved variable information holding unit 2060 stores the variable name of the saved variable and the type "int var-org 2".
  • the save instruction group generation unit 2070 generates a save instruction group 1640 for saving the value of the to-be-saved variable information, and stores it in the save instruction group holding unit 2080. In more detail, the following processing is performed.
  • the save instruction group generation unit 2070 determines how to save the saved variable. Specifically, decide which variables to save and so on. In the present embodiment, save instruction group generation unit 2070 creates a new variable as a save destination of the saved variable, Evacuate the value of the number.
  • the save instruction group generation unit 2070 generates a save instruction group 1640 which is an instruction group for saving the value of the saved variable in accordance with the determined save method.
  • the save instruction group generation unit 2070 stores the generated save instruction group 1640 in the save instruction group holding unit 2
  • the save instruction group generation unit 2070 acquires the to-be-saved variable information from the to-be-saved variable information holding unit 2060, and checks the number of to-be-saved variables.
  • the number of saved variables is only "int var_org2", so it is one.
  • the save instruction group generation unit 2070 newly creates save variables for the determined number and sets the created save variable “int var—saveOj as a variable to be used for save.
  • the save instruction group generation unit 2070 generates a save instruction group 1640 for saving the value of the saved variable into a save variable.
  • the save instruction group generation unit 2070 generates a save instruction group for each saved variable.
  • some conversion such as encryption may be performed and saved. In this embodiment, the conversion including the case of saving after such conversion and the case of saving without conversion is referred to as a conversion.
  • the save instruction group generation unit 2070 stores the generated save instruction group 1640 in the save instruction group holding unit 2 080.
  • "var-saveO var-org2;" is stored.
  • the save instruction group holding unit 2080 has an area for storing an instruction group.
  • the save instruction group holding unit 2080 stores the save instruction group 1640 generated by the save instruction group generation unit 2070 in the storage area.
  • the return instruction group generation unit 2090 generates a return instruction group 1650 which is an instruction group for returning the value saved in the save variable to the saved variable. In more detail, the following processing is performed.
  • the restoration instruction group generation unit 2090 stores the evacuation instruction group held by the evacuation instruction group holding unit 2080
  • Return instruction group generation unit 2090 generates an instruction group to perform reverse conversion of conversion performed by the acquired save instruction group 1640, and sets the instruction group as a return instruction group 1650.
  • the restoration instruction group generation unit 2090 stores the restoration instruction group 1650 in the restoration instruction group holding unit 2091.
  • the restoration instruction group generation unit 2090 stores the evacuation instruction group held by the evacuation instruction group holding unit 2080
  • the return instruction group holding unit 2091 has an area for storing an instruction group. Return instruction group holding unit
  • the return instruction group holding unit 2091 is a return instruction group generation unit.
  • Conditional branch instruction group generation unit 2092 includes SUC-A instruction group 1430 and SUC-B instruction group 1450 as conditional branch destinations, and G- VAL- AB variable (variable "var-abO") for branch destination determination.
  • CBR-AB conditional branch instruction group 1610 is generated that determines the branch destination based on the value. If there is a return instruction group 1650, the conditional branch instruction group generation unit 2092 generates a CBR-AB conditional branch instruction group 1610 including the return instruction group 1650 as a branch destination instead of the SUC-B instruction group 1450. .
  • conditional branch instruction group generation unit 2092 determines a variable for branch destination determination. In this embodiment, a new variable is generated, and this variable is used as a variable for branch destination determination.
  • conditional branch instruction group generation unit 2092 determines what value the value of the variable for branch destination determination is to set the SUC-A instruction group 1430 as a conditional branch destination. Further, the conditional branch instruction group generation unit 2092 determines what value the value of the variable for branch destination determination is to use as the conditional branch destination the SUC-B instruction group 1 450. As a specific example of the condition to be determined here, for example, the value of the variable matches a predetermined value, is larger than the predetermined value, the value obtained by performing some conversion on the value of the variable matches the predetermined value Etc.
  • conditional branch instruction group generation unit 2092 causes the branch condition storage unit 2093 to set the values of the branch destination determination variables for which the conditional branch destination determined in B) above is the SUC-A instruction group 1430.
  • the conditional branch instruction group generation unit 2092 stores in the branch condition storage unit 2093 a set of values of branch destination determination variables for which the conditional branch destination determined in B) is the SUC-B instruction group 1450.
  • conditional branch instruction group generation unit 2092 sets the SUC-A instruction group 1430 and the return instruction group 1650 as conditional branch destinations, and holds them. If not, a CBR-AB conditional branch instruction group 1610 is generated with the SUC-A instruction group 1430 and the SUC-B instruction group 1450 as conditional branch destinations.
  • conditional branch instruction group generation unit 2092 stores the generated CBR-AB conditional branch instruction group 1610 in the conditional branch instruction group holding unit 2094.
  • conditional branch instruction group generation unit 2092 when the input program 1310 in FIG. 18 is input to the tampering process generation device 1320 will be described.
  • conditional branch instruction group generation unit 2092 prepares a new variable not included in the input program 1310, and uses it as a G-VAL-AB variable for branch destination determination.
  • the variable of is "var-abO".
  • the value showing an example of what value the SUC-A instruction group 1430 is to be used as the branch destination when the variable for branch destination determination has a value may be determined by another method. Absent.
  • the SUC-A instruction group 1430 may be determined as the branch destination when the value of the variable for branch destination determination is a randomly selected value.
  • conditional branch instruction group generation unit 2092 sets a set of values of branch destination determination variables for which the conditional branch destination determined in B) above is the SUC-A instruction group 1430 to the branch condition storage unit 2093.
  • conditional branch instruction group generation unit 2092 stores in branch condition storage unit 2093 a set of values of branch destination determination variables for which the conditional branch destination is SUC-B instruction group 1450.
  • conditional branch instruction group generation unit 2092 sets the SUC-A instruction group 1430 and the return instruction group 1650 as a conditional branch destination, and holds If not, a CBR-AB conditional branch instruction group 1610 is generated with the SUC-A instruction group 1430 and the SUC-B instruction group 1450 as conditional branch destinations.
  • the branch condition storage unit 2093 includes at least two areas for storing a set of values of variables.
  • a first set which is a set of values of variables satisfying the condition that the branch destination of the conditional branch instruction group generation unit 2092 becomes SUC-A instruction group 1430 is recorded.
  • the second area is a second set which is a set of values of variables satisfying the condition that the branch destination of the conditional branch instruction group generation unit 2092 is SUC-B instruction group 1450 (or return instruction group 1650). Billion.
  • the first area is a set of values of variables satisfying the condition that the branch destination of the conditional branch instruction group generation unit 2092 becomes the S UC-A instruction group 1430.
  • the conditional branch instruction group holding unit 2094 has an area for storing an instruction group.
  • the conditional branch instruction group holding unit 2094 stores the CBR-AB conditional branch instruction group 1610 generated by the conditional branch instruction group generation unit 2094 in a storage area.
  • variable group value substitution instruction group generation unit 2095 generates an STR-A variable group value substitution instruction group 1620 and an STR-B variable group value substitution instruction group 1630. Specifically, the following processing is performed.
  • variable group value substitution instruction group generation unit 2095 obtains the first set and the second set held by the branch condition holding unit 2093.
  • the variable group value substitution instruction group generation unit 2095 generates an instruction group for substituting values included in the first set into variables for branch destination determination, and STR—A variable group value substitution instruction group It is assumed to be 1620.
  • the variable group value substitution instruction group generation unit 2095 generates an instruction group for substituting values included in the second set into variables for branch destination determination, and sets it as a STR-B variable group value substitution instruction group 1630. Ru.
  • the variable group value substitution instruction group generation unit 2095 selects one of the values and substitutes it. This selection method may be random, or may be selected according to some criteria.
  • variable group value substitution instruction group generation unit 2095 stores the generated instruction group in the variable group value substitution instruction group holding unit 2096.
  • variable group value substitution instruction group generation unit 2095 when the input program 1310 of FIG. 18 is input to the tampering process generation device 1320 will be described.
  • variable group value substitution instruction group generation unit 2095 generates an instruction group in which the variables for branch destination determination are values included in the first set, and the STR—A variable group value substitution instruction group 1620 I assume.
  • variable group value substitution instruction group generation unit 2095 generates the STR-A variable group value substitution instruction group 1620 and the STR-B variable group value substitution instruction group 1630 as a variable group value substitution instruction group holding unit 2096 Store in
  • variable group value substitution instruction group holding unit 2096 has an area for storing an instruction group.
  • Variable group value substitution instruction group holding unit 2096 stores the STR-A variable group value substitution instruction group 1620 generated by the variable group value substitution instruction group generation unit 2095 and the STR-B variable group value substitution instruction group 1630 in the storage area.
  • the variable group value substitution instruction group holding unit 2096 generates the STR-A variable group value substitution instruction group 1620 generated by the variable group value substitution instruction group generation unit 2095 and the STR-B variable group value.
  • the branch instruction group generation unit 2097 generates a BR-B branch instruction group 1660 for branching from the B instruction group 1440 to the A instruction group 1420.
  • the branch instruction group generation unit 2097 branches “A to instruction group 1420” “goto A;” which is a BR-B branch instruction group 1660.
  • the branch instruction group holding unit 2098 has an area for storing an instruction group.
  • Branch instruction group holding unit 2098 stores BR-B branch instruction group 1660 generated by branch instruction group generation unit 2097 as storage area B 0
  • branch instruction group holding unit 2098 generates “ 8 01; 0 A;” in! ⁇ ⁇ 8 branch instruction group 1660 generated by branch instruction group generation unit 2 097. Hold.
  • the tampering prevention program generation unit 2099 generates the tampering prevention program 1330 using the input program 1310 held by the input program holding unit 2020 and the instruction group held by each instruction group holding unit. Specifically, the tampering prevention program generation unit 2099 inserts or arranges the instruction group held by each instruction group holding unit at the following position with respect to the input program 1310, whereby the tampering prevention program 1330 is executed. Generate
  • the tampering program generation unit 2099 inserts the STR-A variable value substitution instruction group 1620 at any position in the PRE-A command group 1410.
  • the tampering program generation unit 2099 places the CBR—AB condition branch instruction group 1610 at the end of the A instruction group 1420.
  • the tampering prevention program creation unit 2099 inserts the STR-B variable group value substitution instruction group 1630 at any position in the B instruction group 1440.
  • the falsification prevention program generation unit 2099 stores a save instruction group at the end of the B instruction group 1440. After that, BR-B branch instruction group 1660 is arranged.
  • the falsification prevention program creation unit 2099 arranges the return instruction group 1650 immediately before the SUC-B instruction group 1450.
  • the tampering program generation unit 2099 inserts each instruction group generated and held in the input program 1310 of FIG. 18, the tampering program 1330 of FIG. Generate
  • the tampering program output unit 2100 receives and stores the tampering program 1330 generated by the tampering program generating unit 2099.
  • the tampering prevention program output unit 2100 records the tampering prevention program 1330 on the recording medium 1350.
  • the G-VAL-AB variable (variable “var-abO”) for branch destination determination corresponds to an additional variable
  • conditional branch instruction group generation unit 2092 is configured as a variable generation means. It is being done.
  • the STR-A variable group value substitution instruction group 1620 corresponds to the first condition value substitution instruction
  • the STR-B variable group value substitution instruction group 1630 corresponds to the second condition value substitution instruction
  • the variable group value substitution instruction A group generation unit 2095 is configured as a condition value substitution instruction generation unit.
  • FIG. 24 is a flowchart showing the operation of the tampering prevention process creation device 1320.
  • the process of converting the input program 1310 into the tampering prevention program 1330, that is, the process flow of obfuscation will be described with reference to FIG.
  • the input unit 2010 of the tampering process generation processing unit 1320 includes an input program 1310, an A instruction group 1420, an PRE-A instruction group 1410, a SUC-A instruction group 1430, and a B instruction group 1440 in the input program 1310. , And the specification of the position of SUC B instruction group 1450 , And stored in the input program holding unit 2020 (step S400).
  • the assigned variable analysis unit 2030 analyzes the assigned variable information of the A instruction group 1420 held by the input program holding unit 2020, and stores the information in the substituted variable information holding unit 2040 (step S402).
  • the saved variable analysis unit 2050 is required to execute the SUC-B instruction group 1450 and the SUC-B instruction group 1450 in the input program 1310 held by the input program holding unit 2020. Identify the variable Then, the evacuated variable analysis unit 2050 sets a variable held in the substituted variable information holding unit 2040 among the identified variables as the evacuated variable, and stores it in the evacuated variable information holding unit 2060 (step S404).
  • the save instruction group generation unit 2070 generates a save instruction group 1640 and stores it in the save instruction group holding unit 2080 (step S406).
  • the restoration instruction group generation unit 2090 generates a restoration instruction group 1650 and stores the same in the restoration instruction group holding unit 2091 (step S408). If no saved variable is found in step S404, there is no need to generate a save instruction group 1640 and a return instruction group 1650, so the processes in steps S406 and S408 are not performed! /.
  • conditional branch instruction group generation unit 2092 generates a conditional branch instruction group 1610 and stores it in the conditional branch instruction group holding unit 2094 (step S410).
  • variable group value substitution instruction group generation unit 2095 generates the STR-B variable group value substitution instruction group 1630 and the STR-A variable group value substitution instruction group 1620, and stores them in the variable group value substitution instruction group holding unit 2096. (Step S412).
  • Branch instruction group generation unit 2097 generates BR-B branch instruction group 1660 and stores it in branch instruction group holding unit 2098 (step S 414).
  • the tampering prevention program generation unit 2099 generates a tampering prevention program 1330 and stores it in the tampering program output unit 2100 (Step S416).
  • the tampering prevention program output unit 2100 records the tampering prevention program on the recording medium 1350.
  • the tampering process generation device 1320 converts the input program 1310 given as an input into a tampering program 1330 that produces the same result as the input program 1310. Can do.
  • the unauthorized analyst performs analysis by actually powering the tampering prevention program 1330, it is difficult to know the execution order and control structure of the instruction group of the input program 1310.
  • the tampering prevention process creation device 1320 can obfuscate the input program 1310 with the tampering prevention program 1330 having a more complicated control structure.
  • Embodiment 1 and its modifications and Embodiments 2 and 3 the power of adding instructions such as variable declarations during obfuscation processing in order to conform to the C language notation.
  • the timing of adding an instruction is not limited to the one described above. After the obfuscation process is completed, these instructions may be added at the end or may be added at other timings. In addition, this processing may not be necessary depending on the description language after obfuscation.
  • the execution processing device and the tampering prevention processing generation device are not limited to the above.
  • the execution processing device does not include a processing generation unit having a function equivalent to that of the tampering prevention processing generation device, and the program may be executed after obfuscation by the processing generation unit.
  • the program to be executed is a program subjected to obfuscation according to the present invention, unauthorized tampering and analysis can be prevented as in the first and second embodiments.
  • it is desirable to protect the original program by protecting the storage location of the program in the execution processing device by using a tamper proof! /, Needless to say! /.
  • the execution processing device is a device that executes the program distributed from the program distribution server, and further includes a decryption device in addition to the tampering prevention processing generation device, and the encrypted and distributed program It may be configured to execute after decoding and further performing obfuscation. According to such a configuration, the program distributed from the program distribution server can be obfuscated and executed by the execution processing device.
  • the tampering prevention processing generation device and the execution processing device are separately configured, the present invention is not limited to this. Similar to the first and second embodiments, the above-mentioned modification can be considered.
  • the evacuated variable analysis unit 2050 sets a part of the variables of the to-be-substituted variable information holding unit 2040 as the to-be-saved variables
  • the to-be-substituted variable information holding unit 2040 holds All of the variables to be saved may be used as saved variables. When such a configuration is used, there is a possibility that extra variables will not be saved even if they are not saved. However, the process of selecting obfuscated variables is unnecessary, so obfuscation processing Can be made faster.
  • all variables included in the A instruction group 1420 may be set as saved variables, or all variables included in the input program 1310 may be set as saved variables. If such a configuration is used, the analysis of the substituted variable becomes unnecessary, and the obfuscation processing can be further speeded up.
  • the method of generating the instruction capable of reverse conversion is not limited to the method mentioned above, and a known method may be used or a method to be conceived in the future may be applied.
  • a configuration may be made such that a save instruction group is created such that one saved variable is saved by a plurality of stages of processing. It may be configured to generate a plurality of save instruction groups in which all the variables are saved. That is, the configuration of the save instruction group does not matter as long as the save variable is finally saved by the execution of the save instruction group. Furthermore, a plurality of save instruction groups may be generated for some of the saved instruction groups, and one save instruction group may be generated for each of the other saved instruction groups. If such a configuration is used, it will be difficult to find out the intermediate power save instruction group and the return instruction group of the instruction group included in the unauthorized analyst force alteration program.
  • the save instruction group generation unit 2070 adds a new variable to use as a save variable.
  • the save variables may be used in combination with other variables generated for obfuscation.
  • a variable used during dummy processing when adding dummy processing which is not executed at the time of execution in a normal system in obfuscation by another method can be considered.
  • the branch instruction group generation unit 2097 may generate a conditional branch instruction group instead of “goto A;” which is the BR-B branch instruction group 1660.
  • the BR—B branch instruction group 1660 may be “if (var ⁇ org2> 200) goto A;”.
  • the operation of the tampering prevention program 1330 is set to the value of var- org2. Therefore, the operation is different.
  • the tampering prevention program 1330 changes the operation depending on whether the value of "var- org 2" exceeds "200". As a result, it is possible for fraudulent analysts to think that the value of “200” t (which is a value that is particularly meaningful in particular) is an important value, making analysis work more difficult. Become.
  • branch instruction group generation units 203 and 203b are the branch processing instruction groups 320, 320a and 320b.
  • Conditional branch instructions may be generated instead of “decrypt (encryptedData)”.
  • the branch source block of the A instruction group is only one of the PREA-A instruction group in the input program has been described, but there may be more than one branch source block. I do not care.
  • branch source blocks such as the first PRE-A instruction group, the second PRE-A instruction group, and so on, similarly add the STR-A variable value assignment instruction group to each branch source block. do it.
  • the tampering process generation device 1320 enables obfuscation of complicated programs having a control structure.
  • the STR-A variable value substitution instruction group to be added to each instruction group may be an instruction in which the final calculation result is the same but the calculation process in the middle is different. This makes it difficult for the unauthorized analyst to divide which instruction the STR-A variable value assignment instruction group is.
  • one command has one B command per A command group. Either one or both of them may be used.
  • the tampering program will be richer in nominations, and it will be more difficult for the fraud analyst to imagine the tampering program as an input program.
  • the number of instruction groups of the same type may be more than one without contradiction.
  • the branch target block of the B instruction group in the input program is only one of the SUC-B instruction group.
  • the branch target block of the B instruction group 1440 is the first SUC-B instruction group and the second SUC-B instruction group
  • the branch destination is determined by the value of "var- org2" at the end of the B instruction group 1440.
  • the branch destination is determined based on the value of “var — org 2”. That is, the CBR-AB conditional branch instruction group 1610 that performs this processing is specifically described using C language as follows.
  • SUC-B-1 is a label attached to the first SUC-B instruction group
  • SUC-B- 2 is a label attached to the second SUC_B instruction group.
  • conditional branch instruction group 1610 includes a CBR—B conditional branch instruction in the CBR—AB conditional branch instruction group 1610 similar to that of the third embodiment as described above. Not exclusively.
  • the first SUC-B instruction group becomes a branch destination at the time of "”
  • the branch 81 ⁇ -eight conditional branch instruction group 1610 may have other configurations.
  • SUC-A-1 is a label attached to the first SUC-A instruction group
  • SUC-A_2 is a label attached to the second SUC_A instruction group.
  • conditional branch instruction group including a dummy branch destination that does not branch in practice, such as the obfuscation technique described in Non-Patent Document 1, may be added.
  • dummy branch destinations such as “case 4”, “case 5”,... May be added to the above-described example of the conditional branch instruction group. If such a configuration is used, only the branch point to the second SUC-B instruction group Even if it is attempted to branch unconditionally to the first SUC-B instruction group, it becomes difficult to know which part should be tampered with.
  • conditional branch instructions using relative jump may be used.
  • first SUC-B instruction group 1, the first SUC-B instruction group 2,... Which perform the same processing as the first SUC-B instruction group are provided, and the first SUC-B instruction group is originally provided.
  • branching may be performed to any of the above equivalent processes.
  • FIG. 25 is a diagram showing a configuration of the tampering prevention program according to the present modification.
  • the tampering prevention program 1330a includes: PRE A instructions 1410; A variable group value substitution instruction group 1620, A instruction group 1420, CBR-AB conditional branch instruction group 16 0, SUC-A instruction group 1430, B instruction group 1440, STR-B variable group value substitution instruction group 16 includes a save instruction group 1640, a referenced variable value substitution process instruction group 2210, a BR-B branch instruction group 1660, a return instruction group 1650, and a SUC-B dependent process instruction group 2220.
  • the tampering prevention program 1330a further includes a referenced variable value substitution processing instruction group 2210 compared to the tampering prevention program 1330 of the third embodiment, and the SUC of the tampering prevention program 1330.
  • B instruction group 1450 include SUC — B dependent processing instruction group 2220!
  • the A instruction group 1420 corresponds to the first processing instruction group 140 of the embodiment 1
  • the referenced variable value substitution processing instruction group 2210 is an embodiment of the present invention. 1 corresponds to the referenced variable value substitution processing instruction group 310
  • the BR-B branch instruction group 1660 corresponds to the branch processing instruction group 320 of the first embodiment
  • the SUC-B dependent processing instruction group 2220 corresponds to the first embodiment.
  • FIG. 26 is a view showing a specific example of the tampering prevention program 1330a expressed in C language.
  • SUC-B dependent processing instruction group 2220 is a processing instruction group to be executed after calling A instruction group 1420, and is a program which performs processing equivalent to SUC-B instruction group 1450 of input program 1310. It is an instruction group.
  • the difference from SUC- B instruction group 1450 itself is that part of the processing of SU CB instruction group 1450 is for processing using the processing result of A instruction group 1420. It is a point that is replaced.
  • the SUC-B dependent processing instruction group 2220 is processed by the A instruction group 1420 to obtain the assumed value "40" as the value of the substituted variable "var- orgO"! /, If SUC — It can execute processing equivalent to B instruction group 1450.
  • FIG. 27 is a diagram showing a flow of processing of the tampering prevention program 1330a.
  • the processing of the tampering prevention program 1330a further includes processing (step S315) for executing a referenced variable value substitution processing instruction group 2210 as compared to the processing of the tampering prevention program 1330 shown in FIG. Instead of the process of step S320 shown in FIG. 22, the process (step S321) of executing the SUC-B dependent process instruction group 2220 is included.
  • the execution processing device 1340 executes the tampering prevention program 1330a
  • the execution processing device 1340 executes the referenced variable value substitution processing instruction group 2 210 (step S314). S315).
  • the execution processing unit 1340 executes the BR_B branch instruction group 1660 (step S316).
  • the execution processing unit 1340 executes the SUC_B dependent processing instruction group 2220 (step S321).
  • FIG. 28 is an explanatory diagram for explaining an operation in which the tampering prevention process generating device according to the present modification generates the tampering prevention program 1330a.
  • PRE-A indicates PRE-A instruction group 1410
  • A indicates A instruction group 1420
  • SUC-A indicates SUC-A instruction group 1430
  • B indicates B instruction group 1440
  • SUC-B indicates SUC-B instruction group 1450 or SUC-B dependent processing instruction group 2220.
  • the variable “X0” indicates the variable “var—org0”
  • the variable “XI” indicates the variable “var—orgl”
  • the variable “X2” indicates the variable “var—org2”.
  • the variable “Y” indicates the variable “var—ab0”
  • the variable “P” indicates the variable “var save0”.
  • the tamper-resistance-processing generating device Upon acquiring the input program 1310, the tamper-resistance-processing generating device specifies an instruction group to be protected, and the input program for the protected instruction group to be executed in a plurality of processing paths. Obscure 1310. That is, the tampering prevention processing generation device is a tampering prevention program in which, when a group of instructions to be protected that are present as a part of one processing path is tampered, an abnormality occurs in another processing path due to the tampering. Generate 1330a.
  • the tampering process generation processing apparatus sets a position between the B instruction group 1440 and the SUC-B instruction group 1450 as a selected position. Then, as shown in (b) of FIG. 28, the tampering process generation device generates an execution path (processing path) of the input program so that the A instruction group 1420 to be protected is re-executed at the selected position. change.
  • the tamper-resistance-processing creating apparatus adds BR-B branch instruction group 1660 "goto A" as a new path so that the process branches from B instruction group 1440 to A instruction group 1420.
  • the SUC-A instruction group 1430 is executed after the B instruction group 1440 when the A instruction group 1420 is executed.
  • some instructions are added so that SUC-B instructions 1450 are executed.
  • the tamper-resistance-processing creating apparatus changes the execution path so that the instruction group 1420 is executed again after the instruction group 1440. As the processing result of the instruction group 1 450 does not change, the consistency of the SUC_B instruction group 1450 is ensured.
  • the tamper-resistance-process creating device is the processing result of SUC-B instruction group 1450.
  • the execution result of A instruction group 1420 executed after B instruction group 1440.
  • the dependent processing instruction group 2220 has the same processing as the SUC-B instruction group 1450.
  • a instruction group 1 420 is falsified, execution of A instruction group 1420 after B instruction group 1440 can not obtain the expected value “40” as the value of variable “X0”, and SUC-B dependent processing
  • the instruction group 2220 is an abnormal process different from the SUC-B instruction group 1450.
  • the tampering process generation device generates the SUC-B dependent processing instruction group 2220 that uses the execution result of the A instruction group 140.
  • This is realized by the tampering process generation device according to the present modification having the same configuration as the tampering process generation device 110, 110a of the first embodiment and the modification thereof. That is, the tampering prevention processing creation device according to the present modification is the same as the tampering prevention processing creation device 1320 shown in FIG. 23 of the third embodiment in the assumed value calculation units 290, 290a in the first embodiment and its modification. And, a dependency processing instruction group generation unit 201, 201a and the like are added.
  • the A command group to be protected 1420 and the SUC-B command group 1450 may include an API (Application Program Interface) related to a user interface or an external access.
  • API Application Program Interface
  • FIG. 29 is an explanatory diagram for explaining an operation of the tampering prevention process creation device according to the present modification to generate a tampering prevention program including an API.
  • PRE-A indicates a PRE-A instruction group
  • A indicates an A instruction group
  • SUC-A indicates a SUC-A instruction group
  • B indicates a B instruction group.
  • -B indicates SUC-B instructions or SUC-B dependent processing instructions.
  • GetText (V) is an API that stores the character string input by the user at the address indicated by the address variable V.
  • GetText (T) is entered by the user at the address indicated by address variable T. Is an API that stores a string.
  • the tampering prevention process generating device acquires an input program including an API in the A instruction group and the SU C-B instruction group. Even in such a case, the tamper-proof processing generation device specifies an instruction group to be protected as described above, and the input program thereof so that the instruction group to be protected is executed in a plurality of processing paths. Obscurately That is, the tampering prevention processing generation device is a tampering prevention program in which, when a group of protected instructions existing as a part of one processing path is tampered with, the tampering causes an abnormality to occur in another processing path. Generate
  • the tampering prevention process generating device determines whether or not the A command group to be protected includes an API. Here, if it is determined that the API is included, the tampering prevention processing generation device searches for another processing that calls the API. As a result, when the anti-tamper processing generator finds the SUC-B instruction group that calls the API, as shown in (a) of FIG. 29, it is determined between the B-instruction group and the SUC-B instruction group. Set to the selected position. Then, as shown in (b) of FIG. 29, the tampering prevention processing generation device sets the execution path (processing path) of the input program so that the A instruction group to be protected is again executed at the selected position. change.
  • the tampering process generation processing unit adds the BR-B branch instruction group "goto A" as a new path so that the process branches from the B instruction group to the A instruction group.
  • the tamper-resistant process generation device then executes the SUC-A group of instructions, and the instruction A is executed after the group of B instructions.
  • the tamper-resistance-processing generating device generates the SUC-B instruction group so that the processing result of the SUC-B instruction group depends on the execution result of the A instruction group.
  • the instruction group is falsified! If not, the SUC-B dependent processing instruction group is processed equivalent to the SUC-B instruction group.
  • the PRE-A instruction group, the A-instruction group, the SUC-A instruction group, the B-instruction group, and the SUC-B instruction group are instructions included in the same input program. Although it exists, it may be realized as a separate function.
  • the A instruction group corresponding to the first processing instruction group and the B instruction group and the SUC-B instruction group corresponding to the second processing instruction group are input as separate functions. This can be considered. In this case, if a function including the A instruction group is read from the B instruction group and the processing result of the function is discarded (or not referred to without explicitly discarding), processing after the S UC-B instruction group While the influence of the instruction group A does not appear, obfuscation similar to that of the third embodiment can be performed. When calling a function including the A instruction group by reference call, etc., the variable given as an argument may change, and the processing after the SUC-B instruction group may be affected. As in 3, the save process instruction group and the return process instruction group are added before and after the function call.
  • the first processing instruction group and the second processing instruction group are input separately, as in the third embodiment, the same input program It may be another process in the middle or in the same function. Also in this case the same as above It goes without saying that the effect can be obtained.
  • the configuration using BR-B branch instruction group 1660 has been described in order to execute the A instruction group after the B instruction group. It is not something that can be done!
  • the order of processing of instruction groups may be changed, and the A instruction group may be arranged immediately after the save instruction group 1640.
  • the BR-B branch instruction group 1 660 becomes unnecessary force
  • the S-A variable group value substitution instruction group 1620 followed by the A instruction group Conversion such as inserting a branch instruction is required.
  • the tampering prevention processing generation device it is also possible to configure the group of instructions selected randomly as the intermediate group of the input program as the group of A instructions or B instructions. In such a configuration, the tamper-resistance-processing generator needs to determine the PRE-A instruction group and the SUC-A instruction group after determining the A instruction group or the B instruction group. In this case, the tampering prevention processing generation device analyzes the branch source block of the determined A instruction group, and sets the analyzed blocks as a first PRE-A instruction group, a second PRE-A instruction group,.
  • the tampering process generation device analyzes the branch target block of the instruction group, and sets the analyzed block as a first SUC-A instruction group, a second SUC-A instruction group,. The same applies to the first SUC-B instruction group, the second SUC-B instruction group, and so on.
  • G— VAL— AB variable for branch destination determination is “var — abO”.
  • variable indicating whether to branch to the SUC- A instruction group and a variable indicating whether to branch to the SUC -B instruction group can be made different variables.
  • the force used in the input program including the SUC-A instruction group as the input to the tampering prevention process creation device 1320 is not limited to this.
  • the input program does not necessarily include the instruction corresponding to the SUC-A instruction group. That is, the anti-tamper processing generator 1320 can execute the A command even if the SUC-A instruction group is not given as an input. Even if you know the address and function name of the instruction that is the branch destination of the instruction group! If you configure the CBR-AB conditional branch instruction group to branch to the instruction group indicated by the address or function name, obfuscation Can.
  • obfuscation techniques described here may be applied together with other obfuscation techniques.
  • the input instruction group is included in the output instruction group as it is. Absent.
  • an instruction group equivalent to each instruction group may be generated based on the input program by another obfuscation method or the like, and then the instruction group may be included in the obfuscated program.
  • the correspondence between the instruction group of the input program and the instruction group of the output program can be made difficult to separate.
  • an equivalent instruction group is generated from all the instruction groups, an equivalent instruction group is generated for a part that is not generated, and another instruction group is output an instruction group as it is as an input program. Good.
  • the equivalent instruction group in this modification includes an instruction group which is not particularly converted, and the generation of the equivalent instruction group also includes a process of only extracting each instruction group from the input program.
  • an instruction group in which at least one of the instruction groups is different from the original one but another instruction group which is different if it is converted into an instruction group which performs equivalent processing is different from the original one. It does not matter whether it is converted to.
  • the obfuscated second processing instruction group 150 is The second processing instruction group 150 can be easily ported to another device without analyzing the second processing instruction group 150, and the second processing instruction group 150 can be executed normally on that device.
  • the second processing instruction group 150 decryption is performed using the encryption key.
  • the encryption key and the contents of the decryption process are information to be considered secret (secret information) and should not be analyzed. Therefore, as described above, the second processing instruction group 150 is obfuscated. However, even if the second processing instruction group 150 is obfuscated and the elucidation of its secret information can be prevented, Obfuscation becomes meaningless if porting and / or fraud as described above is easily performed. Also, in order to prevent such a fraud, it is necessary to significantly increase the code size of the obfuscated second processing instruction set 150.
  • the instruction group originally included in the execution processing device 130 is used as the first processing instruction group 140, and the processing path is
  • the output processing instruction group 160 may be generated so as to branch to one processing instruction group 140. This makes it possible to make the above-mentioned portability difficult while suppressing an increase in the code size of the output processing instruction group 160.
  • FIG. 30 is an explanatory diagram for explaining the effect of the present invention when the first processing instruction group 140 is originally included in the execution processing device 130. As shown in FIG.
  • the tampering prevention process generation device 110 acquires the second processing instruction group 150 to be protected.
  • the second processing instruction group 150 includes the processing blocks BO, B1 and “... 9. Further, the processing blocks ⁇ constituting the first processing instruction group 140 are originally included in the execution processing unit 130 Therefore, the tampering process generation processing unit 110 corrects the second processing instruction group 150 so that the processing path branches from the processing block ⁇ 0 to the processing block ⁇ ⁇ and returns to the processing block B 1 to output processing instruction group In other words, the tampering prevention process generation device 110 obfuscates the second process instruction group 150 into the output process instruction group 160 with the first process instruction group 140 as a part of the protection target.
  • the fraudulent analyst performs the fraudulent action to cause another device to execute the processing by the second processing instruction group 150
  • the first processing instruction group 140 is an instruction group that is originally incorporated in the execution processing device and performs processing
  • porting to another device is difficult. Therefore, such cheating can be made difficult.
  • the obfuscation of the second processing instruction group 150 does not increase the instruction group significantly, so that the increase in the code size of the output processing instruction group 160 can be suppressed small.
  • by selecting an instruction group that performs processing specific to each execution processing device as the first processing instruction group 140 it is possible to make porting more difficult.
  • the first processing instruction group 140 does not necessarily have to be a program instruction.
  • a device or circuit for example, a circuit used for audio reproduction
  • a dedicated device or circuit that plays the role of the first processing instruction group 140 may be added to the execution processing device 130.
  • the branch processing instruction group may include an instruction for operating the above-described device or circuit.
  • the referenced variable is, for example, an input to the device or circuit, and the assigned variable is an output of the device or circuit.
  • characteristic Operation for example, in a process (instruction group) including secret information such as encryption, a characteristic operation such as table lookup or bit shift operation which is not generally used in a large amount (hereinafter, characteristic Operation may be included. Therefore, in the case where the execution processing device 1340 shown in FIG. 16 executes the input program 1310, the unauthorized analyst can easily make a group of instructions including secret information from the input program 1310 with the characteristic operation as a mark. Can be found and analyzed incorrectly.
  • the tampering program 1330 may be generated with the instruction group including the characteristic operation as the A instruction group 1420.
  • FIG. 31 is an explanatory diagram for explaining the effect of the present invention in the case where the A instruction group 1420 includes a characteristic operation.
  • the tamper-resistance-processing creating apparatus 1320 Upon acquiring the input program 1310, the tamper-resistance-processing creating apparatus 1320 searches the instruction group including the characteristic operation and sets the found instruction group as the A instruction group 1420. Perform obfuscation processing similar to. As a result, the program generated by the tampering prevention process creation device 1320 becomes the tampering prevention program 1330 such that the A instruction group 1420 including its characteristic operation is repeatedly executed, as in the third embodiment described above. .
  • the tampering prevention processing generation device performs output processing with the group of instructions including the characteristic operation as the first group of processing instructions. Instructions may be generated.
  • a program that restricts the reproduction of content is falsified to release the reproduction restriction of the program.
  • Such a program permits reproduction of the content if the number of times of reproduction of the content is equal to or less than a predetermined number of times.
  • the program authenticates the device that reproduces the content, and allows only the legitimate device to reproduce the content.
  • the program determines whether the content is illegally copied, and if it is not illegally copied, permits reproduction of the content.
  • the unauthorized analyst finds out the conditional branch instruction for determining the reproduction permission of the content from the program, and modifies the conditional branch instruction into the unconditional branch instruction so that the reproduction is always permitted. I assume.
  • FIG. 32 is a diagram showing an example of tampering by a fraud analyst.
  • the fraudulent analyst first causes the program to be executed as shown in (a) and (b) of FIG. 32, and compares the log when playback is permitted with the log when playback is not permitted. As a result, as shown in (c) and (d) of FIG. 32, an unauthorized analyst identifies a portion where a difference occurs in the log, and determines the reproduction permission of the content immediately before that portion. Find a conditional branch instruction (processing block B19).
  • the unauthorized analyst analyzes the processing block B19 which is a conditional branch instruction, and in the processing block B19, 1 is substituted into the variable a when the reproduction is permitted, and the variable a when the reproduction is not permitted.
  • 0 is assigned to. Therefore, the unauthorized analyst attempts to change the processing block B19 into an unconditional branch instruction as well, so that 1 is always substituted into the variable a in the processing block B19. Therefore, in order to cope with this attack, in the present invention, only the dependency shown in (d) of FIG. 28 may be performed.
  • FIG. 33 is a diagram showing an example in which the tampering prevention process generating device according to the present modification performs only the dependency.
  • the tampering prevention process generating device 400 acquires a program including the conditional branch instruction shown in FIG. 32 as an input program Pi. Then, the tampering prevention process generation device 400 specifies one constant included in the process (restricted process) when reproduction is permitted in the input program Pi. In other words, the tampering process generation device 400 finds out the constant "10" included in the processing block B26. Further, the tampering prevention processing generation device 400 determines, at the time of the reproduction permission, the judgment variable a which is the variable in which the judgment result of the reproduction permission of the content is stored by the conditional branch instruction (processing block B19) of the input program Pi. A limit value “1”, which is a value indicating the determination result stored in the determination variable a, is extracted from the processing block B19.
  • the processing of the processing block B26 depends on the processing result (execution result) of the processing block B19.
  • the tampering prevention processing generation device 400 performs error processing at the time of reproduction non-permission (processing block) so that processing at the time of reproduction permission is executed regardless of the determination result of processing block B19 in the input program Pi.
  • FIG. 34 is a diagram showing an example of the configuration of the tampering prevention process generating device 400 according to the present modification.
  • the tampering prevention process generation device 400 includes an input program holding unit 401, a constant selecting unit 402, a variable extracting unit 403, a converting unit 404, and a tampering program holding unit 405.
  • the input program holding unit 401 acquires and holds the input program Pi.
  • the constant selection unit 402 specifies the process (restricted process) when reproduction is permitted in the input program Pi, and further selects one constant included in the process.
  • variable extraction unit 403 also extracts the conditional branch instruction force in which the determination result is stored in the conditional branch instruction in the input program Pi. Furthermore, the variable extraction unit 403 extracts a restricted value which is a value stored in the judgment variable when it is judged that the restricted process should be executed in the conditional branch instruction.
  • the conditional branch instruction storing the value indicating the determination result in the determination variable may be a group of instructions consisting of a plurality of instructions.
  • the decision variable does not have to be a variable explicitly represented in the input program Pi.
  • the decision variable may be a stack.
  • the restricted value is the value stored in the stack.
  • the determination variable may be a storage area corresponding to the position designated by the address variable.
  • the restricted value is the value stored at that position.
  • the restricted value may be a set of values other than those limited to one value.
  • an instruction group is generated which performs the same processing as the processing block B26 regardless of any value belonging to the set of values assigned to the determination variables.
  • the way of generating the instruction group having such a property is the same as the way of generating the dependent processing instruction group in the sixth modification of the first embodiment.
  • the process of substituting the restricted value into the determination variable in such a conditional branch instruction includes the process of the first processing instruction group in the first embodiment and its modification and the second embodiment, and the embodiment It is similar to the processing of the A instruction group of 3.
  • Conversion unit 404 performs the restricted process regardless of the determination result of the conditional branch instruction. To delete the error handling in the input program Pi. Furthermore, the converting unit 404 converts the constant selected by the constant selecting unit 402 into a mathematical expression using a determination variable. The converter 404 may convert the constant into a function using the determination variable. At this time, when the restricted value is substituted into the determination variable, the conversion unit 404 generates an equation so that the value calculated by the equation becomes equal to the above-mentioned constant. The conversion unit 404 generates the tampering prevention program Po by such processing and stores the tampering prevention program Po in the tampering prevention program holding unit 405. The conversion unit 404 generates the above-described mathematical expression by performing the same processing as the dependent processing instruction group generation units 201, 201a, and 201b of the first embodiment and the modifications thereof, and the second embodiment.
  • the tampering prevention program holding unit 405 acquires and holds the tampering prevention program Po generated by the conversion unit 404.
  • FIG. 35 is a flow chart showing an example of the operation of the tampering prevention process generation device 400 according to the present modification.
  • the tampering prevention process generation device 400 first selects a constant included in the restricted process of the input program Pi (step S500). Further, the tampering process generation apparatus 400 extracts the judgment variable and the restricted value of the conditional branch instruction force of the input program Pi (step S502). Then, the tampering process generation device 400 converts the constant selected in step S500 into a mathematical expression using the determination variable (step S504). Also, at this time, the tampering prevention processing generation device 400 deletes the error processing in the input program Pi so that the restricted processing is executed regardless of the determination result of the conditional branch instruction. As a result, the input program Pi is converted to the tampering prevention program Po.
  • the second processing instruction group 150 may be another processing described as the processing for decompressing compressed content. Furthermore, in the first embodiment and its modification and the second embodiment, the first processing instruction group 140 decrypts the encrypted playable number of the content and outputs the plaintext reproducible number. It may be other processing that has been described as being. That is, the application object of the present invention is limited to the group of instructions for performing the decoding process, the decompression process, etc. described in the first embodiment and its modification and the second embodiment. It can be applied to any instruction set that needs to be tampered with. For example, as an application example, There are an instruction group that manages usage rights.
  • each program or instruction group is a C language program.
  • Each may be another programming language, a modeling language such as UML, an intermediate language such as a compiler, an assembly language, a machine language or the like.
  • the object to be obfuscated is information on the design of a logic circuit such as a logic circuit description language regardless of the computer programming language. In practice, it may be a program described in a hardware description language such as VHDL. The same is true for programs obtained by obscurity. That is, the program to be obfuscated in the present invention and the program obtained by obfuscation are concepts not limited to the program described in the computer programming language, but also information on the design of the above-mentioned logic circuit.
  • Each of the above-mentioned devices is specifically a computer system comprising a microprocessor, ROM, RAM, hard disk unit, display unit, keyboard, mouse and the like.
  • the RAM or hard disk unit stores a computer program. That is, each device achieves its function by operating according to the microprocessor power computer program.
  • the computer program is configured by combining a plurality of instruction codes indicating instructions to the computer in order to achieve a predetermined function.
  • Each device is not limited to a computer system including all of microprocessor, ROM, RAM, hard disk unit, display unit, keyboard, mouse, etc. Even if there is.
  • the system LSI is a super-multifunctional LSI manufactured by integrating a plurality of components on one chip, and more specifically, is a computer system including a microprocessor, ROM, RAM, and the like. is there. A computer program is stored in the RAM. In other words, to operate according to the microprocessor power computer program Thus, the system LSI achieves its function.
  • a part or all of the constituent elements of each device described above may be configured as an IC card or a single modular module that can be attached to each device!
  • the IC card or module is a computer system including a microprocessor, ROM, and RAM.
  • the IC card or module may include the above-described ultra-multifunctional LSI. That is, by operating according to the microprocessor power computer program, the IC card or module achieves its function. This IC card or this module may be tamper resistant.
  • the present invention is also realized as a method in which the tampering prevention process generation device described above generates a tampering prevention process.
  • the present invention is also realized as a computer program that causes a computer to generate tampering prevention processing by these methods, or a digital signal that also has computer program power.
  • the present invention is also directed to a computer-readable recording medium capable of reading the computer program or digital signal described above, such as a flexible disk, hard disk, CD-ROM, MO, DVD, DVD-ROM, DVD- It is also realized as recorded on RAM / BD (Blu-ray Disc), semiconductor memory, etc. It is also realized as a digital signal recorded on these recording media.
  • a computer-readable recording medium capable of reading the computer program or digital signal described above, such as a flexible disk, hard disk, CD-ROM, MO, DVD, DVD-ROM, DVD- It is also realized as recorded on RAM / BD (Blu-ray Disc), semiconductor memory, etc. It is also realized as a digital signal recorded on these recording media.
  • the present invention provides a computer program as described above transmitted via a telecommunications line, a wireless communication line, a wired communication line, a network represented by the Internet, or data broadcasting. It is also realized as a digital signal.
  • the present invention is also realized as a computer system provided with a microprocessor and a memory.
  • the memory stores the computer program described above, and the microprocessor operates in accordance with the computer program.
  • the computer program or digital signal may be recorded on a recording medium and transported, or the computer program or digital signal may be transported independently via a network, etc.
  • the processing of the present invention may be performed by a computer system of
  • the command generation device can convert a program that handles secret information such as an encryption key into a more difficult-to-analyze program, the secret information that may cause a disadvantage if leaked to an unauthorized analyst. It is useful in devices that generate software etc. using.
  • the program generated by the instruction generation device according to the present invention is in a form that analysis by an unauthorized analyst is difficult, a process using confidential information that may cause a disadvantage if leaked to an unauthorized analyst. It can be applied to devices that execute software etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Executing Machine-Instructions (AREA)

Description

命令生成装置
技術分野
[0001] 本発明は、不正な解析および改竄を防止できるようなコンピュータプログラムを生成 する命令生成装置に関する。
背景技術
[0002] コンピュータ上で動作するプログラムの中には、不正な改竄を防止することが求めら れるプログラムがある。このようなプログラムの例は、個人情報を扱うプログラムや、著 作権管理に関わるプログラム等である。個人情報等の重要な情報を使用するプログ ラムに対し、改竄されたプログラムが流出することは脅威であり、改竄防止が望まれる 。また、著作権管理に関わるプログラムとは、例えば、コンテンツの使用回数等を管理 し、使用制限を行うプログラムであるが、このプログラムが改竄されて使用制限が回避 されることは脅威であり、改竄防止が望まれる。上記の例の他にも、ソフトウェア開発 ベンダが開発したプログラムが改造されて他社から販売される脅威や、ゲームプログ ラムが著作権者の意図に反して改造される脅威などがあり、プログラムの改竄防止技 術が望まれている。
[0003] 従来の改竄防止技術には、改竄チェックを用いたものがある。この方式では、メモリ 上のプログラムのハッシュ値 Zチェックサムを計算し、予め算出してお!、たハッシュ値
/チェックサムと等しいかを判定することにより改竄を検出する。
[0004] 図 1は、従来の改竄チェックの処理を含むプログラムを示す図である。図 1にお!/、て 、関数 flは改竄チェック対象 (保護対象)の処理命令群を示す。関数 flはコンビユー タのメモリ上に保持されて実行されるプログラムであって、メモリ上のアドレス 0300〜 0400に保持されているものとする。関数 f 2は改竄チェック処理を示す。処理命令「t mp = 0; f or (a = 0300; aく 0400; a + + ) { tmp + = * a; }」は変数 aの位置に格納 されたデータを読み込み、読み込んだ値を変数 tmpにカ卩えると 、う動作をアドレス 03 00〜0400までの間繰り返す処理 (ハッシュ計算処理)を示す。この処理によって、ァ ドレス 0300〜0400までのデータの和(チェックサム)を算出することが出来る。 [0005] 処理命令「if (tmp! =SUM) {exit () ; }」は算出したチェックサムが SUMと等しい かを判定し、真なる場合には、処理を継続し、偽なる場合には処理を終了する処理( 判定/終了処理)を示す。ここで、 SUMは、予め算出しておいた関数 flのチェックサ ムである。したがって、関数 flが改竄されていなければ、 SUMと tmpとは等しい値と なるが、関数 flが改竄されている場合には、 SUMと tmpは異なる値となる。このこと から、 SUMと tmpが等しい値になるか否かによって関数 flが改竄されている力否か を知ることが出来る。
[0006] 図 2は、従来の改竄防止処理生成装置の処理を説明するための説明図である。
[0007] 従来の改竄防止処理生成装置 (命令生成装置)は、保護対象コードを含む入力プ ログラムを取得し、その入力プログラムに対して改竄チェック処理を付加することによ り、改竄防止プログラムを生成する。保護対象コードは、上述の関数 flの処理命令群 に相当し、改竄防止プログラムは図 1に示すプログラムに相当する。
[0008] このような改竄防止プログラムがコンピュータにより実行されると、保護対象コードの ノ、ッシュ値 (チェックサム)が正しいか否かが判断され、正しくないと判断されたときに
、保護対象コードに対する改竄が検出される。
[0009] このように、従来の改竄防止処理生成装置は、入力プログラムに対して改竄チエツ ク処理を追加することにより、改竄された保護対象コードを含む入力プログラムの実 行を防止している。
[0010] 改竄チェック以外の改竄防止技術としては、プログラムの振る舞いを監視する方法 がある。特許文献 1には、予め所定の振る舞いを行う処理命令をプログラムに埋め込 み、プログラム実行時に実際のプログラムの振る舞いを監視し、埋め込んだ振る舞い が実際に行われるかを確認することでプログラムの改竄を検出する技術が記載され ている。
特許文献 1 :特開 2005— 173903号公報
発明の開示
発明が解決しょうとする課題
[0011] し力しながら、図 2に示す従来の改竄防止処理生成装置では、改竄チェック処理が 不正解析者に容易に見つけられ、改竄チェック処理が改竄されて無効化されると 、う 問題がある。
[0012] 例えば、不正解析者は、まず、改竄防止プログラムの保護対象コード(関数 fl)を改 竄し、その改竄防止プログラムを実行する。そして、不正解析者は、改竄された部分 がデータとしてアクセスされないかを監視することにより、改竄チェック処理の中のハ ッシュ計算処理を容易に見つけることができる。具体的には、改竄チェック処理を見 つけることは、指定したアドレスに対するデータとしての読み取りを監視する機能を持 つたデバッガを用いることで可能となる。すなわち、不正解析者は、保護対象コードを 改竄した後、改竄したアドレスを監視していれば、そのアドレスのデータを読み取る改 竄チェック処理の「tmp+ = * ajを見つけることができ、改竄したアドレスに対して改 竄チェック処理が行われていることを知ることができる。
[0013] そこで、不正解析者は、判定 Z終了処理の処理命令「if (tmp! =SUM) {exit (); }」を、 SUMと tmpがー致しなくとも何もしない命令「if (tmp! =SUM) { ; }」に改竄 する。これにより、改竄チェック処理自体が無効化される。
[0014] また、特許文献 1に記載の技術のようなプログラムの振る舞 、を監視する方法でも、 振る舞!/ヽを監視する処理自体が見つけられ、改竄される恐れがある。
[0015] そこで、本発明では、カゝかる問題に鑑みてなされたものであって、保護対象コードを 確実に保護し得るプログラムを生成する命令生成装置を提供することを目的とする。 課題を解決するための手段
[0016] 上記目的を達成するために、本発明に係る命令生成装置は、コンピュータに対して データを被代入変数に代入させる第一処理命令を保護するために、前記コンビユー タに実行させる複数の命令からなる出力処理命令群を生成する命令生成装置であつ て、前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一 処理命令に分岐させる分岐命令を、前記出力処理命令群の一部として生成する分 岐命令生成手段と、前記コンピュータが前記分岐命令に従って前記第一処理命令を 実行した結果を示す前記被代入変数に代入されたデータに依存し、前記データが 予め定められた内容を示す場合に、前記出力処理命令群以降に行うべき予め定め られた処理を前記コンピュータに実行させる依存処理命令を、前記出力処理命令群 の一部として生成する依存処理命令生成手段とを備えることを特徴とする。 [0017] これにより、出力処理命令群がコンピュータにより実行されると、コンピュータは分岐 命令により第一処理命令を実行するとともに、依存処理命令によりその実行結果 (被 代入変数に代入されたデータ)に依存した処理を実行する。その結果、第一処理命 令が改竄されて ヽなければ、コンピュータは依存処理命令により予め定められた処 理を実行するが、第一処理命令が改竄されていれば、コンピュータは予め定められ た処理以外の処理を実行することとなる。したがって、第一処理命令を改竄から保護 することができる。さらに、第一処理命令をデータとして読み込むことがないので、改 竄を防止しょうとしている処理(出力処理命令群)が不正解析者に見つけ出されるの を困難にすることができ、保護対象コードである第一処理命令を改竄や不正解析か ら確実に保護することができる。
[0018] また、本発明では、第一処理命令が出力処理命令群の一部として使用されることと なり、プログラム (第一処理命令など)の不正解析および改竄を防止することができ、 その価値は大きい。
[0019] また、本発明では、第一処理命令が改竄されると、出力処理命令群は定められた 処理を行わない。すなわち、第一処理命令の改竄チェックが達成できる。さらに、この 改竄チェックを回避するために第一処理命令によって代入されるデータを予め定め られた内容に強制的に合わせるような改竄が行われたとしても、第一処理命令が他 の命令群からも呼び出されている場合には、その命令群が正常に動作しなくなる。そ の結果、改竄があったことを検出できる。
[0020] また、本発明における改竄行為を困難にする方法は、従来の改竄チェック方法と異 なり、プログラムをデータとして読み込む必要がな 、ので、 Java (登録商標)等のプロ グラムをデータとして読み込むには制限がある環境でも用いることが出来、その効果 は大きい。
[0021] また、出力処理命令群を実行する際に、第一処理命令も実行されることになる。よ つて、第一処理命令は第一処理命令の機能と、出力処理命令群の機能の両方に必 要な処理であるのか、第一処理命令の機能にのみ必要な処理であるのかの解析が 困難になる。よって、第一処理命令の機能に必要な処理のみに着目し、第一処理命 令の解析をしょうとする不正解析者の解析作業を困難にすることが出来る。 [0022] ここで、前記依存処理命令生成手段は、前記コンピュータに対して予め定められた 処理を実行させる第二処理命令を取得して前記依存処理命令に変換することによつ て前記依存処理命令を生成し、前記依存処理命令は、前記第一処理命令が実行さ れた結果を示す前記被代入変数に代入された値が、予め定められた想定値を示す 場合に、前記第二処理命令の実行結果と同じ実行結果を前記コンピュータに導出さ せることを特徴としてもよい。
[0023] これにより、命令生成装置が第二処理命令を取得すると、その第二処理命令を依 存処理命令に難読ィ匕することができ、第一処理命令を確実に保護することができる。
[0024] また、本発明では、定められた処理を行う出力処理命令群 (第二処理命令の処理 に相当)を実行する際に、第一処理命令も実行される。よって、定められた処理を解 析する際に、不正解析者は、出力処理命令群と第一処理命令の両方を解析しなけ ればならなくなり、不正解析をさらに困難にすることができる。
[0025] ここで、前記命令生成装置は、さらに、前記第一処理命令を使用しない前記第二 処理命令と、前記第一処理命令を用いて前記第二処理命令とは異なる処理を前記 コンピュータに実行させる第三処理命令とを含む入力プログラムを取得する取得手 段と、前記入力プログラムの前記第二処理命令が前記依存処理命令生成手段によ つて変換されて生成された前記依存処理命令を含む前記出力処理命令群と、前記 第三処理命令とを含む出力プログラムを出力する出力手段とを備えることを特徴とし てもよい。
[0026] これにより、第二処理命令を含むプログラムを難読ィ匕することができる。また、難読 ィ匕後のプログラムでは、元々は必要なカゝつた第一処理命令の処理が追加して実行さ れるが、第一処理命令は、他の目的にも使われる命令なのでコードサイズの増加を 押さえることが出来る上、第一処理命令の実行が実際には、改竄チェックを行うため の処理であることを隠蔽することができる。
[0027] ここで、前記命令生成装置は、さらに、予め定められた条件に従って前記第一処理 命令により前記被代入変数に代入される値を前記想定値として算出する想定値算出 手段を備え、前記依存処理命令生成手段は、前記第一処理命令が実行された結果 を示す前記被代入変数に代入された値が、前記想定値算出手段により算出された 想定値を示す場合に、前記第二処理命令の実行結果と同じ実行結果を前記コンビ ユータに導出させる前記依存処理命令を生成することを特徴としてもよい。例えば、 前記命令生成装置は、さらに、前記コンピュータが前記第一処理命令を実行する際 に、前記コンピュータに対して、前記第一処理命令で参照される被参照変数に値を 代入させる被参照代入処理命令を、前記出力処理命令群の一部として生成する被 参照代入処理生成手段を備え、前記想定値算出手段は、前記被参照変数に代入さ れる値を前記条件として扱い、前記被参照変数の値に従って前記第一処理命令に より前記被代入変数に代入される値を前記想定値として算出する。
[0028] これにより、コンピュータが第一処理命令を実行するときに参照される被参照変数 の値と、想定値算出手段が想定値を算出するときに条件とされる被参照変数の値と が等しいため、第一処理命令が改竄されていなければ、コンピュータが第一処理命 令を実行した結果を示す被代入変数の値と想定値とを等しくすることができる。その 結果、被代入変数の値と想定値とが異なっていれば、第一処理命令が改竄されてい ると判断でき、第二処理命令の実行結果と同じ実行結果をコンピュータに導出させな いようにすることがでさる。
[0029] また、コンピュータが第一処理命令を実行するときに参照される被参照変数の値と 、想定値算出手段が想定値を算出するときに条件とされる被参照変数の値とが等し ければよいため、被参照変数の値を固定値でなく任意の値にすることができる。
[0030] ここで、前記命令生成装置は、さらに、前記第一処理命令で参照される被参照変 数を特定する被参照特定手段を備え、前記被参照代入処理生成手段は、前記コン ピュータに対して、前記被参照特定手段により特定された被参照変数に値を代入さ せる前記被参照代入処理命令を生成することを特徴としてもよい。
[0031] これにより、被参照特定手段 (被参照変数解析部)が被参照変数を特定するため、 第一処理命令に含まれる被参照変数がどれである力をユーザが指定することなぐ 被参照代入処理命令 (被参照変数値代入処理命令群)を生成することが出来る。
[0032] ここで、前記命令生成装置は、さらに、前記被参照変数に代入される値の候補とな る複数の値を、被参照変数値の集合として保持する値保持手段を備え、前記被参照 代入処理生成手段は、前記被参照変数値の集合に含まれる何れかの値を前記被参 照変数に代入させる前記被参照代入処理命令を生成することを特徴としてもよい。 例えば、前記想定値算出手段は、前記被参照変数値の集合に含まれる各値に従つ て前記第一処理命令により前記被代入変数に代入される値の集合を、想定値の集 合として算出し、前記依存処理命令生成手段は、前記被参照変数値の集合と前記 想定値の集合とを用いて前記依存処理命令を生成し、前記依存処理命令は、前記 第一処理命令が実行された結果を示す前記被代入変数の値が、前記想定値の集合 に含まれる値である場合に、前記第二処理命令の実行結果と同じ実行結果を前記コ ンピュータに導出させる。
[0033] これにより、被参照変数に格納される値を、前記出力処理命令が実行されるごとに 異ならせることができる。その結果、出力処理命令群が第一処理命令を保護するた めにあることが不正解析者に解明されるのをより困難にすることができる。
[0034] ここで、前記依存処理命令は、前記コンピュータに対して、前記被代入変数に代入 された値を、予め定められた想定値と比較させ、前記被代入変数の値が前記想定値 と等しいときには、予め定められた処理を前記コンピュータに実行させ、前記被代入 変数の値が前記想定値と異なるときには、前記予め定められた処理の実行を前記コ ンピュータに抑制させることを特徴としてもよい。
[0035] これにより、第一処理命令が改竄された結果、被代入変数の値が想定値と異なると きには、コンピュータに対してエラー処理を実行させることができ、第一処理命令の改 竄検出を行うことができる。
[0036] ここで、前記命令生成装置は、さらに、前記第一処理命令に含まれる前記被代入 変数を特定する被代入特定手段を備え、前記依存処理命令生成手段は、前記被代 入特定手段により特定された前記被代入変数に代入されたデータに依存した処理を 前記コンピュータに実行させる前記依存処理命令を生成することを特徴としてもよい
[0037] これにより、被代入特定手段 (被代入変数解析部)が被代入変数を特定するため、 第一処理命令に含まれる被代入変数がどれである力をユーザが指定することなぐ 依存処理命令を生成することが出来る。
[0038] ここで、前記命令生成装置は、さらに、前記第一処理命令、前記第一処理命令の 分岐元となる第一先行命令、前記第一処理命令の分岐先となる第一後続命令、第 一後続命令の分岐先となる第二処理命令、および前記第二処理命令の分岐先とな る第二後続命令を含む入力プログラムを取得する取得手段と、第一の条件が満たさ れて ヽる場合と第二の条件が満たされて ヽる場合とで、前記第一処理命令の分岐先 が異なるように、前記処理経路を前記第一処理命令から他の命令に分岐させる条件 分岐命令を生成する条件分岐命令生成手段と、前記第一処理命令、前記第一先行 命令、前記第一後続命令、および前記第二処理命令を含む出力プログラムを出力 する出力手段とを備え、前記依存処理命令生成手段は、前記被代入変数のデータ が予め定められた内容を示す場合に、前記第二後続命令と同一の実行結果を前記 コンピュータに導出させる前記依存処理命令を生成し、前記分岐命令生成手段は、 前記コンピュータが前記第二処理命令を実行した後に再び前記第一処理命令を実 行するように、処理経路を前記第二処理命令力 前記第一処理命令に分岐させる前 記分岐命令を生成し、前記条件分岐命令生成手段は、前記第一の条件が満たされ ている場合には、前記処理経路を前記第一処理命令から前記第一後続命令に分岐 させ、前記第二の条件が満たされている場合には、前記処理経路を前記第一処理 命令から前記依存処理命令に分岐させる前記条件分岐命令を生成し、前記出力手 段は、前記依存処理命令、前記分岐命令、および前記条件分岐命令を含む前記出 力プログラムを出力し、前記第一の条件は、前記第一処理命令が前記コンピュータ に実行されたときに、前記第一処理命令の実行の直前に前記第一先行命令が実行 されていることであり、前記第二の条件は、前記第一処理命令が前記コンピュータに 実行されたときに、前記第一処理命令の実行の直前に前記第二処理命令が実行さ れて 、ることであることを特徴としてもよ!/、。
これにより、入力プログラムにおいて第二処理命令と第二後続命令との間で実行さ れることがない第一処理命令力 出力プログラム(改竄防止プログラム)においては第 二処理命令と第二後続命令との間で実行されることがある。すなわち、出力プロダラ ムにおいて、第一処理命令は、入力プログラムにおける実行順序とは異なる実行順 序でも実行されることとなる。その結果、入力プログラムを難読ィ匕することができ、不 正解析者が出力プログラムを実際に動かして解析を行っても、入力プログラムの実行 順序や前後関係を解析することが困難になる。
[0040] さらに、前記入力プログラムには、複数の前記第一後続命令が含まれており、前記 条件分岐命令生成手段は、前記第一の条件が満たされている場合には、前記第一 処理命令が実行された後に、前記複数の第一後続命令のうち第三の条件に応じた 1 つの第一後続命令が分岐先第一後続命令として実行されるように、前記処理経路を 前記第一処理命令から前記分岐先第一後続命令に分岐させる前記条件分岐命令 を生成することを特徴としてもょ 、。
[0041] これにより、第一処理命令の分岐先として、依存処理命令と複数の第一後続命令と が混在することになるので、それらの命令が、第一処理命令と第二処理命令とのどち らから分岐して実行されるものであるかを解析し難くすることができる。
[0042] また、前記第三の条件は、変数に代入される値であり、前記条件分岐命令生成手 段は、前記第一の条件が満たされている力否かを示す変数の値と、前記第二の条件 が満たされている力否かを示す変数の値とに基づいて前記処理経路を分岐させる前 記条件分岐命令を生成することを特徴としてもょ ヽ。
[0043] これにより、第一の条件または第二の条件が満たされているかの確認に使われる変 数と、第三の条件に利用される変数との区別が困難になるので、各条件がどの変数 に基づ!/、て 、るのかを分力り難くすることができ、各条件の解析を困難にすることが できる。
[0044] また、前記入力プログラムには、複数の前記第二後続命令が含まれてあり、前記依 存処理命令は、前記複数の第二後続命令をそれぞれ前記依存処理命令に変換し、 前記条件分岐命令生成手段は、前記第二の条件が満たされている場合には、前記 第一処理命令が実行された後に、前記複数の依存処理命令のうち第四の条件に応 じた 1つの依存処理命令が分岐先依存処理命令として実行されるように、前記処理 経路を前記第一処理命令から前記分岐先依存処理命令に分岐させる前記条件分 岐命令を生成することを特徴としてもょ 、。
[0045] これにより、第一処理命令の分岐先として、複数の依存処理命令と第一後続命令と が混在することになるので、それらの命令が、第一処理命令と第二処理命令とのどち らから分岐して実行されるものであるかを解析し難くすることができる。 [0046] さらに、前記第四の条件は、変数に代入される値であり、前記条件分岐命令生成 手段は、前記第一の条件が満たされているか否かを示す変数の値と、前記第二の条 件が満たされているか否かを示す変数の値とに基づいて前記処理経路を分岐させる 前記条件分岐命令を生成することを特徴としてもょ ヽ。
[0047] これにより、第一の条件または第二の条件が満たされているかの確認に使われる変 数と、第四の条件に利用される変数との区別が困難になるので、各条件がどの変数 に基づ!/、て 、るのかを分力り難くすることができ、各条件の解析を困難にすることが できる。
[0048] また、前記命令生成装置は、さらに、前記入力プログラムで使用されて 、な 、追カロ 変数を生成する変数生成手段と、前記第一の条件が満たされる場合に、前記コンビ ユータに対して、前記追加変数に第一条件値を代入させる第一条件値代入命令を 生成し、前記第二の条件が満たされる場合に、前記コンピュータに対して、前記追加 変数に第二条件値を代入させる第二条件値代入命令を生成する条件値代入命令 生成手段とを備え、前記条件分岐命令生成手段は、前記追加変数に代入されてい る値が前記第一条件値であるときには、前記処理経路を前記第一処理命令から前 記第一後続命令に分岐させ、前記追加変数に代入されている値が前記第二条件値 であるときには、前記処理経路を前記第一処理命令から前記第依存処理命令に分 岐させる条件分岐命令を生成することを特徴としてもょ 、。
[0049] これにより、第一の条件または第二の条件が満たされる力否かの確認に用いられる 追加変数が、入力プログラム中に含まれる変数ではないので、第一の条件または第 二の条件の判定のために、追加変数に値が代入されても入力プログラムが行うべき 処理の実行に影響が出ないことを保証することができる。
[0050] また、前記第二後続命令および前記依存処理命令は、前記第二処理命令が実行 された時点にぉ 、て得られて 、る実行結果を使用して、互いに同等の処理を前記コ ンピュータに実行させる命令であって、前記命令生成装置は、さらに、前記第二処理 命令が実行された時点にぉ 、て得られて 、る実行結果を、前記第一処理命令が実 行される前に退避させる退避命令を生成する退避命令生成手段と、前記第一処理 命令が再び実行された後に、退避された実行結果を復帰させる復帰命令を生成する 復帰命令生成手段とを備えることを特徴としてもょ ヽ。
[0051] これにより、出力プログラムにおいて第一処理命令が第二処理命令と依存処理命 令との間に割り込んでも、依存処理命令処理以降の実行結果が、入力プログラムに おける第二後続処理命令以降の実行結果と同一となることを保証することができる。
[0052] また、前記命令生成装置は、さらに、前記第一処理命令、前記第一先行命令、およ び前記第二処理命令のうち少なくとも 1つの命令を、当該命令に等価な命令に変換 する変換手段を備え、前記出力手段は、前記変換手段によって変換された命令を、 当該命令に対応する変換前の命令の代わりに前記出力プログラムに含めて出力す ることを特徴としてもよい。つまり、本発明の命令または命令群には、その命令または 命令群そのものだけでなぐそれらを本発明と異なる他の難読化手法により難読化し て得られる等価な命令も含まれる。
[0053] これにより、出力プログラムでは、入力プログラムの少なくとも 1つの命令が、その命 令に等価な命令に置き換えられているため、入力プログラムの命令と出力プログラム の命令との対応関係を分力り難くすることができる。つまり、入力プログラムに対する 難読ィ匕の程度を増すことができ、出力プログラムの解析をより困難にすることができる
[0054] また、前記分岐命令生成手段は、前記第一処理命令が API (Application Program I nterface)を含むときには、前記 APIと同一の APIを呼び出す命令を前記第二後続命 令として検索し、前記第二後続命令の分岐元となる前記第二処理命令から前記第一 処理命令に処理経路を分岐させる前記分岐命令を生成することを特徴としてもよい。
[0055] これにより、第一処理命令の APIと同一の APIを呼び出す命令が第二後続命令と されるため、第一処理命令を、被代入変数のデータに依存した依存処理命令に容易 に変換することができ、上述と同様、第一処理命令を改竄や不正解析から確実に保 護することができる。
[0056] また、前記命令生成装置は、さらに、前記第一処理命令を含む入力プログラムを取 得する取得手段と、前記分岐命令生成手段および前記依存処理命令生成手段によ つて生成された前記分岐命令および前記依存処理命令を前記入力プログラムに追 加することにより、前記第一処理命令、前記分岐命令および前記依存処理命令を含 む出力プログラムを生成して出力する出力手段とを備えることを特徴としてもよい。
[0057] これにより、入力プログラムを出力プログラムに変換して、出力プログラムに含まれる 第一処理命令を確実に保護することができる。
[0058] また、本発明に係る命令生成装置によって生成される出力プログラムは、第一の機 能に対応する第一処理命令と、第二の機能に対応する第二処理命令と、コンビユー タが第二処理命令を実行する際に、第二の機能には不要である第一処理命令を冗 長処理としてコンピュータに実行させる分岐命令とを含むことを特徴とする。
[0059] これにより、第二処理命令による処理では本来不要な第一処理命令による処理力 第二処理命令による処理でも行われるので、第一処理命令による処理がどの機能の 実現に必要であり、どの機能に不要なのかを解析することを困難にすることができる。
[0060] また、本発明は、このような命令生成装置として実現することができるだけでなぐそ の出力処理命令群を生成する処理生成方法や、パーソナルコンピュータ等にその出 力処理命令群を生成させるためのプログラム、そのプログラムを記録した記録媒体、 または、その出力処理命令群を生成する集積回路としても実現することができる。こ の場合も、命令生成装置と同様の効果が得られることは言うまでもない。
発明の効果
[0061] 本発明に係る命令生成装置は、保護対象コードを確実に保護し得るプログラムを 生成することができるという作用効果を奏する。
図面の簡単な説明
[0062] [図 1]図 1は、従来の改竄チェックの処理を含むプログラムを示す図である。
[図 2]図 2は、従来の改竄防止処理生成装置の処理を説明するための説明図である
[図 3]図 3は、本発明の実施の形態 1における処理システムの構成を示す図である。
[図 4]図 4は、同上の出力処理命令群の構成を示す図である。
[図 5A]図 5Aは、 C言語で記述された第一処理命令群の具体例を示す図である。
[図 5B]図 5Bは、 C言語で記述された第二処理命令群の具体例を示す図である。
[図 5C]図 5Cは、 C言語で記述された出力処理命令群の具体例を示す図である。
[図 6]図 6は、同上の改竄防止処理生成装置の構成を示す図である。 [図 7]図 7は、同上の改竄防止処理生成装置の動作を示すフローチャートである。
[図 8]図 8は、同上の改竄防止処理生成装置の効果を説明するための説明図である
[図 9]図 9は、同上の変形例 6に係る改竄防止処理生成装置によって生成された出力 処理命令群の具体例を示す図である。
[図 10:図 10は、同上の変形例 6に係る改竄防止処理生成装置の構成を示す図であ る。
圆 11図 11は、本発明の実施の形態 2における処理システムの構成を示す図である 圆 12図 12は、同上の出力処理命令群の構成を示す図である。
圆 13図 13は、同上の C言語で記述された出力処理命令群の具体例を示す図であ る。
[図 14:図 14は、同上の改竄防止処理生成装置の構成を示す図である。
圆 15図 15は、同上の改竄防止処理生成装置の効果を説明するための説明図であ る。
[図 16:図 16は、本発明の実施の形態 3における処理システムの構成を示す図である
[図 17:図 17は、同上の入力プログラムの構成を示す図である。
[図 18:図 18は、同上の C言語における入力プログラムの具体的な一例を示す図であ る。
[図 19:図 19は、同上の改竄防止プログラムの構成を示す図である。
圆 20:図 20は、同上の C言語で表した改竄防止プログラムの具体的な一例を示す図 である
圆 21図 21は、同上の入力プログラムの処理の流れを示す図である。
[図 22図 22は、同上の改竄防止プログラムの処理の流れを示す図である。
[図 23図 23は、同上の改竄防止処理生成装置の構成を示す図である。
[図 24:図 24は、同上の改竄防止処理生成装置の動作を示すフローチャートである。 圆 25図 25は、同上の変形例に係る改竄防止プログラムの構成を示す図である。 [図 26]図 26は、同上の変形例に係る C言語で表した改竄防止プログラムの具体的な 一例を示す図である。
[図 27]図 27は、同上の変形例に係る改竄防止プログラムの処理の流れを示す図で ある。
[図 28]図 28は、同上の変形例に係る改竄防止処理生成装置が改竄防止プログラム を生成する動作を説明するための説明図である。
[図 29]図 29は、同上の変形例に係る改竄防止処理生成装置が、 APIを含む改竄防 止プログラムを生成する動作を説明するための説明図である。
[図 30]図 30は、本発明の第一処理命令群が実行処理装置に元々含まれている場合 における効果を説明するための説明図である。
[図 31]図 31は、本発明の A命令群が特徴的演算を含む場合における効果を説明す るための説明図である。
[図 32]図 32は、不正解析者による改竄の例を示す図である。
[図 33]図 33は、本発明の実施の形態 1〜3の変形例に係る改竄防止処理生成装置 が依存ィ匕のみを行う例を示す図である。
[図 34]図 34は、同上の変形例に係る改竄防止処理生成装置の構成の一例を示す 図である。
[図 35]図 35は、同上の変形例に係る改竄防止処理生成装置の動作の一例を示すフ ローチャートである。 符号の説明
100, 100b, 1300 処理システム
101, 101b, 1310, Pi 入力プログラム
102, 102b, 1330, 1330a, Po 改竄防止プログラム
110, 110a, 110b, 1320, 400 改竄防止処理生成装置
120, 120b, 1350 記録媒体
130, 130b, 1340 実行処理装置
140, 140b 第一処理命令群
150 第二処理命令群 160, 160a, 160b 出力処理命令群
210 入力処理命令群保持部
220 被参照変数解析部
230 被参照変数情報保持部
240, 240a 被参照変数値代入処理命令群生成部
250 被参照変数値代入処理命令群保持部
260, 260a 被参照変数値保持部
270 被代入変数解析部
280 被代入変数情報保持部
290, 290a 想定値算出部
295, 295a 想定値情報保持部
201 依存処理命令群生成部
202 依存処理命令群保持部
203 分岐処理命令群生成部
204 分岐処理命令群保持部
205 出力処理命令群生成部
206 出力処理命令群保持部
310, 310a, 310b, 2210 被参照変数値代入処理命令群
320, 320a, 320b 分岐処理命令群
330, 330a, 330b, 2220 依存処理命令群
1410 PRE— A命令群
1420 A命令群
1430 SUC— A命令群
1440 B命令群
1450 SUC— B命令群
1610 CBR— AB条件分岐命令群
1620 STR— A変数群値代入命令群
1630 STR— B変数群値代入命令群 1640 退避命令群
1650 復帰命令群
1660 BR— B分岐命令群
2010 入力部
2020 入力プログラム保持部
2030 被代入変数解析部
2040 被代入変数情報保持部
2050 被退避変数解析部
2060 被退避変数情報保持部
2070 退避命令群生成部
2080 退避命令群保持部
2090 復帰命令群生成部
2091 復帰命令群保持部
2092 条件分岐命令群生成部
2093 分岐条件保持部
2094 条件分岐命令群保持部
2095 変数群値代入命令群生成部
2096 変数群代入命令群保持部
2097 分岐命令群生成部
2098 分岐命令群保持部
2099 改竄防止プログラム生成部
2100 改竄防止プログラム出力部
発明を実施するための最良の形態
[0064] 以下、本発明に係る命令生成装置および命令生成方法につ!、て図面を参照して 説明する。なお、以下の各実施の形態および各変形例では、本発明に係る命令生 成装置を改竄防止処理生成装置として説明する。
[0065] (実施の形態 1)
本発明に関わる実施の形態 1における処理システムにつ 、て説明する。 [0066] 図 3は、実施の形態 1における処理システムの構成を示す図である。
[0067] 本実施の形態における処理システム 100は、改竄防止処理生成装置 (命令生成装 置) 110と、実行処理装置 130とを備える。
[0068] 改竄防止処理生成装置 110は、保護対象コードを確実に保護し得るプログラムを 生成する装置であって、保護対象コードである第一処理命令群 140と第二処理命令 群 150とを取得して、出力処理命令群 160を生成する。なお、改竄防止処理生成装 置 110は、第二処理命令群 150を難読化して出力処理命令群 160を生成する難読 化装置として構成されている。なお、特に断らない限り、本明細書および本発明にお ける命令群とは、複数の命令が含まれるものに限らず、命令が 1つだけのものも含む ものとする。
[0069] また、改竄防止処理生成装置 110は、その生成された出力処理命令群 160と第一 処理命令群 140とを記録媒体 120に書き込む。
[0070] 実行処理装置 130は、記録媒体 120に記録されている第一処理命令群 140およ び出力処理命令群 160を読み出して実行する。
[0071] なお、改竄防止処理生成装置 110は、第一処理命令群 140および出力処理命令 群 160を記録媒体 120に書き込むことなぐ通信媒体を介して実行処理装置 130に 送信してちょい。
[0072] 以下、それぞれの構成要素について説明を行う。
[0073] 第一処理命令群 140は、実行処理装置 130で実行される処理命令群であって、出 力処理命令群 160の処理の一部として実行される場合もあれば、それとは別に実行 される場合ちある。
[0074] 第二処理命令群 150は、実行処理装置 130に所定の処理を指示する命令を含ん だ処理命令群である。
[0075] 以下、本実施の形態では、第一処理命令群 140は、コンテンツの暗号ィ匕された再 生可能回数を入力とし、これを復号し、平文の再生可能回数を出力する処理を指示 する命令群であるものとして説明を行う。また、本実施の形態では、第二処理命令群 150は圧縮されたコンテンツを入力とし、これを解凍し、出力する処理を指示する命 令群であるものとして説明を行う。 [0076] 出力処理命令群 160は、第二処理命令群 150を難読化した命令群であり、処理の 途中で第一処理命令群 140を呼び出して使用する構成となっている。すなわち、実 行処理装置 130で出力処理命令群 160が実行される場合、最初は出力処理命令群 160に含まれる命令群が実行され、途中で第一処理命令群 140が呼び出されて実 行され、次にまた出力処理命令群 160の続きの処理命令群が実行される。
[0077] 以下、出力処理命令群 160の詳細を説明する。
[0078] (1)出力処理命令群 160の構成
図 4は、出力処理命令群 160の構成を示す図である。
[0079] 出力処理命令群 160は、第一処理命令群 140を呼び出して実行する際に必要とな る各種パラメータに値を設定する被参照変数値代入処理命令群 310と、第一処理命 令群 140を呼び出す分岐処理命令群 320と、第一処理命令群 140を呼び出した後 に実行される依存処理命令群 330とからなる。実行処理装置 130で出力処理命令群 160が実行される場合、被参照変数値代入処理命令群 310、分岐処理命令群 320 、第一処理命令群 140、依存処理命令群 330の順に各処理命令群が実行される。
[0080] 以下、それぞれを説明する。
[0081] (1. 1)被参照変数値代入処理命令群 310
被参照変数値代入処理命令群 310は、第一処理命令群 140を呼び出して実行す る際に必要となる各種パラメータに値を設定する処理である。具体的には、例えば、 第一処理命令群 140が関数である場合には、被参照変数値代入処理命令群 310は 、関数の引数に値を代入する命令群である。また、例えば、第一処理命令群 140が 外部変数を参照する命令群であれば、被参照変数値代入処理命令群 310は、外部 変数に値を代入する命令群である。また、例えば、第一処理命令群 140がスタックの 値を参照する命令群であれば、被参照変数値代入処理命令群 310は、スタックに値 を格納する命令群である。また、例えば、第一処理命令群 140がアドレス変数で指定 した位置に格納された値を参照する命令群であれば、被参照変数値代入処理命令 群 310は、その参照されるアドレス変数に値を格納する命令群である。
[0082] これらの第一処理命令群 140を実行する際に必要となる各種パラメータのことを以 降の説明では総称して、被参照変数と呼ぶものとする。 [0083] (1. 2)分岐処理命令群 320
分岐処理命令群 320は第一処理命令群 140に分岐する処理命令群である。具体 的には、例えば、第一処理命令群 140が関数であるならば、分岐処理命令群 320は 関数コール命令であり、第一処理命令群 140がサブルーチンであるならば、分岐処 理命令群 320はサブルーチンコール命令である。また、第一処理命令群 140が処理 命令群の集まりであるならば、分岐処理命令群 320は分岐命令であり、第一処理命 令群 140が例外処理ならば、分岐処理命令群 320は例外を発生させる処理命令で ある。より具体的には、分岐処理命令群 320は、例えばアセンブリ言語の命令では、 「CALL、 RET」のような関数コールや「JA、 JMP、 LOOP」などのジャンプ命令、「IN Tjなどの割り込み命令である。
[0084] (1. 3)依存処理命令群 330
依存処理命令群 330は、第一処理命令群 140を呼び出した後に実行される処理 命令群であり、第二処理命令群 150と同等の処理を行うプログラム命令群である。第 二処理命令群 150そのものと異なる点は、第二処理命令群 150の一部の処理力 第 一処理命令群 140の処理結果を使用した処理に置き換えられている点である。置き 換えの詳細は改竄防止処理生成装置 110の説明の際に述べるものとし、ここでは置 き換えの概要を説明する。
[0085] まず、第一処理命令群 140の処理結果とは、具体的には、例えば、第一処理命令 群 140が関数である場合には、関数の戻り値である。また、例えば、第一処理命令群 140が外部変数に値を設定する処理であるならば、第一処理命令群 140の処理結 果とは、外部変数に代入された値である。また、例えば、第一処理命令群 140がスタ ックに値を格納する処理であれば、第一処理命令群 140の処理結果とは、スタックに 格納された値である。また、例えば、第一処理命令群 140がアドレス変数で指定した 位置に値を格納する処理であれば、第一処理命令群 140の処理結果とは、その格 納された値である。これらの第一処理命令群 140の処理結果が格納される格納先の ことを、以降の説明では被代入変数と呼ぶものとする。
[0086] 第一処理命令群 140の処理結果を予め知ることは一般には出来ないが、第一処理 命令群 140を実行する際に必要となる各種パラメータの値が被参照変数値代入処理 命令群 310で設定される時に限っては、処理結果の値を予め知ることができる。具体 的には、例えば、被参照変数値代入処理命令群 310が設定する値を実際に被参照 変数に設定した上で、第一処理命令群 140を実行すれば、処理結果の値を知ること ができる。以降の説明では、この値を想定値と呼ぶものとする。
[0087] 依存処理命令群 330は、被代入変数の値が想定値である場合には、前記第二処 理命令群と同じ処理を行う命令群である。また、望ましくは、被代入変数の値が想定 値でな 、場合には、前記第二処理命令群とは異なる処理をする命令群であるとょ ヽ 。具体的には、例えば、第二処理命令群が「a = a * 5 ;」で、被代入変数「b」の想定 値が「5」である場合に、第二処理命令群を「a = a * b;」に置き換えたものが依存処 理命令群となる。
[0088] (1. 4)処理命令群の具体例
図 5Aは、 C言語で記述された第一処理命令群 140の具体例を示す図である。また 、図 5Bは、 C言語で記述された第二処理命令群 150の具体例を示す図である。また 、図 5Cは、 C言語で記述された出力処理命令群 160の具体例を示す図である。なお 、以降の説明では、「*」、「〜」、「 I」、「'」、「くく」、「> >」等の演算子を用いるが 、処理命令群の説明で用いるこれらの演算子は特に断りのない場合、 C言語におけ る演算子を示す。また、以下の説明では、各処理命令群には、関数宣言や変数宣言 力 言語の言語形式にしたがって追加されて 、るが、この言語形式にっ 、ては公知 であるので説明を省略する。
[0089] 第一処理命令群 140は、図 5Aに示すように、暗号ィ匕されたコンテンツの再生回数「 encryptedDataJ (被参照変数)を入力して復号ィ匕することにより、コンテンツの再生 回数「plainData」(被代入変数)を出力する処理を含む命令群である。ここでは、簡 単のために、暗号ィ匕されたコンテンツの再生回数と、秘密情報「0x00FF」との排他 論理和を取る処理「plainData = encryptedData"OxOOFF」を、復号化の処理とし ている。なお、「0x00FF」における頭の「0x」は「00FF」が 16進数であることを示して いる。
[0090] ここで、「plainData」および「encryptedData」はそれぞれ「OxOOOO〜OxFFFF」 までの値を取る 16ビットの値とする。また、 plainDataは 2進数表記したときに最上位 ビットが 1である場合は負の値を示すものとする。すなわち「0x8000〜0xFFFF」ま での値は負数を示す。
[0091] 第二処理命令群 150は、図 5Bに示すように、圧縮されたコンテンツデータ「compr essedData」を入力して解凍することにより、コンテンツデータ「decompressedData 」を出力する処理を含む命令群である。ここでは、簡単のために、圧縮されたコンテン ッデータ「compressedData」の値の数だけ 1が連続する 2進数を出力する処理を、 解凍の処理とする。この処理は、図 5Bに示すように、命令群「for (counter=0 ; cou nter ^ compresseaData; counter + +) {、decompressedData = decompresse dData< < l) | 0x0001; }」として表される。
[0092] ここで、「compressedData」は 0〜31までの値を取るものとし、「decompressedD ata」は 32ビットの値とする。「decompressedData」は、「compressedData」力 S「0」 の時は、「0x00000000」となり、「compressedData」力 1」の時は、「0x0000000 1」となり、「compressedData」が「31」の時は、「0xFFFFFFFF」となる。
[0093] 出力処理命令群 160は、図 5Cに示すように、第二処理命令群 150と同じ解凍処理 を行う処理命令群である。この出力処理命令群 160は、第二処理命令群 150が改竄 防止処理生成装置 110によって難読ィ匕された後の命令群である。改竄防止処理生 成装置 110の詳細にっ 、ては後述する。
[0094] 被参照変数値代入処理命令群 310である「encryptedData=0xF022;」は、第 一処理命令群 140を呼び出す際の弓 I数に値を代入する処理であり、被参照変数「e ncryptedData」に値「0xF022」を代入する処理を示して 、る。
[0095] 分岐処理命令群 320である「plainData = decrypt (encryptedData);」は、引数 を被参照変数「encryptedData」として第一処理命令群 140を呼び出す処理を示し 、第一処理命令群 140の処理結果を被代入変数「plainData」に格納する。実行処 理装置 130において、分岐処理命令群 320が正常に実行された場合の戻り値の想 定値は、被参照変数「encryptedData」を値「0xF022」として第一処理命令群 140 の処理を行った際の結果である「0xF022'0x00FF = 0xF0DD」となる。
[0096] 依存処理命令群 330は、第二処理命令群 150と同等の処理を行う処理を示す。た だし、この処理では、第二処理命令群 150とは異なり、第一処理命令群 140の処理 結果である「plainData」を用いた処理が含まれる。
[0097] 具体的に、依存処理命令群 330は、「for (counter=0 ; counter< compressed Data; counter + +) {decompressedData= (aecompressedData^ 1) | ΐ ainData— OxFODC) ; }」として表される。
[0098] 上記の処理において、「plainData」の値力 先述の想定値「0xF0DD」である場合 、「(plainData— 0xF0DC)」は値「0x001」となる。これは、第二処理命令群 150の 対応箇所と同一の値であるので、「plainData」が想定値になっていれば、依存処理 命令群 330は第二処理命令群 150と同等の処理を行う。また、「plainData」の値が 想定値と異なって 、た時には、「(plainData— OxFODC)」の値は「0x001」とは異 なる値となるため、第二処理命令群 150と同等の処理が行われなくなる。
[0099] (1. 5)出力処理命令群 160の効果
実施の形態 1の出力処理命令群 160は、第一処理命令群 140を実行する際に必 要となる各種パラメータに値を設定する被参照変数値代入処理命令群 310と、第一 処理命令群 140を呼び出す分岐処理命令群 320と、第一処理命令群 140を呼び出 した後に実行される依存処理命令群 330とからなる。ここで、改竄防止処理生成装置 110による変換が行われて 、な 、第二処理命令群 150では第一処理命令群 140を 呼び出さないにも関わらず、変換後の命令群である出力処理命令群 160では第一 処理命令群 140を呼び出すための処理が追加されている。
[0100] このような構成を用いれば、実行処理装置 130で出力処理命令群 160を実行する 際に、出力処理命令群 160が目的としている処理 (上記の実施の形態では解凍処理 )には本来不要なはずの第一処理命令群 140 (上記の実施の形態では復号処理)も 実行されることになる。よって、第一処理命令群 140は複数の処理に必要な機能であ るの力、単数の処理に必要な機能であるかの解析が困難になる。具体的には、上記 の例では、第一処理命令群は、復号に必要な処理であり、本来は解凍には不要な処 理であった。しかし、出力処理命令群 160では、第一処理命令群 140は復号と解凍 との両方に必要な処理となる。よって、復号のみに必要な処理を解析することで復号 処理に含まれる秘密情報を解析しょうとする不正解析者の解析作業を困難にするこ とが出来る。 [0101] さら〖こ、実行処理装置 130では、出力処理命令群 160を実行する際に、第一処理 命令群 140も実行されることとなる。よって、出力処理命令群 160を解析しょうとする 不正解析者が解析しな 、と 、けな 、処理が、第二処理命令群 150と比べて増加する 。従来からも、元々の処理に他の処理を追加して、不正解析者が解析しなければな らな 、処理を増加させる難読ィ匕は行われて 、たが、その際には追加する処理のプロ グラムサイズが増大するという問題があった。しかし、出力処理命令群 160は、実行 処理装置 130において他の用途で使用される第一処理命令群 140を呼び出すため の命令群を追加して 、るのみであるので、プログラムサイズをほとんど増大させずに、 不正解析者が解析しなければならない処理を増大させることができる。
[0102] なお、発明の本質ではないので特に詳細に説明していないが、実施の形態 1の復 号処理を行う第一処理命令群 140は、解凍処理を行う第二処理命令群 150以外の 命令群からも呼ばれる処理である(むしろ、本来は第二処理命令群 150以外から呼 ばれるべき処理である)ことは言うまでもない。ここで、第一処理命令群 140を本来呼 び出すべき命令群は、第一処理命令群 140と同一のプログラムに含まれる命令群で あってもよいし、第一処理命令群 140がライブラリ等である場合は、異なるプログラム カゝら呼び出されてもよい。また、第一処理命令群 140と第二処理命令群 150が同一 のプログラムに含まれて 、てもよ 、し、上述のように第一処理命令群 140がライブラリ 等である場合は異なるプログラムに含まれていてもよい。ここで、同一のプログラムに 含まれる場合、上述したようにプログラムサイズを増大させないためには、そのプログ ラムは第一処理命令群 140を用いて何らかの処理を行うプログラムであることが望ま しい。
[0103] また、第一処理命令群 140と第二処理命令群 150とが同一のプログラムに含まれる 場合は、そのプログラムを入力として与えることで、両方の処理命令群を入力すること ができる。さらにこの場合、プログラム中の第二処理命令群 150を出力処理命令群 1 60に置き換えて出力するプログラム出力手段等をさらに設けることで、入力されたプ ログラムを上述した特徴を有したプログラムへと難読ィ匕することができる。
[0104] さらに、出力処理命令群 160の依存処理命令群 330は、第一処理命令群 140の処 理結果に依存する処理を行う命令群となっている。よって、不正解析者が、第一処理 命令群 140を不正改竄した場合、出力処理命令群 160の処理が本来の結果と異な る結果となる。具体的には、例えば、不正解析者が図 5Aのコンテンツの再生可能回 数を出力する第一処理命令群 140を、「int decrypt ( int encryptedData) {ret urn 100 ; }」に改竄した場合、依存処理命令群 330における「plainData」の値は 1 00となり、「0xF0DD」とは異なる値になる。よって、出力処理命令群 160が実行され ても、本来の解凍処理とは異なる値が出力されることとなる。よって、第一処理命令群 140を改竄した不正解析者は、さらに出力処理命令群 160をも不正改竄しなければ 、コンテンツを正しく実行することが出来なくなる。このように、第一処理命令群 140と 第二処理命令群 150がコンテンツの再生等の大きな機能の構成要素である場合に、 その一部の構成要素が改竄されると、他の一部の構成要素の挙動がお力しくなる。 よって、不正解析者が望む通りに機能を改竄することが困難になる。
[0105] (2)改竄防止処理生成装置 110の構成
続いて、改竄防止処理生成装置 110の説明を行う。改竄防止処理生成装置 110 は、第二処理命令群 150を上記の出力処理命令群 160に変換する装置である。
[0106] 図 6は、改竄防止処理生成装置 110の構成を示す図である。
[0107] 改竄防止処理生成装置 110は、入力処理命令群保持部 210、被参照変数解析部 220、被参照変数情報保持部 230、被参照変数値代入処理命令群生成部 240、被 参照変数値代入処理命令群保持部 250、被参照変数値保持部 260、被代入変数 解析部 270、被代入変数情報保持部 280、想定値情報保持部 295、想定値算出部 290、依存処理命令群生成部 201、依存処理命令群保持部 202、分岐処理命令群 生成部 203、分岐処理命令群保持部 204、出力処理命令群生成部 205、および出 力処理命令群保持部 206を備えて 、る。
[0108] 入力処理命令群保持部 210は、第一処理命令群 140と第二処理命令群 150を取 得し、取得された各命令群を保持する。
[0109] 被参照変数解析部 220は、第一処理命令群 140を実行する際に値を設定しておく 必要のある引数等の変数 (被参照変数)が何であるかを解析する。
[0110] 被参照変数情報保持部 230は、被参照変数解析部 220による解析によって得られ た被参照変数の変数名等の情報を保持する。 [0111] 被参照変数値代入処理命令群生成部 240は、被参照変数に値を代入する被参照 変数値代入処理命令群 310を生成する。
[0112] 被参照変数値代入処理命令群保持部 250は、被参照変数値代入処理命令群生 成部 240が生成した被参照変数値代入処理命令群 310を保持する。
[0113] 被参照変数値保持部 260は、被参照変数値代入処理命令群 310が被参照変数に 代入する値を保持する。
[0114] 被代入変数解析部 270は、第一処理命令群 140の処理結果が代入される変数 (被 代入変数)が何であるかを解析する。
[0115] 被代入変数情報保持部 280は、被代入変数解析部 270による解析によって得られ た被代入変数の変数名等の情報を保持する。
[0116] 想定値算出部 290は、被参照変数の値を被参照変数値保持部 260が保持する値 とし、第一処理命令群 140を実行した際に得られる被代入変数の想定値を算出する
[0117] 想定値情報保持部 295は、想定値算出部 290が算出した想定値を保持する。
[0118] 依存処理命令群生成部 201は、第二処理命令群 150と想定値に基づき依存処理 命令群 330を生成する。
[0119] 依存処理命令群保持部 202は、依存処理命令群生成部 201が生成した依存処理 命令群 330を保持する。
[0120] 分岐処理命令群生成部 203は、入力処理命令群保持部 210が保持する第一処理 命令群 140を呼び出す分岐処理命令群 320を生成する。
[0121] 分岐処理命令群保持部 204は、分岐処理命令群生成部 203が生成した分岐処理 命令群 320を保持する。
[0122] 出力処理命令群生成部 205は、被参照変数値代入処理命令群保持部 250が保 持する被参照変数値代入処理命令群 310と、分岐処理命令群保持部 204が保持す る分岐処理命令群 320と、依存処理命令群保持部 202が保持する依存処理命令群
330とからなる出力処理命令群 160を生成する。
[0123] 出力処理命令群保持部 206は、出力処理命令群が生成した出力処理命令群 160 を保持する。 [0124] 以下、上述の各構成要素について詳細に説明する。なお、以下の説明においては 各構成要素の機能説明に加え、図 5Aの第一処理命令群 140が入力された場合の 具体的な動作例も説明する。
[0125] (2. 1)入力処理命令群保持部 210
入力処理命令群保持部 210は、外部から第一処理命令群 140と第二処理命令群 150の入力を受け付ける。つまり、入力処理命令群保持部 210は、第一処理命令群 140と第二処理命令群 150とを取得する。また、入力処理命令群保持部 210は、 1以 上の処理命令群を記憶する領域を備えている。入力処理命令群保持部 210は、改 竄防止処理生成装置 110に入力された第一処理命令群 140と第二処理命令群 150 を保持する。なお、入力を受け付ける部位と入力された命令群を保持する部位とを別 々に構成してもよいことは言うまでもない。
[0126] (2. 2)被参照変数解析部 220
被参照変数解析部 220は、入力処理命令群保持部 210が保持する第一処理命令 群 140を実行する際に必要となるパラメータを解析 (特定)し、解析 (特定)した情報を 被参照変数情報保持部 230に格納する。
[0127] 具体的には、例えば、第一処理命令群 140が関数であれば、被参照変数解析部 2 20は、その関数の引数の型や名前、個数を特定する。また、例えば、第一処理命令 群 140が外部変数を参照する処理を含む命令群であれば、被参照変数解析部 220 は、その外部変数の変数名や型を特定する。また、例えば、第一処理命令群 140が スタックの値を参照する処理を含む命令群であれば、被参照変数解析部 220は、参 照されるスタックのサイズを特定する。また、例えば、第一処理命令群 140がアドレス 変数で指定した位置に格納された値を参照する処理を含む命令群であれば、被参 照変数解析部 220は、そのアドレス変数や格納する値の型を特定する。以下の説明 では、このように特定された情報 (解析された情報)、すなわち、第一処理命令群 140 を実行する際に必要なパラメータに関する情報を総称して、被参照変数情報と呼ぶ
[0128] 具体的な例としては、被参照変数解析部 220は、図 5Aの第一処理命令群 140が 入力された場合、関数の引数名とその引数の型「int encryptedData」を特定 (解 析)し、これを被参照変数情報保持部 230に格納する。ここでは、引数名は「encryp tedData」であり、型は「int」である。
[0129] (2. 3)被参照変数情報保持部 230
被参照変数情報保持部 230は、被参照変数情報を記憶する領域を備えて!/、る。
[0130] 被参照変数情報保持部 230は、被参照変数解析部 220によって特定された第一 処理命令群 140の被参照変数情報を記憶する。
[0131] 具体的には、被参照変数情報保持部 230は、被参照変数解析部 220が図 5Aの第 一処理命令群 140を解析した場合、関数の引数名と型「int encryptedData」を記 憶する。
[0132] (2. 4)被参照変数値代入処理命令群生成部 240
被参照変数値代入処理命令群生成部 240は、第一処理命令群 140を実行する際 に必要なパラメータに値を設定する処理命令群である被参照変数値代入処理命令 群 310を生成し、生成した処理命令群を被参照変数値代入処理命令群保持部 250 に書き込む。また、被参照変数値代入処理命令群生成部 240は、パラメータに設定 する値を被参照変数値保持部 260に書き込む。
[0133] 具体的には、例えば、被参照変数値代入処理命令群生成部 240は、被参照変数 情報保持部 230が保持する変数名を取得する。次に、被参照変数値代入処理命令 群生成部 240は、取得した取得した変数名が示す変数に代入する値を決定する。そ して、被参照変数値代入処理命令群生成部 240は、取得した変数名と、決定した値 との組を被参照変数値保持部 260に書き込む。さらに、被参照変数値代入処理命令 群生成部 240は、変数に対して、先に決定した値を代入する処理 (被参照変数値代 入処理命令群 310)を生成し、その処理を被参照変数値代入処理命令群保持部 25 0に書き込む。
[0134] より具体的には、被参照変数情報保持部 230が(2. 3)の具体例に示した処理を行 つている場合、被参照変数値代入処理命令群生成部 240は、被参照変数情報保持 部 230が保持する被参照変数情報「int encryptedDataJを取得する。次に、被参 照変数値代入処理命令群生成部 240は、 rencryptedDataJに代入する int型の定 数値をランダムに決定する。ここでは、被参照変数値代入処理命令群生成部 240は 、定数値を「0xF022」と決定するものとする。次に、被参照変数値代入処理命令群 生成部 240は、決定した変数名と値との組「int encryptedData = 0xF022」を被 参照変数値保持部 260に書き込む。また、被参照変数値代入処理命令群生成部 24 0は、「encryptedData = 0xF022」を被参照変数値代入処理命令群 310として被 参照変数値代入処理命令群保持部 250に書き込む。
[0135] (2. 5)被参照変数値代入処理命令群保持部 250
被参照変数値代入処理命令群保持部 250は、 1以上の処理命令を記憶する領域 を備える。被参照変数値代入処理命令群保持部 250は、被参照変数値代入処理命 令群生成部 240が生成した被参照変数値代入処理命令群 310を記憶領域に記憶 する。被参照変数値代入処理命令群生成部 240が生成した処理命令が複数ある場 合には、複数の処理命令を記憶する。
[0136] 具体的には、被参照変数値代入処理命令群生成部 240が(2. 4)の具体例に示し た処理を行って 、る場合、「encryptedData = 0xF022;」を記憶する。
[0137] (2. 6)被参照変数値保持部 260
被参照変数値保持部 260は、第一処理命令群 140を実行する際に必要なパラメ一 タ (被参照変数)に設定する値を記憶する領域を備える。
[0138] 具体的には、例えば、被参照変数値保持部 260は、変数名と値との組を複数記憶 する領域を備え、被参照変数値代入処理命令群生成部 240が決定した変数名と、 その変数名に対応する変数に代入する値との組を記憶する。
[0139] より具体的には、被参照変数値代入処理命令群生成部 240が(2. 4)の具体例に 示した処理を行っている場合、被参照変数値保持部 260は、変数「encyrptedData 」と値「0xF022」との組を記憶する。
[0140] (2. 7)被代入変数解析部 270
被代入変数解析部 270は、入力処理命令群保持部 210が保持する第一処理命令 群 140の処理結果が格納される格納先を解析 (特定)する。
[0141] 具体的には、例えば、第一処理命令群 140が関数である場合には、被代入変数解 析部 270は、その関数の戻り値の変数名や型を特定する。また、例えば、第一処理 命令群 140が外部変数に値を決定する処理であるならば、被代入変数解析部 270 は、その外部変数の変数名や型を特定する。また、例えば、第一処理命令群 140が スタックに値を格納する処理を含む命令群であれば、被代入変数解析部 270は、そ のスタックのサイズやスタック上の位置 (スタックポインタ)を特定する。また、例えば、 第一処理命令群 140がアドレス変数で指定した位置に値を格納する処理を含む命 令群であれば、被代入変数解析部 270は、その格納されるアドレスを特定する。以降 の説明では、このように特定された情報、すなわち、第一処理命令群 140の処理結 果が格納される格納先の情報を総称して、被代入変数情報と呼ぶ。なお、スタック等 が OS (Operating System)の機能として実現されている場合、スタックポインタゃスタ ックのサイズはプログラム中には明示的には表れないことがあるが、このような値も被 代入変数情報である。
[0142] 次に、被代入変数解析部 270は、解析 (特定)した被代入変数情報を被代入変数 情報保持部 280に格納する。
[0143] より具体的には、図 5Aの第一処理命令群 140を解析の対象とする場合、被代入変 数解析部 270は、関数の戻り値が格納される変数名と型「int plainData」を特定し 、「int plainData」を被代入変数情報保持部 280に格納する。
[0144] (2. 8)被代入変数情報保持部 280
被代入変数情報保持部 280は、被代入変数解析部 270によって特定された第一 処理命令群 140の被代入変数情報を記憶する。
[0145] 第一処理命令群 140で値が決定される変数 (被代入変数)が複数ある場合には、 そのうちの 1つ以上の変数名等 (被代入変数情報)を記憶する。なお、本発明は被代 入変数が最低 1つ分かれば実現できるので、複数の被代入変数が特定されたとして もその全てを記憶する必要はな ヽ。どの被代入変数にっ 、ての被代入変数情報を 記憶するかは、被代入変数情報保持部 280が決定してもよいし、被代入変数解析部 270が決定してもよい。また、被代入変数情報を記憶する被代入変数をどれにする かの決定の仕方は特に問わないが、例えば、最初に見つ力つた被代入変数としたり 、見つ力つた被代入変数力もランダムに決定するとしてもよい。
[0146] 具体的には、図 5Aの第一処理命令群 140に対して被代入変数解析部 270による 解析が行われた場合、被代入変数情報保持部 280は、関数の戻り値が格納される 変数名と型「int plainData」を記憶する。
[0147] (2. 9)想定値算出部 290
想定値算出部 290は、被参照変数値保持部 260が保持する被参照変数の値を用 Vヽて第一処理命令群 140を実行した場合に、被代入変数に代入される想定値を算 出する。
[0148] 具体的には、想定値算出部 290は、以下の A)〜E)に示す処理を行う。
[0149] A)想定値算出部 290は、被代入変数情報保持部 280から被代入変数情報を読み 込む。
[0150] B)想定値算出部 290は、被参照変数値保持部 260から被参照変数名および値を 読み込む。
[0151] C)想定値算出部 290は、被参照変数に、読み込んだ値を代入し、入力処理命令 群保持部 210が保持する第一処理命令群 140を実行する。
[0152] D)想定値算出部 290は、第一処理命令群 140の実行後の被代入変数の値を参 照する。
[0153] E)想定値算出部 290は、被代入変数の変数名と、参照した被代入変数の値との 組を想定値情報保持部 295に書き込む。
[0154] なお、被代入変数情報保持部 280が保持する被代入変数情報が複数ある場合に は、想定値算出部 290は、それぞれの被代入変数情報の変数名とその値との組を想 定値情報保持部 295に書き込む。
[0155] より具体的には、被参照変数値保持部 260が(2. 6)の具体例に示す処理を行って いる場合、想定値算出部 290は、以下に示す A)〜E)の処理を行う。
[0156] A)想定値算出部 290は、被代入変数情報保持部 280が保持する被代入変数情 報「int plainData」を読み込む。
[0157] B)想定値算出部 290は、被参照変数値保持部 260から「int encryptedData=
0xF022」を読み込む。ここで、被参照変数名は「encryptedData」であり、値は「0x
F022」である。
[0158] C)想定値算出部 290は、「decrypt (0xF022);」を実行する。すなわち、「decryp t (encryptedData);」の「encryptedData」に値「0xF022」を代入して計算を行う。 [0159] D)想定値算出部 290は、「decrypt (0xF022);」を実行した結果得られる被代入 変数「plainData」の値を算出する。ここでは、想定値算出部 290は、「0xF022'0x
OOFF = OxFODD」を算出する。
[0160] E)想定値算出部 290は、「int plainData=OxFODD」を想定値情報保持部 295 に格納する。ここで、被代入変数の変数名は「plainData」であり、値は「OxFODD」 である。
[0161] (2. 10)想定値情報保持部 295
想定値情報保持部 295は、想定値情報を記憶する領域を備える。ここで、想定値 情報とは想定値を保持すべき変数名やその想定値などの情報である。
[0162] 具体的には、想定値情報保持部 295は、想定値算出部 290が算出した想定値とそ の変数名とを上述の想定値情報として保持する。
[0163] より具体的には、想定値算出部 290が(2. 9)の具体例に示した処理を行っている 場合、「int plainData=OxFODD」を保持する。ここで、想定値は「OxFODD」であ り、変数名は「plainData」である。
[0164] (2. 11)依存処理命令群生成部 201
依存処理命令群生成部 201は、想定値情報保持部 295が保持する想定値および 入力処理命令群保持部 210が保持する第二処理命令群 150に基づき依存処理命 令群 330を生成する。
[0165] 依存処理命令群 330は、第二処理命令群 150と同等の処理を行う処理命令群で あって、第一処理命令群 140の処理結果を参照する処理を含み、一部の処理がそ の参照した値を用いた処理となって 、る処理命令群である。
[0166] 依存処理命令群生成部 201は、具体的には、例えば、以下に示す A)〜F)の処理 を行う。
[0167] A)依存処理命令群生成部 201は、第二処理命令群 150に含まれる処理命令に含 まれる定数を見つける。以下、この定数を含む処理命令を Or 1、その定数の値を Va 1とする。
[0168] B)依存処理命令群生成部 201は、想定値情報保持部 295が保持する想定値情 報を読み込む。以下、その想定値を保持すべき変数を Vrl、その想定値を Va2とす る。
[0169] C)依存処理命令群生成部 201は、 Va3 =Va2— Valを算出する。この時、 Val = Va2— Va3となる。
[0170] D)依存処理命令群生成部 201は、処理命令 Or 1に含まれる値 Valを、変数 Vrl ( 値 Va2を保持すべき変数)から値 Va3を引き算することで算出する処理命令 Or2を 生成する。すなわち、 Or2は「(Vrl—Va3)」となる。
[0171] E)依存処理命令群生成部 201は、第二処理命令群 150の処理命令 Or 1を処理命 令 Or2に置き換えた命令群である依存処理命令群 330を生成する。
[0172] このような置き換えを行えば、変数 Vrlの値が想定値 Va2であれば、「Vrl— Va3」 の値は「Va2— Va3 =Val」となる。すなわち、処理命令 Or 1に含まれる値 Valに対 して上記の置き換えを行ったとしても、処理命令 Or2は、 Vrlに正しい値が代入され る限り、置き換えを行う前と同じ結果をもたらすことが出来る。
[0173] 具体的には、想定値情報保持部 295が(2. 10)の処理を行った場合、依存処理命 令群生成部 201は、以下に示す A)〜E)の処理を行う。
[0174] A)依存処理命令群生成部 201は、処理命令 Orlを「decompressedData= (dec ompressedDataくく 1) | 0x0001;」とし、値 Valを「0x0001」とする。
[0175] B)依存処理命令群生成部 201は、想定値情報保持部 295から「int plainData
= 0xF0DD」を読み込む。ここで、依存処理命令群生成部 201は、変数 Vrlを「plai nDataJ、値 Va2を「0xF0DD」とする。
[0176] C)依存処理命令群生成部 201は、値 Va3、すなわち「0xF0DD— 0x000 l = 0xF
00じ」を算出する。
[0177] D)依存処理命令群生成部 201は、処理命令 Or2「decompressedData= (deco mpressedDataくく 1) | (plainData— OxFODC);」を生成する。
[0178] E)依存処理命令群生成部 201は、第二処理命令群 150の処理命令 Orlを処理命 令 Or2に置き換えた命令群である依存処理命令群 330を生成する。なお、本実施の 形態は C言語によるプログラムであるとしているので、上述した処理の他に、依存処 理命令群 330が C言語プログラムとして適切に動作するよう、関数宣言や変数宣言を 追加する必要がある。 [0179] 以上により、図 5Cに図示する依存処理命令群 330と同じ命令群が生成される。
[0180] なお、ここでは、上述の C)で「Va3 =Va2— Val」の演算を行ったが、他の算出式 による演算または処理を行っても構わない。具体的には、排他的論理和や加算など の演算を行ってもよいし、より複雑な変換を行う関数等の演算を行ってもよい。その場 合、算出式または処理を変形し、 Va2を求める算出式または処理を生成し、それを V a2と置き変えればよい。すなわち、 Valと Va2とを用いた演算または処理を行うことで Va3を算出し、得られた Va3と Valとから Va2を逆算する演算または処理を行う命令 群を生成し、それを Va2と置き換えればよい。
[0181] (2. 12)依存処理命令群保持部 202
依存処理命令群保持部 202は、 1以上の処理命令を記憶する領域を備える。依存 処理命令群保持部 202は、依存処理命令群生成部 201が生成した依存処理命令 群 330を記憶領域に記憶する。
[0182] 具体的には、依存処理命令群生成部 201が(2. 11)の処理を行った場合、依存処 理命令群保持部 202は、図 5Cに示す依存処理命令群 330を記憶する。
[0183] (2. 13)分岐処理命令群生成部 203
分岐処理命令群生成部 203は、入力処理命令群保持部 210が保持する第一処理 命令群 140を呼び出す分岐処理命令群 320を生成する。
[0184] 具体的には、例えば、第一処理命令群 140が関数であるならば、分岐処理命令群 生成部 203は、関数コール命令を生成する。また、第一処理命令群 140がサブルー チンであるならば、分岐処理命令群生成部 203は、サブルーチンコール命令を生成 する。また、第一処理命令群 140が例外処理ならば、分岐処理命令群生成部 203は 、例外を発生させる処理命令を生成する。
[0185] より具体的には、入力処理命令群保持部 210が(2. 1)の処理を行った場合、分岐 処理命令群生成部 203は、関数コール命令である「plainData = decrypt (encrypt edData);」を分岐処理命令群 320として生成する。
[0186] (2. 14)分岐処理命令群保持部 204
分岐処理命令群保持部 204は、 1以上の処理命令を記憶する領域を備える。分岐 処理命令群保持部 204は、分岐処理命令群生成部 203が生成した分岐処理命令 群 320を記憶領域に記憶する。
[0187] 具体的には、分岐処理命令群生成部 203が(2. 13)の処理を行った場合、分岐処 理命令群保持部 204は「plainData = decrypt (encryptedData);」を記憶する。
[0188] (2. 15)出力処理命令群生成部 205
出力処理命令群生成部 205は、被参照変数値代入処理命令群保持部 250が保 持する被参照変数値代入処理命令群 310と、分岐処理命令群保持部 204が保持す る分岐処理命令群 320と、依存処理命令群保持部 202が保持する依存処理命令群
330とからなる出力処理命令群 160を生成する。
[0189] 具体的には、上記の(2. 14)までの処理が行われた場合、出力処理命令群生成部
205は、図 5Cの出力処理命令群 160を生成する。
[0190] (2. 16)出力処理命令群保持部 206
出力処理命令群保持部 206は、 1以上の処理命令群を記憶する領域を備えている
。出力処理命令群保持部 206は、出力処理命令群生成部 205が生成した出力処理 命令群 160を記憶する。
[0191] 具体的には、出力処理命令群生成部 205が(2. 15)の処理を行った場合、出力処 理命令群保持部 206は、図 5Cの出力処理命令群 160を記憶する。
[0192] (2. 17)改竄防止処理生成装置 110の動作
改竄防止処理生成装置 110の動作について、図 7を用いて説明する。
[0193] 図 7は、改竄防止処理生成装置 110の動作を示すフローチャートである。
[0194] 被参照変数解析部 220は、入力処理命令群保持部 210が保持する第一処理命令 群 140を実行する際に必要となるパラメータの格納先である被参照変数に関する情 報である被参照変数情報を解析 (特定)する (ステップ S 100)。
[0195] 被参照変数解析部 220は、特定 (解析)された被参照変数情報を被参照変数情報 保持部 230に格納する(ステップ S102)。
[0196] 被参照変数値代入処理命令群生成部 240は、ステップ S 100で特定 (解析)された 被参照変数に格納する値を決定する (ステップ S104)。
[0197] 被参照変数値代入処理命令群生成部 240は、ステップ S 104で決定した、被参照 変数に格納する値、および被参照変数名を被参照変数値保持部 260に格納する( ステップ SI 06)。
[0198] 被参照変数値代入処理命令群生成部 240は、ステップ S 104で決定した値を被参 照変数に格納する処理命令群である被参照変数値代入処理命令群 310を生成する (ステップ S 108)。
[0199] 被参照変数値代入処理命令群生成部 240は、ステップ S 108で生成した被参照変 数値代入処理命令群 310を被参照変数値代入処理命令群保持部 250に格納する( ステップ S 110)。
[0200] 想定値算出部 290は、被参照変数値保持部 260が保持する被参照変数の値を用 いて第一処理命令群 140を実行した場合の被代入変数が取る想定値を算出する (ス テツプ S 112)。ここで、被代入変数解析部 270は、このステップ S 112が行われるより も前に被代入変数の解析を行 ヽ、その結果を被代入変数情報保持部 280に格納し ているものとする。したがって、ステップ S 112では、想定値算出部 290は、被代入変 数情報保持部 280から被代入変数に関する情報を得て、想定値を算出している。
[0201] 想定値算出部 290は、算出した想定値および、被代入変数名を想定値情報保持 部に格納する (ステップ S 114)。
[0202] 依存処理命令群生成部 201は、想定値情報保持部 295が保持する想定値および 入力処理命令群保持部 210が保持する第二処理命令群 150に基づき依存処理命 令群 330を生成する(ステップ S 116)。
[0203] 依存処理命令群生成部 201は、生成した依存処理命令群 330を依存処理命令群 保持部 202に格納する (ステップ S118)。
[0204] 分岐処理命令群生成部 203は、入力処理命令群保持部 210が保持する第一処理 命令群 140を呼び出す分岐処理命令群 320を生成する (ステップ S120)。
[0205] 分岐処理命令群生成部 203は、生成した分岐処理命令群 320を分岐処理命令群 保持部 204に格納する (ステップ S122)。
[0206] 出力処理命令群生成部 205は、被参照変数値代入処理命令群保持部 250が保 持する被参照変数値代入処理命令群 310と、分岐処理命令群保持部 204が保持す る分岐処理命令群 320と、依存処理命令群保持部 202が保持する依存処理命令群 330とからなる出力処理命令群 160を生成する (ステップ S124)。 [0207] 出力処理命令群生成部 205は、生成した出力処理命令群 160を出力処理命令群 保持部 206に格納する(ステップ S 126)。
[0208] (2. 18)改竄防止処理生成装置 110の効果
改竄防止処理生成装置 110は、入力として与えられた第一処理命令群 140および 第二処理命令群 150から(1. 5)で述べた効果を有する出力処理命令群 160を生成 することが出来る。
[0209] 図 8は、改竄防止処理生成装置 110の効果を説明するための説明図である。
[0210] 改竄防止処理生成装置 110は、例えば、第一処理命令群 140と第二処理命令群 1 50とを含む入力プログラム(オリジナルプログラム) 101を取得して、その入力プログ ラム 101を改竄防止プログラム 102に変換して出力する。このとき、改竄防止処理生 成装置 110は、上述のように、入力プログラム 101の第二処理命令群 150を出力処 理命令群 160に変換して 、る。
[0211] つまり、改竄防止処理生成装置 110は、第二処理命令群 150に対して、保護対象 コードである第一処理命令群 140の呼出処理を追加するとともに、第二処理命令群 150の解凍処理を、保護対象コードである第一処理命令群 140の処理結果に依存さ せること (依存処理)により、改竄防止処理を生成している。
[0212] 保護対象コード (第一処理命令群 140)の呼出処理では、被参照変数値代入処理 命令群 310において、保護対象コードの被参照変数「encryptedData」に値「0x00 22」が代入された状態で、保護対象コードが呼び出される。
[0213] その結果、改竄防止プログラム 102では、従来のように保護対象コードがデータとし て読み込まれることがないため、不正解析者によって改竄防止処理が見つけられる のを困難にすることができる。
[0214] さらに、依存処理では、依存処理命令群 330の解凍処理「decompressedData =
(decompressedData< < 1) | (plainData— 0xF0DC」力、上述の呼出処理によ つて保護対象コードが呼び出されて実行された結果 (第一処理命令群 140の処理結 果)である「plainData」の値に依存している。つまり、保護対象コードが改竄されてい なければ、「plainData」の値は想定値「0xF0DD」となるため、改竄防止プログラム 1 02の出力処理命令群 160が実行されると、第二処理命令群 150の解凍処理「deco mpressedData= (decompressedDataくく 1) | 0x0001」が正しく実行される。
[0215] 一方、保護対象コードが改竄されていれば、「plainData」の値は想定値「0xF0D Djと異なるため、改竄防止プログラム 102の出力処理命令群 160が実行されると、 第二処理命令群 150の解凍処理とは異なる処理が実行される。つまり、改竄防止プ ログラム 102に含まれる入力プログラム 101の処理が正しく実行されないこととなる。
[0216] その結果、改竄防止プログラム 102では、従来のように判定 Z終了処理がないため 、不正解析者によって改竄防止処理が見つけられるのをさらに困難にすることができ る。もしも、プログラムに判定 Z終了処理があれば、不正解析者は、プログラムを複数 回実行して各回におけるログを収集することにより、各回におけるログの違いに基づ いて、判定 Z終了処理、すなわち判定 Z終了処理を伴う改竄防止処理を容易に見 つけることができる。
[0217] しかし、改竄防止プログラム 102では、上述のように、判定 Z終了処理がないため、 改竄防止処理を見つけることが困難になるのである。
[0218] さらに、不正解析者に対して、出力処理命令群 160から呼び出される保護対象コ ード (第一処理命令群 140)を出力処理命令群 160の処理の一部に見せかけること ができ、第二処理命令群 150を難読化することができる。
[0219] このように、本実施の形態における改竄防止処理生成装置 110は、第二処理命令 群 150に対して保護対象コードの呼出処理を追加するとともに依存処理を生成する ことにより、保護対象コードに対する改竄を確実に防止する出力処理命令群 160 (改 竄防止プログラム 102)を生成することができる。また、本実施の形態における改竄防 止処理生成装置 110は、実行中にメモリ上にあるコードをデータとして読み込むこと ができな!/、Java (登録商標)等の言語で記述されたプログラムに対しても、そのプログ ラムの保護対象コードに対する改竄を確実に防止することができる。
[0220] (変形例 1)
上述した実施の形態では、第一処理命令群 140の引数であった変数をそのまま被 参照変数値代入処理命令群 310で値を代入する変数として ヽたが、これに限られる ものではない。被参照変数値代入処理命令群生成部 240は、第二処理命令群 150 で使用されて ヽる変数名を特定し、被参照変数情報保持部 230に保持されて ヽる変 数名のうち、第二処理命令群 150で使用されて ヽな 、変数名の変数にランダムな値 を代入する処理を行う命令群を被参照変数値代入処理命令群 310としてもよ ヽ。こ のような構成を用いれば、第一処理命令群で戻り値を格納する変数名が、第二処理 命令群 150で他の用途に使用されている場合でも第二処理命令群 150の難読化を 行うことができる。
[0221] 上述した実施の形態では、第一処理命令群 140と第二処理命令群 150とは、本来 、情報をやりとりする必要のない命令群であったため、第一処理命令群 140の処理 結果を格納する変数をそのまま難読ィ匕に用いたとしても、そのことにより正 、処理 結果が書き換えられることはな力つた。しかし、第二処理命令群 150が、第一処理命 令群 140を呼び出す命令をもともと含んでおり、その処理結果を利用する命令群で ある場合、単純に上述した難読化を施すと、被参照変数値代入処理命令群 310によ つてその処理結果が書き換えられてしまうことにより、正常な動作が保証できなくなる 。ここで、上述のように第二処理命令群 150に含まれない変数を用いることにより、難 読化に用!ヽる変数と第二処理命令群 150にもともと含まれて ヽた第一処理命令群 14 0の処理結果を格納する変数とが異なる変数となるため、処理結果に影響を与えるこ となく難読ィ匕を行うことができる。すなわち、第二処理命令群 150が第一処理命令群 140を呼び出すような処理を含む場合であっても、上述と同様の難読ィ匕を行うことが できる。
[0222] なお、この場合であっても、 (1. 5)で述べたものと同様の効果が得られることは言う までもない。
[0223] (変形例 2)
被参照変数値代入処理命令群生成部 240では、被参照変数に代入する値をラン ダムに決定するとしたが、代入する値によって、不正解析者の解析行為の困難さに 差が出る場合がある。したがって、改竄防止処理生成装置 110の構成は、代入する 値または想定値がユーザにより指定されるような構成であっても構わない。
[0224] 以下、図 5Cに示すように、被参照変数「encryptedData」に代入する値を「0xF0 22」とした場合と、「0XF0001」とした場合とで、不正解析者の解析行為の困難さの 差を具体的に説明する。 [0225] 図 5Cに示すように、被参照変数「encryptedData」に代入する値を「0xF022」と すると、想定値算出部 290が算出する想定値は「OxFODD」であった。よって、第一 処理命令群 140が処理「int decrypt (int encryptedData) {return OxFODD ; }」に改竄された場合でも、出力処理命令群 160は正常に動作することとなる。
[0226] 上記の処理は、第一処理命令群 140の戻り値を常に想定値となるようにした処理で ある。
[0227] この時、改竄後の第一処理命令群 140が出力する再生可能回数は、「0xF0DD」 である。ここで、「0xF0DD」は、 2進標記した場合の最上位ビットが 1であるので、負 の値である。すなわち、第一処理命令群 140が出力する再生可能回数は常に負の 値となるので、仮に上記のような改竄に成功しても再生はできない。したがって、改竄 に成功しても失敗しても再生ができな 、ことから、不正解析者は改竄が成功したか否 力の判断ができなくなる。また、仮に改竄に成功したと不正解析者が認識していたと しても、再生可能回数が常に負の値であるので、改竄が成功したことによる利益は薄 い。
[0228] 一方、被参照変数に代入する値がランダムに「0x0001」と決まった場合、想定値 算出部 290が算出する想定値は「0x00FE」である。よって、第一処理命令群 140が 処理「int decrypt ( int encryptedData) {return OxOOFE ; }」に改竄された場 合、出力処理命令群 160は正常に動作することとなる。
[0229] この時、改竄後の第一処理命令群 140が出力する再生可能回数 OxOOFEは、最 上位ビットが 0であるので常に正の値となる。この場合、常に再生が可能となってしま うので、これは、不正解析者にとって望ましい改竄である。
[0230] このように、被参照変数に代入する値によって不正解析者の解析行為が困難さに 差が出る場合がある。そこで、改竄防止処理生成装置 110を、代入する値または想 定値がユーザにより指定されるような構成としてもよい。
[0231] (変形例 3)
実施の形態 1では、被参照変数の値をランダムに決定し、その値に対応する想定 値を想定値算出部 290により算出したが、改竄防止処理生成装置 110を、予め被参 照変数の値や想定値が与えられるような構成としても構わない。 [0232] 例えば、第一処理命令群 140を開発した後に行うテストの際のテストデータに含ま れる、被参照変数情報や、被参照変数値、想定値などの情報を用いる構成としても 構わない。
[0233] その場合、改竄防止処理生成装置 110は、被参照変数解析部 220、被代入変数 解析部 270、想定値算出部 290を含まなくてよい。
[0234] このような構成は、同一の第一処理命令群 140を用いる複数の異なるプログラムの それぞれに対して難読化を行うような場合や、難読化強度の調節を行う他の手法と 組み合わせて適切な実行速度と強度を兼ね備えた出力処理命令群 160が得られる まで何度も難読化を試みる場合等に有効である。
[0235] すなわち、想定値の算出に時間が力かる場合、同じ想定値を得られるのみである にも関わらず、難読ィ匕が行われるたびに想定値の算出処理が行われるので、それぞ れの難読化に余分な時間がかかってしまう。上記のような構成を用いることで、一度 想定値を算出すれば、その値を使い回すことができるので、想定値の算出にかかる 時間の分、難読ィ匕処理に力かる時間を短くすることができる。
[0236] (変形例 4)
被参照変数を一つも含まないような第一処理命令群 140を対象とする場合には、 改竄防止処理生成装置 110を、被参照変数解析部 220および被参照変数情報保 持部 230を含まな 、構成としてもよ!/、。
[0237] (変形例 5)
実施の形態 1の改竄防止処理生成装置 110では、 C言語を対象としているため、中 間プログラムを保持する被参照変数値代入処理命令群保持部 250、分岐処理命令 群保持部 204、および依存処理命令群保持部 202と、出力処理命令群生成部 205 とを備えて、中間プログラムから、変数宣言および関数宣言等を有する C言語のプロ グラム(出力処理命令群 160)を出力した。しかし、アセンブリ言語のような、順に処理 命令を並べることでプログラムを生成できる言語を対象とする場合には、改竄防止処 理生成装置 110は、これらの要素を備えずに、出力処理命令群保持部に 206に順 に中間プログラムを追記して出力処理命令群 160を出力してもよい。
[0238] (変形例 6) 改竄防止処理生成装置 110の変形例である改竄防止処理生成装置 110aにつ 、 て図 9および図 10を用いて説明する。なお、以降の説明で、実施の形態 1の構成要 素 (装置、部、および処理命令群など)の符号の語尾に「a」を付けたものはその構成 要素の変形例である。例えば、改竄防止処理生成装置 110aは、実施の形態 1の構 成要素である改竄防止処理生成装置 110の変形例である。また、本変形例における 構成要素のうち、実施の形態 1の構成要素の名称および符号と同じ名称および符号 を用いて示される構成要素は、実施の形態 1にて説明した構成要素と同一である。
[0239] 改竄防止処理生成装置 110aは改竄防止処理生成装置 110と同じく処理システム 100において用いられる装置である。改竄防止処理生成装置 110aは、第一処理命 令群 140および第二処理命令群 150を入力とし、出力処理命令群 160aを出力する 。以下、出力処理命令群 160aおよび改竄防止処理生成装置 110aを説明する。
[0240] (3)出力処理命令群 160aの構成
図 9は、改竄防止処理生成装置 110aによって生成された出力処理命令群 160aの 具体例を示す図である。
[0241] 出力処理命令群 160aは、第一処理命令群 140を実行する際に必要となる各種パ ラメータに値を設定する被参照変数値代入処理命令群 310aと、第一処理命令群 14 0を呼び出す分岐処理命令群 320aと、第一処理命令群 140を呼び出した後に実行 される依存処理命令群 330aとからなる。以下、この具体例を用いながら各部を説明 する。
[0242] (3. 1)被参照変数値代入処理命令群 310a
被参照変数値代入処理命令群 310aは、第一処理命令群 140を呼び出して実行 する際に必要となる各種パラメータに値を設定する処理である。図 5Cの被参照変数 値代入処理命令群 310では、被参照変数「encryptedData」に格納される値は常に 1つの値「0xF022」と固定されていたのに対し、被参照変数値代入処理命令群 310 aでは、格納される値は 1つの固定された値とはならない。
[0243] 具体的には、図 9の被参照変数値代入処理命令群 310a「encryptedData = com pressedData< < 8 ;」では、被参照変数「encryptedData」に格納される値は「co mpressedData」の値に依存する。「compressedData」は、 0〜31の値(16進数表 記で 0x00〜0xlF)を取るので、被参照変数値代入処理命令群「encryptedData = compressedData< < 8 ;」によって被参照変数「encryptedData」に代入される 値は「0x0000、 0x0100、…ゝ 0xlF00」の!ヽずれ力となる。以降の説明では、被参 照変数が取る値を集合の表現を用いて {encryptedData | encryptedData = 0x0 000、 0x0100、…ゝ OxlFOO}と表す。ある!/、は、被参照変数力取る値を、「compre ssedData」も使った集合の表現として {encryptedData | encryptedData = comp ressedData< < 8、 compressedData = OxOO、 0x01、…ゝ OxlF}と表す。
[0244] (3. 2)分岐処理命令群 320a
分岐処理命令群 320aは第一処理命令群 140に分岐する処理命令群である。
[0245] 実施の形態 1の場合、実行処理装置 130により出力処理命令群 160を実行した場 合、第一処理命令群 140を呼び出した後の被代入変数「plainData」が取る値は常 に 1つの固定された値である。なぜならば、第一処理命令群 140の処理結果に影響 を与える変数は被参照変数であり、実施の形態 1では、その被参照変数に常に同じ 値を代入して 、る力 である。
[0246] 一方、本変形例では、被参照変数「encryptedData」に代入される値は 1つの固 定された値ではないので、被代入変数「PlainData」に代入される値も 1つの固定さ れた値とはならない。被参照変数「encryptedData」が取る値は「0x0000、 0x010
0、 · · ·、 0xlF00」のいずれかであるので、被代入変数「plainData」の取る値は、これ らの値を第一処理命令群 140によって処理した結果である「0x00FF、 0x0 IFF,… 、 0xlFFF」のいずれかとなる。被代入変数が取る値を集合で表現した場合、 {plain Data I plainData = OxOOFF, 0x0 IFF,…ゝ OxlFFF}あるいは、 {plainData | p lainData = (compressedData< < 8) 0x00FF、 compressedData = 0x00、 Ox
01、…ゝ OxlF}となる。
[0247] (3. 3)依存処理命令群 330a
依存処理命令群 330aは、第一処理命令群 140を呼び出した後に実行される処理 命令群であり、第二処理命令群 150と同等の処理を行う処理命令群である。具体的 には、被代入変数の値が、 (3. 2)で述べた取り得る値のいずれであっても第二処理 命令群 150と同等の処理を行う処理命令群である。 [0248] より具体的には、依存処理命令群 330aは、処理命令群「 for (counter =0 ; coun ter^ compressedData ; counter + + { decompressedData = ^decompressed Data< < 1) I ( (compressedData< < 8;TplainData-0x00FE) ; }」である。
[0249] 上記の処理命令群で、着目すべきは「(compressedDataく < 8) "plainData'Ox 00FE」の処理命令群の部分である。
[0250」 {plainData | plainData= (compressedData< < 8) 0x00FF、 compressed Data = 0x00, 0x01、…ゝ OxlF}の時、上記の処理命令群は「(compressedData < < 8) " (compressedData < < 8"0x00FF) '0x00FE」を算出する処理となり、出 力値は常に 1となる。すなわち、(compressedData< < 8)と plainDataとは上位の 8ビットが同一の値 compressedDataであるので、排他的論理和演算の結果は常に 値「0x00FF」となる。上記の処理命令群では、この値に対して、さら〖こ、 OxFEという 最下位ビットのみ「0x00FF」と異なる値との排他的論理和を取ることにより、最下位 ビットのみが 1の値、すなわち、「0x0001」力得られる。よって、依存処理命令群 330 aは、被代入変数の値力 (3. 2)で述べた取り得る値のいずれであっても第二処理 命令群 150と同等の処理となる。
[0251] (3. 4)出力処理命令群 160aの効果
出力処理命令群 160aを用いれば、被代入変数に格納される値は変数「compress edDatajに依存して変化する値となるので、不正解析者の解析が困難になる。以下 、この詳細を説明する。
[0252] 実施の形態 1の場合、不正解析者が、被参照変数「compressedData」に「0〜31 」の何れかの値を順に代入して出力処理命令群 160を実行すると、分岐処理命令群 320 rplainData = decrypt (encryptedData)」の処理結果である被代入変数「plai nData」の値は常に 1つの固定された値「0xF0DD」となる。そこで、不正解析者は、 「plainData」の値は常に「0xF0DD」になると推測して、分岐処理命令群 320を「pla inData = 0xF0DD;」に置き換える改竄を行うことができる。このような手順で不正解 析者が解析を行った場合、不正解析者は、第一処理命令群 140の中身を解析せず に出力処理命令群 160を効率的に解析することが出来る。一方、出力処理命令群 1 60aの場合には、被代入変数の値は「compressedData」の値に応じて変化するた め、このような解析を行うことは出来ない。
[0253] (4)改竄防止処理生成装置 110aの構成
図 10は、改竄防止処理生成装置 110aの構成を示す図である。
[0254] 改竄防止処理生成装置 110aは、図 6の改竄防止処理生成装置 110の、被参照変 数値代入処理命令群生成部 240、被参照変数値保持部 260、想定値算出部 290、 想定値情報保持部 295、および依存処理命令群生成部 201がそれぞれ、被参照変 数値代入処理命令群生成部 240a、被参照変数値保持部 260a、想定値算出部 29 0a、想定値情報保持部 295a、および依存処理命令群生成部 201aに置換わったも のである。
[0255] 以下、置き換わった構成要素のそれぞれにつ 、て説明する。なお、以下の例で挙 げる具体例は、図 9に示す出力処理命令群 160aとは異なる出力処理命令群を得る ための処理であることに注意されたい。
[0256] (4. 1)被参照変数値代入処理命令群生成部 240a
被参照変数値代入処理命令群生成部 240aは、第一処理命令群 140を実行する 際に必要なパラメータに値を設定する処理命令群である被参照変数値代入処理命 令群 310aを生成し、生成した処理命令群を被参照変数値代入処理命令群保持部 2 50に書き込む。また、パラメータに設定する値を被参照変数値保持部 260aに書き 込む。
[0257] 具体的には、例えば、被参照変数値代入処理命令群生成部 240aは、被参照変数 情報保持部 230が保持する変数名を取得し、取得したそれぞれの変数に対し以下 の A)〜D)の処理を行う。
[0258] A)被参照変数値代入処理命令群生成部 240aは、被参照変数値代入処理命令 群 310aを決定する。被参照変数値代入処理命令群 310aは、第二処理命令群 150 の被依存変数を用いてランダムに生成されるとしてもよいし、あら力じめ定められた命 令群のテンプレートに被依存変数を当てはめる等としてもよい。
[0259] B)被参照変数値代入処理命令群生成部 240aは、決定した被参照変数値代入処 理命令群 310aを被参照変数値代入処理命令群保持部 250に書き込む。
[0260] C)被参照変数値代入処理命令群生成部 240aは、被参照変数値代入処理命令群 310aによる、被参照変数が取りうる値の集合を求める。
[0261] D)被参照変数値代入処理命令群生成部 240aは、求めた集合を被参照変数値保 持部 260aに書き込む。
[0262] より具体的には、図 5Aの第一処理命令群 140に対しては、以下の処理が行われる [0263] A)被参照変数値代入処理命令群生成部 240aは、被参照変数値代入処理命令 群 310&を「6110^ 6(10& & =
Figure imgf000047_0001
< 8」とする。この処理命令群は
、第二処理命令群 150の被依存変数を用 、てランダムに生成した式である。
[0264] B)被参照変数値代入処理命令群生成部 240aは、被参照変数値代入処理命令群
310a「encryptedData = compressedData< < 8」を被参照変数値代入処理命令 群保持部 250に書き込む。
[0265] C)被参照変数値代入処理命令群生成部 240aは、被参照変数値代入処理命令群
310aによる、被参照変数が取りうる値の集合を求める。この集合は、 {encryptedDa ta I encrypteaData = compressedData w 8、 compressedData = OxOO、 0x0
1、 · · ·、 OxlF}となる。
[0266] D)被参照変数値代入処理命令群生成部 240aは、求めた集合を被参照変数値保 持部 260aに書き込む。ここでは、集合 {encryptedData | encryptedData = com pressedData < < 8、 compressedData = OxOO、 0x01、、、 OxlF}を書き込む。
[0267] (4. 2)被参照変数値保持部 260a
被参照変数値保持部 260aは、第一処理命令群 140を実行する際に必要なパラメ ータに設定する値を記憶する領域を備える。
[0268] 具体的には、例えば、被参照変数値保持部 260aは、変数名と、その変数名の変 数が取りうる値の集合の情報とを記憶する領域を備える。
[0269] より具体的には、図 5Aの第一処理命令群 140に対しては、被参照変数値保持部 2 60aは、集合 {encryptedData | encryptedData = compressedData w 8、 co mpressedData = 0x00、 0x01、…ゝ OxlF}を保持する。ここで、変数名は「encryp tedData」"Cあり、その値の集合は、 {encryptedData = compressedData< < 8、 compressedData = 0x00, 0x01、 · · ·、 OxlF}である。なお、保持する内容は、具 体的に値を列挙したものであっても、集合の表現であっても構わな 、。
[0270] (4. 3)想定値算出部 290a
想定値算出部 290aは、被参照変数値保持部 260aが保持する被参照変数の値を 用いて第一処理命令群 140を実行した場合に、被代入変数に代入される想定値の 値を算出する。ここで、被参照変数の値が 1つの値だけではなぐ値の集合に含まれ る何れかの値であるので、想定値算出部 290aは、想定値を集合として求める。
[0271] 具体的には、想定値算出部 290aは、例えば以下の A)〜C)の処理を行う。
[0272] A)想定値算出部 290aは、被代入変数情報保持部 280から被代入変数情報を読 み込む。
[0273] B)想定値算出部 290aは、被参照変数値保持部 260aから被参照変数名、および 値の集合を読み込み、値の集合の要素につ!、て以下の( a )および( j8 )の処理を繰 り返す。
[0274] ( α )想定値算出部 290aは、被参照変数に、読み込んだ値を代入し、入力処理 命令群保持部 210が保持する第一処理命令群 140を実行する。
[0275] ( |8 )想定値算出部 290aは、第一処理命令群 140の実行後の被代入変数の値を 参照する。
[0276] C)想定値算出部 290aは、 B)で参照した値の集合および、 A)で読み込んだ被代 入変数の変数名を想定値情報保持部 295に格納する。
[0277] より具体的には、(4. 1)および (4. 2)の具体例に示した処理が行われている場合
、想定値算出部 290aは、以下の処理を行う。
[0278] A)想定値算出部 290aは被代入変数情報「int plainData」を読み込む。
[0279] B)想定値算出部 290aは集合 {encryptedData | encryptedData = compresse dData< < 8、 compressedData = OxOO、 0x01、…ゝ OxlF}を読み込む。
[0280] 想定値算出部 290aは「compressedData」が「0x00、 0x01、 · · ·、 0xlF」の各場 合にっ 、て、以下の(ひ )および( β )の処理を繰り返す。
[0281] ( α )想定値算出部 290aは「compressedData」が各値の場合の「encryptedD atajの値を算出し、さらに第一処理命令群 140による処理の結果である「encrypted
Data'0x00FF」を算出する。 [0282] ( j8 )想定値算出部 290aは、算出した値を参照する。なお、 compressedDataが 「0x00、 0x01、 · · ·、 0xlF」の各場合について被代入変数「plainData」の値は「0x0 OFF, 0x0 IFF,…ゝ 0xlFFF」となる。
[0283] C)想定値算出部 290aは、 {plainData | plainData=0x00FF、 0x0 IFF,…ゝ 0 xlFFF}を想定値情報保持部 295に格納する。
[0284] なお、上述した処理は、「plainData」の値の集合を、列挙により表現する場合の処 理である。「plainData」の値を集合の表現として記録する場合には、想定値算出部 290aは、 )および(j8 )の処理を繰り返す代わりに、第一処理命令群 140の処理「 encrypedData 0x00FF」 用いて、 ipiamData | plamData= (compressedDa ta< < 8) "0x00FF, compressedData = 0x00、 0x01、…ゝ OxlF}を格納しても 構わない。
[0285] (4. 4)想定値情報保持部 295a
想定値情報保持部 295aは、想定値情報を記憶する領域を備える。
[0286] 具体的には、想定値情報保持部 295aは、想定値算出部 290aが算出した想定値 の集合とその変数名を上述の想定値情報として保持する。
[0287] より具体的には、想定値情報保持部 295aは、想定値算出部 290aが(4. 3)に示し た具体例の処理を行っている場合、 {plainData | plainData = 0x00FF、 0x0 IFF 、 · · ·、 OxlFFF}を記憶する。ここで、変数名は「plainData」であり、その値の集合は 、 { plainData = 0x00FF、 0x0 IFF,…ゝ OxlFFF}である。なお、上述のような値を 列挙する形式で想定値を保持するのではなぐ集合を示す形で想定値を保持しても よいことは言うまでもない。この場合、想定値情報保持部 295aは、 {plainData | pla mData = (.compressedData^ ^ 8) 0x00FF、 compressedData = 0x00、 0x0 1、 ' ^ OxlF}を記憶する。
[0288] (4. 5)依存処理命令群生成部 201a
依存処理命令群生成部 201aは、想定値情報保持部 295aが保持する想定値およ び入力処理命令群保持部 210が保持する第二処理命令群 150に基づき依存処理 命令群 330aを生成する。
[0289] 依存処理命令群 330aは、第二処理命令群 150と同等の処理を行う処理命令群で あって、第一処理命令群 140の処理結果を参照する処理を含み、一部の処理がそ の参照した値を用いた処理となって 、る処理命令群である。
[0290] 具体的には、例えば、依存処理命令群 330aは、以下の A)〜F)の処理を行う。
[0291] A)依存処理命令群生成部 201aは、第二処理命令群 150に含まれる処理命令に 含まれる定数を見つける。この定数を含む処理命令を Or 1、その定数の値を Valと する。
[0292] B)依存処理命令群生成部 201aは、想定値情報保持部 295aが保持する想定値 情報を読み込む。
[0293] C)依存処理命令群生成部 201aは、想定値の集合の全ての要素を 1つの値 Va2 に対応させる写像 Fを生成する。例えば、被参照変数が Xであり、想定値の集合が {x I x=x— 0、 x— 1、 · · ·、 x— n}の時、依存処理命令群生成部 201aは、写像 Fを (χ' χ_0) * (χ'χ_1) *… * (χ'χ_η)とする。ここで、「*」は乗算を示す。 x=x_t (t =0、 1、 · · ·、 nの何れ力)であるので、写像 Fを示す式の第 t項 (x"x— t)の値は 0とな り、第 t項以外の項は値が何であっても値 0 (第 t項)との積となるので写像 Fは 0となる 。つまり、この例では、 Va2= (x"x_0) * (x"x_l) *… * (x"x_n) =0の関係が 成り立つ。
[0294] D)依存処理命令群生成部 201aは、 Va3 =Va2— Valを算出する。先述の例では , Val =Va2-Va3 = (x"x_0) * (x'x— 1) *… * (x'x— n)— Va3の関係力城り 立つ。
[0295] E)依存処理命令群生成部 201aは、処理命令 Or 1に含まれる値 Valを「写像 Fの 処理 Va3」に置き換えた処理命令 Or2を生成する。
[0296] F)依存処理命令群生成部 201aは、第二処理命令群 150の処理命令 Or 1を処理 命令 Or2に置き換えた命令群である依存処理命令群 330を生成する。
[0297] より具体的には、想定値情報保持部 295aが (4. 4)の具体例に示した処理を行つ ている場合、依存処理命令群生成部 201aは、以下の A)〜F)の処理を行う。
[0298] A)依存処理命令群生成部 201aは、第二処理命令群 150に含まれる処理命令に 含まれる定数を見つける。つまり、依存処理命令群生成部 201aは、この定数を含む 処理命令 Orlを「decompressedData= (decompressedDataくく 1) | 0x0001 ;」とし、その定数の値 Valを「0x0001」とする。
[0299] B)依存処理命令群生成部 201は、想定値情報保持部 295から想定値情報 {plain
Data I plainData = OxOOFF, 0x0 IFF,…ゝ OxlFFF}を読み込む。
[0300] C)依存処理命令群生成部 201aは、想定値の集合の全ての要素を 1つの値 Va2「
0」に対応させる写像 F「(plainData "OxOOFF) * (plainData "0x0 IFF) *… * (p lainData'Oxl IFF)」を生成する。
[0301] D)依存処理命令群生成部 201aは、 Va3 =Va2— Valを算出する。すなわち「Va
3 = 0 - 0x0001 =— 1 = OxFFFF」を算出する。
[0302] E)依存処理命令群生成部 201aは、処理命令 Orlに含まれる値 Val「0x0001」を
、「写像 Fの処理— Va3」すなわち「(plainData'OxOOFF) * (plainData "0x0 IFF
) * · · · * (plainData "Oxl IFF) -OxFFFFjに置き換えた処理命令 Or2を生成する
[0303] すなわち、処理命令 Or2「decompressedData= (decompressedDataくく 1)
I ( (plainData "OxOOFF) * (plainData "0x0 IFF) *… * (plainData "0x1 IFF ) )一 OxFFFF);」を生成する。
[0304] F)依存処理命令群生成部 201は、第二処理命令群 150の処理命令 Orlを処理命 令 Or2に置き換えた命令群である依存処理命令群 330aを生成する。
[0305] すなわち、「 ior、counter=0 ; counter< compressedData ; counterバ decom pressedData= (decompressedData < < 1) | "plainData OxOOFF) * (plain Data'OxOlFF) *〜* (plainData'Oxl lFF) )— OxFFFF) ; }」が生成される。
[0306] ここでは、更に、 C言語の言語形式にしたがって関数宣言や変数宣言を追加する。
[0307] なお、 C)では想定値の集合の全ての要素を 1つの値に対応させる写像 Fの一例を 示したが、他の写像であっても構わない。また、写像 Fを予めいくつか登録できるよう にして、その中から選択する構成であっても構わない。また、写像 Fをユーザが指定 する構成であっても構わない。この場合も、実施の形態 1と同様、同じ写像を使って 何度も難読ィ匕が行われる場合に有用である。
[0308] また、上記で説明した写像 Fとは異なる他の写像の具体例としては、例えば図 9の 依存処理命令群 330a中の「(compressedDataく < 8) ' plainData 'OxOOFEj力 S ある。このような写像であっても正しい値「0x0001」が得られることは、上述したとおり である。
[0309] (変形例 7)
改竄防止処理生成装置 110は、複数の処理命令群の入力を受け付け、その中か ら第一処理命令群 140と第二処理命令群 150を選択してもよい。例えば、改竄防止 処理生成装置 110は、処理命令群 Al、処理命令群 A2、 ···、処理命令群 Anを取得 し、その中からランダムに第一処理命令群 140と第二処理命令群 150の組を選択し 難読化を行っても構わない。さらに、処理を行う対象は 1組だけに限るものではなぐ 選択と難読化を繰り返しても構わな!/ヽ。
[0310] また、例えば、改竄防止処理生成装置 110は、第一処理命令群 140を処理命令群 A1とし、第二処理命令群 150を処理命令群 A1以外の処理命令群からランダムに選 択して難読化を行い、以下、処理命令群 A2、 · ··、 Anについてもそれぞれを第一処 理命令群 140とし、その第一処理命令群 140とされた処理命令群以外の処理命令 群から第二処理命令群 150を選択して難読化してもよい。
[0311] 以上のような構成を用いれば、処理命令群 Al〜Anは複雑に絡みあうので、さらに 改竄を困難にすることが出来る。
[0312] また、本発明の応用例として、改竄防止処理生成装置 110と同等の構成を一部とし て含み、プログラムの実行時に改竄防止処理生成装置 110による変換を行った上で プログラムを実行する実行処理装置を実装することも考えられる。この場合、その実 行処理装置に本変形例と同様の構成を持たせると、どの処理命令群が第一処理命 令群および第二処理命令群であるのかを特定することが困難になるため、より解析を 困難にすることができる。
[0313] (変形例 8)
ここでは、第一処理命令 140に含まれる命令を保護対象とし、その命令に対する改 竄を防止する場合について説明した。しかし、改竄を防止すべき対象は命令に限る ものではなぐデータであってもよい。実施の形態 1のように、命令群を保護する場合 は、その命令群へ分岐する処理を追加していたが、保護対象がデータである場合に は、そのデータを所定の変数等に読み込む処理を追加する。例えば、第一処理命令 群 140が使用するデータを保護対象とする場合であれば、分岐処理命令群 320の 替わりに、保護対象データを読み込む処理を追加し、依存処理命令群 330は、その 変数に依存し、変数に格納されている値が想定値 (ここでは、改竄のないデータ)で ある場合に正しく動作する構成とすることが考えられる。
[0314] このような構成を用いれば、分岐処理命令群 320によって第一処理命令群 140が 実行される替わりに、保護対象データが変数に読み込まれる。そして、保護対象デー タに改竄があれば、変数に読み込まれる値が変化することにより、依存処理命令群 3 30が第二処理命令群 150と異なる動作をするようになる。したがって、実施の形態 1 における第一処理命令群 140に対する保護と同様にして、保護対象データを保護す ることができる。なお、保護対象データは、例えば、携帯電話における電話番号等の 機器固有番号である。
[0315] (実施の形態 2)
本発明に関わる実施の形態 2としての処理システム 100bについて説明する。
[0316] 図 11は、実施の形態 2における処理システム 100bの構成を示す図である。
[0317] 本実施の形態における処理システム 100bは、第一処理命令群 140bの入力を受 け付けて、第一処理命令群 140bの改竄チェックを目的とした出力処理命令群 160b を生成するシステムであって、改竄防止処理生成装置 110b (命令生成装置)と、実 行処理装置 130bとを備える。
[0318] 改竄防止処理生成装置 110bは、保護対象コードを確実に保護し得るプログラムを 生成する装置である。つまり、改竄防止処理生成装置 110bは、保護対象コードであ る第一処理命令群 140bを取得して、その保護対象コードの改竄チェック処理を行う 出力処理命令群 160bを生成する。また、改竄防止処理生成装置 110bは、その生 成された出力処理命令群 160bと第一処理命令群 140bとを記録媒体 120bに書き込 む。
[0319] 実行処理装置 130bは、記録媒体 120bに記録されている第一処理命令群 140bお よび出力処理命令群 160bを読み出して実行する。
[0320] なお、改竄防止処理生成装置 110bは、第一処理命令群 140bおよび出力処理命 令群 160bを記録媒体 120bに書き込むことなぐ通信媒体を介して実行処理装置 13 Obに送信してもよい。
[0321] 出力処理命令群 160bは、処理の途中で第一処理命令群 140bを呼び出す構成と なっている。すなわち、実行処理装置 130bで出力処理命令群 160bが実行される場 合、最初は出力処理命令群 160bに含まれる命令群が実行され、途中で第一処理命 令群 140bが呼び出されて実行され、次にまた出力処理命令群 160bの続きの処理 命令群が実行される。
[0322] 第一処理命令群 140bは、実行処理装置 130bで実行される処理命令群であって、 出力処理命令群 160bの処理の途中に実行される場合もあれば、それとは別に実行 される場合ちある。
[0323] 具体的には、例えば、第一処理命令群 140bは、コンテンツの暗号化された再生可 能回数を入力とし、これを復号し、平文の再生可能回数を出力する処理である。出力 処理命令群 160bは第一処理命令群 140bが改竄されていないかをチェックし、改竄 されていない場合、 0を返し、改竄されていた場合、実行処理装置 130bで実行中の 処理を停止する処理命令群である。
[0324] 以下、それぞれについて詳細な説明を行う。
[0325] (1)出力処理命令群 160bの構成
図 12は、出力処理命令群 160bの構成を示す図である。
[0326] 出力処理命令群 160bは、第一処理命令群 140bを実行する際に必要となる各種 パラメータに値を設定する被参照変数値代入処理命令群 310bと、第一処理命令群 140bを呼び出す分岐処理命令群 320bと、第一処理命令群 140bを呼び出した後 に実行される依存処理命令群 330bとからなる。実行処理装置 130bで出力処理命 令群 160bが実行される場合、被参照変数値代入処理命令群 310b、分岐処理命令 群 320b、第一処理命令群 140b、依存処理命令群 330bの順に各処理命令群の処 理が実行される。
[0327] 以下、それぞれを説明する。
[0328] (1. 1)被参照変数値代入処理命令群 310b
実施の形態 1における被参照変数値代入処理命令群 310と同様である。
[0329] (1. 2)分岐処理命令群 320b 実施の形態 1における分岐処理命令群 320と同様である。
[0330] (1. 3)依存処理命令群 330b
依存処理命令群 330bは、第一処理命令群 140bを呼び出した後に実行される処 理命令群であり、第一処理命令群 140bの処理結果に基づき改竄をチェックする処 理を行う。
[0331] 第一処理命令群 140bの処理結果とは、具体的には、例えば、第一処理命令群 14 Obが関数である場合には関数の戻り値である。また、例えば、第一処理命令群 140b が外部変数に値を決定する命令群であるならば、第一処理命令群 140bの処理結果 とは、外部変数に代入された値である。また、例えば、第一処理命令群 140bがスタツ クに値を格納する命令群であれば、第一処理命令群 140bの処理結果とは、スタック に格納された値である。また、例えば、第一処理命令群 140bがアドレス変数で指定 した位置に値を格納する命令群であれば、第一処理命令群 140bの処理結果とは、 その格納された値である。これらの第一処理命令群 140bの処理結果が格納される 格納先のことを、実施の形態 1と同様に、被代入変数と呼ぶものとする。
[0332] 第一処理命令群 140bの処理結果を予め知ることは一般には出来ないが、第一処 理命令群 140bを実行する際に必要となる各種パラメータの値が被参照変数値代入 処理命令群 310bで設定した値である時に限っては、処理結果の値を予め知ること ができる。具体的には、例えば、被参照変数値代入処理命令群 310bが設定する値 を実際に被参照変数に設定した上で、第一処理命令群 140bを実行すれば、処理 結果の値を知ることができる。以降の説明では、実施の形態 1と同様に、この値を想 定値と呼ぶものとする。
[0333] (1. 4)出力処理命令群 160bの一例
図 13は、 C言語で記述された出力処理命令群 160bの具体例を示す図である。
[0334] 出力処理命令群 160bは、図 5Aの第一処理命令群 140と同等の処理命令群を第 一処理命令群 140bとした時の出力処理命令群であり、第一処理命令群 140bの改 竄チェックを行う処理命令群である。
[0335] 被参照変数値代入処理命令群 310b rencryptedData=0xF022;」は、第一処 理命令群 140bを呼び出す際の引数に値を代入する処理を示す命令群である。すな わち、被参照変数値代入処理命令群 310bは変数「encryptedData」に値「0xF02 2」を代入する。
[0336] 分岐処理命令群 320b「plainData = decrypt (encryptedData);」は、引数を変 数「encryptedData」として第一処理命令群 140bを呼び出す処理を示す命令群で あり、処理結果を変数「plainData」に格納する。実行処理装置 130bにおいて、分岐 処理命令群 320bが正常に実行された場合の戻り値の想定値は、変数「encrypted DataJを値「0xF022」とし、第一処理命令群 140bの処理を行った際の結果である「 0xF022"0x00FF = 0xF0DD」となる。
[0337] 依存処理命令群 330bは、第一処理命令群 140bの処理結果が、想定値と等 ヽ かを判定し、等しい場合は 0を返し、等しくない場合は実行処理装置 130bで実行中 の処理を停止する処理命令群であって、「 if (plainData! =0xF0DD) {exit (l); }return0;」により表される。
[0338] 上記の処理にぉ 、て、第一処理命令群 140bが改竄されて 、る場合、第一処理命 令群 140bの処理結果は想定値と異なる値となる。
[0339] (1. 5)出力処理命令群 160bの効果
実施の形態 2の出力処理命令群 160bは、第一処理命令群 140bを実行する際に 必要となる各種パラメータに値を設定する被参照変数値代入処理命令群 310bと、 第一処理命令群 140bを呼び出す分岐処理命令群 320bと、第一処理命令群 140b を呼び出した後に実行される依存処理命令群 330bとからなる。
[0340] このような構成を用いれば、第一処理命令群 140bの処理命令が改竄されて 、る場 合、第一処理命令群 140bの処理結果が想定値と等しいかを判定することにより、第 一処理命令群 140bの改竄を検出することができる。
[0341] 従来のハッシュチェックによる改竄チェックは、プログラムをデータとして読み込む必 要があった。ところが、通常のプログラムは実行対象として読み込まれることはあって も、データとして読み込まれることは少なぐまた読み込みに使用する命令も特殊なも のである。よって、不正解析者は、命令を監視し、プログラムをデータとして読み込む 命令が実行された場合、その読み込みを行って!、る処理は改竄チェック処理命令群 の一部であり、読み込まれている処理は改竄防止対象となる重要な処理である可能 性が高いと判断することができた。しかし、本実施の形態の方法では、プログラムをデ ータとしてアクセスすることなくプログラムの改竄を検出することが出来る。また、プロ グラムをデータとしてアクセスすることを禁止している言語でも改竄チェックを行うこと ができる。
[0342] (2)改竄防止処理生成装置 110bの構成
図 14は、改竄防止処理生成装置 110bの構成を示す図である。ここで、改竄防止 処理生成装置 110bは、第一処理命令群 140bの改竄チェックを行う出力処理命令 群 160bを生成する装置である。
[0343] 改竄防止処理生成装置 110bは、入力処理命令群保持部 210b、被参照変数解析 部 220b、被参照変数情報保持部 230b、被参照変数値代入処理命令群生成部 24 0b、被参照変数値代入処理命令群保持部 250b、被参照変数値保持部 260b、被 代入変数解析部 270b、被代入変数情報保持部 280b、想定値情報保持部 295b、 想定値算出部 290b、依存処理命令群生成部 201b、依存処理命令群保持部 202b 、分岐処理命令群生成部 203b、分岐処理命令群保持部 204b、出力処理命令群生 成部 205b、および出力処理命令群保持部 206bを備えて ヽる。
[0344] 入力処理命令群保持部 210bは、第一処理命令群 140bを取得して保持する。
[0345] 被参照変数解析部 220bは、第一処理命令群 140bを実行する際に値を設定して おく必要のある引数等の変数 (被参照変数)が何であるかを解析する。
[0346] 被参照変数情報保持部 230bは、被参照変数解析部 220bによる解析によって得ら れた被参照変数の変数名等の情報を保持する。
[0347] 被参照変数値代入処理命令群生成部 240bは、被参照変数に値を代入する被参 照変数値代入処理命令群 31 Obを生成する。
[0348] 被参照変数値代入処理命令群保持部 250bは、被参照変数値代入処理命令群生 成部 240bが生成した被参照変数値代入処理命令群 310bを保持する。
[0349] 被参照変数値保持部 260bは、被参照変数値代入処理命令群 310bが被参照変 数に代入する値を保持する。
[0350] 被代入変数解析部 270bは、第一処理命令群 140bの処理結果が代入される変数
(被代入変数)が何であるかを解析する。 [0351] 被代入変数情報保持部 280bは、被代入変数解析部 270bによる解析によって得ら れた被代入変数の変数名等の情報を保持する。
[0352] 想定値算出部 290bは、被参照変数の値を被参照変数値保持部 260bが保持する 値とし、第一処理命令群 140bを実行した際に得られる被代入変数の想定値を算出 する。
[0353] 想定値情報保持部 295bは、想定値算出部 290bが算出した想定値を保持する。
[0354] 依存処理命令群生成部 201bは、想定値に基づき依存処理命令群 330bを生成す る。
[0355] 依存処理命令群保持部 202bは、依存処理命令群生成部 201bが生成した依存処 理命令群 330bを保持する。
[0356] 分岐処理命令群生成部 203bは、入力処理命令群保持部 210bが保持する第一処 理命令群 140bを呼び出す分岐処理命令群 320bを生成する。
[0357] 分岐処理命令群保持部 204bは、分岐処理命令群生成部 203bが生成した分岐処 理命令群 320bを保持する。
[0358] 出力処理命令群生成部 205bは、被参照変数値代入処理命令群保持部 250bが 保持する被参照変数値代入処理命令群 310bと、分岐処理命令群保持部 204bが 保持する分岐処理命令群 320bと、依存処理命令群保持部 202bが保持する依存処 理命令群 330bとからなる出力処理命令群 160bを生成する。
[0359] 出力処理命令群保持部 206bは、出力処理命令群生成部 205bが生成した出力処 理命令群 160bを保持する。
[0360] 以下、実施の形態 1と異なる入力処理命令群保持部 210b、および依存処理命令 群生成部 201bについて説明する。他の部は、実施の形態 1記載の対応する部と同 等の処理を行うので、説明を省略する。
[0361] (2. 1)入力処理命令群保持部 210b
入力処理命令群保持部 210bは、外部から第一処理命令群 140bの入力を受け付 ける。つまり、入力処理命令群保持部 210bは、第一処理命令群 140bを取得する。 また、入力処理命令群保持部 210bは、 1以上の処理命令群を記憶する領域を備え ている。入力処理命令群保持部 210bは、改竄防止処理生成装置 110bに入力され た第一処理命令群 140bを保持する。
[0362] (2. 2)依存処理命令群生成部 201b
依存処理命令群生成部 201bは、想定値情報保持部 295bが保持する想定値に基 づき依存処理命令群 330bを生成する。
[0363] 具体的には、例えば、依存処理命令群生成部 201bは、以下の A)〜D)の処理を 行う。
[0364] A)依存処理命令群生成部 201bは、想定値情報保持部 295bが保持する想定値 情報を読み込む。
[0365] B)依存処理命令群生成部 201bは、その想定値を保持すべき変数 (被代入変数) を Vrl、その想定値を Valとする。
[0366] C)依存処理命令群生成部 201bは、変数 Vrlと想定値 Valを比較し、等しい場合 は 0を返し、等しくな 、場合は実行処理装置 130bで実行中の処理を停止する処理 命令群を生成する。なお、ここでは一般的なプログラミングの作法にしたがって、検証 結果が正 、場合 (ここでは改竄がな!、ことが確認された場合)には 0を返すとして ヽ る力 これに限るものではない。 0以外の値を返すとしてもよいし、何も値を返さないと してもよい。すなわち、改竄がないことが確認された場合に、実行中の処理が継続さ れる限り、返す値はどのようなものであっても構わない。
[0367] D)依存処理命令群生成部 201bは、生成した依存処理命令群 330bを依存処理 命令群保持部 202bに格納する。
[0368] より具体的には、想定値情報保持部 295bが実施の形態 1の(2. 10)と同様の処理 を行っている場合、依存処理命令群生成部 201bは、以下の A)〜D)の処理を行う。
[0369] A)依存処理命令群生成部 201bは、想定値情報保持部 295bが保持する想定値 情報「int plainData = 0xF0DD」を読み込む。
[0370] B)依存処理命令群生成部 20 lbは、その想定値を保持すべき変数「plainData」を Vrlとし、その想定値「0xF0DD」を Valとする。
[0371] C)依存処理命令群生成部 201bは、変数 Vrlと想定値 Valを比較し、等しい場合 は 0を返し、等しくな 、場合は実行処理装置 130bで実行中の処理を停止する処理 命令群「 if (plainData! = OxFODD) { exit ( 1 ); } returnO;」を生成する。 [0372] D)依存処理命令群生成部 201bは、生成した依存処理命令群 330bを依存処理 命令群保持部 202bに格納する。
[0373] (2. 3)改竄防止処理生成装置 110bの効果
改竄防止処理生成装置 110bは、プログラムをデータとして読み込むことなくプログ ラムの改竄をチェックできる改竄チェック処理命令群(出力処理命令群 160b)を生成 することが出来る。
[0374] 図 15は、改竄防止処理生成装置 110bの効果を説明するための説明図である。
[0375] 改竄防止処理生成装置 110は、例えば、第一処理命令群 140bを含む入力プログ ラム 101bを取得して、その入力プログラム 101bを改竄防止プログラム 102bに変換 して出力する。このとき、改竄防止処理生成装置 110は、上述のように、出力処理命 令群 160bを生成して入力プログラム 101bに追加している。
[0376] つまり、改竄防止処理生成装置 110は、保護対象コードである第一処理命令群 14 Obの呼出処理 (被参照変数値代入処理命令群 310bおよび分岐処理命令群 320b) と、呼出処理によって行われた第一処理命令群 140bの処理結果が想定値と異なる ときに実行処理装置 130bによって実行されている処理を中止させる判定 Z終了処 理 (依存処理命令群 330b)とを、改竄防止処理として生成し、入力プログラム 101b に追加している。
[0377] 保護対象コード (第一処理命令群 140)の呼出処理では、被参照変数値代入処理 命令群 310bにおいて、保護対象コードの被参照変数「encryptedData」に値「0x0 022」が代入された状態で、保護対象コードが呼び出される。
[0378] その結果、改竄防止プログラム 102bでは、従来のように保護対象コードがデータと して読み込まれることがないため、不正解析者によって改竄防止処理が見つけられる のを困難にすることができる。
[0379] さらに、判定 Z終了処理では、依存処理命令群 330bの「if (plainData! =0xF0 DD) {exit (l) ; }return0 ;」力 上述の呼出処理によって保護対象コードが呼び出 されて実行された結果 (第一処理命令群 140bの処理結果)である「plainData」の値 に依存している。つまり、保護対象コードが改竄されていなければ、「plainData」の 値は想定値「0xF0DD」となるため、改竄防止プログラム 102bの出力処理命令群 16 0が実行されると、改竄防止プログラム 102bにおける入力プログラム 101bと同等の 処理が実行処理装置 130bにより正しく実行される。
[0380] 一方、保護対象コードが改竄されて!、れば、「plainData」の値は想定値「0xF0D D」と異なるため、実行処理装置 130bによって実行されている、改竄防止プログラム 102bにおける入力プログラム 101bと同等の処理が中止されることとなる。
[0381] このように、本実施の形態における改竄防止処理生成装置 110bは、入力プロダラ ム 101bに対して保護対象コードの呼出処理および判定 Z終了処理を生成して追カロ することにより、保護対象コードに対する改竄を確実に防止することができる。また、 本実施の形態における改竄防止処理生成装置 11 Obは、実行中にメモリ上にあるコ ードをデータとして読み込むことができな 、Java (登録商標)等の言語で記述された プログラムに対しても、そのプログラムの保護対象コードに対する改竄を確実に防止 することができる。
[0382] (実施の形態 3)
本発明に関わる実施の形態 3の処理システム 1300について説明する。実施の形 態 3に係る処理システム 1300は、 1つの入力プログラム中に含まれる第一処理命令 群 (後述する A命令群に対応)と第二処理命令群 (後述する B命令群と SUC— B命 令群に対応)とを用いて、その入力プログラムの難読ィ匕を行う。また、実施の形態 1お よび 2では、第一処理命令群の処理結果を第二処理命令群でも用いるように難読ィ匕 していたが、実施の形態 3では、 A命令群 (第一処理命令群)の処理結果を SUC— B 命令群 (第二処理命令群)では用いない。つまり、実施の形態 3では、第二処理命令 群の処理途中で本来不要な処理である第一処理命令群に分岐し、その後第二処理 命令群の続きを行わせることで、制御構造の複雑ィ匕を図って 、る。
[0383] 実施の形態 3では、このような入力プログラムの難読ィ匕 (制御構造の複雑化)を図る ことにより、保護対象コードである A命令群 (第一処理命令群)を改竄から確実に保護 することができる。
[0384] 従来、プログラムの処理の流れを困難にし、不正な解析を防止する技術として、非 特許文献 1 (Chenxi Wang、 A security Architecture for Survivability Mechanisms", Ph. D. Dissertation (2000) )に記載の技術のような単純な 無条件分岐命令を分岐先が分力り難い条件分岐命令に置換える方法や、プログラム を複数の命令群に分割して命令群の配置順序を入替える方法が知られて 、る。不正 な解析の結果は、その後の不正な改竄の際に手掛かりとなるため、解析の時点で不 正行為を防止できるようにことは有用である。しかし、上述したような方法で難読化を 行ったとしても、実際にプログラムを動かすことで命令群の実行順序や前後関係 (例 えば、 PRE— A命令群の次に A命令群が実行されるという関係)を知ることは出来て しまう。そこで、実施の形態 3では、プログラムを実際に動力した時にも命令群の実行 順序等が分力 な 、ように制御構造を難読化する。
[0385] 以下、実施の形態 3の処理システム 1300を説明する。
[0386] 図 16は、実施の形態 3における処理システム 1300の構成を示す図である。
[0387] 本実施の形態における処理システム 1300は、改竄防止処理生成装置 (命令生成 装置) 1320と、実行処理装置 1340とを備える。
[0388] 改竄防止処理生成装置 1320は、保護対象コードを確実に保護し得るプログラムを 生成する装置であって、保護対象コードを含む入力プログラム 1310を取得してその 入力プログラム 1310を難読ィ匕することにより、改竄防止プログラム 1330を生成する。
[0389] また、改竄防止処理生成装置 1320は、その生成された改竄防止プログラム 1330 を記録媒体 1350に書き込む。
[0390] 実行処理装置 1340は、記録媒体 1350に記録されている改竄防止プログラム 133
0を読み出して実行する。
[0391] なお、改竄防止処理生成装置 1320は、改竄防止プログラム 1330を記録媒体 135
0に書き込むことなぐ通信媒体を介して実行処理装置 1340に送信してもよい。
[0392] ここで、入力プログラム 1310は、以降に述べるように、一つ以上の命令からなる PR
E— A命令群と、 PRE— A命令群の後に実行される A命令群と、 B命令群とを含む。
[0393] (1)入力プログラム 1310の構成
図 17は、入力プログラム 1310の構成を示す図である。
[0394] 入力プログラム 1310は、 A命令群 1420と、 A命令群 1420の分岐元の命令群であ る PRE— A命令群 1410と、 A命令群 1420の分岐先の命令群である SUC— A命令 群 1430と、 B命令群 1440と、 B命令群 1440の分岐先の命令群である SUC B命 令群 1450とを含んで!/、る。
[0395] ここで、各命令群は 0以上の命令力もなる命令の集合である。すなわち、一部の命 令群については、存在していなくとも良い。例えば、 A命令群 1420がプログラムの先 頭である場合には、 PRE— A命令群 1410は存在しなくともよい。また、 A命令群 142 0や B命令群 1440力 プログラムの最後である場合には、 SUC— A命令群 1430や SUC— B命令群 1450は存在しなくともよい。
[0396] また、ここで、 Y命令群が X命令群の分岐先であるとは、 X命令群の後に Y命令群が 実行されることを意味する。具体的には、例えば、 X命令群の直後に Y命令群が配置 されている場合や、 X命令群に Y命令群への分岐命令が含まれる場合などがある。な お、 X命令群の直後に明示的な分岐命令が存在していなくとも、プログラムの記法上 、 X命令群の後に Y命令群が実行される場合も、本実施の形態では分岐と呼ぶ。例 えば C言語では、特に分岐命令等がない場合、プログラム中の命令は上力 順に実 行される。この場合、 X命令群の下に Y命令群が記述されていれば、 X命令群の後に Y命令群が実行されるので、 Y命令群は X命令群の分岐先である。また、 X命令群が Y命令群の分岐元であるとは、 Y命令群が X命令群の分岐先であることを意味する。
[0397] なお、分岐命令とは、具体的には、条件分岐命令や、無条件分岐命令、サブルー チンコール、例外を発生させる命令、割込みを発生させる命令などを含む。すなわち 、ある命令群力 別の命令群へ実行を移すような命令は 、ずれも本明細書で述べる 分岐命令に当たる。例えば、アセンブリ言語の命令であれば、「CALL、 RET」のよう な関数コールや「JA、 JMP、 LOOP」などのジャンプ命令、「INT」などの割り込み命 令である。
[0398] 図 18は、 C言語における入力プログラム 1310の具体的な一例を示す図である。
[0399] 入力プログラム 1310は、 PRE— A命令群 1410と、 A命令群 1420と、 SUC— A命 令群 1430と、 B命令群 1440と、 311じ—8命令群1450とを含む。
[0400] (2)改竄防止プログラム 1330の構成
改竄防止プログラム 1330は、入力プログラム 1310が改竄防止処理生成装置 132
0によって難読ィ匕されたプログラムである。
[0401] 図 19は、改竄防止プログラム 1330の構成を示す図である。 [0402] 改竄防止プログラム 1330は、 PRE— A命令群 1410と、 STR— A変数群値代入命 令群 1620と、 A命令群 1420と、じ !^—八8条件分岐命令群1610と、 SUC— A命 令群 1430と、 B命令群 1440と、 STR— B変数群値代入命令群 1630と、退避命令 群 1640と、 BR— B分岐命令群 1660と、復帰命令群 1650と、 SUC— B命令群 145 0とを含んでいる。
[0403] 入力プログラム 1310では、 A命令群 1420が実行されるのは PRE— A命令群 141 0が実行された後だけであった力 改竄防止プログラム 1330は、 B命令群 1440の後 にも A命令群 1420が実行されるように変換されている。より具体的に述べると、改竄 防止プログラム 1330では、 PRE— A命令群 1410、 A命令群 1420、 SUC— A命令 群 1430の順に各命令群の処理が実行される場合もあれば、 B命令群 1440、 A命令 群 1420、 SUC— B命令群 1450の順で各命令群の処理が実行される場合もある。 すなわち、 B命令群 1440と SUC— B命令群 1450の間に A命令群 1420の実行が割 り込む場合がある。
[0404] 図 20は、 C言語で表した改竄防止プログラム 1330の具体的な一例を示す図であ る。
[0405] 改竄防止プログラム 1330は、入力プログラム 1310に含まれる各要素に加え、以下 の要素を含む。これらの要素は、改竄防止処理生成装置 1320により、入力プロダラ ム 1310に付けカ卩えられる力 この付けカ卩える処理の詳細については後述する。
[0406] BR— B分岐命令群 1660は、 B命令群 1440の後に、 A命令群 1420を実行させる ための分岐命令である。
[0407] CBR— AB条件分岐命令群 1610は、 A命令群 1420の実行後、適切な分岐先を 判定してその分岐先に処理を分岐させるための命令群である。入力プログラム 1310 では、 A命令群 1420の後に実行される命令群は常に SUC— A命令群 1430であつ た力 改竄防止プログラム 1330においては、 SUC— A命令群 1430の場合と、 SUC —B命令群 1450の場合とがある。 CBR— AB条件分岐命令群 1610は、 A命令群 1 420の実行後、 SUC— A命令群 1430と SUC— B命令群 1450のどちらに分岐すベ きかを判定して、適切な分岐先に処理を分岐させる。
[0408] STR— A変数群値代入命令群 1620、および STR—B変数群値代入命令群 1630 は、 CBR—AB条件分岐命令群 1610の判定に用いる情報 (本実施の形態では、後 述する変数「var— abO」の値)をセットする命令群である。改竄防止プログラム 1330 では、 A命令群 1420が PRE— A命令群 1410の後に実行されているならば、次に実 行されるべき命令群は SUC— A命令群 1430であり、 A命令群 1420が B命令群 144 0の後に実行されているならば、次に実行されるべき命令群は SUC— B命令群 145 0である。そのどちらであるのかがわ力るように、すなわち、 PRE— A命令群 1410が 行われた後なのか、 B命令群 1440が行われた後なのかがわ力るように、判定の手掛 力ゝりを残す命令群が、 STR— A変数群値代入命令群 1620および STR— B変数群 値代入命令群 1630である。
[0409] 退避命令群 1640は、既に実行された処理結果がその後に実行される処理によつ て影響されないように、その既に実行された処理結果を退避する命令群である。また 、復帰命令群 1650は、その退避された処理結果を復帰させる命令群である。
[0410] 改竄防止プログラム 1330では、 B命令群 1440の実行と SUC— B命令群 1450の 実行と間に A命令群 1420の実行が割り込む。そのため、 B命令群 1440が終った時 点での処理の途中結果を、 A命令群の処理によって影響されないように退避しておく 必要がある。この退避処理を行う命令群が退避命令群 1640である。
[0411] また、復帰命令群 1650は、退避命令群 1640が退避した途中結果の内容を、 SU C—B命令群 1450に戻った時点で戻す。
[0412] 以下、各命令群について、図 19、図 20を用いてより詳細に説明する。
[0413] (2. 1)退避命令群 1640
B命令群 1440と SUC— B命令群 1450との間に割り込む A命令群 1420の処理に よって、 SUC— B命令群 1450およびその後で実行される命令群の処理に影響が及 ばないように、途中結果を退避しておく処理を行う命令群が退避命令群 1640である 。具体的には、退避命令群 1640は、 A命令群 1420で値が代入される変数のうち、 S UC—B命令群以降に実行される命令群において参照される変数に格納されている 値を他の変数に格納する命令群である。
[0414] 入力プログラム 1310では、 B命令群 1440と SUC— B命令群 1450以降との間には 他の命令が存在しないため、 B命令群までが実行された時点での途中結果力 SUC —B命令群以降にも引き継がれる。ここで、入力プログラム 1310が、改竄防止処理 生成装置 1320によって難読化されると、 B命令群 1440と SUC— B命令群 1450以 降の命令との間に A命令群 1420の実行が割り込むこととなる。このとき、 A命令群 14 20力 SUC— B命令群 1450以降の命令が用いる変数と同じ変数を変化させる命令 を含む場合、上述した途中結果が A命令群 1420によって書き換えられてしまうことと なる。このような事態が発生すると、改竄防止プログラム 1330の実行結果が入力プロ グラム 1310と異なるものとなってしまう。このような事態を避けるために、 A命令群 14 20が実行される前後で途中結果を退避および復帰させる必要がある。
[0415] 例えば図 20の A命令群 1420においては、変数「var— orgO」と変数「var— orgl」 とが値が代入される変数である。そのうち変数「var_org2」は、 SUC— B命令群 14 50中の命令「var— orgl = var— orgl + var— org2;」にお 、て値が参照されて!、る 。そのため、処理の途中結果である「var— org2」の値を退避する必要がある力 この 「var— org2」に格納されている値を他の変数「var— save0」に退避する処理「var— save0=var_org2;」が退避命令群 1640である。
[0416] なお、本実施の形態では、変数の値を例として述べて!/、るが、変数以外にも A命令 群 1420によって改変される恐れのある情報は退避しておくことが望ましい。このよう な情報の例としてはスタックや、レジスタ、キャッシュの記録内容などが考えられる。
[0417] (2. 2)復帰命令群 1650
復帰命令群 1650は、難読化によって B命令群 1440と SUC— B命令群 1450の間 に割り込むこととなった A命令群 1420の処理が終った後に、退避命令群 1640で退 避してぉ 、た値を元の変数に戻す命令群である。
[0418] 具体的には、図 20の復帰命令群 1650は、変数「var— save0」に退避した値を変 数「var— org2」に格納する処理「var— org2=var— save0 ;」として表される。
[0419] なお、 A命令群が、 SUC— B命令群以降の命令で参照する変数を変化させな 、場 合は、これらの変数を退避する必要がないので、退避命令群 1640と復帰命令群 16 50は不要である。
[0420] (2. 3)じ !^_八8条件分岐命令群1610
CBR AB条件分岐命令群 1610は、 SUC A命令群 1430と SUC B命令群 1 450とを条件分岐先に含む条件分岐命令である。なお、改竄防止プログラム 1330が 復帰命令群 1650を含む場合には、退避して 、た内容を復帰させた上で SUC— B命 令群 1450以降の処理を行わなくてはならないので、 SUC— B命令群 1450の替わり に復帰命令群 1650を条件分岐先とする。図 20では、 SUC— B命令群 1450と復帰 命令群 1650にそれぞれ、「SUC— B」、「SUC— B―」を付しているが、 CBR— AB 条件分岐命令群 1610は、復帰命令群 1650が存在する場合には、ラベル「SUC— B―」が付された復帰命令群 1650を分岐先とし、存在しない場合には、ラベル「SU C_BJが付された SUC— B命令群 1450を分岐先とする。復帰命令群 1650が存在 しない場合としては、復帰させるべき途中結果がない場合などが考えられる。
[0421] 図 20に例示した改竄防止プログラム 1330は、復帰命令群 1650を含む。したがつ て、じ !^—八8条件分岐命令群1610は、 SUC— A命令群 1430と復帰命令群 165 0とを条件分岐先とし、「変数 var— abO」の値によって分岐先が決定する条件分岐命 令 &1:—&1)0%2= =0) 801;0 SUC— B—;」として表される。ここで、変数「var ― abO」は、 A命令群 1420力 PRE— A命令群 1410の後に実行されたの力、 B命 令群 1440の後に実行されたのかを示す手がかりとなる変数であり、後述する G—V AL— AB変数群にあたる。改竄防止プログラム 1330では、この CBR— AB条件分岐 命令群 1610によって、 A命令群 1420の後に SUC— A命令群 1430が実行される場 合と、 A命令群 1420の後に復帰命令群 1650 (または SUC— B命令群 1450)が行 われる場合とが生じるよう制御して 、る。
[0422] なお、本実施の形態では、改竄防止プログラム 1330は C言語で記述されて 、るた め、じ !^—八8条件分岐命令群1610にぉぃて、明示的に SUC— A命令群 1430へ 分岐する命令を記述していない。すなわち、 C言語の記法上、 CBR— AB条件分岐 命令群 1610の if文中の条件「var— ab0%2= =0」が偽の場合、 CBR— AB条件分 岐命令群 1610の直後には SUC— A命令群が実行されるため、 SUC— A命令群へ の明示的な分岐命令は不要である。つまり、図 20の記述内容でも、実質的に CBR— AB条件分岐命令群 1610は SUC— A命令群 1430と SUC— B命令群 1450とのい ずれを実行するかの分岐を示すこととなる。なお、図 20の CBR— AB条件分岐命令 群 1610の直後に「else goto SUC— A;」等の明示的な分岐命令が記述されてい ても良 、ことは言うまでもな 、。上述のように明示的な分岐命令を記述しておくことで
、 CBR—AB条件分岐命令群 1610と SUC— A命令群 1430とがプログラム上で離 れた位置にあっても適切な分岐処理を行うことができる。
[0423] (2. 4) STR_A変数群値代入命令群 1620
STR— A変数群値代入命令群 1620は、じ !^—八8条件分岐命令群1610にぉ1、 て、条件分岐先が SUC— A命令群 1430と判定されるように、変数に値を代入する命 令群である。すなわち、この命令群が実行されるときは、 PRE— A命令群 1410が実 行された後に A命令群 1420が実行され、さらにその後に CBR— AB条件分岐命令 群 1610が実行されるときであるので、 STR— A変数群値代入命令群 1620は、その 旨を示す情報を変数の値として残している。なお、この変数を、以下では G— VAL— AB変数群と呼ぶ。なお、 G— VAL— AB変数群は 1つの変数である必要はなぐ複 数の変数の集合であってもよい。また、プログラム中に明示的に変数として現れるも の以外のものであってもよぐ例えばスタックの一番上に積まれている値などであって もよい。すなわち、判定の手掛力りが残せるような処理を行う命令群であれば、どのよ うな命令群であっても良い。この G— VAL— AB変数群は、 CBR— AB条件分岐命 令群 1610がどの命令に分岐すべきかを決定する際に用いられる。図 20に示した具 体例では G— VAL— AB変数群は変数「var— abO」である。
[0424] 図 20に示した具体例では、 STR— A変数群値代入命令群 1620は、 CBR— AB条 件分岐命令群 1610の if文中の条件「var— ab0%2= =0」が偽となるように「var— a bOjに値を代入する命令群「var— ab0= 1;」である。ここで、条件「var— ab0%2 = =0」が偽となれば、 CBR—AB条件分岐命令群 1610が SUC— A命令群 1430に 分岐することは、 CBR—AB条件分岐命令群 1610の説明で述べたとおりである。す なわち、改竄防止プログラム 1330では、 PRE— A命令群 1410の後に A命令群 142 0が行われた後には、(SUC— B命令群 1450ではなく) SUC— A命令群 1430が行 われるようにするために、 STR— A変数群値代入命令群 1620を用いて 、る。
[0425] (2. 5) 3丁1^—8変数群値代入命令群1630
STR— B変数群値代入命令群 1630は、上述の CBR—AB条件分岐命令群 1610 において、条件分岐先が SUC B命令群 1450と判定されるように、 G VAL AB 変数群に含まれる変数に値を代入する命令群である。すなわち、この命令群が実行 されるときは、 B命令群 1440が実行された後に A命令群 1420が実行され、さらにそ の後に CBR—AB条件分岐命令群 1610が実行されるときであるので、 STR— B変 数群値代入命令群 1630は、その旨を示す情報を変数の値として残している。ここで 、 STR— B変数群値代入命令群 1630が、複数の変数を用いたり、変数以外のもの を利用する構成であってもよ ヽことは、 STR— A変数群値代入命令群 1620と同様で ある。
[0426] 図 20に示した具体的例では、 CBR— AB条件分岐命令群 1610の1£文中の条件 ar_ab0%2= =0」が真となるように「var— abO」に値を代入する命令群「var— abO = 8 ;」が STR— B変数群値代入命令群 1630である。ここで、条件「var— ab0%2 = =0」が真となれば、 CBR—AB条件分岐命令群 1610中の if文の判定結果が真とな つて「goto SUC— B—;」が実行されるため、復帰命令群 1650への分岐処理が実 行される。すなわち、改竄防止プログラム 1330では、 B命令群 1440、退避命令群 1 640、 A命令群 1420の順に各命令群の処理が行われた後には、(SUC— A命令群 1430ではなく)復帰命令群 1650が行われるようにするために、 STR— B変数群値 代入命令群 1630を用いている。なお、復帰命令群 1650がない場合には、 STR— B 変数群値代入命令群 1630は、 B命令群 1440が実行された後に A命令群 1420が 実行され、さらにその後に SUC_B命令群 1450が実行されるようにするために、変 数の値を設定する命令群である。
[0427] (2. 6) BR_B分岐命令群 1660
図 20中の BR—B分岐命令群 1660は、 B命令群 1440から A命令群 1420へ分岐 する命令群である。ただし、改竄防止プログラム 1330が退避命令群 1640を含む場 合は、 A命令群 1420へ分岐する前に途中結果を退避する必要があるので、退避命 令群 1640による処理が終わった後で A命令群 1420へ分岐する命令群となる。
[0428] 図 20に例示した改竄防止プログラム 1330は退避命令群 1640を含むので、 BR— B分岐命令群 1660は、退避命令群 1640による処理が終わった後で A命令群 1420 へ分岐する分岐命令群「goto A;」として表される。
[0429] (2. 7)改竄防止プログラム 1330の処理の流れ 本実施の形態における改竄防止プログラム 1330の処理の流れを、入力プログラム 1310の処理の流れと比較して説明するため、先に、入力プログラム 1310の処理の 流れについて説明する。
[0430] 図 21は、入力プログラム 1310の処理の流れを示す図である。
[0431] 入力プログラム 1310は、図 21に示すように、分岐を含まない単純なものである。実 行処理装置 1340は、入力プログラム 1310を実行した場合、まず、 PRE— A命令群 1410を実行し (ステップ S200)、 A命令群 1420を実行する(ステップ S202)。さらに 、実行処理装置 1340は、 SUC_A命令群 1430を実行し (ステップ S204)、 B命令 群 1440を実行し (ステップ S 206)、 SUC— B命令群 1450を実行する(ステップ S20 8)。
[0432] 図 22は、改竄防止プログラム 1330の処理の流れを示す図である。
[0433] 一方、改竄防止プログラム 1330は、図 22に示すように、分岐と合流を含む。実行 処理装置 1340は、改竄防止プログラム 1330を実行した場合、まず、 PRE— A命令 群 1410を実行し (ステップ S300)、次に、 STR— A変数群値代入命令群 1620を実 行し (ステップ S302)、その後、 A命令群 1420を実行する(ステップ S304)。ここで、 実行処理装置 1340は、ステップ S 302で STR— A変数群値代入命令群 1620を実 行することで、変数「var_abO」に 1を代入する。
[0434] そして、実行処理装置 1340は、 CBR—AB条件分岐命令群 1610を実行すること により、変数「var— abO」が「var— ab0%2= =0」を満たすか否かを判別する(ステツ プ S306)。このとき、実行処理装置 1340は、ステップ S302で変数「var一 abO」に 1 が代入されて 、るため、変数「var— abO」が「var— ab0%2= =0」を満たさな!/、と判 別する(ステップ S 306の rVar_abO%2= = 1」)。
[0435] その結果、実行処理装置 1340は、 SUC— A命令群 1430を実行し (ステップ S30 8)、次に、 B命令群 1440を実行し (ステップ S310)、さらに、 STR— B変数群値代入 命令群 1630を実行する (ステップ S312)。ここで、実行処理装置 1340は、ステップ S 312で STR— B変数群値代入命令群 1630を実行するときには、変数「var— abO」 に 8を代入する。
[0436] さらに、実行処理装置 1340は、退避命令群 1640を実行し (ステップ S314)、その 後、 BR_B分岐命令群 1660を実行すると (ステップ S316)、再び、 A命令群 1420 を実行する (ステップ S304)。
[0437] そして、実行処理装置 1340は、もう一度、 CBR— AB条件分岐命令群 1610を実 行することにより、変数「var— abO」が「var— ab0%2= =0」を満たすか否かを判別 する(ステップ S306)。このとき、実行処理装置 1340は、ステップ 3312で変数 & — ab0」に 8が代入されて!、るため、変数「var— ab0」が「var— ab0% 2 = = 0」を満 たすと判別する(ステップ S306の rVar_abO%2= =0」)。
[0438] その結果、実行処理装置 1340は、復帰命令群 1650を実行し (ステップ S318)、 次に、 SUC— B命令群 1450を実行する(ステップ S320)。
[0439] このように、 A命令群 1420は、 STR— A変数群値代入命令群 1620の後と、 BR— B分岐命令群 1660の後とで実行される。つまり、実行処理装置 1340が入力プロダラ ム 1310を実行した場合には、 A命令群 1420は 1回しか実行されないのに対し、実 行処理装置 1340が改竄防止プログラム 1330を実行した場合には、 A命令群 1420 は 2回実行されることとなる。したがって、改竄防止プログラム 1330を実行処理装置 1 340で実行させた場合と、難読ィ匕前のプログラムである入力プログラム 1310を実行 処理装置 1340で実行させた場合とでは、各命令群が異なる順序で実行される。
[0440] (2. 8)改竄防止プログラム 1330の効果
不正解析者が改竄防止プログラム 1330を解析した際のそのプログラムの実行順序 と、入力プログラム 1310の実行順序とは、図 21および図 22に示したように異なるた め、不正解析者は改竄防止プログラム 1330の実行順序を解析しても、難読化前の 入力プログラムの実行順序を知ることが難しぐ解析が困難になる。また、改竄防止プ ログラム 1330の実行順序は、入力プログラム 1310の実行順序よりも複雑になるので 、解析や改竄を困難にすることが出来る。その結果、保護対象コードである A命令群 1420を確実に保護することができる。
[0441] また、不正解析者が、難読ィ匕のための冗長な処理を見つけ出して読み飛ばす、あ るいは、削除するといつた攻撃を取ることが考えられる。ここで、本実施の形態では、 BR—B分岐命令群 1660の後の A命令群 1420の実行が冗長な処理に当たるので、 不正解析者が A命令群 1420が冗長であることをつきとめ、削除しょうとすることが考 えられる。しかし、本実施の形態の改竄防止プログラム 1330では、 A命令群 1420は 単なる冗長な処理ではなぐ難読ィ匕前のプログラム (入力プログラム 1310)で必要で あった処理である。したがって、 A命令群 1420を削除すると、難読ィ匕前のプログラム において A命令群 1420を使っていた処理が実行されなくなる。その結果、改竄防止 プログラム 1330と入力プログラム 1310との全体の処理結果が合わなくなる。つまり、 不正解析者は必要な処理まで削除してしまうこととなる。よって、このような不正解析 者の攻撃による改竄防止プログラム 1330の改竄は困難になる。
[0442] また、不正解析者がプログラムの特定の部分の制御構造を知って 、て、その知識を 用いてその特定の部分を見つけ出す攻撃を行うことも考えられる (このような制御構 造の例としては、公知の暗号ィ匕アルゴリズムなどが考えられる)。また、難読化対象( 入力プログラム 1310)が秘密情報を用いるプログラムであって、不正解析者がプログ ラムに含まれる特定の演算を知っていて、その秘密情報を見つけるために、その演 算を見つけ出す攻撃も考えられる。しかし、本実施の形態における改竄防止プロダラ ム 1330の制御構造は不正解析者が知っている制御構造と異なるものとなっているの で、不正解析者が知っている制御構造に基づぐ改竄防止プログラム 1330の制御 構造に対する解析が困難になる。
[0443] (3)改竄防止処理生成装置 1320の構成
続いて、改竄防止処理生成装置 1320の説明を行う。改竄防止処理生成装置 132 0は、入力プログラム 1310を難読ィ匕し改竄防止プログラム 1330を生成する装置であ る。
[0444] 図 23は、改竄防止処理生成装置 1320の構成を示す図である。
[0445] 改竄防止処理生成装置 1320は、入力部 2010と、入力プログラム保持部 2020と、 被代入変数解析部 2030と、被代入変数情報保持部 2040と、被退避変数解析部 20 50と、被退避変数情報保持部 2060と、退避命令群生成部 2070と、退避命令群保 持部 2080と、復帰命令群生成部 2090と、復帰命令群保持部 2091と、条件分岐命 令群生成部 2092と、分岐条件保持部 2093と、条件分岐命令群保持部 2094と、変 数群値代入命令群生成部 2095と、変数群値代入命令群保持部 2096と、分岐命令 群生成部 2097と、分岐命令群保持部 2098と、改竄防止プログラム生成部 2099と、 改竄防止プログラム出力部 2100とを備えている。
[0446] 入力部 2010は、 SUC— A命令群 1430を分岐先とする A命令群 1420と、 A命令 群 1420を分岐先とする PRE— A命令群 1410と、 SUC— B命令群 1450を分岐先と する B命令群 1440とを含む入力プログラム 1310 (例えば図 18に示すプログラム)を 受け付ける。
[0447] 入力プログラム保持部 2020は、入力部 2010が受け付けた入力プログラム 1310を 保持する。
[0448] 被代入変数解析部 2030は、入力プログラム保持部 2020が保持する入力プロダラ ム 1310中の A命令群 1420に含まれる変数であって、値の代入がなされる変数 (被 代入変数)を解析 (特定)する。
[0449] 被代入変数情報保持部 2040は、被代入変数解析部 2030による解析によって得 られた被代入変数の変数名等の情報を保持する。
[0450] 被退避変数解析部 2050は、 SUC— B命令群 1450に含まれる変数であって、値 の参照がなされる変数 (被参照変数)を解析 (特定)する。さらに、被退避変数解析部 2050は、被代入変数情報保持部 2040が保持する被代入変数であり、かつ、被参 照変数でもある変数 (以下では、被退避変数と呼ぶ)を特定する。
[0451] 被退避変数情報保持部 2060は、被退避変数解析部 2050で特定された被退避変 数の変数名等の情報を保持する。
[0452] 退避命令群生成部 2070は、被退避変数が保持する値を退避用変数 (本実施の形 態では、変数「var— saveO」など)に退避する命令群である退避命令群 1640を生成 する。
[0453] 退避命令群保持部 2080は、退避命令群生成部 2070が生成した退避命令群 164 0を保持する。
[0454] 復帰命令群生成部 2090は、退避用変数に退避した値を被退避変数に戻すため の命令群である復帰命令群 1650を生成する。
[0455] 復帰命令群保持部 2091は、復帰命令群生成部 2090が生成した復帰命令群 165
0を保持する。
[0456] 条件分岐命令群生成部 2092は、 SUC A命令群 1430と SUC B命令群 1450 とを条件分岐先に含み、分岐先決定用の変数である G— VAL— AB変数群 (本実施 の形態では、変数「var— abO」など)の値に基づき分岐先を決定する CBR— AB条 件分岐命令群 1610を生成する。
[0457] 分岐条件保持部 2093は、 CBR— AB条件分岐命令群 1610が SUC— A命令群 1
430を分岐先とする条件を満たすために分岐先決定用変数が取るべき値の集合、お よび、 SUC— B命令群 1450を分岐先とする条件を満たすために分岐先決定用変数 が取るべき値の集合を保持する。
[0458] 条件分岐命令群保持部 2094は、条件分岐命令群生成部 2092が生成した CBR
—AB条件分岐命令群 1610を保持する。
[0459] 変数群値代入命令群生成部 2095は、 G— VAL— AB変数群 (本実施の形態では
、変数「var_abO」など)に、 SUC_A命令群 1430を分岐先とする条件を満たす値 を代入する命令群の生成、および、 SUC— B命令群 1450を分岐先とする条件を満 たす値を代入する命令群の生成を行う。
[0460] 変数群値代入命令群保持部 2096は、変数群値代入命令群生成部 2095が生成 した命令群を保持する。
[0461] 分岐命令群生成部 2097は、 B命令群 1440の後に A命令群 1420が実行されるよ うに制御する BR— B分岐命令群 1660を生成する。
[0462] 分岐命令群保持部 2098は、分岐命令群生成部 2097が生成した BR—B分岐命 令群 1660を保持する。
[0463] 改竄防止プログラム生成部 2099は、入力プログラム保持部 2020が保持する入力 プログラム 1310および、各命令群保持部が保持する命令群を用いて改竄防止プロ グラム 1330を生成する。
[0464] 改竄防止プログラム出力部 2100は、改竄防止プログラム生成部 2099が生成した 改竄防止プログラム 1330を記録媒体 1350に記録する。
[0465] 以下、各構成要素の動作についてより詳細に説明する。また、具体例として、図 18 の入力プログラム 1310が改竄防止処理生成装置 1320に入力された場合の動作を 説明する。
[0466] (3. 1)入力部 2010 入力部 2010は、入力プログラム 1310を受け付ける。入力プログラム 1310は、入 力プログラム 1310の構成で述べたように、 A命令群 1420、 PRE— A命令群 1410、 SUC— A命令群 1430、 B命令群 1440、および SUC— B命令群 1450を含む。入力 部 2010は、さらに、入力プログラム 1310のうち、いずれの部分力 A命令群 1420、 PRE— A命令群 1410、 SUC— A命令群 1430、 B命令群 1440、または SUC— B命 令群 1450であるかの指定を受け付ける。
[0467] (3. 2)入力プログラム保持部 2020
入力プログラム保持部 2020は、命令群を記憶する領域を備えている。入力プログ ラム保持部 2020は、入力部 2010が受け付けた入力プログラム 1310を保持する。
[0468] (3. 3)被代入変数解析部 2030
被代入変数解析部 2030は、入力プログラム保持部 2020が保持する入力プロダラ ム 1310中の A命令群 1420にお 、て、なんらかの処理結果が格納される格納先を解 析 (特定)する。
[0469] 具体的には、例えば、 A命令群 1420が変数の値を代入する処理を含むのであれ ば、被代入変数解析部 2030は、変数の変数名や型を解析 (特定)する。また、例え ば、 A命令群 1420がスタックポインタからの相対値を指定してスタックに値を格納す る処理を含むのであれば、被代入変数解析部 2030は、そのスタックポインタや、スタ ックのサイズやスタックポインタからの相対値を解析 (特定)する。また、例えば、 A命 令群 1420がアドレス変数で指定した位置に値を格納する処理を含むのであれば、 被代入変数解析部 2030は、その格納されるアドレスを解析 (特定)する。以降の説 明では、これらの A命令群 1420のなんらかの処理結果が格納される格納先の情報 を総称して、被代入変数情報と呼ぶ。なお、本実施の形態では、 A命令群 1420中に 直接的に現れる変数以外であっても、なんらかの処理結果が格納される格納先の情 報を被代入変数情報と呼ぶ。例えば、スタック等が OSの機能として実現されている 場合、スタックポインタやスタックのサイズは A命令群 1420中には明示的には表れな いことがあるが、このような値も被代入変数情報である。
[0470] 次に、被代入変数解析部 2030は、解析した被代入変数情報を被代入変数情報保 持部 2040に格納する。例えば、図 18の A命令群 1420を解析の対象とする場合、被 代入変数解析部 2030は、値の代入が行われる変数「var— orgO」と変数「var— org 2」の変数名と型「int var— orgO」と「int var— org2」を特定し、それぞれを被代入 変数情報保持部 2040に格納する。
[0471] なお、本実施の形態では、入力プログラム 1310における A命令群 1420の範囲は 、ラベル「A:」力も始まり、次の他のラベルが現れる前までとする。以降の説明におけ る、 PRE— A命令群 1410、 SUC— A命令群 1430、 B命令群 1440、 SUC— B命令 群 1450の範囲も同様に、各命令群は何らかのラベル力も次のラベルが現れる前ま での範囲であるものとする。
[0472] このラベルは、入力部 2010を介してユーザ力もの指定により付されるものとしてもよ V、し、入力プログラム 1310に元力も付されて!、るラベルを利用しても良!、。
[0473] (3. 4)被代入変数情報保持部 2040
被代入変数情報保持部 2040は、被代入変数解析部 2030が解析した A命令群 14 20の被代入変数情報を記憶する。被代入変数が複数ある場合には、各被代入変数 につ 1、ての被代入変数情報を記憶する。
[0474] 本実施の形態では、図 18の A命令群 1420に対して被代入変数解析部 2030によ る解析が行われた場合、被代入変数情報保持部 2040は、各被代入変数の型と変 数名である「int var— org0」と「int var— org2」とを記憶する。
[0475] (3. 5)被退避変数解析部 2050
被退避変数解析部 2050は、 SUC— B命令群 1450以降の命令群の処理結果に 影響を与える変数であって、かつ、 A処理命令群で値が変更される変数を解析 (特 定)する。なお、被退避変数解析部 2050の解析対象は、被代入変数解析部 2030 の解析対象と同様、 A命令群 1420中に直接的に現れる変数以外のものも含む。こ のような変数を解析してその変数の値を退避しておかなくては、 A処理命令群が SU C—B命令群 1450の前に実行されることにより、改竄防止プログラム 1330の処理結 果が入力プログラム 1310とは異なるものとなってしまうこととなることは上述のとおりで ある。
[0476] まず、被退避変数解析部 2050は、入力プログラム保持部 2020が保持する入力プ ログラム 1310中の SUC B命令群 1450、および、 SUC B命令群 1450以降を実 行する際に必要となる変数を特定する。ここで、実行する際に必要となる変数とは、 B 命令群 1440の実行が終了した時点における変数の値が SUC— B命令群 1450以 降の命令で使用される変数、すなわち、 SUC— B命令群 1450以降の処理結果に影 響を与える変数のことを示す。より具体的には、 B命令群 1440までに値が代入され、 SUC— B命令群 1450以降の命令に含まれる代入式の右辺に表れる変数がこれに 当たる。
[0477] 次に、特定された変数のうち被代入変数情報保持部 2040に保持されて 、る変数 があれば、被退避変数解析部 2050は、その変数を被退避変数とし、被退避変数の 変数名等の情報を被退避変数情報保持部 2060に格納する。すなわち、被退避変 数解析部 2050は、 A命令群 1420で値が代入され、 SUC— B命令群 1450以降の 命令群で必要となる変数を、退避変数として抽出する。
[0478] より具体的には、 SUC— B命令群 1450が変数を参照する処理を含む命令群であ れば、被退避変数解析部 2050は、その変数の変数名や型を解析 (特定)する。また 、例えば、 SUC— B命令群 1450がスタックの値を参照する処理を含む命令群であ れば、被退避変数解析部 2050は、参照するスタックのサイズを解析 (特定)する。ま た、例えば、 SUC— B命令群 1450がアドレス変数で指定した位置に格納された値を 参照する処理を含むのであれば、被退避変数解析部 2050は、そのアドレス変数や 格納する値の型を解析 (特定)する。以下の説明では、これらの SUC— B命令群 145 0を実行する際に必要なパラメータや変数に関する情報を総称して被参照変数情報 と呼び、パラメータや変数自体のことを被参照変数と呼ぶ。
[0479] 次に、その被参照変数のうち、被代入変数情報保持部 2040に保持されている変 数があれば、被退避変数解析部 2050は、その変数を被退避変数とし、被退避変数 の変数名等の情報を被退避変数情報保持部 2060に格納する。
[0480] 例えば、図 18の SUC— B命令群 1450の場合、「var— orgl =var— orgl +var— org2 ;var_orgl =var— orgl * 123 ;」において、変数「var— orgl」および変数「 var— org2」の値が参照されている。よって、被退避変数解析部 2050は、変数「var — orgl」および変数「var— org2」を被参照変数とし、「int var— orgl」および「int var— org2」を被参照変数情報とする。このうち、「int var— orgl」は被代入変数 情報保持部 2040に保持されておらず、「int var— org2」は保持されている。したが つて、保持されて 、る方の「int var_org2jの変数「var— org2」は、 SUC— B命令 群 1450の処理結果に影響を与える変数であって、かつ、 A命令群 1420で値が変更 される変数である。よって、変数「var— org2」の値を、 A命令群 1420の処理を行う前 に退避し、 SUC— B命令群 1450の処理を行う前にその値を戻さなければならない。 被退避変数解析部 2050は、「int var— org2」を被退避変数情報とし、被退避変数 情報保持部 2060に格納する。
[0481] なお、 SUC— B命令群 1450の処理結果に影響を与える変数であって、かつ、 A命 令群 1420で値が変更される変数が抽出されるのであれば、被退避変数解析部 205 0が行う処理は上記のものに限らない。例えば、被退避変数解析部 2050は、被代入 変数情報保持部 2040に保持されて 、る変数を取り出し、これが SUC— B命令群 14 50以降の命令に含まれているかを検索しても良い。また、被退避変数解析部 2050 は、被代入変数情報保持部 2040を用いずに、入力プログラム保持部 2020が保持 する入力プログラム 1310から、 A命令群 1420によって値が変更される変数を直接 取り出してもよい。
[0482] (3. 6)被退避変数情報保持部 2060
被退避変数情報保持部 2060は、被退避変数情報を記憶する領域を備えて!/ヽる。
[0483] 被退避変数情報保持部 2060は、被退避変数解析部 2050が解析した被退避変数 情報を記憶する。なお、被退避変数が複数ある場合には、被退避変数情報保持部 2 060は、各被退避変数につ!、ての被退避変数情報を記憶する。
[0484] 具体的には、図 18の SUC— B命令群 1450の場合、被退避変数情報保持部 206 0は、被退避変数の変数名と型「int var— org2」を記憶する。
[0485] (3. 7)退避命令群生成部 2070
退避命令群生成部 2070は、被退避変数情報の値を退避させる退避命令群 1640 を生成して退避命令群保持部 2080に格納する。より詳細には、以下の処理を行う。
[0486] A)退避命令群生成部 2070は、被退避変数をどう退避するかを決める。具体的に は、どの変数に退避するかなどを決定する。本実施の形態では、退避命令群生成部 2070は、被退避変数の退避先として新たな変数を作成して、その変数に被退避変 数の値を退避させる。
[0487] B)退避命令群生成部 2070は、決定した退避のさせ方に従って、被退避変数の値 を退避させる命令群である退避命令群 1640を生成する。
[0488] C)退避命令群生成部 2070は、生成した退避命令群 1640を退避命令群保持部 2
080に格納する。
[0489] 以下、図 18の入力プログラム 1310が改竄防止処理生成装置 1320に入力された 場合における、退避命令群生成部 2070の具体的な動作の例を説明する。
[0490] A)退避命令群生成部 2070は、被退避変数情報保持部 2060より被退避変数情 報を取得し、被退避変数の個数を調べる。ここでは、被退避変数は「int var_org2 」のみであるので、 1つである。退避命令群生成部 2070は、判定した個数分の退避 用変数を新たに作成し、作成した退避用変数「int var— saveOjを退避に用いる変 数に決める。
[0491] B)退避命令群生成部 2070は、被退避変数の値を退避用変数に退避する退避命 令群 1640を生成する。ここでは、退避命令群生成部 2070は、命令「var— saveO = var— org2 ;」を生成する。なお、被退避変数が複数ある場合は、退避命令群生成部 2070は、それぞれの被退避変数について、退避命令群を生成する。また、退避命 令群として被退避変数そのものを退避させるのではなぐ暗号ィ匕などの何らかの変換 を施して退避してもよい。本実施の形態では、このような変換を施した上で退避する 場合および無変換のまま退避する場合の両方を含めて、変換と呼ぶ。
[0492] C)退避命令群生成部 2070は、生成した退避命令群 1640を退避命令群保持部 2 080〖こ格納する。ここでは、「var— saveO=var— org2 ;」が格納される。
[0493] (3. 8)退避命令群保持部 2080
退避命令群保持部 2080は、命令群を記憶する領域を備える。退避命令群保持部 2080は、退避命令群生成部 2070が生成した退避命令群 1640を記憶領域に記憶 する。
[0494] 図 18に示した入力プログラム 1310が改竄防止処理生成装置 1320に入力された 場合、退避命令群生成部 2070が生成した退避命令群 1640が「var— saveO=var org2 ;」となるので、退避命令群保持部 2080は、「var saveO=var org2 ;」を 記憶する。
[0495] (3. 9)復帰命令群生成部 2090
復帰命令群生成部 2090は、退避用変数に退避した値を被退避変数に戻すため の命令群である復帰命令群 1650を生成する。より詳細には、以下の処理を行う。
[0496] A)復帰命令群生成部 2090は、退避命令群保持部 2080が保持する退避命令群 1
640を取得する。
[0497] B)復帰命令群生成部 2090は、取得した退避命令群 1640が行う変換の逆変換を 行う命令群を生成してその命令群を復帰命令群 1650とする。
[0498] C)復帰命令群生成部 2090は、復帰命令群 1650を復帰命令群保持部 2091に格 納する。
[0499] 以下、図 18の入力プログラム 1310が改竄防止処理生成装置 1320に入力された 場合における、復帰命令群生成部 2090の具体的な動作の例を説明する。
[0500] A)復帰命令群生成部 2090は、退避命令群保持部 2080が保持する退避命令群 1
640 Γ var_saveO = var_org 2;」を取得する。
[0501] B)復帰命令群生成部 2090は、「var— saveO=var— org2 ;」の逆変換である「var
_org2=var_save0;」を生成し、復帰命令群 1650とする。
[0502] C)復帰命令群生成部 2090は、復帰命令群 1650「var— org2=var— saveO;」を 復帰命令群保持部 2091に格納する。
[0503] (3. 10)復帰命令群保持部 2091
復帰命令群保持部 2091は、命令群を記憶する領域を備える。復帰命令群保持部
2091は、復帰命令群生成部 2090が生成した復帰命令群 1650を記憶領域に記憶 する。
[0504] 上記の具体例では、復帰命令群生成部 2090が生成した復帰命令群 1650が「var —org2=var—save0 ;」であるので、復帰命令群保持部 2091は、復帰命令群生成 部 2090で生成された「var— org2= var— saveO;」を記憶する。
[0505] (3. 11)条件分岐命令群生成部 2092
条件分岐命令群生成部 2092は、 SUC— A命令群 1430と SUC— B命令群 1450 とを条件分岐先に含み、分岐先決定用の G— VAL— AB変数 (変数「var— abO」)の 値に基づき分岐先を決定する CBR—AB条件分岐命令群 1610を生成する。なお、 復帰命令群 1650がある場合には、条件分岐命令群生成部 2092は、 SUC— B命令 群 1450に替えて復帰命令群 1650を分岐先として含む CBR—AB条件分岐命令群 1610を生成する。
[0506] 具体的には、以下の処理を行う。
[0507] A)条件分岐命令群生成部 2092は、分岐先決定用の変数を決定する。本実施の 形態では、新しく変数を生成し、その変数を分岐先決定用の変数とする。
[0508] B)条件分岐命令群生成部 2092は、分岐先決定用の変数の値がどのような値の時 に SUC— A命令群 1430を条件分岐先とするかを決定する。また、条件分岐命令群 生成部 2092は、分岐先決定用の変数の値がどのような値の時に SUC— B命令群 1 450を条件分岐先とするかを決定する。ここで決定する条件の具体例としては、例え ば、変数の値が所定の値と一致する、所定の値よりも大きい、変数の値に何らかの変 換を施した値が所定の値と一致するなどである。
[0509] C)条件分岐命令群生成部 2092は、上記の B)で決めた条件分岐先が SUC— A 命令群 1430となる分岐先決定用の変数の値の集合を分岐条件保持部 2093に格 納する。また、条件分岐命令群生成部 2092は、 B)で決めた条件分岐先が SUC— B 命令群 1450となる分岐先決定用の変数の値の集合を分岐条件保持部 2093に格 納する。
[0510] D)復帰命令群保持部 2091が復帰命令群 1650を保持する場合は、条件分岐命 令群生成部 2092は、 SUC— A命令群 1430と復帰命令群 1650を条件分岐先とし、 保持しない場合は、 SUC— A命令群 1430と SUC— B命令群 1450を条件分岐先と する CBR—AB条件分岐命令群 1610を生成する。
[0511] E)条件分岐命令群生成部 2092は、生成した CBR—AB条件分岐命令群 1610を 条件分岐命令群保持部 2094に格納する。
[0512] 以下、図 18の入力プログラム 1310が改竄防止処理生成装置 1320に入力された 場合における、条件分岐命令群生成部 2092の具体的な動作の例を説明する。
[0513] A)条件分岐命令群生成部 2092は、入力プログラム 1310に含まれない変数を新 たに用意し、分岐先決定用の G— VAL— AB変数とする。ここでは、分岐先決定用 の変数は「var— abO」とする。
[0514] B)条件分岐命令群生成部 2092は、分岐先決定用の変数が 2の倍数でない時、す なわち、「var— ab0%2 = = 1」の時、 SUC— A命令群 1430を分岐先とし、 2の倍 数の時、すなわち、「var— ab0%2 = =0」の時、 SUC— B命令群 1450を分岐先と することを決定する。
[0515] なお、ここでは、分岐先決定用の変数がどのような値の時に SUC— A命令群 1430 を分岐先にするかの一例を示した力 その決め方は他の方法であっても構わない。 例えば、分岐先決定用の変数の値がランダムに選択した値の時に SUC— A命令群 1430を分岐先とすると決めても構わな 、。
[0516] C)条件分岐命令群生成部 2092は、上記の B)で決めた条件分岐先が SUC— A 命令群 1430となる分岐先決定用の変数の値の集合を分岐条件保持部 2093に格 納する。ここでは、条件分岐命令群生成部 2092は、集合「var— ab0%2 = = 1」、 すなわち 2の倍数以外の値の集合を格納する。
[0517] さらに、条件分岐命令群生成部 2092は、条件分岐先が SUC— B命令群 1450と なる分岐先決定用の変数の値の集合を分岐条件保持部 2093に格納する。ここでは 、条件分岐命令群生成部 2092は、集合「var— ab0%2 = =0」、すなわち 2の倍数 を格納する。
[0518] ここで、集合を格納するとは、集合に含まれる全ての値を格納するのであっても構 わないし、「var— ab0%2 = =0」のような集合を表す式を格納するのであっても構 わない。
[0519] D)条件分岐命令群生成部 2092は、復帰命令群保持部 2091が復帰命令群 165 0を保持する場合は、 SUC— A命令群 1430と復帰命令群 1650を条件分岐先とし、 保持しない場合は、 SUC— A命令群 1430と SUC— B命令群 1450を条件分岐先と する CBR—AB条件分岐命令群 1610を生成する。ここでは、復帰命令群保持部 20 91は復帰命令群 1650を保持するので、条件分岐命令群生成部 2092は、復帰命 令群 1650の先頭〖こラベル「SUC— B―」を設け、 CBR— AB条件分岐命令群 1610 「if (var— ab0%2= =0) goto SUC— B—;」を生成する。
[0520] E)条件分岐命令群生成部 2092は、生成した CBR— AB条件分岐命令群 1610「i f (var_ab0%2= =0) goto SUC—B—;」を条件分岐命令群保持部 2094に格 納する。
[0521] (3. 12)分岐条件保持部 2093
分岐条件保持部 2093は、変数の値の集合を記憶する領域を少なくとも 2つ備える 。第一の領域は、条件分岐命令群生成部 2092の分岐先が SUC— A命令群 1430と なる条件を満たす変数の値の集合である第一の集合を記録する。また、第二の領域 は、条件分岐命令群生成部 2092の分岐先が SUC— B命令群 1450 (もしくは復帰 命令群 1650)となる条件を満たす変数の値の集合である第二の集合を記億する。こ こで、集合を格納するとは、集合に含まれる全ての値を格納するのであっても構わな いし、「var— ab0%2= =0」のような集合を表す式を格納するのであっても構わない
[0522] 上記の具体例の場合、第一の領域は、条件分岐命令群生成部 2092の分岐先が S UC— A命令群 1430となる条件を満たす変数の値の集合である「var— ab0%2= = 1」を保持する。また、第二の領域は、条件分岐命令群生成部 2092の分岐先が復帰 命令群 1650となる条件を満たす変数の値の集合である「var— ab0%2= =0」を保 持する。
[0523] (3. 13)条件分岐命令群保持部 2094
条件分岐命令群保持部 2094は、命令群を記憶する領域を備える。条件分岐命令 群保持部 2094は、条件分岐命令群生成部 2094が生成した CBR—AB条件分岐命 令群 1610を記憶領域に記憶する。
[0524] 上記の具体例の場合、条件分岐命令群保持部 2094は、条件分岐命令群生成部 2092が生成した CBR— AB条件分岐命令群 1610「if (var— ab0%2= =0) goto SUC_B_;」を記憶する。
[0525] (3. 14)変数群値代入命令群生成部 2095
変数群値代入命令群生成部 2095は、 STR— A変数群値代入命令群 1620と、 S TR—B変数群値代入命令群 1630を生成する。具体的には、以下の処理を行う。
[0526] A)変数群値代入命令群生成部 2095は、分岐条件保持部 2093が保持する第一 の集合および第二の集合を取得する。 [0527] B)変数群値代入命令群生成部 2095は、分岐先決定用の変数に、第一の集合に 含まれる値を代入する命令群を生成し、 STR— A変数群値代入命令群 1620とする 。また、変数群値代入命令群生成部 2095は、分岐先決定用の変数に、第二の集合 に含まれる値を代入する命令群を生成し、 STR—B変数群値代入命令群 1630とす る。なお、第一の集合または第二の集合に複数の値が含まれる場合、変数群値代入 命令群生成部 2095は、いずれかの値を選択して代入する値とする。この選択方法 はランダムであってもよ 、し、何らかの基準に従って選択してもよ 、。
[0528] C)変数群値代入命令群生成部 2095は、生成した命令群を変数群値代入命令群 保持部 2096に格納する。
[0529] 以下、図 18の入力プログラム 1310が改竄防止処理生成装置 1320に入力された 場合における、変数群値代入命令群生成部 2095の具体的な動作の例を説明する。
[0530] A)変数群値代入命令群生成部 2095は、分岐条件保持部 2093が保持する第一 の集合および第二の集合を取得する。これらは、それぞれ「var— ab0%2= = l」ま たは「var— ab0%2= =0」である。
[0531] B)変数群値代入命令群生成部 2095は、分岐先決定用の変数を、第一の集合に 含まれる値とする命令群を生成し、 STR— A変数群値代入命令群 1620とする。ここ では、分岐先決定用の変数は「var— ab0」であり、例えば、 1が第一の集合に含まれ る値である。よって、変数群値代入命令群生成部 2095は、「var— ab0= l ;」を STR —A変数群値代入命令群 1620とする。同様に、変数群値代入命令群生成部 2095 は、「var— ab0 = 8;」を STR— B変数群値代入命令群 1630とする。
[0532] C)変数群値代入命令群生成部 2095は、生成した STR— A変数群値代入命令群 1620と STR— B変数群値代入命令群 1630とを変数群値代入命令群保持部 2096 に格納する。
[0533] (3. 15)変数群値代入命令群保持部 2096
変数群値代入命令群保持部 2096は、命令群を記憶する領域を備える。変数群値 代入命令群保持部 2096は、変数群値代入命令群生成部 2095が生成した STR— A変数群値代入命令群 1620と STR— B変数群値代入命令群 1630とを記憶領域に feす。。 [0534] 上記の具体例の場合、変数群値代入命令群保持部 2096は、変数群値代入命令 群生成部 2095が生成した STR— A変数群値代入命令群 1620と STR—B変数群 値代入命令群 1630とである、「var_abO = 1;」と「var_abO = 8;」とを保持する。
[0535] (3. 16)分岐命令群生成部 2097
分岐命令群生成部 2097は、 B命令群 1440から A命令群 1420に分岐するための BR— B分岐命令群 1660を生成する。
[0536] 具体的には、図 18の入力プログラム 1310が処理対象である場合、分岐命令群生 成部 2097は、 A命令群 1420へ分岐する BR— B分岐命令群 1660である「goto A ;」を生成する。
[0537] (3. 17)分岐命令群保持部 2098
分岐命令群保持部 2098は、命令群を記憶する領域を備える。分岐命令群保持部 2098は、分岐命令群生成部 2097が生成した BR—B分岐命令群 1660を記憶領域 B己 ΐ す 0
[0538] 例えば、上記の具体例の場合、分岐命令群保持部 2098は、分岐命令群生成部 2 097が生成した !^—8分岐命令群1660でぁる「801;0 A;」を保持する。
[0539] (3. 18)改竄防止プログラム生成部 2099
改竄防止プログラム生成部 2099は、入力プログラム保持部 2020が保持する入力 プログラム 1310および、各命令群保持部が保持する命令群を用いて改竄防止プロ グラム 1330を生成する。具体的には、改竄防止プログラム生成部 2099は、入力プ ログラム 1310に対して、各命令群保持部が保持する命令群を以下の位置に挿入ま たは配置することにより、改竄防止プログラム 1330を生成する。
[0540] A)改竄防止プログラム生成部 2099は、 PRE— A命令群 1410中のいずれかの位 置に STR— A変数群値代入命令群 1620を挿入する。
[0541] B)改竄防止プログラム生成部 2099は、 A命令群 1420の最後に CBR— AB条件 分岐命令群 1610を配置する。
[0542] C)改竄防止プログラム生成部 2099は、 B命令群 1440中のいずれかの位置に ST R—B変数群値代入命令群 1630を挿入する。
[0543] D)改竄防止プログラム生成部 2099は、 B命令群 1440の最後に退避命令群 1640 を、さらにその後ろに、 BR—B分岐命令群 1660を配置する。
[0544] E)改竄防止プログラム生成部 2099は、 SUC—B命令群 1450の直前に復帰命令 群 1650を配置する。
[0545] 具体的な例としては、改竄防止プログラム生成部 2099は、図 18の入力プログラム 1310に対して、生成して保持されている各命令群を挿入すると、図 20の改竄防止 プログラム 1330を生成する。
[0546] なお、入力プログラム 1310自体に対して、すでに他の難読化手法による変換など が施されている場合、 A命令群 1420や B命令群 1440の最後に正常系での実行時 には実行されないダミー命令等が含まれている場合がある。この場合は、 CBR— AB 条件分岐命令群 1610や退避命令群 1640は、必ずしも各命令群の最後でなくとも 良い。すなわち、正常系で実行される命令のうちでの最後の位置に配置すれば良い
[0547] (3. 19)改竄防止プログラム出力部 2100
改竄防止プログラム出力部 2100は、改竄防止プログラム生成部 2099が生成した 改竄防止プログラム 1330を受け取って格納する。また、改竄防止プログラム出力部 2100は、改竄防止プログラム 1330を記録媒体 1350に記録する。
[0548] なお、本実施の形態では、分岐先決定用の G— VAL— AB変数 (変数「var— abO 」)が追加変数に相当し、条件分岐命令群生成部 2092が変数生成手段として構成さ れている。また、 STR— A変数群値代入命令群 1620が第一条件値代入命令に相 当し、 STR—B変数群値代入命令群 1630が第二条件値代入命令に相当し、変数 群値代入命令群生成部 2095が条件値代入命令生成手段として構成されている。
[0549] (3. 20)改竄防止処理生成装置 1320の処理の流れ
図 24は、改竄防止処理生成装置 1320の動作を示すフローチャートである。図 24 を用いて、入力プログラム 1310を改竄防止プログラム 1330に変換する処理、つまり 難読化の処理の流れを説明する。
[0550] まず、改竄防止処理生成装置 1320の入力部 2010は、入力プログラム 1310と、入 力プログラム 1310における A命令群 1420、 PRE— A命令群 1410、 SUC— A命令 群 1430、 B命令群 1440、および SUC B命令群 1450の位置の指定とを受け付け 、入力プログラム保持部 2020に格納する(ステップ S400)。
[0551] 被代入変数解析部 2030は、入力プログラム保持部 2020が保持する A命令群 142 0の被代入変数情報を解析し、被代入変数情報保持部 2040に格納する (ステップ S 402)。
[0552] 被退避変数解析部 2050は、入力プログラム保持部 2020が保持する入力プロダラ ム 1310中の SUC— B命令群 1450、および、 SUC— B命令群 1450以降を実行す る際に必要となる変数を特定する。そして、被退避変数解析部 2050は、特定された 変数のうち被代入変数情報保持部 2040に保持されている変数を被退避変数とし、 被退避変数情報保持部 2060に格納する (ステップ S404)。
[0553] 退避命令群生成部 2070は、退避命令群 1640を生成して退避命令群保持部 208 0に格納する(ステップ S406)。
[0554] 復帰命令群生成部 2090は、復帰命令群 1650を生成して復帰命令群保持部 209 1に格納する(ステップ S408)。なお、ステップ S404で被退避変数が 1つも見つから な力つた場合は、退避命令群 1640および復帰命令群 1650を生成する必要がない ので、ステップ S406およびステップ S408の処理は行われな!/、。
[0555] 条件分岐命令群生成部 2092は、じ !^—八8条件分岐命令群1610を生成し、条 件分岐命令群保持部 2094に格納する (ステップ S410)。
[0556] 変数群値代入命令群生成部 2095は、 STR—B変数群値代入命令群 1630および STR— A変数群値代入命令群 1620を生成し、変数群値代入命令群保持部 2096 に格納する(ステップ S412)。
[0557] 分岐命令群生成部 2097は、 BR—B分岐命令群 1660を生成し、分岐命令群保持 部 2098に格納する(ステップ S414)。
[0558] 改竄防止プログラム生成部 2099は、改竄防止プログラム 1330を生成し、改竄防 止プログラム出力部 2100に格納する (ステップ S416)。また、改竄防止プログラム出 力部 2100は、改竄防止プログラムを記録媒体 1350に記録する。
[0559] (3. 21)改竄防止処理生成装置 1320の効果
改竄防止処理生成装置 1320は、入力として与えられた入力プログラム 1310を、入 力プログラム 1310と同一の結果が得られる改竄防止プログラム 1330に変換すること が出来る。ここで、不正解析者が改竄防止プログラム 1330を実際に動力して解析を 行ったとしても、入力プログラム 1310の命令群の実行順序や制御構造を知ることが 困難であることは、改竄防止プログラム 1330の説明にて述べたとおりである。
[0560] また、改竄防止処理生成装置 1320は、入力プログラム 1310をより複雑な制御構 造を持つ改竄防止プログラム 1330に難読ィ匕することが出来る。
[0561] (その他の変形例)
なお、本発明を上記実施の形態に基づいて説明してきた力 本発明は、上記の実 施の形態に限定されないのはもちろんである。以下のような場合も本発明に含まれる
[0562] (1)実施の形態 1およびその変形例ならびに実施の形態 2, 3では、 C言語の記法 に合わせるため、難読ィ匕の処理中に変数宣言等の命令を追加していた力 これらの 命令を追加するタイミングは、上記で述べたものに限られない。難読化の処理が完了 した後、最後にこれらの命令を追加するとしても良いし、他のタイミングで追加すると しても良い。また、難読ィ匕後の記述言語によってはこの処理が不要な場合もある。
[0563] (2)実施の形態 1およびその変形例ならびに実施の形態 2では、実行処理装置と 改竄防止処理生成装置とは別装置としていた力 これに限られるものではない。例え ば、実行処理装置に改竄防止処理生成装置と同等の機能を持った処理生成部を含 ませ、プログラムの実行時には、その処理生成部による難読化を行った上で、実行し てもよい。この構成〖こよると、実行されるプログラムは本発明による難読ィ匕が行われた プログラムとなるため、実施の形態 1および 2と同様に不正な改竄および解析を防止 することができる。なお、この場合、実行処理装置内でのプログラムの格納場所を耐 タンパイ匕等により保護することにより、オリジナルのプログラムを保護しておくことが望 まし!/、ことは言うまでもな!/、。
[0564] さらに、実行処理装置は、プログラム配信サーノくから配信されたプログラムを実行 する装置であって、改竄防止処理生成装置に加え、更に復号装置を含み、暗号化さ れて配信されたプログラムを復号ィ匕し、さらに難読ィ匕を行った上で実行する構成であ るとしてもよい。このような構成によると、プログラム配信サーノくから配信されたプログ ラムを実行処理装置で難読化し実行することが出来る。 [0565] また、実施の形態 3において、改竄防止処理生成装置と実行処理装置を別々な構 成を示したが、同様にこれに限られるものではない。実施の形態 1および 2と同様に 上記のような変形例が考えられる。
[0566] (3)実施の形態 3では、被退避変数解析部 2050は、被代入変数情報保持部 204 0の一部の変数を被退避変数としたが、被代入変数情報保持部 2040が保持する変 数の全てを被退避変数としても構わない。このような構成を用いた場合、退避しなくと も結果に影響が出ない変数まで余分に退避される可能性があるが、被退避変数を選 ぶ処理が不要となる分、難読化の処理をより高速にすることが出来る。
[0567] また、 A命令群 1420に含まれる全ての変数を被退避変数としたり、入力プログラム 1310に含まれる全ての変数を被退避変数とする構成であっても構わない。このよう な構成を用いれば、被代入変数の解析自体が不要となるので、更に、難読化の処理 を高速にすることが出来る。
[0568] (4)実施の形態 3では、退避命令群生成部 2070は、退避命令群 1640「var— sav e0=var_org2;」を生成するとしたが、「var— saveO=var— org2 + 2;」などのよう に、逆変換可能な他の命令を生成しても構わない。その場合、復帰命令群生成部 2 090は、逆変換となる復帰命令群 1650「var— org2 = var— saveO— 2;」を生成 する。なお、逆変換可能な命令を生成する方法は上記にて挙げた方法に限るもので はなぐ公知の方法を用いても、将来的に考え出される方法を適用してもよい。
[0569] また、一つの被退避変数を、複数の段階の処理によって退避するような退避命令 群を生成する構成であっても構わないし、複数の被退避変数に対して、最終的に被 退避変数全てが退避されるような複数の退避命令群を生成する構成であっても構わ ない。すなわち、退避命令群の実行によって最終的に退避変数が退避されるのであ れば、退避命令群の構成は問わない。さらに、一部の被退避命令群に対しては複数 の退避命令群を生成し、他の被退避命令群については、それぞれ 1つの退避命令 群を生成するといつたようにしても構わない。このような構成を用いれば、不正解析者 力 改竄防止プログラムに含まれる命令群の中力 退避命令群や復帰命令群を見つ け出すことが困難になる。
[0570] また、退避命令群生成部 2070は、新たに変数を追加して退避用変数とする構成を 説明したが、退避用変数は、難読化のために生成した他の変数と併用する構成であ つても構わない。このような変数の例としては、他の手法による難読ィ匕において正常 系での実行時には実行されな ヽダミーの処理を付加する場合の、ダミー処理中で用 いられる変数などが考えられる。また、プログラム中にあって、既に使用されていない 変数などを用いても構わない。このような構成を用いれば、不正解析者が改竄防止 プログラムで使われる変数のうち、いずれが難読化前からあった変数で、いずれが退 避用変数であるかを解析することが困難になる。よって、改竄防止プログラムのなか のどの部分に本手法が適用されているかを知ることが困難になる。
[0571] (5)実施の形態 3では、改竄防止プログラム 1330に含まれる各命令群をそれぞれ 独立した命令群として示したが、それらのうち複数を合成した命令群を生成しても構 わない。また、実施の形態 1およびその変形例ならびに実施の形態 2でも、上述と同 様、複数の命令群を合成した命令群を生成してもよい。例えば、実施の形態 3におい て、復帰命令群 1650である「var— org2= var— saveO;」と SUC— B命令群 1450 で fco「var一 org 1 = var一 org 1 + var一 org 2 ; var一 orgl =var一 orgl水 123 ;」と を生成する代わりに、それらを合成した命令群「 var— orgl = var— orgl + var— sav eO ;var— orgl =var— orgl * 123 ;」を生成しても構わない。上記の例では、プログ ラムの解析により、変数「var— org2」の値が「var— saveO」の値と同一であることが 分かるので、 SUC— B命令群 1450中の var— org2^var— saveOと置き換えている 。このような構成を用いれば、不正解析者が改竄防止プログラム力 復帰命令群や 退避命令群を見つけ出すことが困難になる。よって、改竄防止プログラムのなかのど の部分に本手法が適用されているかを知ることが困難になる。
[0572] なお、上記の例以外にも複数の命令から前後の矛盾なく合成した新しい命令を生 成する手法がコンパイラ等の分野で知られている。詳細な説明は省略するが、本手 法に対して適宜それらの手法を用いてもょ 、ことは言うまでもな 、。
[0573] (6)実施の形態 3では、分岐命令群生成部 2097は、 BR— B分岐命令群 1660で ある「goto A;」の替わりに条件分岐命令群を生成しても構わな 、。例えば、 BR— B 分岐命令群 1660を「if (var— org2 > 200) goto A;」としても構わない。
[0574] このような構成を用いれば、改竄防止プログラム 1330の動作は var— org2の値に よって、異なる動作となる。上記の例では、改竄防止プログラム 1330は、「var— org 2」の値が「200」を超えるかどうかに応じて動作を変える。そのため、不正解析者に( 本来は特に意味のな 、値である)「200」 t 、う値が何か重要な値であると思 、込ませ ることができるので、解析作業がより困難になる。
[0575] なお、実施の形態 1およびその変形例ならびに実施の形態 2においても、上述と同 様、分岐命令群生成部 203, 203bは、分岐処理命令群 320, 320a, 320bである「 plainData = decrypt (encryptedData)」の代わりに条件分岐命令群を生成しても よい。
[0576] (7)実施の形態 3では、入力プログラムにおいて、 A命令群 1420が B命令群 1440 よりも前にある場合にっ ヽて説明したが、逆であつても構わな 、。
[0577] (8)実施の形態 3では、入力プログラムにおいて、 A命令群の分岐元ブロックが PR E— A命令群の 1つのみである場合を説明したが、分岐元ブロックは複数あつても構 わない。分岐元ブロックが第一 PRE— A命令群、第二 PRE— A命令群、…と複数あ る場合には、それぞれの分岐元ブロックに対して同様に STR— A変数群値代入命令 群を追加すればよい。このような構成を用いれば、改竄防止処理生成装置 1320によ つて制御構造の複雑なプログラムの難読ィ匕が可能となる。この場合、各命令群に追 加する STR— A変数群値代入命令群を、それぞれ、最終的な計算結果は同一とな るものの途中の計算過程が異なる命令としてもよい。これにより、不正解析者に対し て、 STR— A変数群値代入命令群がどの命令であるかを分力りにくくすることができ る。
[0578] また、実施の形態 3では、 A命令群一つに対して、 B命令群が一つであった力 これ らはどちら力、あるいは両方が複数であっても構わない。このような構成を用いれば、 改竄防止プログラムのノ リエーシヨンが豊富になり、不正解析者が改竄防止プロダラ ムカも入力プログラムを想像することがより困難になる。なお、実施の形態 1およびそ の変形例ならびに実施の形態 2においても、上述と同様、矛盾が無い範囲で、同一 種の命令群の数が複数あってもよ 、。
[0579] (9)実施の形態 3では、入力プログラムにおける B命令群の分岐先ブロックは SUC —B命令群の 1つのみであった力 分岐先ブロックは複数あっても構わない。例えば 、 B命令群 1440の分岐先ブロックが第一 SUC— B命令群と第二 SUC— B命令群で ある場合、 B命令群 1440の最後で「var— org2」の値によって分岐先を決定する。こ のように分岐先を決定する CBR—B条件分岐命令は、例えば、「if (var— org2%2 = =0) {goto SUC_B_1; } else {goto SUC— B— 2 ; }」として表される。この 場合、 CBR— AB条件分岐命令群 1610は、「var— ab0%2! =0」の時は、 SUC— Aを分岐先とし、「var— ab0%2= =0」の時は、「var— org2」の値に基づき、分岐先 を決定する。すなわち、この処理を行う CBR—AB条件分岐命令群 1610を、 C言語 を用いて具体的に記述すると以下のようになる。
[0580] 「if (var_ab0%2= =0) {
if (var_org2%2= =0) {goto SUC— B— 1; }
else {goto SUC_B_2 ; }
J」
[0581] なお、「SUC— B— 1」は第一 SUC— B命令群に付されたラベルであり、「SUC— B —2」は第二 SUC_B命令群に付されたラベルである。
[0582] このような、じ !^—八8条件分岐命令群1610では、 PRE— A命令群が実行された 後に A命令群が実行された場合には、「var— ab%2! =0」となるので、 CBR— AB 条件分岐命令群 1610の直後にある SUC— A命令群が分岐先となる。また、 B命令 群が実行された後に A命令群が実行された場合には、「var— ab%2= =0」となるの で、上述の命令群の 2行目から 3行目に含まれて 、る CBR— B条件分岐命令の条件 に基づき第一 SUC— B命令群または第二 SUC— B命令群が条件分岐先となる。
[0583] なお、じ !^—八8条件分岐命令群1610は、上記のように、実施の形態 3と同様の CBR— AB条件分岐命令群 1610に CBR— B条件分岐命令を含ませる構成に限ら ない。上記の例の場合は、「var— ab%2! =0」の時に SUC— A命令群が分岐先と なり、「var— ab%2= =0」かつ「var— org2%2= =0」の時に第一 SUC— B命令群 が分岐先となり、「var— ab%2= =0」かつ「var— org2%2! =0」の時に第二 SUC —B命令群が分岐先となる処理となれば、じ81^—八8条件分岐命令群1610は、他 の構成であっても構わな 、。
[0584] 例えば、 CBR—AB条件分岐命令群 1610を以下のような命令群としてもよい。 [0585] 「tmp = (var_ab0%2) * 2 + (var_org2%2);
switch (tmp) { case 0:
case 1:
goto SUC— A;
case 2 :
goto SUC_B_1;
case 3:
goto SUC— B— 2 ; }」
[0586] また、同様に、 A命令群の分岐先ブロックについても、 SUC— A命令群の 1つのみ である場合について説明したが、分岐先ブロックは複数あっても構わない。第一 SU C— A命令群と第二 SUC— A命令群と力 変数「var— org2」の値が 2の倍数かどう かによつて分岐先となる場合における、 CBR— AB条件分岐命令群 1610の例を以 下に示す。
[0587] 「if (var— ab0%2= =0) {goto SUC— B ; }
elset
if (var_org2%2= =0) {goto SUC— A— 1; }
else {goto SUC— A— 2 ; }
J」
[0588] なお、「SUC— A— 1」は第一 SUC— A命令群に付されたラベルであり、「SUC— A_2」は第二 SUC_A命令群に付されたラベルである。
[0589] 上記の例では、「var— abO」が 2で割り切れな!/、場合、第一 SUC— A命令群へ分 岐するか、第二 SUC— A命令群へ分岐するかの処理が行われる。なお、 SUC— A 命令群が複数ある場合の CBR— AB条件分岐命令群 1610の作り方も上述のものに 限られない。具体的な例は、 SUC— B命令群が複数ある場合と同様であるので省略 する。
[0590] また、 SUC— A命令群および SUC— B命令群の両方ともが複数あってもよいことは いうまでもない。
[0591] 以下、このような構成を用いた場合の効果にっ 、て述べる。 [0592] 不正解析者による攻撃の例として、プログラムの不正改竄を行う際に、条件分岐命 令を無条件分岐命令に改竄することが考えられる。例えば、改竄対象のプログラムが 、ユーザが入力した IDが正しい値であるかをチェックし、正しい値であった場合には 第一 SUC— B命令群を行 、、間違った値であった場合には第二 SUC— B命令群を 行うプログラムである場合に、不正解析者は条件分岐命令を改竄して第一 SUC— B 命令群に分岐する無条件分岐命令に改竄することを行う。このような改竄を行うと、正 し!、IDを知らなくとも、正し!/、IDを知って!/、る正規のユーザと同等のプログラムを実 行することが出来る。ここで、上述した難読ィ匕を行ったプログラムに対して、条件分岐 命令を無条件分岐命令に置き換える改竄を行った場合、例えば、上にあげた CBR — AB条件分岐命令群 1610を「801;0 SUC— B— 1;」におきかえた場合、入力され た IDが正 、値でな 、場合であっても第一 SUC— B命令群を行うようにすることが出 来る(改竄がなければ、第二 SUC— B命令群が実行されるはずである)。しかし、上 述した難読ィ匕を施した CBR—AB条件分岐命令群 1610は、 SUC— Aを実行する前 にも呼び出されるので、このような改竄を行うと、 SUC— A命令群を行うべき場合にも 、無条件で第一 SUC— B命令群が行われてしまうこととなる。よって、このような改竄 を行うと、 SUC— A命令群の実行自体が行われなくなってしまうと 、う不正解析者が 意図しない影響が生じる。このため、不正解析者に対して、自身が行った改竄による 影響を把握しに《することができるので、不正解析行為および改竄行為を行いにく くなる。
[0593] 特に上記の構成と変形例(6)で述べた構成を組み合わせた場合、入力値等によつ て(例えば、「var— org2」の値によって)上記の改竄による影響が発生する場合と発 生しない場合とができる。そのため、不正解析者が影響の出ない入力値を使って解 析を行った場合に本手法が適用された部分の把握がより困難になり、不正解析行為 および改竄行為を行いにくくなる。
[0594] さらにまた、非特許文献 1に記載の難読ィ匕技術のような実際には分岐しないダミー の分岐先を含む条件分岐命令群を追加しても構わない。具体的には、上記にあげた 条件分岐命令群の例に、「case 4」、「case 5」、…とダミーの分岐先を追加しても 構わない。このような構成を用いれば、第二 SUC— B命令群へと分岐する箇所のみ を第一 SUC— B命令群へ無条件分岐するよう改竄しょうとしても、いずれの箇所を改 竄すればよいかを知ることが困難になる。また、アセンブリ言語などで記述されたプロ グラムを難読ィ匕する場合には、相対ジャンプを用いた条件分岐命令を用いても構わ ない。
[0595] さらにまた、第一 SUC— B命令群と同等の処理を行う第一 SUC— B命令群 1、第 一 SUC— B命令群 2、…を設け、本来第一 SUC— B命令群に分岐する条件の時に 、上記同等な処理のいずれかに分岐しても構わない。第二 SUC— B命令群、第一 S UC— A命令群についても同様である。このようにすることで、不正解析者が、どの命 令群が第一 SUC— B命令群等に当たる処理を示しているのかを特定することを困難 にすることができる。
[0596] (10)実施の形態 3では、 SUC— B命令群の分岐元は B命令群ただ一つである場 合について説明した力 B命令群以外に、 SUC— B命令群の分岐元として C1命令 群、 C2命令群、…があっても構わない。その場合、 SUC— B命令群に復帰命令群を 追加する都合上、 C1命令群、 C2命令群、…にも復帰命令に対応する退避命令群を 追加する必要がある。また、 C1命令群に SUC— B命令群以外の分岐先である D1分 岐先命令群、 D2分岐先命令群、…がある場合には、 C1命令群に復帰命令群を追 加する都合上、 D1分岐先命令群、 D2分岐先命令群、…にも退避命令群を追加す る。
[0597] 制御構造の複雑なプログラムに対しては、上記の操作を繰り返し行 、、退避命令群 を追加する対象となる命令群と復帰命令群を追加する対象となる命令群とを決定す る。決定した命令群に退避命令群、復帰命令群の追加を行うことで、本発明による難 読ィ匕を行うことができる。
[0598] (11)実施の形態 3では、 B命令群の後に A命令群が実行された場合、 A命令群の 実行結果は使用されな!、構成を示したが、 A命令群を行った後の結果を SUC— B命 令群で使用する構成としても構わない。この場合は、実施の形態 1または 2と同様の 効果が得られる。
[0599] 図 25は、本変形例に係る改竄防止プログラムの構成を示す図である。
[0600] 本変形例に係る改竄防止プログラム 1330aは、 PRE A命令群 1410と、 STR A変数群値代入命令群 1620と、 A命令群 1420と、 CBR— AB条件分岐命令群 161 0と、 SUC— A命令群 1430と、 B命令群 1440と、 STR— B変数群値代入命令群 16 30と、退避命令群 1640と、被参照変数値代入処理命令群 2210と、 BR— B分岐命 令群 1660と、復帰命令群 1650と、 SUC— B依存処理命令群 2220とを含んでいる
[0601] つまり、本変形例に係る改竄防止プログラム 1330aは、実施の形態 3の改竄防止プ ログラム 1330と比べて、被参照変数値代入処理命令群 2210をさらに含むとともに、 改竄防止プログラム 1330の SUC— B命令群 1450の代わりに、 SUC— B依存処理 命令群 2220を含んで!/、る。
[0602] また、本変形例に係る改竄防止プログラム 1330aでは、 A命令群 1420は実施の形 態 1の第一処理命令群 140に相当し、被参照変数値代入処理命令群 2210は実施 の形態 1の被参照変数値代入処理命令群 310に相当し、 BR— B分岐命令群 1660 は実施の形態 1の分岐処理命令群 320に相当し、 SUC— B依存処理命令群 2220 は実施の形態 1の依存処理命令群 330に相当する。
[0603] 図 26は、 C言語で表した改竄防止プログラム 1330aの具体的な一例を示す図であ る。
[0604] 被参照変数値代入処理命令群 2210は、 A命令群 1420を呼び出して実行する際 に必要となる各種パラメータに値を設定する処理である。具体的には、例えば、被参 照変数値代入処理命令群 2210は、「var— org2 = 5 ;」として表され、被参照変数「v ar_org2jに値「5」を代入する処理を示して!/、る。
[0605] したがって、 BR—B分岐命令群 1660によって、 A命令群 1420に処理が分岐する と、その A命令群 1420が改竄されていなければ、 A命令群 1420の処理により被代 入変数「var— orgO」に想定値「40 ( = 5 X 8)」力 S代入されるとともに、変数「var— org 2」に 7 ( = 5 + 2)が代入される。
[0606] 一方、 SUC— B依存処理命令群 2220は、 A命令群 1420を呼び出した後に実行 される処理命令群であり、入力プログラム 1310の SUC— B命令群 1450と同等の処 理を行うプログラム命令群である。 SUC— B命令群 1450そのものと異なる点は、 SU C B命令群 1450の一部の処理が、 A命令群 1420の処理結果を使用した処理に 置き換えられて 、る点である。
[0607] 具体的には、例えば、 SUC— B依存処理命令群 2220は、「var— orgl =var— or gl +var一 org 2 ; var一 orgl =var一 org丄 * (var一 orgO * 3 + 3)」として れる 。つまり、 SUC— B依存処理命令群 2220では、 SUC— B命令群 1450の「123」が、 A命令群 1420の処理結果を使用した「 (var— orgO * 3 + 3)」に置き換えられて!/、る
[0608] したがって、 SUC— B依存処理命令群 2220は、 A命令群 1420の処理により、被 代入変数「var— orgO」の値として想定値「40」が得られて!/、れば、 SUC— B命令群 1450と同等の処理を実行することができる。
[0609] 図 27は、改竄防止プログラム 1330aの処理の流れを示す図である。
[0610] 改竄防止プログラム 1330aの処理は、図 22に示す改竄防止プログラム 1330の処 理と比べて、さらに、被参照変数値代入処理命令群 2210を実行する処理 (ステップ S315)を含むとともに、図 22に示すステップ S320の処理の代わりに、 SUC— B依存 処理命令群 2220を実行する処理 (ステップ S321)を含んでいる。
[0611] すなわち、実行処理装置 1340は、改竄防止プログラム 1330aを実行した場合には 、退避命令群 1640を実行した後 (ステップ S314)、被参照変数値代入処理命令群 2 210を実行する(ステップ S315)。その後、実行処理装置 1340は、 BR_B分岐命令 群 1660を実行する (ステップ S316)。また、実行処理装置 1340は、復帰命令群 16 50を実行した後には (ステップ S318)、 SUC_B依存処理命令群 2220を実行する( ステップ S321)。
[0612] 図 28は、本変形例に係る改竄防止処理生成装置が改竄防止プログラム 1330aを 生成する動作を説明するための説明図である。
[0613] なお、図 28では、 PRE— Aは PRE— A命令群 1410を示し、 Aは A命令群 1420を 示し、 SUC— Aは SUC— A命令群 1430を示し、 Bは B命令群 1440を示し、 SUC— Bは SUC— B命令群 1450または SUC— B依存処理命令群 2220を示す。また、変 数「X0」は変数「var— org0」を示し、変数「XI」は変数「var— orgl」を示し、変数「X 2」は変数「var— org2」を示す。さらに、変数「Y」は変数「var— ab0」を示し、変数「P 」は変数「var save0」を示す。 [0614] 改竄防止処理生成装置は、入力プログラム 1310を取得すると、保護対象とすべき 命令群を特定し、その保護対象の命令群が複数の処理経路で実行されるように、そ の入力プログラム 1310を難読ィ匕する。すなわち、改竄防止処理生成装置は、 1つの 処理経路の一部として存在する保護対象の命令群が改竄された場合には、その改 竄によって他の処理経路で異常が発生するような改竄防止プログラム 1330aを生成 する。
[0615] 具体的には、改竄防止処理生成装置は、図 28の(a)に示すように、 B命令群 1440 と SUC— B命令群 1450との間を選択位置に設定する。そして、改竄防止処理生成 装置は、図 28の(b)に示すように、その選択位置で保護対象の A命令群 1420が再 び実行されるように、入力プログラムの実行経路 (処理経路)を変更する。
[0616] すなわち、改竄防止処理生成装置は、 B命令群 1440から A命令群 1420に処理が 分岐するように、 BR— B分岐命令群 1660「goto A」を新経路として追加する。
[0617] このとき、改竄防止処理生成装置は、 PRE— A命令群 1410の後に A命令群 1420 が実行されたときには、その後、 SUC— A命令群 1430が実行され、 B命令群 1440 の後に A命令群 1420が実行されたときには、その後、 SUC— B命令群 1450が実行 されるように、幾つかの命令群を追加する。例えば、改竄防止処理生成装置は、 ST R— A変数群値代入命令群 1620「Y= 1」と、 STR— Β変数群値代入命令群 1630「 Υ=8」と、じ !^—八8条件分岐命令群1610 (¥%2= =0) 801;0 SUC— Β」とを 追加する。
[0618] 次に、改竄防止処理生成装置は、図 28の(c)に示すように、 Β命令群 1440の後に Α命令群 1420が再び実行されるような実行経路の変更によって、 SUC— B命令群 1 450の処理結果が変化しな 、ように、 SUC_B命令群 1450の整合性を確保する。
[0619] すなわち、改竄防止処理生成装置は、退避命令群 1640「P=X2」と復帰命令群 1 650「X2 = P」とを追加する。これにより、改竄防止処理生成装置は、 B命令群 1440 の後に A命令群 1420が実行されても、その実行結果が SUC— B命令群 1450の処 理結果に影響を与えてしまうのを防ぐことができる。
[0620] さらに、改竄防止処理生成装置は、図 28の(d)に示すように、 SUC— B命令群 14 50の処理結果力 B命令群 1440の後に実行される A命令群 1420の実行結果に依 存するように、 SUC— B命令群 1450を SUC— B依存処理命令群 2220に変更する 。このとき、改竄防止処理生成装置は、被参照変数値代入処理命令群 2210「X2 = 5」を追加する。
[0621] その結果、 A命令群 1420が改竄されていなければ、 B命令群 1440の後の A命令 群 1420の実行によって変数「XO」の値として想定値「40」が得られ、 SUC— B依存 処理命令群 2220は、 SUC— B命令群 1450と同等の処理となる。一方、 A命令群 1 420が改竄されていれば、 B命令群 1440の後の A命令群 1420の実行によって変数 「X0」の値として想定値「40」が得られず、 SUC— B依存処理命令群 2220は、 SUC —B命令群 1450と異なる異常な処理となる。
[0622] このように本変形例に係る改竄防止処理生成装置は、 A命令群 140の実行結果を 使用する SUC— B依存処理命令群 2220を生成する。これは、本変形例に係る改竄 防止処理生成装置が、実施の形態 1およびその変形例の改竄防止処理生成装置 1 10, 110aと同様の構成を有することによって実現される。つまり、本変形例に係る改 竄防止処理生成装置は、実施の形態 3の図 23に示す改竄防止処理生成装置 1320 に対して、実施の形態 1およびその変形例における想定値算出部 290, 290aおよび 依存処理命令群生成部 201, 201aなどを追加して構成される。
[0623] ここで、保護対象の A命令群 1420や SUC— B命令群 1450には、関数の代わりに 、ユーザインターフェースや外部アクセスに関する API (Application Program Interfac e)が含まれていてもよい。
[0624] 図 29は、本変形例に係る改竄防止処理生成装置が、 APIを含む改竄防止プログ ラムを生成する動作を説明するための説明図である。
[0625] なお、図 29では、 PRE— Aは PRE— A命令群を示し、 Aは A命令群を示し、 SUC — Aは SUC— A命令群を示し、 Bは B命令群を示し、 SUC— Bは SUC— B命令群ま たは SUC— B依存処理命令群を示す。
[0626] ここで、図 29の(a)に示すように、 A命令群は例えば「X=GetText (V)」として表さ れる。「GetText (V)」は、アドレス変数 Vの示すアドレスに、ユーザが入力した文字 列を格納する APIである。同様に、 SUC— B命令群は例えば「S = GetText (T)」と して表される。「GetText (T)」は、アドレス変数 Tの示すアドレスに、ユーザが入力し た文字列を格納する APIである。
[0627] つまり、改竄防止処理生成装置は、図 29の(a)に示すように、 A命令群および SU C—B命令群に APIを含む入力プログラムを取得する。このような場合でも、改竄防 止処理生成装置は、上述と同様、保護対象とすべき命令群を特定し、その保護対象 の命令群が複数の処理経路で実行されるように、その入力プログラムを難読ィ匕する。 すなわち、改竄防止処理生成装置は、 1つの処理経路の一部として存在する保護対 象の命令群が改竄された場合には、その改竄によって他の処理経路で異常が発生 するような改竄防止プログラムを生成する。
[0628] 具体的には、改竄防止処理生成装置は、保護対象となる A命令群に APIが含まれ ている力否かを判定する。ここで、 APIが含まれていると判定すると、改竄防止処理 生成装置は、その APIをコールする他の処理を検索する。その結果、改竄防止処理 生成装置は、その APIをコールする SUC— B命令群を見つけると、図 29の(a)に示 すように、 B命令群とその SUC— B命令群との間を選択位置に設定する。そして、改 竄防止処理生成装置は、図 29の (b)に示すように、その選択位置で保護対象の A命 令群が再び実行されるように、入力プログラムの実行経路 (処理経路)を変更する。
[0629] すなわち、改竄防止処理生成装置は、 B命令群から A命令群に処理が分岐するよ うに、 BR— B分岐命令群「goto A」を新経路として追加する。
[0630] このとき、改竄防止処理生成装置は、 PRE— A命令群の後に A命令群が実行され たときには、その後、 SUC— A命令群が実行され、 B命令群の後に A命令群が実行 されたときには、その後、 SUC— B命令群が実行されるように、幾つかの命令群を追 加する。例えば、改竄防止処理生成装置は、 STR— A変数群値代入命令群「Y= 1 」と、 STR— Β変数群値代入命令群「Υ= 8」と、 CBR— ΑΒ条件分岐命令群「if (Y% 2= =0) goto SUC— B」とを追加する。
[0631] 次に、改竄防止処理生成装置は、図 29の(c)に示すように、 B命令群の後にアドレ ス変数 Vの値を変更して A命令群が再び実行されても、その変数 Xおよびアドレス変 数 Vの値が SUC— B命令群以降の処理でも不必要に変更されてしまうことがないよう に、変数 Xおよびアドレス変数 Vの整合性を確保する。すなわち、改竄防止処理生成 装置は、退避命令群「P1 =X; P2=V」と復帰命令群「X=P1 ; V=P2」とを追カロ する。
[0632] さらに、改竄防止処理生成装置は、図 29の(d)に示すように、 SUC— B命令群の 処理結果が、 A命令群の実行結果に依存するように、 SUC— B命令群「S = GetTex t (T)」を SUC— B依存処理命令群「S =X; *T= *V」に変更する。すなわち、改 竄防止処理生成装置は、アドレス変数 Vにより示されるアドレスに処理結果が格納さ れて 、るので、その処理結果を本来の SUC— B命令群の処理結果の代わりに使用 する。なお、このとき、改竄防止処理生成装置は、被参照変数値代入処理命令群「V =T」を追力!]する。
[0633] その結果、 Α命令群が改竄されて!、なければ、 SUC— B依存処理命令群は、 SUC —B命令群と同等の処理となる。一方、 A命令群が改竄されていれば、つまり、 A命 令群がシリアルの入力をする処理である場合に不正解析者が例えば「X= (シリアル の値の定数)」とするような改竄を行えば、 SUC— B依存処理命令群は、 SUC— B命 令群と異なる異常な処理となる。
[0634] ( 12)実施の形態 3では、 PRE— A命令群、 A命令群、 SUC— A命令群、 B命令群 、および SUC— B命令群とは同一の入力プログラムに含まれる命令群であるとしたが 、別々の関数として実現してもよい。
[0635] 例えば、実施の形態 1と同様、第一処理命令群に相当する A命令群と、第二処理 命令群に相当する B命令群および SUC— B命令群とを別々の関数として入力するこ となどが考えられる。この場合、 B命令群から A命令群を含む関数を読み出し、その 関数の処理結果を破棄すれば (または、明示的に破棄しなくとも参照しなければ)、 S UC—B命令群以降の処理に命令群 Aの影響が現れな 、ようにしつつ、実施の形態 3と同様の難読ィ匕を行うことができる。なお、 A命令群を含む関数を参照呼びで呼び 出す場合などには、引数として与えた変数が変化してしまい、 SUC— B命令群以降 の処理に影響が出る恐れがあるので、実施の形態 3と同様、退避処理命令群や復帰 処理命令群を関数呼び出しの前後に追加する。
[0636] また、実施の形態 1およびその変形例では、第一処理命令群と第二処理命令群と は別々に入力されるものであるとした力 実施の形態 3と同様、同一の入力プログラム 中、または、同一の関数中の別の処理であるとしても良い。この場合も上記と同様の 効果が得られることは言うまでもな 、。
[0637] (13)実施の形態 3では、 B命令群の後に A命令群が実行されるようにするために、 BR— B分岐命令群 1660を用 、る構成を説明したが、これに限られるものではな!/、。 例えば、分岐命令を使う代わりに、命令群の処理の順番を入れ替え、退避命令群 16 40の直後に、 A命令群を配置するとしてもよい。この場合には、 BR— B分岐命令群 1 660は不要となる力 命令群の実行順序を入力プログラム 1310と同じにするため、 S TR— A変数群値代入命令群 1620の後に A命令群への分岐命令を挿入する等の 変換が必要となる。
[0638] (14)実施の形態 3では、入力プログラムのうち、どの部分を A命令群とし、どの部分 を B命令群とする力をユーザが指定する構成であつたが、改竄防止処理生成装置が 入力プログラムの中力 ランダムに選択した命令群を A命令群又は B命令群とする構 成としても構わない。そのような構成をする場合、改竄防止処理生成装置は、 A命令 群又は B命令群の決定後、 PRE— A命令群および SUC— A命令群を決定する必要 がある。この場合、改竄防止処理生成装置は、決定した A命令群の分岐元ブロックを 解析し、解析したブロックを第一 PRE— A命令群、第二 PRE— A命令群、…とする。 第一 PRE— B命令群、第二 PRE— B命令群、…についても同様である。また、改竄 防止処理生成装置は、命令群の分岐先ブロックを解析し、解析したブロックを第一 S UC— A命令群、第二 SUC— A命令群、…とする。第一 SUC— B命令群、第二 SU C— B命令群、…についても同様である。
[0639] (15)実施の形態 3では、分岐先決定用の G— VAL— AB変数は、「var— abO」の
1つだけであつたが、複数であってもよい。この場合、例えば、 SUC— A命令群へ分 岐すべきか否か示す変数と SUC— B命令群へ分岐すべきか否かを示す変数とを異 なる変数にすることなどができる。
[0640] (16)実施の形態 3では、改竄防止処理生成装置 1320への入力として、 SUC— A 命令群を含んだ入力プログラムを用いていた力 これに限られるものではない。例え ば、 A命令群の分岐先である命令が OS側の関数である場合などには、必ずしも SU C— A命令群に相当する命令が入力プログラムに含まれない。すなわち、改竄防止 処理生成装置 1320は、 SUC— A命令群が入力として与えられない場合でも、 A命 令群の分岐先である命令のアドレスや関数名さえ分って!、れば、そのアドレスや関数 名が示す命令群に分岐するよう CBR—AB条件分岐命令群を構成することで、難読 化ができる。
[0641] (17)実施の形態 1およびその変形例ならびに実施の形態 2, 3の説明では、プログ ラム生成の処理の流れの一例を示した力 互いに依存関係のな 、処理につ!、ては 順序を入替えたり、並列化して実行しても構わな ヽ。
[0642] また、ここで述べた難読ィ匕を他の難読ィ匕手法と一緒に適用しても良い。
[0643] 例えば、実施の形態 1およびその変形例ならびに実施の形態 2, 3では、基本的に は入力された命令群を、出力する命令群にそのまま含ませていた力 それに限られ るものではない。別の難読ィ匕手法などにより、入力プログラムに基づいて、各命令群 に等価な命令群を生成した上で、その命令群を難読化後のプログラムに含ませても 良い。このようにすることで、入力プログラムの命令群と出力されるプログラムの命令 群との対応関係を分力りにくくすることができる。ここで、全ての命令群からそれぞれ の等価な命令群を生成するのではなぐ一部については等価な命令群を生成し、他 の命令群については、入力プログラムそのままの命令群を出力するとしてもよい。つ まり、本変形例における等価な命令群とは特に何も変換されない命令群も含み、等 価な命令群の生成とは入力プログラムから各命令群を抽出するだけの処理も含む。 なお、上記の効果を得るためには、各命令群のうち、少なくとも 1つが元とは異なるが 等価な処理を行う命令群に変換されればよぐ他の命令群が元とは異なる命令群に 変換されるかどうかは問わな 、。
[0644] (18)ここで例えば、図 3に示す第二処理命令群 150を本発明と異なる他の手法に より難読化して実行処理装置 130に実行させる場合には、その難読化された第二処 理命令群 150を解析することなぐそれらを他の機器に容易に移植して、その機器に おいても第二処理命令群 150を正常に実行させることができる。
[0645] 例えば、第二処理命令群 150では、暗号鍵を用いて復号ィ匕が行われる。その暗号 鍵や復号ィ匕処理の内容は秘密とされるべき情報 (秘密情報)であって、解析されては ならない。したがって、上述のように第二処理命令群 150は難読化される。しかし、第 二処理命令群 150が難読化されて、その秘密情報の解明を防ぐことができても、上 述のような移植と!/、う不正行為が容易に行われれば、その難読化は無意味になって しまう。また、そのような不正行為を防ぐためには、難読化された第二処理命令群 15 0のコードサイズを大幅に増加させる必要がある。
[0646] したがって、実施の形態 1およびその変形例の改竄防止処理生成装置 110では、 実行処理装置 130に元々含まれて 、る命令群を第一処理命令群 140として用い、 処理経路がその第一処理命令群 140に分岐するように出力処理命令群 160を生成 してもよい。これにより、出力処理命令群 160のコードサイズの増大を小さく抑えつつ 上述のような移植を困難にすることができる。
[0647] 図 30は、第一処理命令群 140が実行処理装置 130に元々含まれている場合にお ける本発明の効果を説明するための説明図である。
[0648] 改竄防止処理生成装置 110は、保護対象である第二処理命令群 150を取得する。
例えば、第二処理命令群 150は、処理ブロック BO, B1, "·Β9を含んでいる。また、 第一処理命令群 140を構成する処理ブロック ΒΑは、実行処理装置 130に元々含ま れている。そこで、改竄防止処理生成装置 110は、処理経路が処理ブロック Β0から 処理ブロック ΒΑに分岐して処理ブロック B1に戻るように、第二処理命令群 150を修 正することにより、出力処理命令群 160を生成する。つまり、改竄防止処理生成装置 110は、第一処理命令群 140を保護対象の一部とし、第二処理命令群 150を出力 処理命令群 160に難読化する。
[0649] その結果、不正解析者は、第二処理命令群 150による処理を他の機器に実行させ るような不正行為を行う場合には、第二処理命令群 150だけでなく第一処理命令群 140も移植しなければならない。しかし、第一処理命令群 140は、実行処理装置にも ともと組み込まれて 、る処理を行う命令群であるので、別の装置への移植は困難であ る。したがって、このような不正行為を困難にすることができる。さらに、第二処理命令 群 150の難読ィ匕により、命令群が大幅に増加されることがないので、出力処理命令 群 160のコードサイズの増大を小さく抑えることができる。また、各実行処理装置に固 有の処理を行うような命令群を第一処理命令群 140として選ぶことで、さらに移植を 困難にすることができる。
[0650] なお、第一処理命令群 140は必ずしもプログラム命令である必要はなぐ実行処理 装置 130に元々含まれて 、る装置や回路 (例えば、オーディオ再生に使用する回路 )などとしてもよい。また、移植を困難にするために、実行処理装置 130に第一処理 命令群 140の役割を担う専用の装置や回路を追加してもよい。これらの場合、分岐 処理命令群には、第一処理命令群 140に分岐する動作の代わりに、上述した装置 や回路を動作させる命令を含ませればよい。なお、被参照変数は、例えば、その装 置や回路に対する入力となり、被代入変数は、その装置や回路の出力となる。
[0651] このような構成を用いれば、単に実行処理装置 130で動作するプログラムを移植し ても、前記の装置や回路を持たない環境では、移植したプログラムを動作させること が出来なくなるので、不正者がプログラムを移植する攻撃を防止することができる。
[0652] (19)ここで例えば、暗号などの秘密情報を含む処理 (命令群)には、一般的にはあ まり使用されないテーブル引きやビットシフト演算などの特徴的な演算 (以下、特徴的 演算)が含まれる場合がある。したがって、図 16に示す実行処理装置 1340が入力プ ログラム 1310を実行するような場合には、不正解析者は、特徴的演算を目印にして 、入力プログラム 1310から、秘密情報を含む命令群を容易に見つけ出して不正に 解析することができる。
[0653] したがって、例えば実施の形態 3の改竄防止処理生成装置 1320では、特徴的演 算を含む命令群を A命令群 1420として、改竄防止プログラム 1330を生成してもよい
[0654] 図 31は、 A命令群 1420が特徴的演算を含む場合における本発明の効果を説明 するための説明図である。
[0655] 改竄防止処理生成装置 1320は、入力プログラム 1310を取得すると、特徴的演算 を含む命令群を検索して、見つカゝつた命令群を A命令群 1420として、上述した実施 の形態 3と同様の難読化処理を行う。その結果、改竄防止処理生成装置 1320が生 成するプログラムは、上述の実施の形態 3と同様に、その特徴的演算を含む A命令 群 1420が繰り返して実行されるような改竄防止プログラム 1330となる。
[0656] これにより、改竄防止プログラム 1330の処理経路において特徴的演算が実行され る箇所が増加する。したがって、不正解析者が秘密情報を含む命令群を見つけ出そ うとする不正解析を困難にすることができる。 [0657] なお、実施の形態 1およびその変形例ならびに実施の形態 2においても、上述と同 様、改竄防止処理生成装置は、特徴的演算を含む命令群を第一処理命令群として 、出力処理命令群を生成してもよい。
[0658] (20)ここで、実施の形態 1およびその変形例ならびに実施の形態 2, 3では、保護 対象となる命令群 (第一処理命令群または A命令群)に分岐する分岐処理命令群を 生成したが、この分岐処理命令群を生成することなぐ図 28の(d)に示すような依存 化のみを行ってもよい。
[0659] 例えば、コンテンツの再生を制限するプログラムを改竄して、そのプログラムの再生 制限を解除してしまうような攻撃が想定される。このようなプログラムは、例えば、コン テンッの再生回数が所定の制限回数以下であれば、そのコンテンツの再生を許可す る。または、プログラムは、コンテンツを再生する機器を認証し、正当な機器にのみそ のコンテンツの再生を許可する。または、プログラムは、そのコンテンツが不正にコピ 一されたものであるか否かを判定し、不正にコピーされたものでなければ、そのコンテ ンッの再生を許可する。
[0660] つまり、不正解析者は、コンテンツの再生許否を判定するための条件分岐命令をそ のプログラムから見つけ出して、常に再生許可されるようにその条件分岐命令を無条 件分岐命令に改竄しょうとする。
[0661] 図 32は、不正解析者による改竄の例を示す図である。
[0662] 不正解析者は、まず、図 32の(a)および (b)に示すように、プログラムを実行させて 、再生許可時におけるログと再生不許可時におけるログとを比較する。その結果、不 正解析者は、図 32の(c)および (d)に示すように、ログに差異が生じる部位を特定し 、その部位の直前にある、コンテンツの再生許否を判定するための条件分岐命令 (処 理ブロック B19)を見つけ出す。
[0663] そこで、不正解析者は、条件分岐命令である処理ブロック B19を解析し、処理ブロ ック B19では、再生許可のときに変数 aに 1が代入され、再生不許可のときに変数 aに 0が代入されることを解明する。したがって、不正解析者は、処理ブロック B19におい て常に変数 aに 1が代入されるように、その処理ブロック B19を条件分岐命令力も無 条件分岐命令に変更しょうとする。 [0664] そこで、この攻撃に対処するために、本発明では、図 28の(d)に示すような依存ィ匕 のみを行ってもよい。
[0665] 図 33は、本変形例に係る改竄防止処理生成装置が依存ィ匕のみを行う例を示す図 である。
[0666] 本変形例に係る改竄防止処理生成装置 400は、図 32に示す条件分岐命令を含む プログラムを入力プログラム Piとして取得する。そして、改竄防止処理生成装置 400 は、その入力プログラム Piの中の再生許可時の処理 (被制限処理)に含まれる 1つの 定数を特定する。つまり、改竄防止処理生成装置 400は、処理ブロック B26に含まれ る定数「10」を見つけ出す。さらに、改竄防止処理生成装置 400は、その入力プログ ラム Piの条件分岐命令(処理ブロック B19)で、コンテンツの再生許否の判定結果が 格納される変数である判定変数 aと、再生許可のときにその判定変数 aに格納される 判定結果を示す値である被制限値「 1」とを処理ブロック B19から抽出する。
[0667] その結果、改竄防止処理生成装置 400は、処理ブロック B26に含まれる定数「10」 を、「a= l」のときにその定数「10」と等しくなるような数式「a * 5 + 5」に変換すること により、処理ブロック B26の処理を処理ブロック B19の処理結果(実行結果)に依存さ せる。
[0668] つまり、改竄防止処理生成装置 400は、入力プログラム Piにおいて処理ブロック B1 9の判定結果に関わらず再生許可時の処理が実行されるように、再生不許可時のェ ラー処理(処理ブロック B30〜: B39)を削除するとともに、処理ブロック B26「x=x+ 1 0」を、処理ブロック B26a「x = x + a * 5 + 5」に置き換えることにより、改竄防止プログ ラム Poを生成する。
[0669] これにより、改竄防止プログラム Poでは、処理ブロック B26で再生が許可されたとき 、つまり判定変数 aに 1が代入されたときには、コンテンツが正常に再生されるような処 理が行われる。一方、処理ブロック B26で再生が許可されなかったとき、つまり判定 変数 aに 0が代入されたときには、コンテンツが正常に再生されるような処理は行われ ず、異常な処理が行われる。したがって、判定変数 aに正当な値が代入されな力つた 場合には、コンテンツを正常に再生することができなくなるので、入力プログラム Piと 同等の処理ができる。 [0670] また、本変形例では、改竄防止プログラム Poを実行したときのログが、再生許可時 と再生不許可時とで等しくなるため、保護対象となる条件分岐命令が見つけ出されて 無条件分岐命令に改竄されるのを困難にすることができる。
[0671] 図 34は、本変形例に係る改竄防止処理生成装置 400の構成の一例を示す図であ る。
[0672] 改竄防止処理生成装置 400は、入力プログラム保持部 401、定数選択部 402、変 数抽出部 403、変換部 404、および改竄防止プログラム保持部 405を備えている。
[0673] 入力プログラム保持部 401は、入力プログラム Piを取得して保持する。
[0674] 定数選択部 402は、入力プログラム Piの中の再生許可時の処理 (被制限処理)を 特定し、さらに、その処理に含まれる 1つの定数を選択する。
[0675] 変数抽出部 403は、入力プログラム Piの中の条件分岐命令において判定結果が 格納される判定変数を、その条件分岐命令力も抽出する。さらに、変数抽出部 403 は、条件分岐命令において被制限処理を実行すべきと判定されるときにその判定変 数に格納される値である被制限値を抽出する。
[0676] なお、判定結果を示す値を判定変数に格納する条件分岐命令は、複数の命令か らなる命令群であってもよい。また、判定変数は、入力プログラム Pi中に明示的に表 れる変数である必要はない。例えば、判定変数はスタックであってもよい。この場合、 被制限値とは、そのスタックに格納された値である。また、判定変数は、アドレス変数 で指定される位置に対応する記憶領域であってもよい。この場合、被制限値とは、そ の位置に格納された値である。さらに、被制限値も 1つの値に限るものではなぐ値の 集合であってもよい。この場合、処理ブロック B26aとして、判定変数に代入された値 力 の集合に属するどの値であっても処理ブロック B26と同じ処理を行うような命令群 を生成する。このような性質を持つ命令群の生成の仕方は、実施の形態 1の変形例 6 における依存処理命令群の生成の仕方と同様である。
[0677] また、このような条件分岐命令において判定変数に被制限値を代入する処理は、 実施の形態 1およびその変形例ならびに実施の形態 2における第一処理命令群の 処理や、実施の形態 3の A命令群の処理と同様である。
[0678] 変換部 404は、条件分岐命令の判定結果に関わらず被制限処理が実行されるよう に、入力プログラム Piの中のエラー処理を削除する。さらに、変換部 404は、定数選 択部 402で選択された定数を、判定変数を用いた数式に変換する。なお、変換部 40 4は、その定数を、判定変数を用いた関数に変換してもよい。このとき、変換部 404は 、判定変数に被制限値が代入されたときにその数式によって算出される値が上述の 定数と等しくなるように数式を生成する。変換部 404は、このような処理により改竄防 止プログラム Poを生成して改竄防止プログラム保持部 405に格納する。なお、変換 部 404は、実施の形態 1およびその変形例ならびに実施の形態 2の依存処理命令群 生成部 201, 201a, 201bと同様の処理を行うことにより、上述の数式を生成する。
[0679] 改竄防止プログラム保持部 405は、変換部 404によって生成された改竄防止プロ グラム Poを取得して保持する。
[0680] 図 35は、本変形例に係る改竄防止処理生成装置 400の動作の一例を示すフロー チャートである。
[0681] 改竄防止処理生成装置 400は、まず、入力プログラム Piの被制限処理に含まれる 定数を選択する (ステップ S500)。さらに、改竄防止処理生成装置 400は、入力プロ グラム Piの条件分岐命令力も判定変数および被制限値を抽出する (ステップ S502) 。そして、改竄防止処理生成装置 400は、ステップ S500で選択された定数を、判定 変数を用いた数式に変換する (ステップ S504)。また、このとき、改竄防止処理生成 装置 400は、条件分岐命令の判定結果に関わらず被制限処理が実行されるように、 入力プログラム Piの中のエラー処理を削除する。その結果、入力プログラム Piは改竄 防止プログラム Poに変換される。
[0682] (21)また、実施の形態 1およびその変形例では、第二処理命令群 150が、圧縮さ れたコンテンツを解凍する処理であるとして説明した力 他の処理であってもよい。さ らに、実施の形態 1およびその変形例ならびに実施の形態 2では、第一処理命令群 140が、コンテンツの暗号ィ匕された再生可能回数を復号して平文の再生可能回数を 出力する処理であるとして説明した力 他の処理であってもよい。すなわち、本発明 の適用対象は、実施の形態 1およびその変形例ならびに実施の形態 2で述べた復号 処理や解凍処理等を行う命令群に限らな 、。改竄を防止する必要がある命令群であ れば、どのようなものにでも適用できる。例えば、その適用例として、コンテンツの利 用権を管理する命令群などが挙げられる。
[0683] (22)実施の形態 1およびその変形例ならびに実施の形態 2, 3では、各プログラム や命令群が C言語のプログラムである場合の例を示した力 これに限られるものでは ない。それぞれ、他のプログラミング言語、 UML等のモデリング言語、コンパイラ等の 中間言語、アセンブリ言語、マシン語等であっても構わない。
[0684] (23)実施の形態 1およびその変形例ならびに実施の形態 2, 3で、難読化する対 象はコンピュータプログラミング言語に関わらず、論理回路記述言語等の論理回路 の設計の情報 (具体的には、 VHDL等のハードウェア記述言語で記述されたプログ ラム等)であっても構わない。難読ィ匕により得られるプログラムについても同様である。 すなわち、本発明で難読ィ匕対象とするプログラムおよび難読ィ匕により得られるプログ ラムは、コンピュータプログラミング言語で記述されたプログラムに限らず、上述した論 理回路の設計の情報も含む概念である。
[0685] (24)上記の各装置は、具体的には、マイクロプロセッサ、 ROM, RAM,ハードデ イスクユニット、ディスプレイユニット、キーボード、およびマウスなどから構成されるコ ンピュータシステムである。その RAMまたはハードディスクユニットには、コンピュータ プログラムが記憶されている。つまり、マイクロプロセッサ力 コンピュータプログラムに したがって動作することにより、各装置は、その機能を達成する。ここでコンピュータプ ログラムは、所定の機能を達成するために、コンピュータに対する指令を示す命令コ ードが複数個組み合わされて構成されたものである。なお、各装置は、マイクロプロ セッサ、 ROM、 RAM、ハードディスクユニット、ディスプレイユニット、キーボード、マ ウスなどの全てを含むコンピュータシステムには限らず、これらの一部から構成されて V、るコンピュータシステムであってもよ 、。
[0686] (25)上記の各装置を構成する構成要素の一部または全部は、 1個のシステム LSI
(Large Scale Integration:大規模集積回路)から構成されているとしてもよい。 システム LSIは、複数の構成部を 1個のチップ上に集積して製造された超多機能 LSI であり、具体的には、マイクロプロセッサ、 ROM、および RAMなどを含んで構成され るコンピュータシステムである。その RAMには、コンピュータプログラムが記憶されて いる。つまり、マイクロプロセッサ力 コンピュータプログラムにしたがって動作すること により、システム LSIは、その機能を達成する。
[0687] (26)上記の各装置を構成する構成要素の一部または全部は、各装置に脱着可能 な ICカードまたは単体のモジュール力も構成されて!、るとしてもよ!/、。その ICカードま たはモジュールは、マイクロプロセッサ、 ROM,および RAMなどから構成されるコン ピュータシステムである。その ICカードまたはモジュールは、上記の超多機能 LSIを 含むとしてもよい。つまり、マイクロプロセッサ力 コンピュータプログラムにしたがって 動作することにより、その ICカードまたはモジュールは、その機能を達成する。この IC カードまたはこのモジュールは、耐タンパ性を有するとしてもよ 、。
[0688] (27)本発明は、上記の改竄防止処理生成装置が改竄防止処理を生成する方法と しても実現される。また、本発明は、これらの方法によりコンピュータに改竄防止処理 を生成させるコンピュータプログラムや、コンピュータプログラム力もなるディジタル信 号としても実現される。
[0689] (28)また、本発明は、上述のコンピュータプログラムまたはディジタル信号をコンビ ユータ読み取り可能な記録媒体、例えば、フレキシブルディスクや、ハードディスク、 CD-ROM, MO、 DVDゝ DVD— ROMゝ DVD— RAMゝ BD (Blu—ray Disc)、 半導体メモリなどに記録したものとしても実現される。また、これらの記録媒体に記録 されて ヽるディジタル信号としても実現される。
[0690] (29)また、本発明は、電気通信回線、無線通信回線、有線通信回線、インターネ ットを代表とするネットワーク、またはデータ放送等を経由して伝送される、上述のコン ピュータプログラムまたはディジタル信号としても実現される。
[0691] (30)また、本発明は、マイクロプロセッサとメモリを備えたコンピュータシステムとし ても実現される。この場合、そのメモリは、上述のコンピュータプログラムを記憶してお り、マイクロプロセッサは、そのコンピュータプログラムにしたがって動作する。
[0692] (31)また、そのコンピュータプログラムまたはディジタル信号を記録媒体に記録し て移送することにより、またはコンピュータプログラムまたはディジタル信号をネットヮ 一ク等を経由して移送すること〖こより、独立した他のコンピュータシステムにより本発 明の処理を実施してもよい。
[0693] (32)本発明は、これらの実施の形態及び変形例の組合せであってもよ!/、。 産業上の利用可能性
また、本発明に係る命令生成装置は、暗号鍵などの秘密情報を扱うプログラムを、 より解析が困難なプログラムに変換することができるので、不正解析者に漏洩すると 不利益を招くような秘密情報を用いたソフトウェア等を生成する機器などにおいて有 用である。また、本発明に係る命令生成装置により生成されたプログラムは、不正解 析者による解析が困難な形をしているので、不正解析者に漏洩すると不利益を招くよ うな秘密情報を用いた処理を行うソフトウェア等を実行する機器などに適用することが できる。

Claims

請求の範囲
[1] コンピュータに対してデータを被代入変数に代入させる第一処理命令を保護する ために、前記コンピュータに実行させる複数の命令力 なる出力処理命令群を生成 する命令生成装置であって、
前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一処 理命令に分岐させる分岐命令を、前記出力処理命令群の一部として生成する分岐 命令生成手段と、
前記コンピュータが前記分岐命令に従って前記第一処理命令を実行した結果を示 す前記被代入変数に代入されたデータに依存し、前記データが予め定められた内 容を示す場合に、前記出力処理命令群以降に行うべき予め定められた処理を前記 コンピュータに実行させる依存処理命令を、前記出力処理命令群の一部として生成 する依存処理命令生成手段と
を備えることを特徴とする命令生成装置。
[2] 前記依存処理命令生成手段は、
前記コンピュータに対して予め定められた処理を実行させる第二処理命令を取得し て前記依存処理命令に変換することによって前記依存処理命令を生成し、
前記依存処理命令は、前記第一処理命令が実行された結果を示す前記被代入変 数に代入された値が、予め定められた想定値を示す場合に、前記第二処理命令の 実行結果と同じ実行結果を前記コンピュータに導出させる
ことを特徴とする請求項 1に記載の命令生成装置。
[3] 前記命令生成装置は、さらに、
前記第一処理命令を使用しない前記第二処理命令と、前記第一処理命令を用い て前記第二処理命令とは異なる処理を前記コンピュータに実行させる第三処理命令 とを含む入力プログラムを取得する取得手段と、
前記入力プログラムの前記第二処理命令が前記依存処理命令生成手段によって 変換されて生成された前記依存処理命令を含む前記出力処理命令群と、前記第三 処理命令とを含む出力プログラムを出力する出力手段とを備える
ことを特徴とする請求項 2に記載の命令生成装置。 [4] 前記命令生成装置は、さらに、
予め定められた条件に従って前記第一処理命令により前記被代入変数に代入さ れる値を前記想定値として算出する想定値算出手段を備え、
前記依存処理命令生成手段は、
前記第一処理命令が実行された結果を示す前記被代入変数に代入された値が、 前記想定値算出手段により算出された想定値を示す場合に、前記第二処理命令の 実行結果と同じ実行結果を前記コンピュータに導出させる前記依存処理命令を生成 する
ことを特徴とする請求項 2に記載の命令生成装置。
[5] 前記命令生成装置は、さらに、
前記コンピュータが前記第一処理命令を実行する際に、前記コンピュータに対して 、前記第一処理命令で参照される被参照変数に値を代入させる被参照代入処理命 令を、前記出力処理命令群の一部として生成する被参照代入処理生成手段を備え 前記想定値算出手段は、
前記被参照変数に代入される値を前記条件として扱 、、前記被参照変数の値に従 つて前記第一処理命令により前記被代入変数に代入される値を前記想定値として算 出する
ことを特徴とする請求項 4に記載の命令生成装置。
[6] 前記命令生成装置は、さらに、
前記第一処理命令で参照される被参照変数を特定する被参照特定手段を備え、 前記被参照代入処理生成手段は、
前記コンピュータに対して、前記被参照特定手段により特定された被参照変数に 値を代入させる前記被参照代入処理命令を生成する
ことを特徴とする請求項 5に記載の命令生成装置。
[7] 前記命令生成装置は、さらに、
前記被参照変数に代入される値の候補となる複数の値を、被参照変数値の集合と して保持する値保持手段を備え、 前記被参照代入処理生成手段は、
前記被参照変数値の集合に含まれる何れかの値を前記被参照変数に代入させる 前記被参照代入処理命令を生成する
ことを特徴とする請求項 5に記載の命令生成装置。
[8] 前記想定値算出手段は、
前記被参照変数値の集合に含まれる各値に従って前記第一処理命令により前記 被代入変数に代入される値の集合を、想定値の集合として算出し、
前記依存処理命令生成手段は、
前記被参照変数値の集合と前記想定値の集合とを用いて前記依存処理命令を生 成し、
前記依存処理命令は、
前記第一処理命令が実行された結果を示す前記被代入変数の値が、前記想定値 の集合に含まれる値である場合に、前記第二処理命令の実行結果と同じ実行結果 を前記コンピュータに導出させる
ことを特徴とする請求項 7に記載の命令生成装置。
[9] 前記依存処理命令は、
前記コンピュータに対して、前記被代入変数に代入された値を、予め定められた想 定値と比較させ、前記被代入変数の値が前記想定値と等しいときには、予め定めら れた処理を前記コンピュータに実行させ、前記被代入変数の値が前記想定値と異な るときには、前記予め定められた処理の実行を前記コンピュータに抑制させる ことを特徴とする請求項 1に記載の命令生成装置。
[10] 前記命令生成装置は、さらに、
前記第一処理命令に含まれる前記被代入変数を特定する被代入特定手段を備え 前記依存処理命令生成手段は、
前記被代入特定手段により特定された前記被代入変数に代入されたデータに依 存した処理を前記コンピュータに実行させる前記依存処理命令を生成する
ことを特徴とする請求項 1に記載の命令生成装置。 前記命令生成装置は、さらに、
前記第一処理命令、前記第一処理命令の分岐元となる第一先行命令、前記第一 処理命令の分岐先となる第一後続命令、第一後続命令の分岐先となる第二処理命 令、および前記第二処理命令の分岐先となる第二後続命令を含む入力プログラムを 取得する取得手段と、
第一の条件が満たされて 、る場合と第二の条件が満たされて 、る場合とで、前記 第一処理命令の分岐先が異なるように、前記処理経路を前記第一処理命令から他 の命令に分岐させる条件分岐命令を生成する条件分岐命令生成手段と、
前記第一処理命令、前記第一先行命令、前記第一後続命令、および前記第二処 理命令を含む出力プログラムを出力する出力手段とを備え、
前記依存処理命令生成手段は、
前記被代入変数のデータが予め定められた内容を示す場合に、前記第二後続命 令と同一の実行結果を前記コンピュータに導出させる前記依存処理命令を生成し、 前記分岐命令生成手段は、
前記コンピュータが前記第二処理命令を実行した後に再び前記第一処理命令を 実行するように、処理経路を前記第二処理命令力 前記第一処理命令に分岐させる 前記分岐命令を生成し、
前記条件分岐命令生成手段は、
前記第一の条件が満たされている場合には、前記処理経路を前記第一処理命令 から前記第一後続命令に分岐させ、前記第二の条件が満たされている場合には、前 記処理経路を前記第一処理命令から前記依存処理命令に分岐させる前記条件分 岐命令を生成し、
前記出力手段は、
前記依存処理命令、前記分岐命令、および前記条件分岐命令を含む前記出力プ ログラムを出力し、
前記第一の条件は、前記第一処理命令が前記コンピュータに実行されたときに、 前記第一処理命令の実行の直前に前記第一先行命令が実行されていることであり、 前記第二の条件は、前記第一処理命令が前記コンピュータに実行されたときに、 前記第一処理命令の実行の直前に前記第二処理命令が実行されていることである ことを特徴とする請求項 1に記載の命令生成装置。
[12] 前記入力プログラムには、複数の前記第一後続命令が含まれており、
前記条件分岐命令生成手段は、
前記第一の条件が満たされている場合には、前記第一処理命令が実行された後 に、前記複数の第一後続命令のうち第三の条件に応じた 1つの第一後続命令が分 岐先第一後続命令として実行されるように、前記処理経路を前記第一処理命令から 前記分岐先第一後続命令に分岐させる前記条件分岐命令を生成する
ことを特徴とする請求項 11に記載の命令生成装置。
[13] 前記第三の条件は、変数に代入される値であり、
前記条件分岐命令生成手段は、
前記第一の条件が満たされて 、るか否かを示す変数の値と、前記第二の条件が満 たされている力否かを示す変数の値とに基づいて前記処理経路を分岐させる前記条 件分岐命令を生成する
ことを特徴とする請求項 12に記載の命令生成装置。
[14] 前記入力プログラムには、複数の前記第二後続命令が含まれてあり、
前記依存処理命令は、
前記複数の第二後続命令をそれぞれ前記依存処理命令に変換し、
前記条件分岐命令生成手段は、
前記第二の条件が満たされている場合には、前記第一処理命令が実行された後 に、前記複数の依存処理命令のうち第四の条件に応じた 1つの依存処理命令が分 岐先依存処理命令として実行されるように、前記処理経路を前記第一処理命令から 前記分岐先依存処理命令に分岐させる前記条件分岐命令を生成する
ことを特徴とする請求項 11に記載の命令生成装置。
[15] 前記第四の条件は、変数に代入される値であり、
前記条件分岐命令生成手段は、
前記第一の条件が満たされて 、るか否かを示す変数の値と、前記第二の条件が満 たされている力否かを示す変数の値とに基づいて前記処理経路を分岐させる前記条 件分岐命令を生成する
ことを特徴とする請求項 14に記載の命令生成装置。
[16] 前記命令生成装置は、さらに、
前記入力プログラムで使用されていない追加変数を生成する変数生成手段と、 前記第一の条件が満たされる場合に、前記コンピュータに対して、前記追加変数に 第一条件値を代入させる第一条件値代入命令を生成し、前記第二の条件が満たさ れる場合に、前記コンピュータに対して、前記追加変数に第二条件値を代入させる 第二条件値代入命令を生成する条件値代入命令生成手段とを備え、
前記条件分岐命令生成手段は、
前記追加変数に代入されている値が前記第一条件値であるときには、前記処理経 路を前記第一処理命令から前記第一後続命令に分岐させ、前記追加変数に代入さ れている値が前記第二条件値であるときには、前記処理経路を前記第一処理命令 から前記第依存処理命令に分岐させる条件分岐命令を生成する
ことを特徴とする請求項 11に記載の命令生成装置。
[17] 前記第二後続命令および前記依存処理命令は、前記第二処理命令が実行された 時点にお 、て得られて 、る実行結果を使用して、互いに同等の処理を前記コンピュ ータに実行させる命令であって、
前記命令生成装置は、さらに、
前記第二処理命令が実行された時点にぉ ヽて得られて!/ヽる実行結果を、前記第 一処理命令が実行される前に退避させる退避命令を生成する退避命令生成手段と 前記第一処理命令が再び実行された後に、退避された実行結果を復帰させる復帰 命令を生成する復帰命令生成手段とを備える
ことを特徴とする請求項 11に記載の命令生成装置。
[18] 前記分岐命令生成手段は、
前記第一処理命令が API (Application Program Interface)を含むときには、前記 A PIと同一の APIを呼び出す命令を前記第二後続命令として検索し、前記第二後続 命令の分岐元となる前記第二処理命令から前記第一処理命令に処理経路を分岐さ せる前記分岐命令を生成する
ことを特徴とする請求項 11に記載の命令生成装置。
[19] 前記命令生成装置は、さらに、
前記第一処理命令を含む入力プログラムを取得する取得手段と、
前記分岐命令生成手段および前記依存処理命令生成手段によって生成された前 記分岐命令および前記依存処理命令を前記入力プログラムに追加することにより、 前記第一処理命令、前記分岐命令および前記依存処理命令を含む出力プログラム を生成して出力する出力手段とを備える
ことを特徴とする請求項 1に記載の命令生成装置。
[20] コンピュータに対してデータを被代入変数に代入させる第一処理命令を保護する ための、前記コンピュータに実行させる複数の命令力 なるプログラムであって、 前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一処 理命令に分岐させる分岐命令と、
前記コンピュータが前記分岐命令に従って前記第一処理命令を実行した結果を示 す前記被代入変数に代入されたデータに依存し、前記データが予め定められた内 容を示す場合に、前記出力処理命令群以降に行うべき予め定められた処理を前記 コンピュータに実行させる依存処理命令と
を含むことを特徴とするプログラム。
[21] コンピュータに対してデータを被代入変数に代入させる第一処理命令を保護する ために、前記コンピュータに実行させる複数の命令力 なる出力処理命令群を生成 する命令生成方法であって、
前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一処 理命令に分岐させる分岐命令を、前記出力処理命令群の一部として生成する分岐 命令生成ステップと、
前記コンピュータが前記分岐命令に従って前記第一処理命令を実行した結果を示 す前記被代入変数に代入されたデータに依存し、前記データが予め定められた内 容を示す場合に、前記出力処理命令群以降に行うべき予め定められた処理を前記 コンピュータに実行させる依存処理命令を、前記出力処理命令群の一部として生成 する依存処理命令生成ステップと
を含むことを特徴とする命令生成方法。
[22] コンピュータに対してデータを被代入変数に代入させる第一処理命令を保護する ために、前記コンピュータに実行させる複数の命令力 なる出力処理命令群を生成 するためのプログラムであって、
前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一処 理命令に分岐させる分岐命令を、前記出力処理命令群の一部として生成する分岐 命令生成ステップと、
前記コンピュータが前記分岐命令に従って前記第一処理命令を実行した結果を示 す、前記被代入変数に代入されたデータに依存し、前記データが予め定められた内 容を示す場合に、前記出力処理命令群以降に行うべき予め定められた処理を前記 コンピュータに実行させる依存処理命令を、前記出力処理命令群の一部として生成 する依存処理命令生成ステップと
をコンピュータに実行させることを特徴とするプログラム。
[23] コンピュータに対してデータを被代入変数に代入させる第一処理命令を保護する ために、前記コンピュータに実行させる複数の命令力 なる出力処理命令群を生成 する集積回路であって、
前記コンピュータが前記第一処理命令を実行するように、処理経路を前記第一処 理命令に分岐させる分岐命令を、前記出力処理命令群の一部として生成する分岐 命令生成手段と、
前記コンピュータが前記分岐命令に従って前記第一処理命令を実行した結果を示 す前記被代入変数に代入されたデータに依存し、前記データが予め定められた内 容を示す場合に、前記出力処理命令群以降に行うべき予め定められた処理を前記 コンピュータに実行させる依存処理命令を、前記出力処理命令群の一部として生成 する依存処理命令生成手段と
を備えることを特徴とする集積回路。
PCT/JP2007/064156 2006-07-18 2007-07-18 dispositif de génération de commande WO2008010508A1 (fr)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US12/373,956 US8302188B2 (en) 2006-07-18 2007-07-18 Instruction generation apparatus for generating a computer program resistant to unauthorized analyses and tampering
JP2008525875A JP5118036B2 (ja) 2006-07-18 2007-07-18 命令生成装置、命令生成方法、プログラムおよび集積回路

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP2006-195249 2006-07-18
JP2006195249 2006-07-18
JP2006-303603 2006-11-09
JP2006303603 2006-11-09

Publications (1)

Publication Number Publication Date
WO2008010508A1 true WO2008010508A1 (fr) 2008-01-24

Family

ID=38956839

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2007/064156 WO2008010508A1 (fr) 2006-07-18 2007-07-18 dispositif de génération de commande

Country Status (3)

Country Link
US (1) US8302188B2 (ja)
JP (1) JP5118036B2 (ja)
WO (1) WO2008010508A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012043322A (ja) * 2010-08-23 2012-03-01 Kddi Corp ソフトウェアの不正流用検出装置、ソフトウェアの不正流用検出方法およびプログラム
WO2018150619A1 (ja) * 2017-02-14 2018-08-23 日本電信電話株式会社 付与装置、付与方法及び付与プログラム

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8312297B2 (en) * 2005-04-21 2012-11-13 Panasonic Corporation Program illegiblizing device and method
DE102007038763A1 (de) * 2007-08-16 2009-02-19 Siemens Ag Verfahren und Vorrichtung zur Sicherung eines Programms gegen eine Kontrollflussmanipulation und gegen einen fehlerhaften Programmablauf
JP5300294B2 (ja) * 2008-03-25 2013-09-25 パナソニック株式会社 処理装置、難読化装置、プログラムおよび集積回路
FR2942558B1 (fr) * 2009-02-24 2014-05-30 Eads Europ Aeronautic Defence Procede d'obscurcissement d'un programme d'ordinateur.
US20150199788A1 (en) * 2012-04-12 2015-07-16 Google Inc. Accelerating graphical rendering through legacy graphics compilation
CN102779255B (zh) * 2012-07-16 2014-11-12 腾讯科技(深圳)有限公司 判断恶意程序的方法及装置
FR3017226B1 (fr) * 2014-02-03 2016-01-29 St Microelectronics Sa Procede de securisation d'un code programme, systeme et processeur correspondants
US9946635B2 (en) * 2015-09-29 2018-04-17 International Business Machines Corporation Synchronizing multi-system program instruction sequences
EP3633656B1 (en) * 2017-05-25 2021-09-08 Nippon Telegraph and Telephone Corporation Secret tampering detection system, secret tampering detection apparatus, secret tampering detection method, and program
US11687440B2 (en) * 2021-02-02 2023-06-27 Thales Dis Cpl Usa, Inc. Method and device of protecting a first software application to generate a protected software application

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005166070A (ja) * 2005-01-11 2005-06-23 Ricoh Co Ltd 暗号プログラム生成装置及び暗号プログラム生成方法
WO2006009081A1 (ja) * 2004-07-16 2006-01-26 Matsushita Electric Industrial Co., Ltd. アプリケーション実行装置及びアプリケーション実行装置のアプリケーション実行方法
JP2006164184A (ja) * 2004-12-10 2006-06-22 Ntt Docomo Inc プログラム分割装置、プログラム実行装置、プログラム分割方法及びプログラム実行方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004362532A (ja) * 2002-10-25 2004-12-24 Matsushita Electric Ind Co Ltd 透かし挿入装置および透かし取出装置
JP4497450B2 (ja) 2003-12-10 2010-07-07 独立行政法人科学技術振興機構 プログラム認証システム
FR2864655B1 (fr) * 2003-12-31 2006-03-24 Trusted Logic Procede de controle d'integrite de programmes par verification d'empreintes de traces d'execution

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006009081A1 (ja) * 2004-07-16 2006-01-26 Matsushita Electric Industrial Co., Ltd. アプリケーション実行装置及びアプリケーション実行装置のアプリケーション実行方法
JP2006164184A (ja) * 2004-12-10 2006-06-22 Ntt Docomo Inc プログラム分割装置、プログラム実行装置、プログラム分割方法及びプログラム実行方法
JP2005166070A (ja) * 2005-01-11 2005-06-23 Ricoh Co Ltd 暗号プログラム生成装置及び暗号プログラム生成方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012043322A (ja) * 2010-08-23 2012-03-01 Kddi Corp ソフトウェアの不正流用検出装置、ソフトウェアの不正流用検出方法およびプログラム
WO2018150619A1 (ja) * 2017-02-14 2018-08-23 日本電信電話株式会社 付与装置、付与方法及び付与プログラム
JPWO2018150619A1 (ja) * 2017-02-14 2019-07-11 日本電信電話株式会社 付与装置、付与方法及び付与プログラム
US11403388B2 (en) 2017-02-14 2022-08-02 Nippon Telegraph And Telephone Corporation Assignment device, assignment method, and assignment program

Also Published As

Publication number Publication date
JPWO2008010508A1 (ja) 2009-12-17
US20090177873A1 (en) 2009-07-09
US8302188B2 (en) 2012-10-30
JP5118036B2 (ja) 2013-01-16

Similar Documents

Publication Publication Date Title
WO2008010508A1 (fr) dispositif de génération de commande
CN101491000B (zh) 用于混淆密码函数的方法和系统
US7874009B2 (en) Data processing device
US7469346B2 (en) Dual virtual machine architecture for media devices
US7516331B2 (en) Tamper-resistant trusted java virtual machine and method of using the same
JP4976991B2 (ja) 情報処理装置、プログラム検証方法及びプログラム
US20080263366A1 (en) Self-verifying software to prevent reverse engineering and piracy
WO2007125911A1 (ja) データ処理装置、方法、プログラム、集積回路、プログラム生成装置
US20090083521A1 (en) Program illegiblizing device and method
KR101216995B1 (ko) 인덱스 테이블 기반 코드 암호화 및 복호화 장치 및 그 방법
JP5171907B2 (ja) 情報処理装置、情報処理プログラム
US20080208886A1 (en) Encryption based silicon IP protection
KR20080013940A (ko) 전자기기, 갱신 서버장치, 키 갱신장치
US20090106832A1 (en) Computer system and program creating device
US20070136728A1 (en) Computer readable medium in which program is stored, computer data signal embodied in carrier wave, information processing apparatus that executes program, and program control method for executing program
JP2012514267A (ja) ソフトウェア分離実行方法、装置、及びコンピュータで読み取り可能な記録媒体
US20090254738A1 (en) Obfuscation device, processing device, method, program, and integrated circuit thereof
JP2014048866A (ja) アプリケーションプログラムの実行方法
JP4514473B2 (ja) コンピュータシステム、中央装置及びプログラム実行方法
US20080127078A1 (en) Method and apparatus for preventing modulation of executable program
CN109543433B (zh) 软件开发工具包加密方法、装置、计算机和存储介质
JP2002344441A (ja) ディジタルデータ暗号システム、ディジタルデータ再生装置、ディジタルデータ暗号方法、ディジタルデータ再生方法およびそれらの方法をコンピュータに実行させるプログラム
US20040111717A1 (en) Software modification
WO2012049881A1 (en) Protection method, decryption method, player, storage medium, and encryption apparatus of digital content
JP2004362077A (ja) データ変換システム

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200780027026.3

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 07790911

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2008525875

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 12373956

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

NENP Non-entry into the national phase

Ref country code: RU

122 Ep: pct application non-entry in european phase

Ref document number: 07790911

Country of ref document: EP

Kind code of ref document: A1