configure.ac: fix -DNO_BIG_INT setup to recognize $ENABLED_SP_MATH.

wolfcrypt/test/test.c: fix gating around modLen in rsa_test().

wolfssl/openssl/bn.h: remove superfluous WOLFSSL_SP_MATH gate around mp_int mpi
  in struct WOLFSSL_BIGNUM definition.

wolfssl/wolfcrypt/wolfmath.h: add check for "Conflicting MPI settings.", add
  initial check for WOLFSSL_SP_MATH_ALL || WOLFSSL_SP_MATH to include sp_int.h,
  and remove superfluous WOLFSSL_SP_MATH gate on "common math functions".
This commit is contained in:
Daniel Pouzzner
2025-03-20 22:18:22 -05:00
parent e870e7f6d2
commit 57ecd4b246
4 changed files with 16 additions and 7 deletions

View File

@@ -9809,8 +9809,8 @@ AS_IF([test "x$ENABLED_16BIT" = "xyes" && \
################################################################################
# Update CFLAGS based on options #
################################################################################
AS_IF([test "x$ENABLED_SP_MATH_ALL" = "xno" && test "x$ENABLED_FASTMATH" = "xno" &&
test "x$ENABLED_HEAPMATH" = "xno"],
AS_IF([test "$ENABLED_SP_MATH" = "no" && test "$ENABLED_SP_MATH_ALL" = "no" &&
test "$ENABLED_FASTMATH" = "no" && test "$ENABLED_HEAPMATH" = "no"],
[AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"])
AS_IF([test "x$ENABLED_CERTS" = "xno"],

View File

@@ -22109,13 +22109,15 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_rsa);
#endif
#if !defined(NO_SIG_WRAPPER) && !defined(NO_SHA256)
#ifndef NO_SIG_WRAPPER
#ifndef NO_SHA256
ret = rsa_sig_test(key, sizeof *key, modLen, &rng);
if (ret != 0)
goto exit_rsa;
#else
#else /* NO_SHA256 */
(void)modLen;
#endif
#endif /* NO_SHA256 */
#endif /* !NO_SIG_WRAPPER */
#ifdef WC_RSA_NONBLOCK
ret = rsa_nb_test(key, in, inLen, out, outSz, plain, plainSz, &rng);

View File

@@ -40,7 +40,7 @@
typedef struct WOLFSSL_BIGNUM {
int neg; /* openssh deference */
void *internal; /* our big num */
#if !defined(NO_BIG_INT) || defined(WOLFSSL_SP_MATH)
#if !defined(NO_BIG_INT)
mp_int mpi;
#endif
} WOLFSSL_BIGNUM;

View File

@@ -42,6 +42,13 @@ This library provides big integer math functions.
#if defined(NO_BIG_INT)
/* MPI globally disabled -- no PK algorithms supported. */
#if defined(USE_FAST_MATH) || defined(USE_INTEGER_HEAP_MATH) || \
defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH) || \
defined(HAVE_WOLF_BIGINT) || defined(WOLFSSL_EXPORT_INT)
#error Conflicting MPI settings.
#endif
#elif defined(WOLFSSL_SP_MATH_ALL) || defined(WOLFSSL_SP_MATH)
#include <wolfssl/wolfcrypt/sp_int.h>
#elif defined(USE_FAST_MATH)
#include <wolfssl/wolfcrypt/tfm.h>
#elif defined(USE_INTEGER_HEAP_MATH)
@@ -74,7 +81,7 @@ This library provides big integer math functions.
extern const wc_ptr_t wc_off_on_addr[2];
#endif
#if !defined(NO_BIG_INT) || defined(WOLFSSL_SP_MATH)
#if !defined(NO_BIG_INT)
/* common math functions */
MP_API int get_digit_count(const mp_int* a);
MP_API mp_digit get_digit(const mp_int* a, int n);