WO2021117524A1 - 実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体 - Google Patents

実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体 Download PDF

Info

Publication number
WO2021117524A1
WO2021117524A1 PCT/JP2020/044409 JP2020044409W WO2021117524A1 WO 2021117524 A1 WO2021117524 A1 WO 2021117524A1 JP 2020044409 W JP2020044409 W JP 2020044409W WO 2021117524 A1 WO2021117524 A1 WO 2021117524A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
code
memory
register
conversion unit
Prior art date
Application number
PCT/JP2020/044409
Other languages
English (en)
French (fr)
Inventor
渡辺 大
麻奈美 鈴木
Original Assignee
株式会社日立製作所
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 株式会社日立製作所 filed Critical 株式会社日立製作所
Publication of WO2021117524A1 publication Critical patent/WO2021117524A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords

Definitions

  • the present invention relates to a technique for preventing data theft in an information processing device.
  • malware illegal software
  • Confidential information may be retained in the main memory when the app is running. Malware has been reported that reads data in main memory and identifies credit card numbers, etc. from the data.
  • Patent Document 1 knows a technique of encrypting data and storing it in a memory.
  • Patent Document 1 secures a secure area in terms of hardware as a function of a CPU (Central Processing Unit) and controls access to the main memory independently of the OS (Operating System). is there.
  • CPU Central Processing Unit
  • OS Operating System
  • One object of the present invention is to provide a technique for facilitating data protection of a main storage device.
  • the execution file generator is an execution file generator that generates an execution file in machine language from a source file in which the source code of a program executed by an information processing device provided with a processor and a memory is described.
  • the first code embedding unit that adds the code for reserving the first register to the source file, and in the latter stage of the first code conversion unit and in the first stage of the second code conversion unit.
  • the write process of writing data to the memory in the intermediate code generated by the first code conversion unit from the source file to which the code for reserving the first register is added is detected, and the write process is performed on the first register.
  • the read process of reading the data from the memory in the intermediate code is detected, and the read process is performed from the memory using the first register. It has a second code embedding unit that replaces the encrypted data with a decryption / reading process that reads and decrypts the encrypted data.
  • data protection of the main memory can be easily realized.
  • FIG. 1 is a block diagram of the information processing system of the present embodiment.
  • This information processing system includes an application distribution server 103, an authentication server 110, and an application server 111.
  • the user 101 uses the information processing system using the network terminal 102.
  • the network terminal 102 is an information processing terminal capable of communicating via the network 201 such as a smartphone carried by the user 101. In this embodiment, as an example, the network terminal 102 has a single CPU configuration.
  • the authentication server 110 and the application server 111 are constructed by a service provider 104 that provides a predetermined service using the application.
  • the application is generated by the executable file generation device 900 and stored in the application distribution server 103.
  • the execution file generation device 900 is a device that generates an execution file of the application.
  • the application distribution server 103 is a server that distributes an application.
  • the user 101 downloads the application from the application distribution server 103 to the network terminal 102.
  • the downloaded application is used to use a specific service provided by the service provider 104.
  • the user 101 who has downloaded the application to the network terminal 102 executes user registration to the authentication server 110 using the application.
  • the user registration is a process of registering the user 101 and / or the network terminal 102 using the application to the authentication server 110.
  • the user 101 can receive user authentication or device authentication for the network terminal 102.
  • the user 101 uses the service through the application server 111 after undergoing user authentication or device authentication by the authentication server 110.
  • FIG. 2 is a block diagram of the network terminal 102.
  • the network terminal 102 has a network IF (interface) 210, a sensor 220, a storage 230, a CPU 240, and a RAM (Random Access Memory) 250.
  • the network interface 210 is wireless communication based on standards such as 3G (3rd generation mobile communication system) and 4G (4th generation mobile communication system), LAN standards such as IEEE802.11, or wired communication of Ethernet (registered trademark). It is an interface device that exchanges information with the outside according to the standard of.
  • the sensor 220 is a device that reads physical information such as acceleration and light.
  • the storage 230 is a non-volatile storage device that stores data and programs.
  • the CPU 240 is a processing device that executes a program, performs arithmetic processing, and controls the network terminal 102.
  • the RAM 250 is a volatile storage device that is used as the main storage device of an information processing device and holds intermediate data and programs being processed.
  • the network interface 210, the sensor 220, the storage 230, the CPU 240, and the RAM 250 are connected to each other by a data bus.
  • the network interface 210, the sensor 220, the storage 230, and the CPU 240 exchange data via the RAM 250.
  • the CPU 240 has a plurality of registers 241, an arithmetic unit 242, an entropy generation source 243, and a cycle counter 244 built-in.
  • the entropy generation source 243 is a device that generates an entropy input such as a physical random number generator that generates a random number by utilizing a physical phenomenon.
  • the cycle counter 244 is a device corresponding to a timer that generates a timing signal.
  • the application 231 is stored on the storage 230.
  • the application 231 includes binary data of the program and a setting file in which setting information used for executing the program is recorded.
  • the processing target data 251 to be processed by the application 231 is stored in the RAM 250.
  • the sensor data 221 acquired from the sensor 220 and / or the communication data 211 acquired from the network IF 210 is recorded in the RAM 250 as the processing target data 251.
  • the data on the storage 230 may be the data to be processed 251.
  • an OS (not shown) resides on the hardware of the network terminal 102.
  • the OS mediates the exchange of data between the hardware and the application, manages the authority to execute processing for each of the plurality of applications, and manages the resources possessed by the network terminal 102.
  • the application 231 is general application software, the application 231 and the processing target data 251 are stored in the user area.
  • the user area is an area that can be accessed by software having limited authority called user authority. Applications with user privileges can access the user area. On the other hand, it has a privilege that is stronger than the OS user authority.
  • the OS executes processing such as resource management in the privileged area.
  • the privileged area is an area accessible to privileged software. Interrupt control operates in the privileged area.
  • FIG. 3 is a conceptual diagram showing memory access by general application software.
  • the process 301 of the application 231 reads the input data 302 placed on the RAM 250 into the register 241 and calculates using the arithmetic unit 242 (step 310).
  • the intermediate data 312 in the middle of the calculation is written by the process 301 to the available area on the RAM 250 (step 311).
  • the intermediate data 312 is read back into register 241 as needed (step 313).
  • the process 301 repeats these steps to execute a predetermined process, and outputs the final result as output data 303 (step 314). In this case, unencrypted intermediate data 312 is placed in the RAM 250 while the process 301 is being executed.
  • the executable file generation device 900 of the present embodiment generates an executable file that encrypts data on the main memory while the application is being executed from the source file of such a general application.
  • FIG. 4 is a conceptual diagram showing memory access by the executable file generated by the executable file generator of the present embodiment.
  • a RAM encryption process for encrypting the data in the memory is added to the application 231, and the process 401 by the application 231 also has the RAM encryption process added.
  • the process 401 of FIG. 4 is a process in which the RAM encryption process is added to the process 301 of FIG.
  • Process 401 first generates a private key used for RAM encryption processing (step 411). More specifically, the process 401 receives the entropy input 402 from the entropy source 243, generates a key 412 based on the entropy input, and stores it on the register 241.
  • the process 401 reads the input data 302 placed on the RAM 250 into the register 241 and calculates using the arithmetic unit 242 (step 310).
  • the value in the middle of calculation is encrypted using the key 412 (step 421) to become the ciphertext 431, and the process 401 writes the ciphertext 431 in the available area on the RAM 250 (step 422).
  • the ciphertext 431 is read back into register 241 as needed (step 441), decrypted using the key 412 (step 442), and used for data processing on register 241.
  • the process 401 repeats these steps to execute a predetermined process, and outputs the final result as output data 303 (step 314).
  • the process 401 discards the key 412 by initializing the register 241 at the end (step 413).
  • FIG. 5 is a diagram showing a data flow on the hardware of the CPU in the RAM encryption process.
  • the relationship between the hardware mechanism of the CPU 240 and the RAM encryption processing will be described with reference to FIG.
  • the CPU 240 has m registers having a register length of 32 bits.
  • the key 412 is arranged in the two registers R [m-1] 511 and R [m] 512.
  • the data 501 to be encrypted and the constant 502, which are the data encrypted by the RAM encryption process are arranged in the registers R [2] 513 and R [k] 514, respectively.
  • the ciphertext 431 that encrypts the encryption target data 501 is generated (step 821).
  • the data size of the ciphertext 431 is twice the data size of the encryption target data 501.
  • the ciphertext 431 is divided into two data blocks (ciphertext data C1 503 and ciphertext data C2 504) equal to the register length, and is overwritten by the register R [2] and the register R [k].
  • the RAM encryption process includes a data encryption / write process for encrypting the data and a decryption / read process for reading and decrypting the encrypted data on the RAM 250.
  • the encryption in the encrypted writing process has been described as an example, but the relationship between the decryption in the decryption / reading process and the hardware mechanism of the CPU 240 is basically the same as this.
  • a relatively simple encryption operation is taken as an example for explanation, and an example using a constant 502 is shown, but the present invention is not limited to this.
  • a variable value such as a memory address for writing the encryption target data 501 may be used. According to this, even if the encrypted target data 501 has the same value, the value of the ciphertext will be different if the memory address to be written is different, so that further improvement in security can be expected.
  • a complicated XTS mode may be used as the encryption operation.
  • the data is written in the encrypted state on the RAM 250. Further, the encryption process for that purpose is performed on the CPU 240, and the key 412 is managed on the CPU 240.
  • advanced attacks such as using the function of the debugger are required. For example, if an attack using a debugger is performed, it is easy to detect it. Therefore, according to the present embodiment, it is possible to reduce the risk of information leaking from the RAM 250 when the application 231 is executed.
  • the executable file generator 900 will be described below.
  • FIG. 6 is a block diagram of the executable file generator.
  • the executable file generation device 900 is a device that generates an executable file 602 in machine language from a source file 601 in which the source code of the application 231 is described while embedding encryption and decryption processes.
  • the executable file generation device 900 includes a first code conversion unit 901, a second code conversion unit 902, a first code embedding unit 903, and a second code embedding unit 904. .
  • the hardware of the executable file generator 900 is composed of one or more computers (not shown) having a processor and a non-temporary storage device.
  • the processor of the computer executes a software program (executable file generation program) stored in the storage device. It is realized by doing.
  • the software program may be stored in the storage device in advance, or a part or all of the software program may be stored in the non-temporary storage device of another device via a network or a non-temporary storage medium as needed. Therefore, it may be stored in the above storage device.
  • the first code conversion unit 901 includes a compiler that allocates variables in the source file 601 to the register or memory of the processor and generates intermediate code including the allocation result.
  • the second code conversion unit 902 includes an assembler and a link that generate an executable file from the intermediate code.
  • the first code embedding unit 903 adds a process of reserving the first register to the source file 601 in the first stage of the first code conversion unit 901.
  • the second code embedding unit 904 is arranged after the first code conversion unit 901 and before the second code conversion unit 902.
  • the second code embedding unit 904 detects a write process for writing data to the memory in the intermediate code generated by the first code conversion unit 901 from the source file to which the code for reserving the first register is added, and the write process is performed. Is replaced with an encrypted writing process that encrypts the data using the first register and writes it to the memory.
  • the second code embedding unit 904 detects a read process for reading data from the memory in the intermediate code generated by the first code conversion unit 901 from the source file to which the code for reserving the first register is added. The read process is replaced with a decryption read process that reads and decodes the encrypted data from the memory using the first register.
  • the executable file generation device 900 generates the executable file 602 to which the RAM encryption process is added from the source file 601 will be described in detail.
  • FIG. 7 is a flowchart of the executable file generation process according to the present embodiment.
  • the executable file generation process of the present embodiment is a process of generating an executable file while embedding the encryption / decryption processing code in the application.
  • the first code conversion unit 901 includes a preprocessor.
  • the executable file generation process includes the following steps 611 to 617.
  • Steps 611 to 612 are executed by the first code embedding unit 903.
  • Steps 613 to 614 are executed by the first code conversion unit 901.
  • Step 615 is executed by the second code embedding unit 904.
  • Steps 616 to 617 are executed by the second code conversion unit 902.
  • the resource securing process is a process of adding a code for securing resources necessary for the process of encrypting the data written on the RAM 250 (RAM encryption process) to the source file 601. At that time, the script of the code prepared in advance may be added.
  • the source file 601 before the execution file generation process is shown as code_0c in FIG. 7. Details of step 611 will be described later with reference to FIG.
  • Step 612 Add the key generation process and the key discard process to the source file 601.
  • the source file 601 to which the key generation process and the key discard process are added is shown as code_1c in FIG. 7.
  • Step 613 The preprocessor uncomments from the source file 601 and expands the macro defined in the source file 601.
  • Step 614 The compiler parses the syntax of the source file 601 and transforms the abstractly written logic into a sequence of ASCII code instructions that runs on the hardware. An intermediate code is generated by this step 614. This intermediate code is shown as code_1asm in FIG.
  • the encryption code embedding process is executed.
  • the encryption code embedding process is a process of adding a process of encrypting or decrypting data to a memory access process in an intermediate code.
  • An intermediate code to which a process of encrypting and / or decrypting data is added is shown as code_2asm in FIG. Details of step 615 will be described later with reference to FIG.
  • Step 616 The assembler converts a sequence of instructions written in ASCII code, which is an intermediate code with processing for encrypting and / or decrypting data, into a binary code.
  • the linker links a plurality of binary files generated from a plurality of source files with an external library to generate an executable file 602.
  • the executable file 602 is shown as code_1exe in FIG.
  • the RAM encryption process is embedded before and after step 614 in which the function of holding the data abstractly described as a variable is allocated to physical computational resources such as memory and registers.
  • the compiler determines the allocation of the register holding the key 412 prior to determining the allocation of physical computational resources. After that, the compiler determines the allocation of physical computing resources to determine the memory access of the process 301. After that, the memory access is detected from the assembly code and the RAM encryption process is inserted.
  • the RAM encryption process can be implemented in any application 231 according to the procedure for generating the execution file 602 from the source file 601.
  • steps 611 and 612 may be executed after step 613. However, step 611 needs to be executed before step 614.
  • steps 611 to 616 are processes executed in file units, it is possible to determine whether or not to perform RAM encryption processing in file units by specifying whether or not to embed the RAM encryption processing in the makefile. If it is desired to determine the range of data protection by the RAM encryption process in more detail instead of the file unit, the variable to be protected may be defined by the comment and / or the definition statement.
  • the execution file of the process 301 in which the RAM encryption process is not embedded is generated, and the memory access pattern is analyzed on the debugger to obtain the data in the RAM encryption process. You may analyze the decrease in the execution speed of the application due to protection, determine the trade-off between execution speed and safety, and then determine the variable to be protected. It is also possible to examine the range affected by the value of one variable by prior analysis prior to the process of embedding the RAM encryption process, and verify whether or not the range of the variables defined as the protection target is appropriate.
  • the key generation process added to the source file 601 in step 612 includes a process of acquiring the entropy input from the entropy source 243 of the CPU 240.
  • the value indicated by the timer provided by the CPU may be read more easily, and the entropy input may be calculated from the value.
  • the pseudo-random number generated by the pseudo-random number generator provided by the OS may be used as the entropy input.
  • the value indicated by the timer of the CPU has a relatively low degree of entropy, but the degree of entropy can be sufficiently increased by reading the value of the timer a plurality of times at intervals and using the plurality of values.
  • the key 412 can be generated by converting the collected entropy input with a hash function or the like.
  • FIG. 8 is a flowchart of the resource securing process.
  • the resource securing process in step 611 includes the following steps 711 to 714.
  • Step 711 Insert the code that declares the registers 511 and 512 for holding the key 412 as global variables in the C language source file code_0c.
  • Step 712 Insert the code that declares the register 513 used for data encryption and decryption as a global variable in the source file code_0c.
  • Step 713 From the memory variables declared in the source file code_0c, the upper limit of the work area required to execute the process 301 in the state before adding the RAM encryption process is calculated.
  • Step 714 From the upper limit value calculated in step 713, the area required for holding the ciphertext in the execution of the process 401 after adding the RAM encryption process is calculated. Then, the code that declares the calculated area as a table of global variables is inserted into the source file code_0c.
  • the source file obtained as a result of steps 711 to 714 is output as code_1c.
  • registers can be assigned to specific variables by using the volatile declaration. However, since some of the general-purpose registers are reserved by the OS or the compiler, other registers are assigned to variables in this resource allocation process.
  • FIG. 9 is a conceptual diagram showing data transfer between functions.
  • the registers 511 and 512 holding the key 412 are declared as global variables. If the registers 511 and 512 are declared as global variables in this way, neither the caller 801 nor the calle 811 will use the registers 511 and 512 for any purpose other than holding the key 412. Also, the registers 511 and 512 are not initialized by the function call. Therefore, the key 412 can be passed from the caller 801 to the callee 811 without going through the RAM 250.
  • the table 803 which is an area required for holding the ciphertext, is declared as a global variable. If table 803 is declared as a global variable in this way, caller801 and callee811 can write and read the ciphertext by accessing the same area.
  • step 615 the encryption code embedding process of step 615, a process of encrypting the data in the memory is added to the comparison process. As a result, the data saved in the stack 805 is encrypted and protected.
  • FIG. 10 is a flowchart of the encryption code embedding process.
  • the encryption code embedding process of step 615 includes the following steps 911 to 917.
  • Step 911 The code_1asm, which is the output of the processing by the compiler in step 614, is searched, and the start address of the table holding the ciphertext is acquired.
  • Step 912 Move to the beginning of the instruction block in code_1asm.
  • Steps 913 to 915 Read the instruction line by line from the instruction block in code_1asm (step 913). This process is repeated until the read instruction becomes a memory access instruction (step 915). When the end of the code_1asm file is reached, the assembly code code_2asm in which the RAM encryption processing is embedded is output, and the processing is terminated (step 914).
  • Step 916 When the instruction is a memory access instruction in step 915, if the memory access instruction is a write instruction, the code of the write instruction is replaced with the code of the encrypted write process, and the memory access instruction is If it is a read instruction, the code of the read instruction is replaced with the code of the decoding / reading process.
  • Scripts for encryption / writing processing and decryption / reading processing may be prepared in advance and inserted as replacement code. However, since the address of the memory for storing the ciphertext differs for each memory access instruction, it is calculated separately.
  • Step 917 Further, a code for calculating the address for writing the ciphertext is inserted into code_1asm. At that time, a script prepared in advance for calculating the address for writing the ciphertext may be inserted.
  • FIG. 11 is a conceptual diagram showing how a write instruction is converted by adding a RAM encryption process.
  • the memory access instruction is converted in the encryption code embedding process of FIG. Specifically, in steps 916 to 917, a script is embedded in the memory access instruction portion in the intermediate code.
  • FIG. 11 shows a state of conversion of processing when the memory access instruction is a write instruction.
  • FIG. 11 shows the process 1001 before conversion.
  • the write instruction (store instruction) for writing data to the memory takes the address ptxt_addr 1002 to which the data is written and the register R [2] 513 holding the value of the data to be written as arguments.
  • Register R [2] Write the value on 513 to the position of the memory address ptxt_addr on the memory (step 1003).
  • the data on this register R [2] 513 is the data 501 to be encrypted.
  • the constant 502 is set in the register R [k] 514 reserved for the encryption process.
  • the value obtained by combining the register R [2] 513 and the register R [k] 514 is set as the plaintext ptxt 505, and the ciphertext ctxt 431 is generated using the key 412 (step 1012).
  • the procedure for generating the ciphertext ctxt 431 is as shown in FIG.
  • the size of the ciphertext ctxt 431 generated here is 2 words.
  • the address ctxt_addr 1014 for writing the ciphertext corresponding to the data is calculated in the process 1011 after conversion (step 1013).
  • the two-word ciphertext ctxt 431 is written at the location of the address ctxt_addr 1014 on the memory (step 1015).
  • FIG. 12 is a conceptual diagram showing how the read instruction is converted by adding the RAM encryption process.
  • FIG. 12 shows a state of conversion of processing when the memory access instruction is a read instruction.
  • the upper part of FIG. 12 shows the process 1101 before conversion.
  • the instruction (load instruction) for reading data from the memory reads the data ptxt 505 written in the data ptxt 505 from the position on the memory indicated at the address ptxt_addr 1102 for reading the data, and registers R [ 2] Store in 513 (step 1103).
  • the address ctxt_addr 1114 that reads the ciphertext in the post-conversion process 1111 is calculated from the address ptxt_addr 1102 that reads the data in the pre-conversion process 1101 (step 1113).
  • data for two words is read from the position of the address ctxt_addr 1114 on the memory, and each word is stored in the register R [2] 513 and the register R [k] 514, respectively (step 1115).
  • the two-word data stored in the register R [2] 513 and the register R [k] 514 is used as the ciphertext ctxt 431.
  • the ciphertext ctxt 431 is decrypted using the key 412 (step 1116).
  • the data ptxt 505 read from the memory and stored in the register R [2] 513 is generated on the register R [2] 513 in the process 1101 before conversion.
  • the word length of the register is 32 bits as an example.
  • the block length of the block cipher used for encryption is assumed to be 2 words.
  • the embodiment is not limited to these.
  • the constant 502 may be a plurality of words.
  • plaintext data of 2 to 4 words may be collectively encrypted into one ciphertext.
  • application software includes processing that continuously accesses memory, it is possible to reduce the number of encryption operations and retain the ciphertext by encrypting the plaintext data of multiple words at once. The required memory area can be reduced. The same applies when one word is 64 bits.
  • the address ctxt_addr 1114 for reading the ciphertext is calculated in step 1113 during the execution of the converted process 1111, but the present invention is not limited to this.
  • the address ptxt_addr 1102 for reading data is given as an immediate value in the process 1101 before conversion
  • the address ctxt_addr 1114 for reading the ciphertext is calculated in the encryption code embedding process, and the address is written in the intermediate code in advance. You may do it.
  • the process of calculating the address ctxt_addr 1114 in the processed 1111 after conversion can be omitted, the overhead due to the calculation of the address can be reduced, and the processing of the application can be speeded up.
  • the address calculation process 1013 can be omitted in the same manner.
  • the method of calculating the ciphertext address ctxt_addr corresponding to the plaintext from the plaintext address ptxt_addr is not particularly limited. If the relationship between the plaintext address and the ciphertext address is determined, the calculation can be performed based on the relationship.
  • the ciphertext address ctxt_addr is calculated from the plaintext ptxt_addr.
  • the start address of the data area used by the process 401 is ptxt_bp
  • the start address of the area for writing the ciphertext is ctxt_bp.
  • the data size of the ciphertext is twice the data size of the plaintext (data to be encrypted).
  • the ciphertext address ctxt_addr can be calculated by the following equation (1).
  • ctxt_addr ctxt_bp + (ptxt_addr-ptxt_bp) x 2 ... (1)
  • the ciphertext retains the original address such as ⁇ word ptxt_addr, word ctxt [2] ⁇ .
  • a method of defining with a structure and searching using ptxt_addr as a search key may be used.
  • the word-based address ctxt_addr is calculated as the position of the ciphertext in the memory, and the ciphertext read from that address is decrypted into plaintext, and the obtained plaintext is obtained. It is necessary to acquire the data to be encrypted from the specific byte position ptxt_pos of. Assuming that one word is 32 bits, that is, 4 bytes, the byte position ptxt_pos can be calculated by the following equation (2). "%" Is a modulo operator that calculates the remainder by the remainder operation.
  • (Matter 1) An execution file generator that generates a machine language execution file from a source file in which the source code of a program executed by an information processing device equipped with a processor and memory is described.
  • the first code conversion unit that allocates to the memory and generates an intermediate code including the allocation result
  • the second code conversion unit that generates an execution file from the intermediate code, and the first stage of the first code conversion unit.
  • a code for reserving the first register has been added in a first code embedding unit for adding a code for reserving a register to the source file and a code for reserving the first register in a stage after the first code conversion unit and in a stage before the second code conversion unit.
  • Decoding / reading process that replaces with the process of converting and writing, detects the reading process of reading data from the memory in the intermediate code, and reads the encrypted data from the memory using the first register and decodes the reading process. It has a second code embedding portion to be replaced with.
  • the data in the memory is encrypted by modifying the program before and after allocating the variables of the program to the register or the memory, so that the data protection of the main memory can be easily realized.
  • the first code embedding unit generates a private key in the source file and sets it in the first register, and a key that initializes the first register and erases the private key.
  • the second code embedding unit uses the private key on the first register in the encrypted writing and the decryption / reading process. As a result, the private key is generated in the program, the data in the memory is encrypted and decrypted using the private key, and the private key is erased, so that highly confidential encryption can be realized.
  • the first code embedding unit knows the size of the memory area to be used from the description of the source file, and the size of the memory area and the rate of change in the size of the data due to encryption. Based on the above, the size of the memory area required for holding the encrypted data is calculated, and a process for securing the memory area of the size is added to the source file. As a result, the memory area required for holding the encrypted data is secured in advance, so that the data can be held even when the amount of data increases due to the encryption.
  • the second code embedding unit prepares in advance a memory data encryption program that encrypts the data on the second register and writes it to the memory, and stores the data of the predetermined target register in the intermediate code.
  • the memory data encryption program in which the second register is replaced with the target register is embedded in place of the write process portion. This makes it possible to easily change the program by preparing a memory data encryption program in advance and embedding it in the intermediate code.
  • the second code embedding unit prepares in advance a memory data decoding program that reads data from the memory onto the third register and performs decoding processing using the private key held in the first register.
  • a read process for storing data read from the memory in a predetermined target register is detected in the intermediate code
  • the memory data decoding in which the third register is replaced with the target register instead of the read process portion is detected. Embed the program. This makes it possible to easily change the program by preparing a memory data decoding program in advance and embedding it in the intermediate code.
  • the second code embedding unit acquires a first address of a memory used as a data storage destination for the write process or the read process, and based on the address, the encrypted write process or the said.
  • the second address of the memory used as the storage destination of the ciphertext corresponding to the data in the decryption / reading process is calculated.
  • the address for storing the ciphertext can be specified in association with the address of the data, and the encryption and decryption processes can be embedded in the program.
  • the second code embedding unit is output from the first code conversion unit when the writing process is replaced with the encrypted writing process and when the reading process is replaced with the decryption / reading process.
  • the start address ptxt_bp of the data area assigned to the data before encryption and the start address ctxt_bp of the data area assigned to the data after encryption are detected from the intermediate code, and the first address is set to ptxt_addr.
  • the second address ctxt_addr is calculated.
  • the address for storing the ciphertext corresponding to the data address can be specified based on the ratio of the data size before and after encryption, and the encryption and decryption processes can be embedded in the program.
  • the first code embedding unit adds a code that declares the first register as a global variable to the source file.
  • global variables are used in the process of encrypting data in memory, so when there is a process in which one function calls another function, the register holding the variable is not initialized by the function call and is called.
  • the side function and the called side function can easily share the value on the register.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Devices For Executing Special Programs (AREA)
  • Storage Device Security (AREA)

Abstract

ソースファイルから実行ファイルを生成する実行ファイル生成装置が、ソースファイル内の変数をプロセッサのレジスタまたはメモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、中間コードから実行ファイルを生成する第2コード変換部と、第1コード変換部の前段において、第1レジスタを予約するコードをソースファイルに追加する第1コード埋め込み部と、第1コード変換部の後段で第2コード変換部の前段において、中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、メモリからデータを読み出す読み出し処理を検出し、暗号化されたデータを読み出して復号する復号読み出し処理に置換する第2コード埋め込み部と、を有する。

Description

実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体
 本発明は、情報処理装置におけるデータの盗用を防止する技術に関する。
 スマートフォンやパーソナルコンピュータ等のモバイル端末の普及とWebサービスの高度化とに伴い、モバイル端末で利用可能なサービスの種類も多様化している。特に近年では、モバイル決済のように、従来は、金融機関のATM(Automatic Teller Machine)、窓口、あるいは専用端末を経由して行う必要のあった料金の支払や送金を、ユーザのモバイル端末上で行うことを可能にする金融サービスが流行の兆しを見せている。この種の金融サービスは、専用のアプリケーションソフトウェア(以下、単に「アプリ」ともいう)をモバイル端末にインストールし、そのアプリを介してサービスを利用するという形態が一般的である。
 このようなサービスを利用するときにはユーザ認証または端末認証を行う必要がある。この認証には、ユーザまたは端末のみが有する秘密情報が用いられる。このような高い秘匿性が求められる処理は、モバイル端末に搭載されたSIM(Subscriber Identity Module)チップ上の領域で行われることが望ましい。しかしながら、SIMチップの記憶容量および処理能力は、そのようなアプリをインストールし動作させるには十分でない。そのため、上述したように、実際には、通常のメモリ領域でアプリを実行して秘密情報を取り扱うケースがほとんどである。
 その一方で、モバイル端末は、一定の割合でマルウェア(不正ソフトウェア)に感染しているという現実がある。例えば、金融サービスに特化して不正な動作を行うマルウェアの存在も確認されている。アプリを実行しているときには秘密情報が主記憶装置(メインメモリ)上に保持されることがある。メインメモリ上のデータを読み取り、そのデータからクレジットカード番号などを特定するマルウェアが報告されている。
 このような状況から、モバイル端末にてアプリが実行されている間のメインメモリのデータを保護することが求められている。そして、特許文献1には、データを暗号化してメモリに格納する技術が知られている。
米国特許出願公開第2013/159726号明細書
 特許文献1に開示された技術は、CPU(Central Processing Unit)の機能として、ハードウェア的にセキュアな領域を確保し、OS(Operating System)から独立してメインメモリへのアクセスを制御するものである。しかし、この技術を利用するには専用のハードウェアが必要であるため、ユーザにとって利便性が低く、サービス提供者にとってもユーザによるサービス利用の機会を損失する可能性がある。
 本発明のひとつの目的は、主記憶装置のデータ保護を容易にする技術を提供することである。
 本開示にひとつの態様による実行ファイル生成装置は、プロセッサとメモリを備える情報処理装置で実行されるプログラムのソースコードが記述されたソースファイルから、マシン語の実行ファイルを生成する実行ファイル生成装置であって、ソースファイル内の変数を前記プロセッサのレジスタまたは前記メモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、中間コードから実行ファイルを生成する第2コード変換部と、前記第1コード変換部の前段において、第1レジスタを予約するコードを前記ソースファイルに追加する第1コード埋め込み部と、前記第1コード変換部の後段で前記第2コード変換部の前段において、前記第1レジスタを予約するコードが追加されたソースファイルから前記第1コード変換部により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、前記書き込み処理を、前記第1レジスタを用いて前記データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、前記中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、前記読み出し処理を、前記第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する第2コード埋め込み部と、を有する。
 本開示のひとつの態様によれば、メインメモリのデータ保護を容易に実現することができる。
本実施形態の情報処理システムのブロック図である。 ネットワーク端末のブロック図である。 一般的なアプリケーションソフトウェアによるメモリアクセスを表す概念図である。 本実施形態の実行ファイル生成装置により生成された実行ファイルによるメモリアクセスを表す概念図である。 RAM暗号化処理におけるCPUのハードウェア上でのデータの流れを示す図である。 実行ファイル生成装置のブロック図である。 本実施形態による実行ファイル生成処理のフローチャートである。 リソース確保処理のフローチャートである。 関数間でのデータの受け渡しを示す概念図である。 暗号化コード埋め込み処理のフローチャートである。 RAM暗号化処理を加えることにより書き込み命令がどのように変換されるかを示す概念図である。 RAM暗号化処理を加えることにより読み出し命令がどのように変換されるかを示す概念図である。
 以下、本発明の実施形態について図面を参照して説明する。
 図1は、本実施形態の情報処理システムのブロック図である。
 本情報処理システムは、アプリ配信サーバ103と、認証サーバ110と、アプリケーションサーバ111とを含んでいる。ユーザ101はネットワーク端末102を用いて情報処理システムを利用する。ネットワーク端末102は、ユーザ101が携帯するスマートフォンなどネットワーク201経由の通信が可能な情報処理端末である。本実施形態では一例としてネットワーク端末102はシングルCPU構成である。認証サーバ110およびアプリケーションサーバ111は、アプリを利用した所定のサービスを提供するサービス提供者104により構築されている。アプリは、実行ファイル生成装置900で生成され、アプリ配信サーバ103に格納される。実行ファイル生成装置900は、アプリの実行ファイルを生成する装置である。アプリ配信サーバ103は、アプリを配信するサーバである。
 ユーザ101は、アプリ配信サーバ103からネットワーク端末102にアプリをダウンロードする。ダウンロードしたアプリは、サービス提供者104が提供する特定のサービスを利用するために用いられる。ネットワーク端末102にアプリをダウンロードしたユーザ101は、アプリを利用して認証サーバ110に対してユーザ登録を実行する。ユーザ登録は、アプリを利用するユーザ101および/またはネットワーク端末102を認証サーバ110に対して登録する処理である。ユーザ登録によりユーザ101はユーザ認証あるいはネットワーク端末102に対する機器認証を受けることが可能となる。その後、ユーザ101は、認証サーバ110によるユーザ認証あるいは機器認証を経て、アプリケーションサーバ111を通じサービスを利用する。
 図2は、ネットワーク端末102のブロック図である。
 ネットワーク端末102は、ネットワークIF(インターフェース)210、センサ220、ストレージ230、CPU240、RAM(Random Access Memory)250を有している。
 ネットワークインターフェース210は、3G(第3世代移動通信システム)、4G(第4世代移動通信システム)などの規格、IEEE802.11などのLANの規格による無線通信、または、Ethernet(登録商標)の有線通信の規格により、外部と情報のやり取りを行うインターフェース装置である。
 センサ220は、加速度や光などの物理情報を読み取る装置である。
 ストレージ230は、データやプログラムを保存する不揮発性の記憶装置である。
 CPU240は、プログラムを実行し、演算処理やネットワーク端末102の制御を行う処理装置である。
 RAM250は、情報処理装置の主記憶装置として用いられ、処理中の中間データやプログラムを保持する揮発性の記憶装置である。
 ネットワークインターフェース210、センサ220、ストレージ230、CPU240、およびRAM250は、データバスで相互に接続されている。ネットワークインターフェース210、センサ220、ストレージ230、およびCPU240は、RAM250を介してデータをやり取りする。
 CPU240は、複数のレジスタ241、演算器242、エントロピー発生源243、およびサイクルカウンタ244を内蔵している。エントロピー発生源243は、物理現象を利用して乱数を発生させる物理乱数生成器などエントロピー入力を発生させる装置である。サイクルカウンタ244は、タイミング信号を発生させるタイマに相当する装置である。
 ストレージ230上には、アプリ231が保存される。アプリ231にはプログラムのバイナリデータと、プログラムの実行に用いられる設定情報が記録された設定ファイルとが含まれている。
 アプリ231による処理の対象となる処理対象データ251はRAM250に記憶される。例えば、センサ220から取得されたセンサデータ221および/またはネットワークIF210から取得された通信データ211が処理対象データ251としてRAM250に記録される。また、ストレージ230上のデータが処理対象データ251となることもある。
 ネットワーク端末102のハードウェア上には、通常、OS(不図示)が常駐している。OSは、ハードウェアとアプリの間でデータのやり取りを仲介し、また複数のアプリのそれぞれについて処理を実行する権限を管理し、またネットワーク端末102が有するリソースを管理する。
 アプリ231は一般的なアプリケーションソフトウェアなので、アプリ231と処理対象データ251はユーザ領域に格納される。ユーザ領域は、ユーザ権限と呼ばれる限定された権限を有するソフトウェアがアクセス可能な領域である。ユーザ権限を与えられたアプリケーションはユーザ領域にアクセスできる。一方、OSユーザ権限より強い権限である特権を有する。OSはリソース管理などの処理を特権領域で実行する。特権領域は、特権を有するソフトウェアがアクセス可能な領域である。特権領域では割り込み制御が動作する。
 図3は、一般的なアプリケーションソフトウェアによるメモリアクセスを表す概念図である。図3を参照すると、アプリ231のプロセス301は、RAM250上に置かれている入力データ302をレジスタ241上に読み込み、演算器242を用いて計算する(ステップ310)。計算の途中の中間データ312は、プロセス301により、RAM250上の利用できる領域に書き込まれる(ステップ311)。中間データ312は必要に応じてレジスタ241に再度読み込まれる(ステップ313)。プロセス301は、これらを繰り返して所定の処理を実行し、最終的な結果を出力データ303として出力する(ステップ314)。この場合、プロセス301が実行されている間、RAM250には暗号化されていない中間データ312が置かれる。
 本実施形態の実行ファイル生成装置900は、このような一般的なアプリのソースファイルから、アプリが実行されている間の主記憶装置上のデータを暗号化する実行ファイルを生成するものである。
 図4は、本実施形態の実行ファイル生成装置により生成された実行ファイルによるメモリアクセスを表す概念図である。ここではアプリ231にメモリ上のデータを暗号化するRAM暗号化処理が追加されており、そのアプリ231によるプロセス401もRAM暗号化処理が追加されたものとなっている。図4のプロセス401は、図3のプロセス301にRAM暗号化処理が追加されたプロセスである。
 プロセス401は、まずRAM暗号化処理に用いる秘密鍵を生成する(ステップ411)。より具体的には、プロセス401はエントロピー発生源243からエントロピー入力402を受け取り、エントロピー入力に基づいて鍵412を生成し、レジスタ241上に保管する。
 プロセス401は、RAM250上に置かれている入力データ302をレジスタ241上に読み込み、演算器242を用いて計算する(ステップ310)。計算途中の値は、鍵412を使って暗号化されて(ステップ421)暗号文431となり、プロセス401がRAM250上の利用できる領域にその暗号文431を書き込む(ステップ422)。暗号文431は必要に応じてレジスタ241に再度読み込まれ(ステップ441)、鍵412を使って復号され(ステップ442)、レジスタ241上のデータ処理に用いられる。プロセス401は、これらを繰り返して所定の処理を実行し、最終的な結果を出力データ303として出力する(ステップ314)。プロセス401は、終了時にレジスタ241を初期化することで鍵412を廃棄する(ステップ413)。
 図5は、RAM暗号化処理におけるCPUのハードウェア上でのデータの流れを示す図である。
 図5を用いてCPU240のハードウェア機構とRAM暗号化処理の関係について説明する。ここではCPU240は、レジスタ長が32ビットのレジスタをm本有しているものとする。このうち2本のレジスタR[m-1]511、R[m]512に、鍵412を配置する。また、RAM暗号化処理で暗号化されるデータである暗号化対象データ501と定数502はレジスタR[2]513とR[k]514にそれぞれ配置されているものとする。
 この暗号化対象データ501と定数502とを連結した平文505と鍵412に基づき、暗号化対象データ501を暗号化した暗号文431が生成される(ステップ821)。ここでは、暗号文431のデータサイズは暗号化対象データ501のデータサイズの2倍であるとする。暗号文431は、レジスタ長に等しい2つのデータブロック(暗号文データC1 503と暗号文データC2 504)に分割され、レジスタR[2]とレジスタR[k]に上書きされる。
 なお、RAM暗号化処理には、データを暗号化してRAM250に暗号化書き込み処理と、RAM250上の暗号化されたデータを読み出して復号する復号読み出し処理とが含まれている。ここでは暗号化書き込み処理における暗号化の方を例にとって説明したが、復号読み出し処理における復号もCPU240のハードウェア機構との関係は基本的にこれと同様である。
 また、ここでは比較的単純な暗号化の演算を説明のための一例とし、定数502を用いる例を示したが、これに限定されることはない。他の例として、定数502の代わりに、暗号化対象データ501を書き込むメモリアドレスなど可変の値を用いても良い。これによれば、暗号化対象データ501が同じ値であっても、書き込むメモリアドレスが異なれば暗号文の値は異なるものとなるため、より安全性の向上がが期待できる。更に、暗号化の演算として複雑なXTSモードを用いても良い。
 以上の通り、本実施形態の実行ファイル生成装置900で生成した実行ファイルによる情報処理装置のデータ処理方法によれば、RAM250上にはデータは暗号化された状態で書き込まれる。また、そのための暗号処理はCPU240上で行われ、鍵412はCPU240上で管理される。アプリ231によるプロセス401以外のものが鍵412にアクセスするためには、デバッガの機能を用いるなど高度な攻撃が必要となる。例えば、デバッガを使用した攻撃が行われれば、その検出は容易である。したがって、本実施形態によれば、アプリ231の実行時にRAM250から情報が流出するリスクを軽減することができる。
 以下、実行ファイル生成装置900について説明する。
 図6は、実行ファイル生成装置のブロック図である。実行ファイル生成装置900は、アプリ231のソースコードが記述されたソースファイル601から、暗号化および復号の処理を埋め込みながらマシン語の実行ファイル602を生成する装置である。
 図6を参照すると、実行ファイル生成装置900は、第1コード変換部901と、第2コード変換部902と、第1コード埋め込み部903と、第2コード埋め込み部904と、を有している。実行ファイル生成装置900のハードウェアは、図示していない1つ以上の、プロセッサと非一時的な記憶装置を備えるコンピュータにより構成されている。第1コード変換部901、第2コード変換部902、第1コード埋め込み部903、および第2コード埋め込み部904は、コンピュータのプロセッサが記憶装置に格納されたソフトウェアプログラム(実行ファイル生成プログラム)を実行することにより実現される。
 上記ソフトウェアプログラムは、予め上記記憶装置に格納されていても良いし、一部または全部が、必要に応じて、他の装置の非一時的記憶装置からネットワーク経由で、または非一時的な記憶媒体から、上記記憶装置に格納されても良い。
 第1コード変換部901は、ソースファイル601内の変数をプロセッサのレジスタまたはメモリに割り付けて、割り付け結果を含む中間コードを生成するコンパイラを含む。
 第2コード変換部902は、中間コードから実行ファイルを生成するアセンブラおよびリンクを含む。
 第1コード埋め込み部903は、第1コード変換部901の前段において、第1レジスタを予約する処理をソースファイル601に追加する。
 第2コード埋め込み部904は、第1コード変換部901の後段で第2コード変換部902の前段に配置される。第2コード埋め込み部904は、第1レジスタを予約するコードが追加されたソースファイルから第1コード変換部901により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、その書き込み処理を、第1レジスタを用いてデータを暗号化してメモリに書き込む暗号化書き込む処理に置換する。また、第2コード埋め込み部904は、第1レジスタを予約するコードが追加されたソースファイルから第1コード変換部901により生成された中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、その読み出し処理を、第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する。
 以下、実行ファイル生成装置900が、ソースファイル601からRAM暗号化処理を加えた実行ファイル602を生成する処理について詳細に説明する。
 図7は、本実施形態による実行ファイル生成処理のフローチャートである。本実施形態の実行ファイル生成処理は、アプリに暗号化および復号の処理のコードを埋め込みながら、実行ファイルを生成する処理である。ここでは、ソースファイル601がC言語で記述されている場合を例示する。第1コード変換部901にはプリプロセッサが含まれる。
 図7を参照すると、実行ファイル生成処理は以下のステップ611~617を含む。ステップ611~612は、第1コード埋め込み部903により実行される。ステップ613~614は第1コード変換部901により実行される。ステップ615は第2コード埋め込み部904により実行される。ステップ616~617は第2コード変換部902により実行される。
・ステップ611:リソース確保処理を実行する。リソース確保処理は、RAM250上に書き込まれるデータを暗号化する処理(RAM暗号化処理)に必要なリソースを確保するコードをソースファイル601に追記する処理である。その際、予め用意しておいた当該コードのスクリプトを追記することにしてもよい。実行ファイル生成処理が施される前のソースファイル601が図7にはcode_0cとして示されている。ステップ611の詳細は図8を参照して後述する。
・ステップ612:鍵生成処理および鍵廃棄処理をソースファイル601に追加する。鍵生成処理および鍵廃棄処理が追加されたソースファイル601が図7にはcode_1cとして示されている。
・ステップ613:プリプロセッサがソースファイル601からコメントを除去し、ソースファイル601に定義されたマクロを展開する。
・ステップ614:コンパイラがソースファイル601の構文を解析し、抽象的に記述された論理をハードウェア上で動作するアスキーコードの命令の列に変換する。このステップ614により中間コードが生成される。この中間コードが図7ではcode_1asmとして示されている。
・ステップ615:暗号化コード埋め込み処理を実行する。暗号化コード埋め込み処理は、中間コードにおけるメモリアクセス処理にデータを暗号化または復号する処理を付加する処理である。データを暗号化および/または復号する処理が付加された中間コードが図7ではcode_2asmとして示されている。ステップ615の詳細は図10を参照して後述する。
・ステップ616:アセンブラが、中間コードにデータを暗号化および/または復号する処理が付加されたアスキーコードで記述された命令の列をバイナリのコードに変換する。
・ステップ617:リンカが、複数のソースファイルから生成された複数のバイナリのファイルと外部ライブラリとをリンクし、実行ファイル602を生成する。実行ファイル602が図7ではcode_2exeとして示されている。
 このように、本実施形態によれば、変数として抽象的に記述されたデータを保持する機能を、メモリやレジスタといった物理的な計算資源に割り当てるステップ614の前後にRAM暗号化処理の埋め込み処理を分割する。具体的には、コンパイラが物理的な計算資源の割り当てを決定するに先立って、鍵412を保持するレジスタの割り当てを決定する。その後、コンパイラが物理的な計算資源の割り当てを決定することで、プロセス301のメモリアクセスが決定されるので、その後にアセンブリコードからメモリアクセスを検出し、RAM暗号化処理を挿入する。これにより、ソースファイル601から実行ファイル602を生成する手順に沿って任意のアプリ231にRAM暗号化処理を実装することができる。
 なお、ステップ611およびステップ612はステップ613の後で実行しても良い。ただし、ステップ611はステップ614前に実行する必要がある。
 また、ステップ611~ステップ616は、ファイル単位で実行される処理なので、makefileにRAM暗号化処理の埋め込みの有無を指定することで、ファイル単位でRAM暗号化処理を行うか否かを決定できる。ファイル単位ではなく、更に詳細にRAM暗号化処理でデータを保護する範囲を決定したい場合には、コメントおよび/またはdefine文で保護の対象とする変数を定めても良い。この場合、RAM暗号化処理を埋め込む処理に先立って、RAM暗号化処理を埋め込まないプロセス301の実行ファイルを生成し、デバッガ上でメモリアクセスのパターンを解析することにより、RAM暗号化処理でデータを保護することによるアプリの実行速度の低下を分析し、実行速度と安全性とのトレードオフを決定してから保護対象の変数を決めることにしても良い。このようなRAM暗号化処理を埋め込む処理に先立つ事前の分析により、1つの変数の値が影響する範囲を調べ、保護対象として定めた変数の範囲が妥当か否かを検証することもできる。
 なお、本実施形態では、ステップ612にてソースファイル601に追加する鍵生成処理は、CPU240が持つエントロピー発生源243からエントロピー入力を取得する処理を含むものである。例えば、乱数生成器を呼び出してエントロピー入力を取得する方法の他に、より簡便にCPUの備えるタイマが示す値を読み取り、その値からエントロピー入力を算出することにしてもよい。また、OSが提供する疑似乱数生成器により生成される疑似乱数をエントロピー入力としてもよい。CPUのタイマが示す値はエントロピーの度合いが比較的低いが、時間間隔を空けてタイマの値を複数回読み取り、それら複数の値を用いることにより、エントロピーの度合いを十分に高めることができる。集めたエントロピー入力をハッシュ関数などで変換することにより鍵412を生成することができる。
 また、ここでは、C言語を例にとって説明したが、この例に限定されことはない。本実施形態に用いられている実行ファイルの生成方法は、C言語以外のプログラミング言語であっても、変数をメモリあるいはレジスタといった物理的な計算資源に割り当てる手順の前と後でコードを書き換えることが可能なものであれば、同様に適用できる。また、アプリケーションソフトウェアがインタプリタを利用して実行させるものである場合、あるいは、アプリケーションソフトウェアを実行する実行環境がVM(Virtual Machine)である場合には、インタプリタあるいはVMに対して、本実施形態に示されたRAM暗号化処理を埋め込むことで、個別のアプリケーションソフトウェアにRAM暗号化処理を埋め込まなくても、メモリ上のデータを暗号化して保護することができる。
 図8は、リソース確保処理のフローチャートである。
 図8を参照すると、ステップ611のリソース確保処理は以下のステップ711~714を含む。
・ステップ711:C言語のソースファイルcode_0cに、鍵412を保持するためのレジスタ511、512をグローバル変数として宣言するコードを挿入する。
・ステップ712:ソースファイルcode_0cに、データの暗号化および復号に使用するレジスタ513をグローバル変数として宣言するコードを挿入する。
・ステップ713:ソースファイルcode_0cに宣言されているメモリ変数から、RAM暗号化処理を追加する前の状態のプロセス301の実行に必要なワークエリアの上限値を算出する。
・ステップ714:ステップ713で算出した上限値から、RAM暗号化処理を追加した後のプロセス401の実行で暗号文の保持に必要となる領域を算出する。そして、算出された領域をグローバル変数のテーブルとして宣言するコードをソースファイルcode_0cに挿入する。
 ステップ711~714までの結果として得られたソースファイルはcode_1cとして出力される。
 なお、C言語では、volatile宣言を用いることでレジスタを特定の変数に割り付けることができる。ただし、汎用レジスタのいくつかはOSあるいはコンパイラが予約しているので、このリソース確保処理ではそれ以外のレジスタを変数へ割り付ける。
 図9は、関数間でのデータの受け渡しを示す概念図である。
 プロセス401が実行される中では、ある関数が他の関数を呼び出す関数呼び出しが多数発生する。関数呼び出しでは、呼び出し側の関数(caller)801は、呼ばれる側の関数(callee)811にRAM250を介してデータを渡す。
 本実施形態では、上述のように、鍵412を保持するレジスタ511、512がグローバル変数で宣言される。このようにレジスタ511、512をグローバル変数で宣言しておくと、caller801とcallee811のいずれもレジスタ511、512を鍵412の保持以外の用途には使用しなくなる。また、レジスタは511、512は、関数呼び出しによって初期化されることはない。そのため、RAM250を介さずに鍵412をcaller801からcallee811に渡すことが可能となる。
 また、本実施形態では、上述のように、暗号文の保持に必要となる領域となるテーブル803がグローバル変数で宣言される。このようにテーブル803をグローバル変数で宣言しておくと、caller801とcallee811は暗号文の書き込みと読み出しを同じ領域にアクセスすることで行うことができる。
 なお、関数呼び出しの実行前にレジスタ上の値はcaller801のスタック805に退避される。この退避処理は、ステップ614に示したコンパイラの実行時に挿入される。したがって、ステップ615の暗号化コード埋め込み処理によって、対比処理にはメモリ上のデータを暗号化する処理が付加される。これにより、スタック805に退避されるデータは暗号化され、保護されることになる。
 図10は、暗号化コード埋め込み処理のフローチャートである。
 図10を参照すると、ステップ615の暗号化コード埋め込み処理は以下のステップ911~917を含む。
・ステップ911:ステップ614におけるコンパイラによる処理の出力であるcode_1asmを検索して、暗号文を保持するテーブルの先頭アドレスを取得する。
・ステップ912:code_1asmにおける命令ブロックの先頭に移動する。
・ステップ913~915:code_1asmにおける命令ブロックから命令を1行ずつ読み込む(ステップ913)。読み込んだ命令がメモリアクセス命令になるまで、この処理を繰り返す(ステップ915)。code_1asmのファイルの終端に到達したら、RAM暗号化処理を埋め込んだアセンブリコードcode_2asmを出力し、処理を終了する(ステッ914)。
・ステップ916:ステップ915にて命令がメモリアクセス命令であった場合、そのメモリアクセス命令が書き込み命令であれば、その書き込み命令のコードを暗号化書き込み処理のコードに置換し、そのメモリアクセス命令が読み込み命令であれば、その読み込み命令のコードを復号読み出し処理のコードに置換する。暗号化書き込み処理および復号読み出し処理のスクリプトを予め用意しておいて、置換するコードとして挿入することにしてもよい。ただし、暗号文を格納するメモリのアドレスについてはメモリアクセス命令毎に異なるので、別途算出する。
・ステップ917:さらに、code_1asmに、暗号文を書き込むアドレスを算出するコードを挿入する。その際、予め用意しておいた、暗号文を書き込むアドレスを算出するスクリプトを挿入することにしてもよい。
 図11は、RAM暗号化処理を加えることにより書き込み命令がどのように変換されるかを示す概念図である。上述のように図10の暗号化コード埋め込み処理においてメモリアクセス命令が変換される。具体的には、ステップ916~917にて中間コードにメモリアクセス命令の部分にスクリプトが埋め込まれる。図11には、そのメモリアクセス命令が書き込み命令であった場合の処理の変換の様子が示されている。
 図11の上段には、変換前の処理1001が示されている。変換前の処理1001では、メモリにデータを書き込む書き込み命令(ストア命令)は、データを書き込む先のアドレスptxt_addr 1002と、書き込むデータの値を保持しているレジスタR[2] 513とを引数に取り、レジスタR[2] 513上の値をメモリ上のメモリアドレスptxt_addrの位置に書き込む(ステップ1003)。
 このレジスタR[2] 513上にあるデータが暗号化対象データ501となる。
 変換後の処理1011では、暗号化処理のために確保したレジスタR[k] 514に定数502をセットする。次に、レジスタR[2] 513とレジスタR[k] 514とを結合した値を平文ptxt 505とし、鍵412を用いて暗号文ctxt 431を生成する(ステップ1012)。暗号文ctxt 431を生成する手順は図5に示した通りである。ここで生成される暗号文ctxt 431のサイズは2ワードである。
 また、それとは独立して、変換前の処理1001におけるデータを書き込むアドレスptxt_addr 1002から、変換後の処理1011において、そのデータに対応する暗号文を書き込むアドレスctxt_addr 1014を算出する(ステップ1013)。最後に、2ワードの暗号文ctxt 431を、メモリ上のアドレスctxt_addr 1014の位置に書き込む(ステップ1015)。
 なお、ここでは、図5の例に合わせて、暗号化対象データ501がレジスタR[2] 513に格納されている例を示したが、これに限定されることはない。実際には、RAM暗号化処理で用いるためにグローバル変数で定義されたレジスタ以外のすべてのレジスタ上のデータが暗号化対象データとなりうる。
 図12は、RAM暗号化処理を加えることにより読み出し命令がどのように変換されるかを示す概念図である。図12には、メモリアクセス命令が読み出し命令であった場合の処理の変換の様子が示されている。
 図12の上段には、変換前の処理1101が示されている。変換前の処理1101では、メモリからデータを読み出す命令(ロード命令)は、データを読み出すアドレスptxt_addr 1102に示されるメモリ上の位置から、そこに書き込まれているデータptxt 505を読み出して、レジスタR[2] 513に格納する(ステップ1103)。
 これに対して、変換後の処理1111では、まず、変換前の処理1101においてデータを読み出すアドレスptxt_addr 1102から、変換後の処理1111において暗号文を読み出すアドレスctxt_addr 1114を算出する(ステップ1113)。次に、メモリ上のアドレスctxt_addr 1114の位置から、2ワード分のデータを読み出して、各ワードをレジスタR[2] 513とレジスタR[k] 514とにそれぞれ格納する(ステップ1115)。このレジスタR[2] 513とレジスタR[k] 514に格納された2ワードのデータを暗号文ctxt 431とする。この暗号文ctxt 431に対して、鍵412を用いて復号処理を行う(ステップ1116)。復号処理の結果として、レジスタR[2] 513上には、変換前の処理1101において、メモリから読み出されてレジスタR[2] 513に格納されるデータptxt 505が生成される。
 なお、本実施形態では、一例としてレジスタのワード長は32ビットである。また、暗号化に用いるブロック暗号のブロック長は2ワードであるとしている。しかし、実施の態様がこれらに限定されることはない。例えば、ブロック暗号として、AES(Advanced Encryption Standard)を使う場合には、ブロック長が128ビットになる。この場合、定数502を複数ワードとしても良い。あるいは、2~4ワードの平文のデータをまとめて暗号化して1つの暗号文にしても良い。アプリケーションソフトウェアが連続的にメモリへアクセスするような処理を含む場合、複数ワードの平文のデータをまとめて暗号化することにより、暗号化の演算の回数を削減し、また暗号文を保持するために必要とされるメモリの領域を削減することができる。1ワードが64ビットの場合も同様である。
 また、本実施形態では、変換後の処理1111の実行中に、ステップ1113で、暗号文を読み出すアドレスctxt_addr 1114を算出しているが、これに限定されることはない。変換前の処理1101においてデータを読み出すアドレスptxt_addr 1102が即値で与えられている場合には、暗号化コード埋め込み処理において、暗号文を読み出すアドレスctxt_addr 1114を算出し、予め中間コードにそのアドレスを書き込むことにしてもよい。それにより、変換後の処理1111におけるアドレスctxt_addr 1114を算出する処理を省略し、アドレスの算出によるオーバーヘッドが削減されアプリの処理を高速化することができる。図11で説明した書き込み処理についても、同様の方法でアドレスの算出処理1013を省略することができる。
 また、本実施形態における、平文のアドレスptxt_addrから、その平文に対応する暗号文のアドレスctxt_addrを算出する方法は特に限定されない。平文のアドレスと暗号文のアドレスとの関係が定まっていれば、その関係を基に計算することができる。
 一例として、プロセス401が使用するデータ領域が連続領域である場合を想定し、平文のptxt_addrから、暗号文のアドレスctxt_addrを算出することとする。例えば、プロセス401が使用するデータ領域の先頭アドレスをptxt_bpとし、暗号文を書き込む領域の先頭アドレスをctxt_bpとする。また、暗号文のデータサイズは平文(暗号化対象データ)のデータサイズの2倍であるとする。その場合に以下の式(1)により暗号文のアドレスctxt_addrを算出することができる。
ctxt_addr=ctxt_bp+(ptxt_addr-ptxt_bp)×2 …(1)
 なお、式(1)の「2」は、本実施形態における、暗号文のデータサイズの平文(暗号化対象データ)のデータサイズに対する比である。この比が変われば式(1)における「2」の部分がその比の値に変わる。
 他の例として、逆に、プロセス401が使用するデータ領域が細切れのブロックになっている場合には、暗号文を{word ptxt_addr、word ctxt[2]}のように、元のアドレスを保持する構造体で定義し、ptxt_addrを検索キーとして検索する方法を用いてもよい。
 また、一般的なアプリケーションプログラムは、バイト変数とワード変数が混在している場合が多い。暗号化対象データがバイト変数の場合、復号読み出し処理において、メモリ上の暗号文の位置として、ワード単位のアドレスctxt_addrを算出し、そのアドレスから読み出される暗号文を平文に復号し、得られた平文の特定のバイト位置ptxt_posから、暗号化対象データを取得する必要がある。1ワードが32ビットすなわち4バイトであるとすると、以下の式(2)により、バイト位置ptxt_posを算出することができる。「%」は、剰余演算による余りを算出する剰余演算子である。
ptxt_pos=ptxt_addr%4 …(2)
 なお、式(2)における「4」は、本実施形態における、1ワードのバイト数である。この値が変われば、式(2)における「4」の部分がその値に変わる。
 以上説明した本実施形態には以下に示す事項が含まれる。ただし、本実施形態に示されている事項が以下の事項に限定されることはない。
 (事項1)
 プロセッサとメモリを備える情報処理装置で実行されるプログラムのソースコードが記述されたソースファイルから、マシン語の実行ファイルを生成する実行ファイル生成装置であって、ソースファイル内の変数を前記プロセッサのレジスタまたは前記メモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、中間コードから実行ファイルを生成する第2コード変換部と、前記第1コード変換部の前段において、第1レジスタを予約するコードを前記ソースファイルに追加する第1コード埋め込み部と、前記第1コード変換部の後段で前記第2コード変換部の前段において、前記第1レジスタを予約するコードが追加されたソースファイルから前記第1コード変換部により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、前記書き込み処理を、前記第1レジスタを用いて前記データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、前記中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、前記読み出し処理を、前記第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する第2コード埋め込み部と、を有している。これにより、プログラムの変数をレジスタあるいはメモリへ割り付ける前後に分けてプログラムに修正を加えてメモリ上のデータを暗号化するので、メインメモリのデータ保護を容易に実現することができる。
 (事項2)
 事項1において、前記第1コード埋め込み部は、前記ソースファイルに、秘密鍵を生成して前記第1レジスタに設定する鍵生成処理と、前記第1レジスタを初期化して前記秘密鍵を消去する鍵廃棄処理とを追加し、前記第2コード埋め込み部は、前記暗号化書き込みおよび前記復号読み出し処理において、前記第1レジスタ上の前記秘密鍵を用いる。これにより、プログラムの中で秘密鍵を生成し、秘密鍵を利用してメモリ上のデータの暗号化および復号を行い、秘密鍵を消去するので、秘匿性の高い暗号化を実現できる。
 (事項3)
 事項1において、前記第1コード埋め込み部は、前記ソースファイルの記述から、利用されるメモリ領域の大きさを知得し、該メモリ領域の大きさと、暗号化によるデータの大きさの変化の割合と、に基づいて、暗号化されたデータの保持に要するメモリ領域の大きさを算出し、前記ソースファイルに、該大きさのメモリ領域を確保する処理を追加する。これにより、暗号化されたデータを保持するために要するメモリ領域を予め確保するので、暗号化によりデータ量が増大する場合にもデータの保持が可能である。
 (事項4)
 事項1において、前記第2コード埋め込み部は、第2レジスタ上のデータを暗号化してメモリに書き込むメモリデータ暗号化プログラムを予め用意しており、前記中間コード内に所定の対象レジスタのデータをメモリに書き込む書き込み処理を検出すると、前記書き込み処理の部分の代わりに、前記第2レジスタを前記対象レジスタで置換した前記メモリデータ暗号化プログラムを埋め込む。これにより、メモリデータ暗号化プログラムを予め用意しておいてそれを中間コードに埋め込むという方法でプログラムを容易に変更することができる。
 (事項5)
 事項1において、前記第2コード埋め込み部は、前記メモリから第3レジスタ上にデータを読み出し、前記第1レジスタに保持された秘密鍵を用いて復号処理を行うメモリデータ復号プログラムを予め用意しており、前記中間コード内にメモリから読み出したデータを所定の対象レジスタに格納する読み出し処理を検出すると、前記読み出し処理の部分の代わりに、前記第3レジスタを前記対象レジスタで置換した前記メモリデータ復号プログラムを埋め込む。これにより、メモリデータ復号プログラムを予め用意しておいてそれを中間コードに埋め込むという方法でプログラムを容易に変更することができる。
 (事項6)
 事項1において、前記第2コード埋め込み部は、前記書き込み処理または前記読み出し処理にデータの格納先として用いれらているメモリの第1アドレスを取得し、該アドレスに基づいて前記暗号化書き込み処理または前記復号読み出し処理に前記データに対応する暗号文の格納先として用いるメモリの第2アドレスを算出する。これにより、データのアドレスに対応付けて暗号文を格納するアドレスを特定して暗号化および復号の処理をプログラムに埋め込むことができる。
 (事項7)
 事項6において、前記第2コード埋め込み部は、前記書き込み処理を前記暗号化書き込み処理に置換するとき、および、前記読み出し処理を前記復号読み出し処理に置換するとき、前記第1コード変換部から出力された前記中間コードから、暗号化前のデータに割り当てられたデータ領域の先頭アドレスptxt_bpと、暗号化後のデータに割り当てられたデータ領域の先頭アドレスctxt_bpを検出し、前記第1アドレスをptxt_addrとし、前記第2アドレスをctxt_addrとし、前記第1アドレスptxt_addrから、ctxt_addr=ctxt_bp+(ptxt_addr-ptxt_bp)×n(nは暗号化前のデータに対する暗号化後のデータのサイズ比)という式を用いて、前記第2アドレスctxt_addrを算出する。これにより、暗号化前後のデーサイズの比に基づいて、データのアドレスに対応する暗号文を格納するアドレスを特定して暗号化および復号の処理をプログラムに埋め込むことができる。
 (事項8)
 事項7において、前記第2コード埋め込み部は、前記読み出し処理を前記復号読み出し処理に置換するとき、前記読み出し処理で読み出す変数がバイト変数であれば、前記第2アドレスから読み出したデータを復号したワードデータptxtのうち、ptxt_pos=ptxt_addr%m(mはバイトに対するワードのサイズ比)という式を用いて特定したバイト位置にあるデータを取得する。これにより、例えばバイトの変数をワード単位で暗号化するような場合に、復号されたワードにおける対象のデータの位置を特定することができる。
 (事項9)
 事項1において、前記第1コード埋め込み部は、前記第1レジスタをグローバル変数として宣言するコードを前記ソースファイルに追加する。これにより、メモリ上のデータを暗号化する処理にグローバル変数を用いるので、ある関数が他の関数を呼び出すような処理がある場合に、関数呼び出しにより変数を保持するレジスタが初期化されず、呼び出す側の関数と呼び出される側の関数がレジスタ上の値を容易に共有することができる。

Claims (11)

  1.  プロセッサとメモリを備える情報処理装置で実行されるプログラムのソースコードが記述されたソースファイルから、マシン語の実行ファイルを生成する実行ファイル生成装置であって、
     ソースファイル内の変数を前記プロセッサのレジスタまたは前記メモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、
     中間コードから実行ファイルを生成する第2コード変換部と、
     前記第1コード変換部の前段において、第1レジスタを予約するコードを前記ソースファイルに追加する第1コード埋め込み部と、
     前記第1コード変換部の後段で前記第2コード変換部の前段において、前記第1レジスタを予約するコードが追加されたソースファイルから前記第1コード変換部により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、前記書き込み処理を、前記第1レジスタを用いて前記データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、前記中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、前記読み出し処理を、前記第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する第2コード埋め込み部と、を有する実行ファイル生成装置。
  2.  前記第1コード埋め込み部は、前記ソースファイルに、秘密鍵を生成して前記第1レジスタに設定する鍵生成処理と、前記第1レジスタを初期化して前記秘密鍵を消去する鍵廃棄処理とを追加し、
     前記第2コード埋め込み部は、前記暗号化書き込みおよび前記復号読み出し処理において、前記第1レジスタ上の前記秘密鍵を用いる、請求項1に記載の実行ファイル生成装置。
  3.  前記第1コード埋め込み部は、前記ソースファイルの記述から、利用されるメモリ領域の大きさを知得し、該メモリ領域の大きさと、暗号化によるデータの大きさの変化の割合と、に基づいて、暗号化されたデータの保持に要するメモリ領域の大きさを算出し、前記ソースファイルに、該大きさのメモリ領域を確保する処理を追加する、請求項1に記載の実行ファイル生成装置。
  4.  前記第2コード埋め込み部は、第2レジスタ上のデータを暗号化してメモリに書き込むメモリデータ暗号化プログラムを予め用意しており、前記中間コード内に所定の対象レジスタのデータをメモリに書き込む書き込み処理を検出すると、前記書き込み処理の部分の代わりに、前記第2レジスタを前記対象レジスタで置換した前記メモリデータ暗号化プログラムを埋め込む、請求項1に記載の実行ファイル生成装置。
  5.  前記第2コード埋め込み部は、前記メモリから第3レジスタ上にデータを読み出し、前記第1レジスタに保持された秘密鍵を用いて復号処理を行うメモリデータ復号プログラムを予め用意しており、前記中間コード内にメモリから読み出したデータを所定の対象レジスタに格納する読み出し処理を検出すると、前記読み出し処理の部分の代わりに、前記第3レジスタを前記対象レジスタで置換した前記メモリデータ復号プログラムを埋め込む、請求項1に記載の実行ファイル生成装置。
  6.  前記第2コード埋め込み部は、前記書き込み処理または前記読み出し処理にデータの格納先として用いれらているメモリの第1アドレスを取得し、該アドレスに基づいて前記暗号化書き込み処理または前記復号読み出し処理に前記データに対応する暗号文の格納先として用いるメモリの第2アドレスを算出する、請求項1に記載の実行ファイル生成装置。
  7.  前記第2コード埋め込み部は、前記書き込み処理を前記暗号化書き込み処理に置換するとき、および、前記読み出し処理を前記復号読み出し処理に置換するとき、前記第1コード変換部から出力された前記中間コードから、暗号化前のデータに割り当てられたデータ領域の先頭アドレスptxt_bpと、暗号化後のデータに割り当てられたデータ領域の先頭アドレスctxt_bpを検出し、前記第1アドレスをptxt_addrとし、前記第2アドレスをctxt_addrとし、前記第1アドレスptxt_addrから、ctxt_addr=ctxt_bp+(ptxt_addr-ptxt_bp)×n(nは暗号化前のデータに対する暗号化後のデータのサイズ比)という式を用いて、前記第2アドレスctxt_addrを算出する、請求項6に記載の実行ファイル生成装置。
  8.  前記第2コード埋め込み部は、前記読み出し処理を前記復号読み出し処理に置換するとき、前記読み出し処理で読み出す変数がバイト変数であれば、前記第2アドレスから読み出したデータを復号したワードデータptxtのうち、ptxt_pos=ptxt_addr%m(mはバイトに対するワードのサイズ比)という式を用いて特定したバイト位置にあるデータを取得する、請求項7に記載の実行ファイル生成装置。
  9.  前記第1コード埋め込み部は、前記第1レジスタをグローバル変数として宣言するコードを前記ソースファイルに追加する、請求項1に記載の実行ファイル生成装置。
  10.  プロセッサとメモリを備える情報処理装置で実行されるプログラムのソースコードが記述されたソースファイルから、マシン語の実行ファイルを生成するための実行ファイル生成方法であって、
     ソースファイル内の変数を前記プロセッサのレジスタまたは前記メモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、中間コードから実行ファイルを生成する第2コード変換部と、を備えるコンピュータが、
     前記第1コード変換部の前段において、第1レジスタを予約するコードを前記ソースファイルに追加し、
     前記第1コード変換部の後段で前記第2コード変換部の前段において、前記第1レジスタを予約するコードが追加されたソースファイルから前記第1コード変換部により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、前記書き込み処理を、前記第1レジスタを用いて前記データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、前記中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、前記読み出し処理を、前記第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する、実行ファイル生成方法。
  11.  プロセッサとメモリを備える情報処理装置で実行されるプログラムのソースコードが記述されたソースファイルから、マシン語の実行ファイルを生成することを、ソースファイル内の変数を前記プロセッサのレジスタまたは前記メモリに割り付けて、割り付け結果を含む中間コードを生成する第1コード変換部と、中間コードから実行ファイルを生成する第2コード変換部と、を備えるコンピュータに実行させるための実行ファイル生成プログラムが記録された非一時的記憶媒体であって、
     前記第1コード変換部の前段において、第1レジスタを予約するコードを前記ソースファイルに追加し、
     前記第1コード変換部の後段で前記第2コード変換部の前段において、前記第1レジスタを予約するコードが追加されたソースファイルから前記第1コード変換部により生成された中間コードにおける、データをメモリへ書き込む書き込み処理を検出し、前記書き込み処理を、前記第1レジスタを用いて前記データを暗号化してメモリに書き込む暗号化書き込む処理に置換し、前記中間コードにおける、メモリからデータを読み出す読み出し処理を検出し、前記読み出し処理を、前記第1レジスタを用いてメモリから暗号化されたデータを読み出して復号する復号読み出し処理に置換する、ことを前記コンピュータに実行させる実行ファイル生成プログラムが記録された非一時的記憶媒体。
PCT/JP2020/044409 2019-12-10 2020-11-30 実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体 WO2021117524A1 (ja)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2019-222883 2019-12-10
JP2019222883A JP2021092951A (ja) 2019-12-10 2019-12-10 実行ファイル生成装置、方法、およびプログラム

Publications (1)

Publication Number Publication Date
WO2021117524A1 true WO2021117524A1 (ja) 2021-06-17

Family

ID=76312472

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/044409 WO2021117524A1 (ja) 2019-12-10 2020-11-30 実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体

Country Status (2)

Country Link
JP (1) JP2021092951A (ja)
WO (1) WO2021117524A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009009537A (ja) * 2006-09-11 2009-01-15 Renesas Technology Corp プログラム作成方法及び情報処理装置ならびにマイコン
US20170140148A1 (en) * 2015-11-12 2017-05-18 Samsung Electronics Co., Ltd. Method and apparatus for protecting kernel control-flow integrity using static binary instrumentation
JP2019074913A (ja) * 2017-10-16 2019-05-16 株式会社日立製作所 情報処理装置および情報処理装置のデータ処理方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009009537A (ja) * 2006-09-11 2009-01-15 Renesas Technology Corp プログラム作成方法及び情報処理装置ならびにマイコン
US20170140148A1 (en) * 2015-11-12 2017-05-18 Samsung Electronics Co., Ltd. Method and apparatus for protecting kernel control-flow integrity using static binary instrumentation
JP2019074913A (ja) * 2017-10-16 2019-05-16 株式会社日立製作所 情報処理装置および情報処理装置のデータ処理方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WATANABE, DAI ET AL.: "A prototype of RAM embedding encryption", PREPRINTS OF THE 2020 SYMPOSIUM ON CRYPTOGRAPHY AND INFORMATION SECURITY, 21 January 2020 (2020-01-21), pages 1 - 7 *

Also Published As

Publication number Publication date
JP2021092951A (ja) 2021-06-17

Similar Documents

Publication Publication Date Title
US10853270B2 (en) Cryptographic pointer address encoding
US10878083B2 (en) Mobile device having trusted execution environment
KR101471589B1 (ko) 공통중간언어 기반 프로그램을 위한 보안 제공 방법
US11263311B2 (en) Securing virtual-machine software applications
CN110637301B (zh) 减少虚拟机中敏感数据的泄密
US20160180065A1 (en) Apparatus for tamper protection of application code and method thereof
CN109784007B (zh) 一种字节码加密的方法、字节码解密的方法及终端
CN104298932A (zh) 一种so文件的调用方法及装置
CN101957903A (zh) 一种保护类文件的方法和装置
US20180067777A1 (en) Application protection method, server, and terminal
US10867017B2 (en) Apparatus and method of providing security and apparatus and method of executing security for common intermediate language
CN111159658B (zh) 字节码处理方法、系统、装置、计算机设备和存储介质
CN104200137A (zh) 一种保护java程序自身安全的方法
JP6899308B2 (ja) 情報処理装置および情報処理装置のデータ処理方法
WO2021117524A1 (ja) 実行ファイル生成装置、方法、およびプログラムが記録された非一時的記憶媒体
Kim et al. CAFE: A virtualization-based approach to protecting sensitive cloud application logic confidentiality
DONG et al. Sesoa: Security enhancement system with online authentication for android apk
WO2020226054A1 (ja) 情報処理方法、情報処理装置及び記憶媒体
JP6297149B2 (ja) モバイル機器及び該モバイル機器の動作方法
Deyannis et al. Andromeda: Enabling secure enclaves for the Android ecosystem
CN114297589A (zh) 应用程序的资源保护方法、资源读取方法及装置
JP2021051199A (ja) 情報処理装置

Legal Events

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

Ref document number: 20898521

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20898521

Country of ref document: EP

Kind code of ref document: A1