diff options
author | tb <> | 2021-03-31 16:59:32 +0000 |
---|---|---|
committer | tb <> | 2021-03-31 16:59:32 +0000 |
commit | 5b46ea706824f271994a8e6eb2da25b4001fd4e7 (patch) | |
tree | 7fc9a2f9697b2baf17edacea4b0ba9baf7f6c5a7 | |
parent | 9dc4e18bb8f3e7f98db4b8f92f512c88bf9b347c (diff) | |
download | openbsd-5b46ea706824f271994a8e6eb2da25b4001fd4e7.tar.gz openbsd-5b46ea706824f271994a8e6eb2da25b4001fd4e7.tar.bz2 openbsd-5b46ea706824f271994a8e6eb2da25b4001fd4e7.zip |
Expose various DTLSv1.2 specific functions and defines
ok bcook inoguchi jsing
-rw-r--r-- | src/lib/libcrypto/opensslfeatures.h | 1 | ||||
-rw-r--r-- | src/lib/libssl/Symbols.list | 4 | ||||
-rw-r--r-- | src/lib/libssl/dtls1.h | 4 | ||||
-rw-r--r-- | src/lib/libssl/ssl.h | 10 | ||||
-rw-r--r-- | src/lib/libssl/ssl_methods.c | 16 |
5 files changed, 8 insertions, 27 deletions
diff --git a/src/lib/libcrypto/opensslfeatures.h b/src/lib/libcrypto/opensslfeatures.h index 9684276b72..20696d3d91 100644 --- a/src/lib/libcrypto/opensslfeatures.h +++ b/src/lib/libcrypto/opensslfeatures.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * enabled (or possibly not yet not implemented, or removed!). | 4 | * enabled (or possibly not yet not implemented, or removed!). |
5 | */ | 5 | */ |
6 | /* #define LIBRESSL_HAS_TLS1_3 */ | 6 | /* #define LIBRESSL_HAS_TLS1_3 */ |
7 | /* #define LIBRESSL_HAS_DTLS1_2 */ | ||
7 | 8 | ||
8 | #define OPENSSL_THREADS | 9 | #define OPENSSL_THREADS |
9 | 10 | ||
diff --git a/src/lib/libssl/Symbols.list b/src/lib/libssl/Symbols.list index 9234cf6e51..15d43f891e 100644 --- a/src/lib/libssl/Symbols.list +++ b/src/lib/libssl/Symbols.list | |||
@@ -13,6 +13,9 @@ DTLS_server_method | |||
13 | DTLSv1_client_method | 13 | DTLSv1_client_method |
14 | DTLSv1_method | 14 | DTLSv1_method |
15 | DTLSv1_server_method | 15 | DTLSv1_server_method |
16 | DTLSv1_2_client_method | ||
17 | DTLSv1_2_method | ||
18 | DTLSv1_2_server_method | ||
16 | SSLv23_client_method | 19 | SSLv23_client_method |
17 | SSLv23_method | 20 | SSLv23_method |
18 | SSLv23_server_method | 21 | SSLv23_server_method |
@@ -244,6 +247,7 @@ SSL_get_version | |||
244 | SSL_get_wbio | 247 | SSL_get_wbio |
245 | SSL_get_wfd | 248 | SSL_get_wfd |
246 | SSL_has_matching_session_id | 249 | SSL_has_matching_session_id |
250 | SSL_is_dtls | ||
247 | SSL_is_server | 251 | SSL_is_server |
248 | SSL_library_init | 252 | SSL_library_init |
249 | SSL_load_client_CA_file | 253 | SSL_load_client_CA_file |
diff --git a/src/lib/libssl/dtls1.h b/src/lib/libssl/dtls1.h index b822f659ab..fe8c5864dd 100644 --- a/src/lib/libssl/dtls1.h +++ b/src/lib/libssl/dtls1.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dtls1.h,v 1.24 2021/02/20 08:11:57 jsing Exp $ */ | 1 | /* $OpenBSD: dtls1.h,v 1.25 2021/03/31 16:59:32 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
@@ -74,10 +74,8 @@ extern "C" { | |||
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #define DTLS1_VERSION 0xFEFF | 76 | #define DTLS1_VERSION 0xFEFF |
77 | #if defined(LIBRESSL_HAS_DTLS1_2) || defined(LIBRESSL_INTERNAL) | ||
78 | #define DTLS1_2_VERSION 0xFEFD | 77 | #define DTLS1_2_VERSION 0xFEFD |
79 | #define DTLS1_VERSION_MAJOR 0xFE | 78 | #define DTLS1_VERSION_MAJOR 0xFE |
80 | #endif | ||
81 | 79 | ||
82 | /* lengths of messages */ | 80 | /* lengths of messages */ |
83 | #define DTLS1_COOKIE_LENGTH 256 | 81 | #define DTLS1_COOKIE_LENGTH 256 |
diff --git a/src/lib/libssl/ssl.h b/src/lib/libssl/ssl.h index 5665a09179..5ed2198b38 100644 --- a/src/lib/libssl/ssl.h +++ b/src/lib/libssl/ssl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl.h,v 1.185 2021/03/31 16:55:04 tb Exp $ */ | 1 | /* $OpenBSD: ssl.h,v 1.186 2021/03/31 16:59:32 tb 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 | * |
@@ -301,9 +301,7 @@ extern "C" { | |||
301 | #define SSL_TXT_STREEBOG512 "STREEBOG512" | 301 | #define SSL_TXT_STREEBOG512 "STREEBOG512" |
302 | 302 | ||
303 | #define SSL_TXT_DTLS1 "DTLSv1" | 303 | #define SSL_TXT_DTLS1 "DTLSv1" |
304 | #if defined(LIBRESSL_HAS_DTLS1_2) || defined(LIBRESSL_INTERNAL) | ||
305 | #define SSL_TXT_DTLS1_2 "DTLSv1.2" | 304 | #define SSL_TXT_DTLS1_2 "DTLSv1.2" |
306 | #endif | ||
307 | #define SSL_TXT_SSLV2 "SSLv2" | 305 | #define SSL_TXT_SSLV2 "SSLv2" |
308 | #define SSL_TXT_SSLV3 "SSLv3" | 306 | #define SSL_TXT_SSLV3 "SSLv3" |
309 | #define SSL_TXT_TLSV1 "TLSv1" | 307 | #define SSL_TXT_TLSV1 "TLSv1" |
@@ -523,10 +521,8 @@ struct ssl_session_st { | |||
523 | #define SSL_OP_NO_TLSv1_3 0x20000000L | 521 | #define SSL_OP_NO_TLSv1_3 0x20000000L |
524 | #endif | 522 | #endif |
525 | 523 | ||
526 | #if defined(LIBRESSL_HAS_DTLS1_2) || defined(LIBRESSL_INTERNAL) | ||
527 | #define SSL_OP_NO_DTLSv1 0x40000000L | 524 | #define SSL_OP_NO_DTLSv1 0x40000000L |
528 | #define SSL_OP_NO_DTLSv1_2 0x80000000L | 525 | #define SSL_OP_NO_DTLSv1_2 0x80000000L |
529 | #endif | ||
530 | 526 | ||
531 | /* SSL_OP_ALL: various bug workarounds that should be rather harmless. */ | 527 | /* SSL_OP_ALL: various bug workarounds that should be rather harmless. */ |
532 | #define SSL_OP_ALL \ | 528 | #define SSL_OP_ALL \ |
@@ -1465,9 +1461,7 @@ void SSL_free(SSL *ssl); | |||
1465 | int SSL_up_ref(SSL *ssl); | 1461 | int SSL_up_ref(SSL *ssl); |
1466 | int SSL_accept(SSL *ssl); | 1462 | int SSL_accept(SSL *ssl); |
1467 | int SSL_connect(SSL *ssl); | 1463 | int SSL_connect(SSL *ssl); |
1468 | #ifdef LIBRESSL_INTERNAL | ||
1469 | int SSL_is_dtls(const SSL *s); | 1464 | int SSL_is_dtls(const SSL *s); |
1470 | #endif | ||
1471 | int SSL_is_server(const SSL *s); | 1465 | int SSL_is_server(const SSL *s); |
1472 | int SSL_read(SSL *ssl, void *buf, int num); | 1466 | int SSL_read(SSL *ssl, void *buf, int num); |
1473 | int SSL_peek(SSL *ssl, void *buf, int num); | 1467 | int SSL_peek(SSL *ssl, void *buf, int num); |
@@ -1527,11 +1521,9 @@ const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ | |||
1527 | const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ | 1521 | const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ |
1528 | const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ | 1522 | const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ |
1529 | 1523 | ||
1530 | #if defined(LIBRESSL_HAS_DTLS1_2) || defined(LIBRESSL_INTERNAL) | ||
1531 | const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */ | 1524 | const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */ |
1532 | const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */ | 1525 | const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */ |
1533 | const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */ | 1526 | const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */ |
1534 | #endif | ||
1535 | 1527 | ||
1536 | const SSL_METHOD *DTLS_method(void); /* DTLS v1.0 or later */ | 1528 | const SSL_METHOD *DTLS_method(void); /* DTLS v1.0 or later */ |
1537 | const SSL_METHOD *DTLS_server_method(void); /* DTLS v1.0 or later */ | 1529 | const SSL_METHOD *DTLS_server_method(void); /* DTLS v1.0 or later */ |
diff --git a/src/lib/libssl/ssl_methods.c b/src/lib/libssl/ssl_methods.c index 084f533f5e..a3e51ac0d0 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.23 2021/02/25 17:06:05 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_methods.c,v 1.24 2021/03/31 16:59:32 tb 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 | * |
@@ -59,7 +59,6 @@ | |||
59 | #include "ssl_locl.h" | 59 | #include "ssl_locl.h" |
60 | #include "tls13_internal.h" | 60 | #include "tls13_internal.h" |
61 | 61 | ||
62 | #ifdef LIBRESSL_HAS_DTLS1_2 | ||
63 | static const SSL_METHOD_INTERNAL DTLS_method_internal_data = { | 62 | static const SSL_METHOD_INTERNAL DTLS_method_internal_data = { |
64 | .dtls = 1, | 63 | .dtls = 1, |
65 | .server = 1, | 64 | .server = 1, |
@@ -117,7 +116,6 @@ static const SSL_METHOD DTLS_client_method_data = { | |||
117 | .put_cipher_by_char = ssl3_put_cipher_by_char, | 116 | .put_cipher_by_char = ssl3_put_cipher_by_char, |
118 | .internal = &DTLS_client_method_internal_data, | 117 | .internal = &DTLS_client_method_internal_data, |
119 | }; | 118 | }; |
120 | #endif | ||
121 | 119 | ||
122 | static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { | 120 | static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { |
123 | .dtls = 1, | 121 | .dtls = 1, |
@@ -274,31 +272,19 @@ DTLSv1_2_server_method(void) | |||
274 | const SSL_METHOD * | 272 | const SSL_METHOD * |
275 | DTLS_client_method(void) | 273 | DTLS_client_method(void) |
276 | { | 274 | { |
277 | #ifdef LIBRESSL_HAS_DTLS1_2 | ||
278 | return &DTLS_client_method_data; | 275 | return &DTLS_client_method_data; |
279 | #else | ||
280 | return DTLSv1_client_method(); | ||
281 | #endif | ||
282 | } | 276 | } |
283 | 277 | ||
284 | const SSL_METHOD * | 278 | const SSL_METHOD * |
285 | DTLS_method(void) | 279 | DTLS_method(void) |
286 | { | 280 | { |
287 | #ifdef LIBRESSL_HAS_DTLS1_2 | ||
288 | return &DTLS_method_data; | 281 | return &DTLS_method_data; |
289 | #else | ||
290 | return DTLSv1_method(); | ||
291 | #endif | ||
292 | } | 282 | } |
293 | 283 | ||
294 | const SSL_METHOD * | 284 | const SSL_METHOD * |
295 | DTLS_server_method(void) | 285 | DTLS_server_method(void) |
296 | { | 286 | { |
297 | #ifdef LIBRESSL_HAS_DTLS1_2 | ||
298 | return &DTLS_method_data; | 287 | return &DTLS_method_data; |
299 | #else | ||
300 | return DTLSv1_server_method(); | ||
301 | #endif | ||
302 | } | 288 | } |
303 | 289 | ||
304 | #if defined(LIBRESSL_HAS_TLS1_3_CLIENT) && defined(LIBRESSL_HAS_TLS1_3_SERVER) | 290 | #if defined(LIBRESSL_HAS_TLS1_3_CLIENT) && defined(LIBRESSL_HAS_TLS1_3_SERVER) |