aboutsummaryrefslogtreecommitdiff
path: root/platform/include/tfm_plat_crypto_nv_seed.h
blob: 9b897c83e3e6ca19232bf361dca75e2679b75dbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright (c) 2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */
#ifndef __TFM_PLAT_CRYPTO_NV_SEED_H__
#define __TFM_PLAT_CRYPTO_NV_SEED_H__

#include <stddef.h>

#ifndef NV_SEED_FILE_ID
#define NV_SEED_FILE_ID 9
#endif

#define TFM_CRYPTO_NV_SEED_SUCCESS 0
#define TFM_CRYPTO_NV_SEED_FAILED  -1

/**
 * \brief Read Seed from NV storage.
 *
 * \param[out] buf        Buffer to store the seed
 * \param[in]  buf_len    Buffer length to read
 *
 * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success,
 *         or TFM_CRYPTO_NV_SEED_FAILED on failure.
 */
int tfm_plat_crypto_nv_seed_read(unsigned char *buf, size_t buf_len);

/**
 * \brief Write Seed to NV storage.
 *
 * \param[in]  buf        Buffer storing the seed
 * \param[in]  buf_len    Buffer length to write
 *
 * \return Return TFM_CRYPTO_NV_SEED_SUCCESS on success,
 *         or TFM_CRYPTO_NV_SEED_FAILED on failure.
 */
int tfm_plat_crypto_nv_seed_write(const unsigned char *buf, size_t buf_len);

#endif /* __TFM_PLAT_CRYPTO_NV_SEED_H__ */