blob: 1f4ecc6290d6f15226aa638b3c748bf04160346e [file] [log] [blame]
Mark Horvath008ecb72020-09-10 12:35:05 +02001##############################################
2Secure Enclave solution for Trusted Firmware-M
3##############################################
4
5:Author: Mark Horvath
6:Organization: Arm Limited
7:Contact: Mark Horvath <mark.horvath@arm.com>
Mark Horvath008ecb72020-09-10 12:35:05 +02008
9********
10Abstract
11********
12
13This document summarizes the design goals and one possible implementation
14of the TF-M Secure Enclave solution.
15
16************
17Introduction
18************
19
20If a separate subsystem can provide the PSA Root of Trust (RoT) in a system
21then an additional physical separation exists between the most trusted and
22other domains. In such a system at least two subsystems are present, a Secure
23Enclave (SE) whose only task is to provide PSA RoT and an application core
24where any other application specific functionality can be placed. The latter
25core (or cores) are referred as *Host* in this document.
26
27The current design assumes that Host is a v8-m core with security extension.
28
29************
30Requirements
31************
32
33- Secure Enclave shall implement secure boot-flow (start-up first at reset and
34 validate its own and the Host image or images before release Host from reset)
35- Secure Enclave shall provide the PSA RoT services
36- Host shall provide not just the non-secure context but the Application RoT as
37 well
38- It shall be transparent to the (secure or non-secure) applications running on
39 host whether the RoT services are provided by the same subsystem or by a
40 Secure Enclave.
41
42.. Note::
43
44 In comparison, in a Dual Core system the whole secure context is placed on a
45 separate subsystem, while a Secure Enclave only implements the PSA RoT
46 security domain.
47
48***************
49Proposed design
50***************
51
52As the clients and the services are running on different cores only the IPC
53model can be used on both Secure Enclave and Host.
54
55Secure Enclave
56==============
57
58To provide the required functionality it is enough to run the current PSA RoT
59secure partitions on the Secure Enclave, so no need for non-secure context
60there. (It is enough if the Secure Enclave's architecture is v6-m, v7-m or v8-m
61without the security extension.)
62
63Secure Enclave can treat all clients running on Host as non-secure (even the
64services running on Host's secure side). This means that fom Secure Enclave's
65point of view all Host images, Host's RAM and shared memory between Host and
66Secure Enclave if present are treated as non-secure. (Just like in the Dual CPU
67solution.) But the clients need to be distinguished, otherwise some
68functionalities are not working, for example:
69- Protected Storage partition shall run on Host, but the PS area is handled by
70Internal Trusted Storage partition (running on Secure Enclave). ITS partition
71decides whether it should work on PS or ITS assets by checking the client ID.
72- If a secure partition on host creates a crypto key, no other client shall be
73able to destroy it.
74
75Communication
76=============
77
78To communicate between Host and Secure Enclave, the existing mailbox solution
79can be reused as it is.
80
81Host
82====
83
84On Host the current TF-M software architecture can be placed to provide
85non-secure context and Application RoT domain.
86
87One solution to forward a PSA RoT IPC message from a client running on Host to
88the Secure Enclave is to add a proxy partition to the secure side. This PSA
89Proxy partition can provide all the RoT services to the system by forwarding
90the messages over the mailbox solution.
91
92If the new partition's manifest contains all the PSA RoT service IDs SPM will
93deliver all IPC messages there. Then the messages just must be blindly copied
94into the mailbox. PSA proxy can use the non-secure interface of the mailbox,
95but it is placed on the secure side of Host. (From SE's point of view this is
96in fact the non-secure side of the mailbox as whole Host is treated as
97non-secure.)
98
99It is important to verify IOVECs before forwarding them to SE, otherwise a
100malicous actor could use SE to access a memory area otherwise unaccessable. If
101PSA proxy uses the current secure partition interface then this is ensured by
102Host's SPM.
103
104SE treats all clients of Host as non-secure, so all PSA messages shall have a
105negative client ID when pushed into SE's SPM. This is given for the clients on
106the non-secure side of Host, but the secure side clients of Host have positive
107client IDs. The straightforward solution is to translate the positive client
108IDs into a predefined negative range in PSA proxy, and push the translated
109values into the mailbox. Of course this range shall be reserved for this use
110only and no clients on non-secure side of Host shall have client ID from this
111range.
112
113To avoid blocking Host when a message is sent PSA Proxy shall handle the
114service requests in non-blocking mode. And to maximize bandwidth PSA Proxy
115shall be able to push new messages into the mailbox, while others still not
116answered. To achieve these the mailbox interrupts needs to be handled in the
117PSA Proxy partition.
118
119--------------
120
121*Copyright (c) 2020, Arm Limited. All rights reserved.*