summaryrefslogtreecommitdiffstats
path: root/ssl
AgeCommit message (Collapse)Author
2015-01-22mark all block comments that need format preserving so thatTim Hudson
indent will not alter them when reformatting comments (cherry picked from commit 1d97c8435171a7af575f73c526d79e1ef0ee5960) Conflicts: crypto/bn/bn_lcl.h crypto/bn/bn_prime.c crypto/engine/eng_all.c crypto/rc4/rc4_utl.c crypto/sha/sha.h ssl/kssl.c ssl/t1_lib.c Conflicts: crypto/rc4/rc4_enc.c crypto/x509v3/v3_scts.c crypto/x509v3/v3nametest.c ssl/d1_both.c ssl/s3_srvr.c ssl/ssl.h ssl/ssl_locl.h ssl/ssltest.c ssl/t1_lib.c Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-08A memory leak can occur in dtls1_buffer_record if either of the calls toMatt Caswell
ssl3_setup_buffers or pqueue_insert fail. The former will fail if there is a malloc failure, whilst the latter will fail if attempting to add a duplicate record to the queue. This should never happen because duplicate records should be detected and dropped before any attempt to add them to the queue. Unfortunately records that arrive that are for the next epoch are not being recorded correctly, and therefore replays are not being detected. Additionally, these "should not happen" failures that can occur in dtls1_buffer_record are not being treated as fatal and therefore an attacker could exploit this by sending repeated replay records for the next epoch, eventually causing a DoS through memory exhaustion. Thanks to Chris Mueller for reporting this issue and providing initial analysis and a patch. Further analysis and the final patch was performed by Matt Caswell from the OpenSSL development team. CVE-2015-0206 Reviewed-by: Dr Stephen Henson <steve@openssl.org>
2015-01-08Unauthenticated DH client certificate fix.Dr. Stephen Henson
Fix to prevent use of DH client certificates without sending certificate verify message. If we've used a client certificate to generate the premaster secret ssl3_get_client_key_exchange returns 2 and ssl3_get_cert_verify is never called. We can only skip the certificate verify message in ssl3_get_cert_verify if the client didn't send a certificate. Thanks to Karthikeyan Bhargavan for reporting this issue. CVE-2015-0205 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-01-08Follow on from CVE-2014-3571. This fixes the code that was the original sourceMatt Caswell
of the crash due to p being NULL. Steve's fix prevents this situation from occuring - however this is by no means obvious by looking at the code for dtls1_get_record. This fix just makes things look a bit more sane. Reviewed-by: Dr Steve Henson <steve@openssl.org>
2015-01-08Fix crash in dtls1_get_record whilst in the listen state where you get twoDr. Stephen Henson
separate reads performed - one for the header and one for the body of the handshake record. CVE-2014-3571 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-01-07fix error discrepancyDr. Stephen Henson
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 4a4d4158572fd8b3dc641851b8378e791df7972d)
2015-01-06Only inherit the session ID context in SSL_set_SSL_CTX if the existingEmilia Kasper
context was also inherited (matches that of the existing SSL_CTX). Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit ac8e9cbe14b59dacfe4ac52bc5ff06f8003e9b01)
2015-01-06Only allow ephemeral RSA keys in export ciphersuites.Dr. Stephen Henson
OpenSSL clients would tolerate temporary RSA keys in non-export ciphersuites. It also had an option SSL_OP_EPHEMERAL_RSA which enabled this server side. Remove both options as they are a protocol violation. Thanks to Karthikeyan Bhargavan for reporting this issue. (CVE-2015-0204) Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 4b4c1fcc88aec8c9e001b0a0077d3cd4de1ed0e6) Conflicts: doc/ssl/SSL_CTX_set_options.pod
2015-01-05ECDH downgrade bug fix.Dr. Stephen Henson
Fix bug where an OpenSSL client would accept a handshake using an ephemeral ECDH ciphersuites with the server key exchange message omitted. Thanks to Karthikeyan Bhargavan for reporting this issue. CVE-2014-3572 Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit b15f8769644b00ef7283521593360b7b2135cb63)
2015-01-05Ensure that the session ID context of an SSL* is updatedAdam Langley
when its SSL_CTX is updated. From BoringSSL commit https://boringssl.googlesource.com/boringssl/+/a5dc545bbcffd9c24cebe65e9ab5ce72d4535e3a Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 61aa44ca99473f9cabdfb2d3b35abd0b473437d1)
2015-01-02Clear existing extension state.Dr. Stephen Henson
When parsing ClientHello clear any existing extension state from SRP login and SRTP profile. Thanks to Karthikeyan Bhargavan for reporting this issue. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 47606dda672a5008168f62d4b7d7f94cd2d31313) Conflicts: ssl/t1_lib.c
2014-12-17Clear warnings/errors within TLS_DEBUG code sectionsRichard Levitte
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit bf68456f538cacc9dcfd00986962aef0e8538289)
2014-12-17Clear warnings/errors within KSSL_DEBUG code sectionsRichard Levitte
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 53332a75d16a5bb3b9d90c15fcf38d2e87160a52)
2014-12-17Clear warnings/errors within CIPHER_DEBUG code sectionsRichard Levitte
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit cd387d21daa939862e081f00be0a98dbc5a85351)
2014-12-17Clear warnings/errors within CIPHER_DEBUG code sectionsRichard Levitte
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 0c403e80a9952c83a38eab3c8a4ce42e17a2cee0)
2014-12-17Premaster secret handling fixesAdam Langley
From BoringSSL - Send an alert when the client key exchange isn't correctly formatted. - Reject overly short RSA ciphertexts to avoid a (benign) out-of-bounds memory access. Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 4aecfd4d9f366c849c9627ab666d1b1addc024e6)
2014-12-16Add OPENSSL_NO_ECDH guardsMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-12-16Remove extraneous white space, and add some bracesMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 55e530265a7ea8f264717a4e37338cc04eca2007)
2014-12-16DTLS fixes for signed/unsigned issuesMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 1904d21123849a65dafde1705e6dd5b7c2f420eb)
2014-12-15Checkout return value of dtls1_output_cert_chainMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-15Check return value of ssl3_output_cert_chainMatt Caswell
Based on commit 66f96fe2d519147097c118d4bf60704c69ed0635 by Steve Henson Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-13Fix memory leak in s2_srvr.c if BUF_MEM_grow failsMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit d04a1e0b5beb3329cdf8c4ec35b9113cbc41d2f2)
2014-12-13Fixed memory leak if BUF_MEM_grow failsMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit bb1ddd3d9a0d01656b90693a214b911995a5fe8c)
2014-12-08Fixed memory leak in the event of a failure of BUF_MEM_growMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 41bf25013032da0eeb111ce3c8fc0946c0e61c41)
2014-12-08Fix memory leak in SSL_new if errors occur.Matt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 76e6509085ea96df0ca542568ee2596343711307)
2014-12-05Reject elliptic curve lists of odd lengths.Emilia Kasper
The Supported Elliptic Curves extension contains a vector of NamedCurves of 2 bytes each, so the total length must be even. Accepting odd-length lists was observed to lead to a non-exploitable one-byte out-of-bounds read in the latest development branches (1.0.2 and master). Released versions of OpenSSL are not affected. Thanks to Felix Groebert of the Google Security Team for reporting this issue. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 33d5ba862939ff8db70a9e36fc9a326fab3e8d98)
2014-12-04Remove incorrect code inadvertently introduced through commit 59669b6ab.Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> Conflicts: ssl/d1_lib.c
2014-12-03Remove "#if 0" codeMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 4bb8eb9ce4f794fecf020a15b54e8505fced0edf)
2014-12-03Only use the fallback mtu after 2 unsuccessful retransmissions if it is lessMatt Caswell
than the mtu we are already using Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 047f21593eebbc617a410a208ded01e65ca11028)
2014-12-03If we really get a situation where the underlying mtu is less than the minimumMatt Caswell
we will support then dtls1_do_write can go into an infinite loop. This commit fixes that. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit d3d9eef31661633f5b003a9e115c1822f79d1870)
2014-12-03Fix dtls_query_mtu so that it will always either complete with an mtu that isMatt Caswell
at least the minimum or it will fail. There were some instances in dtls1_query_mtu where the final mtu can end up being less than the minimum, i.e. where the user has set an mtu manually. This shouldn't be allowed. Also remove dtls1_guess_mtu that, despite having logic for guessing an mtu, was actually only ever used to work out the minimum mtu to use. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 1620a2e49c777f31f2ce57966ae74006b48ad759)
2014-12-03Remove instances in libssl of the constant 28 (for size of IPv4 header + UDP)Matt Caswell
and instead use the value provided by the underlying BIO. Also provide some new DTLS_CTRLs so that the library user can set the mtu without needing to know this constant. These new DTLS_CTRLs provide the capability to set the link level mtu to be used (i.e. including this IP/UDP overhead). The previous DTLS_CTRLs required the library user to subtract this overhead first. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 59669b6abf620d1ed2ef4d1e2df25c998b89b64d) Conflicts: ssl/d1_both.c ssl/ssl_lib.c
2014-12-03The first call to query the mtu in dtls1_do_write correctly checks that theMatt Caswell
mtu that we have received is not less than the minimum. If its less it uses the minimum instead. The second call to query the mtu does not do that, but instead uses whatever comes back. We have seen an instance in RT#3592 where we have got an unreasonably small mtu come back. This commit makes both query checks consistent. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 6abb0d1f8e702a0daa9c32b8021d01eda0483018)
2014-12-03The SSL_OP_NO_QUERY_MTU option is supposed to stop the mtu from beingMatt Caswell
automatically updated, and we should use the one provided instead. Unfortunately there are a couple of locations where this is not respected. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 001235778a6e9c645dc0507cad6092d99c9af8f5)
2014-12-03Verify that we have a sensible message len and fail if notMatt Caswell
RT#3592 provides an instance where the OPENSSL_assert that this commit replaces can be hit. I was able to recreate this issue by forcing the underlying BIO to misbehave and come back with very small mtu values. This happens the second time around the while loop after we have detected that the MTU has been exceeded following the call to dtls1_write_bytes. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit cf75017bfd60333ff65edf9840001cd2c49870a3)
2014-11-28[PR3597] Advance to the next state variant when reusing messages.Richard Levitte
Previously, state variant was not advanced, which resulted in state being stuck in the st1 variant (usually "_A"). This broke certificate callback retry logic when accepting connections that were using SSLv2 ClientHello (hence reusing the message), because their state never advanced to SSL3_ST_SR_CLNT_HELLO_C variant required for the retry code path. Reported by Yichun Zhang (agentzh). Signed-off-by: Piotr Sikora <piotr@cloudflare.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2014-11-27Fixed warning in ssl2_encMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2014-11-27Check EVP_Cipher return values for SSL2Matt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2014-11-27Add checks to the return value of EVP_Cipher to prevent silent encryption ↵Matt Caswell
failure. PR#1767 Reviewed-by: Richard Levitte <levitte@openssl.org>
2014-11-27Remove redundant checks in ssl_cert_dup. This was causing spurious error ↵Matt Caswell
messages when using GOST PR#3613 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit fc3968a25ce0c16cab8730ec0d68a59856158029)
2014-11-27Add include of ssl.h which is required by srtp.hMatt Caswell
Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit f67203836cd4a35c1774b6147e0f2d33eb7b1b6f)
2014-11-26Fixed memory leak due to incorrect freeing of DTLS reassembly bit maskMatt Caswell
PR#3608 Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 8a35dbb6d89a16d792b79b157b3e89443639ec94)
2014-11-25Corrected comments in ssl.h about SSLv23_method and friendsMatt Caswell
PR#3574 Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit 3a0765882c4b3b67960b7efb203570764dd4ed29)
2014-11-20Do not resume a session if the negotiated protocol version does not matchDavid Benjamin
the session's version (server). See also BoringSSL's commit bdf5e72f50e25f0e45e825c156168766d8442dde. Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit 9e189b9dc10786c755919e6792e923c584c918a1)
2014-11-20Ensure SSL3_FLAGS_CCS_OK (or d1->change_cipher_spec_ok for DTLS) is resetEmilia Kasper
once the ChangeCipherSpec message is received. Previously, the server would set the flag once at SSL3_ST_SR_CERT_VRFY and again at SSL3_ST_SR_FINISHED. This would allow a second CCS to arrive and would corrupt the server state. (Because the first CCS would latch the correct keys and subsequent CCS messages would have to be encrypted, a MitM attacker cannot exploit this, though.) Thanks to Joeri de Ruiter for reporting this issue. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit e94a6c0ede623960728415b68650a595e48f5a43) Conflicts: CHANGES ssl/s3_srvr.c
2014-11-20Always require an advertised NewSessionTicket message.Emilia Kasper
The server must send a NewSessionTicket message if it advertised one in the ServerHello, so make a missing ticket message an alert in the client. An equivalent change was independently made in BoringSSL, see commit 6444287806d801b9a45baf1f6f02a0e3a16e144c. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit de2c7504ebd4ec15334ae151a31917753468f86f) Conflicts: CHANGES
2014-11-20Remove ssl3_check_finished.Emilia Kasper
The client sends a session ID with the session ticket, and uses the returned ID to detect resumption, so we do not need to peek at handshake messages: s->hit tells us explicitly if we're resuming. An equivalent change was independently made in BoringSSL, see commit 407886f589cf2dbaed82db0a44173036c3bc3317. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 980bc1ec6114f5511b20c2e6ca741e61a39b99d6) Conflicts: ssl/d1_clnt.c ssl/s3_clnt.c
2014-11-20Set s->hit when resuming from external pre-shared secret.Emilia Kasper
The same change was independently made in BoringSSL, see commit 9eaeef81fa2d4fd6246dc02b6203fa936a5eaf67 Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 7b3ba508af5c86afe43e28174aa3c53a0a24f4d9)
2014-11-20Reset s->tlsext_ticket_expected in ssl_scan_serverhello_tlsext.Emilia Kasper
This ensures that it's zeroed even if the SSL object is reused (as in ssltest.c). It also ensures that it applies to DTLS, too. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit a06cd5d056c6a5b1d161786873e21a5e53d554d8)
2014-11-19New option no-ssl3-method which removes SSLv3_*methodDr. Stephen Henson
When no-ssl3 is set only make SSLv3 disabled by default. Retain -ssl3 options for s_client/s_server/ssltest. When no-ssl3-method is set SSLv3_*method() is removed and all -ssl3 options. We should document this somewhere, e.g. wiki, FAQ or manual page. Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 3881d8106df732fc433d30446625dfa2396da42d) Conflicts: util/mkdef.pl