blob: 2e872f2959e275ada10ff11d8e3d16692f4f51db [file] [log] [blame]
Julian Hall7b594622022-04-08 14:04:15 +01001Attestation Service
2===================
3Overview
4--------
Julian Hallc1cf9122021-06-21 13:44:33 +01005The Attestation service is responsible for reporting on the security state of a device.
6Because information is signed, a remote party may verify that the information is intact
7and authentic. The Attestation service can be used as part of an infrastructure for
8remote security monitoring. The Attestation service provider performs the following
9functions:
10
11 1. Collates information about device hardware and firmware. This information must be obtained in a secure way to provide a suitably trustworthy snapshot of a device's security state.
12 2. Prepares and signs a report that includes the information as a set of claims about the device.
13
14Like other trusted services, the Attestation service provider runs within a secure
15processing environment such as a secure partition or secondary MCU. Service operations
16are invoked by clients using a service access protocol that defines the serialization of
17requests and responses carried by the underlying RPC layer. Client-side adapters are
18available that support service access using the following C APIs:
19
20 - **PSA Initial Attestation API** - used during normal device operation to obtain a fresh attestation token.
21 - **Attestation Provisioning API** - used during manufacture for key provisioning operations.
22
23Project Directories
24-------------------
25Components within the Trusted Services project related to the Attestation service are
26located under the following directories:
27
28.. list-table::
29 :header-rows: 1
30
31 * - Directory
32 - Contains
33 * - components/service/attestation
34 - Service specific code and API header files.
35 * - protocols/service/attestation
36 - Service access protocol definitions.
37 * - deployments/attestation
38 - Build files and deployment specific code for building the attestation service provider to run in different environments.
39 * - deployments/platform-inspect
40 - A user-space application that retrieves information about platform firmware and hardware and produces a pretty printed output.
41
42Attestation report
43------------------
44A fresh attestation report may be requested at any time to obtain the current view
45of a device's security state. The report is encoded as a CBOR token, signed using
46the CBOR Object Signing and Encryption protocol (COSE). For more information about
47the report contents and encoding, see:
48https://www.psacertified.org/blog/what-is-an-entity-attestation-token/. The following
49text shows the typical content of an attestation report. This report was retrieved
50and decoded using the *platform-inspect* command line application::
51
52 attestation_report:
53 challenge: 32 2d 69 64 ba df b2 f3 28 e8 27 88 50 68 c2 94 7c 4d a9 71 ce 14 e9 f4 88 26 45 9d 2c f5 3c 1b
54 client_id: 0
55 boot_seed: 6c eb 03 90 46 e2 09 27 f2 1c 7c a2 2c 1a a6 a2 bd 41 5e 3c aa be 4a b1 fd 35 52 95 b9 74 32 42
56 security_lifecycle: 3000
57 instance_id: 01 cb e9 65 fc 88 90 69 36 4b b1 0c ef 04 ae 97 aa d7 7c f9 74 41 4d f5 41 0c d3 9d e3 df 97 de c5
58 sw_components:
59 type: BL_2
60 digest: a8 4f b4 7b 54 d9 4b ab 49 73 63 f7 9b fc 66 cb 85 12 ab 18 6f 24 74 01 5d cf 33 f3 80 9e 9b 20
61
62 type: BL_31
63 digest: 2f d3 43 6c 6f ef 9b 11 c2 16 dd 1f 8b df 9b a5 24 14 a5 c1 97 0c 3a 6c 78 bf ef 64 0f c1 23 e1
64
65 type: HW_CONFIG
66 digest: f3 de 4e 17 a1 a5 a7 fe d9 d9 f4 16 3c 49 36 7e ae f7 2f 2a a8 87 e6 b6 22 89 cd 27 dc 1c 80 25
67
68 type: SOC_FW_CONFIG
69 digest: 4e e4 8e 5a e6 50 ed e0 b5 a3 54 8a 1f d6 0e 8a ea 0e 71 75 0e a4 3f 82 76 ce af cd 7c b0 91 e0
70
71 type: BL_32
72 digest: 62 22 4f 0f b0 5d b4 77 1b 3f a5 2e ab 76 1e 61 17 b8 c6 6e ac 8c c8 4d 2e b0 7d 70 08 60 4b 41
73
74 type: BL32_EXTRA1_IMAGE
75 digest: 39 d2 b8 5d 93 5d f6 d8 f8 ed 0c 1a 3a e3 c8 90 72 19 f4 88 5c 79 15 05 7b f0 76 db c1 4c 5d 77
76
77 type: BL_33
78 digest: b5 d6 08 61 dd fa 6d da a3 f7 a5 de d6 8f 6f 39 25 b1 57 fa 3e db 46 42 58 24 8e 81 1c 45 5d 38
79
80 type: NT_FW_CONFIG
81 digest: 25 10 60 5d d4 bc 9d 82 7a 16 9f 8a cc 47 95 a6 fd ca a0 c1 2b c9 99 8f 51 20 ff c6 ed 74 68 5a
82
83Design Description
84------------------
85Components related to the Attestation service are partitioned as follows:
86
87.. uml:: uml/AttestPartitioning.puml
88
89The partitioning into components reflects the following problem areas:
90
91.. list-table::
92 :header-rows: 1
93
94 * - Component
95 - Problem Area
96 * - claims
97 - Collecting diverse information about a device and presenting it in a uniform way. Provides an extensible framework that allows new sources of information to be added while avoiding coupling to other components.
98 * - client
99 - Client side adapters for calling service operations.
100 * - key_mngr
101 - Manages provisioning related operations and access to the key (IAK) used for report signing.
102 * - reporter
103 - Combines the set of claims that forms the content of an attestation report, encoding it and signing using the IAK.
104 * - provider
105 - The service provider that handles incoming requests.
106 * - protocol
107 - The service access protocol definition that describes supported operations and the serialization of input and output parameters.
108
109Claims Model
110''''''''''''
111The set of available claims about a device and the method for obtaining them is likely to
112vary between different platforms. The following are examples of likely variations:
113
114 - The method for collecting boot measurements will depend on the boot loader and on SoC architecture. Some likely variations are:
115
116 - Passed forward using a TPM event log or via a proprietary format.
117 - Boot measurements are stored in TPM PCR type registers that need to be read to obtain claims about loaded components.
118 - The set of information passed forward by the boot loader may vary between platforms. Information such as the boot seed or device lifecycle state may be owned by the boot loader on some platforms but not on others.
119 - Platform vendors may wish to include custom claims within the attestation report that reflect vendor specific views of security state.
120
121To accommodate these variations, a flexible claims model is implemented with the following
122characteristics:
123
124 - Any claim is represented by a common structure with members to identify:
125
126 - The category of claim - e.g. this is a claim about device hardware, firmware, the verification service.
127 - The subject of the claim - a claim specific identifier
128 - A variant id to identify the data type for a claim - e.g. integer, byte string, text string or a collection.
129 - Arbitrarily complex claim structures may be presented in a normalized way using combinations of claim variants.
130 - Claims are collected by a set of 'claim sources'. Each concrete claim source implements the platform specific method for collecting information and representing it in standard way. The set of claim sources used may vary for different deployments.
131 - Claim sources are registered with the claims_register. This is a singleton that provides methods for querying for different sets of claims e.g. all device claims or all firmware measurements. By collating claims by category, tight coupling between the reporter and the set of available claims is avoided.
132
133The following class diagram illustrates the implemented claims model:
134
135.. uml:: uml/AttestClaimsModel.puml
136
137Claim Sources
138"""""""""""""
139It is envisaged that the number of concrete claim sources will grow to cope with differences
140between platforms and the need to include custom claims in attestation reports. The following
141table lists some existing claim sources:
142
143.. list-table::
144 :header-rows: 1
145
146 * - Claim Source
147 - Description
148 * - event_log
149 - A claim source that sources a claim_collection variant. An iterator may be created that allows claims within a TCG event log to be iterated over and accessed.
150 * - boot_seed_generator
151 - Where a boot seed is not available from another source, a boot_seed_generator may be used in a deployment. On the first call to get_claim(), a random boot seed is generated and returned as a byte_string claim variant. On subsequent calls, the same boot seed value is return.
152 * - instance_id
153 - A claim source that returns a device instance ID, derived from the IAK public key.
154 * - null_lifecycle
155 - Used when there is no hardware backed support for the device lifecycle state variable. This claim source just returns a lifecycle state of 'unknown'.
156
157Reporter
158""""""""
159The contents of the attestation report created by the reporter is determined by the set of
160claim sources registered with the claims_register. To generate a PSA compliant attestation
161report, the reporter queries for the following categories of claim:
162
163 - Device
164 - Verification service
165 - Boot measurements
166
167Having collated all claims, the report is serialized as a CBOR object using the qcbor
168open source library. The CBOR object is then signed using the *t_cose* library to produce
169the final attestation token.
170
171Provisioning Flows
172------------------
173The Attestation service uses the IAK (an ECDSA key pair) for signing attestation reports.
174An external verification service needs a way of establishing trust in the IAK used by a
175device to sign a report. This trust relationship is formed when a device is provisioned
176during manufacture. During provisioning, the following steps must be performed in a
177secure manufacturing environment:
178
179 1. A unique IAK is generated and stored as a persistent key in the device's secure key store.
180 2. The IAK public key is obtained and stored in a central database of trusted devices. The hash of the IAK public key (the device's instance ID) is used as the database key for accessing the stored key.
181
182To verify the authenticity of an attestation report, an external verifier must query
183the database using the instance ID claim contained within the report. The signature on
184the report is viewed as authentic if the following are true:
185
186 - A key record exists for the given instance ID within the database.
187 - The signature is verified successfully using the corresponding public key.
188
189The attestation access protocol supports operations to support provisioning. These
190operations may be invoked using simple client C API (see *attest_provision.h*) or by
191using the access protocol directly for non-C clients. The following two alternative
192provisioning flows are supported:
193
194Self-generated IAK
195''''''''''''''''''
196When a device powers up before provisioning has been performed, no IAK will exist in
197the device's key store. As long as no attestation related service operations are
198performed, the device will remain in this state. To trigger the self generation of
199an IAK, factory provisioning software should call the *export_iak_public_key* operation.
200If no IAK exists, one will be generated using the device's TRNG. A benefit of this
201flow is that the IAK private key value is never externally exposed. To support test
202deployments where no persistent storage is used, the self-generated IAK flow may
203optionally generate a volatile key instead of persistent key.:
204
205.. uml:: uml/AttestSelfGeneratedIAKflow.puml
206
207Imported IAK
208''''''''''''
209To support external generation of the IAK, a one-time key import operation is also
210supported. When a device is in the pre-provisioned state where no IAK exists, the
211import_iak may be called by factory provisioning software. Importantly, *import_iak*
212may only be called once. An attempt to call it again will be rejected.:
213
214.. uml:: uml/AttestImportedIAKflow.puml
215
216Testing the Attestation Service
217-------------------------------
218The following CppUtest based test suites are available for attestation service testing.
219All component and service level tests may be run on a real target device and as part
220of a native PC built binary.
221
222Component-Level Test Suites
223'''''''''''''''''''''''''''
224Test suites included in deployments of *component-test*:
225
226.. list-table::
227 :header-rows: 1
228
229 * - Test Suite
230 - Coverage
231 - File Location
232 * - TcgEventLogTests
233 - Tests decoding and iterator access to a TCG event log.
234 - service/attestation/claims/sources/event_log/test
235 * - AttestationReporterTests
236 - Checks the contents and signing of a generated attestation report.
237 - service/attestation/test/component
238
239Service-Level Test Suites
240'''''''''''''''''''''''''
241Test suites included in deployments of *ts-service-test*. Test cases act as conventional
242service clients:
243
244.. list-table::
245 :header-rows: 1
246
247 * - Test Suite
248 - Coverage
249 - File Location
250 * - AttestationServiceTests
251 - Different attestation token request scenarios
252 - service/attestation/test/service
253 * - AttestationProvisioningTests
254 - Tests provisioning flows and checks defence against misuse of provisioning operations.
255 - service/attestation/test/service
256
257Environment Tests
258'''''''''''''''''
259When deployed within a secure partition, the attestation SP relies on access to externally
260provided information such as the TPM event log. Test have been added to the *env_test* SP
261deployment to check that features that the attestation SP relies on are working as expected.
262Tests included in the *env_test* SP deployment may be invoked from Linux user-space using the
263*ts-remote-test/arm-linux* deployment.
264
265--------------
266
Julian Hall7b594622022-04-08 14:04:15 +0100267*Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.*
Julian Hallc1cf9122021-06-21 13:44:33 +0100268
269SPDX-License-Identifier: BSD-3-Clause