summaryrefslogtreecommitdiff
path: root/lib/libssl/d1_lib.c
AgeCommit message (Collapse)Author
2021-10-23Fold DTLS1_STATE_INTERNAL into DTLS1_STATE.Joel Sing
Now that DTLS1_STATE is opaque, fold DTLS1_STATE_INTERNAL back into DTLS1_STATE and remove D1I() usage. ok tb@
2021-10-21Avoid potential NULL dereferences in dtls1_free()Theo Buehler
ok jsing
2021-08-30Replace DTLS r_epoch with the read epoch from the TLSv1.2 record layer.Joel Sing
ok inoguchi@ tb@
2021-07-21Remove DTLS processed_rcds queue.Joel Sing
When DTLS handshake records are received from the next epoch, we will potentially queue them on the unprocessed_rcds queue - this is usually a Finished message that has been received without the ChangeCipherSuite (CCS) message (which may have been dropped or reordered). After the epoch increments (due to the CCS being received), the current code processes all records on the unprocessed queue and immediate queues them on the processed queue, which dtls1_get_record() then pulls from. This form of processing only adds more complexity and another queue. Instead, once the epoch increments, pull a single record from the unprocessed queue and process it, allowing the contents to be consumed by the caller. We repeat this process until the unprocessed queue is empty, at which point we go back to consuming messages from the wire. ok inoguchi@ tb@
2021-07-01Merge SSL_METHOD_INTERNAL into SSL_METHOD.Joel Sing
Now that SSL_METHOD is opaque and in internal headers, we can remove SSL_METHOD_INTERNAL by merging it back into SSL_METHOD. ok tb@
2021-06-19Provide the ability to set the initial DTLS epoch value.Joel Sing
This allows for regress to test edge cases for epoch handling. ok tb@
2021-06-19Initialise the epoch for the DTLS processed and unprocessed queues.Joel Sing
Currently these only get correctly initialised when dtls1_process_buffered_records() is called - while this works it is more accidental than intentional. ok tb@
2021-05-16Move DTLS structs/definitions/prototypes to dtls_locl.h.Joel Sing
Now that the DTLS structs are opaque, add a dtls_locl.h header and move internal-only structs from dtls1.h, along with prototypes from ssl_locl.h. Only pull this header in where DTLS code actually exists. ok inoguchi@ tb@
2021-02-20Clean up/simplify dtls1_get_cipher().Joel Sing
ok tb@
2021-01-21Mop up unused dtls1_build_sequence_number() function.Joel Sing
2020-10-03Use TLSv1_1_enc_data instead of DTLSv1_enc_data.Joel Sing
DTLSv1 is TLSv1.1 over datagrams - there is no need for a separate SSL3_ENC_METHOD struct, just use TLSv1_1_enc_data and remove DTLSv1_enc_data entirely. ok tb@
2020-09-26Call dtls1_hm_fragment_free() from dtls1_drain_fragments()Joel Sing
Currently dtls1_drain_fragments() has a incomplete handrolled version of dtls1_hm_fragment_free(), which has the potential to leak memory. Replace the handrolled free with a call to dtls1_hm_fragment_free(). ok inoguchi@ tb@
2020-09-26Have dtls1_new() call dtls1_free() on failure.Joel Sing
Allocate into the appropriate structures and call dtls1_free() on failure, rather than allocating into local variables and then remembering to free various things on failure. ok tb@
2020-09-26Refactor dtls1_clear_queues()Theo Buehler
An upcoming cleanup diff by jsing needs dtls1_clear_queues() to be able to handle NULL pqueues. While one can easily add a NULL check to pqueue_pop(), this does not really fit in with the rest of the code. There are two kinds of while loops in dtls1_clear_queues that drain pqueues, so add two helper functions with a NULL check each. ok jsing
2020-09-24Release read and write buffers using freezero().Joel Sing
Provide a ssl3_release_buffer() function that correctly frees a buffer and call it from the appropriate locations. While here also change ssl3_release_{read,write}_buffer() to void since they cannot fail and no callers check the return value currently. ok beck@ inoguchi@ tb@
2020-07-07Remove some unnecessary function pointers from SSL_METHOD_INTERNAL.Joel Sing
ssl_version is completely unused and get_timeout is the same everywhere. ok beck@ inoguchi@ tb@
2020-03-12Use internal versions of SSL3_BUFFER, SSL3_RECORD and DTLS1_RECORD_DATA.Joel Sing
SSL3_BUFFER, SSL3_RECORD and DTLS1_RECORD_DATA are currently still in public headers, even though their usage is internal. This moves to using _INTERNAL suffixed versions that are in internal headers, which then allows us to change them without any potential public API fallout. ok inoguchi@ tb@
2020-03-10Remove the enc function pointers.Joel Sing
The enc function pointers do not serve any purpose these days - remove a layer of indirection and call dtls1_enc()/tls1_enc() directly. ok inoguchi@ tb@
2020-02-21Convert dtls1_build_sequence_number() to CBB.Joel Sing
ok inoguchi@ tb@
2017-04-10Use freezero() for the internal opaque structures, instead of the currentJoel Sing
explicit_bzero()/free(). Less code and potentially less overhead.
2017-02-07Change SSLerror() back to taking two args, with the first one being an SSL *.Bob Beck
Make a table of "function codes" which maps the internal state of the SSL * to something like a useful name so in a typical error in the connection you know in what sort of place in the handshake things happened. (instead of by arcane function name). Add SSLerrorx() for when we don't have an SSL * ok jsing@ after us both being prodded by bluhm@ to make it not terrible
2017-01-26Send the error function codes to rot in the depths of hell where they belongBob Beck
We leave a single funciton code (0xFFF) to say "SSL_internal" so the public API will not break, and we replace all internal use of the two argument SSL_err() with the internal only SSL_error() that only takes a reason code. ok jsing@
2017-01-26Remove most of SSL3_ENC_METHOD - we can just inline the function callsJoel Sing
and defines since they are the same everywhere. ok beck@
2017-01-25Change the SSL_IS_DTLS() macro to check the version, rather than using aJoel Sing
flag in the encryption methods. We can do this since there is currently only one DTLS version. This makes upcoming changes easier. ok beck@
2017-01-23Split most of SSL_METHOD out into an internal variant, which is opaque.Joel Sing
Discussed with beck@
2017-01-22Move most of DTLS1_STATE to internal.Bob Beck
ok jsing@
2017-01-22Convert publically visible structs to translucent structs.Joel Sing
This change adds an internal opaque struct for each of the significant publically visible structs. The opaque struct is then allocated and attached to the publically visible struct when the appropriate *_new() function is called, then cleared and freed as necessary. This will allow for changes to be made to the internals of libssl, without requiring a major bump each time the publically visible structs are modified. ok beck@
2016-11-04Mark a couple local functions as staticPhilip Guenther
ok jsing@ beck@
2016-02-29remove NULL checks for pqueue_free()Michael McConville
ok doug@
2015-10-07include <sys/time.h> for gettimeofday(2)Brent Cook
2015-09-10Remove support for DTLS_BAD_VER. We do not support non-standard andJoel Sing
incomplete implementations just so that we can interoperate with products from vendors who have not bothered to fix things in the last ~10 years. ok bcook@ miod@
2015-09-10Correct spelling of OPENSSL_cleanse.Joel Sing
ok miod@
2015-07-19Allow *_free() functions in libssl to handle NULL input.Doug Hogan
This mimics free()'s behavior which makes error handling simpler. ok bcook@ miod@
2015-03-19Fix several crash causing defects from OpenSSL.Ted Unangst
These include: CVE-2015-0209 - Use After Free following d2i_ECPrivatekey error CVE-2015-0286 - Segmentation fault in ASN1_TYPE_cmp CVE-2015-0287 - ASN.1 structure reuse memory corruption CVE-2015-0289 - PKCS7 NULL pointer dereferences Several other issues did not apply or were already fixed. Refer to https://www.openssl.org/news/secadv_20150319.txt joint work with beck, doug, guenther, jsing, miod
2015-02-09Jettison DTLS over SCTP.Joel Sing
OpenBSD does not have SCTP support and it sees little use in the wild. OPENSSL_NO_SCTP is already specified via opensslfeatures.h, hence this is a code removal only and symbols should remain unchanged. ok beck@ miod@ tedu@
2014-12-14Remove trailing whitespace.Joel Sing
2014-11-16Sort and group includes.Joel Sing
2014-07-17avoid sys/param.h; Jonas TermansenTheo de Raadt
2014-07-11In dtls1_clear_queues(), free buffered_add_data.q correctly, it's made ofMiod Vallat
DTLS1_RECORD_DATA, not hm_fragment. OpenSSL PR #3286 via OpenSSL trunk.
2014-07-09remove unused, private version strings except SSL_version_strBrent Cook
Also remove unused des_ver.h, which exports some of these strings, but is not installed. ok miod@ tedu@
2014-06-21Pull the code that builds a DTLS sequence number out into its own functionJoel Sing
to avoid duplication. Also use fewer magic numbers. ok miod@
2014-06-13Remove support for the `opaque PRF input' extension, which draft has expiredMiod Vallat
7 years ago and never made it into an RFC. That code wasn't compiled in anyway unless one would define the actual on-the-wire extension id bytes; crank libssl major. With help and enlightenment from Brendan MacDonell.
2014-06-12tags as requested by miod and teduTheo de Raadt
2014-06-11Fix memory leak: free s if calloc fails.Loganaden Velvindron
(From Jonas Maebe) OK from beck@
2014-05-29Make it substantially easier to identify protocol version requirementsJoel Sing
by adding an enc_flags field to the ssl3_enc_method, specifying four flags that are used with this field and providing macros for evaluating these conditions. Currently the version requirements are identified by continually checking the version number and other criteria. This change also adds separate SSL3_ENC_METHOD data for TLS v1.1 and v1.2, since they have different enc_flags from TLS v1. Based on changes in OpenSSL head. No objection from miod@
2014-05-28There is no point in checking if a pointer is non-NULL before calling free,Joel Sing
since free already does this for us. Also remove some pointless NULL assignments, where the result from malloc(3) is immediately assigned to the same variable. ok miod@
2014-05-26repair some KNF missed by the script; ok jsingTheo de Raadt
2014-05-24Use C99 initialisers for SSL3_ENC_METHOD structs.Joel Sing
ok miod@
2014-05-22Stop pulling pqueue.h into ssl_locl.h since only a small part of libsslJoel Sing
actually needs it. Instead, just include it in the files where it is actually necessary. Also remove standard includes from pqueue.h so that they are not available as a side effect. Just add the two includes that are needed to pqueue.c. ok miod@
2014-04-20gettimeofday() is portable enough and does not need a wrapperTheo de Raadt