blob: f39f33963788cfbc890ca01be8500ac6a8310293 [file] [log] [blame]
Gilles Peskinee59236f2018-01-27 23:32:46 +01001/**
2 * \file psa/crypto_extra.h
3 *
4 * \brief PSA cryptography module: Mbed TLS vendor extensions
Gilles Peskine07c91f52018-06-28 18:02:53 +02005 *
6 * \note This file may not be included directly. Applications must
7 * include psa/crypto.h.
8 *
9 * This file is reserved for vendor-specific definitions.
Gilles Peskinee59236f2018-01-27 23:32:46 +010010 */
11/*
12 * Copyright (C) 2018, ARM Limited, All Rights Reserved
13 * SPDX-License-Identifier: Apache-2.0
14 *
15 * Licensed under the Apache License, Version 2.0 (the "License"); you may
16 * not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
18 *
19 * http://www.apache.org/licenses/LICENSE-2.0
20 *
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
23 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
26 *
27 * This file is part of mbed TLS (https://tls.mbed.org)
28 */
29
30#ifndef PSA_CRYPTO_EXTRA_H
31#define PSA_CRYPTO_EXTRA_H
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
Netanel Gonen2bcd3122018-11-19 11:53:02 +020037/* UID for secure storage seed */
38#define MBED_RANDOM_SEED_ITS_UID 0xFFFFFF52
39
Gilles Peskinee59236f2018-01-27 23:32:46 +010040/**
41 * \brief Library deinitialization.
42 *
43 * This function clears all data associated with the PSA layer,
44 * including the whole key store.
45 *
46 * This is an Mbed TLS extension.
47 */
48void mbedtls_psa_crypto_free( void );
49
Netanel Gonen2bcd3122018-11-19 11:53:02 +020050
51#if ( defined(MBEDTLS_ENTROPY_NV_SEED) && defined(MBEDTLS_PSA_HAS_ITS_IO) )
52/**
53 * \brief Inject initial entropy seed into persistent storage for random capabilities.
54 *
55 * \warning This function **can** fail! Callers MUST check the return status.
56 *
57 * \note To use this function both mbedtls_nv_seed_read and mbedtls_nv_seed_write
58 * must be defined.
59 *
60 * \param seed[in] Buffer storing the seed value to inject.
61 * \param seed_size[in] Size of the \p seed buffer. The minimum size of the seed is MBEDTLS_ENTROPY_MIN_PLATFORM
62 *
63 * \retval #PSA_SUCCESS
64 * \retval #PSA_ERROR_INVALID_ARGUMENT
65 * \retval #PSA_ERROR_STORAGE_FAILURE
66 * \retval #PSA_ERROR_NOT_PERMITTED
67 * \retval #PSA_ERROR_BAD_STATE
68 */
69psa_status_t mbedtls_psa_inject_entropy(const unsigned char *seed,
70 size_t seed_size);
71
72#endif
73
Gilles Peskinee59236f2018-01-27 23:32:46 +010074#ifdef __cplusplus
75}
76#endif
77
78#endif /* PSA_CRYPTO_EXTRA_H */