From d79ca8a74631f0eca591bd7dd23dd6709dc3ecc2 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 13 Aug 2025 21:58:34 +0100 Subject: [PATCH] Improve some of the build cases around crypto callback only --- examples/benchmark/tls_bench.c | 8 ++++---- tests/api/test_ecc.c | 7 ++++--- wolfcrypt/test/test.c | 12 +++++++----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/examples/benchmark/tls_bench.c b/examples/benchmark/tls_bench.c index c191b2782..29fe81e48 100644 --- a/examples/benchmark/tls_bench.c +++ b/examples/benchmark/tls_bench.c @@ -85,12 +85,12 @@ Or #define SINGLE_THREADED #endif #endif -/* Conversely, if both server and client are enabled, we must require pthreads */ + +/* If both client and server are enabled and single threaded, just disable this example */ #if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) \ && defined(SINGLE_THREADED) - #error "threads must be enabled if building benchmark suite \ -to run both client and server. Please define HAVE_PTHREAD if your \ -platform supports it" + #undef NO_TLS + #define NO_TLS #endif #if 0 diff --git a/tests/api/test_ecc.c b/tests/api/test_ecc.c index b60a11da5..bd24c7072 100644 --- a/tests/api/test_ecc.c +++ b/tests/api/test_ecc.c @@ -1360,7 +1360,7 @@ int test_wc_ecc_pointFns(void) EXPECT_DECLS; #if defined(HAVE_ECC) && defined(HAVE_ECC_KEY_EXPORT) && \ !defined(WC_NO_RNG) && !defined(WOLFSSL_ATECC508A) && \ - !defined(WOLFSSL_ATECC608A) + !defined(WOLFSSL_ATECC608A) && !defined(WOLF_CRYPTO_CB_ONLY_ECC) ecc_key key; WC_RNG rng; int ret; @@ -1465,7 +1465,7 @@ int test_wc_ecc_shared_secret_ssh(void) #if defined(HAVE_ECC) && defined(HAVE_ECC_DHE) && \ !defined(WC_NO_RNG) && !defined(WOLFSSL_ATECC508A) && \ !defined(WOLFSSL_ATECC608A) && !defined(PLUTON_CRYPTO_ECC) && \ - !defined(WOLFSSL_CRYPTOCELL) + !defined(WOLFSSL_CRYPTOCELL) && !defined(WOLF_CRYPTO_CB_ONLY_ECC) ecc_key key; ecc_key key2; WC_RNG rng; @@ -1639,7 +1639,8 @@ int test_wc_ecc_mulmod(void) EXPECT_DECLS; #if defined(HAVE_ECC) && !defined(WC_NO_RNG) && \ !(defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \ - defined(WOLFSSL_VALIDATE_ECC_IMPORT)) + defined(WOLFSSL_VALIDATE_ECC_IMPORT)) && \ + !defined(WOLF_CRYPTO_CB_ONLY_ECC) ecc_key key1; ecc_key key2; ecc_key key3; diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 4ea30d48f..fb0bcd501 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -31175,6 +31175,7 @@ done: #else wc_ecc_free(key); #endif + (void)tmpSz; return ret; } @@ -59585,12 +59586,11 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx) wc_test_ret_t ret = 0; #if defined(HAVE_ECC) #if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) - ecc_key* key = (ecc_key *)XMALLOC(sizeof *key, + ecc_key* key = (ecc_key *)XMALLOC(sizeof(*key), HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); - ecc_key* pub = (ecc_key *)XMALLOC(sizeof *pub, - HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); - byte* out = (byte*)XMALLOC(sizeof(byte), + ecc_key* pub = (ecc_key *)XMALLOC(sizeof(*pub), HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); + byte* out = (byte*)XMALLOC(256, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA) byte* check = (byte*)XMALLOC(256, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); #endif @@ -59599,6 +59599,9 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx) #ifdef HAVE_ECC_DHE ecc_key pub[1]; #endif + #if defined(HAVE_ECC_SIGN) && defined(HAVE_ECC_VERIFY) + byte out[256]; + #endif #if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA) byte check[256]; #endif @@ -59654,7 +59657,6 @@ static wc_test_ret_t ecc_onlycb_test(myCryptoDevCtx *ctx) #if defined(HAVE_ECC_SIGN) && defined(HAVE_ECC_VERIFY) byte in[] = "Everyone gets Friday off. ecc p"; word32 inLen = (word32)XSTRLEN((char*)in); - byte out[256]; word32 outLen; int verify; #endif