From c0a1a319dfbe89878c9497b12ab43ea0869c6ffc Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Sun, 4 Dec 2011 17:12:15 +0000 Subject: [PATCH] - Moved test to entropy and CTR_DRBG --- tests/suites/test_suite_rsa.data | 8 ++++---- tests/suites/test_suite_rsa.function | 14 ++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/suites/test_suite_rsa.data b/tests/suites/test_suite_rsa.data index 4110debb5..da41d234b 100644 --- a/tests/suites/test_suite_rsa.data +++ b/tests/suites/test_suite_rsa.data @@ -306,19 +306,19 @@ RSA Public (Data larger than N) rsa_public:"b38ac65c8141f7f5c96e14470e851936a67bf94cc6821a39ac12c05f7c0b06d9e6ddba2224703b02e25f31452f9c4a8417b62675fdc6df46b94813bc7b9769a892c482b830bfe0ad42e46668ace68903617faf6681f4babf1cc8e4b0420d3c7f61dc45434c6b54e2c3ee0fc07908509d79c9826e673bf8363255adb0add2401039a7bcd1b4ecf0fbe6ec8369d2da486eec59559dd1d54c9b24190965eafbdab203b35255765261cd0909acf93c3b8b8428cbb448de4715d1b813d0c94829c229543d391ce0adab5351f97a3810c1f73d7b1458b97daed4209c50e16d064d2d5bfda8c23893d755222793146d0a78c3d64f35549141486c3b0961a7b4c1a2034f":2048:16:"b38ac65c8141f7f5c96e14470e851936a67bf94cc6821a39ac12c05f7c0b06d9e6ddba2224703b02e25f31452f9c4a8417b62675fdc6df46b94813bc7b9769a892c482b830bfe0ad42e46668ace68903617faf6681f4babf1cc8e4b0420d3c7f61dc45434c6b54e2c3ee0fc07908509d79c9826e673bf8363255adb0add2401039a7bcd1b4ecf0fbe6ec8369d2da486eec59559dd1d54c9b24190965eafbdab203b35255765261cd0909acf93c3b8b8428cbb448de4715d1b813d0c94829c229543d391ce0adab5351f97a3810c1f73d7b1458b97daed4209c50e16d064d2d5bfda8c23893d755222793146d0a78c3d64f35549141486c3b0961a7b4c1a2034f":16:"3":"605baf947c0de49e4f6a0dfb94a43ae318d5df8ed20ba4ba5a37a73fb009c5c9e5cce8b70a25b1c7580f389f0d7092485cdfa02208b70d33482edf07a7eafebdc54862ca0e0396a5a7d09991b9753eb1ffb6091971bb5789c6b121abbcd0a3cbaa39969fa7c28146fce96c6d03272e3793e5be8f5abfa9afcbebb986d7b3050604a2af4d3a40fa6c003781a539a60259d1e84f13322da9e538a49c369b83e7286bf7d30b64bbb773506705da5d5d5483a563a1ffacc902fb75c9a751b1e83cdc7a6db0470056883f48b5a5446b43b1d180ea12ba11a6a8d93b3b32a30156b6084b7fb142998a2a0d28014b84098ece7d9d5e4d55cc342ca26f5a0167a679dec8":POLARSSL_ERR_RSA_BAD_INPUT_DATA RSA Generate Key -depends_on:POLARSSL_HAVEGE_C +depends_on:POLARSSL_ENTROPY_C:POLARSSL_CTR_DRBG_C rsa_gen_key:128:3:0 RSA Generate Key (Number of bits too small) -depends_on:POLARSSL_HAVEGE_C +depends_on:POLARSSL_ENTROPY_C:POLARSSL_CTR_DRBG_C rsa_gen_key:127:3:POLARSSL_ERR_RSA_BAD_INPUT_DATA RSA Generate Key (Exponent too small) -depends_on:POLARSSL_HAVEGE_C +depends_on:POLARSSL_ENTROPY_C:POLARSSL_CTR_DRBG_C rsa_gen_key:128:2:POLARSSL_ERR_RSA_BAD_INPUT_DATA RSA Generate Key -depends_on:POLARSSL_HAVEGE_C +depends_on:POLARSSL_ENTROPY_C:POLARSSL_CTR_DRBG_C rsa_gen_key:1024:3:0 RSA PKCS1 Encrypt Bad RNG diff --git a/tests/suites/test_suite_rsa.function b/tests/suites/test_suite_rsa.function index 15048cd2c..7909903a0 100644 --- a/tests/suites/test_suite_rsa.function +++ b/tests/suites/test_suite_rsa.function @@ -6,7 +6,8 @@ BEGIN_HEADER #include #include #include -#include +#include +#include END_HEADER BEGIN_DEPENDENCIES @@ -509,12 +510,17 @@ BEGIN_CASE rsa_gen_key:nrbits:exponent:result { rsa_context ctx; - havege_state hs; + entropy_context entropy; + ctr_drbg_context ctr_drbg; + char *pers = "test_suite_rsa"; + + entropy_init( &entropy ); + TEST_ASSERT( ctr_drbg_init( &ctr_drbg, entropy_func, &entropy, + (unsigned char *) pers, strlen( pers ) ) == 0 ); - havege_init( &hs ); rsa_init( &ctx, 0, 0 ); - TEST_ASSERT( rsa_gen_key( &ctx, havege_random, &hs, {nrbits}, {exponent} ) == {result} ); + TEST_ASSERT( rsa_gen_key( &ctx, ctr_drbg_random, &ctr_drbg, {nrbits}, {exponent} ) == {result} ); if( {result} == 0 ) { TEST_ASSERT( rsa_check_privkey( &ctx ) == 0 );