summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-03-31 16:59:32 +0000
committertb <>2021-03-31 16:59:32 +0000
commit5b46ea706824f271994a8e6eb2da25b4001fd4e7 (patch)
tree7fc9a2f9697b2baf17edacea4b0ba9baf7f6c5a7
parent9dc4e18bb8f3e7f98db4b8f92f512c88bf9b347c (diff)
downloadopenbsd-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.h1
-rw-r--r--src/lib/libssl/Symbols.list4
-rw-r--r--src/lib/libssl/dtls1.h4
-rw-r--r--src/lib/libssl/ssl.h10
-rw-r--r--src/lib/libssl/ssl_methods.c16
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
13DTLSv1_client_method 13DTLSv1_client_method
14DTLSv1_method 14DTLSv1_method
15DTLSv1_server_method 15DTLSv1_server_method
16DTLSv1_2_client_method
17DTLSv1_2_method
18DTLSv1_2_server_method
16SSLv23_client_method 19SSLv23_client_method
17SSLv23_method 20SSLv23_method
18SSLv23_server_method 21SSLv23_server_method
@@ -244,6 +247,7 @@ SSL_get_version
244SSL_get_wbio 247SSL_get_wbio
245SSL_get_wfd 248SSL_get_wfd
246SSL_has_matching_session_id 249SSL_has_matching_session_id
250SSL_is_dtls
247SSL_is_server 251SSL_is_server
248SSL_library_init 252SSL_library_init
249SSL_load_client_CA_file 253SSL_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);
1465int SSL_up_ref(SSL *ssl); 1461int SSL_up_ref(SSL *ssl);
1466int SSL_accept(SSL *ssl); 1462int SSL_accept(SSL *ssl);
1467int SSL_connect(SSL *ssl); 1463int SSL_connect(SSL *ssl);
1468#ifdef LIBRESSL_INTERNAL
1469int SSL_is_dtls(const SSL *s); 1464int SSL_is_dtls(const SSL *s);
1470#endif
1471int SSL_is_server(const SSL *s); 1465int SSL_is_server(const SSL *s);
1472int SSL_read(SSL *ssl, void *buf, int num); 1466int SSL_read(SSL *ssl, void *buf, int num);
1473int SSL_peek(SSL *ssl, void *buf, int num); 1467int SSL_peek(SSL *ssl, void *buf, int num);
@@ -1527,11 +1521,9 @@ const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
1527const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ 1521const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
1528const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ 1522const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
1529 1523
1530#if defined(LIBRESSL_HAS_DTLS1_2) || defined(LIBRESSL_INTERNAL)
1531const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */ 1524const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */
1532const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */ 1525const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */
1533const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */ 1526const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */
1534#endif
1535 1527
1536const SSL_METHOD *DTLS_method(void); /* DTLS v1.0 or later */ 1528const SSL_METHOD *DTLS_method(void); /* DTLS v1.0 or later */
1537const SSL_METHOD *DTLS_server_method(void); /* DTLS v1.0 or later */ 1529const 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
63static const SSL_METHOD_INTERNAL DTLS_method_internal_data = { 62static 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
122static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = { 120static const SSL_METHOD_INTERNAL DTLSv1_method_internal_data = {
123 .dtls = 1, 121 .dtls = 1,
@@ -274,31 +272,19 @@ DTLSv1_2_server_method(void)
274const SSL_METHOD * 272const SSL_METHOD *
275DTLS_client_method(void) 273DTLS_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
284const SSL_METHOD * 278const SSL_METHOD *
285DTLS_method(void) 279DTLS_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
294const SSL_METHOD * 284const SSL_METHOD *
295DTLS_server_method(void) 285DTLS_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)