Add support for prime checking to sp_int.c

This allows SP to support:
- DH parameter checking
- DH parameter generation
- RSA key generation
Improved performance of sp_mod operation.
Reworked some functions to have one exit point (return statement).
Fixed sp_sub_d().
Changed tests to perform 2048-bit RSA key generation only when using SP
math.

Fixed Intel x86_64 C file to not have DH specific functions available
unless WOLFSSL_HAVE_SP_DH is defined.
Fixed tfm to return an error when t is not the correct size in
fp_isprime_ex().
This commit is contained in:
Sean Parkinson
2019-09-19 09:08:15 +10:00
parent 9d69f17f17
commit 0bc16d47e2
10 changed files with 1376 additions and 169 deletions

View File

@@ -4037,6 +4037,9 @@ if test "$ENABLED_SP_MATH" = "yes"; then
if test "$ENABLED_SP_DH" = "no" && test "$ENABLED_DH" = "yes"; then
AC_MSG_ERROR([Cannot use P256 single precision only math and DH])
fi
ENABLED_FASTMATH="no"
ENABLED_SLOWMATH="no"
fi
if test "$ENABLED_SP_MATH" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SP_MATH"
@@ -4538,9 +4541,9 @@ then
fi
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
fi
if test "$ENABLED_SP_MATH" = "yes" && test "$ENABLED_KEYGEN" = "yes"; then
AC_MSG_ERROR([Cannot use single precision math and key generation])
fi
#if test "$ENABLED_SP_MATH" = "yes" && test "$ENABLED_KEYGEN" = "yes"; then
# AC_MSG_ERROR([Cannot use single precision math and key generation])
#fi
if test "x$ENABLED_PKCS7" = "xyes"
then