The TrustZone is a security extension in the Arm Cortex series of processors that provides hardware-level isolation between secure and non-secure environments on the same system-on-a-chip (SoC). It creates a secure world for trusted code and data isolated from the non-secure world used by the main operating system and applications.
Overview of the TrustZone
The TrustZone divides system resources like memory, peripherals and processing cores into secure and non-secure domains. A context switch between the two worlds is controlled by secure monitor code running in monitor mode. This provides efficient switching while maintaining isolation.
The secure world is trusted and protects sensitive assets like cryptography keys, user credentials and payment details. It runs a trusted execution environment (TEE) with its own operating system and applications. The non-secure world runs the rich operating system and untrusted applications.
Hardware logic ensures no code executed in the non-secure world can access resources assigned to the secure world. The secure world has full access to the non-secure resources but not the other way around.
Key Components of the TrustZone
The main components that enable the TrustZone security are:
- Secure and Non-secure Modes – The processor can operate in secure or non-secure mode based on the value of the NS bit. This enables access control to resources.
- Monitor Mode – A new processor mode that handles world switching. Monitor mode runs the monitor code and configures security policies.
- Secure Monitor – Trusted firmware that implements world switching and isolation. It saves/restores state during context switches.
- TZPC – TrustZone Protection Controller configures security policies for peripherals like interrupts.
- TZASC – TrustZone Address Space Controller partitions memory into secure and non-secure regions.
Hardware Security Features
The TrustZone hardware security features include:
- Banked Registers – Separate secure and non-secure copies of registers like SP, LR, SPSR prevent leakage across worlds.
- Translation Tables – Separate memory translation tables for secure and non-secure worlds prevent non-secure access.
- Interrupt Handling – Interrupts can be configured as secure or non-secure. Secure interrupts handled in monitor mode.
- Internal Buses – Hardware controls access to on-chip peripherals and memory via internal buses.
- Secure Boot – Cryptographic checks validate bootloader integrity before loading secure world OS.
Software Components in the Secure World
The secure world software stack includes:
- Trusted OS – Real-time OS like OP-TEE provides secure environment isolated from main OS.
- Trustlets – Trusted applications that run in TEE with access to secure resources.
- Secure Monitor – Low-level firmware that handles world switches and isolation.
- Secure Bootloader – First code executed on reset that checks integrity of secure world software.
The TEE Trusted OS provides standard services like cryptographic operations, secure storage and trusted user interface. Trustlets leverage these services to implement security use cases.
How the TrustZone Provides Security
Here are some of the key ways the TrustZone provides security:
- Isolation – Hardware mechanisms isolate secure world from non-secure software including the main OS.
- Access Control – Secure world has access to all resources while non-secure access is restricted.
- Trusted Execution – Sensitive code executes in a trusted environment isolated from main OS threats.
- Secure Storage – Keys, credentials and sensitive data protected from unauthorized access.
- Trusted Peripherals – Secure world has exclusive access or protects shared peripherals like display, keyboard.
- Secure Boot – Cryptographic validation of initial bootloader before loading secure world software.
This hardware backed isolation and access control mechanisms enable building robust security use cases.
Use Cases Enabled by TrustZone
Here are some examples of security use cases enabled by the TrustZone:
- Digital Rights Management (DRM) – Media decryption keys and algorithms protected in TEE from main OS threats.
- Secure Payments – Payment credentials and transactions isolated in TEE from malware in main OS.
- Authentication – Biometric template matching and storage done in isolated secure environment.
- Secure Data – Trustlets in TEE can encrypt/decrypt sensitive data and keys without exposing them.
- Root of Trust – Chained validation of each boot stage establishes hardware backed root of trust.
- Trusted User Interface – Secure display and input channels for PIN entry, transaction confirmation etc.
Device OEMs and application developers can leverage the hardware security mechanisms to implement advanced trusted use cases.
Software Interfaces for Non-secure World
The non-secure or Rich Execution Environment (REE) running the main OS communicates with TEE running in secure world via software interfaces like:
- GlobalPlatform TEE Client API – API for applications in REE to communicate with Trusted Applications in TEE.
- ARM Trusted Firmware-A – Implements Secure Monitor mode and world switching.
- TrustZone Software Communication – API that enables coordination between Normal and Secure worlds.
These standard interfaces enable application developers to leverage TrustZone services without dealing with low-level details.
Summary
The TrustZone is a hardware security feature in Arm Cortex processors that provides isolation of secure services from main OS. It enables building robust security use cases leveraging hardware backed access control and trusted execution. The secure world runs trusted applications and stores sensitive assets isolated from non-secure domain running rich OS and apps. This security architecture enables advanced use cases like digital rights management, secure payments and authentication.