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