mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-08-01 00:37:47 +00:00
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]>
This commit is contained in:
@@ -15,6 +15,10 @@
|
||||
|
||||
#include <test/fake_external_rng_for_test.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
|
||||
#include <psa/crypto_driver_random.h>
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||
|
||||
#include <test/random.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user