Skip to content

Commit a035b04

Browse files
Only run SRP tests with at least 3072 bits.
The SRP buffers are 192 bytes, so they need a minimum of 3072 bits. If the bit size is too low, wc_SrpGetVerifier will return MP_VAL as the buffers won't fit.
1 parent 8395410 commit a035b04

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,8 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
22172217
TEST_PASS("DSA test passed!\n");
22182218
#endif
22192219

2220-
#ifdef WOLFCRYPT_HAVE_SRP
2220+
#if defined(WOLFCRYPT_HAVE_SRP) && ((defined(FP_MAX_BITS) && (FP_MAX_BITS >= 3072)) \
2221+
|| (defined(SP_INT_BITS) && (SP_INT_BITS >= 3072)))
22212222
if ( (ret = srp_test()) != 0)
22222223
TEST_FAIL("SRP test failed!\n", ret);
22232224
else
@@ -24151,8 +24152,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dsa_test(void)
2415124152

2415224153
#endif /* !NO_DSA */
2415324154

24154-
#ifdef WOLFCRYPT_HAVE_SRP
24155-
24155+
#if defined(WOLFCRYPT_HAVE_SRP) && ((defined(FP_MAX_BITS) && (FP_MAX_BITS >= 3072)) \
24156+
|| (defined(SP_INT_BITS) && (SP_INT_BITS >= 3072)))
2415624157
static wc_test_ret_t generate_random_salt(byte *buf, word32 size)
2415724158
{
2415824159
wc_test_ret_t ret = WC_TEST_RET_ENC_NC;
@@ -24340,7 +24341,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srp_test(void)
2434024341
return ret;
2434124342
}
2434224343

24343-
#endif /* WOLFCRYPT_HAVE_SRP */
24344+
#endif
24345+
/* WOLFCRYPT_HAVE_SRP && ((FP_MAX_BITS && (FP_MAX_BITS >= 3072))
24346+
|| (SP_INT_BITS && (SP_INT_BITS >= 3072))) */
2434424347

2434524348
#if defined(OPENSSL_EXTRA) && !defined(WOLFCRYPT_ONLY)
2434624349

0 commit comments

Comments
 (0)