diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index d246e46f8..27f41f49e 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -50,14 +50,32 @@ */ -#define ECC112 -#define ECC128 -#define ECC160 -#define ECC192 -#define ECC224 -#define ECC256 -#define ECC384 -#define ECC521 + +/* p256 curve on by default whether user curves or not */ +#if defined(HAVE_ECC112) || defined(HAVE_ALL_CURVES) + #define ECC112 +#endif +#if defined(HAVE_ECC128) || defined(HAVE_ALL_CURVES) + #define ECC128 +#endif +#if defined(HAVE_ECC160) || defined(HAVE_ALL_CURVES) + #define ECC160 +#endif +#if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES) + #define ECC192 +#endif +#if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES) + #define ECC224 +#endif +#if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES) + #define ECC256 +#endif +#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES) + #define ECC384 +#endif +#if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES) + #define ECC521 +#endif diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 200c07f18..93134c890 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -4882,6 +4882,7 @@ int ecc_test(void) if (ret != 0) return -1017; +#if (defined(HAVE_ECC192) && defined(HAVE_ECC224)) || defined(HAVE_ALL_CURVES) { /* test raw ECC key import */ Sha sha; @@ -4964,6 +4965,7 @@ int ecc_test(void) return -1023 - i; } } +#endif /* defined(HAVE_ECC192) && defined(HAVE_ECC256) */ #ifdef WOLFSSL_KEY_GEN diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 331079d34..b2edbe206 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -740,6 +740,14 @@ #pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */ #endif +/* user can specify what curves they want with ECC_USER_CURVES otherwise + * all curves are on by default for now */ +#ifndef ECC_USER_CURVES + #ifndef HAVE_ALL_CURVES + #define HAVE_ALL_CURVES + #endif +#endif + /* Place any other flags or defines here */