fix github issue #35, allow user to pick ecc curves with ECC_USER_CURVES and separate HAVE_ECCxxx defines

This commit is contained in:
toddouska
2015-03-18 13:36:07 -07:00
parent 145123ff64
commit 0316dd2ef6
3 changed files with 36 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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 */