Fix tests to handle ECC < 224 not enabled.

This commit is contained in:
David Garske
2020-10-16 15:53:09 -07:00
parent 6bd98afdd0
commit b13848e568
2 changed files with 24 additions and 21 deletions

View File

@ -56,8 +56,9 @@
#ifndef ECC_PRIV_KEY_BUF
#define ECC_PRIV_KEY_BUF 66 /* For non user defined curves. */
#endif
#ifdef HAVE_ALL_CURVES
/* ecc key sizes: 14, 16, 20, 24, 28, 30, 32, 40, 48, 64*/
/* ecc key sizes: 14, 16, 20, 24, 28, 30, 32, 40, 48, 64 */
/* logic to choose right key ECC size */
#if defined(HAVE_ALL_CURVES) && defined(ECC_WEAK_CURVES)
#ifndef KEY14
#define KEY14 14
#endif
@ -70,6 +71,21 @@
#if !defined(KEY24)
#define KEY24 24
#endif
#else
#ifndef KEY14
#define KEY14 32
#endif
#if !defined(KEY16)
#define KEY16 32
#endif
#if !defined(KEY20)
#define KEY20 32
#endif
#if !defined(KEY24)
#define KEY24 32
#endif
#endif
#ifdef HAVE_ALL_CURVES
#if !defined(KEY28)
#define KEY28 28
#endif
@ -89,19 +105,6 @@
#define KEY64 64
#endif
#else
/* ecc key sizes: 14, 16, 20, 24, 28, 30, 32, 40, 48, 64*/
#ifndef KEY14
#define KEY14 32
#endif
#if !defined(KEY16)
#define KEY16 32
#endif
#if !defined(KEY20)
#define KEY20 32
#endif
#if !defined(KEY24)
#define KEY24 32
#endif
#if !defined(KEY28)
#define KEY28 32
#endif

View File

@ -21868,31 +21868,31 @@ static int ecc_test(void)
return -9900;
#endif
#if defined(HAVE_ECC112) || defined(HAVE_ALL_CURVES)
#if (defined(HAVE_ECC112) || defined(HAVE_ALL_CURVES)) && defined(ECC_WEAK_CURVES)
ret = ecc_test_curve(&rng, 14);
if (ret < 0) {
goto done;
}
#endif /* HAVE_ECC112 */
#if defined(HAVE_ECC128) || defined(HAVE_ALL_CURVES)
#if (defined(HAVE_ECC128) || defined(HAVE_ALL_CURVES)) && defined(ECC_WEAK_CURVES)
ret = ecc_test_curve(&rng, 16);
if (ret < 0) {
goto done;
}
#endif /* HAVE_ECC128 */
#if defined(HAVE_ECC160) || defined(HAVE_ALL_CURVES)
#if (defined(HAVE_ECC160) || defined(HAVE_ALL_CURVES)) && defined(ECC_WEAK_CURVES)
ret = ecc_test_curve(&rng, 20);
if (ret < 0) {
goto done;
}
#endif /* HAVE_ECC160 */
#if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)
#if (defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES)) && defined(ECC_WEAK_CURVES)
ret = ecc_test_curve(&rng, 24);
if (ret < 0) {
goto done;
}
#endif /* HAVE_ECC192 */
#if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)
#if (defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES)) && defined(ECC_WEAK_CURVES)
ret = ecc_test_curve(&rng, 28);
if (ret < 0) {
goto done;