diff --git a/configure.ac b/configure.ac index c93569ed6..9fa9d41d0 100644 --- a/configure.ac +++ b/configure.ac @@ -1032,7 +1032,7 @@ AC_ARG_ENABLE([asn], if test "$ENABLED_ASN" = "no" then AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS" - if test "$ENABLED_DH" = "no" + if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" == "no" then # DH needs bigint AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT" @@ -1056,18 +1056,21 @@ then AC_MSG_ERROR([please disable dsa if disabling asn.]) fi -if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no" +if test "x$ENABLED_CRYPTONLY" = "xyes" then - AC_MSG_ERROR([please disable ecc if disabling asn.]) -fi + if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no" + then + AC_MSG_ERROR([please disable ecc if disabling asn.]) + fi -if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no" -then - AC_MSG_ERROR([please enable psk if disabling asn.]) + if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no" + then + AC_MSG_ERROR([please enable psk if disabling asn.]) + fi fi # DH needs bigint -if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" +if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" then ENABLED_FASTMATH=no ENABLED_SLOWMATH=no @@ -2182,7 +2185,7 @@ then # turn off fastmth if leanpsk on or asn off (w/o dh) if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no" then - if test "$ENABLED_DH" = "no" + if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no" then ENABLED_FASTMATH=no else diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 83bdbf105..c3e875460 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -1671,7 +1671,9 @@ void bench_eccKeyAgree(void) double start, total, each, milliEach; int i, ret; byte shared[32]; +#ifndef NO_ASN byte sig[64+16]; /* der encoding too */ +#endif byte digest[32]; word32 x = 0; @@ -1712,6 +1714,7 @@ void bench_eccKeyAgree(void) digest[i] = (byte)i; +#ifndef NO_ASN start = current_time(1); for(i = 0; i < agreeTimes; i++) { @@ -1739,6 +1742,7 @@ void bench_eccKeyAgree(void) return; } } +#endif total = current_time(0) - start; each = total / agreeTimes; /* per second */ diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 8b7c79d96..a56bf67bf 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -1832,6 +1832,7 @@ int wc_ecc_init(ecc_key* key) } +#ifndef NO_ASN /** Sign a message digest in The message digest to sign @@ -1865,6 +1866,7 @@ int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen, return err; } +#endif /* !NO_ASN */ /** Sign a message digest @@ -2226,6 +2228,7 @@ static int ecc_mul2add(ecc_point* A, mp_int* kA, +#ifndef NO_ASN /* verify * * w = s^-1 mod n @@ -2276,6 +2279,7 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash, return err; } +#endif /* !NO_ASN */ /** Verify an ECC signature @@ -3112,6 +3116,7 @@ int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub, return ret; } +#ifndef NO_ASN /** Convert ECC R,S to signature r R component of signature @@ -3151,6 +3156,7 @@ int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen) return err; } +#endif /* !NO_ASN */ /** Import raw ECC key diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index ee11c6ccb..f17cd5a86 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -6172,11 +6172,14 @@ int ecc_test(void) WC_RNG rng; byte sharedA[1024]; byte sharedB[1024]; +#ifndef NO_ASN byte sig[1024]; + int verify; +#endif byte digest[20]; byte exportBuf[1024]; word32 x, y; - int i, verify, ret; + int i, ret; ecc_key userA, userB, pubKey; ret = wc_InitRng(&rng); @@ -6266,6 +6269,7 @@ int ecc_test(void) for (i = 0; i < (int)sizeof(digest); i++) digest[i] = (byte)i; +#ifndef NO_ASN x = sizeof(sig); ret = wc_ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA); @@ -6280,6 +6284,7 @@ int ecc_test(void) if (verify != 1) return -1016; +#endif x = sizeof(exportBuf); ret = wc_ecc_export_private_only(&userA, exportBuf, &x);