blob: db298fb52888969c434019e507a3e71acc583b8c [file] [log] [blame]
Steven Valdez8f36c512017-06-20 10:55:02 -04001/* Copyright (c) 2017, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15#include <openssl/ssl.h>
16
17#include <assert.h>
18
David Benjamina972b782023-05-05 10:22:43 -040019#include <algorithm>
20
Steven Valdez8f36c512017-06-20 10:55:02 -040021#include <openssl/bytestring.h>
22#include <openssl/err.h>
David Benjamina972b782023-05-05 10:22:43 -040023#include <openssl/span.h>
Steven Valdez8f36c512017-06-20 10:55:02 -040024
25#include "internal.h"
26#include "../crypto/internal.h"
27
28
Joshua Liebow-Feeser8c7c6352018-08-26 18:53:36 -070029BSSL_NAMESPACE_BEGIN
David Benjamin86e95b82017-07-18 16:34:25 -040030
David Benjamined9aed12017-09-27 19:24:09 -040031bool ssl_protocol_version_from_wire(uint16_t *out, uint16_t version) {
Steven Valdez8f36c512017-06-20 10:55:02 -040032 switch (version) {
Steven Valdez8f36c512017-06-20 10:55:02 -040033 case TLS1_VERSION:
34 case TLS1_1_VERSION:
35 case TLS1_2_VERSION:
Steven Valdezd4514532018-08-13 10:07:45 -040036 case TLS1_3_VERSION:
Steven Valdez8f36c512017-06-20 10:55:02 -040037 *out = version;
David Benjamined9aed12017-09-27 19:24:09 -040038 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -040039
Steven Valdez8f36c512017-06-20 10:55:02 -040040 case DTLS1_VERSION:
David Benjaminc11ea9422017-08-29 16:33:21 -040041 // DTLS 1.0 is analogous to TLS 1.1, not TLS 1.0.
Steven Valdez8f36c512017-06-20 10:55:02 -040042 *out = TLS1_1_VERSION;
David Benjamined9aed12017-09-27 19:24:09 -040043 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -040044
45 case DTLS1_2_VERSION:
46 *out = TLS1_2_VERSION;
David Benjamined9aed12017-09-27 19:24:09 -040047 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -040048
49 default:
David Benjamined9aed12017-09-27 19:24:09 -040050 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -040051 }
52}
53
David Benjaminc11ea9422017-08-29 16:33:21 -040054// The follow arrays are the supported versions for TLS and DTLS, in order of
55// decreasing preference.
Steven Valdez8f36c512017-06-20 10:55:02 -040056
57static const uint16_t kTLSVersions[] = {
Steven Valdezd4514532018-08-13 10:07:45 -040058 TLS1_3_VERSION,
Steven Valdez8f36c512017-06-20 10:55:02 -040059 TLS1_2_VERSION,
60 TLS1_1_VERSION,
61 TLS1_VERSION,
Steven Valdez8f36c512017-06-20 10:55:02 -040062};
63
64static const uint16_t kDTLSVersions[] = {
65 DTLS1_2_VERSION,
66 DTLS1_VERSION,
67};
68
David Benjamin95dd54e2019-08-22 16:43:15 -040069static Span<const uint16_t> get_method_versions(
70 const SSL_PROTOCOL_METHOD *method) {
71 return method->is_dtls ? Span<const uint16_t>(kDTLSVersions)
72 : Span<const uint16_t>(kTLSVersions);
Steven Valdez8f36c512017-06-20 10:55:02 -040073}
74
Matthew Braithwaite0e9e0ba2018-04-10 15:40:12 -070075bool ssl_method_supports_version(const SSL_PROTOCOL_METHOD *method,
76 uint16_t version) {
David Benjamin95dd54e2019-08-22 16:43:15 -040077 for (uint16_t supported : get_method_versions(method)) {
78 if (supported == version) {
David Benjamined9aed12017-09-27 19:24:09 -040079 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -040080 }
81 }
David Benjamined9aed12017-09-27 19:24:09 -040082 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -040083}
84
David Benjamina4bafd32017-10-03 15:06:29 -040085// The following functions map between API versions and wire versions. The
Steven Valdezb84674b2018-08-28 10:14:07 -040086// public API works on wire versions.
David Benjamina4bafd32017-10-03 15:06:29 -040087
Adam Langleyc215ce72023-05-08 11:35:14 -070088static const char* kUnknownVersion = "unknown";
89
90struct VersionInfo {
David Benjamina972b782023-05-05 10:22:43 -040091 uint16_t version;
92 const char *name;
Adam Langleyc215ce72023-05-08 11:35:14 -070093};
94
95static const VersionInfo kVersionNames[] = {
David Benjamina972b782023-05-05 10:22:43 -040096 {TLS1_3_VERSION, "TLSv1.3"},
97 {TLS1_2_VERSION, "TLSv1.2"},
98 {TLS1_1_VERSION, "TLSv1.1"},
99 {TLS1_VERSION, "TLSv1"},
100 {DTLS1_VERSION, "DTLSv1"},
101 {DTLS1_2_VERSION, "DTLSv1.2"},
102};
103
David Benjamina4bafd32017-10-03 15:06:29 -0400104static const char *ssl_version_to_string(uint16_t version) {
David Benjamina972b782023-05-05 10:22:43 -0400105 for (const auto &v : kVersionNames) {
106 if (v.version == version) {
107 return v.name;
108 }
David Benjamina4bafd32017-10-03 15:06:29 -0400109 }
Adam Langleyc215ce72023-05-08 11:35:14 -0700110 return kUnknownVersion;
David Benjamina4bafd32017-10-03 15:06:29 -0400111}
112
113static uint16_t wire_version_to_api(uint16_t version) {
Steven Valdezb84674b2018-08-28 10:14:07 -0400114 return version;
David Benjamina4bafd32017-10-03 15:06:29 -0400115}
116
Steven Valdezb84674b2018-08-28 10:14:07 -0400117// api_version_to_wire maps |version| to some representative wire version.
David Benjamina4bafd32017-10-03 15:06:29 -0400118static bool api_version_to_wire(uint16_t *out, uint16_t version) {
David Benjamina4bafd32017-10-03 15:06:29 -0400119 // Check it is a real protocol version.
120 uint16_t unused;
121 if (!ssl_protocol_version_from_wire(&unused, version)) {
122 return false;
123 }
124
125 *out = version;
126 return true;
127}
128
129static bool set_version_bound(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
130 uint16_t version) {
131 if (!api_version_to_wire(&version, version) ||
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700132 !ssl_method_supports_version(method, version)) {
David Benjamin353577c2017-06-29 15:54:58 -0400133 OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_SSL_VERSION);
David Benjamined9aed12017-09-27 19:24:09 -0400134 return false;
David Benjamin353577c2017-06-29 15:54:58 -0400135 }
136
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700137 *out = version;
David Benjamined9aed12017-09-27 19:24:09 -0400138 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400139}
140
David Benjamined9aed12017-09-27 19:24:09 -0400141static bool set_min_version(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
142 uint16_t version) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400143 // Zero is interpreted as the default minimum version.
Steven Valdez8f36c512017-06-20 10:55:02 -0400144 if (version == 0) {
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700145 *out = method->is_dtls ? DTLS1_VERSION : TLS1_VERSION;
David Benjamined9aed12017-09-27 19:24:09 -0400146 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400147 }
148
149 return set_version_bound(method, out, version);
150}
151
David Benjamined9aed12017-09-27 19:24:09 -0400152static bool set_max_version(const SSL_PROTOCOL_METHOD *method, uint16_t *out,
153 uint16_t version) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400154 // Zero is interpreted as the default maximum version.
Steven Valdez8f36c512017-06-20 10:55:02 -0400155 if (version == 0) {
Matthew Braithwaite58d56f42019-11-04 13:20:01 -0800156 *out = method->is_dtls ? DTLS1_2_VERSION : TLS1_3_VERSION;
David Benjamined9aed12017-09-27 19:24:09 -0400157 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400158 }
159
160 return set_version_bound(method, out, version);
161}
162
Steven Valdez8f36c512017-06-20 10:55:02 -0400163const struct {
164 uint16_t version;
165 uint32_t flag;
166} kProtocolVersions[] = {
Steven Valdez8f36c512017-06-20 10:55:02 -0400167 {TLS1_VERSION, SSL_OP_NO_TLSv1},
168 {TLS1_1_VERSION, SSL_OP_NO_TLSv1_1},
169 {TLS1_2_VERSION, SSL_OP_NO_TLSv1_2},
170 {TLS1_3_VERSION, SSL_OP_NO_TLSv1_3},
171};
172
Matthew Braithwaiteb7bc80a2018-04-13 15:51:30 -0700173bool ssl_get_version_range(const SSL_HANDSHAKE *hs, uint16_t *out_min_version,
David Benjamined9aed12017-09-27 19:24:09 -0400174 uint16_t *out_max_version) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400175 // For historical reasons, |SSL_OP_NO_DTLSv1| aliases |SSL_OP_NO_TLSv1|, but
176 // DTLS 1.0 should be mapped to TLS 1.1.
Matthew Braithwaiteb7bc80a2018-04-13 15:51:30 -0700177 uint32_t options = hs->ssl->options;
178 if (SSL_is_dtls(hs->ssl)) {
Steven Valdez8f36c512017-06-20 10:55:02 -0400179 options &= ~SSL_OP_NO_TLSv1_1;
180 if (options & SSL_OP_NO_DTLSv1) {
181 options |= SSL_OP_NO_TLSv1_1;
182 }
183 }
184
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700185 uint16_t min_version, max_version;
186 if (!ssl_protocol_version_from_wire(&min_version,
187 hs->config->conf_min_version) ||
188 !ssl_protocol_version_from_wire(&max_version,
189 hs->config->conf_max_version)) {
190 OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR);
191 return false;
192 }
Steven Valdez8f36c512017-06-20 10:55:02 -0400193
Steven Valdezc8e0f902018-07-14 11:23:01 -0400194 // QUIC requires TLS 1.3.
Alessandro Ghedini3cbb0292018-12-13 13:53:57 +0000195 if (hs->ssl->quic_method && min_version < TLS1_3_VERSION) {
Steven Valdezc8e0f902018-07-14 11:23:01 -0400196 min_version = TLS1_3_VERSION;
197 }
198
David Benjamin72b095d2020-06-11 14:41:28 -0400199 // The |SSL_OP_NO_*| flags disable individual protocols. This has two
200 // problems. First, prior to TLS 1.3, the protocol can only express a
201 // contiguous range of versions. Second, a library consumer trying to set a
202 // maximum version cannot disable protocol versions that get added in a future
203 // version of the library.
David Benjaminc11ea9422017-08-29 16:33:21 -0400204 //
205 // To account for both of these, OpenSSL interprets the client-side bitmask
206 // as a min/max range by picking the lowest contiguous non-empty range of
207 // enabled protocols. Note that this means it is impossible to set a maximum
208 // version of the higest supported TLS version in a future-proof way.
David Benjamined9aed12017-09-27 19:24:09 -0400209 bool any_enabled = false;
Steven Valdez8f36c512017-06-20 10:55:02 -0400210 for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(kProtocolVersions); i++) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400211 // Only look at the versions already enabled.
Steven Valdez8f36c512017-06-20 10:55:02 -0400212 if (min_version > kProtocolVersions[i].version) {
213 continue;
214 }
215 if (max_version < kProtocolVersions[i].version) {
216 break;
217 }
218
219 if (!(options & kProtocolVersions[i].flag)) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400220 // The minimum version is the first enabled version.
Steven Valdez8f36c512017-06-20 10:55:02 -0400221 if (!any_enabled) {
David Benjamined9aed12017-09-27 19:24:09 -0400222 any_enabled = true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400223 min_version = kProtocolVersions[i].version;
224 }
225 continue;
226 }
227
David Benjaminc11ea9422017-08-29 16:33:21 -0400228 // If there is a disabled version after the first enabled one, all versions
229 // after it are implicitly disabled.
Steven Valdez8f36c512017-06-20 10:55:02 -0400230 if (any_enabled) {
231 max_version = kProtocolVersions[i-1].version;
232 break;
233 }
234 }
235
236 if (!any_enabled) {
237 OPENSSL_PUT_ERROR(SSL, SSL_R_NO_SUPPORTED_VERSIONS_ENABLED);
David Benjamined9aed12017-09-27 19:24:09 -0400238 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -0400239 }
240
241 *out_min_version = min_version;
242 *out_max_version = max_version;
David Benjamined9aed12017-09-27 19:24:09 -0400243 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400244}
245
David Benjamind9cbb532017-07-07 13:17:19 -0400246static uint16_t ssl_version(const SSL *ssl) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400247 // In early data, we report the predicted version.
David Benjamind9cbb532017-07-07 13:17:19 -0400248 if (SSL_in_early_data(ssl) && !ssl->server) {
249 return ssl->s3->hs->early_session->ssl_version;
250 }
251 return ssl->version;
252}
253
David Benjamind1e3ce12017-10-06 18:31:15 -0400254uint16_t ssl_protocol_version(const SSL *ssl) {
Steven Valdez8f36c512017-06-20 10:55:02 -0400255 assert(ssl->s3->have_version);
256 uint16_t version;
257 if (!ssl_protocol_version_from_wire(&version, ssl->version)) {
David Benjaminc11ea9422017-08-29 16:33:21 -0400258 // |ssl->version| will always be set to a valid version.
Steven Valdez8f36c512017-06-20 10:55:02 -0400259 assert(0);
260 return 0;
261 }
262
263 return version;
264}
265
David Benjamin14e51ad2021-05-19 15:24:34 -0400266bool ssl_supports_version(const SSL_HANDSHAKE *hs, uint16_t version) {
267 const SSL *const ssl = hs->ssl;
Steven Valdezcd8470f2017-10-11 12:29:36 -0400268 uint16_t protocol_version;
Matthew Braithwaite0e9e0ba2018-04-10 15:40:12 -0700269 if (!ssl_method_supports_version(ssl->method, version) ||
Steven Valdezcd8470f2017-10-11 12:29:36 -0400270 !ssl_protocol_version_from_wire(&protocol_version, version) ||
271 hs->min_version > protocol_version ||
272 protocol_version > hs->max_version) {
273 return false;
Steven Valdez520e1222017-06-13 12:45:25 -0400274 }
275
Steven Valdez56c4ed92018-05-10 11:04:53 -0400276 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400277}
278
David Benjamin83a49932021-05-20 15:57:09 -0400279bool ssl_add_supported_versions(const SSL_HANDSHAKE *hs, CBB *cbb,
280 uint16_t extra_min_version) {
David Benjamin95dd54e2019-08-22 16:43:15 -0400281 for (uint16_t version : get_method_versions(hs->ssl->method)) {
David Benjamin83a49932021-05-20 15:57:09 -0400282 uint16_t protocol_version;
David Benjamin95dd54e2019-08-22 16:43:15 -0400283 if (ssl_supports_version(hs, version) &&
David Benjamin83a49932021-05-20 15:57:09 -0400284 ssl_protocol_version_from_wire(&protocol_version, version) &&
285 protocol_version >= extra_min_version && //
David Benjamin95dd54e2019-08-22 16:43:15 -0400286 !CBB_add_u16(cbb, version)) {
David Benjamined9aed12017-09-27 19:24:09 -0400287 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -0400288 }
289 }
David Benjamined9aed12017-09-27 19:24:09 -0400290 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400291}
292
David Benjamined9aed12017-09-27 19:24:09 -0400293bool ssl_negotiate_version(SSL_HANDSHAKE *hs, uint8_t *out_alert,
294 uint16_t *out_version, const CBS *peer_versions) {
David Benjamin95dd54e2019-08-22 16:43:15 -0400295 for (uint16_t version : get_method_versions(hs->ssl->method)) {
296 if (!ssl_supports_version(hs, version)) {
Steven Valdez8f36c512017-06-20 10:55:02 -0400297 continue;
298 }
299
David Benjamin6965d252018-11-19 15:49:56 -0600300 // JDK 11, prior to 11.0.2, has a buggy TLS 1.3 implementation which fails
301 // to send SNI when offering 1.3 sessions. Disable TLS 1.3 for such
302 // clients. We apply this logic here rather than |ssl_supports_version| so
303 // the downgrade signal continues to query the true capabilities. (The
304 // workaround is a limitation of the peer's capabilities rather than our
305 // own.)
306 //
307 // See https://bugs.openjdk.java.net/browse/JDK-8211806.
David Benjamin95dd54e2019-08-22 16:43:15 -0400308 if (version == TLS1_3_VERSION && hs->apply_jdk11_workaround) {
David Benjamin6965d252018-11-19 15:49:56 -0600309 continue;
310 }
311
Steven Valdez8f36c512017-06-20 10:55:02 -0400312 CBS copy = *peer_versions;
313 while (CBS_len(&copy) != 0) {
David Benjamin95dd54e2019-08-22 16:43:15 -0400314 uint16_t peer_version;
315 if (!CBS_get_u16(&copy, &peer_version)) {
Steven Valdez8f36c512017-06-20 10:55:02 -0400316 OPENSSL_PUT_ERROR(SSL, SSL_R_DECODE_ERROR);
317 *out_alert = SSL_AD_DECODE_ERROR;
David Benjamined9aed12017-09-27 19:24:09 -0400318 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -0400319 }
320
David Benjamin95dd54e2019-08-22 16:43:15 -0400321 if (peer_version == version) {
Steven Valdez8f36c512017-06-20 10:55:02 -0400322 *out_version = version;
David Benjamined9aed12017-09-27 19:24:09 -0400323 return true;
Steven Valdez8f36c512017-06-20 10:55:02 -0400324 }
325 }
326 }
327
328 OPENSSL_PUT_ERROR(SSL, SSL_R_UNSUPPORTED_PROTOCOL);
329 *out_alert = SSL_AD_PROTOCOL_VERSION;
David Benjamined9aed12017-09-27 19:24:09 -0400330 return false;
Steven Valdez8f36c512017-06-20 10:55:02 -0400331}
David Benjamin86e95b82017-07-18 16:34:25 -0400332
Joshua Liebow-Feeser8c7c6352018-08-26 18:53:36 -0700333BSSL_NAMESPACE_END
David Benjamin86e95b82017-07-18 16:34:25 -0400334
335using namespace bssl;
336
337int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, uint16_t version) {
338 return set_min_version(ctx->method, &ctx->conf_min_version, version);
339}
340
341int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, uint16_t version) {
342 return set_max_version(ctx->method, &ctx->conf_max_version, version);
343}
344
Alessandro Ghedini12049fd2019-10-10 17:25:50 +0100345uint16_t SSL_CTX_get_min_proto_version(const SSL_CTX *ctx) {
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700346 return ctx->conf_min_version;
347}
348
Alessandro Ghedini12049fd2019-10-10 17:25:50 +0100349uint16_t SSL_CTX_get_max_proto_version(const SSL_CTX *ctx) {
Nitish Sakhawalkara4af5f82019-03-25 17:26:59 -0700350 return ctx->conf_max_version;
351}
352
David Benjamin86e95b82017-07-18 16:34:25 -0400353int SSL_set_min_proto_version(SSL *ssl, uint16_t version) {
Matthew Braithwaiteb7bc80a2018-04-13 15:51:30 -0700354 if (!ssl->config) {
355 return 0;
356 }
357 return set_min_version(ssl->method, &ssl->config->conf_min_version, version);
David Benjamin86e95b82017-07-18 16:34:25 -0400358}
359
360int SSL_set_max_proto_version(SSL *ssl, uint16_t version) {
Matthew Braithwaiteb7bc80a2018-04-13 15:51:30 -0700361 if (!ssl->config) {
362 return 0;
363 }
364 return set_max_version(ssl->method, &ssl->config->conf_max_version, version);
David Benjamin86e95b82017-07-18 16:34:25 -0400365}
366
Alessandro Ghedini12049fd2019-10-10 17:25:50 +0100367uint16_t SSL_get_min_proto_version(const SSL *ssl) {
368 if (!ssl->config) {
369 return 0;
370 }
371 return ssl->config->conf_min_version;
372}
373
374uint16_t SSL_get_max_proto_version(const SSL *ssl) {
375 if (!ssl->config) {
376 return 0;
377 }
378 return ssl->config->conf_max_version;
379}
380
David Benjamin86e95b82017-07-18 16:34:25 -0400381int SSL_version(const SSL *ssl) {
David Benjamina4bafd32017-10-03 15:06:29 -0400382 return wire_version_to_api(ssl_version(ssl));
David Benjamin86e95b82017-07-18 16:34:25 -0400383}
384
385const char *SSL_get_version(const SSL *ssl) {
386 return ssl_version_to_string(ssl_version(ssl));
387}
388
David Benjamina972b782023-05-05 10:22:43 -0400389size_t SSL_get_all_version_names(const char **out, size_t max_out) {
Adam Langleyc215ce72023-05-08 11:35:14 -0700390 return GetAllNames(out, max_out, MakeConstSpan(&kUnknownVersion, 1),
391 &VersionInfo::name, MakeConstSpan(kVersionNames));
David Benjamina972b782023-05-05 10:22:43 -0400392}
393
David Benjamin86e95b82017-07-18 16:34:25 -0400394const char *SSL_SESSION_get_version(const SSL_SESSION *session) {
395 return ssl_version_to_string(session->ssl_version);
396}
David Benjamina4bafd32017-10-03 15:06:29 -0400397
398uint16_t SSL_SESSION_get_protocol_version(const SSL_SESSION *session) {
399 return wire_version_to_api(session->ssl_version);
400}
401
402int SSL_SESSION_set_protocol_version(SSL_SESSION *session, uint16_t version) {
403 // This picks a representative TLS 1.3 version, but this API should only be
404 // used on unit test sessions anyway.
405 return api_version_to_wire(&session->ssl_version, version);
406}
Adam Langleyc2827d32021-10-12 13:18:18 -0700407
408int SSL_CTX_set_record_protocol_version(SSL_CTX *ctx, int version) {
409 return version == 0;
410}