2021-01-20 20:02:01 +01:00
|
|
|
/*
|
|
|
|
* Insecure but standalone implementation of mbedtls_psa_external_get_random().
|
|
|
|
* Only for use in tests!
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright The Mbed TLS Contributors
|
2023-11-02 20:47:20 +01:00
|
|
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
2021-01-20 20:02:01 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FAKE_EXTERNAL_RNG_FOR_TEST_H
|
|
|
|
#define FAKE_EXTERNAL_RNG_FOR_TEST_H
|
|
|
|
|
2021-05-27 11:25:03 +02:00
|
|
|
#include "mbedtls/build_info.h"
|
2021-01-20 20:02:01 +01:00
|
|
|
|
|
|
|
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
|
|
|
/** Enable the insecure implementation of mbedtls_psa_external_get_random().
|
|
|
|
*
|
|
|
|
* The insecure implementation of mbedtls_psa_external_get_random() is
|
|
|
|
* disabled by default.
|
|
|
|
*
|
|
|
|
* When MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled and the test
|
|
|
|
* helpers are linked into a program, you must enable this before running any
|
|
|
|
* code that uses the PSA subsystem to generate random data (including internal
|
|
|
|
* random generation for purposes such as blinding when the random generation
|
|
|
|
* is routed through PSA).
|
|
|
|
*
|
|
|
|
* You can enable and disable it at any time, regardless of the state
|
|
|
|
* of the PSA subsystem. You may disable it temporarily to simulate a
|
|
|
|
* depleted entropy source.
|
|
|
|
*/
|
2023-01-11 14:50:10 +01:00
|
|
|
void mbedtls_test_enable_insecure_external_rng(void);
|
2021-01-20 20:02:01 +01:00
|
|
|
|
|
|
|
/** Disable the insecure implementation of mbedtls_psa_external_get_random().
|
|
|
|
*
|
|
|
|
* See mbedtls_test_enable_insecure_external_rng().
|
|
|
|
*/
|
2023-01-11 14:50:10 +01:00
|
|
|
void mbedtls_test_disable_insecure_external_rng(void);
|
2021-01-20 20:02:01 +01:00
|
|
|
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
|
|
|
|
|
|
|
#endif /* FAKE_EXTERNAL_RNG_FOR_TEST_H */
|