Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-12-16Add outgoing messages to the handshake hash at set_handshake_header.David Benjamin
This avoids needing a should_add_to_finished_hash boolean on do_write. The logic in do_write was a little awkward because do_write would be called multiple times if the write took several iterations. This also gets complex if DTLS retransmits are involved. (At a glance, it's not obvious the BIO_CTRL_DGRAM_MTU_EXCEEDED case actually works.) Doing it as the handshake message is being prepared avoids this concern. It also gives a natural point for the extended master secret logic which needs to do work after the finished hash has been sampled. As a bonus, we can remove s->d1->retransmitting which was only used to deal with this issue. Change-Id: Ifedf23ee4a6c5e08f960d296a6eb1f337a16dc7a Reviewed-on: https://boringssl-review.googlesource.com/2604 Reviewed-by: Adam Langley <agl@google.com>
2014-12-16Fold dtls1_set_message_header into dtls1_set_handshake_header.David Benjamin
The frag_off/frag_len parameters are always zero, and the return value is never used. Change-Id: If7487b23c55f2a996e411b25b76a8e1651f25d8b Reviewed-on: https://boringssl-review.googlesource.com/2601 Reviewed-by: Adam Langley <agl@google.com>
2014-12-14Reformatting of several DTLS source files.Adam Langley
This change has no semantic effect (I hope!). It's just a reformatting of a few files in ssl/. This is just a start – the other files in ssl/ should follow in the coming days. Change-Id: I5eb3f4b18d0d46349d0f94d3fe5ab2003db5364e
2014-12-05Fixed memory leak due to incorrect freeing of DTLS reassembly bit maskDavid Benjamin
PR#3608 (Imported from upstream's 8a35dbb6d89a16d792b79b157b3e89443639ec94.) Change-Id: Iab9d91f9b96793f2275a23770f1275ff4edf0386 Reviewed-on: https://boringssl-review.googlesource.com/2476 Reviewed-by: Adam Langley <agl@google.com>
2014-11-11Remove DTLSv1_listen.David Benjamin
This was added in http://rt.openssl.org/Ticket/Display.html?id=2033 to support a mode where a DTLS socket would statelessly perform the ClientHello / HelloVerifyRequest portion of the handshake, to be handed off to a socket specific to this peer address. This is not used by WebRTC or other current consumers. If we need to support something like this, it would be cleaner to do the listen portion (cookieless ClientHello + HelloVerifyRequest) externally and then spin up an SSL instance on receipt of a cookied ClientHello. This would require a slightly more complex BIO to replay the second ClientHello but would avoid peppering the DTLS handshake state with a special short-circuiting mode. Change-Id: I7a413932edfb62f8b9368912a9a0621d4155f1aa Reviewed-on: https://boringssl-review.googlesource.com/2220 Reviewed-by: Adam Langley <agl@google.com>
2014-11-04DTLS1_AD_MISSING_HANDSHAKE_MESSAGE does not exist.David Benjamin
This code isn't compiled in. It seems there was some half-baked logic for a 7-byte alert that includes more information about handshake messages retransmit. No such alert exists, and the code had a FIXME anyway. If it gets resurrected in DTLS 1.3 or some extension, we can deal with it then. Change-Id: I8784ea8ee44bb8da4b0fe5d5d507997526557432 Reviewed-on: https://boringssl-review.googlesource.com/2121 Reviewed-by: Adam Langley <agl@google.com>
2014-10-25Extended master secret support.Adam Langley
This change implements support for the extended master secret. See https://tools.ietf.org/html/draft-ietf-tls-session-hash-01 https://secure-resumption.com/ Change-Id: Ifc7327763149ab0894b4f1d48cdc35e0f1093b93 Reviewed-on: https://boringssl-review.googlesource.com/1930 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-09-03Fix minor issues found by Clang's analysis.Adam Langley
Thanks to Denis Denisov for running the analysis. Change-Id: I80810261e013423e746fd8d8afefb3581cffccc0 Reviewed-on: https://boringssl-review.googlesource.com/1701 Reviewed-by: Adam Langley <agl@google.com>
2014-08-27Introduce a hash_message parameter to ssl_get_message.David Benjamin
This replaces the special-case in ssl3_get_message for Channel ID. Also add ssl3_hash_current_message to hash the current message, taking TLS vs DTLS handshake header size into account. One subtlety with this flag is that a message intended to be processed with SSL_GET_MESSAGE_DONT_HASH_MESSAGE cannot follow an optional message (reprocessed with reuse_message, etc.). There is an assertion to that effect. If need be, we can loosen it to requiring that the preceeding optional message also pass SSL_GET_MESSAGE_DONT_HASH_MESSAGE and then maintain some state to perform the more accurate assertion, but this is sufficient for now. Change-Id: If8c87342b291ac041a35885b9b5ee961aee86eab Reviewed-on: https://boringssl-review.googlesource.com/1630 Reviewed-by: Adam Langley <agl@google.com>
2014-08-20Mark some more globals as const.David Benjamin
Change-Id: Ie6f3a3713ce1482a787444678a65daa37bc0b273 Reviewed-on: https://boringssl-review.googlesource.com/1565 Reviewed-by: Adam Langley <agl@google.com>
2014-08-18Remove SSL_OP_CISCO_ANYCONNECT.David Benjamin
I see no internal users and the existence of a THIRD version encoding complicates all version-checking logic. Also convert another version check to SSL_IS_DTLS that was missed earlier. Change-Id: I60d215f57d44880f6e6877889307dc39dbf838f7 Reviewed-on: https://boringssl-review.googlesource.com/1550 Reviewed-by: Adam Langley <agl@google.com>
2014-08-08Remove 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> (Imported from upstream's d345a24569edf0a966b3d6eaae525f0ca4c5e570) Change-Id: I038f9f01a1d9379f1ee058b231d80e8b9ce6c2d7 Reviewed-on: https://boringssl-review.googlesource.com/1438 Reviewed-by: Adam Langley <agl@google.com>
2014-08-08Same fix as in dtls1_process_out_of_seq_message.Matt Caswell
Applying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS 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> (Imported from upstream's 3d5dceac430d7b9b273331931d4d2303f5a2256f) Change-Id: Ibe30716266e2ee1489c98b922cf53edda096c23c Reviewed-on: https://boringssl-review.googlesource.com/1437 Reviewed-by: Adam Langley <agl@google.com>
2014-08-08Fix 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> (Imported from upstream's aad61c0a57a3b6371496034db61675abcdb81811.) Change-Id: I2fb0ea93b6e812e19723ada3351f842cc7b2fa91 Reviewed-on: https://boringssl-review.googlesource.com/1436 Reviewed-by: Adam Langley <agl@google.com>
2014-08-08Fix 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> (Imported from upstream's 8ca4c4b25e050b881f3aad7017052842b888722d.) Change-Id: I387e3f6467a0041f6367965ed3c1ad4377b9ac08 Reviewed-on: https://boringssl-review.googlesource.com/1435 Reviewed-by: Adam Langley <agl@google.com>
2014-08-08Fix 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> (Imported from upstream's 0598468fc04fb0cf2438c4ee635b587aac1bcce6) Change-Id: I4849498eabb45ec973fcb988d639b23145891e25 Reviewed-on: https://boringssl-review.googlesource.com/1434 Reviewed-by: Adam Langley <agl@google.com>
2014-08-07Added comment for the frag->reassembly == NULL case as per feedback from EmiliaMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org> (Imported from upstream's ea7cb5397457c59554155935b677a1dab23bd864) Change-Id: Idd5ed233028c42d2b921deb424381aad88a0aa84 Reviewed-on: https://boringssl-review.googlesource.com/1433 Reviewed-by: Adam Langley <agl@google.com>
2014-08-07Avoid 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> (Imported from upstream's 49850075555893c9c60d5b981deb697f3b9515ea) Change-Id: Ie40007184f6194ba032b4213c18d36254e80aaa6 Reviewed-on: https://boringssl-review.googlesource.com/1432 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Adam Langley <agl@google.com>
2014-07-15Make init_msg a uint8_t*.David Benjamin
It's current a void* and gets explicitly cast everywhere. Make it a uint8_t and only add the casts when converting it come init_buf, which internally stores a char*. Change-Id: I28bed129e46ed37ee1ce378d5c3bd0738fc1177f Reviewed-on: https://boringssl-review.googlesource.com/1163 Reviewed-by: Adam Langley <agl@google.com>
2014-06-27Remove heartbeat extension.David Benjamin
Change-Id: I0273a31e49c5367b89b9899553e3ebe13ec50687 Reviewed-on: https://boringssl-review.googlesource.com/1050 Reviewed-by: Adam Langley <agl@google.com>
2014-06-25Remove more remnants of compression.David Benjamin
Change-Id: I721914594fc92a66d95c7ec2088f13b68e964103
2014-06-21Fix null pointer errors.Adam Langley
PR#3394 (Imported from upstream's cea5a1d5f255a6a186cd7944c4a312612da965f3)
2014-06-21Fix for CVE-2014-0195Adam Langley
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. (Imported from upstream's eb6508d50c9a314b88ac155bd378cbd79a117c92)
2014-06-21Fix CVE-2014-0221Adam Langley
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. (Imported from upstream's 8942b92c7cb5fa144bd79b7607b459d0b777164c)
2014-06-21Typo: set i to -1 before goto.Adam Langley
PR#3302 (Imported from upstream's 646886682373e76dee233f7b918dec0c83e180fc)
2014-06-21Add heartbeat extension bounds check.Adam Langley
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) (Imported from upstream's 7e840163c06c7692b796a93e3fa85a93136adbb2)
2014-06-21Inital import.Adam Langley
Initial fork from f2d678e6e89b6508147086610e985d4e8416e867 (1.0.2 beta). (This change contains substantial changes from the original and effectively starts a new history.)