Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 1 | /* |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2019, Arm Limited. All rights reserved. |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 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 |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 12 | * |
| 13 | * The interfaces defined in this file are meant to provide the following |
| 14 | * attributes of the device: |
Tamas Ban | 339b32f | 2019-01-02 18:54:50 +0000 | [diff] [blame^] | 15 | * - Instance ID: Unique identifier of the device. |
| 16 | * - Implementation ID: Original implementation signer of the attestation key. |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 17 | */ |
| 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 |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | /** |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 32 | * \def INSTANCE_ID_MAX_SIZE |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 33 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 34 | * \brief Maximum size of instance ID in bytes |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 35 | */ |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 36 | #define INSTANCE_ID_MAX_SIZE (33u) |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 37 | |
| 38 | /** |
Tamas Ban | 339b32f | 2019-01-02 18:54:50 +0000 | [diff] [blame^] | 39 | * \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 Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 46 | * \brief Get the UEID of the device. |
| 47 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 48 | * 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 Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 54 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 55 | * \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 Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 61 | */ |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 62 | enum tfm_plat_err_t tfm_plat_get_instance_id(uint32_t *size, uint8_t *buf); |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 63 | |
Tamas Ban | 339b32f | 2019-01-02 18:54:50 +0000 | [diff] [blame^] | 64 | /** |
| 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 | */ |
| 82 | enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size, |
| 83 | uint8_t *buf); |
| 84 | |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | #endif /* __TFM_PLAT_DEVICE_ID_H__ */ |