From 79226e358d98e040478958616fcf6247b223bd19 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 8 Jul 2025 21:37:14 +0200 Subject: [PATCH] Add a flags parameter to the get_entropy callback Finish aligning the prototype of `mbedtls_platform_get_entropy()` with the prototype of the `"get_entropy"` entry point in PSA entropy drivers: move the `estimate_bits` parameter, and add the `flags` parameter. For the time being, no flags are supported. Signed-off-by: Gilles Peskine --- tests/src/fake_external_rng_for_test.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/src/fake_external_rng_for_test.c b/tests/src/fake_external_rng_for_test.c index d8905708d..14a87365b 100644 --- a/tests/src/fake_external_rng_for_test.c +++ b/tests/src/fake_external_rng_for_test.c @@ -15,6 +15,10 @@ #include +#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY) +#include +#endif + #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) #include @@ -145,9 +149,15 @@ int mbedtls_platform_get_entropy(unsigned char *output, size_t output_size, #endif /* MBEDTLS_PLATFORM_GET_ENTROPY_ALT */ #if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY) -int mbedtls_platform_get_entropy(unsigned char *output, size_t output_size, - size_t *estimate_bits) +int mbedtls_platform_get_entropy(psa_driver_get_entropy_flags_t flags, + size_t *estimate_bits, + unsigned char *output, size_t output_size) { + /* We don't implement any flags yet. */ + if (flags != 0) { + return PSA_ERROR_NOT_SUPPORTED; + } + int ret = fake_get_entropy(output, output_size, estimate_bits); return ret; }