Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 1 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 2 | * All rights reserved. |
| 3 | * |
| 4 | * This package is an SSL implementation written |
| 5 | * by Eric Young (eay@cryptsoft.com). |
| 6 | * The implementation was written so as to conform with Netscapes SSL. |
| 7 | * |
| 8 | * This library is free for commercial and non-commercial use as long as |
| 9 | * the following conditions are aheared to. The following conditions |
| 10 | * apply to all code found in this distribution, be it the RC4, RSA, |
| 11 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 12 | * included with this distribution is covered by the same copyright terms |
| 13 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 14 | * |
| 15 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 16 | * the code are not to be removed. |
| 17 | * If this package is used in a product, Eric Young should be given attribution |
| 18 | * as the author of the parts of the library used. |
| 19 | * This can be in the form of a textual message at program startup or |
| 20 | * in documentation (online or textual) provided with the package. |
| 21 | * |
| 22 | * Redistribution and use in source and binary forms, with or without |
| 23 | * modification, are permitted provided that the following conditions |
| 24 | * are met: |
| 25 | * 1. Redistributions of source code must retain the copyright |
| 26 | * notice, this list of conditions and the following disclaimer. |
| 27 | * 2. Redistributions in binary form must reproduce the above copyright |
| 28 | * notice, this list of conditions and the following disclaimer in the |
| 29 | * documentation and/or other materials provided with the distribution. |
| 30 | * 3. All advertising materials mentioning features or use of this software |
| 31 | * must display the following acknowledgement: |
| 32 | * "This product includes cryptographic software written by |
| 33 | * Eric Young (eay@cryptsoft.com)" |
| 34 | * The word 'cryptographic' can be left out if the rouines from the library |
| 35 | * being used are not cryptographic related :-). |
| 36 | * 4. If you include any Windows specific code (or a derivative thereof) from |
| 37 | * the apps directory (application code) you must include an acknowledgement: |
| 38 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 39 | * |
| 40 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 41 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 43 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 44 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 45 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 46 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 48 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 49 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 50 | * SUCH DAMAGE. |
| 51 | * |
| 52 | * The licence and distribution terms for any publically available version or |
| 53 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 54 | * copied and put under another distribution licence |
| 55 | * [including the GNU Public Licence.] */ |
| 56 | |
David Benjamin | 9e4e01e | 2015-09-15 01:48:04 -0400 | [diff] [blame] | 57 | #include <openssl/ssl.h> |
| 58 | |
David Benjamin | 2dc0204 | 2016-09-19 19:57:37 -0400 | [diff] [blame] | 59 | #include <assert.h> |
David Benjamin | 6167281 | 2016-07-14 23:10:43 -0400 | [diff] [blame] | 60 | #include <string.h> |
| 61 | |
David Benjamin | 3ba9586 | 2019-10-21 16:14:33 -0400 | [diff] [blame] | 62 | #include <openssl/err.h> |
David Benjamin | 97718f1 | 2016-07-08 09:16:50 -0700 | [diff] [blame] | 63 | |
David Benjamin | 17cf2cb | 2016-12-13 01:07:13 -0500 | [diff] [blame] | 64 | #include "../crypto/internal.h" |
David Benjamin | 2ee94aa | 2015-04-07 22:38:30 -0400 | [diff] [blame] | 65 | #include "internal.h" |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 66 | |
| 67 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 68 | BSSL_NAMESPACE_BEGIN |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 69 | |
David Benjamin | 82a4b22 | 2020-02-09 17:51:45 -0500 | [diff] [blame] | 70 | static void tls_on_handshake_complete(SSL *ssl) { |
David Benjamin | c11ea942 | 2017-08-29 16:33:21 -0400 | [diff] [blame] | 71 | // The handshake should have released its final message. |
David Benjamin | 7934f08 | 2017-08-01 16:32:25 -0400 | [diff] [blame] | 72 | assert(!ssl->s3->has_message); |
David Benjamin | 8f94c31 | 2017-08-01 17:35:55 -0400 | [diff] [blame] | 73 | |
David Benjamin | 32ce0ac | 2017-10-13 19:17:22 -0400 | [diff] [blame] | 74 | // During the handshake, |hs_buf| is retained. Release if it there is no |
David Benjamin | f9cc26f | 2020-02-09 16:49:31 -0500 | [diff] [blame] | 75 | // excess in it. There should not be any excess because the handshake logic |
| 76 | // rejects unprocessed data after each Finished message. Note this means we do |
| 77 | // not allow a TLS 1.2 HelloRequest to be packed into the same record as |
| 78 | // Finished. (Schannel also rejects this.) |
| 79 | assert(!ssl->s3->hs_buf || ssl->s3->hs_buf->length == 0); |
David Benjamin | 32ce0ac | 2017-10-13 19:17:22 -0400 | [diff] [blame] | 80 | if (ssl->s3->hs_buf && ssl->s3->hs_buf->length == 0) { |
| 81 | ssl->s3->hs_buf.reset(); |
David Benjamin | 8f94c31 | 2017-08-01 17:35:55 -0400 | [diff] [blame] | 82 | } |
David Benjamin | e3dee27 | 2017-08-02 20:06:53 -0400 | [diff] [blame] | 83 | } |
David Benjamin | 0be6fc4 | 2016-12-03 23:23:52 -0500 | [diff] [blame] | 84 | |
David Benjamin | b092192 | 2020-02-20 12:33:28 -0500 | [diff] [blame] | 85 | static bool tls_set_read_state(SSL *ssl, ssl_encryption_level_t level, |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 86 | UniquePtr<SSLAEADContext> aead_ctx, |
| 87 | Span<const uint8_t> secret_for_quic) { |
David Benjamin | 40e9470 | 2017-10-06 18:26:36 -0400 | [diff] [blame] | 88 | // Cipher changes are forbidden if the current epoch has leftover data. |
David Benjamin | d9229f9 | 2017-10-06 17:36:20 -0400 | [diff] [blame] | 89 | if (tls_has_unprocessed_handshake_data(ssl)) { |
David Benjamin | f9cc26f | 2020-02-09 16:49:31 -0500 | [diff] [blame] | 90 | OPENSSL_PUT_ERROR(SSL, SSL_R_EXCESS_HANDSHAKE_DATA); |
David Benjamin | d1e3ce1 | 2017-10-06 18:31:15 -0400 | [diff] [blame] | 91 | ssl_send_alert(ssl, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE); |
David Benjamin | 97250f4 | 2017-10-07 04:12:35 -0400 | [diff] [blame] | 92 | return false; |
Steven Valdez | 143e8b3 | 2016-07-11 13:19:03 -0400 | [diff] [blame] | 93 | } |
David Benjamin | 6167281 | 2016-07-14 23:10:43 -0400 | [diff] [blame] | 94 | |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 95 | if (ssl->quic_method != nullptr) { |
David Benjamin | b571e77 | 2021-03-25 19:42:16 -0400 | [diff] [blame] | 96 | if ((ssl->s3->hs == nullptr || !ssl->s3->hs->hints_requested) && |
| 97 | !ssl->quic_method->set_read_secret(ssl, level, aead_ctx->cipher(), |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 98 | secret_for_quic.data(), |
| 99 | secret_for_quic.size())) { |
| 100 | return false; |
| 101 | } |
| 102 | |
| 103 | // QUIC only uses |ssl| for handshake messages, which never use early data |
| 104 | // keys, so we return without installing anything. This avoids needing to |
| 105 | // have two secrets active at once in 0-RTT. |
| 106 | if (level == ssl_encryption_early_data) { |
| 107 | return true; |
| 108 | } |
| 109 | } |
| 110 | |
David Benjamin | 32013e8 | 2022-09-22 16:55:34 -0400 | [diff] [blame] | 111 | ssl->s3->read_sequence = 0; |
David Benjamin | 8e7bbba | 2017-10-13 17:18:35 -0400 | [diff] [blame] | 112 | ssl->s3->aead_read_ctx = std::move(aead_ctx); |
David Benjamin | b092192 | 2020-02-20 12:33:28 -0500 | [diff] [blame] | 113 | ssl->s3->read_level = level; |
David Benjamin | 97250f4 | 2017-10-07 04:12:35 -0400 | [diff] [blame] | 114 | return true; |
David Benjamin | 6167281 | 2016-07-14 23:10:43 -0400 | [diff] [blame] | 115 | } |
| 116 | |
David Benjamin | b092192 | 2020-02-20 12:33:28 -0500 | [diff] [blame] | 117 | static bool tls_set_write_state(SSL *ssl, ssl_encryption_level_t level, |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 118 | UniquePtr<SSLAEADContext> aead_ctx, |
| 119 | Span<const uint8_t> secret_for_quic) { |
David Benjamin | 700631b | 2018-05-24 17:17:34 -0400 | [diff] [blame] | 120 | if (!tls_flush_pending_hs_data(ssl)) { |
| 121 | return false; |
| 122 | } |
| 123 | |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 124 | if (ssl->quic_method != nullptr) { |
David Benjamin | b571e77 | 2021-03-25 19:42:16 -0400 | [diff] [blame] | 125 | if ((ssl->s3->hs == nullptr || !ssl->s3->hs->hints_requested) && |
| 126 | !ssl->quic_method->set_write_secret(ssl, level, aead_ctx->cipher(), |
David Benjamin | 5298ef9 | 2020-03-13 12:17:30 -0400 | [diff] [blame] | 127 | secret_for_quic.data(), |
| 128 | secret_for_quic.size())) { |
| 129 | return false; |
| 130 | } |
| 131 | |
| 132 | // QUIC only uses |ssl| for handshake messages, which never use early data |
| 133 | // keys, so we return without installing anything. This avoids needing to |
| 134 | // have two secrets active at once in 0-RTT. |
| 135 | if (level == ssl_encryption_early_data) { |
| 136 | return true; |
| 137 | } |
| 138 | } |
| 139 | |
David Benjamin | 32013e8 | 2022-09-22 16:55:34 -0400 | [diff] [blame] | 140 | ssl->s3->write_sequence = 0; |
David Benjamin | 8e7bbba | 2017-10-13 17:18:35 -0400 | [diff] [blame] | 141 | ssl->s3->aead_write_ctx = std::move(aead_ctx); |
David Benjamin | b092192 | 2020-02-20 12:33:28 -0500 | [diff] [blame] | 142 | ssl->s3->write_level = level; |
David Benjamin | 97250f4 | 2017-10-07 04:12:35 -0400 | [diff] [blame] | 143 | return true; |
David Benjamin | 6167281 | 2016-07-14 23:10:43 -0400 | [diff] [blame] | 144 | } |
| 145 | |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 146 | static const SSL_PROTOCOL_METHOD kTLSProtocolMethod = { |
David Benjamin | 97250f4 | 2017-10-07 04:12:35 -0400 | [diff] [blame] | 147 | false /* is_dtls */, |
David Benjamin | 82a4b22 | 2020-02-09 17:51:45 -0500 | [diff] [blame] | 148 | tls_new, |
| 149 | tls_free, |
| 150 | tls_get_message, |
| 151 | tls_next_message, |
David Benjamin | f9cc26f | 2020-02-09 16:49:31 -0500 | [diff] [blame] | 152 | tls_has_unprocessed_handshake_data, |
David Benjamin | 82a4b22 | 2020-02-09 17:51:45 -0500 | [diff] [blame] | 153 | tls_open_handshake, |
| 154 | tls_open_change_cipher_spec, |
| 155 | tls_open_app_data, |
| 156 | tls_write_app_data, |
| 157 | tls_dispatch_alert, |
| 158 | tls_init_message, |
| 159 | tls_finish_message, |
| 160 | tls_add_message, |
| 161 | tls_add_change_cipher_spec, |
| 162 | tls_flush_flight, |
| 163 | tls_on_handshake_complete, |
| 164 | tls_set_read_state, |
| 165 | tls_set_write_state, |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 166 | }; |
David Benjamin | 5b33a5e | 2014-09-24 16:27:30 -0400 | [diff] [blame] | 167 | |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 168 | static bool ssl_noop_x509_check_client_CA_names( |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 169 | STACK_OF(CRYPTO_BUFFER) *names) { |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 170 | return true; |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | static void ssl_noop_x509_clear(CERT *cert) {} |
| 174 | static void ssl_noop_x509_free(CERT *cert) {} |
| 175 | static void ssl_noop_x509_dup(CERT *new_cert, const CERT *cert) {} |
| 176 | static void ssl_noop_x509_flush_cached_leaf(CERT *cert) {} |
| 177 | static void ssl_noop_x509_flush_cached_chain(CERT *cert) {} |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 178 | static bool ssl_noop_x509_session_cache_objects(SSL_SESSION *sess) { |
| 179 | return true; |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 180 | } |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 181 | static bool ssl_noop_x509_session_dup(SSL_SESSION *new_session, |
| 182 | const SSL_SESSION *session) { |
| 183 | return true; |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 184 | } |
| 185 | static void ssl_noop_x509_session_clear(SSL_SESSION *session) {} |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 186 | static bool ssl_noop_x509_session_verify_cert_chain(SSL_SESSION *session, |
| 187 | SSL_HANDSHAKE *hs, |
| 188 | uint8_t *out_alert) { |
| 189 | return false; |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | static void ssl_noop_x509_hs_flush_cached_ca_names(SSL_HANDSHAKE *hs) {} |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 193 | static bool ssl_noop_x509_ssl_new(SSL_HANDSHAKE *hs) { return true; } |
Matthew Braithwaite | b7bc80a | 2018-04-13 15:51:30 -0700 | [diff] [blame] | 194 | static void ssl_noop_x509_ssl_config_free(SSL_CONFIG *cfg) {} |
| 195 | static void ssl_noop_x509_ssl_flush_cached_client_CA(SSL_CONFIG *cfg) {} |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 196 | static bool ssl_noop_x509_ssl_auto_chain_if_needed(SSL_HANDSHAKE *hs) { |
| 197 | return true; |
Matthew Braithwaite | b7bc80a | 2018-04-13 15:51:30 -0700 | [diff] [blame] | 198 | } |
David Benjamin | 1e77ef4 | 2019-03-30 01:03:50 -0500 | [diff] [blame] | 199 | static bool ssl_noop_x509_ssl_ctx_new(SSL_CTX *ctx) { return true; } |
| 200 | static void ssl_noop_x509_ssl_ctx_free(SSL_CTX *ctx) {} |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 201 | static void ssl_noop_x509_ssl_ctx_flush_cached_client_CA(SSL_CTX *ctx) {} |
| 202 | |
David Benjamin | ba2d3df | 2017-08-04 13:59:24 -0400 | [diff] [blame] | 203 | const SSL_X509_METHOD ssl_noop_x509_method = { |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 204 | ssl_noop_x509_check_client_CA_names, |
| 205 | ssl_noop_x509_clear, |
| 206 | ssl_noop_x509_free, |
| 207 | ssl_noop_x509_dup, |
| 208 | ssl_noop_x509_flush_cached_chain, |
| 209 | ssl_noop_x509_flush_cached_leaf, |
| 210 | ssl_noop_x509_session_cache_objects, |
| 211 | ssl_noop_x509_session_dup, |
| 212 | ssl_noop_x509_session_clear, |
| 213 | ssl_noop_x509_session_verify_cert_chain, |
| 214 | ssl_noop_x509_hs_flush_cached_ca_names, |
| 215 | ssl_noop_x509_ssl_new, |
Matthew Braithwaite | b7bc80a | 2018-04-13 15:51:30 -0700 | [diff] [blame] | 216 | ssl_noop_x509_ssl_config_free, |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 217 | ssl_noop_x509_ssl_flush_cached_client_CA, |
| 218 | ssl_noop_x509_ssl_auto_chain_if_needed, |
| 219 | ssl_noop_x509_ssl_ctx_new, |
| 220 | ssl_noop_x509_ssl_ctx_free, |
| 221 | ssl_noop_x509_ssl_ctx_flush_cached_client_CA, |
| 222 | }; |
| 223 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 224 | BSSL_NAMESPACE_END |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 225 | |
| 226 | using namespace bssl; |
| 227 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 228 | const SSL_METHOD *TLS_method(void) { |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 229 | static const SSL_METHOD kMethod = { |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 230 | 0, |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 231 | &kTLSProtocolMethod, |
Adam Langley | 3509dac | 2017-02-01 11:59:18 -0800 | [diff] [blame] | 232 | &ssl_crypto_x509_method, |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 233 | }; |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 234 | return &kMethod; |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 235 | } |
David Benjamin | 5b33a5e | 2014-09-24 16:27:30 -0400 | [diff] [blame] | 236 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 237 | const SSL_METHOD *SSLv23_method(void) { |
| 238 | return TLS_method(); |
| 239 | } |
David Benjamin | 5b33a5e | 2014-09-24 16:27:30 -0400 | [diff] [blame] | 240 | |
David Benjamin | 86e95b8 | 2017-07-18 16:34:25 -0400 | [diff] [blame] | 241 | const SSL_METHOD *TLS_with_buffers_method(void) { |
| 242 | static const SSL_METHOD kMethod = { |
| 243 | 0, |
| 244 | &kTLSProtocolMethod, |
| 245 | &ssl_noop_x509_method, |
| 246 | }; |
| 247 | return &kMethod; |
| 248 | } |
| 249 | |
David Benjamin | c11ea942 | 2017-08-29 16:33:21 -0400 | [diff] [blame] | 250 | // Legacy version-locked methods. |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 251 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 252 | const SSL_METHOD *TLSv1_2_method(void) { |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 253 | static const SSL_METHOD kMethod = { |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 254 | TLS1_2_VERSION, |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 255 | &kTLSProtocolMethod, |
Adam Langley | 3509dac | 2017-02-01 11:59:18 -0800 | [diff] [blame] | 256 | &ssl_crypto_x509_method, |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 257 | }; |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 258 | return &kMethod; |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 259 | } |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 260 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 261 | const SSL_METHOD *TLSv1_1_method(void) { |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 262 | static const SSL_METHOD kMethod = { |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 263 | TLS1_1_VERSION, |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 264 | &kTLSProtocolMethod, |
Adam Langley | 3509dac | 2017-02-01 11:59:18 -0800 | [diff] [blame] | 265 | &ssl_crypto_x509_method, |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 266 | }; |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 267 | return &kMethod; |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 268 | } |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 269 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 270 | const SSL_METHOD *TLSv1_method(void) { |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 271 | static const SSL_METHOD kMethod = { |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 272 | TLS1_VERSION, |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 273 | &kTLSProtocolMethod, |
Adam Langley | 3509dac | 2017-02-01 11:59:18 -0800 | [diff] [blame] | 274 | &ssl_crypto_x509_method, |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 275 | }; |
David Benjamin | a2c42d7 | 2016-07-08 09:05:45 -0700 | [diff] [blame] | 276 | return &kMethod; |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 277 | } |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 278 | |
David Benjamin | c11ea942 | 2017-08-29 16:33:21 -0400 | [diff] [blame] | 279 | // Legacy side-specific methods. |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 280 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 281 | const SSL_METHOD *TLSv1_2_server_method(void) { |
| 282 | return TLSv1_2_method(); |
| 283 | } |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 284 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 285 | const SSL_METHOD *TLSv1_1_server_method(void) { |
| 286 | return TLSv1_1_method(); |
| 287 | } |
David Benjamin | cde8aba | 2014-11-23 15:47:20 -0500 | [diff] [blame] | 288 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 289 | const SSL_METHOD *TLSv1_server_method(void) { |
| 290 | return TLSv1_method(); |
| 291 | } |
| 292 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 293 | const SSL_METHOD *TLSv1_2_client_method(void) { |
| 294 | return TLSv1_2_method(); |
| 295 | } |
| 296 | |
| 297 | const SSL_METHOD *TLSv1_1_client_method(void) { |
| 298 | return TLSv1_1_method(); |
| 299 | } |
| 300 | |
| 301 | const SSL_METHOD *TLSv1_client_method(void) { |
| 302 | return TLSv1_method(); |
| 303 | } |
| 304 | |
David Benjamin | 82c9e90 | 2014-12-12 15:55:27 -0500 | [diff] [blame] | 305 | const SSL_METHOD *SSLv23_server_method(void) { |
| 306 | return SSLv23_method(); |
| 307 | } |
| 308 | |
| 309 | const SSL_METHOD *SSLv23_client_method(void) { |
| 310 | return SSLv23_method(); |
| 311 | } |
David Benjamin | a9c3bf1 | 2016-08-05 10:41:07 -0400 | [diff] [blame] | 312 | |
| 313 | const SSL_METHOD *TLS_server_method(void) { |
| 314 | return TLS_method(); |
| 315 | } |
| 316 | |
| 317 | const SSL_METHOD *TLS_client_method(void) { |
| 318 | return TLS_method(); |
| 319 | } |