Commit Graph

81 Commits

Author SHA1 Message Date
Daniel Pouzzner a25c0244a7 wolfssl/wolfcrypt/types.h: refactor static_assert*() as wc_static_assert*() to avoid conflicts with target-native static_assert(), and add additional coverage for C23 and MSVC C11.
wolfcrypt/test/test.c: in render_error_message(), in tests for strerror_r(), test for __USE_GNU.
2024-10-04 16:41:33 -05:00
Juliusz Sosinowicz cf96ab22ba Address code review 2024-09-20 15:31:01 +02:00
Juliusz Sosinowicz 99a99e3d6e Implement DTLS 1.2 Connection ID (CID) 2024-09-20 15:31:01 +02:00
Daniel Pouzzner fbbb2b876b wolfssl/wolfcrypt/types.h: add static_assert() definitions;
wolfssl/internal.h: add DTLS13_HANDSHAKE_HEADER_SZ;

src/tls13.c: in EchHashHelloInner(), use falseHeader[DTLS13_HANDSHAKE_HEADER_SZ] to fix buffer overrun;

src/dtls13.c: add static assert for DTLS13_HANDSHAKE_HEADER_SZ.
2024-09-19 01:15:42 -05:00
Juliusz Sosinowicz 1e75a2367c Address code review 2024-09-18 10:35:29 +02:00
Juliusz Sosinowicz 74ac2cd07d dtls 1.3: pad plaintext when too short for record header protection 2024-09-18 10:35:29 +02:00
Daniel Pouzzner c81c9be9ce error code fixes:
* fix TLS layer to consistently use WOLFSSL_FATAL_ERROR for error retvals, rather than literal -1.
* add WC_NO_ERR_TRACE() wrapper around LENGTH_ONLY_E (it does not signify an error condition).
* refactor errcode handling for traceability in wolfSSL_DSA_do_sign(), wolfSSL_DH_size(), wolfSSL_EC_KEY_get_conv_form(), wolfSSL_d2i_DSA_SIG(), wolfSSL_DSA_do_sign(), SetDhInternal(), and wolfSSL_EC_KEY_get_conv_form().
2024-09-06 19:33:48 -05:00
Daniel Pouzzner b178138d83 src/internal.c: in wolfSSL_ERR_reason_error_string(), add missing error string for SCR_DIFFERENT_CERT_E, and de-gate error strings previously gated on HAVE_HTTP_CLIENT.
tests/api.c: add error_test() adapted from wolfcrypt/test/test.c, checking all error strings for expected presence/absence and length, called from existing test_wolfSSL_ERR_strings().

wolfssl/ssl.h, wolfssl/error-ssl.h, and wolfssl/wolfcrypt/error-crypt.h:
* move several negative error return codes from ssl.h to error-ssl.h,
* renumber them to conform to existing sequence, and
* include error-ssl.h from ssl.h;
* add special-case WOLFSSL_DEBUG_TRACE_ERROR_CODES macros for WOLFSSL_FAILURE;
* add missing WOLFSSL_API attribute to wc_backtrace_render().

add numerous WC_NO_ERR_TRACE()s to operand error code uses, cleaning up error traces in general, and particularly when WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS.
* crypto lib (36),
* crypto test&benchmark (20),
* TLS lib (179),
* examples (122),
* linuxkm (3),
* tests/api.c (2272).
2024-08-28 23:05:04 -05:00
Andras Fekete d350ba6c41 remove NULL test with XFREE arguments with dereference 2024-08-06 10:44:59 -04:00
JacobBarthelmeh 31a6a2bf59 update copyright to 2024 2024-07-19 13:15:05 -06:00
Daniel Pouzzner b3e8f0ad24 add --enable-debug-trace-errcodes, WOLFSSL_DEBUG_TRACE_ERROR_CODES, WC_ERR_TRACE(), WC_NO_ERR_TRACE(), support/gen-debug-trace-error-codes.sh. also add numerous deployments of WC_NO_ERR_TRACE() to inhibit frivolous/misleading errcode traces when -DWOLFSSL_DEBUG_TRACE_ERROR_CODES. 2024-06-08 16:39:53 -05:00
Per Allansson 92d7815b5c
Fix missing return in DTLS1.3 / FIPS code 2024-01-23 08:35:07 +01:00
Juliusz Sosinowicz 493bb1760d Add option to remove early sanity checks 2023-12-12 17:31:48 +01:00
Juliusz Sosinowicz 627310d26a Additional TLS checks
- double check which messages need to be encrypted
- check msgs that have to be last in a record

ZD17108
2023-12-12 13:57:12 +01:00
Eric Blankenhorn 7bbeadcf97 Fix build errors with dtls1.3 and no tls1.2 2023-11-15 10:37:09 -06:00
JacobBarthelmeh c5e2f414ea
Merge pull request #6929 from julek-wolfssl/dtls13-early-data-server-side
dtls 1.3: allow to skip cookie exchange on resumption
2023-11-06 13:30:21 -07:00
Juliusz Sosinowicz 8c87920903 Address code review 2023-11-03 11:02:41 +01:00
Sean Parkinson 0eab70f806 Regression test fixes
Fixes for different configurations and memory allocation failure
testing.
2023-11-01 14:10:49 +10:00
Juliusz Sosinowicz aed715cb2c dtls 1.3: allow to skip cookie exchange on resumption
tls 1.3: do cookie exchange when asked too even when found a matching cipher
2023-10-31 14:29:04 +01:00
Juliusz Sosinowicz 3a881079d3 Fix async 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz ada785e115 Address code review 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz 8da863184c Force DTLS 1.3 when accepting fragmented CH 2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz 85a596e54a DTLS 1.3: allow fragmenting the second ClientHello message
- DTLS 1.3 pqc support
- Add --enable-dtls-frag-ch option to enable CH fragmenting
- Send an alert when we get an empty keyshare with a cookie present to not allow for multiple HRR in one connection
- Only update the DTLS window when we have successfully processed or stored a message
- Call ssl->chGoodCb as soon as we have processed a verified full or fragmented ClientHello cookie
2023-10-09 12:54:11 +02:00
Juliusz Sosinowicz a99954c0b0 Update dtls_expected_peer_handshake_number when downgrading 2023-08-23 23:20:51 +02:00
Juliusz Sosinowicz 5624b6e9d2 Update comment 2023-08-23 23:20:51 +02:00
Juliusz Sosinowicz 058dfca809 Use explicit field to signal that we received a unified hdr 2023-08-23 23:20:51 +02:00
Juliusz Sosinowicz 9427bea275 DTLS 1.3: do not send ACKs until we negotiate 1.3 (through SH) 2023-08-23 22:18:21 +02:00
Juliusz Sosinowicz 5cf42244f0 Add comment back in 2023-07-26 12:04:11 +02:00
Juliusz Sosinowicz 56fc5bbf87 Dtls13GetRnMask: Correctly get chacha counter on BE systems
The issue was that BIG_ENDIAN is defined in endian.h (on linux). Our define is BIG_ENDIAN_ORDER.
2023-07-24 09:13:10 +02: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
Marco Oliverio 31ed2a2bbb dtls13: support Authentication and Integrity-Only Cipher Suites
See RFC 9150. To enable the feature use HAVE_NULL_CIPHER compilation flag.
2023-05-18 10:03:03 +00:00
Juliusz Sosinowicz 335722c586 Async fixes 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz 5f65752414 Refactor alerts into one location
Remove previous stateless code. Now all DTLS 1.3 stateless handling is done in dtls.c
2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz 57dccc4cf4 Calculate cookie in SendStatelessReplyDtls13()
Not touching ssl->hsHashes while in stateless mode
2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz 2f31cdef69 Re-create hs header for hash 2023-03-07 12:04:54 +01:00
Juliusz Sosinowicz aa9dcca624 Rebase and Jenkins fixes 2023-03-07 12:02:54 +01:00
Juliusz Sosinowicz 984d709db0 dtls 1.3: Stateless ClientHello parsing 2023-03-07 12:02:54 +01:00
jordan 409ed6232a Used codespell and fixed obvious typos in src and wolfssl. 2023-03-02 09:52:07 -06:00
David Garske fc6d693dae Update logging enter, exit, msg to match function names. Fix some typos and improper use of "enter". Fix internal uses of `SSL_SUCCESS` and `SSL_FAILURE`. Add `WOLFSSL_DEBUG_NONBLOCK` option to allow printing iterations without debug enabled. 2023-02-21 12:02:15 -08:00
Jacob Barthelmeh 9dcc48c8f7 update copyright to 2023 2022-12-30 17:12:11 -07:00
Anthony Hu 7935a11b3e Fixups for problems discovered while testing for DTLS 1.3 2022-12-06 11:30:23 -05:00
Anthony Hu 6190666108 Support for Analog Devices MAXQ1080 and MAXQ1065 2022-11-23 11:57:31 -05:00
Per Allansson 0a88bb9779
Allow DTLS 1.3 to compile when FIPS is enabled 2022-10-31 08:42:13 +01:00
David Garske a5a9ab96e6
Merge pull request #5524 from rizlik/protocol_version_alerts
Dtls13: improvements
2022-09-29 10:59:06 -07:00
Juliusz Sosinowicz c72d315325 DTLS 1.3: Don't add HRR to ssl->dtls13Rtx
Signed-off-by: Marco Oliverio <marco@wolfssl.com>
2022-09-28 18:42:38 +02:00
Marco Oliverio 400d3c6963 dtls13: Dtls13ParseUnifiedRecordLayer: add overflow check 2022-09-21 16:01:35 +02:00
Marco Oliverio 804081e7c2 fix: GetDtls13RecordHeader:requires correct minimum size 2022-09-21 16:01:35 +02:00
David Garske 73dbc873bd
Merge pull request #5586 from julek-wolfssl/dtls-misc-security
Add missing minor security checks
2022-09-19 09:47:00 -07:00
Daniel Pouzzner 02cc7bf82e fix whitespace/linelength/indentation. 2022-09-17 12:53:37 -05:00
Juliusz Sosinowicz 1941fb2b35 Keep a separate drop counter for each epoch 2022-09-15 15:49:05 +02:00