Secure Code Execution from External Memory via Authenticated Encryption

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Executing code from external memory introduces significant security risks due to vulnerability to attacks, as an adversary can manipulate or read the code stored in external non-volatile memory, compromising security mechanisms like secure boot.

Innovation Solution

A method using a block cipher in authenticated encryption mode to encrypt and authenticate code stored in external memory, generating authentication tags and translating addresses to ensure secure access, binding the code to the CPU and providing rollback protection.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If code is stored in external non-volatile memory for efficient execution and storage, then code execution efficiency is improved, but security is worsened because adversaries can read and write the external memory when the SoC is powered off or in low power mode

Engineering Contradiction:
Improvecode execution efficiencyVSAvoidsecurity
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies preliminary action by encrypting the code in external memory before the SoC is powered on or exits low power mode. The encryption is performed in advance during a secure provisioning phase, so that when the code is later read and executed, it is already protected. This prevents adversaries from reading or manipulating the code when the device is off, as the code remains encrypted until the final decryption step during execution.

Inventive Principle:
Principle #10Preliminary action

2Quantity of substance

If code is stored in external memory, then storage capacity is improved, but security mechanisms like secure boot are compromised because adversaries can replace the existing code with malicious code

Engineering Contradiction:
Improvestorage capacityVSAvoidsecure boot integrity
Core Design Contradiction:
Quantity of substanceVSReliability

Solution Approach 1:

The patent introduces encryption as an intermediary layer between the code and the external memory. Instead of storing plaintext code that can be directly read and replaced, the code is encrypted using a block cipher with authenticated encryption mode. This intermediary encryption layer prevents adversaries from reading or replacing the code, as any modification would be detected during authentication. The encryption acts as a mediator that protects the code while allowing it to be stored in external memory.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of manufacture

If external memory is used for code storage, then device cost is reduced, but security risks increase due to vulnerability to side channel attacks and fault attacks such as power supply glitch injection or electromagnetic fault injection

Engineering Contradiction:
Improvedevice costVSAvoidvulnerability to attacks
Core Design Contradiction:
Ease of manufactureVSObject-affected harmful factors

Solution Approach 1:

The patent converts the potential harm of using external memory (which is vulnerable to physical attacks) into a benefit by applying authenticated encryption. The encryption scheme includes authentication tags that detect any tampering or fault injection attempts. Even if adversaries attempt side channel attacks or fault injection, the authentication mechanism will detect the tampering and prevent execution of compromised code. This transforms the vulnerable external memory into a secure storage medium by using the encryption as a protective measure against the very attacks that external memory is susceptible to.

Inventive Principle:
Principle #22Blessing in disguise (Convert harm into benefit)

Data Source

PatentUS11677541B2Method and device for secure code execution from external memory
Publication Date: 2023.06.13 NXP BV
  • US11677541B2 patent drawing
  • US11677541B2 patent drawing
  • US11677541B2 patent drawing

AI summary

A method is provided for securely accessing code in an external memory. In the method, plaintext code may be stored in internal memory as sets of multiple blocks, each of the multiple blocks having N-bits. The code is encrypted and stored in the external memory. A block cipher having an authenticated encryption mode is used to convert the plaintext code to ciphertext code plus an authentication tag corresponding to each set of the multiple blocks. The external memory is formatted to store the ciphertext and the authentication tag. A translated address for the ciphertext is created from a plaintext address. During a read operation, the generated authentication tag is checked with an expected authentication tag. If the check is successful, the ciphertext code is decrypted and provided to a CPU for execution as plaintext code. In one embodiment, the CPU executes the plaintext code “in place” in the external memory.