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
2015-12-16Reset ssl error codes.David Benjamin
38 error codes have fallen off the list since the last time we did this. Change-Id: Id7ee30889a5da2f6ab66957fd8e49e97640c8489 Reviewed-on: https://boringssl-review.googlesource.com/6643 Reviewed-by: Adam Langley <agl@google.com>
2015-11-12Limit DHE groups to 4096-bit.David Benjamin
dh.c had a 10k-bit limit but it wasn't quite correctly enforced. However, that's still 1.12s of jank on the IO thread, which is too long. Since the SSL code consumes DHE groups from the network, it should be responsible for enforcing what sanity it needs on them. Costs of various bit lengths on 2013 Macbook Air: 1024 - 1.4ms 2048 - 14ms 3072 - 24ms 4096 - 55ms 5000 - 160ms 10000 - 1.12s UMA says that DHE groups are 0.2% 4096-bit and otherwise are 5.5% 2048-bit and 94% 1024-bit and some noise. Set the limit to 4096-bit to be conservative, although that's already quite a lot of jank. BUG=554295 Change-Id: I8e167748a67e4e1adfb62d73dfff094abfa7d215 Reviewed-on: https://boringssl-review.googlesource.com/6464 Reviewed-by: Adam Langley <agl@google.com>
2015-09-01Forbid a server from negotiating both ALPN and NPN.David Benjamin
If the two extensions select different next protocols (quite possible since one is server-selected and the other is client-selected), things will break. This matches the behavior of NSS (Firefox) and Go. Change-Id: Ie1da97bf062b91a370c85c12bc61423220a22f36 Reviewed-on: https://boringssl-review.googlesource.com/5780 Reviewed-by: Adam Langley <agl@google.com>
2015-07-31Implement custom extensions.Adam Langley
This change mirrors upstream's custom extension API because we have some internal users that depend on it. Change-Id: I408e442de0a55df7b05c872c953ff048cd406513 Reviewed-on: https://boringssl-review.googlesource.com/5471 Reviewed-by: Adam Langley <agl@google.com>
2015-07-22Tidy up extensions stuff and drop fastradio support.Adam Langley
Fastradio was a trick where the ClientHello was padding to at least 1024 bytes in order to trick some mobile radios into entering high-power mode immediately. After experimentation, the feature is being dropped. This change also tidies up a bit of the extensions code now that everything is using the new system. Change-Id: Icf7892e0ac1fbe5d66a5d7b405ec455c6850a41c Reviewed-on: https://boringssl-review.googlesource.com/5466 Reviewed-by: Adam Langley <agl@google.com>
2015-07-16Get rid of err function codes.David Benjamin
Running make_errors.go every time a function is renamed is incredibly tedious. Plus we keep getting them wrong. Instead, sample __func__ (__FUNCTION__ in MSVC) in the OPENSSL_PUT_ERROR macro and store it alongside file and line number. This doesn't change the format of ERR_print_errors, however ERR_error_string_n now uses the placeholder "OPENSSL_internal" rather than an actual function name since that only takes the uint32_t packed error code as input. This updates err scripts to not emit the function string table. The OPENSSL_PUT_ERROR invocations, for now, still include the extra parameter. That will be removed in a follow-up. BUG=468039 Change-Id: Iaa2ef56991fb58892fa8a1283b3b8b995fbb308d Reviewed-on: https://boringssl-review.googlesource.com/5275 Reviewed-by: Adam Langley <agl@google.com>
2015-07-10Convert the signature algorithms extension to the new systemAdam Langley
Change-Id: Ia53b434acd11e9d2b0151b967387d86745ae441f Reviewed-on: https://boringssl-review.googlesource.com/5362 Reviewed-by: Adam Langley <agl@google.com>
2015-07-01Convert the renegotiation extension to the new system.Adam Langley
This change also switches the behaviour of the client. Previously the client would send the SCSV rather than the extension, but now it'll only do that for SSLv3 connections. Change-Id: I67a04b8abbef2234747c0dac450458deb6b0cd0a Reviewed-on: https://boringssl-review.googlesource.com/5143 Reviewed-by: Adam Langley <agl@google.com>
2015-07-01Add infrastructure for better extension handling.Adam Langley
Rather than four massive functions that handle every extension, organise the code by extension with four smaller functions for each. Change-Id: I876b31dacb05aca9884ed3ae7c48462e6ffe3b49 Reviewed-on: https://boringssl-review.googlesource.com/5142 Reviewed-by: Adam Langley <agl@google.com>
2015-06-26Promote SSL_CTX_[gs]et_tlsext_ticket_keys to functions.David Benjamin
BUG=404754 Change-Id: Iae75a7ab24d4aa3b30edf578cbfc1058aeadd863 Reviewed-on: https://boringssl-review.googlesource.com/5233 Reviewed-by: Adam Langley <agl@google.com>
2015-06-16Add SSL_SESSION_from_bytes.David Benjamin
Mirrors SSL_SESSION_to_bytes. It avoids having to deal with object-reuse, the non-size_t length parameter, and trailing data. Both it and the object-reuse variant back onto an unexposed SSL_SESSION_parse which reads a CBS. Note that this changes the object reuse story slightly. It's now merely an optional output pointer that frees its old contents. No d2i_SSL_SESSION consumer in Google that's built does reuse, much less reuse with the assumption that the top-level object won't be overridden. Change-Id: I5cb8522f96909bb222cab0f342423f2dd7814282 Reviewed-on: https://boringssl-review.googlesource.com/5121 Reviewed-by: Adam Langley <agl@google.com>
2015-06-09Limit the number of warning alerts silently consumed.David Benjamin
Per review comments on https://boringssl-review.googlesource.com/#/c/4112/. Change-Id: I82cacf67c6882e64f6637015ac41945522699797 Reviewed-on: https://boringssl-review.googlesource.com/5041 Reviewed-by: Adam Langley <agl@google.com>
2015-06-04Tighten up EMS resumption behaviour.Adam Langley
The client and server both have to decide on behaviour when resuming a session where the EMS state of the session doesn't match the EMS state as exchanged in the handshake. Original handshake | No Yes ------+-------------------------------------------------------------- | R | Server: ok [1] Server: abort [3] e No | Client: ok [2] Client: abort [4] s | u | m | e | Yes | Server: don't resume No problem | Client: abort; server | shouldn't have resumed [1] Servers want to accept legacy clients. The draft[5] says that resumptions SHOULD be rejected so that Triple-Handshake can't be done, but we'll rather enforce that EMS was used when using tls-unique etc. [2] The draft[5] says that even the initial handshake should be aborted if the server doesn't support EMS, but we need to be able to talk to the world. [3] This is a very weird case where a client has regressed without flushing the session cache. Hopefully we can be strict and reject these. [4] This can happen when a server-farm shares a session cache but frontends are not all updated at once. If Chrome is strict here then hopefully we can prevent any servers from existing that will try to resume an EMS session that they don't understand. OpenSSL appears to be ok here: https://www.ietf.org/mail-archive/web/tls/current/msg16570.html [5] https://tools.ietf.org/html/draft-ietf-tls-session-hash-05#section-5.2 BUG=492200 Change-Id: Ie1225a3960d49117b05eefa5a36263d8e556e467 Reviewed-on: https://boringssl-review.googlesource.com/4981 Reviewed-by: Adam Langley <agl@google.com>
2015-06-02Switch the ssl_write_bytes hook to ssl_write_app_data.David Benjamin
The SSL_PROTOCOL_METHOD table needs work, but this makes it clearer exactly what the shared interface between the upper later and TLS/DTLS is. BUG=468889 Change-Id: I38931c484aa4ab3f77964d708d38bfd349fac293 Reviewed-on: https://boringssl-review.googlesource.com/4955 Reviewed-by: Adam Langley <agl@google.com>
2015-05-21Factor SSL_AEAD_CTX into a dedicated type.David Benjamin
tls1_enc is now SSL_AEAD_CTX_{open,seal}. This starts tidying up a bit of the record-layer logic. This removes rr->input, as encrypting and decrypting records no longer refers to various globals. It also removes wrec altogether. SSL3_RECORD is now only used to maintain state about the current incoming record. Outgoing records go straight to the write buffer. This also removes the outgoing alignment memcpy and simply calls SSL_AEAD_CTX_seal with the parameters as appropriate. From bssl speed tests, this seems to be faster on non-ARM and a bit of a wash on ARM. Later it may be worth recasting these open/seal functions to write into a CBB (tweaked so it can be malloc-averse), but for now they take an out/out_len/max_out trio like their EVP_AEAD counterparts. BUG=468889 Change-Id: Ie9266a818cc053f695d35ef611fd74c5d4def6c3 Reviewed-on: https://boringssl-review.googlesource.com/4792 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Get rid of ssl_undefined_*David Benjamin
The only place using it is export keying material which can do the version check inline. Change-Id: I1893966c130aa43fa97a6116d91bb8b04f80c6fb Reviewed-on: https://boringssl-review.googlesource.com/4615 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Move the NULL case in ssl_add_cert_chain up.David Benjamin
It's only called for client certificates with NULL. The interaction with extra_certs is more obvious if we handle that case externally. (We shouldn't attach extra_certs if there is no leaf.) Change-Id: I9dc26f32f582be8c48a4da9aae0ceee8741813dc Reviewed-on: https://boringssl-review.googlesource.com/4613 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Promote SNI macros to functions.David Benjamin
BUG=404754 Change-Id: I2b2e27f3db0c97f2db65ca5e226c6488d2bee2fc Reviewed-on: https://boringssl-review.googlesource.com/4570 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Promote channel ID macros to proper functions.David Benjamin
BUG=404754 Change-Id: I002d4602720e207f92a985d90f0d58e89562affa Reviewed-on: https://boringssl-review.googlesource.com/4569 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Promote set_tmp_dh and set_tmp_ecdh to functions.David Benjamin
BUG=404754 Change-Id: I7c75dd88fe9338b1d3b90745f742d15d6b84775a Reviewed-on: https://boringssl-review.googlesource.com/4568 Reviewed-by: Adam Langley <agl@google.com>
2015-05-07Promote all SSL callback ctrl hooks to proper functions.David Benjamin
Document them while I'm here. This adds a new 'preprocessor compatibility section' to avoid breaking #ifdefs. The CTRL values themselves are defined to 'doesnt_exist' to catch anything calling SSL_ctrl directly until that function can be unexported completely. BUG=404754 Change-Id: Ia157490ea8efe0215d4079556a0c7643273e7601 Reviewed-on: https://boringssl-review.googlesource.com/4553 Reviewed-by: Adam Langley <agl@google.com>
2015-04-07Enforce that sessions are resumed at the version they're created.David Benjamin
After sharding the session cache for fallbacks, the numbers have been pretty good; 0.03% on dev and 0.02% on canary. Stable is at 0.06% but does not have the sharded session cache. Before sharding, stable, beta, and dev had been fairly closely aligned. Between 0.03% being low and the fallback saving us in all but extremely contrived cases, I think this should be fairly safe. Add tests for both the cipher suite and protocol version mismatch checks. BUG=441456 Change-Id: I2374bf64d0aee0119f293d207d45319c274d89ab Reviewed-on: https://boringssl-review.googlesource.com/3972 Reviewed-by: Adam Langley <agl@google.com>
2015-04-06Factor out sequence number updates.David Benjamin
Also check for overflow, although it really shouldn't happen. Change-Id: I34dfe8eaf635aeaa8bef2656fda3cd0bad7e1268 Reviewed-on: https://boringssl-review.googlesource.com/4235 Reviewed-by: Adam Langley <agl@google.com>
2015-04-06Clean up do_ssl3_write fragment handling.David Benjamin
Separate actually writing the fragment to the network from assembling it so there is no need for is_fragment. record_split_done also needn't be a global; as of 7fdeaf11017b82368e0a97547fc491b90ad40f67, it is always reset to 0 whether or not SSL3_WANT_WRITE occurred, despite the comment. I believe this is sound, but the pre-7fdeaf1 logic wasn't quiiite right; ssl3_write_pending allows a retry to supply *additional* data, so not all plaintext had been commited to before the IV was randomized. We could fix this by tracking how many bytes were committed to the last time we fragmented, but this is purely an optimization and doesn't seem worth the complexity. This also fixes the alignment computation in the record-splitting case. The extra byte was wrong, as demonstrated by the assert. Change-Id: Ia087a45a6622f4faad32e501942cc910eca1237b Reviewed-on: https://boringssl-review.googlesource.com/4234 Reviewed-by: Adam Langley <agl@google.com>
2015-03-10Get rid of the RSMBLY macros.David Benjamin
Turn them into static functions that take in an hm_fragment. It's not immediately obvious that the frag_off/frag_len bounds checks and the msg_len consistency check are critical to avoiding an out-of-bounds write. Better to have dtls1_hm_fragment_mark also check internally. Also rework the bitmask logic to be clearer and avoid a table. Change-Id: Ica54e98f66295efb323e033cb6c67ab21e7d6cbc Reviewed-on: https://boringssl-review.googlesource.com/3765 Reviewed-by: Adam Langley <agl@google.com>
2015-03-10Rework DTLS handshake message reassembly logic.David Benjamin
Notably, drop all special cases around receiving a message in order and receiving a full message. It makes things more complicated and was the source of bugs (the MixCompleteMessageWithFragments tests added in this CL did not pass before). Instead, every message goes through an hm_fragment, and dtls1_get_message always checks buffered_messages to see if the next is complete. The downside is that we pay one more copy of the message data in the common case. This is only during connection setup, so I think it's worth the simplicity. (If we want to optimize later, we could either tighten ssl3_get_message's interface to allow the handshake data being in the hm_fragment's backing store rather than s->init_buf or swap out s->init_buf with the hm_fragment's backing store when a mesasge completes. This CL does not address ssl_read_bytes being an inappropriate API for DTLS. Future work will revise the handshake/transport boundary to align better with DTLS's needs. Also other problems that I've left as TODOs. Change-Id: Ib4570d45634b5181ecf192894d735e8699b1c86b Reviewed-on: https://boringssl-review.googlesource.com/3764 Reviewed-by: Adam Langley <agl@google.com>
2015-02-12Reset all the error codes.David Benjamin
This saves about 6-7k of error data. Change-Id: Ic28593d4a1f5454f00fb2399d281c351ee57fb14 Reviewed-on: https://boringssl-review.googlesource.com/3385 Reviewed-by: Adam Langley <agl@google.com>
2015-02-10Precompute sorted array for error strings.Adam Langley
Previously, error strings were kept in arrays for each subdirectory and err.c would iterate over them all and insert them at init time to a hash table. This means that, even if you have a shared library and lots of processes using that, each process has ~30KB of private memory from building that hash table. This this change, all the error strings are built into a sorted list and are thus static data. This means that processes can share the error information and it actually saves binary space because of all the pointer overhead in the old scheme. Also it saves the time taken building the hash table at startup. This removes support for externally-supplied error string data. Change-Id: Ifca04f335c673a048e1a3e76ff2b69c7264635be