# US 2022/0294634 A1 · Method for executing a computer program by means of an electronic apparatus

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

- Number: US 2022/0294634 A1
- Document ID: US20220294634A1
- Status: Published application
- Kind: A1
- Application number: 17/650,861
- Filed: 2022-02-14
- Published: 2022-09-15
- Earliest claimed: 2021-03-09
- Assignees: Commissariat A L'energie Atomique Et Aux Energies Alternatives
- Applicants: Commissariat à l'Energie Atomique et aux Energies Alternatives
- Inventors: Olivier Savry; Thomas Hiscock
- Web page: https://patentgrep.com/patent/US20220294634A1

## CPC

- G06F 21/54: by adding security routines or objects to programs
- H04L 9/3234: {involving additional secure or trusted devices, e.g. TPM, smartcard, USB or software token (network architectures or network communication protocols for supporting authentication of entities using an additional device in a packet data network H04L63/0853)}
- G06F 21/72: in cryptographic circuits
- H04L 9/065: {Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

A method for executing a computer program includes incorporating, into metadata of a block containing a line of code to be accessed using a pointer, a first pointer identifier associated with the line of code to be accessed, then obtaining a pointer including a first range of bits containing the address of the line of code to be accessed, and a different second range of bits containing a second pointer identifier, then verifying that the second pointer identifier contained in the obtained pointer corresponds to the first pointer identifier associated with the line of code to be accessed and contained in the metadata of the loaded block, and when the first and second pointer identifiers do not correspond, then the security module triggers signaling of an execution fault.

## Claims

### Claim 1

A method for executing a computer program with an electronic apparatus comprising a microprocessor, an unencrypted memory, an encrypted memory and a hardware security module, wherein, during the execution of the computer program, lines of code are transferred between the unencrypted memory and the encrypted memory in whole blocks of a plurality of encrypted and authenticated lines of code, said method comprising the following steps:
a) storing in the encrypted memory a block of encrypted and authenticated lines of code containing a line of code to be accessed using a pointer, said block of encrypted and authenticated lines of code containing:
a cryptogram of all of the lines of code of said block, said cryptogram having to be decrypted in its entirety to obtain a block of cleartext lines of code,
an authentication code computed from the block of cleartext lines of codes or from the cryptogram of the block of cleartext lines of code, and
metadata,
b) obtaining, with the microprocessor, a pointer containing the address at which the line of code to be accessed is stored, then
c) loading the block containing the line of code to be accessed from the encrypted memory into the microprocessor, and
d) decrypting the cryptogram contained in the loaded block to obtain the block of cleartext lines of code, and storing the obtained block of cleartext lines of code in the unencrypted memory and storing the metadata of the loaded block, and
e) verifying, with the hardware security module and using the authentication code contained in the loaded block, the integrity:
of the block of cleartext lines of code obtained from the cryptogram contained in the loaded block, or
of the cryptogram contained in the loaded block,
f) when said verification fails, inhibiting processing, by the microprocessor, of the lines of code of said loaded block and, when said verification succeeds, permitting processing, by the microprocessor, of the lines of code of said loaded block,
wherein:
step c) comprises incorporating, into the metadata of the block containing the line of code to be accessed, a first pointer identifier associated with the line of code to be accessed, said first pointer identifier alone allowing one pointer to be uniquely identified among a set containing a plurality of different pointers employed in the same execution of the computer program by the microprocessor,
step b) of obtaining the pointer comprises obtaining a pointer comprising:
a first range of bits containing the address of the line of code to be accessed, and
a different second range of bits containing a second pointer identifier, and
the method comprises a step g) of verifying, with the hardware security module, that the second pointer identifier contained in the pointer obtained in step b) corresponds to the first pointer identifier associated with the line of code to be accessed and contained in the metadata of the loaded block, and when the first and second pointer identifiers do not correspond, then the security module triggers signalling of an execution fault and, in the contrary case, the security module inhibits triggering of signalling of an execution fault and the microprocessor processes the line of code to be accessed.

### Claim 2 (depends on 1)

The method according to claim 1, wherein step d) comprises storing the first pointer identifier contained in the metadata of the loaded block in a memory solely accessible by the hardware security module.

### Claim 3 (depends on 1)

The method according to claim 1, wherein, before step a), the authentication code of the block of encrypted and authenticated lines of code to be stored is also computed from the metadata.

### Claim 4 (depends on 1)

The method according to claim 1, wherein, before step a), the method comprises:
encrypting the block of cleartext lines of code using an initialization vector and generating a new initialization vector before each encryption of the block of cleartext lines of code, and
incorporating, into the metadata of the block of encrypted and authenticated lines of code, the initialization vector used to obtain the cryptogram of said block of encrypted and authenticated lines of code, and
during the decryption of the cryptogram, the hardware security module extracts, from the metadata of the block of encrypted and authenticated lines of code, the initialization vector to be used to carry out said decryption.

### Claim 5 (depends on 4)

The method according to claim 4, wherein:
during the encryption of the block of cleartext lines of code, the cleartext lines of code are encrypted using a stream cipher initialized using the initialization vector, and
the initialization vector is stored in the block of encrypted and authenticated lines of code before the cryptogram of all of the lines of code of said block, then
during the decryption of the cryptogram, the hardware security module first extracts the initialization vector to be used to carry out said decryption then immediately starts decrypting the first line of code of the cryptogram, said line of code being received before the complete cryptogram is received.

### Claim 6 (depends on 1)

The method according to claim 1, wherein, in step a), the address at which the block of encrypted and authenticated lines of code is stored is related, by a bijective function, to an address @BDCi defined by the following relationship: @BDCi=@BDi·Tb/TBD, where:
@BDi is the address at which starts, in the address space of the computer program, the block of cleartext lines of code,
Tb is the size, in number of bytes, of the block of encrypted and authenticated lines of code,
TBD is the size, in number of bytes, of the block of cleartext lines of code.

### Claim 7 (depends on 6)

The method according to claim 6, wherein:
after step b) and before step c), the hardware security module determines the address @BDCi using the following first relationship: @BDCi=E(@Di, j/TBD)·Tb, where
E( ) is the function that returns the integer part of the number located between the parentheses, and
@Di,j is the address contained in the pointer obtained in step b),
Tb and TBD are both powers of two,
the division and multiplication of the first relationship being executed by shift registers of the hardware security module during said determining operation, then
in step c), the block containing the line of code to be accessed is loaded, from the encrypted memory, from the address related, by the bijective function, to the determined address @BDCi.

### Claim 8 (depends on 6)

The method according to claim 6, wherein:
after step b) and before step c), the hardware security module determines the address @BDCi using the following second relationship: @BDCi=E(@Di,j/TBD)·TBD+E(@Di,j/TBD)·(Tb−TBD), where
E( ) is the function that returns the integer part of the number located between the parentheses, and
@Di,j is the address contained in the pointer obtained in step b),
(Tb−TBD) and TBD are both powers of two,
each division and each multiplication of the second relationship are executed by shift registers of the hardware security module during said determining operation, and
in step c), the block containing the line of code to be accessed is loaded, from the encrypted memory, from the address related, by the bijective function, to the determined address @BBDCi.

### Claim 9 (depends on 1)

The method according to claim 1, wherein the cryptogram of all of the lines of code of the stored block of encrypted and authenticated lines of code:
may solely be decrypted in its entirety to obtain the block of cleartext line of code, and not line of code by line of code, or
may solely be decrypted in a predetermined order to obtain the block of cleartext line of code, and does not permit the lines of code to be decrypted in any order.

### Claim 10 (depends on 1)

A computer program able to be executed by a microprocessor by implementing a method according to claim 1, wherein the binary code of the computer program comprises:
a block of encrypted and authenticated lines of code containing a line of code to be accessed using a respective pointer, said block of encrypted and authenticated lines of code containing:
a cryptogram of all of the lines of code of said block, said cryptogram having to be decrypted in its entirety to obtain a block of cleartext lines of code,
an authentication code computed from the block of cleartext lines of codes or from the cryptogram of the block of cleartext lines of code, and
metadata,
a pointer containing the address at which the line of code to be accessed is stored wherein:
the metadata comprise a first pointer identifier associated with the line of code to be accessed, said first pointer identifier alone allowing one pointer to be uniquely identified among a set containing a plurality of different pointers employed in the same execution of the computer program by the microprocessor, and
the pointer comprises:
a first range of bits containing the address of the line of code to be accessed, and
a different second range of bits containing a second pointer identifier, said second pointer identifier being equal to the first pointer identifier.

### Claim 11 (depends on 1)

A hardware security module for implementing a method according to claim 1, wherein the hardware module is configured to:
a) trigger storage in the encrypted memory of a block of encrypted and authenticated lines of code containing a line of code to be accessed using a pointer, said block of encrypted and authenticated lines of code containing:
a cryptogram of all of the lines of code of said block, said cryptogram having to be decrypted in its entirety to obtain a block of cleartext lines of code,
an authentication code computed from the block of cleartext lines of codes or from the cryptogram of the block of cleartext lines of code, and
metadata,
b) receive a pointer containing the address at which the line of code to be accessed is stored, then
c) trigger loading of the block containing the line of code to be accessed from the encrypted memory into the microprocessor, and
d) decrypt the cryptogram contained in the loaded block to obtain the block of cleartext lines of code, and trigger storage of the obtained block of cleartext lines of code in the unencrypted memory and storing the metadata of the loaded block,
e) verify, using the authentication code contained in the loaded block, the integrity:
of the block of cleartext lines of code obtained from the cryptogram contained in the loaded block, or
of the cryptogram contained in the loaded block,
f) when said verification fails, inhibiting processing, by the microprocessor, of the lines of code of said loaded block and, when said verification succeeds, permitting processing, by the microprocessor, of the lines of code of said loaded block,
wherein the security module is also configured:
to incorporate, into the metadata of the block containing the line of code to be accessed, a first pointer identifier associated with the line of code to be accessed, said first pointer identifier alone allowing one pointer to be uniquely identified among a set containing a plurality of different pointers employed in the same execution of the computer program by the microprocessor,
in response to the execution of an instruction to access the line of code to be accessed using a pointer, to extract a second pointer identifier from a range of bits of said pointer, then
to verify that the second pointer identifier corresponds to the first pointer identifier associated with the line of code to be accessed and contained in the metadata of the loaded block, and if the first and second pointer identifiers do not correspond, then to trigger signalling of an execution fault and, in the contrary case, to inhibit triggering of signalling of an execution fault and to permit the microprocessor to process the line of code to be accessed.
