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: |
| 15 | * - Instance ID: Unique identifier of the device. |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * \note The interfaces defined in this file must be implemented for each |
| 20 | * SoC. |
| 21 | */ |
| 22 | |
| 23 | #include <stdint.h> |
| 24 | #include "tfm_plat_defs.h" |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | /** |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame^] | 31 | * \def INSTANCE_ID_MAX_SIZE |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 32 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame^] | 33 | * \brief Maximum size of instance ID in bytes |
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 | #define INSTANCE_ID_MAX_SIZE (33u) |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * \brief Get the UEID of the device. |
| 39 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame^] | 40 | * This mandatory claim represents the unique identifier of the instance. |
| 41 | * In the PSA definition is a hash of the public attestation key of the |
| 42 | * instance. The claim will be represented by the EAT standard claim UEID |
| 43 | * of type GUID. The EAT definition of a GUID type is that it will be between |
| 44 | * 128 & 256 bits but this implementation will use the full 256 bits to |
| 45 | * accommodate a hash result. |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 46 | * |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame^] | 47 | * \param[in/out] size As an input value it indicates the size of the caller |
| 48 | * allocated buffer (in bytes) to store the UEID. At return |
| 49 | * its value is updated with the exact size of the UEID. |
| 50 | * \param[out] buf Pointer to the buffer to store the UEID |
| 51 | * |
| 52 | * \return Returns error code specified in \ref tfm_plat_err_t |
Tamas Ban | 38e1731 | 2018-11-22 15:26:35 +0000 | [diff] [blame] | 53 | */ |
Tamas Ban | 2318feb | 2019-01-02 16:50:51 +0000 | [diff] [blame^] | 54 | 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] | 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif /* __TFM_PLAT_DEVICE_ID_H__ */ |