summaryrefslogtreecommitdiffstats
path: root/ssl
AgeCommit message (Collapse)Author
2022-09-02QUIC Record Layer (Refactor and TX Side)Hugo Landau
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18949)
2022-09-02QUIC Demuxer and Record Layer (RX Side)Hugo Landau
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18949)
2022-09-01Remove unused dtls1_bitmap.cTomas Mraz
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19088)
2022-08-31Fix memory leak with TLS1.2 compressionJuergen Christ
Leak sanitizer reports following leak for ssl-test-new subtest 4-tlsv1_2-both-compress: ==335733==ERROR: LeakSanitizer: detected memory leaks Direct leak of 17728 byte(s) in 1 object(s) allocated from: #0 0x3ff9fbba251 in malloc (/usr/lib64/libasan.so.8+0xba251) #1 0x3ff9f71744f in tls_do_uncompress ssl/record/methods/tls_common.c:868 #2 0x3ff9f7175bd in tls_default_post_process_record ssl/record/methods/tls_common.c:896 #3 0x3ff9f715ee7 in tls_get_more_records ssl/record/methods/tls_common.c:773 #4 0x3ff9f712209 in tls_read_record ssl/record/methods/tls_common.c:958 #5 0x3ff9f6ef73f in ssl3_read_bytes ssl/record/rec_layer_s3.c:1235 #6 0x3ff9f776165 in tls_get_message_header ssl/statem/statem_lib.c:1198 #7 0x3ff9f74709b in read_state_machine ssl/statem/statem.c:624 #8 0x3ff9f74709b in state_machine ssl/statem/statem.c:478 #9 0x3ff9f662e61 in SSL_do_handshake ssl/ssl_lib.c:4430 #10 0x100c55d in do_handshake_step test/helpers/handshake.c:775 #11 0x100c55d in do_connect_step test/helpers/handshake.c:1134 #12 0x100e85b in do_handshake_internal test/helpers/handshake.c:1544 #13 0x1011715 in do_handshake test/helpers/handshake.c:1738 #14 0x101d1a7 in test_handshake test/ssl_test.c:543 #15 0x1027875 in run_tests test/testutil/driver.c:370 #16 0x1008393 in main test/testutil/main.c:30 #17 0x3ff9cc2b871 in __libc_start_call_main (/usr/lib64/libc.so.6+0x2b871) #18 0x3ff9cc2b94f in __libc_start_main_alias_2 (/usr/lib64/libc.so.6+0x2b94f) #19 0x100864f (/code/openssl/test/ssl_test+0x100864f) Direct leak of 17728 byte(s) in 1 object(s) allocated from: #0 0x3ff9fbba251 in malloc (/usr/lib64/libasan.so.8+0xba251) #1 0x3ff9f71744f in tls_do_uncompress ssl/record/methods/tls_common.c:868 #2 0x3ff9f7175bd in tls_default_post_process_record ssl/record/methods/tls_common.c:896 #3 0x3ff9f715ee7 in tls_get_more_records ssl/record/methods/tls_common.c:773 #4 0x3ff9f712209 in tls_read_record ssl/record/methods/tls_common.c:958 #5 0x3ff9f6ef73f in ssl3_read_bytes ssl/record/rec_layer_s3.c:1235 #6 0x3ff9f776165 in tls_get_message_header ssl/statem/statem_lib.c:1198 #7 0x3ff9f74709b in read_state_machine ssl/statem/statem.c:624 #8 0x3ff9f74709b in state_machine ssl/statem/statem.c:478 #9 0x3ff9f662e61 in SSL_do_handshake ssl/ssl_lib.c:4430 #10 0x100c55d in do_handshake_step test/helpers/handshake.c:775 #11 0x100c55d in do_connect_step test/helpers/handshake.c:1134 #12 0x1010b09 in do_handshake_internal test/helpers/handshake.c:1550 #13 0x1011715 in do_handshake test/helpers/handshake.c:1738 #14 0x101d1a7 in test_handshake test/ssl_test.c:543 #15 0x1027875 in run_tests test/testutil/driver.c:370 #16 0x1008393 in main test/testutil/main.c:30 #17 0x3ff9cc2b871 in __libc_start_call_main (/usr/lib64/libc.so.6+0x2b871) #18 0x3ff9cc2b94f in __libc_start_main_alias_2 (/usr/lib64/libc.so.6+0x2b94f) #19 0x100864f (/code/openssl/test/ssl_test+0x100864f) SUMMARY: AddressSanitizer: 35456 byte(s) leaked in 2 allocation(s). Fix this by freeing the SSL3_RECORD structure inside the OSSL_RECORD_LAYER. Signed-off-by: Juergen Christ <jchrist@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19030)
2022-08-29Tolerate a bad record version in TLSv1.3 plaintext recordsMatt Caswell
When a server responds to a second TLSv1.3 ClientHello it is required to set the legacy_record_version to 0x0303 (TLSv1.2). The client is required to ignore that field even if it is wrong. The recent changes to the read record layer in PR #18132 made the record layer stricter and it was checking that the legacy_record_version was the correct value. This caused connection failures when talking to buggy servers that set the wrong legacy_record_version value. We make us more tolerant again. Fixes #19051 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19058)
2022-08-26Convert serverinfo in SSL_CTX_use_serverinfo() to v2.Daniel Fiala
Fixes openssl#18183. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18614)
2022-08-24Updates for OSSL_TIME changesHugo Landau
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18676)
2022-08-24QUIC ACK Manager, Statistics Manager and Congestion Control APIHugo Landau
This is the initial implementation of the ACK Manager for OpenSSL's QUIC support, with supporting design documentation and tests. Because the ACK Manager also depends on the Statistics Manager, it is also implemented here. The Statistics Manager is quite simple, so this does not amount to a large amount of extra code. Because the ACK Manager depends on a congestion controller, it adds a no-op congestion controller, which uses the previously workshopped congestion control API. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18676)
2022-08-23Fix the return type for the rlayer_skip_early_data callbackMatt Caswell
There was a copy & paste error in the definition of the rlayer_skip_early_data callback. The return type is supposed to be "int" but it was defined as a pointer type. This was causing test failures on some platforms. Fixes #19037 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/19048)
2022-08-23rl->enc_ctx must be non-NULL and cipher must be setTomas Mraz
Otherwise ssl3_cipher() cannot work properly. Fixes Coverity CID 1509401 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19027)
2022-08-23Do not use RLAYERfatal on NULL RLAYERTomas Mraz
or on record layer that is to be freed anyway. Fixes Coverity CID 1509402, 1509403 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19027)
2022-08-19Coverity: misuses of time_tPauli
Coverity 1508506: Fixes a bug in the cookie code which would have caused problems for ten minutes before and after the lower 32 bits of time_t rolled over. Coverity 1508534 & 1508540: Avoid problems when the lower 32 bits of time_t roll over by delaying the cast to integer until after the time delta has been computed. Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19004)
2022-08-18Check record layer callbacks are non-nullMatt Caswell
The current libssl code always ensures that the callbacks are non-null. However, the record layer itself wasn't checkthing this. We ensure it does. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Formatting cleanupsMatt Caswell
Some minor formatting cleanups and other minor tweaks. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove redefinition of macrosMatt Caswell
Some macros were redefined in ssl3_cbc.c. We remove the redefinitions Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove redefinition of SSL_AD_NO_ALERTMatt Caswell
The SSL_AD_NO_ALERT value was defined in two places. We centralise its definition. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Ensure the rrl object is set to NULL after it is freedMatt Caswell
Once we free the rrl object we should NULL it to prevent a dangling ref to it. Otherwise we could get a double free. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Rename some functions to be more consistentMatt Caswell
Some functions in the record layer were called rlayer_*, but most were called tls_*. We standardise on the latter. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Rename DTLS1_BITMAP to DTLS_BITMAPMatt Caswell
The 1 in DTLS1 is confusing and is removed. We also tweak the structure to always be able to track 64 packets regardless of whether we are on a 32 bit or 64 bit system. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove ssl/record/README.mdMatt Caswell
This file contains design details for the old record layer and is no longer relevant for the new design. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Standardise type for epochMatt Caswell
The value for epoch was being represented internally via various types: uint16_t, unsigned short, unsigned int, unsigned long We standardise on uint16_t Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove the SSL3_RECORD read fieldMatt Caswell
The read field is no longer used and can be safely removed. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Clean up some SCTP releated issuesMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Ensure various record layer options can be updatedMatt Caswell
We would like the capability for the options/mode/read_ahead settings to be updateable after the record layer object has been instantiated. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some redundant codeMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Update the tls13encryptiontest for new read record layerMatt Caswell
The tls13encryption is an internal test that reaches inside libssl to test encryption/decryption of records. It needs to be amended for the new code structure so that it is testing the equivalent things as before. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Implement a human readable state function for the record layerMatt Caswell
This allows querying of the record layer to get a human readable state string out. This resolves two outstanding TODO comments and enables us to remove the rstate variable from s->rlayer. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Correct some formatting errors in tls1_meth.cMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Move SSL_MODE_RELEASE_BUFFERS into the read record layerMatt Caswell
This resolves an outstanding "TODO" item. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove a redundant TODOMatt Caswell
If read_ahead data is left over when a record layer closes down, there is already code present to push into the "next" BIO. So the TODO removed here is no longer relevant. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Cleanse the SSLv3 MAC secret when we clean up the read record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Move some fields out of the SSL object and into the record layer objectMatt Caswell
Fields such as rrlmethod and rrl are entirely related to the record layer, and so should be in that object. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove an unnecessary setup of the read bufferMatt Caswell
Now everything has been moved to the record layer the additional check for setting up the read buffer is not needed and can be removed. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Clear away some unused fields and cruft in the record layerMatt Caswell
Now that the read record layer has moved to the new architecture we can clear some of the old stuff away. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some references to rlayer.rstateMatt Caswell
This also fixes ssl3_pending while we are at it Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Ensure we use a dgram mem BIO for the DTLS record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some more redundant TODO(RECLAYER) commentsMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Resolve a TODO(RECLAYER) in the SSLv3 codeMatt Caswell
We remove some code outside of the record layer which is no longer relevant since its functions are now performed by the new record layer code. This removes a TODO(RECLAYER) as a result. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some TODO(RECLAYER) commentsMatt Caswell
Some TODO(RECLAYER) comments are no longer necessary and can be removed. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some unnecessary function pointers from OSSL_RECORD_METHODMatt Caswell
We had some temporary function pointers in OSSL_RECORD_METHOD which were only necessary during the process of refactoring the read record layer. These are no longer required so can be removed. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Standardise some DTLS record layer namingMatt Caswell
Remove references to dtls1_* and just use dtls_* Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some remaining SSL object references from DTLS record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Push unprocessed DTLS records from one record layer object to nextMatt Caswell
We add unprocessed DTLS records to the unprocessed record queue. When the record layer closes down we write the unprocessed records to the next record layer object. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove reliance on the SSL object from the DTLS read record layer codeMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Move some DTLS read code into the read record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove some final references to the SSL object in the record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Remove the separation betweeen enc_read_ctx and enc_write_ctxMatt Caswell
Similarly with read_hash and write_hash. In the new model we have a separate record layer object for reading and writing. Therefore we don't need to distinguish between reading and writing inside the record layer object in the encryption and md ctxs. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Enable the record layer to call the ssl_security callbackMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Use a record layer specific message callbackMatt Caswell
Don't use the message callback from the SSL object. Instead we use a wrapper callback so that the record layer does not need to be aware of the SSL object. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)
2022-08-18Move early data counting out of the SSL object and into the record layerMatt Caswell
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18132)