Skip to content

Commit

Permalink
Merge pull request #8015 from gojimmypi/pr-mp_read_radix
Browse files Browse the repository at this point in the history
gate test mp_read_radix on OPENSSL_EXTRA or !NO_DSA or HAVE_ECC
  • Loading branch information
JacobBarthelmeh committed Sep 25, 2024
2 parents 2328a7e + 3930720 commit 79b5ec8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -55026,6 +55026,7 @@ static wc_test_ret_t mp_test_cmp(mp_int* a, mp_int* b)
if (ret != MP_GT)
return WC_TEST_RET_ENC_NC;

#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
mp_read_radix(b, "1234567890123456789", MP_RADIX_HEX);
ret = mp_cmp_d(b, -1);
if (ret != MP_GT)
Expand All @@ -55040,9 +55041,12 @@ static wc_test_ret_t mp_test_cmp(mp_int* a, mp_int* b)
ret = mp_cmp(b, b);
if (ret != MP_EQ)
return WC_TEST_RET_ENC_NC;
#endif

#if (!defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_SP_MATH_ALL)) || \
defined(WOLFSSL_SP_INT_NEGATIVE)

#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
mp_read_radix(a, "-1", MP_RADIX_HEX);
mp_read_radix(a, "1", MP_RADIX_HEX);
ret = mp_cmp(a, b);
Expand All @@ -55059,12 +55063,15 @@ static wc_test_ret_t mp_test_cmp(mp_int* a, mp_int* b)
ret = mp_cmp(b, a);
if (ret != MP_LT)
return WC_TEST_RET_ENC_NC;
#endif

#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
mp_read_radix(a, "-2", MP_RADIX_HEX);
ret = mp_cmp(a, b);
if (ret != MP_EQ)
return WC_TEST_RET_ENC_NC;
#endif
#endif

#if defined(HAVE_ECC) && !defined(WC_NO_RNG) && \
defined(WOLFSSL_ECC_GEN_REJECT_SAMPLING)
Expand Down Expand Up @@ -55824,12 +55831,16 @@ static wc_test_ret_t mp_test_invmod(mp_int* a, mp_int* m, mp_int* r)
#endif

#if !defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_INT_NEGATIVE)

#if defined(OPENSSL_EXTRA) || !defined(NO_DSA) || defined(HAVE_ECC)
mp_read_radix(a, "-3", 16);
ret = mp_invmod(a, m, r);
if (ret != MP_OKAY)
return WC_TEST_RET_ENC_EC(ret);
#endif

#endif

#if defined(WOLFSSL_SP_MATH_ALL) && defined(HAVE_ECC)
mp_set(a, 0);
mp_set(m, 3);
Expand Down

0 comments on commit 79b5ec8

Please sign in to comment.