Mbed OS Reference
Loading...
Searching...
No Matches
tfm_plat_device_id.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_PLAT_DEVICE_ID_H__
9#define __TFM_PLAT_DEVICE_ID_H__
10/**
11 * \file tfm_plat_device_id.h
12 *
13 * The interfaces defined in this file are meant to provide the following
14 * attributes of the device:
15 * - Instance ID: Unique identifier of the device.
16 * - Implementation ID: Original implementation signer of the attestation key.
17 * - Hardware version: Identify the GDSII that went to fabrication.
18 */
19
20/**
21 * \note The interfaces defined in this file must be implemented for each
22 * SoC.
23 */
24
25#include <stdint.h>
26#include "tfm_plat_defs.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * \def INSTANCE_ID_MAX_SIZE
34 *
35 * \brief Maximum size of instance ID in bytes
36 */
37#define INSTANCE_ID_MAX_SIZE (33u)
38
39/**
40 * \def IMPLEMENTATION_ID_MAX_SIZE
41 *
42 * \brief Maximum size of implementation ID in bytes
43 */
44#define IMPLEMENTATION_ID_MAX_SIZE (32u)
45
46/**
47 * \def HW_VERSION_MAX_SIZE
48 *
49 * \brief Maximum size of hardware version in bytes
50 *
51 * Recommended to use the European Article Number format: EAN-13+5
52 */
53#define HW_VERSION_MAX_SIZE (18u)
54
55/**
56 * \brief Get the UEID of the device.
57 *
58 * This mandatory claim represents the unique identifier of the instance.
59 * In the PSA definition is a hash of the public attestation key of the
60 * instance. The claim will be represented by the EAT standard claim UEID
61 * of type GUID. The EAT definition of a GUID type is that it will be between
62 * 128 & 256 bits but this implementation will use the full 256 bits to
63 * accommodate a hash result.
64 *
65 * \param[inout] size As an input value it indicates the size of the caller
66 * allocated buffer (in bytes) to store the UEID. At return
67 * its value is updated with the exact size of the UEID.
68 * \param[out] buf Pointer to the buffer to store the UEID
69 *
70 * \return Returns error code specified in #tfm_plat_err_t
71 */
72enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf);
73
74/**
75 * \brief Get the Implementation ID of the device.
76 *
77 * This mandatory claim represents the original implementation signer of the
78 * attestation key and identifies the contract between the report and
79 * verification. A verification service will use this claim to locate the
80 * details of the verification process. The claim will be represented by a
81 * custom EAT claim with a value consisting of a CBOR byte string. The size of
82 * this string will normally be 32 bytes to accommodate a 256 bit hash.
83 *
84 * \param[inout] size As an input value it indicates the size of the caller
85 * allocated buffer (in bytes) to store the implementation
86 * ID. At return its value is updated with the exact size
87 * of the implementation ID.
88 * \param[out] buf Pointer to the buffer to store the implementation ID
89 *
90 * \return Returns error code specified in #tfm_plat_err_t
91 */
93 uint8_t *buf);
94
95/**
96 * \brief Get the hardware version of the device.
97 *
98 * This optional claim provides metadata linking the token to the GDSII that
99 * went to fabrication for this instance. It is represented as CBOR text string.
100 * It is recommended to use for identification the format of the European
101 * Article Number: EAN-13+5.
102 *
103 * \param[inout] size As an input value it indicates the size of the caller
104 * allocated buffer (in bytes) to store the HW version. At
105 * return its value is updated with the exact size of the
106 * HW version.
107 * \param[out] buf Pointer to the buffer to store the HW version
108 *
109 * \return Returns error code specified in #tfm_plat_err_t
110 */
111enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf);
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* __TFM_PLAT_DEVICE_ID_H__ */
tfm_plat_err_t
Error enum for TFM platform functions.
Definition: tfm_plat_defs.h:23
enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size, uint8_t *buf)
Get the Implementation ID of the device.
enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf)
Get the UEID of the device.
enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf)
Get the hardware version of the device.