diff options
author | jsing <> | 2020-10-14 16:44:15 +0000 |
---|---|---|
committer | jsing <> | 2020-10-14 16:44:15 +0000 |
commit | d01f579537c8999cab6b1bf97cfb2760827ceeae (patch) | |
tree | 48a3e74cff5229e78703d45e5305fd0d015a6e1f /src | |
parent | b78b3da503cdbc1eab982be1760a8fc44c08c508 (diff) | |
download | openbsd-d01f579537c8999cab6b1bf97cfb2760827ceeae.tar.gz openbsd-d01f579537c8999cab6b1bf97cfb2760827ceeae.tar.bz2 openbsd-d01f579537c8999cab6b1bf97cfb2760827ceeae.zip |
Mark DTLS methods as DTLS.
Rather than inferring DTLS from the method version, add a field that marks
a method as specifically being DTLS. Have SSL_IS_DTLS condition on this
rather than on version.
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl_locl.h | 5 | ||||
-rw-r--r-- | src/lib/libssl/ssl_methods.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index f2e1cb97f8..12838bf294 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_locl.h,v 1.304 2020/10/11 12:45:52 guenther Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.305 2020/10/14 16:44:15 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -315,7 +315,7 @@ __BEGIN_HIDDEN_DECLS | |||
315 | 315 | ||
316 | /* Check if an SSL structure is using DTLS. */ | 316 | /* Check if an SSL structure is using DTLS. */ |
317 | #define SSL_IS_DTLS(s) \ | 317 | #define SSL_IS_DTLS(s) \ |
318 | (s->method->internal->version == DTLS1_VERSION) | 318 | (s->method->internal->dtls) |
319 | 319 | ||
320 | /* See if we use signature algorithms extension. */ | 320 | /* See if we use signature algorithms extension. */ |
321 | #define SSL_USE_SIGALGS(s) \ | 321 | #define SSL_USE_SIGALGS(s) \ |
@@ -362,6 +362,7 @@ __BEGIN_HIDDEN_DECLS | |||
362 | #define NAMED_CURVE_TYPE 3 | 362 | #define NAMED_CURVE_TYPE 3 |
363 | 363 | ||
364 | typedef struct ssl_method_internal_st { | 364 | typedef struct ssl_method_internal_st { |
365 | int dtls; | ||
365 | int version; | 366 | int version; |
366 | 367 | ||
367 | uint16_t min_version; | 368 | uint16_t min_version; |
diff --git a/src/lib/libssl/ssl_methods.c b/src/lib/libssl/ssl_methods.c index e2d5766e0f..600aa89095 100644 --- a/src/lib/libssl/ssl_methods.c +++ b/src/lib/libssl/ssl_methods.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_methods.c,v 1.19 2020/10/11 12:45:52 guenther Exp $ */ | 1 | /* $OpenBSD: ssl_methods.c,v 1.20 2020/10/14 16:44:15 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -60,6 +60,7 @@ | |||
60 | #include "tls13_internal.h" | 60 | #include "tls13_internal.h" |
61 | 61 | ||
62 | static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { | 62 | static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { |
63 | .dtls = 1, | ||
63 | .version = DTLS1_VERSION, | 64 | .version = DTLS1_VERSION, |
64 | .min_version = DTLS1_VERSION, | 65 | .min_version = DTLS1_VERSION, |
65 | .max_version = DTLS1_VERSION, | 66 | .max_version = DTLS1_VERSION, |
@@ -124,6 +125,7 @@ DTLS_server_method(void) | |||
124 | 125 | ||
125 | #if defined(LIBRESSL_HAS_TLS1_3_CLIENT) && defined(LIBRESSL_HAS_TLS1_3_SERVER) | 126 | #if defined(LIBRESSL_HAS_TLS1_3_CLIENT) && defined(LIBRESSL_HAS_TLS1_3_SERVER) |
126 | static const SSL_METHOD_INTERNAL TLS_method_internal_data = { | 127 | static const SSL_METHOD_INTERNAL TLS_method_internal_data = { |
128 | .dtls = 0, | ||
127 | .version = TLS1_3_VERSION, | 129 | .version = TLS1_3_VERSION, |
128 | .min_version = TLS1_VERSION, | 130 | .min_version = TLS1_VERSION, |
129 | .max_version = TLS1_3_VERSION, | 131 | .max_version = TLS1_3_VERSION, |
@@ -152,6 +154,7 @@ static const SSL_METHOD TLS_method_data = { | |||
152 | #endif | 154 | #endif |
153 | 155 | ||
154 | static const SSL_METHOD_INTERNAL TLS_legacy_method_internal_data = { | 156 | static const SSL_METHOD_INTERNAL TLS_legacy_method_internal_data = { |
157 | .dtls = 0, | ||
155 | .version = TLS1_2_VERSION, | 158 | .version = TLS1_2_VERSION, |
156 | .min_version = TLS1_VERSION, | 159 | .min_version = TLS1_VERSION, |
157 | .max_version = TLS1_2_VERSION, | 160 | .max_version = TLS1_2_VERSION, |
@@ -179,6 +182,7 @@ static const SSL_METHOD TLS_legacy_method_data = { | |||
179 | }; | 182 | }; |
180 | 183 | ||
181 | static const SSL_METHOD_INTERNAL TLSv1_method_internal_data = { | 184 | static const SSL_METHOD_INTERNAL TLSv1_method_internal_data = { |
185 | .dtls = 0, | ||
182 | .version = TLS1_VERSION, | 186 | .version = TLS1_VERSION, |
183 | .min_version = TLS1_VERSION, | 187 | .min_version = TLS1_VERSION, |
184 | .max_version = TLS1_VERSION, | 188 | .max_version = TLS1_VERSION, |
@@ -206,6 +210,7 @@ static const SSL_METHOD TLSv1_method_data = { | |||
206 | }; | 210 | }; |
207 | 211 | ||
208 | static const SSL_METHOD_INTERNAL TLSv1_1_method_internal_data = { | 212 | static const SSL_METHOD_INTERNAL TLSv1_1_method_internal_data = { |
213 | .dtls = 0, | ||
209 | .version = TLS1_1_VERSION, | 214 | .version = TLS1_1_VERSION, |
210 | .min_version = TLS1_1_VERSION, | 215 | .min_version = TLS1_1_VERSION, |
211 | .max_version = TLS1_1_VERSION, | 216 | .max_version = TLS1_1_VERSION, |
@@ -233,6 +238,7 @@ static const SSL_METHOD TLSv1_1_method_data = { | |||
233 | }; | 238 | }; |
234 | 239 | ||
235 | static const SSL_METHOD_INTERNAL TLSv1_2_method_internal_data = { | 240 | static const SSL_METHOD_INTERNAL TLSv1_2_method_internal_data = { |
241 | .dtls = 0, | ||
236 | .version = TLS1_2_VERSION, | 242 | .version = TLS1_2_VERSION, |
237 | .min_version = TLS1_2_VERSION, | 243 | .min_version = TLS1_2_VERSION, |
238 | .max_version = TLS1_2_VERSION, | 244 | .max_version = TLS1_2_VERSION, |