diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras index 17a7dbe8b..b41ed942d 100644 --- a/.wolfssl_known_macro_extras +++ b/.wolfssl_known_macro_extras @@ -987,6 +987,7 @@ __SDCC_VERSION_MINOR __SDCC_VERSION_PATCH __SIZEOF_INT128__ __SIZEOF_LONG_LONG__ +__STDC_NO_ATOMICS__ __STDC_VERSION__ __STDC__ __STM32__ @@ -1042,4 +1043,3 @@ ssize_t sun versal wc_Tls13_HKDF_Expand_Label -__STDC_NO_ATOMICS__ diff --git a/scripts/openssl.test b/scripts/openssl.test index f797a9ff8..49140c19a 100755 --- a/scripts/openssl.test +++ b/scripts/openssl.test @@ -280,7 +280,7 @@ check_server_ready() { server_ready=0 while [ "$counter" -lt 20 ]; do echo -e "waiting for $server_name ready..." - echo -e Checking | nc -w 5 localhost $server_port + echo -e Checking | nc -4 -w 1 -z localhost $server_port nc_result=$? if [ $nc_result = 0 ] then diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 83bbe8022..2c3572eaa 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -3136,7 +3136,7 @@ static void* benchmarks_do(void* args) } bench_buf_size = XFTELL(file); - if(XFSEEK(file, 0, XSEEK_SET) != 0) { + if(bench_buf_size < 0 || XFSEEK(file, 0, XSEEK_SET) != 0) { XFCLOSE(file); goto exit; } @@ -3182,7 +3182,7 @@ static void* benchmarks_do(void* args) } bench_buf_size = XFTELL(file); - if(XFSEEK(file, 0, XSEEK_SET) != 0) { + if (bench_buf_size < 0 || XFSEEK(file, 0, XSEEK_SET) != 0) { XFCLOSE(file); goto exit; } diff --git a/wolfssl/wolfcrypt/hash.h b/wolfssl/wolfcrypt/hash.h index 02d99d4c2..36a91253c 100644 --- a/wolfssl/wolfcrypt/hash.h +++ b/wolfssl/wolfcrypt/hash.h @@ -40,7 +40,7 @@ #if defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512) #include #endif -#ifdef HAVE_BLAKE2 +#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S) #include #endif #ifdef WOLFSSL_SHA3 @@ -52,9 +52,6 @@ #ifdef WOLFSSL_MD2 #include #endif -#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S) - #include -#endif #ifdef WOLFSSL_SM3 #include #endif @@ -122,11 +119,15 @@ typedef struct { } wc_HashAlg; #endif /* !NO_HASH_WRAPPER */ + /* Find largest possible digest size Note if this gets up to the size of 80 or over check smallstack build */ +#undef WC_MAX_DIGEST_SIZE +#undef WC_MAX_BLOCK_SIZE #if defined(WOLFSSL_SHA3) + /* note: SHA3-224 has the largest block size */ #define WC_MAX_DIGEST_SIZE WC_SHA3_512_DIGEST_SIZE - #define WC_MAX_BLOCK_SIZE WC_SHA3_224_BLOCK_SIZE /* 224 is the largest block size */ + #define WC_MAX_BLOCK_SIZE WC_SHA3_224_BLOCK_SIZE #elif defined(WOLFSSL_SHA512) #define WC_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE #define WC_MAX_BLOCK_SIZE WC_SHA512_BLOCK_SIZE diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 11998841b..afee382fd 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -2063,10 +2063,14 @@ enum Max_ASN { #endif }; +#ifndef WC_MAX_DIGEST_SIZE +#define WC_MAX_DIGEST_SIZE 64 +#endif +#ifndef WC_MAX_DIGEST_SIZE +#define WC_MAX_BLOCK_SIZE 128 +#endif + #ifdef WOLFSSL_CERT_GEN - #ifdef WOLFSSL_NO_MALLOC - #include "wolfssl/wolfcrypt/hash.h" /* for max sizes */ - #endif /* Used in asn.c MakeSignature for ECC and RSA non-blocking/async */ enum CertSignState { CERTSIGN_STATE_BEGIN,