add fastmath to bump, add fastmath FP_MAX_BITS runtime check
This commit is contained in:
parent
290f94c8ad
commit
340f275a8a
35
configure.ac
35
configure.ac
@ -160,7 +160,7 @@ fi
|
||||
|
||||
if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||
then
|
||||
AC_MSG_ERROR([can't enable small and opensslExtra, only one or the other.])
|
||||
AC_MSG_ERROR([cannot enable small and opensslExtra, only one or the other.])
|
||||
fi
|
||||
|
||||
|
||||
@ -177,6 +177,18 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# ssl bump build
|
||||
AC_ARG_ENABLE(bump,
|
||||
[ --enable-bump Enable SSL Bump build (default: disabled)],
|
||||
[ ENABLED_BUMP=$enableval ],
|
||||
[ ENABLED_BUMP=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_BUMP" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DOPENSSL_EXTRA -DFP_MAX_BITS=8192"
|
||||
fi
|
||||
|
||||
# fastmath
|
||||
AC_ARG_ENABLE(fastmath,
|
||||
[ --enable-fastmath Enable fast math for BigInts (default: disabled)],
|
||||
@ -184,6 +196,11 @@ AC_ARG_ENABLE(fastmath,
|
||||
[ ENABLED_FASTMATH=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_BUMP" = "yes"
|
||||
then
|
||||
ENABLED_FASTMATH="yes"
|
||||
fi
|
||||
|
||||
if test "x$ENABLED_FASTMATH" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
|
||||
@ -419,18 +436,6 @@ fi
|
||||
AM_CONDITIONAL([BUILD_NOINLINE], [test "x$ENABLED_NOINLINE" = "xyes"])
|
||||
|
||||
|
||||
# ssl bump build
|
||||
AC_ARG_ENABLE(bump,
|
||||
[ --enable-bump Enable SSL Bump build (default: disabled)],
|
||||
[ ENABLED_BUMP=$enableval ],
|
||||
[ ENABLED_BUMP=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_BUMP" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DOPENSSL_EXTRA"
|
||||
fi
|
||||
|
||||
# ECC
|
||||
AC_ARG_ENABLE(ecc,
|
||||
[ --enable-ecc Enable ECC (default: disabled)],
|
||||
@ -448,7 +453,7 @@ AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
|
||||
|
||||
if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||
then
|
||||
AC_MSG_ERROR([can't enable ecc and small, ecc requires TLS which small turns off.])
|
||||
AC_MSG_ERROR([cannot enable ecc and small, ecc requires TLS which small turns off.])
|
||||
fi
|
||||
|
||||
|
||||
@ -473,7 +478,7 @@ AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
|
||||
|
||||
if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||
then
|
||||
AC_MSG_ERROR([can't enable ntru and small, ntru requires TLS which small turns off.])
|
||||
AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -50,6 +50,13 @@ word32 CheckRunTimeSettings(void)
|
||||
}
|
||||
|
||||
|
||||
/* math settings size check */
|
||||
word32 CheckRunTimeFastMath(void)
|
||||
{
|
||||
return FP_SIZE;
|
||||
}
|
||||
|
||||
|
||||
/* Functions */
|
||||
|
||||
void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
||||
|
@ -137,6 +137,11 @@ void ctaocrypt_test(void* args)
|
||||
if (CheckCtcSettings() != 1)
|
||||
err_sys("Build vs runtime math mismatch\n", -1234);
|
||||
|
||||
#ifdef USE_FAST_MATH
|
||||
if (CheckFastMathSettings() != 1)
|
||||
err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235);
|
||||
#endif
|
||||
|
||||
if ( (ret = md5_test()) )
|
||||
err_sys("MD5 test failed!\n", ret);
|
||||
else
|
||||
|
@ -226,7 +226,9 @@
|
||||
*
|
||||
* It defaults to 4096-bits [allowing multiplications upto 2048x2048 bits ]
|
||||
*/
|
||||
#define FP_MAX_BITS 4096
|
||||
#ifndef FP_MAX_BITS
|
||||
#define FP_MAX_BITS 4096
|
||||
#endif
|
||||
#define FP_MAX_SIZE (FP_MAX_BITS+(8*DIGIT_BIT))
|
||||
|
||||
/* will this lib work? */
|
||||
@ -668,6 +670,11 @@ int mp_sub_d(fp_int *a, fp_digit b, fp_int *c);
|
||||
int mp_prime_is_prime(mp_int* a, int t, int* result);
|
||||
#endif /* CYASSL_KEY_GEN */
|
||||
|
||||
CYASSL_API word32 CheckRunTimeFastMath(void);
|
||||
|
||||
/* If user uses RSA, DH, DSA, or ECC math lib directly then fast math FP_SIZE
|
||||
must match, return 1 if a match otherwise 0 */
|
||||
#define CheckFastMathSettings() (FP_SIZE == CheckRunTimeFastMath())
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user