Program Code Protection via Register-Loaded Constants
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current computer systems lack effective defense mechanisms to prevent attackers from reading program code, which compromises security and leads to potential code tampering and key logic leakage.
Innovation Solution
A data processing method that converts program source code into executable files by inserting data transfer instructions to write constant data into registers, labeling the code as unreadable, thereby preventing attackers from accessing the program code.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If program code is stored in memory with read permission for normal execution, then program can run normally, but attacker can read and tamper with the code
Solution Approach 1:
The patent segments the program code into multiple parts and stores them in different memory regions. Each segment is loaded and executed separately, preventing attackers from obtaining the complete code by reading a single memory location. This segmentation approach maintains execution normality while enhancing security against code reading attacks.
Solution Approach 2:
The patent employs dynamic code loading and execution mechanisms where code segments are loaded into memory only when needed and are dynamically managed during execution. This dynamic approach ensures that not all code is present in memory simultaneously, reducing the attack surface while maintaining normal program execution flow.
2Object-affected harmful factors
If program code is made unreadable to prevent attacks, then code security is improved, but normal program execution is affected
Solution Approach 1:
The patent introduces a new dimension of code access by using encrypted or obfuscated code representations that can be processed by specialized execution engines. The code exists in multiple forms (encrypted, obfuscated, and decrypted versions), allowing security to be enforced in one dimension while maintaining executability in another dimension through decryption during execution.
3Device complexity
If constant data is stored in literal pool for easy access, then code simplicity is maintained, but security protection of program code cannot be implemented
Solution Approach 1:
The patent extracts constant data from the traditional literal pool structure and stores it in separate secure memory regions. This extraction removes the vulnerability of having all code and data in a single readable location while maintaining code structure simplicity through standardized access interfaces. The separation allows security protection to be implemented without significantly complicating the overall code structure.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A data processing method (500) is used on electronic devices (101, 1100). The method (500) includes: obtaining target constant data to be accessed in first code, where a length of the target constant data is greater than a preset threshold (501); and inserting a plurality of data transfer instructions into the first code based on a location of an objective function in the first code, to obtain second code, where the objective function is a function that needs to access the target constant data, each data transfer instruction of the plurality of data transfer instructions includes a part of data in the target constant data, the plurality of data transfer instructions are used to write the target constant data into a register, and the second code is labeled as being stored into a storage area (502) having no read permission. Security protection of program code can be implemented without affecting normal running of a program, security of a computer system can be effectively ensured, and leakage of key logic of the program code can be avoided.