1 /* 2 * Copyright (c) 2021, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 #ifndef __TFM_PLAT_CRYPTO_NV_SEED_H__ 8 #define __TFM_PLAT_CRYPTO_NV_SEED_H__ 9 10 #include <stddef.h> 11 12 #ifndef NV_SEED_FILE_ID 13 #define NV_SEED_FILE_ID 9 14 #endif 15 16 #define TFM_CRYPTO_NV_SEED_SUCCESS 0 17 #define TFM_CRYPTO_NV_SEED_FAILED -1 18 19 /** 20 * \brief Provision Seed to NV storage. Fails if a seed is already in storage. 21 * 22 * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, 23 * or TFM_CRYPTO_NV_SEED_FAILED on failure. 24 */ 25 int tfm_plat_crypto_provision_entropy_seed(void); 26 27 /** 28 * \brief Read Seed from NV storage. 29 * 30 * \param[out] buf Buffer to store the seed 31 * \param[in] buf_len Buffer length to read 32 * 33 * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, 34 * or TFM_CRYPTO_NV_SEED_FAILED on failure. 35 */ 36 int tfm_plat_crypto_nv_seed_read(unsigned char *buf, size_t buf_len); 37 38 /** 39 * \brief Write Seed to NV storage. 40 * 41 * \param[in] buf Buffer storing the seed 42 * \param[in] buf_len Buffer length to write 43 * 44 * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success, 45 * or TFM_CRYPTO_NV_SEED_FAILED on failure. 46 */ 47 int tfm_plat_crypto_nv_seed_write(const unsigned char *buf, size_t buf_len); 48 49 #endif /* __TFM_PLAT_CRYPTO_NV_SEED_H__ */ 50