Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers psa_crypto_invasive.h Source File

psa_crypto_invasive.h

Go to the documentation of this file.
00001 /**
00002  * \file psa_crypto_invasive.h
00003  *
00004  * \brief PSA cryptography module: invasive interfaces for test only.
00005  *
00006  * The interfaces in this file are intended for testing purposes only.
00007  * They MUST NOT be made available to clients over IPC in integrations
00008  * with isolation, and they SHOULD NOT be made available in library
00009  * integrations except when building the library for testing.
00010  */
00011 /*
00012  *  Copyright (C) 2018, ARM Limited, All Rights Reserved
00013  *  SPDX-License-Identifier: Apache-2.0
00014  *
00015  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00016  *  not use this file except in compliance with the License.
00017  *  You may obtain a copy of the License at
00018  *
00019  *  http://www.apache.org/licenses/LICENSE-2.0
00020  *
00021  *  Unless required by applicable law or agreed to in writing, software
00022  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00023  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024  *  See the License for the specific language governing permissions and
00025  *  limitations under the License.
00026  *
00027  *  This file is part of mbed TLS (https://tls.mbed.org)
00028  */
00029 
00030 #ifndef PSA_CRYPTO_INVASIVE_H
00031 #define PSA_CRYPTO_INVASIVE_H
00032 
00033 #if defined(MBEDTLS_CONFIG_FILE)
00034 #include MBEDTLS_CONFIG_FILE
00035 #else
00036 #include "mbedtls/config.h"
00037 #endif
00038 
00039 #include "psa/crypto.h"
00040 
00041 #include "mbedtls/entropy.h"
00042 
00043 /** \brief Configure entropy sources.
00044  *
00045  * This function may only be called before a call to psa_crypto_init(),
00046  * or after a call to mbedtls_psa_crypto_free() and before any
00047  * subsequent call to psa_crypto_init().
00048  *
00049  * This function is only intended for test purposes. The functionality
00050  * it provides is also useful for system integrators, but
00051  * system integrators should configure entropy drivers instead of
00052  * breaking through to the Mbed TLS API.
00053  *
00054  * \param entropy_init  Function to initialize the entropy context
00055  *                      and set up the desired entropy sources.
00056  *                      It is called by psa_crypto_init().
00057  *                      By default this is mbedtls_entropy_init().
00058  *                      This function cannot report failures directly.
00059  *                      To indicate a failure, set the entropy context
00060  *                      to a state where mbedtls_entropy_func() will
00061  *                      return an error.
00062  * \param entropy_free  Function to free the entropy context
00063  *                      and associated resources.
00064  *                      It is called by mbedtls_psa_crypto_free().
00065  *                      By default this is mbedtls_entropy_free().
00066  *
00067  * \retval PSA_SUCCESS
00068  *         Success.
00069  * \retval PSA_ERROR_NOT_PERMITTED
00070  *         The caller does not have the permission to configure
00071  *         entropy sources.
00072  * \retval PSA_ERROR_BAD_STATE
00073  *         The library has already been initialized.
00074  */
00075 psa_status_t mbedtls_psa_crypto_configure_entropy_sources(
00076     void (* entropy_init )( mbedtls_entropy_context *ctx ),
00077     void (* entropy_free )( mbedtls_entropy_context *ctx ) );
00078 
00079 #endif /* PSA_CRYPTO_INVASIVE_H */