blob: 0a16dabb9a4e2d2b700ed6313bfd35fad6693564 [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 Ban339b32f2019-01-02 18:54:50 +000056 * \brief Get the Implementation ID of the device.
57 *
58 * This mandatory claim represents the original implementation signer of the
59 * attestation key and identifies the contract between the report and
60 * verification. A verification service will use this claim to locate the
61 * details of the verification process. The claim will be represented by a
62 * custom EAT claim with a value consisting of a CBOR byte string. The size of
63 * this string will normally be 32 bytes to accommodate a 256 bit hash.
64 *
65 * \param[in/out] size As an input value it indicates the size of the caller
66 * allocated buffer (in bytes) to store the implementation
67 * ID. At return its value is updated with the exact size
68 * of the implementation ID.
69 * \param[out] buf Pointer to the buffer to store the implementation ID
70 *
71 * \return Returns error code specified in \ref tfm_plat_err_t
72 */
73enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size,
74 uint8_t *buf);
75
Tamas Ban82dc4352019-01-02 21:49:59 +000076/**
77 * \brief Get the hardware version of the device.
78 *
79 * This optional claim provides metadata linking the token to the GDSII that
80 * went to fabrication for this instance. It is represented as CBOR text string.
81 * It is recommended to use for identification the format of the European
82 * Article Number: EAN-13+5.
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 HW version. At
86 * return its value is updated with the exact size of the
87 * HW version.
88 * \param[out] buf Pointer to the buffer to store the HW version
89 *
90 * \return Returns error code specified in \ref tfm_plat_err_t
91 */
92enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf);
93
Tamas Ban38e17312018-11-22 15:26:35 +000094#ifdef __cplusplus
95}
96#endif
97
98#endif /* __TFM_PLAT_DEVICE_ID_H__ */