# US 2020/0004934 A1 · Method to secure a software code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2020/0004934 A1
- Document ID: US20200004934A1
- Status: Published application
- Kind: A1
- Application number: 16/481,377
- Filed: 2018-01-25
- Published: 2020-01-02
- Earliest claimed: 2017-01-26
- Assignees: Thales Dis France SAS; SFNT Germany GmbH
- Applicants: Thales Dis France SA; SFNT Germany GmbH
- Inventors: Eric GARREAU; Sébastien VOLPE; Peter GARBA
- Web page: https://patentgrep.com/patent/US20200004934A1

## CPC

- G06F 21/125: {by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code}
- G06F 21/14: against software analysis or reverse engineering, e.g. by obfuscation
- G06F 21/1062: {Editing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present invention relates to a method of securing a compiled software code (SC) comprising computer code instructions organized in a plurality of basic blocks, said method generating a secure software code (SSC) and comprising the steps of: •determining (S1) by a processor a portion of the software code to be protected, •inserting (S2) by the processor in a selected basic block of the software code a first sequence of instructions which when executed at runtime: computes an integrity check value on said portion of the software code to be protected and computes an index value based on said computed integrity check value, •inserting (S3) by the processor in the selected basic block of the software code an indexed array of memory addresses in which the address, when executing the secure software code, of a following basic block to be executed after the selected basic block is indexed by said index value, •inserting (S4) by the processor at the end of the selected basic block of the software code a jump instruction to the address indexed in the array by said index value computed at runtime.

## Claims

### Claim 1

A method of securing a compiled software code (SC) comprising computer code instructions organized in a plurality of basic blocks, said method generating a secure software code (SSC) and comprising the steps of:
determining (S1) by a processor (21) a portion of the software code to be protected,
inserting (S2) by the processor in a selected basic block of the software code a first sequence of instructions which when executed at runtime:
computes (E1) an integrity check value on said portion of the software code to be protected,
computes (E2) an index value based on said computed integrity check value,
inserting (S3) by the processor in the selected basic block of the software code an indexed array of memory addresses in which the address, when executing the secure software code, of a following basic block to be executed after the selected basic block is indexed by said index value,
inserting (S4) by the processor at the end of the selected basic block of the software code a jump instruction to the address indexed in the array by said index value computed at runtime.

### Claim 2 (depends on 1)

The method of claim 1 wherein the portion of the software code to be protected is determined at random.

### Claim 3 (depends on 1)

The method of claim 1 wherein the integrity check value is computed on said portion of the software code to be protected and on at least a part of the selected basic block.

### Claim 4 (depends on 1)

The method of claim 1 wherein the first sequence of instructions comprises a second sequence of instructions which, when executed at runtime, computes said integrity check value by performing one or more operations among a checksum, a mask, a hash function, a binary shifting and arithmetic operations.

### Claim 5 (depends on 1)

The method of claim 1 wherein said second sequence of instructions is selected at random in a set of predetermined sequences of instructions computing integrity check functions.

### Claim 6 (depends on 1)

The method of claim 1 wherein the first sequence of instructions comprises a third sequence of instructions which, when executed at runtime, applies a transformation function to said computed integrity check value to compute said index value, said transformation function comprising one or more operations among a checksum, a mask, a hash function, a binary shifting and arithmetic operations.

### Claim 7 (depends on 6)

The method of claim 6 wherein the transformation function is selected at random in a set of predetermined transformation functions.

### Claim 8 (depends on 1)

The method of claim 1 wherein addresses in the array are addresses of basic blocks of the secure software code when the secure software code is executed.

### Claim 9 (depends on 1)

The method of claim 1 wherein said integrity check value is computed on instructions of the secure software code between a start address and a stop address,
and comprising a fifth securing step (S5) performed when or after compiling and linking the secure software code and comprising:
determining begin and end addresses in the software code of the beginning and end of a portion of the software code on which the integrity check value is to be computed,
computing said integrity check value and said index value based on said computed integrity check value,
and comprising a sixth securing step (S6) performed when or after compiling and linking the secure software code and comprising:
setting said start and stop addresses to said begin and end addresses determined in the fifth securing step (S5),
setting in the array the address of the following basic block at said index value computed in the fifth securing step.

### Claim 10 (depends on 1)

The method of claim 1 wherein the array and the first sequence of instructions are inserted at a random location in the selected basic block of the software code.

### Claim 11 (depends on 1)

The method of claim 1 wherein the first sequence of instructions is inserted at the end of the selected basic block before the inserted jump instruction.

### Claim 12

A non-transitory machine-readable storage medium encoded with instructions of secure software code for execution by a processor wherein:
said secure software code is a modified version of a software code comprising computer code instructions organized in a plurality of basic blocks,
a selected basic block of the secure software code comprises an indexed array of memory addresses comprising the address, when executing the secure software code, of a following basic block to be executed after the selected basic block,
said non-transitory machine-readable storage medium being also encoded with a first sequence of instructions inserted in the selected basic block of the secure software code which when executed at runtime:
computes (E1) an integrity check value on a portion of the software code to be protected,
computes (E2) an index value indexing in the array the address of the following basic block based on said computed integrity check value,
and the selected basic block of the secure software code also comprising at its end a jump instruction to the address of the array indexed by said index value computed at runtime.

### Claim 13 (depends on 12)

The non-transitory machine-readable storage medium of claim 12 wherein the integrity check value is computed on the portion of the software code to be protected and on at least a part of the selected basic block.

### Claim 14

A method of executing by a processor (31) instructions of a selected basic block of a secure software code, wherein:
said secure software code is a modified version of a software code comprising computer code instructions organized in a plurality of basic blocks,
the selected basic block of the secure software code comprises an indexed array of memory addresses comprising the address, when executing the secure software code, of a following basic block to be executed after the selected basic block,
said method comprising the steps of:
computing (E1) an integrity check value on a portion of the software code to be protected,
computing (E2) an index value indexing in the array the address of the following basic block based on said computed integrity check value,
executing (E3) at the end of the selected basic block a jump instruction to the address indexed in the array by said computed index value.

### Claim 15 (depends on 14)

The method of claim 14 wherein the integrity check value is computed on the portion of the software code to be protected and on at least a part of the selected basic block.
