Skip to content

Commit

Permalink
moved some macro logic from test.c to settings.h
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbrett committed Oct 31, 2024
1 parent cac11e3 commit 17c7b6c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
9 changes: 2 additions & 7 deletions wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -30871,10 +30871,7 @@ static wc_test_ret_t ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerif
#ifdef HAVE_ECC_SIGN
/* ECC w/out Shamir has issue with all 0 digest */
/* WC_BIGINT doesn't have 0 len well on hardware */
/* Cryptocell has issues with all 0 digest */
#if defined(ECC_SHAMIR) && !defined(WOLFSSL_ASYNC_CRYPT) && \
!defined(WOLFSSL_CRYPTOCELL) && \
!defined(WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST)
#if defined(ECC_SHAMIR) && !defined(WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST)
/* test DSA sign hash with zeros */
for (i = 0; i < (int)ECC_DIGEST_SIZE; i++) {
digest[i] = 0;
Expand Down Expand Up @@ -30911,9 +30908,7 @@ static wc_test_ret_t ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerif
TEST_SLEEP();
}
#endif /* HAVE_ECC_VERIFY */
#endif /* ECC_SHAMIR && !WOLFSSL_ASYNC_CRYPT && !WOLFSSL_CRYPTOCELL
* && !WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST
*/
#endif /* ECC_SHAMIR && !WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST */

/* test DSA sign hash with sequence (0,1,2,3,4,...) */
for (i = 0; i < (int)ECC_DIGEST_SIZE; i++) {
Expand Down
14 changes: 14 additions & 0 deletions wolfssl/wolfcrypt/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,14 @@ extern void uITRON4_free(void *p) ;
#undef NO_DH
#endif

/* CryptoCell defines */
#ifdef WOLFSSL_CRYPTOCELL
#if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN)
/* Don't attempt to sign/verify an all-zero digest in wolfCrypt tests */
#define WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST
#endif /* HAVE_ECC && HAVE_ECC_SIGN */
#endif

/* Asynchronous Crypto */
#ifdef WOLFSSL_ASYNC_CRYPT
#if !defined(HAVE_CAVIUM) && !defined(HAVE_INTEL_QA) && \
Expand All @@ -3192,6 +3200,12 @@ extern void uITRON4_free(void *p) ;
* but not required */
#define ECC_CACHE_CURVE
#endif

#if defined(HAVE_ECC) && defined(HAVE_ECC_SIGN)
/* Don't attempt to sign/verify an all-zero digest in wolfCrypt tests */
#define WC_TEST_NO_ECC_SIGN_VERIFY_ZERO_DIGEST
#endif /* HAVE_ECC && HAVE_ECC_SIGN */

#endif /* WOLFSSL_ASYNC_CRYPT */
#ifndef WC_ASYNC_DEV_SIZE
#define WC_ASYNC_DEV_SIZE 0
Expand Down

0 comments on commit 17c7b6c

Please sign in to comment.