Program Code Protection via Register-Loaded Constants

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improveprogram execution normalityVSAvoidcode reading and tampering
Core Design Contradiction:
ReliabilityVSObject-affected harmful factors

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.

Inventive Principle:
Principle #1Segmentation

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.

Inventive Principle:
Principle #15Dynamics

2Object-affected harmful factors

If program code is made unreadable to prevent attacks, then code security is improved, but normal program execution is affected

Engineering Contradiction:
Improvecode reading preventionVSAvoidprogram execution
Core Design Contradiction:
Object-affected harmful factorsVSEase of operation

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.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

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

Engineering Contradiction:
Improvecode structure simplicityVSAvoidcode reading vulnerability
Core Design Contradiction:
Device complexityVSObject-affected harmful factors

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.

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentEP4369222B1Data processing method and related apparatus
Publication Date: 2026.03.25 HUAWEI TECH CO LTD
  • EP4369222B1 patent drawingFigure 1
  • EP4369222B1 patent drawingFigure 2
  • EP4369222B1 patent drawingFigure 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.