Skip to content

Commit 96661a5

Browse files
authored
Merge pull request #9977 from JacobBarthelmeh/multi-test
Minor fixes for nightly multi-test tool
2 parents 57f416f + 49796a5 commit 96661a5

6 files changed

Lines changed: 28 additions & 14 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,6 @@ WOLFSSL_PSK_IDENTITY_ALERT
866866
WOLFSSL_PSK_ID_PROTECTION
867867
WOLFSSL_PSK_MULTI_ID_PER_CS
868868
WOLFSSL_PSK_TLS13_CB
869-
WOLFSSL_PYTHON
870869
WOLFSSL_RENESAS_FSPSM_CRYPT_ONLY
871870
WOLFSSL_RENESAS_RA6M3
872871
WOLFSSL_RENESAS_RA6M3G

configure.ac

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,11 @@ then
12111211
test "$enable_ocsp" = "" && enable_ocsp=yes
12121212
test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
12131213
test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
1214-
test "$enable_ocsp_responder" = "" && test "$enable_ocsp" != "no" && test "$ASN_IMPL" = "template" && enable_ocsp_responder=yes
1214+
test "$enable_ocsp_responder" = "" &&
1215+
test "$enable_ocsp" != "no" &&
1216+
test "$enable_sha" != "no" &&
1217+
test "$ASN_IMPL" = "template" &&
1218+
enable_ocsp_responder=yes
12151219
test "$enable_savesession" = "" && enable_savesession=yes
12161220
test "$enable_savecert" = "" && enable_savecert=yes
12171221
test "$enable_postauth" = "" && enable_postauth=yes
@@ -1485,7 +1489,6 @@ then
14851489
test "$enable_ocsp" = "" && enable_ocsp=yes
14861490
test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
14871491
test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
1488-
test "$enable_ocsp_responder" = "" && test "$enable_ocsp" != "no" && test "$ASN_IMPL" = "template" && enable_ocsp_responder=yes
14891492
test "$enable_crl" = "" && enable_crl=yes
14901493
test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
14911494
test "$enable_tlsx" = "" && enable_tlsx=yes

src/tls.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,9 +2394,10 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, const byte* input, word16 length,
23942394
else
23952395
#endif
23962396
{
2397-
matched = cacheOnly || (XSTRLEN(sni->data.host_name) == size &&
2398-
XSTRNCMP(sni->data.host_name, (const char*)input + offset,
2399-
size) == 0);
2397+
const char* hostName = (sni != NULL) ? sni->data.host_name : NULL;
2398+
matched = cacheOnly || (hostName != NULL &&
2399+
XSTRLEN(hostName) == size &&
2400+
XSTRNCMP(hostName, (const char*)input + offset, size) == 0);
24002401
}
24012402

24022403
#if defined(WOLFSSL_TLS13) && defined(HAVE_ECH)
@@ -2415,7 +2416,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, const byte* input, word16 length,
24152416
}
24162417
#endif
24172418

2418-
if (matched || sni->options & WOLFSSL_SNI_ANSWER_ON_MISMATCH) {
2419+
if (matched ||
2420+
(sni != NULL && (sni->options & WOLFSSL_SNI_ANSWER_ON_MISMATCH))) {
24192421
int matchStat;
24202422
int r = TLSX_UseSNI(&ssl->extensions, type, input + offset, size,
24212423
ssl->heap);
@@ -2441,7 +2443,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, const byte* input, word16 length,
24412443
if (!cacheOnly)
24422444
TLSX_SetResponse(ssl, TLSX_SERVER_NAME);
24432445
}
2444-
else if (!(sni->options & WOLFSSL_SNI_CONTINUE_ON_MISMATCH)) {
2446+
else if ((sni == NULL) ||
2447+
!(sni->options & WOLFSSL_SNI_CONTINUE_ON_MISMATCH)) {
24452448
SendAlert(ssl, alert_fatal, unrecognized_name);
24462449
WOLFSSL_ERROR_VERBOSE(UNKNOWN_SNI_HOST_NAME_E);
24472450
return UNKNOWN_SNI_HOST_NAME_E;

tests/api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33617,7 +33617,10 @@ static int test_lms_write_key(const byte* priv, word32 privSz, void* context)
3361733617
FILE* f = fopen((const char*)context, "wb");
3361833618
if (f == NULL)
3361933619
return -1;
33620-
fwrite(priv, 1, privSz, f);
33620+
if (fwrite(priv, 1, privSz, f) != privSz) {
33621+
fclose(f);
33622+
return -1;
33623+
}
3362133624
fclose(f);
3362233625
return WC_LMS_RC_SAVED_TO_NV_MEMORY;
3362333626
}

wolfcrypt/src/asn.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12374,14 +12374,16 @@ int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey* key,
1237412374
/* dsaPubKeyASN is longer than dsaPublicKeyASN. */
1237512375
DECL_ASNGETDATA(dataASN, dsaPubKeyASN_Length);
1237612376
int ret = 0;
12377+
void* heap = NULL;
1237712378

1237812379
/* Validated parameters. */
1237912380
if ((input == NULL) || (inOutIdx == NULL) || (key == NULL)) {
1238012381
ret = BAD_FUNC_ARG;
1238112382
}
12383+
heap = (key != NULL) ? key->heap : NULL;
1238212384

1238312385
if (ret == 0) {
12384-
ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, key->heap);
12386+
ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, heap);
1238512387
}
1238612388

1238712389
if (ret == 0) {
@@ -12420,7 +12422,7 @@ int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey* key,
1242012422
key->type = DSA_PUBLIC;
1242112423
}
1242212424

12423-
FREE_ASNGETDATA(dataASN, key->heap);
12425+
FREE_ASNGETDATA(dataASN, heap);
1242412426
return ret;
1242512427
#endif
1242612428
}
@@ -37539,6 +37541,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3753937541
/* eccKeyASN is longer than eccPublicKeyASN. */
3754037542
DECL_ASNGETDATA(dataASN, eccKeyASN_Length);
3754137543
int ret = 0;
37544+
void* heap = NULL;
3754237545
int curve_id = ECC_CURVE_DEF;
3754337546
int oidIdx = ECCPUBLICKEYASN_IDX_ALGOID_CURVEID;
3754437547
#ifdef WOLFSSL_CUSTOM_CURVES
@@ -37549,9 +37552,10 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3754937552
if ((input == NULL) || (inOutIdx == NULL) || (key == NULL) || (inSz == 0)) {
3755037553
ret = BAD_FUNC_ARG;
3755137554
}
37555+
heap = (key != NULL) ? key->heap : NULL;
3755237556

3755337557
if (ret == 0) {
37554-
ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key->heap);
37558+
ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, heap);
3755537559
}
3755637560

3755737561
if (ret == 0) {
@@ -37625,7 +37629,7 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
3762537629
}
3762637630
}
3762737631

37628-
FREE_ASNGETDATA(dataASN, key->heap);
37632+
FREE_ASNGETDATA(dataASN, heap);
3762937633
return ret;
3763037634
#endif /* WOLFSSL_ASN_TEMPLATE */
3763137635
}

wolfcrypt/src/integer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3278,8 +3278,10 @@ int mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
32783278
q.sign = a->sign;
32793279
w = 0;
32803280

3281-
if (a->used == 0)
3281+
if (a->used == 0) {
3282+
mp_clear(&q);
32823283
return MP_VAL;
3284+
}
32833285

32843286
for (ix = a->used - 1; ix >= 0; ix--) {
32853287
w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]);

0 commit comments

Comments
 (0)