mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 18:55:45 +00:00
SSL test programs: always allow building with the PSA external RNG
The SSL test programs can now use the PSA RNG, and the PSA RNG can use an external RNG. The build conditions hadn't been updated and didn't cover the case when MBEDTLS_TEST_USE_PSA_CRYPTO_RNG is enabled but MBEDTLS_USE_PSA_CRYPTO is disabled. Fix this. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
38c12fd48e
commit
8133abd746
|
@ -43,23 +43,33 @@
|
||||||
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MBEDTLS_ENTROPY_C) || \
|
#undef HAVE_RNG
|
||||||
!defined(MBEDTLS_NET_C) || \
|
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) && \
|
||||||
|
( defined(MBEDTLS_USE_PSA_CRYPTO) || \
|
||||||
|
defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG) )
|
||||||
|
#define HAVE_RNG
|
||||||
|
#elif defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
#define HAVE_RNG
|
||||||
|
#elif defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_HMAC_DRBG_C) && \
|
||||||
|
( defined(MBEDTLS_SHA256_C) || defined(MBEDTLS_SHA512_C) )
|
||||||
|
#define HAVE_RNG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_NET_C) || \
|
||||||
!defined(MBEDTLS_SSL_TLS_C) || \
|
!defined(MBEDTLS_SSL_TLS_C) || \
|
||||||
defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
|
defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
|
||||||
#define MBEDTLS_SSL_TEST_IMPOSSIBLE \
|
#define MBEDTLS_SSL_TEST_IMPOSSIBLE \
|
||||||
"MBEDTLS_ENTROPY_C and/or " \
|
|
||||||
"MBEDTLS_NET_C and/or " \
|
"MBEDTLS_NET_C and/or " \
|
||||||
"MBEDTLS_SSL_TLS_C not defined, " \
|
"MBEDTLS_SSL_TLS_C not defined, " \
|
||||||
"and/or MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined.\n"
|
"and/or MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined.\n"
|
||||||
#elif !( defined(MBEDTLS_CTR_DRBG_C) || \
|
#elif !defined(HAVE_RNG)
|
||||||
defined(MBEDTLS_HMAC_DRBG_C) && ( defined(MBEDTLS_SHA256_C) || \
|
|
||||||
defined(MBEDTLS_SHA512_C) ) )
|
|
||||||
#define MBEDTLS_SSL_TEST_IMPOSSIBLE \
|
#define MBEDTLS_SSL_TEST_IMPOSSIBLE \
|
||||||
"Neither MBEDTLS_CTR_DRBG_C, nor MBEDTLS_HMAC_DRBG_C and a supported hash defined.\n"
|
"No random generator is available.\n"
|
||||||
#else
|
#else
|
||||||
#undef MBEDTLS_SSL_TEST_IMPOSSIBLE
|
#undef MBEDTLS_SSL_TEST_IMPOSSIBLE
|
||||||
|
|
||||||
|
#undef HAVE_RNG
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -76,7 +86,7 @@
|
||||||
#include "mbedtls/timing.h"
|
#include "mbedtls/timing.h"
|
||||||
#include "mbedtls/base64.h"
|
#include "mbedtls/base64.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
#if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_TEST_USE_PSA_CRYPTO_RNG)
|
||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
#include "mbedtls/psa_util.h"
|
#include "mbedtls/psa_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue