summaryrefslogtreecommitdiffstats
path: root/ssl/d1_both.c
AgeCommit message (Collapse)Author
2015-01-22indent has problems with comments that are on the right hand side of a line.Matt Caswell
Sometimes it fails to format them very well, and sometimes it corrupts them! This commit moves some particularly problematic ones. Conflicts: crypto/bn/bn.h crypto/ec/ec_lcl.h crypto/rsa/rsa.h demos/engines/ibmca/hw_ibmca.c ssl/ssl.h ssl/ssl3.h Conflicts: crypto/ec/ec_lcl.h ssl/tls1.h Reviewed-by: Tim Hudson <tjh@openssl.org>
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>
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-03Remove "#if 0" codeMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 4bb8eb9ce4f794fecf020a15b54e8505fced0edf)
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-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-09-08RT3301: Discard too-long heartbeat requestsErik Auerswald
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit af4c6e348e4bad6303e7d214cdcf2536487aabe4)
2014-08-06Remove some duplicate DTLS code.Adam Langley
In a couple of functions, a sequence number would be calculated twice. Additionally, in |dtls1_process_out_of_seq_message|, we know that |frag_len| <= |msg_hdr->msg_len| so the later tests for |frag_len < msg_hdr->msg_len| can be more clearly written as |frag_len != msg_hdr->msg_len|, since that's the only remaining case. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Applying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS ↵Matt Caswell
fragment would cause *ok to be clear, but the return value would still be the number of bytes read. Problem identified by Emilia Käsper, based on previous issue/patch by Adam Langley. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Fix return code for truncated DTLS fragment.Adam Langley
Previously, a truncated DTLS fragment in |dtls1_process_out_of_seq_message| would cause *ok to be cleared, but the return value would still be the number of bytes read. This would cause |dtls1_get_message| not to consider it an error and it would continue processing as normal until the calling function noticed that *ok was zero. I can't see an exploit here because |dtls1_get_message| uses |s->init_num| as the length, which will always be zero from what I can see. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Fix memory leak from zero-length DTLS fragments.Adam Langley
The |pqueue_insert| function can fail if one attempts to insert a duplicate sequence number. When handling a fragment of an out of sequence message, |dtls1_process_out_of_seq_message| would not call |dtls1_reassemble_fragment| if the fragment's length was zero. It would then allocate a fresh fragment and attempt to insert it, but ignore the return value, leaking the fragment. This allows an attacker to exhaust the memory of a DTLS peer. Fixes CVE-2014-3507 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Fix DTLS handshake message size checks.Matt Caswell
In |dtls1_reassemble_fragment|, the value of |msg_hdr->frag_off+frag_len| was being checked against the maximum handshake message size, but then |msg_len| bytes were allocated for the fragment buffer. This means that so long as the fragment was within the allowed size, the pending handshake message could consume 16MB + 2MB (for the reassembly bitmap). Approx 10 outstanding handshake messages are allowed, meaning that an attacker could consume ~180MB per DTLS connection. In the non-fragmented path (in |dtls1_process_out_of_seq_message|), no check was applied. Fixes CVE-2014-3506 Wholly based on patch by Adam Langley with one minor amendment. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Added comment for the frag->reassembly == NULL case as per feedback from EmiliaMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-08-06Avoid double free when processing DTLS packets.Adam Langley
The |item| variable, in both of these cases, may contain a pointer to a |pitem| structure within |s->d1->buffered_messages|. It was being freed in the error case while still being in |buffered_messages|. When the error later caused the |SSL*| to be destroyed, the item would be double freed. Thanks to Wah-Teh Chang for spotting that the fix in 1632ef74 was inconsistent with the other error paths (but correct). Fixes CVE-2014-3505 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2014-06-10Fix null pointer errors.Dr. Stephen Henson
PR#3394 (cherry picked from commit 7a9d59c148b773f59a41f8697eeecf369a0974c2)
2014-06-05Fix CVE-2014-0221Dr. Stephen Henson
Unnecessary recursion when receiving a DTLS hello request can be used to crash a DTLS client. Fixed by handling DTLS hello request without recursion. Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
2014-06-05Fix for CVE-2014-0195Dr. Stephen Henson
A buffer overrun attack can be triggered by sending invalid DTLS fragments to an OpenSSL DTLS client or server. This is potentially exploitable to run arbitrary code on a vulnerable client or server. Fixed by adding consistency check for DTLS fragments. Thanks to Jüri Aedla for reporting this issue.
2014-06-02Typo: set i to -1 before goto.Sami Farin
PR#3302 (cherry picked from commit 9717f01951f976f76dd40a38d9fc7307057fa4c4)
2014-04-07Add heartbeat extension bounds check.Dr. Stephen Henson
A missing bounds check in the handling of the TLS heartbeat extension can be used to reveal up to 64k of memory to a connected client or server. Thanks for Neel Mehta of Google Security for discovering this bug and to Adam Langley <agl@chromium.org> and Bodo Moeller <bmoeller@acm.org> for preparing the fix (CVE-2014-0160)
2013-12-20Fix DTLS retransmission from previous session.Dr. Stephen Henson
For DTLS we might need to retransmit messages from the previous session so keep a copy of write context in DTLS retransmission buffers instead of replacing it after sending CCS. CVE-2013-6450.
2013-03-18Avoid unnecessary fragmentation.Michael Tuexen
(cherry picked from commit 80ccc66d7eedb2d06050130c77c482ae1584199a)
2012-03-06PR: 2755Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reduce MTU after failed transmissions.
2012-02-27PR: 2739Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Fix padding bugs in Heartbeat support.
2011-12-31PR: 2658Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Support for TLS/DTLS heartbeats.
2011-12-25PR: 2535Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Add SCTP support for DTLS (RFC 6083).
2011-10-27PR: 2628Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Send alert instead of assertion failure for incorrectly formatted DTLS fragments.
2011-09-23PR: 2602Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Fix DTLS bug which prevents manual MTU setting
2011-04-03PR: 2462Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Fix DTLS Retransmission Buffer Bug
2011-04-03PR: 2458Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Don't change state when answering DTLS ClientHello.
2011-04-03PR: 2457Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Fix DTLS fragment reassembly bug.
2010-05-03PR: 2230Dr. Stephen Henson
Submitted By: Robin Seggelmann <seggelmann@fh-muenster.de> Fix bug in bitmask macros and stop warnings.
2010-04-14fix signed/unsigned comparison warningsDr. Stephen Henson
2010-04-14PR: 2230Dr. Stephen Henson
Submitted By: Robin Seggelmann <seggelmann@fh-muenster.de> Fix various DTLS fragment reassembly bugs.
2010-03-24PR: 1731 and maybe 2197Dr. Stephen Henson
Clear error queue in a few places in SSL code where errors are expected so they don't stay in the queue.
2009-12-01PR: 2115Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Approved by: steve@openssl.org Add Renegotiation extension to DTLS, fix DTLS ClientHello processing bug.
2009-11-02PR: 2089Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Approved by: steve@openssl.org DTLS Fragment size bug fix.
2009-10-01PR: 2054Dr. Stephen Henson
Submitted by: Julia Lawall <julia@diku.dk> Approved by: steve@openssl.org Correct BIO_ctrl error handling
2009-08-12PR: 1997Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Approved by: steve@openssl.org DTLS timeout handling fix.
2009-07-15Fix error codes and indentation.Dr. Stephen Henson
2009-06-28Update from 0.9.8-stable.Dr. Stephen Henson
2009-06-05Stop gcc bracket warning.Dr. Stephen Henson
2009-06-05PR: 1950Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve@openssl.org DTLS fragment retransmission bug.
2009-05-16PR: 1931Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Approved by: steve@openssl.org Fix fragment handling memory leak.
2009-05-15PR: 1922Dr. Stephen Henson
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Approved by: steve@openssl.org DTLS Timer bug fix.