diff --git a/configure.ac b/configure.ac index 9de62ae66..f16facdfa 100644 --- a/configure.ac +++ b/configure.ac @@ -199,6 +199,9 @@ then # Enable multiple attribute additions such as DC AM_CFLAGS="-DWOLFSSL_MULTI_ATTRIB $AM_CFLAGS" + + # Enable checks on ECC keys that are imported + AM_CFLAGS="-DWOLFSSL_VALIDATE_ECC_IMPORT $AM_CFLAGS" fi @@ -1626,6 +1629,9 @@ then AC_MSG_ERROR([cannot enable fpecc without enabling ecc.]) fi AM_CFLAGS="$AM_CFLAGS -DFP_ECC" + + # Enable checks on ECC keys that are imported + AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_VALIDATE_ECC_IMPORT" fi diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 668253303..4c81c653f 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -965,7 +965,7 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) #endif { /* b cannot be negative */ - if (b->sign == MP_NEG || mp_iszero(b) == MP_YES) { + if (b->sign == MP_NEG || mp_iszero(b) == MP_YES || mp_iszero(a) == MP_YES) { return MP_VAL; }