Skip to content

Commit 460af03

Browse files
Merge pull request #208 from ronald-cron-arm/entropy-rng-clean-up
Cleanup following the simplification of entropy and RNG options
2 parents bac469c + bb7434e commit 460af03

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

scripts/all-helpers.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ helper_psasim_config() {
139139
scripts/config.py full
140140
scripts/config.py unset MBEDTLS_PSA_CRYPTO_C
141141
scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C
142+
scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
143+
scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT
142144
if in_mbedtls_repo && in_3_6_branch; then
143145
# Dynamic secure element support is a deprecated feature and it is not
144146
# available when CRYPTO_C and PSA_CRYPTO_STORAGE_C are disabled.

tests/include/test/fake_external_rng_for_test.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void mbedtls_test_enable_insecure_external_rng(void);
3737
void mbedtls_test_disable_insecure_external_rng(void);
3838
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
3939

40-
#if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
40+
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
4141

4242
#include <mbedtls/platform.h>
4343

@@ -73,6 +73,6 @@ void mbedtls_test_platform_get_entropy_set_entropy_content(size_t val);
7373
/* Return the number of times mbedtls_platform_get_entropy() was called. */
7474
size_t mbedtls_test_platform_get_entropy_get_call_count(void);
7575

76-
#endif /* MBEDTLS_PLATFORM_GET_ENTROPY_ALT || MBEDTLS_PSA_DRIVER_GET_ENTROPY */
76+
#endif /* MBEDTLS_PSA_DRIVER_GET_ENTROPY */
7777

7878
#endif /* FAKE_EXTERNAL_RNG_FOR_TEST_H */

tests/src/fake_external_rng_for_test.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ psa_status_t mbedtls_psa_external_get_random(
5555

5656
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
5757

58-
#if defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT) || defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
58+
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
5959

6060
#include <test/random.h>
6161

@@ -130,7 +130,7 @@ static int fake_get_entropy(unsigned char *output, size_t output_size,
130130
return 0;
131131
}
132132

133-
#endif /* MBEDTLS_PLATFORM_GET_ENTROPY_ALT || MBEDTLS_PSA_DRIVER_GET_ENTROPY */
133+
#endif /* MBEDTLS_PSA_DRIVER_GET_ENTROPY */
134134

135135
#if defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
136136
int mbedtls_platform_get_entropy(psa_driver_get_entropy_flags_t flags,
@@ -145,18 +145,4 @@ int mbedtls_platform_get_entropy(psa_driver_get_entropy_flags_t flags,
145145
int ret = fake_get_entropy(output, output_size, estimate_bits);
146146
return ret;
147147
}
148-
#elif defined(MBEDTLS_PLATFORM_GET_ENTROPY_ALT)
149-
int mbedtls_platform_get_entropy(unsigned char *output, size_t output_size,
150-
size_t *output_len, size_t *entropy_content)
151-
{
152-
int ret = fake_get_entropy(output, output_size, entropy_content);
153-
if (ret == 0) {
154-
if (platform_get_entropy_forced_output_len == SIZE_MAX) {
155-
*output_len = output_size;
156-
} else {
157-
*output_len = platform_get_entropy_forced_output_len;
158-
}
159-
}
160-
return ret;
161-
}
162-
#endif /* MBEDTLS_PLATFORM_GET_ENTROPY_ALT */
148+
#endif /* MBEDTLS_PSA_DRIVER_GET_ENTROPY */

0 commit comments

Comments
 (0)