Skip to content

Commit 62c14e4

Browse files
Merge pull request #6604 from douzzer/20230711-linuxkm-fixes
20230711-linuxkm-fixes
2 parents b8119af + 648f474 commit 62c14e4

9 files changed

Lines changed: 58 additions & 54 deletions

File tree

configure.ac

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ AC_SUBST([ENABLED_LINUXKM_BENCHMARKS])
508508
if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
509509
then
510510
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF -DWOLFSSL_SMALL_STACK_STATIC -DWOLFSSL_TEST_SUBROUTINE=static"
511+
if test "$ENABLED_LINUXKM_PIE" = "yes"; then
512+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_OCSP_ISSUER_CHECK"
513+
fi
511514
if test "$ENABLED_FIPS" = "no"; then
512515
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_OLD_PRIME_CHECK"
513516
fi
@@ -4391,6 +4394,14 @@ then
43914394
fi
43924395

43934396

4397+
# MD4
4398+
AC_ARG_ENABLE([md4],
4399+
[AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
4400+
[ ENABLED_MD4=$enableval ],
4401+
[ ENABLED_MD4=no ]
4402+
)
4403+
4404+
43944405
# DES3
43954406
AC_ARG_ENABLE([des3],
43964407
[AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
@@ -4701,7 +4712,7 @@ AS_CASE([$FIPS_VERSION],
47014712
AS_IF([test "x$ENABLED_DES3" = "xno"],[ENABLED_DES3="yes"])
47024713
])
47034714

4704-
AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$thread_ls_on" = "xno"],
4715+
AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$thread_ls_on" = "xno" && test "$ENABLE_LINUXKM" = "no"],
47054716
[AC_MSG_ERROR([FIPS requires Thread Local Storage])])
47064717

47074718

@@ -6299,6 +6310,11 @@ AC_ARG_ENABLE([curl],
62996310
# curl support requires all the features enabled within this conditional.
63006311
if test "$ENABLED_CURL" = "yes"
63016312
then
6313+
if test "$ENABLED_MD4" = "no"
6314+
then
6315+
ENABLED_MD4="yes"
6316+
fi
6317+
63026318
if test "x$ENABLED_DES3" = "xno"
63036319
then
63046320
ENABLED_DES3="yes"
@@ -6513,14 +6529,6 @@ then
65136529
fi
65146530
fi
65156531

6516-
# MD4
6517-
AC_ARG_ENABLE([md4],
6518-
[AS_HELP_STRING([--enable-md4],[Enable MD4 (default: disabled)])],
6519-
[ ENABLED_MD4=$enableval ],
6520-
[ ENABLED_MD4=no ]
6521-
)
6522-
6523-
65246532
if test "$ENABLED_MD4" = "no"
65256533
then
65266534
#turn on MD4 if using stunnel
@@ -8933,14 +8941,10 @@ fi
89338941

89348942
if test "$ENABLED_REPRODUCIBLE_BUILD" != "yes"
89358943
then
8936-
ESCAPED_ARGS="$ac_configure_args"
8937-
ESCAPED_ARGS=$(echo "$ESCAPED_ARGS" | sed 's/\\/\\\\/g')
8938-
ESCAPED_ARGS=$(echo "$ESCAPED_ARGS" | sed 's/\"/\\\"/g')
8939-
ESCAPED_GLOBAL_ARGS="$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS"
8940-
ESCAPED_GLOBAL_ARGS=$(echo "$ESCAPED_GLOBAL_ARGS" | sed 's/\\/\\\\/g')
8941-
ESCAPED_GLOBAL_ARGS=$(echo "$ESCAPED_GLOBAL_ARGS" | sed 's/\"/\\\"/g')
8944+
ESCAPED_ARGS=$(echo "$ac_configure_args" | sed 's/\\/\\\\/g;s/\"/\\\"/g')
8945+
ESCAPED_GLOBAL_CFLAGS=$(echo "$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS" | sed 's/\\/\\\\/g;s/\"/\\\"/g')
89428946
echo "#define LIBWOLFSSL_CONFIGURE_ARGS \"$ESCAPED_ARGS\"" > "${output_objdir}/.build_params" &&
8943-
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$ESCAPED_GLOBAL_ARGS\" LIBWOLFSSL_GLOBAL_EXTRA_CFLAGS" >> "${output_objdir}/.build_params" ||
8947+
echo "#define LIBWOLFSSL_GLOBAL_CFLAGS \"$ESCAPED_GLOBAL_CFLAGS\" LIBWOLFSSL_GLOBAL_EXTRA_CFLAGS" >> "${output_objdir}/.build_params" ||
89448948
AC_MSG_ERROR([Couldn't create ${output_objdir}/.build_params.])
89458949
else
89468950
rm -f "${output_objdir}/.build_params"

scripts/sniffer-gen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ run_sequence() {
6565
run_test "" "-v 4 -g" "-v 4 -J"
6666
else
6767
echo "Invalid test"
68-
exit -1
68+
exit 1
6969
fi
7070
}
7171

src/internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35791,6 +35791,11 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3579135791
#endif
3579235792

3579335793
if (!ssl->options.tls1_3) {
35794+
if (ssl->arrays == NULL) {
35795+
WOLFSSL_MSG("CreateTicket called with null arrays");
35796+
ret = BAD_FUNC_ARG;
35797+
goto error;
35798+
}
3579435799
XMEMCPY(it->msecret, ssl->arrays->masterSecret, SECRET_LEN);
3579535800
#ifndef NO_ASN_TIME
3579635801
c32toa(LowResTimer(), it->timestamp);

src/ocsp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,6 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
549549
return ret;
550550
}
551551

552-
#ifdef HAVE_OCSP
553-
554552
#ifndef WOLFSSL_NO_OCSP_ISSUER_CHAIN_CHECK
555553
static int CheckOcspResponderChain(OcspEntry* single, DecodedCert *cert,
556554
void* vp) {
@@ -646,7 +644,6 @@ int CheckOcspResponder(OcspResponse *bs, DecodedCert *cert, void* vp)
646644
}
647645
return ret;
648646
}
649-
#endif /* HAVE_OCSP */
650647

651648
#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
652649
defined(WOLFSSL_APACHE_HTTPD) || defined(HAVE_LIGHTY)

src/tls.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,6 @@ int ALPN_Select(WOLFSSL *ssl)
16931693
SendAlert(ssl, alert_fatal, no_application_protocol);
16941694
WOLFSSL_ERROR_VERBOSE(UNKNOWN_ALPN_PROTOCOL_NAME_E);
16951695
return UNKNOWN_ALPN_PROTOCOL_NAME_E;
1696-
break;
16971696
}
16981697
}
16991698
else
@@ -10290,8 +10289,10 @@ static int TLSX_PskKeModes_Parse(WOLFSSL* ssl, const byte* input, word16 length,
1029010289
if (ret == 0)
1029110290
ret = TLSX_PskKeyModes_Use(ssl, modes);
1029210291

10293-
if (ret != 0)
10292+
if (ret != 0) {
1029410293
WOLFSSL_ERROR_VERBOSE(ret);
10294+
}
10295+
1029510296
return ret;
1029610297
}
1029710298

tests/api.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40233,12 +40233,15 @@ static int test_wolfSSL_BIO_gets(void)
4023340233
ExpectNotNull(emp_bm = BUF_MEM_new());
4023440234
ExpectNotNull(msg_bm = BUF_MEM_new());
4023540235
ExpectIntEQ(BUF_MEM_grow(msg_bm, sizeof(msg)), sizeof(msg));
40236-
XFREE(msg_bm->data, NULL, DYNAMIC_TYPE_OPENSSL);
40236+
if (EXPECT_SUCCESS())
40237+
XFREE(msg_bm->data, NULL, DYNAMIC_TYPE_OPENSSL);
4023740238
/* emp size is 1 for terminator */
4023840239
ExpectIntEQ(BUF_MEM_grow(emp_bm, sizeof(emp)), sizeof(emp));
40239-
XFREE(emp_bm->data, NULL, DYNAMIC_TYPE_OPENSSL);
40240-
emp_bm->data = emp;
40241-
msg_bm->data = msg;
40240+
if (EXPECT_SUCCESS()) {
40241+
XFREE(emp_bm->data, NULL, DYNAMIC_TYPE_OPENSSL);
40242+
emp_bm->data = emp;
40243+
msg_bm->data = msg;
40244+
}
4024240245
ExpectIntEQ(BIO_set_mem_buf(bio, emp_bm, BIO_CLOSE), WOLFSSL_SUCCESS);
4024340246

4024440247
/* check reading an empty string */
@@ -40256,9 +40259,11 @@ static int test_wolfSSL_BIO_gets(void)
4025640259
ExpectIntEQ(BIO_gets(bio, bio_buffer, bufferSz), 8);
4025740260
ExpectIntEQ(BIO_gets(bio, bio_buffer, -1), 0);
4025840261

40259-
emp_bm->data = NULL;
40262+
if (EXPECT_SUCCESS())
40263+
emp_bm->data = NULL;
4026040264
BUF_MEM_free(emp_bm);
40261-
msg_bm->data = NULL;
40265+
if (EXPECT_SUCCESS())
40266+
msg_bm->data = NULL;
4026240267
BUF_MEM_free(msg_bm);
4026340268
#endif
4026440269

tests/utils.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ char* create_tmp_dir(char *tmpDir, int len)
5353
#ifdef _MSC_VER
5454
if (_mkdir(tmpDir) != 0)
5555
return NULL;
56+
#elif defined(__CYGWIN__) || defined(__MINGW32__)
57+
if (mkdir(tmpDir) != 0)
58+
return NULL;
5659
#else
5760
if (mkdir(tmpDir, 0700) != 0)
5861
return NULL;

wolfcrypt/src/asn.c

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ ASN Options:
190190
#include <wolfssl/wolfcrypt/cryptocb.h>
191191
#endif
192192

193-
#include <wolfssl/internal.h>
193+
#ifndef WOLFCRYPT_ONLY
194+
#include <wolfssl/internal.h>
195+
#endif
196+
194197
#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
195198
#include <wolfssl/openssl/objects.h>
196199
#endif
@@ -18867,7 +18870,7 @@ static int DecodeAuthKeyId(const byte* input, word32 sz, DecodedCert* cert)
1886718870
/* Get the hash or hash of the hash if wrong size. */
1886818871
ret = GetHashId(dataASN[AUTHKEYIDASN_IDX_KEYID].data.ref.data,
1886918872
(int)dataASN[AUTHKEYIDASN_IDX_KEYID].data.ref.length,
18870-
cert->extAuthKeyId, HashIdAlg(cert->signatureOID));
18873+
cert->extAuthKeyId, HashIdAlg((int)cert->signatureOID));
1887118874
}
1887218875
#ifdef WOLFSSL_AKID_NAME
1887318876
if (ret == 0 && dataASN[AUTHKEYIDASN_IDX_ISSUER].data.ref.data != NULL) {
@@ -21448,29 +21451,10 @@ int wc_ParseCert(DecodedCert* cert, int type, int verify, void* cm)
2144821451
return ParseCert(cert, type, verify, cm);
2144921452
}
2145021453

21451-
#if !defined(OPENSSL_EXTRA) && !defined(OPENSSL_EXTRA_X509_SMALL) && \
21452-
!defined(GetCA)
21453-
/* from SSL proper, for locking can't do find here anymore.
21454-
* brought in from internal.h if built with compat layer.
21455-
* if defined(GetCA), it's a predefined macro and these prototypes
21456-
* would conflict.
21457-
*/
21458-
#ifdef __cplusplus
21459-
extern "C" {
21460-
#endif
21461-
Signer* GetCA(void* signers, byte* hash);
21462-
#ifndef NO_SKID
21463-
Signer* GetCAByName(void* signers, byte* hash);
21464-
#endif
21465-
#ifdef __cplusplus
21466-
}
21467-
#endif
21468-
21469-
#endif /* !OPENSSL_EXTRA && !OPENSSL_EXTRA_X509_SMALL && !GetCA */
21470-
21471-
#if defined(WOLFCRYPT_ONLY)
21454+
#ifdef WOLFCRYPT_ONLY
2147221455

2147321456
/* dummy functions, not using wolfSSL so don't need actual ones */
21457+
Signer* GetCA(void* signers, byte* hash);
2147421458
Signer* GetCA(void* signers, byte* hash)
2147521459
{
2147621460
(void)hash;
@@ -21479,6 +21463,7 @@ Signer* GetCA(void* signers, byte* hash)
2147921463
}
2148021464

2148121465
#ifndef NO_SKID
21466+
Signer* GetCAByName(void* signers, byte* hash);
2148221467
Signer* GetCAByName(void* signers, byte* hash)
2148321468
{
2148421469
(void)hash;
@@ -21488,6 +21473,8 @@ Signer* GetCAByName(void* signers, byte* hash)
2148821473
#endif /* NO_SKID */
2148921474

2149021475
#ifdef WOLFSSL_AKID_NAME
21476+
Signer* GetCAByAKID(void* vp, const byte* issuer, word32 issuerSz,
21477+
const byte* serial, word32 serialSz);
2149121478
Signer* GetCAByAKID(void* vp, const byte* issuer, word32 issuerSz,
2149221479
const byte* serial, word32 serialSz)
2149321480
{
@@ -22701,7 +22688,7 @@ int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm)
2270122688
}
2270222689
}
2270322690
else {
22704-
cert->maxPathLen = min(cert->ca->maxPathLen - 1,
22691+
cert->maxPathLen = (byte)min(cert->ca->maxPathLen - 1,
2270522692
cert->maxPathLen);
2270622693
}
2270722694
}

wolfssl/internal.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6128,12 +6128,14 @@ WOLFSSL_LOCAL WC_RNG* WOLFSSL_RSA_GetRNG(WOLFSSL_RSA *rsa, WC_RNG **tmpRNG,
61286128
DecodedCert* cert);
61296129
#endif
61306130

6131-
WOLFSSL_LOCAL Signer* GetCA(void* vp, byte* hash);
6131+
#ifndef GetCA
6132+
WOLFSSL_LOCAL Signer* GetCA(void* vp, byte* hash);
6133+
#endif
61326134
#ifdef WOLFSSL_AKID_NAME
61336135
WOLFSSL_LOCAL Signer* GetCAByAKID(void* vp, const byte* issuer,
61346136
word32 issuerSz, const byte* serial, word32 serialSz);
61356137
#endif
6136-
#ifndef NO_SKID
6138+
#if !defined(NO_SKID) && !defined(GetCAByName)
61376139
WOLFSSL_LOCAL Signer* GetCAByName(void* cm, byte* hash);
61386140
#endif
61396141
#endif /* !NO_CERTS */

0 commit comments

Comments
 (0)