1 /*
2  * Insecure but standalone implementation of mbedtls_psa_external_get_random().
3  * Only for use in tests!
4  */
5 /*
6  *  Copyright The Mbed TLS Contributors
7  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
8  */
9 
10 #ifndef FAKE_EXTERNAL_RNG_FOR_TEST_H
11 #define FAKE_EXTERNAL_RNG_FOR_TEST_H
12 
13 #include "mbedtls/build_info.h"
14 
15 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
16 /** Enable the insecure implementation of mbedtls_psa_external_get_random().
17  *
18  * The insecure implementation of mbedtls_psa_external_get_random() is
19  * disabled by default.
20  *
21  * When MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled and the test
22  * helpers are linked into a program, you must enable this before running any
23  * code that uses the PSA subsystem to generate random data (including internal
24  * random generation for purposes such as blinding when the random generation
25  * is routed through PSA).
26  *
27  * You can enable and disable it at any time, regardless of the state
28  * of the PSA subsystem. You may disable it temporarily to simulate a
29  * depleted entropy source.
30  */
31 void mbedtls_test_enable_insecure_external_rng(void);
32 
33 /** Disable the insecure implementation of mbedtls_psa_external_get_random().
34  *
35  * See mbedtls_test_enable_insecure_external_rng().
36  */
37 void mbedtls_test_disable_insecure_external_rng(void);
38 #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
39 
40 #endif /* FAKE_EXTERNAL_RNG_FOR_TEST_H */
41