Tamas Ban | 3681ce0 | 2018-11-22 15:19:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_PLAT_BOOT_SEED_H__ |
| 9 | #define __TFM_PLAT_BOOT_SEED_H__ |
| 10 | /** |
| 11 | * \file tfm_plat_boot_seed.h |
| 12 | * |
| 13 | * Boot seed is used by a validating entity to ensure multiple reports were |
| 14 | * generated in the same boot session. Boot seed is a random number, generated |
| 15 | * only once during a boot cycle and its value is constant in the same cycle. |
| 16 | * Size recommendation is 256-bit to meet the statistically improbable property. |
| 17 | * Boot seed can be generated by secure boot loader an included to the measured |
| 18 | * boot state or can be generated by PRoT SW. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * \note The interfaces defined in this file must be implemented for each |
| 23 | * SoC. |
| 24 | */ |
| 25 | |
| 26 | #include <stdint.h> |
| 27 | #include "tfm_plat_defs.h" |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | /*! |
| 34 | * \def BOOT_SEED_SIZE |
| 35 | * |
| 36 | * \brief Size of boot seed in bytes. |
| 37 | */ |
| 38 | #define BOOT_SEED_SIZE (32u) |
| 39 | |
| 40 | /** |
| 41 | * \brief Gets the boot seed, which is a constant random number during a boot |
| 42 | * cycle. |
| 43 | * |
| 44 | * \param[in] size The required size of boot seed in bytes |
| 45 | * \param[out] buf Pointer to the buffer to store boot seed |
| 46 | * |
| 47 | * \return TFM_PLAT_ERR_SUCCESS if the value is generated correctly. Otherwise, |
| 48 | * it returns TFM_PLAT_ERR_SYSTEM_ERR. |
| 49 | */ |
| 50 | enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf); |
| 51 | |
| 52 | #ifdef __cplusplus |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | #endif /* __TFM_PLAT_BOOT_SEED_H__ */ |