mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-09 23:26:29 -04:00
Force MBEDTLS_PSA_HMAC_DRBG_MD_TYPE based on CTR_DRBG
If MBEDTLS_CTR_DRBG_C is enabled, force MBEDTLS_PSA_HMAC_DRBG_MD_TYPE to be disabled. This resolves the former inconsistency in builds where MBEDTLS_PSA_HMAC_DRBG_MD_TYPE is explicitly defined but MBEDTLS_CTR_DRBG_C remains enabled, where PSA called the CTR_DRBG functions but other parts of the code based assumed that HMAC was in use, in particular error code conversions (leading to a test failure in test_suite_psa_crypto_init). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
6b32ac74e7
commit
e752eaf73a
@ -39,13 +39,10 @@ int mbedtls_psa_get_random(void *p_rng,
|
|||||||
#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
|
||||||
|
|
||||||
/* Choose a DRBG based on configuration and availability */
|
/* Choose a DRBG based on configuration and availability */
|
||||||
#if defined(MBEDTLS_PSA_HMAC_DRBG_MD_TYPE)
|
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
|
||||||
#include "mbedtls/hmac_drbg.h"
|
|
||||||
|
|
||||||
#elif defined(MBEDTLS_CTR_DRBG_C)
|
|
||||||
|
|
||||||
#include "mbedtls/ctr_drbg.h"
|
#include "mbedtls/ctr_drbg.h"
|
||||||
|
#undef MBEDTLS_PSA_HMAC_DRBG_MD_TYPE
|
||||||
|
|
||||||
#elif defined(MBEDTLS_HMAC_DRBG_C)
|
#elif defined(MBEDTLS_HMAC_DRBG_C)
|
||||||
|
|
||||||
@ -67,9 +64,11 @@ int mbedtls_psa_get_random(void *p_rng,
|
|||||||
#error "No hash algorithm available for HMAC_DBRG."
|
#error "No hash algorithm available for HMAC_DBRG."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else /* !MBEDTLS_CTR_DRBG_C && !MBEDTLS_HMAC_DRBG_C*/
|
||||||
|
|
||||||
#error "No DRBG module available for the psa_crypto module."
|
#error "No DRBG module available for the psa_crypto module."
|
||||||
#endif
|
|
||||||
|
#endif /* !MBEDTLS_CTR_DRBG_C && !MBEDTLS_HMAC_DRBG_C*/
|
||||||
|
|
||||||
#include "mbedtls/entropy.h"
|
#include "mbedtls/entropy.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user