blob: 350505cce7eeda4210944aede6f1c860c832ff1f [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 Ban38e17312018-11-22 15:26:35 +000017 */
18
19/**
20 * \note The interfaces defined in this file must be implemented for each
21 * SoC.
22 */
23
24#include <stdint.h>
25#include "tfm_plat_defs.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/**
Tamas Ban2318feb2019-01-02 16:50:51 +000032 * \def INSTANCE_ID_MAX_SIZE
Tamas Ban38e17312018-11-22 15:26:35 +000033 *
Tamas Ban2318feb2019-01-02 16:50:51 +000034 * \brief Maximum size of instance ID in bytes
Tamas Ban38e17312018-11-22 15:26:35 +000035 */
Tamas Ban2318feb2019-01-02 16:50:51 +000036#define INSTANCE_ID_MAX_SIZE (33u)
Tamas Ban38e17312018-11-22 15:26:35 +000037
38/**
Tamas Ban339b32f2019-01-02 18:54:50 +000039 * \def IMPLEMENTATION_ID_MAX_SIZE
40 *
41 * \brief Maximum size of implementation ID in bytes
42 */
43#define IMPLEMENTATION_ID_MAX_SIZE (32u)
44
45/**
Tamas Ban38e17312018-11-22 15:26:35 +000046 * \brief Get the UEID of the device.
47 *
Tamas Ban2318feb2019-01-02 16:50:51 +000048 * This mandatory claim represents the unique identifier of the instance.
49 * In the PSA definition is a hash of the public attestation key of the
50 * instance. The claim will be represented by the EAT standard claim UEID
51 * of type GUID. The EAT definition of a GUID type is that it will be between
52 * 128 & 256 bits but this implementation will use the full 256 bits to
53 * accommodate a hash result.
Tamas Ban38e17312018-11-22 15:26:35 +000054 *
Tamas Ban2318feb2019-01-02 16:50:51 +000055 * \param[in/out] size As an input value it indicates the size of the caller
56 * allocated buffer (in bytes) to store the UEID. At return
57 * its value is updated with the exact size of the UEID.
58 * \param[out] buf Pointer to the buffer to store the UEID
59 *
60 * \return Returns error code specified in \ref tfm_plat_err_t
Tamas Ban38e17312018-11-22 15:26:35 +000061 */
Tamas Ban2318feb2019-01-02 16:50:51 +000062enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf);
Tamas Ban38e17312018-11-22 15:26:35 +000063
Tamas Ban339b32f2019-01-02 18:54:50 +000064/**
65 * \brief Get the Implementation ID of the device.
66 *
67 * This mandatory claim represents the original implementation signer of the
68 * attestation key and identifies the contract between the report and
69 * verification. A verification service will use this claim to locate the
70 * details of the verification process. The claim will be represented by a
71 * custom EAT claim with a value consisting of a CBOR byte string. The size of
72 * this string will normally be 32 bytes to accommodate a 256 bit hash.
73 *
74 * \param[in/out] size As an input value it indicates the size of the caller
75 * allocated buffer (in bytes) to store the implementation
76 * ID. At return its value is updated with the exact size
77 * of the implementation ID.
78 * \param[out] buf Pointer to the buffer to store the implementation ID
79 *
80 * \return Returns error code specified in \ref tfm_plat_err_t
81 */
82enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size,
83 uint8_t *buf);
84
Tamas Ban38e17312018-11-22 15:26:35 +000085#ifdef __cplusplus
86}
87#endif
88
89#endif /* __TFM_PLAT_DEVICE_ID_H__ */