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"
|
if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||||
then
|
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
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -177,6 +177,18 @@ then
|
|||||||
fi
|
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
|
# fastmath
|
||||||
AC_ARG_ENABLE(fastmath,
|
AC_ARG_ENABLE(fastmath,
|
||||||
[ --enable-fastmath Enable fast math for BigInts (default: disabled)],
|
[ --enable-fastmath Enable fast math for BigInts (default: disabled)],
|
||||||
@ -184,6 +196,11 @@ AC_ARG_ENABLE(fastmath,
|
|||||||
[ ENABLED_FASTMATH=no ]
|
[ ENABLED_FASTMATH=no ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if test "$ENABLED_BUMP" = "yes"
|
||||||
|
then
|
||||||
|
ENABLED_FASTMATH="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$ENABLED_FASTMATH" = "xyes"
|
if test "x$ENABLED_FASTMATH" = "xyes"
|
||||||
then
|
then
|
||||||
AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
|
AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
|
||||||
@ -419,18 +436,6 @@ fi
|
|||||||
AM_CONDITIONAL([BUILD_NOINLINE], [test "x$ENABLED_NOINLINE" = "xyes"])
|
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
|
# ECC
|
||||||
AC_ARG_ENABLE(ecc,
|
AC_ARG_ENABLE(ecc,
|
||||||
[ --enable-ecc Enable ECC (default: disabled)],
|
[ --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"
|
if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||||
then
|
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
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -473,7 +478,7 @@ AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
|
|||||||
|
|
||||||
if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
|
if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
|
||||||
then
|
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
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,13 @@ word32 CheckRunTimeSettings(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* math settings size check */
|
||||||
|
word32 CheckRunTimeFastMath(void)
|
||||||
|
{
|
||||||
|
return FP_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
||||||
|
@ -137,6 +137,11 @@ void ctaocrypt_test(void* args)
|
|||||||
if (CheckCtcSettings() != 1)
|
if (CheckCtcSettings() != 1)
|
||||||
err_sys("Build vs runtime math mismatch\n", -1234);
|
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()) )
|
if ( (ret = md5_test()) )
|
||||||
err_sys("MD5 test failed!\n", ret);
|
err_sys("MD5 test failed!\n", ret);
|
||||||
else
|
else
|
||||||
|
@ -226,7 +226,9 @@
|
|||||||
*
|
*
|
||||||
* It defaults to 4096-bits [allowing multiplications upto 2048x2048 bits ]
|
* 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))
|
#define FP_MAX_SIZE (FP_MAX_BITS+(8*DIGIT_BIT))
|
||||||
|
|
||||||
/* will this lib work? */
|
/* 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);
|
int mp_prime_is_prime(mp_int* a, int t, int* result);
|
||||||
#endif /* CYASSL_KEY_GEN */
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user