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 | 82dc435 | 2019-01-02 21:49:59 +0000 | [diff] [blame] | 17 | * - Hardware version: Identify the GDSII that went to fabrication. |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 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 |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| 32 | /** |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 33 | * \def INSTANCE_ID_MAX_SIZE |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 34 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 35 | * \brief Maximum size of instance ID in bytes |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 36 | */ |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame] | 37 | #define INSTANCE_ID_MAX_SIZE (33u) |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 38 | |
| 39 | /** |
Tamas Ban | 339b32f | 2019-01-02 18:54:50 +0000 | [diff] [blame] | 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 | /** |
Tamas Ban | 82dc435 | 2019-01-02 21:49:59 +0000 | [diff] [blame] | 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 | /** |
Tamas Ban | 339b32f | 2019-01-02 18:54:50 +0000 | [diff] [blame] | 56 | * \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 | */ |
| 73 | enum tfm_plat_err_t tfm_plat_get_implementation_id(uint32_t *size, |
| 74 | uint8_t *buf); |
| 75 | |
Tamas Ban | 82dc435 | 2019-01-02 21:49:59 +0000 | [diff] [blame] | 76 | /** |
| 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 | */ |
| 92 | enum tfm_plat_err_t tfm_plat_get_hw_version(uint32_t *size, uint8_t *buf); |
| 93 | |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 94 | #ifdef __cplusplus |
| 95 | } |
| 96 | #endif |
| 97 | |
| 98 | #endif /* __TFM_PLAT_DEVICE_ID_H__ */ |