From 5e2502fa9543b0fcd07bc144a1832fdae5d01e4c Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 19 Jul 2016 14:34:32 -0700 Subject: [PATCH] ECC without Shamir has issues testing all zero's digest, so disable this test if not using Shamir method. Fixed comment about "NO_ECC_SECP". --- wolfcrypt/src/ecc.c | 2 +- wolfcrypt/test/test.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index cbb5e2c07..15fd09327 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -47,7 +47,7 @@ Possible ECC enable options: /* ECC Curve Types: - * NO_ECC_SECP Disables SECP curves default: on + * NO_ECC_SECP Disables SECP curves default: off (not defined) * HAVE_ECC_SECPR2 Enables SECP R2 curves default: off * HAVE_ECC_SECPR3 Enables SECP R3 curves default: off * HAVE_ECC_BRAINPOOL Enables Brainpool curves default: off diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 9a1da93ed..b33d24ce7 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -6822,11 +6822,11 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount, #endif /* HAVE_ECC_KEY_EXPORT */ #ifdef HAVE_ECC_SIGN +#ifdef ECC_SHAMIR /* test DSA sign hash with zeros */ for (i = 0; i < (int)sizeof(digest); i++) { digest[i] = 0; } - digest[i-1] = 1; /* Set last digit to non-zero value */ x = sizeof(sig); ret = wc_ecc_sign_hash(digest, sizeof(digest), sig, &x, rng, &userA); @@ -6844,6 +6844,7 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount, ERROR_OUT(-1016, done); } #endif /* HAVE_ECC_VERIFY */ +#endif /* ECC_SHAMIR */ /* test DSA sign hash with sequence (0,1,2,3,4,...) */ for (i = 0; i < (int)sizeof(digest); i++) {