mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:05:36 +01:00
Omit RSA key generation test if no strong entropy is present
The RSA key generation test needs strong entropy to succeed. This commit captures the presence of a strong entropy source in a preprocessor flag and only runs the key generation test if that flag is set.
This commit is contained in:
parent
f058f34b5a
commit
c6deafc0d4
@ -55,6 +55,16 @@
|
|||||||
#define MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE -0x003D /**< No strong sources have been added to poll. */
|
#define MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE -0x003D /**< No strong sources have been added to poll. */
|
||||||
#define MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR -0x003F /**< Read/write error in file. */
|
#define MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR -0x003F /**< Read/write error in file. */
|
||||||
|
|
||||||
|
/* Indicates whether at least one standard strong entropy source is enabled. */
|
||||||
|
#if defined(MBEDTLS_TEST_NULL_ENTROPY) || \
|
||||||
|
( !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
|
||||||
|
( !defined(MBEDTLS_NO_PLATFORM_ENTROPY) || \
|
||||||
|
defined(MBEDTLS_HAVEGE_C) || \
|
||||||
|
defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
|
||||||
|
defined(ENTROPY_NV_SEED) ) )
|
||||||
|
#define MBEDTLS_ENTROPY_HAVE_STRONG
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name SECTION: Module settings
|
* \name SECTION: Module settings
|
||||||
*
|
*
|
||||||
|
@ -83,6 +83,9 @@ void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
|
|||||||
mbedtls_havege_init( &ctx->havege_data );
|
mbedtls_havege_init( &ctx->havege_data );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Reminder: Update MBEDTLS_ENTROPY_HAVE_STRONG when
|
||||||
|
* adding more strong entropy sources here. */
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_NULL_ENTROPY)
|
#if defined(MBEDTLS_TEST_NULL_ENTROPY)
|
||||||
mbedtls_entropy_add_source( ctx, mbedtls_null_entropy_poll, NULL,
|
mbedtls_entropy_add_source( ctx, mbedtls_null_entropy_poll, NULL,
|
||||||
1, MBEDTLS_ENTROPY_SOURCE_STRONG );
|
1, MBEDTLS_ENTROPY_SOURCE_STRONG );
|
||||||
|
@ -52,10 +52,14 @@ entropy_nv_seed:"000000000000000000000000000000000000000000000000000000000000000
|
|||||||
Check NV seed manually #3
|
Check NV seed manually #3
|
||||||
entropy_nv_seed:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
entropy_nv_seed:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
|
|
||||||
Entropy self test
|
Entropy self test (with strong entropy)
|
||||||
depends_on:!MBEDTLS_TEST_NULL_ENTROPY
|
depends_on:!MBEDTLS_TEST_NULL_ENTROPY:MBEDTLS_ENTROPY_HAVE_STRONG
|
||||||
entropy_selftest:0
|
entropy_selftest:0
|
||||||
|
|
||||||
|
Entropy self test (without strong entropy)
|
||||||
|
depends_on:!MBEDTLS_TEST_NULL_ENTROPY:!MBEDTLS_ENTROPY_HAVE_STRONG
|
||||||
|
entropy_selftest:1
|
||||||
|
|
||||||
Entropy self test (MBEDTLS_TEST_NULL_ENTROPY)
|
Entropy self test (MBEDTLS_TEST_NULL_ENTROPY)
|
||||||
depends_on:MBEDTLS_TEST_NULL_ENTROPY
|
depends_on:MBEDTLS_TEST_NULL_ENTROPY
|
||||||
entropy_selftest:1
|
entropy_selftest:1
|
||||||
|
@ -658,7 +658,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C */
|
/* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_HAVE_STRONG */
|
||||||
void mbedtls_rsa_gen_key( int nrbits, int exponent, int result)
|
void mbedtls_rsa_gen_key( int nrbits, int exponent, int result)
|
||||||
{
|
{
|
||||||
mbedtls_rsa_context ctx;
|
mbedtls_rsa_context ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user