Skip to content

Commit bcdce75

Browse files
authored
Merge pull request #8909 from dgarske/various_20250620
Fixes with max size, openssl.test netcat and clang-tidy
2 parents 1be3038 + b9455bc commit bcdce75

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

.wolfssl_known_macro_extras

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ __SDCC_VERSION_MINOR
987987
__SDCC_VERSION_PATCH
988988
__SIZEOF_INT128__
989989
__SIZEOF_LONG_LONG__
990+
__STDC_NO_ATOMICS__
990991
__STDC_VERSION__
991992
__STDC__
992993
__STM32__
@@ -1042,4 +1043,3 @@ ssize_t
10421043
sun
10431044
versal
10441045
wc_Tls13_HKDF_Expand_Label
1045-
__STDC_NO_ATOMICS__

scripts/openssl.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ check_server_ready() {
280280
server_ready=0
281281
while [ "$counter" -lt 20 ]; do
282282
echo -e "waiting for $server_name ready..."
283-
echo -e Checking | nc -w 5 localhost $server_port
283+
echo -e Checking | nc -4 -w 1 -z localhost $server_port
284284
nc_result=$?
285285
if [ $nc_result = 0 ]
286286
then

wolfcrypt/benchmark/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,7 @@ static void* benchmarks_do(void* args)
31363136
}
31373137

31383138
bench_buf_size = XFTELL(file);
3139-
if(XFSEEK(file, 0, XSEEK_SET) != 0) {
3139+
if(bench_buf_size < 0 || XFSEEK(file, 0, XSEEK_SET) != 0) {
31403140
XFCLOSE(file);
31413141
goto exit;
31423142
}
@@ -3182,7 +3182,7 @@ static void* benchmarks_do(void* args)
31823182
}
31833183

31843184
bench_buf_size = XFTELL(file);
3185-
if(XFSEEK(file, 0, XSEEK_SET) != 0) {
3185+
if (bench_buf_size < 0 || XFSEEK(file, 0, XSEEK_SET) != 0) {
31863186
XFCLOSE(file);
31873187
goto exit;
31883188
}

wolfssl/wolfcrypt/hash.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#if defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512)
4141
#include <wolfssl/wolfcrypt/sha512.h>
4242
#endif
43-
#ifdef HAVE_BLAKE2
43+
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
4444
#include <wolfssl/wolfcrypt/blake2.h>
4545
#endif
4646
#ifdef WOLFSSL_SHA3
@@ -52,9 +52,6 @@
5252
#ifdef WOLFSSL_MD2
5353
#include <wolfssl/wolfcrypt/md2.h>
5454
#endif
55-
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
56-
#include <wolfssl/wolfcrypt/blake2.h>
57-
#endif
5855
#ifdef WOLFSSL_SM3
5956
#include <wolfssl/wolfcrypt/sm3.h>
6057
#endif
@@ -122,11 +119,15 @@ typedef struct {
122119
} wc_HashAlg;
123120
#endif /* !NO_HASH_WRAPPER */
124121

122+
125123
/* Find largest possible digest size
126124
Note if this gets up to the size of 80 or over check smallstack build */
125+
#undef WC_MAX_DIGEST_SIZE
126+
#undef WC_MAX_BLOCK_SIZE
127127
#if defined(WOLFSSL_SHA3)
128+
/* note: SHA3-224 has the largest block size */
128129
#define WC_MAX_DIGEST_SIZE WC_SHA3_512_DIGEST_SIZE
129-
#define WC_MAX_BLOCK_SIZE WC_SHA3_224_BLOCK_SIZE /* 224 is the largest block size */
130+
#define WC_MAX_BLOCK_SIZE WC_SHA3_224_BLOCK_SIZE
130131
#elif defined(WOLFSSL_SHA512)
131132
#define WC_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE
132133
#define WC_MAX_BLOCK_SIZE WC_SHA512_BLOCK_SIZE

wolfssl/wolfcrypt/types.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,10 +2063,14 @@ enum Max_ASN {
20632063
#endif
20642064
};
20652065

2066+
#ifndef WC_MAX_DIGEST_SIZE
2067+
#define WC_MAX_DIGEST_SIZE 64
2068+
#endif
2069+
#ifndef WC_MAX_DIGEST_SIZE
2070+
#define WC_MAX_BLOCK_SIZE 128
2071+
#endif
2072+
20662073
#ifdef WOLFSSL_CERT_GEN
2067-
#ifdef WOLFSSL_NO_MALLOC
2068-
#include "wolfssl/wolfcrypt/hash.h" /* for max sizes */
2069-
#endif
20702074
/* Used in asn.c MakeSignature for ECC and RSA non-blocking/async */
20712075
enum CertSignState {
20722076
CERTSIGN_STATE_BEGIN,

0 commit comments

Comments
 (0)