Commit Graph

7182 Commits

Author SHA1 Message Date
Juliusz Sosinowicz
0abaa89787 Add support for nginx-1.25.0
- nginx: add necessary defines and function
- Implement Certificate Authorities for TLS 1.3
- Implement secret logging for TLS 1.3. Can be used for example with:
  ./configure CPPFLAGS="-DWOLFSSL_SSLKEYLOGFILE -DSHOW_SECRETS -DHAVE_SECRET_CALLBACK -DWOLFSSL_SSLKEYLOGFILE_OUTPUT='\"/tmp/secrets\"'"
- Implement session context checking for tickets
- Check for authorized responder in OCSP basic response
- Fix handling call to ocsp->statusCb
- compat: Translate SOCKET_PEER_CLOSED_E to WOLFSSL_ERROR_SYSCALL
- Fix wolfSSL_CTX_set_session_cache_mode
  - WOLFSSL_SESS_CACHE_OFF means nothing should be on
  - WOLFSSL_SESS_CACHE_NO_INTERNAL turns off only the internal cache
- Respect ssl->options.internalCacheOff
- Implement SSL_SESSION_set_time
- wolfSSL_SSL_in_init: fix detection for TLS 1.3
- Fix handling call to ssl->alpnSelect
- SendTls13NewSessionTicket: always generate new ID
  - When we send a new ticket for the same session (for example we resumed a connection and are sending a new ticket so that the client can resume in the future), we need to generate a new ID so that we don't overwrite the old session in the cache. Overwriting the session results in the `diff` calculation in `DoClientTicketCheck()` producing the wrong value and failing to resume.
Add nginx github action test
- Fix memory leaks
- wolfSSL_OCSP_basic_verify: implement OCSP_TRUSTOTHER flag
- AKID: implement matching on issuer name and serial number
- ocsp: check for a chain match for OCSP responder
- Split CreateTicket into CreateTicket and SetupTicket
- SendCertificateStatus: free response.buffer
- Use heap hint when allocating responseBuffer
- Remove responseBuffer from internal API's that don't use it anywhere
2023-07-07 11:22:58 +02:00
David Garske
fb0c769d6c Merge pull request #6578 from douzzer/20230705-analyzer-fixes
20230705-analyzer-fixes
2023-07-06 09:04:39 -07:00
Juliusz Sosinowicz
0b4e4287c9 getsockopt needs to take in an int
This caused an issue on big endian platforms

From the getsockopt man page:
       Most socket-level options utilize an int argument for optval.  For setsockopt(), the argument should be non‐
       zero to enable a boolean option, or zero if the option is to be disabled.
2023-07-06 11:40:36 +02:00
Daniel Pouzzner
1912f1bc2a fixes for clang-analyzer-core.NullDereference, clang-analyzer-core.NonNullParamChecker, clang-analyzer-deadcode.DeadStores, readability-redundant-preprocessor, clang-diagnostic-unreachable-code-break, -Werror=sign-conversion, bugprone-macro-parentheses, "Call to 'malloc' has an allocation size of 0 bytes", clang-diagnostic-declaration-after-statement re tests/unit.h:ExpectPtr() pragmas. 2023-07-06 00:53:37 -05:00
Juliusz Sosinowicz
b0c2e29a2e Always add DTLS_MTU_ADDITIONAL_READ_BUFFER for better MTU interop 2023-07-05 10:19:19 -07:00
David Garske
f00b5c3a1e Merge pull request #6537 from SparkiDev/sm
SM2/SM3/SM4: Chinese cipher support
2023-07-04 10:03:37 -07:00
Juliusz Sosinowicz
7af1f0cf05 Add additional windows logging for DoMonitor 2023-07-04 14:12:38 +02:00
Juliusz Sosinowicz
f58539581d Fix DoMonitor for Mac/BSD 2023-07-04 13:24:00 +02:00
Sean Parkinson
e2424e6744 SM2/SM3/SM4: Chinese cipher support
Add support for:
 - SM2 elliptic curve and SM2 sign/verify
 - SM3 digest
 - SM4 cipher with modes ECB/CBC/CTR/GCM/CCM

Add APIs for SM3 and SM4.
Add SM2 sign and verify APIs.
Add support for SM3 in wc_Hash and wc_Hmac API.
Add support for SM3 and SM4 through EVP layer.
Add support for SM2-SM3 certificates. Support key ID and name hash being
with SHA-1/256 or SM3.
Add support for TLS 1.3 cipher suites: TLS-SM4-GCM-SM3, TLS-SM4-CCM-SM3
Add support for TLS 1.2 SM cipher suite: ECDHE-ECDSA-SM4-CBC-SM3
Add support for SM3 in wc_PRF_TLS.
Add SM2-SM3 certificates and keys. Generated with GmSSL-3.0.0 and
OpenSSL.
2023-07-04 13:36:28 +10:00
Juliusz Sosinowicz
3d68bcd6f7 Jenkins fixes 2023-07-03 14:02:51 +02:00
Juliusz Sosinowicz
bff2cf5690 Add crl monitor unit testing 2023-07-03 14:02:51 +02:00
Juliusz Sosinowicz
8ab0050801 Init windows CRL monitor 2023-07-03 14:02:51 +02:00
David Garske
95675c7e34 Merge pull request #6455 from lealem47/INIT_SSL_NO_CTX_KEY
Allow option to create SSL without key/cert in ctx
2023-06-30 10:35:52 -07:00
Lealem Amedie
7720dac545 Allow option to create SSL without key/cert in ctx 2023-06-29 13:57:40 -06:00
Anthony Hu
ed4774f606 Allocate WOLFSSL_X509_NAME with heap hint. 2023-06-29 12:04:32 -04:00
David Garske
048083cfe3 Merge pull request #6329 from tmael/crl_off
Add support for enabling and disabling CRLs.
2023-06-28 16:03:25 -07:00
Tesfa Mael
26e6fd9a6f update wolfSSL_X509_STORE_set_flags 2023-06-27 08:29:13 -07:00
Tesfa Mael
cb0e2c8b0f Maintain existing behavor when not using OPENSSL_COMPATIBLE_DEFAULTS 2023-06-27 08:29:13 -07:00
Tesfa Mael
03e5d109c7 Add test_wolfSSL_dup_CA_list 2023-06-27 08:29:13 -07:00
Tesfa Mael
481ae20fcb Maintain consistent behavior when activating CRL 2023-06-27 08:26:02 -07:00
Tesfa Mael
fd17fa3e9c Implement the option to disable CRL check
Do leaf CRL check by default
Correct wolfSSL_sk_X509_NAME_push return check
Update OpenSSL compatibility errors for HAProxy
Change X509_V to literal constant values
Fix the compat layer with TLS session ticket reuse
Fix for tls1_2 session resume and cache miss
Save intitial wolfSSL ctx
Check for OpenSSL CRL error code 23
2023-06-27 08:26:02 -07:00
Juliusz Sosinowicz
291c538e5f Ignore session ID's shorter than 32 bytes instead of erroring out 2023-06-27 14:51:46 +02:00
David Garske
23c60b7b9c Merge pull request #6530 from SparkiDev/tests_api_expect_5
Test api.c: change more tests to use Expect instead of Assert
2023-06-26 16:10:52 -07:00
Sean Parkinson
578f56e60c Test api.c: change more tests to use Expect instead of Assert
bio.c:
  wolfSSL_BIO_flush(): check allocation to bio->ip succeeded.

internal.c:
  InitSSL_Ctx(): set ctx->heap to heap if value passed in
ProcessPeerCerts(): check for error MEMORY_E too as a fatal parsing
error

ssl.c:
wolfSSL_shutdown(): SOCKET_ERROR_E is also an indication that the
socket is done, MEMORY_E is a fatal error
  wolfSSL_Cleanup(): move free of memory fail couting to wolfSSL API
  SessionTicketNoncePrealloc(): eror return must be non-zero
AddSessionToCache(): XFREE checks for NULL no need to do it before
call
wolfSSL_set_psk_use_session_callback(): ensure ssl is not NULL before
dereferencing
wolfSSL_SMIME_read_PKCS7(): check for error return from
wolfSSL_BIO_gets()

asn.c:
  wc_MIME_parse_headers(): check allocation succeeded into nextHdr

compress.c:
  wc_DeCompressDynamic(): free tmp on inflateInit2 failure

memory.c: rework where memory allocation failure counting code for when
WOFLSSL_STATIC_MEMORY is defined

wc_port.c:
wolfCrypt_Cleanup(): only call wc_MemFailCount_Free() when no
wolfSSL_Cleanup()
2023-06-27 08:01:33 +10:00
JacobBarthelmeh
18032cdc40 Merge pull request #6535 from dgarske/wpas_small
Fix for `--enable-wpas=small`
2023-06-23 16:19:31 -07:00
David Garske
514ea2d0b1 Merge pull request #6510 from mitchcapper/win32_better_socket_error_msg_pr
Added For TranslateIoError in debug mode use FormatMessage to get a better error message
2023-06-23 15:33:34 -07:00
David Garske
af0facad9f Fix for --enable-wpas=small. 2023-06-23 14:25:39 -07:00
Mitch Capper
6185d66b01 For TranslateIoError use FormatMessage to get a better error message on win32 2023-06-23 14:05:38 -07:00
lealem47
06c1dd171a Merge pull request #6466 from dgarske/keilmdk
Fixes and cleanups for Keil MDK examples
2023-06-23 08:41:04 -06:00
David Garske
746ac3c9a3 Merge pull request #6533 from anhu/no_data_junk
make sure that when TLSX_ALPN_GetRequest() returns, data and dataSz...
2023-06-22 22:11:02 -07:00
David Garske
a56fe30c2c Fixes and cleanups for Keil MDK examples. Combine duplicate user_settings.h. Use SP math all by default. Disable old/deprecated algorithms. Add CMSIS RTOS timer support for TLS and benchmark. 2023-06-22 16:48:17 -06:00
Anthony Hu
3e821c6f2b make sure that when TLSX_ALPN_GetRequest() returns data and dataSz are not pointing to junk. 2023-06-22 15:01:11 -04:00
jordan
2be3bb4c56 Fix ThreadSanitizer unlock of an unlocked mutex warning 2023-06-22 13:23:08 -05:00
David Garske
6697181081 Merge pull request #6500 from SparkiDev/tests_api_expect_4
Test api.c: change more tests to use Expect instead of Assert
2023-06-21 17:17:37 -07:00
Kareem
75c8d87353 Fix trusted_ca_keys extension allowed logic. 2023-06-21 15:35:29 -07:00
Sean Parkinson
e467112a93 Test api.c: change more tests to use Expect instead of Assert
Changed EXPECT_DECL to start of as TEST_SKIPPED.
Modified other EXPECT macros appropriately.
Change test functions to not use 'res' when EXPECT_DECL is used.

memory.c:
  wc_MemFailCount_Init(): don't declare variable after a statement

conf.c:
wolfSSL_TXT_DB_read(): free the whole WOLFSSL_TXT_DB on failure
instead of just the memory
wolfSSL_CONF_add_string(): pop the value added into section->value
(sk) if it can't be pushed onto conf->data
  wolfSSL_NCONF_load(): free the new value if it wasn't able to be added

ocsp.c:
  wolfSSL_OCSP_cert_to_id():
free the decoded certificate if parsing failed (is freed after use
otherwise)
free the certificate id on failure and make it NULL and continue
freeing other variables

pk.c:
wolfSSL_RSA_set0_crt_params(): set dmp1, dmq1 and iqmp fields to NULL
if setting the internal failed - returns error and caller needs to free
the passed in BNs
wolfSSL_RSA_set0_factors(): set p and q fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs
wolfSSL_RSA_set0_key(): set n, e abd d fields to NULL if setting the
internal failed - returns error and caller needs to free the passed in
BNs

x509.c:
wolfSSL_X509_set_serialNumber(): explicit NULL
checkwolfSSL_X509_REQ_add1_attr_by_NID(): check whether push succeeded
and on failure free attribute

asn.c:
ConfirmSignature(): for DSA, allocate separately to ensure no leak on
memory allocation failure.

dh.c:
wc_DhGenerateParams(): ensure tmp and tmp2 are able to be cleared on
error

evp.c:
wolfSSL_EVP_PKEY_CTX_add1_hkdf_info(): fix realloc use to no leak on
failure
  wolfSSL_EVP_CIPHER_CTX_iv_length(): handle ctx being NULL.
2023-06-22 08:21:17 +10:00
David Garske
9204101e94 Merge pull request #6517 from douzzer/20230615-opensslextra-wolfSSL_ERR_reason_error_string
20230615-opensslextra-wolfSSL_ERR_reason_error_string
2023-06-21 11:06:51 -07:00
Sean Parkinson
beef8b0014 outputBuffer - use idx field
dtls13.c:
Change end of outputBuffer data calculations to use function
GetOutputBuffer().
  Use idx when calculating unused byte count of outputBuffer.

internal.c:
Change end of outputBuffer data calculations to use function
GetOutputBuffer().
  Use GetOutputBuffer() to calculate end of data in outputBuffer.
  GrowOutputBuffer():
Calculate new size to allocate to include already written data in
case of static buffer.
    Copy all data including already written count (idx).
  CheckAvailableSize():
    Don't subtract idx from length when checking MTU size.
Do subtract idx from bufferSize to determine count of unused bytes
in outputBuffer.
2023-06-16 10:29:52 +10:00
Daniel Pouzzner
970663f8a1 in wolfSSL_ERR_reason_error_string(), unconditionally convert positive error codes to negative, and in switch(), match against negated values of OpenSSL positive codes like WOLFSSL_ERROR_WANT_READ. fixes #6514 2023-06-15 17:42:03 -05:00
JacobBarthelmeh
5b81dc47d2 adjust location used for writing to output buffer 2023-06-14 21:01:12 -07:00
JacobBarthelmeh
9e0c13bbdb sanity check on send fatal alert return 2023-06-14 11:08:56 -07:00
JacobBarthelmeh
938a48d9b1 sanity check on socket return value for timeout with DTLS13 2023-06-08 02:37:21 -06:00
JacobBarthelmeh
4a4a769512 check on allocation of new node before dereferencing 2023-06-07 15:20:23 -06:00
JacobBarthelmeh
84979900a7 avoid use after free in error case 2023-06-07 15:13:13 -06:00
JacobBarthelmeh
14990ad92d set return bio to null after free on error 2023-06-07 15:05:52 -06:00
JacobBarthelmeh
ebc62f8d17 clear extension string and avoid potential double free 2023-06-07 14:41:47 -06:00
JacobBarthelmeh
d796aa12fc free up memory with othername object on error 2023-06-07 13:29:41 -06:00
JacobBarthelmeh
c399fba4ce set ext pointer to null after free'ing it 2023-06-07 13:23:43 -06:00
JacobBarthelmeh
8583cc65fa Merge pull request #6471 from SparkiDev/tests_api_expect_3
Test api.c: change more tests to use Expect instead of Assert
2023-06-07 11:22:23 -06:00
JacobBarthelmeh
1445a6a832 Merge pull request #6482 from SparkiDev/regression_fixes_7
Regression testing fixes
2023-06-07 11:18:36 -06:00