Skip to content

Commit 79226e3

Browse files
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 <[email protected]>
1 parent db1f13b commit 79226e3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/src/fake_external_rng_for_test.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
#include <test/fake_external_rng_for_test.h>
1717

18+
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
19+
#include <psa/crypto_driver_random.h>
20+
#endif
21+
1822
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
1923

2024
#include <test/random.h>
@@ -145,9 +149,15 @@ int mbedtls_platform_get_entropy(unsigned char *output, size_t output_size,
145149
#endif /* MBEDTLS_PLATFORM_GET_ENTROPY_ALT */
146150

147151
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
148-
int mbedtls_platform_get_entropy(unsigned char *output, size_t output_size,
149-
size_t *estimate_bits)
152+
int mbedtls_platform_get_entropy(psa_driver_get_entropy_flags_t flags,
153+
size_t *estimate_bits,
154+
unsigned char *output, size_t output_size)
150155
{
156+
/* We don't implement any flags yet. */
157+
if (flags != 0) {
158+
return PSA_ERROR_NOT_SUPPORTED;
159+
}
160+
151161
int ret = fake_get_entropy(output, output_size, estimate_bits);
152162
return ret;
153163
}

0 commit comments

Comments
 (0)