Skip to content

Commit 8df5d61

Browse files
committed
add optional cryptocb test disable macro to wolfCrypt tests
1 parent 9f9e890 commit 8df5d61

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8475,6 +8475,19 @@ AC_ARG_ENABLE([cryptocb],
84758475
[ ENABLED_CRYPTOCB=no ]
84768476
)
84778477
8478+
# Enable testing of cryptoCb using software crypto. On platforms where wolfCrypt tests
8479+
# are used to test a custom cryptoCb, it may be desired to disable this so wolfCrypt tests
8480+
# don't also test software implementations of every algorithm
8481+
AC_ARG_ENABLE([cryptocb-sw-test],
8482+
[AS_HELP_STRING([--disable-cryptocb-sw-test],[Disable wolfCrypt crypto callback tests using software crypto (default: enabled). Only valid with --enable-cryptocb])],
8483+
[ if test "x$ENABLED_CRYPTOCB" = "xno"; then
8484+
AC_MSG_ERROR([--disable-cryptocb-sw-test requires --enable-cryptocb])
8485+
else
8486+
ENABLED_CRYPTOCB_SW_TEST=$enableval
8487+
fi ],
8488+
[ ENABLED_CRYPTOCB_SW_TEST=yes ]
8489+
)
8490+
84788491
if test "x$ENABLED_PKCS11" = "xyes" || test "x$ENABLED_WOLFTPM" = "xyes" || test "$ENABLED_CAAM" != "no"
84798492
then
84808493
ENABLED_CRYPTOCB=yes
@@ -8484,6 +8497,11 @@ then
84848497
AM_CFLAGS="$AM_CFLAGS -DWOLF_CRYPTO_CB"
84858498
fi
84868499
8500+
if test "$ENABLED_CRYPTOCB_SW_TEST" = "no"
8501+
then
8502+
AM_CFLAGS="$AM_CFLAGS -DWC_TEST_NO_CRYPTOCB_SW_TEST"
8503+
fi
8504+
84878505
84888506
84898507
# Asynchronous Crypto

wolfcrypt/test/test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void printOutput(const char *strName, unsigned char *data, unsigned int dataSz);
735735
WOLFSSL_TEST_SUBROUTINE int ariagcm_test(MC_ALGID);
736736
#endif
737737

738-
#ifdef WOLF_CRYPTO_CB
738+
#if defined(WOLF_CRYPTO_CB) && !defined(WC_TEST_NO_CRYPTOCB_SW_TEST)
739739
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void);
740740
#endif
741741
#ifdef WOLFSSL_CERT_PIV
@@ -2321,7 +2321,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
23212321
TEST_PASS("blob test passed!\n");
23222322
#endif
23232323

2324-
#if defined(WOLF_CRYPTO_CB) && \
2324+
#if defined(WOLF_CRYPTO_CB) && !defined(WC_TEST_NO_CRYPTOCB_SW_TEST) && \
23252325
!(defined(HAVE_INTEL_QAT_SYNC) || defined(HAVE_CAVIUM_OCTEON_SYNC) || \
23262326
defined(WOLFSSL_QNX_CAAM) || defined(HAVE_RENESAS_SYNC))
23272327
if ( (ret = cryptocb_test()) != 0)
@@ -55567,6 +55567,7 @@ static int myCryptoCbFind(int currentId, int algoType)
5556755567
#endif /* WOLF_CRYPTO_CB_FIND */
5556855568

5556955569

55570+
#if !defined(WC_TEST_NO_CRYPTOCB_SW_TEST)
5557055571
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void)
5557155572
{
5557255573
wc_test_ret_t ret = 0;
@@ -55695,6 +55696,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t cryptocb_test(void)
5569555696

5569655697
return ret;
5569755698
}
55699+
#endif /* ! WC_TEST_NO_CRYPTOCB_SW_TEST */
5569855700
#endif /* WOLF_CRYPTO_CB */
5569955701

5570055702
#ifdef WOLFSSL_CERT_PIV

0 commit comments

Comments
 (0)