summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_both.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* This is errata/6.8/013_libressl.patch.siglibressl-v3.2.4tb2021-02-031-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Various interoperability issues and memory leaks were discovered in libcrypto and libssl. The new verifier is not bug compatible with the old verifier and caused many issues by failing to propagate errors correctly, returning different error codes than some software was trained to expect and otherwise failing when it shouldn't. While much of this is fixed in -current, it's still not perfect, so switching back to the legacy verifier is preferable at this point. Other included fixes: * Unbreak DTLS retransmissions for flights that include a CCS * Only check BIO_should_read() on read and BIO_should_write() on write * Implement autochain for the TLSv1.3 server * Use the legacy verifier for AUTO_CHAIN * Implement exporter for TLSv1.3 * Free alert_data and phh_data in tls13_record_layer_free() * Plug leak in x509_verify_chain_dup() * Free the policy tree in x509_vfy_check_policy() Original commits by jsing and tb ok inoguchi jsing
* Call dtls1_hm_fragment_free() from dtls1_drain_fragments()jsing2020-09-261-3/+3
| | | | | | | | 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@
* Have dtls1_hm_fragment_new() call dtls1_hm_fragment_free() on failure.jsing2020-09-261-26/+17
| | | | | | | | | | Rather than using local variables and having to remember which things need to be freed upon a failure at a certain point, simply allocate into the hm_fragment struct and call dtls1_hm_fragment_free() on failure. Also use calloc() to ensure memory is appropriately zeroed/initialised. ok tb@
* Use 0 instead of 0x00 for memset() calls.jsing2020-08-111-4/+4
| | | | ok inoguchi@ tb@
* "non-existant" is one of those words that don't exist, so use "non-existent"phessler2019-02-101-2/+2
| | | | | | | instead From Pamela Mosiejczuk, many thanks! OK phessler@ deraadt@
* Clean up and simplify the handshake transcript code.jsing2018-11-081-3/+3
| | | | | | | This provides a cleaner, simpler and more readable API, with code that uses a BUF_MEM instead of a BIO. ok beck@ ("hurry up") and tb@.
* Use the newer/more sensible names for EVP_MD_CTX_* functions.jsing2018-09-051-2/+2
| | | | | | | | | | EVP_MD_CTX_create -> EVP_MD_CTX_new EVP_MD_CTX_destroy -> EVP_MD_CTX_free This should make the intent more obvious and reduce head scratching during code reviews. Raised by tb@
* Nuke ssl_pending/ssl_shutdown function pointers.jsing2018-08-301-10/+1
| | | | | | | ssl3_pending() is used for all protocols and dtls1_shutdown() just calls ssl3_shutdown(), so just call the appropriate function directly instead. ok beck@ inoguchi@ tb@
* Dedup DTLS header writing code and convert to CBB.jsing2018-08-271-25/+35
| | | | | | | | | There are three versions of the DTLS header writing code, which primarily differ by the fragment offset and fragment length values that differ. Rework dtls1_write_message_header() such that it can be used in all three cases and convert it to CBB in the process. ok inoguchi@ tb@
* Convert ssl3_send_change_cipher_spec() to use CBB and make it handle DTLS,jsing2017-10-081-39/+2
| | | | | | which allows us to drop dtls1_send_change_cipher_spec() entirely. ok inoguchi@
* Move state from ssl->internal to the handshake structure.beck2017-05-071-4/+4
| | | | | | | while we are at it, convert SSLerror to use a function internally, so that we may later allocate the handshake structure and check for it ok jsing@
* Drop the second argument of dtls1_set_message_header() and make it a voidjsing2017-03-041-6/+4
| | | | | function. Nothing makes use of the return value and the second argument was only used to produce the return value...
* Change SSLerror() back to taking two args, with the first one being an SSL *.beck2017-02-071-9/+9
| | | | | | | | | 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
* Finish the fallout of the SSLerr->SSLerror cleanup to get rid of the uglybeck2017-01-261-15/+8
| | | | line wraps that resulted
* Send the error function codes to rot in the depths of hell where they belongbeck2017-01-261-9/+9
| | | | | | | 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@
* Split most of SSL_METHOD out into an internal variant, which is opaque.jsing2017-01-231-7/+7
| | | | Discussed with beck@
* send state and rstate from ssl_st into internal. There are accessorsbeck2017-01-231-4/+4
| | | | | so these should not be diddled with directly ok jsing@
* Move a large part of ssl_st into internal, so we can see what squeals.beck2017-01-231-70/+70
| | | | ok jsing@
* move the callbacks from ssl_st to internalbeck2017-01-231-10/+10
| | | | ok jsing@
* Move most of the SSL3_STATE fields to internal - the ones that remain arejsing2017-01-221-18/+18
| | | | | | known to be used by ports. ok beck@
* Move most of DTLS1_STATE to internal.beck2017-01-221-58/+58
| | | | ok jsing@
* Now that ssl3_send_{client,server}_certificate() are using the commonjsing2016-12-061-75/+1
| | | | handshake functions, we can remove more copied code from DTLS.
* Make sure stdio functions don't end up in the library, from miod@beck2016-03-061-1/+7
| | | | ok doug@ bcook@
* Rename functions that moved to t1_enc.c, with a tls1_ prefix instead of ajsing2015-09-111-3/+3
| | | | | | ssl3_ prefix. ok beck@
* Replace dtls1_send_finished() with ssl3_send_finished() - they're nowjsing2015-09-111-42/+1
| | | | | | | both essentially the same (in fact DTLS benefits from improvements previously made to the ssl3_send_finished() function). ok beck@
* Convert dtls1_send_finished() and ssl3_send_finished() tojsing2015-09-111-12/+5
| | | | | | ssl3_handshake_msg_start()/ssl3_handshake_msg_finish(). ok beck@
* Remove support for DTLS_BAD_VER. We do not support non-standard andjsing2015-09-101-13/+5
| | | | | | | 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@
* Allow *_free() functions in libssl to handle NULL input.doug2015-07-191-1/+3
| | | | | | This mimics free()'s behavior which makes error handling simpler. ok bcook@ miod@
* Convert dtls1_get_message_header to CBS and change to int.doug2015-07-181-12/+32
| | | | | | | Changed return value from void to int. It should never return an error given that the input length is not checked yet. ok miod@
* Jettison DTLS over SCTP.jsing2015-02-091-16/+1
| | | | | | | | 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@
* Provide functions for starting, finishing and writing SSL handshakejsing2014-12-141-1/+3
| | | | | | | | | | | | | | | messages. This will allow for removal of repeated/duplicated code. Additionally, DTLS was written by wholesale copying of the SSL/TLS code, with some DTLS specifics being added to the duplicated code. Since these SSL handshake message functions know how to handle both SSL/TLS and DTLS, upon conversion the duplicate versions will become identical (or close to), at which point the DTLS versions can be removed and the SSL/TLS versions used for both protocols. Partially based on similar changes in OpenSSL. ok miod@
* Sort and group includes.jsing2014-11-161-3/+5
|
* Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes().jsing2014-10-181-2/+1
| | | | | | | | | | | | | | | arc4random provides high quality pseudo-random numbers, hence there is no need to differentiate between "strong" and "pseudo". Furthermore, the arc4random_buf() function is guaranteed to succeed, which avoids the need to check for and handle failure, simplifying the code. It is worth noting that a number of the replaced RAND_bytes() and RAND_pseudo_bytes() calls were missing return value checks and these functions can fail for a number of reasons (at least in OpenSSL - thankfully they were converted to wrappers around arc4random_buf() some time ago in LibreSSL). ok beck@ deraadt@ miod@
* Fix CVE-2014-3507, avoid allocating and then leaking a fresh fragmentguenther2014-08-081-2/+7
| | | | | | | | | structure when a zero-length fragment is received. Based on https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=d0a4b7d1a2948fce38515b8d862f43e7ba0ebf74 diff by miod@, ok guenther@ bcook@ deraadt@
* Fix CVE-2014-3506, DTLS handshake message size checks. Fromguenther2014-08-071-16/+22
| | | | | | | https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=1250f12613b61758675848f6600ebd914ccd7636 with comment/whitespace style tweaks ok bcook@ miod@
* Oops, revert changes commited by mistake. The previous commit was supposedmiod2014-08-071-2/+3
| | | | to only apply to s23_srvr.c.
* When you expect a function to return a particular value, don't put a commentmiod2014-08-071-3/+2
| | | | | | | | | | | saying that you expect it to return that value and compare it against zero because it is supposedly faster, for this leads to bugs (especially given the high rate of sloppy cut'n'paste within ssl3 and dtls1 routines in this library). Instead, compare for the exact value it ought to return upon success. ok deraadt@
* decompress libssl. ok beck jsingtedu2014-07-101-6/+1
|
* KNF comments, reflowing and moving out of the middle of argument lists inguenther2014-07-101-45/+84
| | | | | | places ok jsing@
* Memory leak in error path of the day, from clang via dhill@bitrig;miod2014-07-021-2/+3
| | | | ok dhill@bitrig
* tags as requested by miod and teduderaadt2014-06-121-1/+1
|
* Do not recurse when a 'Hello Request' message is received while gettingjsing2014-06-051-1/+2
| | | | | | | | | DTLS fragments. A stream of 'Hello Request' messages will result in infinite recursion, eventually crashing the DTLS client or server. Fixes CVE-2014-0221, from OpenSSL. Reported to OpenSSL by Imre Rad.
* Avoid a buffer overflow that can be triggered by sending specially craftedjsing2014-06-051-1/+7
| | | | | | | | | | DTLS fragments. Fix for CVE-2014-0195, from OpenSSL. Reported to OpenSSL by Juri Aedla. ok deraadt@ beck@
* BUF_MEM_grow_clean() takes a size_t as the size argument. Remove false commentsmiod2014-05-311-1/+1
| | | | | | | mentioning it's an int, bogus (int) casts and bounds checks against INT_MAX (BUF_MEM_grow_clean has its own integer bounds checks). ok deraadt@
* remove some #if 0 code. we don't need any more reminders that we're usingtedu2014-05-301-49/+0
| | | | a not quite appropriate data structure. ok jsing
* There is no point in checking if a pointer is non-NULL before calling free,jsing2014-05-281-6/+3
| | | | | | | | 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@
* Stop pulling pqueue.h into ssl_locl.h since only a small part of libssljsing2014-05-221-0/+2
| | | | | | | | | | 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@
* In dtls1_reassemble_fragment() and dtls1_process_out_of_seq_message(), in casemiod2014-05-181-7/+3
| | | | | | | | of error, make sure we do not free pitem which is still linked into the pqueue. In the same vain, only free `frag' if we allocated it in this function. Help and ok beck@
* Avoid a potential null pointer dereference by checking that we actuallyjsing2014-04-301-0/+2
| | | | | | managed to allocate a fragment, before trying to memcpy data into it. ok miod@
* More KNF.jsing2014-04-241-92/+122
|