blob: dcce8378c419a75cdc8e2a033ae66acdf05514e3 [file] [log] [blame]
Tamas Ban38e17312018-11-22 15:26:35 +00001/*
Tamas Ban2318feb2019-01-02 16:50:51 +00002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Tamas Ban38e17312018-11-22 15:26:35 +00003 *
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
Tamas Ban2318feb2019-01-02 16:50:51 +000012 *
13 * The interfaces defined in this file are meant to provide the following
14 * attributes of the device:
Tamas Ban339b32f2019-01-02 18:54:50 +000015 * - Instance ID: Unique identifier of the device.
16 * - Implementation ID: Original implementation signer of the attestation key.
Tamas Ban82dc4352019-01-02 21:49:59 +000017 * - Hardware version: Identify the GDSII that went to fabrication.
Tamas Ban38e17312018-11-22 15:26:35 +000018 */
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/**
Tamas Ban2318feb2019-01-02 16:50:51 +000033 * \def INSTANCE_ID_MAX_SIZE
Tamas Ban38e17312018-11-22 15:26:35 +000034 *
Tamas Ban2318feb2019-01-02 16:50:51 +000035 * \brief Maximum size of instance ID in bytes
Tamas Ban38e17312018-11-22 15:26:35 +000036 */
Tamas Ban2318feb2019-01-02 16:50:51 +000037#define INSTANCE_ID_MAX_SIZE (33u)
Tamas Ban38e17312018-11-22 15:26:35 +000038
39/**
Tamas Ban339b32f2019-01-02 18:54:50 +000040 * \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/**
Tamas Ban82dc4352019-01-02 21:49:59 +000047 * \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/**
Tamas Ban38e17312018-11-22 15:26:35 +000056 * \brief Get the UEID of the device.
57 *
Tamas Ban2318feb2019-01-02 16:50:51 +000058 * 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.
Tamas Ban38e17312018-11-22 15:26:35 +000064 *
Tamas Ban2318feb2019-01-02 16:50:51 +000065 * \param[in/out] 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 \ref tfm_plat_err_t
Tamas Ban38e17312018-11-22 15:26:35 +000071 */
Tamas Ban2318feb2019-01-02 16:50:51 +000072enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf);
Tamas Ban38e17312018-11-22 15:26:35 +000073
Tamas Ban339b32f2019-01-02 18:54:50 +000074/**
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[in/out] 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 \ref tfm_plat_err_t
91 */
92enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size,
93 uint8_t *buf);
94
Tamas Ban82dc4352019-01-02 21:49:59 +000095/**
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[in/out] 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 \ref tfm_plat_err_t
110 */
111enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf);
112
Tamas Ban38e17312018-11-22 15:26:35 +0000113#ifdef __cplusplus
114}
115#endif
116
117#endif /* __TFM_PLAT_DEVICE_ID_H__ */