blob: 4bd6e8d4ba65aaffef9693b770a018bb00bf4d79 [file] [log] [blame]
Maulik Patel606ba312023-10-30 18:09:00 +00001####################################
Jamie Foxf0204f12024-02-19 14:38:01 +00002ADAC implementation for RSE platform
Maulik Patel606ba312023-10-30 18:09:00 +00003####################################
4
Jamie Foxf0204f12024-02-19 14:38:01 +00005ADAC Requirements for RSE
Maulik Patel606ba312023-10-30 18:09:00 +00006=========================
7
Jamie Foxf0204f12024-02-19 14:38:01 +00008For RSE, ADAC design and implementation must meet below requirements.
Maulik Patel606ba312023-10-30 18:09:00 +00009
Jamie Foxf0204f12024-02-19 14:38:01 +0000101. Since RSE is HES (Hardware Enforced Security) host for CCA (Confidential
11 Compute Architecture) system, ADAC functionality must be implemented by RSE.
Maulik Patel606ba312023-10-30 18:09:00 +0000122. By default, CCA HES and other trusted subsystems debug should be disabled
13 all the time.
Jamie Foxf0204f12024-02-19 14:38:01 +0000143. When in a secured (trustworthy) state, no debug should be allowed to RSE,
Maulik Patel606ba312023-10-30 18:09:00 +000015 and other components of CCA System security Domain.
164. If life cycle is not in a secured state and if a CCA component debug is
17 requested, a new debug session should be initiated.
185. Likewise at the end of debug session, all debug interfaces should be closed
19 and a system reset is required to return to the previous state.
206. Depending on current policy, the debug start and stop request may require
21 a system reset for the request to be processed in a distinct debug session.
Jamie Foxf0204f12024-02-19 14:38:01 +000022 For RSE, a system reset is required for handling debug requests for any
Maulik Patel606ba312023-10-30 18:09:00 +000023 components of CCA security domain.
247. Finally, CCA Platform Attestation token should be different if any CCA debug
25 is enabled.
26
27Implementation Constraints
28==========================
29
30PSA ADAC protocol specifies use of asymmetric key cryptography for certificate
31parsing and authentication. Ideally, authentication and application of
32permissions should be done at the same time in boot so that they cannot be
33tampered later on, but
34
35* BL1 is constrained on memory resources and
36* BL1 is immutable, so any flaw in the authentication scheme would result in
37 a permanent security vulnerability.
38
39Hence, authentication has to handled as runtime service while appropriate
40permissions can be applied in the bootloader.
41
42Design description
43==================
44
45As per the ADAC architecture, debug host must implement Secure Debug Manager
46(SDM) component while debug target requires Secure Debug Authenticator (SDA)
47as mentioned in architecture specification. Logical link is established
48among the above two components to establish secure debug connection.
49
50To meet the above requirements, ADAC protocol is integrated in TF-M as follows:
51
521. A new ADAC runtime service which calls SDA to authenticate any incoming debug
53 request from other components.
542. Above service only acknowledges any incoming debug request if the device is
55 in appropriate life cycle state. Else, it rejects any incoming debug request.
56 Here the appropriate life cycle state is defined by the platform specific
57 policy.
583. Once the service acknowledges the request, it sends the request to the
59 core protocol API for authentication. It also checks if the host has
60 appropriate access rights permissions. If it authenticates the host
61 successfully, it stores the debug state and may initiate the reset (depending
62 on platform policy).
634. On immediate reset, the bootloader (BL1_2) retrieves the stored debug state
64 and applies corresponding debug permissions.
655. It also locks the related DCU bits so that the applied permissions stays
66 the same throughout the debug session.
676. Runtime service now waits for debug end signal to end debug session. To end
68 current debug session, it stores the state again and initiates the reset
69 (depending on platform policy).
707. On reset, BL1_2 resets the permission and locks the DCU to continue
71 normal execution.
728. For debug request of any components where platform policy does not require a
73 reset, ADAC service does not initiate any reset and enables the debug
74 immediately.
75
Maulik Patel52addf52024-07-16 12:14:31 +010076************************************
77Code structure & Service Integration
78************************************
79
80The ADAC Service source and header files are located in the current directory.
81The interface for the ADAC runtime Service is located in ``interface/include``.
82The only header to be included by applications that want to use functions from
83the PSA API is ``tfm_adac_api.h``.
84
85Service interface
86=================
87The ADAC Service exposes the following interface:
88
89.. code-block:: c
90
91 /*!
92 * \brief Authenticates the requested debug service.
93 *
94 * \param[in] debug_request Request identifier for the debug zone
95 * (valid values vary based on the platform
96 * Each bit of the \p debug_request represents
97 * debug request for corresponding zone.
98 * e.g.
99 * If no bits are set => no debug request
100 * If bit0 is set => start debug for zone1
101 * If bit0 is cleared => end debug for zone1
102 * If bit1 is set => start debug for zone2
103 * If bit1 is cleared => end debug for zone2
104 * ...
105 *
106 * Enumeration of zones (zone1, zone2, etc.) is
107 * done by ``tfm_debug_zones`` (platform specific)
108 *
109 * \return Returns PSA_SUCCESS on success,
110 * otherwise error as specified in \ref psa_status_t
111 */
112 psa_status_t tfm_adac_service(uint32_t debug_request)
113
114Service source files
115====================
116- ``tfm_adac_api.c``: Implements the secure API layer to allow
117 other services in the secure domain to request functionalities
118 from the adac service using the PSA API interface.
119
120- ``adac_req_mngr.c``: Includes the initialization entry of
121 adac service and handles adac service requests in IPC model.
122
123- ``adac.c``: Implements core functionalities such as implementation
124 of APIs, handling and processing of debug request.
125
Maulik Patel606ba312023-10-30 18:09:00 +0000126Hardware abstraction layer Interface
127====================================
128
129Classification of various debug zones is platform/system specific.
Jamie Foxf0204f12024-02-19 14:38:01 +0000130For system with RSE subsystem, these are mainly classified into CCA security
Maulik Patel606ba312023-10-30 18:09:00 +0000131domain debug and Non-CCA debug zones.
132
133- ``tfm_debug_zones``: enumerates 2 CCA and 4 Non-CCA debug zones.
134
135- ``tfm_platform_system_reset()``: Request system reset to initiate or terminate
136 a debug session.
137
138- ``tfm_plat_otp_read()``: Reads the life cycle state as well as secure debug
139 key required for authentication.
140
141Bootloader Interface
142====================
143
144The ADAC runtime service requires to convey debug state information between
145runtime service and bootloader. This needs be in platform specific
146predefined persistent area as this information needs to be retained after reset.
147
Jamie Foxf0204f12024-02-19 14:38:01 +0000148For RSE platform, this functionality is provided by RESET_SYNDROME register.
Maulik Patel606ba312023-10-30 18:09:00 +00001498 bits field, SWSYN, of above register is allocated to convey debug state
150information between bootloader and runtime service
151
152- ``lcm_dcu_set_enabled()``: Apply appropriate debug zone permissions by setting
153 the DCU register values.
154
155- ``lcm_dcu_set_locked()``: Locks the DCU so permission cannot be modified
156 during that power cycle.
157
158ADAC Protocol (SDA) integration
159===============================
160
Jamie Foxf0204f12024-02-19 14:38:01 +0000161- ``tfm_to_psa_adac_rse_secure_debug()``: Initiates the connection with the
Maulik Patel606ba312023-10-30 18:09:00 +0000162 host debugger and performs secure debug authentication process.
163
164Enable Secure Debug
165===================
166
Jamie Foxf0204f12024-02-19 14:38:01 +0000167To enable ADAC on RSE, below options must be configured:
Maulik Patel606ba312023-10-30 18:09:00 +0000168
169- ``-DPLATFORM_PSA_ADAC_SECURE_DEBUG=ON``
170
171- ``-DTFM_PARTITION_ADAC=ON``
172
173--------------
174
Maulik Patel52addf52024-07-16 12:14:31 +0100175*Copyright (c) 2023-2024, Arm Limited. All rights reserved.*