]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
libssl: Move SSL object unwrapping macros to separate header
authorHugo Landau <hlandau@openssl.org>
Thu, 11 Jan 2024 08:36:15 +0000 (08:36 +0000)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23334)

48 files changed:
include/internal/quic_predef.h
include/internal/quic_trace.h [new file with mode: 0644]
include/internal/ssl_unwrap.h [new file with mode: 0644]
ssl/bio_ssl.c
ssl/d1_lib.c
ssl/d1_msg.c
ssl/d1_srtp.c
ssl/quic/quic_channel.c
ssl/quic/quic_impl.c
ssl/quic/quic_local.h
ssl/quic/quic_obj.c
ssl/quic/quic_port.c
ssl/quic/quic_tls.c
ssl/quic/quic_trace.c
ssl/record/rec_layer_d1.c
ssl/record/rec_layer_s3.c
ssl/s3_enc.c
ssl/s3_lib.c
ssl/s3_msg.c
ssl/ssl_cert.c
ssl/ssl_ciph.c
ssl/ssl_conf.c
ssl/ssl_lib.c
ssl/ssl_local.h
ssl/ssl_rsa.c
ssl/ssl_sess.c
ssl/ssl_stat.c
ssl/statem/extensions.c
ssl/statem/extensions_clnt.c
ssl/statem/extensions_cust.c
ssl/statem/extensions_srvr.c
ssl/statem/statem.c
ssl/statem/statem_clnt.c
ssl/statem/statem_dtls.c
ssl/statem/statem_lib.c
ssl/statem/statem_srvr.c
ssl/t1_enc.c
ssl/t1_lib.c
ssl/t1_trce.c
ssl/tls13_enc.c
ssl/tls_depr.c
ssl/tls_srp.c
test/dtls_mtu_test.c
test/helpers/handshake.c
test/ssl_handshake_rtt_test.c
test/sslapitest.c
test/sslbuffertest.c
test/tls13secretstest.c

index 574915e20c3049cbd6b21bd763617c2dc747c32f..899f60959a4279685ddd06f77fde644bc9210999 100644 (file)
@@ -37,6 +37,7 @@ typedef struct quic_lcidm_st QUIC_LCIDM;
 typedef struct quic_urxe_st QUIC_URXE;
 typedef struct quic_engine_st QUIC_ENGINE;
 typedef struct quic_obj_st QUIC_OBJ;
+typedef struct quic_conn_st QUIC_CONNECTION;
 
 # endif
 
diff --git a/include/internal/quic_trace.h b/include/internal/quic_trace.h
new file mode 100644 (file)
index 0000000..35d6996
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_QUIC_TRACE_H
+# define OSSL_QUIC_TRACE_H
+
+# ifndef OPENSSL_NO_QUIC
+
+int ossl_quic_trace(int write_p, int version, int content_type,
+                    const void *buf, size_t msglen, SSL *ssl, void *arg);
+
+# endif
+
+#endif
diff --git a/include/internal/ssl_unwrap.h b/include/internal/ssl_unwrap.h
new file mode 100644 (file)
index 0000000..e436e6d
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_SSL_UNWRAP_H
+# define OSSL_SSL_UNWRAP_H
+
+# include <openssl/ssl.h>
+# include "internal/quic_predef.h"
+
+# define SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, c) \
+    ((ssl) == NULL ? NULL                         \
+     : ((ssl)->type == SSL_TYPE_SSL_CONNECTION    \
+       ? (c SSL_CONNECTION *)(ssl)                \
+       : NULL))
+# define SSL_CONNECTION_NO_CONST
+# define SSL_CONNECTION_FROM_SSL_ONLY(ssl) \
+    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
+# define SSL_CONNECTION_FROM_CONST_SSL_ONLY(ssl) \
+    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
+# define SSL_CONNECTION_GET_CTX(sc) ((sc)->ssl.ctx)
+# define SSL_CONNECTION_GET_SSL(sc) (&(sc)->ssl)
+# define SSL_CONNECTION_GET_USER_SSL(sc) ((sc)->user_ssl)
+# ifndef OPENSSL_NO_QUIC
+struct ssl_connection_st *ossl_quic_obj_get0_handshake_layer(QUIC_OBJ *obj);
+#  define SSL_CONNECTION_FROM_SSL_int(ssl, c)                                           \
+    ((ssl) == NULL ? NULL                                                               \
+     : ((ssl)->type == SSL_TYPE_SSL_CONNECTION                                          \
+        ? (c SSL_CONNECTION *)(ssl)                                                     \
+        : (SSL_TYPE_IS_QUIC((ssl)->type)                                                \
+          ? (c SSL_CONNECTION *)ossl_quic_obj_get0_handshake_layer((QUIC_OBJ *)(ssl))   \
+          : NULL)))
+#  define SSL_CONNECTION_FROM_SSL(ssl) \
+    SSL_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+#  define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
+    SSL_CONNECTION_FROM_SSL_int(ssl, const)
+# else
+#  define SSL_CONNECTION_FROM_SSL(ssl) \
+    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
+#  define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
+    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
+# endif
+
+# ifndef OPENSSL_NO_QUIC
+
+#  define IS_QUIC_METHOD(m) \
+    ((m) == OSSL_QUIC_client_method() || \
+     (m) == OSSL_QUIC_client_thread_method())
+
+#  define IS_QUIC_CTX(ctx)          IS_QUIC_METHOD((ctx)->method)
+
+#  define QUIC_CONNECTION_FROM_SSL_int(ssl, c)   \
+     ((ssl) == NULL ? NULL                       \
+      : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
+         ? (c QUIC_CONNECTION *)(ssl)            \
+         : NULL))
+
+#  define QUIC_XSO_FROM_SSL_int(ssl, c)                             \
+    ((ssl) == NULL                                                  \
+     ? NULL                                                         \
+     : (((ssl)->type == SSL_TYPE_QUIC_XSO                           \
+        ? (c QUIC_XSO *)(ssl)                                       \
+        : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                  \
+           ? (c QUIC_XSO *)((QUIC_CONNECTION *)(ssl))->default_xso  \
+           : NULL))))
+
+#  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c)               \
+     ((ssl) == NULL ? NULL                                       \
+      : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                 \
+         ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
+         : NULL))
+
+#  define QUIC_LISTENER_FROM_SSL_int(ssl, c)                            \
+    ((ssl) == NULL                                                      \
+     ? NULL                                                             \
+     : ((ssl)->type == SSL_TYPE_QUIC_LISTENER                           \
+        ? (c QUIC_LISTENER *)(ssl)                                      \
+        : NULL))
+
+#  define IS_QUIC_CS(ssl) ((ssl) != NULL                                \
+                           && ((ssl)->type == SSL_TYPE_QUIC_CONNECTION  \
+                               || (ssl)->type == SSL_TYPE_QUIC_XSO))
+
+#  define IS_QUIC(ssl)                                                  \
+    ((ssl) != NULL && SSL_TYPE_IS_QUIC((ssl)->type))
+
+# else
+
+#  define QUIC_CONNECTION_FROM_SSL_int(ssl, c) NULL
+#  define QUIC_XSO_FROM_SSL_int(ssl, c) NULL
+#  define QUIC_LISTENER_FROM_SSL_int(ssl, c) NULL
+#  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c) NULL
+#  define IS_QUIC(ssl) 0
+#  define IS_QUIC_CS(ssl) 0
+#  define IS_QUIC_CTX(ctx) 0
+#  define IS_QUIC_METHOD(m) 0
+
+# endif
+
+# define QUIC_CONNECTION_FROM_SSL(ssl) \
+    QUIC_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define QUIC_CONNECTION_FROM_CONST_SSL(ssl) \
+    QUIC_CONNECTION_FROM_SSL_int(ssl, const)
+# define QUIC_XSO_FROM_SSL(ssl) \
+    QUIC_XSO_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define QUIC_XSO_FROM_CONST_SSL(ssl) \
+    QUIC_XSO_FROM_SSL_int(ssl, const)
+# define QUIC_LISTENER_FROM_SSL(ssl) \
+    QUIC_LISTENER_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define QUIC_LISTENER_FROM_CONST_SSL(ssl) \
+    QUIC_LISTENER_FROM_SSL_int(ssl, const)
+# define SSL_CONNECTION_FROM_QUIC_SSL(ssl) \
+    SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
+# define SSL_CONNECTION_FROM_CONST_QUIC_SSL(ssl) \
+    SSL_CONNECTION_FROM_CONST_QUIC_SSL_int(ssl, const)
+
+#endif
index ac65a3988bd1026420f390d5a9d6f6537a9bbb68..a76a7e2de6d100695eb6d560437bdc30cae76e37 100644 (file)
@@ -15,6 +15,8 @@
 #include "internal/bio.h"
 #include <openssl/err.h>
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
+#include "internal/sockets.h"
 
 static int ssl_write(BIO *h, const char *buf, size_t size, size_t *written);
 static int ssl_read(BIO *b, char *buf, size_t size, size_t *readbytes);
index 9fa8606b4028cfc38c4a9cc70aa6d952b2908db8..7c3c5df5f302e2e1dd33a8631efa127890a4a7a2 100644 (file)
@@ -14,6 +14,7 @@
 #include <openssl/rand.h>
 #include "ssl_local.h"
 #include "internal/time.h"
+#include "internal/ssl_unwrap.h"
 
 static int dtls1_handshake_write(SSL_CONNECTION *s);
 static size_t dtls1_link_min_mtu(void);
index b1e1fad16d9e47a5d34cda82f55d5d244b031f54..48902c97f333167da8e5244c5302fbad0cde616f 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 int dtls1_write_app_data_bytes(SSL *s, uint8_t type, const void *buf_,
                                size_t len, size_t *written)
index 155021ff58412d5725191b3d1a3a30b3beb70316..0cccc37c2957c65061f8a16498dfafd7486c8761 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdio.h>
 #include <openssl/objects.h>
 #include "ssl_local.h"
-#include "quic/quic_local.h"
+#include "internal/ssl_unwrap.h"
 
 #ifndef OPENSSL_NO_SRTP
 
index b28a4917765fb4cdc31471d0a87830a4c3fb27a6..7726f4a868e65c84428fb983bf3cba9dd7bd99dc 100644 (file)
@@ -9,12 +9,15 @@
 
 #include <openssl/rand.h>
 #include <openssl/err.h>
+#include "internal/ssl_unwrap.h"
 #include "internal/quic_channel.h"
 #include "internal/quic_error.h"
 #include "internal/quic_rx_depack.h"
 #include "internal/quic_lcidm.h"
 #include "internal/quic_srtm.h"
 #include "internal/qlog_event_helpers.h"
+#include "internal/quic_txp.h"
+#include "internal/quic_tls.h"
 #include "../ssl_local.h"
 #include "quic_channel_local.h"
 #include "quic_port_local.h"
index 01ba89e64e7254eead1b761bc7135cad9e8df199..1341a76deecf8130c35ec1b75586a47d283e995a 100644 (file)
@@ -12,6 +12,7 @@
 #include <openssl/sslerr.h>
 #include <crypto/rand.h>
 #include "quic_local.h"
+#include "internal/ssl_unwrap.h"
 #include "internal/quic_tls.h"
 #include "internal/quic_rx_depack.h"
 #include "internal/quic_error.h"
index cada1844823f3b830a2d1ffac9471faad43ddd1d..0fcaf8a14248a1f545892f5727aea7b60ab52c1b 100644 (file)
@@ -33,8 +33,8 @@
  * state required by the libssl API personality.
  */
 struct quic_xso_st {
-    /* SSL object common header. */
-    struct ssl_st                   ssl;
+    /* QUIC_OBJ common header, including SSL object common header. */
+    QUIC_OBJ                        obj;
 
     /* The connection this stream is associated with. Always non-NULL. */
     QUIC_CONNECTION                 *conn;
@@ -126,13 +126,13 @@ struct quic_xso_st {
  */
 struct quic_conn_st {
     /*
-     * ssl_st is a common header for ordinary SSL objects, QUIC connection
-     * objects and QUIC stream objects, allowing objects of these different
-     * types to be disambiguated at runtime and providing some common fields.
+     * QUIC_OBJ is a common header for QUIC APL objects, allowing objects of
+     * these different types to be disambiguated at runtime and providing some
+     * common fields.
      *
      * Note: This must come first in the QUIC_CONNECTION structure.
      */
-    struct ssl_st                   ssl;
+    QUIC_OBJ                        obj;
 
     SSL                             *tls;
 
@@ -255,8 +255,8 @@ struct quic_conn_st {
  * layer for QLSO objects, wrapping the QUIC-native QUIC_PORT object.
  */
 struct quic_listener_st {
-    /* Common header for SSL objects. */
-    struct ssl_st                   ssl;
+    /* QUIC_OBJ common header, including SSL object common header. */
+    QUIC_OBJ                        obj;
 };
 
 /* Internal calls to the QUIC CSM which come from various places. */
@@ -276,77 +276,9 @@ void ossl_quic_conn_raise_protocol_error(QUIC_CONNECTION *qc,
 void ossl_quic_conn_on_remote_conn_close(QUIC_CONNECTION *qc,
                                          OSSL_QUIC_FRAME_CONN_CLOSE *f);
 
-int ossl_quic_trace(int write_p, int version, int content_type,
-                    const void *buf, size_t msglen, SSL *ssl, void *arg);
-
 #  define OSSL_QUIC_ANY_VERSION 0xFFFFF
-#  define IS_QUIC_METHOD(m) \
-    ((m) == OSSL_QUIC_client_method() || \
-     (m) == OSSL_QUIC_client_thread_method())
-#  define IS_QUIC_CTX(ctx)          IS_QUIC_METHOD((ctx)->method)
-
-#  define QUIC_CONNECTION_FROM_SSL_int(ssl, c)   \
-     ((ssl) == NULL ? NULL                       \
-      : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
-         ? (c QUIC_CONNECTION *)(ssl)            \
-         : NULL))
-
-#  define QUIC_XSO_FROM_SSL_int(ssl, c)                             \
-    ((ssl) == NULL                                                  \
-     ? NULL                                                         \
-     : (((ssl)->type == SSL_TYPE_QUIC_XSO                           \
-        ? (c QUIC_XSO *)(ssl)                                       \
-        : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                  \
-           ? (c QUIC_XSO *)((QUIC_CONNECTION *)(ssl))->default_xso  \
-           : NULL))))
-
-#  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c)               \
-     ((ssl) == NULL ? NULL                                       \
-      : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                 \
-         ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
-         : NULL))
-
-#  define QUIC_LISTENER_FROM_SSL_int(ssl, c)                            \
-    ((ssl) == NULL                                                      \
-     ? NULL                                                             \
-     : ((ssl)->type == SSL_TYPE_QUIC_LISTENER                           \
-        ? (c QUIC_LISTENER *)(ssl)                                      \
-        : NULL))
-
-#  define IS_QUIC_CS(ssl) ((ssl) != NULL                                \
-                           && ((ssl)->type == SSL_TYPE_QUIC_CONNECTION  \
-                               || (ssl)->type == SSL_TYPE_QUIC_XSO))
-
-#  define IS_QUIC(ssl)                                                  \
-    ((ssl) != NULL && SSL_TYPE_IS_QUIC((ssl)->type))
-# else
-#  define QUIC_CONNECTION_FROM_SSL_int(ssl, c) NULL
-#  define QUIC_XSO_FROM_SSL_int(ssl, c) NULL
-#  define QUIC_LISTENER_FROM_SSL_int(ssl, c) NULL
-#  define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c) NULL
-#  define IS_QUIC(ssl) 0
-#  define IS_QUIC_CS(ssl) 0
-#  define IS_QUIC_CTX(ctx) 0
-#  define IS_QUIC_METHOD(m) 0
 # endif
 
-# define QUIC_CONNECTION_FROM_SSL(ssl) \
-    QUIC_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-# define QUIC_CONNECTION_FROM_CONST_SSL(ssl) \
-    QUIC_CONNECTION_FROM_SSL_int(ssl, const)
-# define QUIC_XSO_FROM_SSL(ssl) \
-    QUIC_XSO_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-# define QUIC_XSO_FROM_CONST_SSL(ssl) \
-    QUIC_XSO_FROM_SSL_int(ssl, const)
-# define QUIC_LISTENER_FROM_SSL(ssl) \
-    QUIC_LISTENER_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-# define QUIC_LISTENER_FROM_CONST_SSL(ssl) \
-    QUIC_LISTENER_FROM_SSL_int(ssl, const)
-# define SSL_CONNECTION_FROM_QUIC_SSL(ssl) \
-    SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-# define SSL_CONNECTION_FROM_CONST_QUIC_SSL(ssl) \
-    SSL_CONNECTION_FROM_CONST_QUIC_SSL_int(ssl, const)
-
 # define IMPLEMENT_quic_meth_func(version, func_name, q_accept, \
                                  q_connect, enc_data) \
 const SSL_METHOD *func_name(void)  \
index 63261073d56fb0ec18b56a1af990c5373d1efb09..2981fd4fe86da6b00b07c1b86617c684eb8dfa41 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "quic_obj_local.h"
 #include "quic_local.h"
+#include "internal/ssl_unwrap.h"
 
 static int obj_update_cache(QUIC_OBJ *obj);
 
index fbc798601768251714dc6926c192a9f6efe1d3fe..01892614bd39a788cf64c7b3eb04cbf42fcb7bc5 100644 (file)
@@ -11,6 +11,7 @@
 #include "internal/quic_channel.h"
 #include "internal/quic_lcidm.h"
 #include "internal/quic_srtm.h"
+#include "internal/ssl_unwrap.h"
 #include "quic_port_local.h"
 #include "quic_channel_local.h"
 #include "quic_engine_local.h"
index 6cd656ea422758ec9b6d1363e27fe6f4dbbddd60..bd5eed874adcedc0c4212d271d8d564b23fffb3d 100644 (file)
@@ -12,6 +12,7 @@
 #include "../ssl_local.h"
 #include "internal/quic_error.h"
 #include "internal/quic_types.h"
+#include "internal/ssl_unwrap.h"
 
 #define QUIC_TLS_FATAL(rl, ad, err) \
     do { \
index 9c433746f87f5b8becd7492aac2ba756f690d014..cf337180ecc0e09858c9695121e31e0ebbde1546 100644 (file)
@@ -9,7 +9,10 @@
 
 #include <openssl/bio.h>
 #include "../ssl_local.h"
+#include "internal/quic_trace.h"
 #include "internal/quic_wire_pkt.h"
+#include "internal/quic_wire.h"
+#include "internal/ssl_unwrap.h"
 
 static const char *packet_type(int type)
 {
index d55887d9aaa2124fba6598cb9ef6dedce5de064e..7d340805baaf3acb6c4d8dbfafd85d26639129ca 100644 (file)
@@ -15,6 +15,7 @@
 #include "record_local.h"
 #include "internal/packet.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 
 int DTLS_RECORD_LAYER_new(RECORD_LAYER *rl)
 {
index 7022d08cea11f4ec5cbdbebca4d81a7bee2cad2c..3177f4a7c69f6c25defe49d49aec0712ff910ae2 100644 (file)
@@ -22,6 +22,7 @@
 #include "record_local.h"
 #include "internal/packet.h"
 #include "internal/comp.h"
+#include "internal/ssl_unwrap.h"
 
 void RECORD_LAYER_init(RECORD_LAYER *rl, SSL_CONNECTION *s)
 {
index cda1f7f83bcd0073f1c2dc8aa4f68c9a334c5e1f..e0c70a0818444706d3412de8e368711ac4c3a9ab 100644 (file)
@@ -14,6 +14,7 @@
 #include <openssl/md5.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 
 static int ssl3_generate_key_block(SSL_CONNECTION *s, unsigned char *km, int num)
 {
index 05f9e3753d68d5a9624d2c6dba8a6163a7deb033..254cf9128a370d2d977b7328bf17aa3297a84aad 100644 (file)
@@ -21,6 +21,7 @@
 #include <openssl/x509v3.h>
 #include <openssl/core_names.h>
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 
 #define TLS13_NUM_CIPHERS       OSSL_NELEM(tls13_ciphers)
 #define SSL3_NUM_CIPHERS        OSSL_NELEM(ssl3_ciphers)
index 3fcea15e279e4c36c1331c871f8a027f4eef1f49..398f746a909cb262373c9c86ede26d48d4497037 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 int ssl3_do_change_cipher_spec(SSL_CONNECTION *s)
 {
index 6f48ab2f456993d2d4f779410f22eecd2f2eb450..276b489c60ebe4f8c146b0d00102c5c86eb01c38 100644 (file)
@@ -26,6 +26,7 @@
 #include "ssl_local.h"
 #include "ssl_cert_table.h"
 #include "internal/thread_once.h"
+#include "internal/ssl_unwrap.h"
 #ifndef OPENSSL_NO_POSIX_IO
 # include <sys/stat.h>
 # ifdef _WIN32
index e5d6237176cacad93b44d447838b8823ba578f30..4a3df98107d73ffb54fa7a47186cc41d71404184 100644 (file)
@@ -22,6 +22,7 @@
 #include "internal/thread_once.h"
 #include "internal/cryptlib.h"
 #include "internal/comp.h"
+#include "internal/ssl_unwrap.h"
 
 /* NB: make sure indices in these tables match values above */
 
index 730a796a78fc34e9009a7f0475afad83347eecf0..d23601ccf274a733753b062d620bcb23987b03c2 100644 (file)
@@ -16,6 +16,7 @@
 #include <openssl/decoder.h>
 #include <openssl/core_dispatch.h>
 #include "internal/nelem.h"
+#include "internal/ssl_unwrap.h"
 
 /*
  * structure holding name tables. This is used for permitted elements in lists
index 1d61e5b6ebd1d21d6bfc48bc3f0f18ec0cf6c5d5..6a89ee8f7db25ea612b2f208f897ebfabd3a3ffb 100644 (file)
@@ -30,6 +30,7 @@
 #include "internal/thread_once.h"
 #include "internal/ktls.h"
 #include "internal/to_hex.h"
+#include "internal/ssl_unwrap.h"
 #include "quic/quic_local.h"
 
 static int ssl_undefined_function_3(SSL_CONNECTION *sc, unsigned char *r,
index 31fbe3a8ea5c40df4e15aa751ac34eeedfe244bc..8c104b95f1b5fb66a3f067f5f162cf707c1624ee 100644 (file)
@@ -37,6 +37,7 @@
 # include "internal/time.h"
 # include "internal/ssl.h"
 # include "internal/cryptlib.h"
+# include "internal/quic_predef.h"
 # include "record/record.h"
 # include "internal/quic_predef.h"
 # include "internal/quic_tls.h"
@@ -1856,39 +1857,6 @@ struct ssl_connection_st {
     size_t server_cert_type_len;
 };
 
-# define SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, c) \
-    ((ssl) == NULL ? NULL                         \
-     : ((ssl)->type == SSL_TYPE_SSL_CONNECTION    \
-       ? (c SSL_CONNECTION *)(ssl)                \
-       : NULL))
-# define SSL_CONNECTION_NO_CONST
-# define SSL_CONNECTION_FROM_SSL_ONLY(ssl) \
-    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
-# define SSL_CONNECTION_FROM_CONST_SSL_ONLY(ssl) \
-    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
-# define SSL_CONNECTION_GET_CTX(sc) ((sc)->ssl.ctx)
-# define SSL_CONNECTION_GET_SSL(sc) (&(sc)->ssl)
-# define SSL_CONNECTION_GET_USER_SSL(sc) ((sc)->user_ssl)
-# ifndef OPENSSL_NO_QUIC
-#  include "quic/quic_local.h"
-#  define SSL_CONNECTION_FROM_SSL_int(ssl, c)                      \
-    ((ssl) == NULL ? NULL                                          \
-     : ((ssl)->type == SSL_TYPE_SSL_CONNECTION                     \
-        ? (c SSL_CONNECTION *)(ssl)                                \
-        : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION                 \
-           ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
-           : NULL)))
-#  define SSL_CONNECTION_FROM_SSL(ssl) \
-    SSL_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
-#  define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
-    SSL_CONNECTION_FROM_SSL_int(ssl, const)
-# else
-#  define SSL_CONNECTION_FROM_SSL(ssl) \
-    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, SSL_CONNECTION_NO_CONST)
-#  define SSL_CONNECTION_FROM_CONST_SSL(ssl) \
-    SSL_CONNECTION_FROM_SSL_ONLY_int(ssl, const)
-# endif
-
 /*
  * Structure containing table entry of values associated with the signature
  * algorithms (signature scheme) extension
index dee9d7baf0c49463144dd26bc3f2c950334b10aa..160c9b3cc26daedb7e84d9f4d5bd50d9bc4d37ac 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include "ssl_local.h"
 #include "internal/packet.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/bio.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 69149de0507c9888b8c2e3d0f1a7f733464eeeee..e19abf26ec2181cc5c2e38ad0f765616f0e1218c 100644 (file)
@@ -17,6 +17,7 @@
 #include <openssl/engine.h>
 #include "internal/refcount.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include "ssl_local.h"
 #include "statem/statem_local.h"
 
index 686eba452df45cfb91395625ab3a8f2b63dffbe5..18b2837d6529da37f8896bd67ba7dd17b75f28ad 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <stdio.h>
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 const char *SSL_state_string_long(const SSL *s)
 {
index d4275946b16c737db559ae2aa06fa2b3ff5410d6..56d9503e6eb24034ceb8938ffcc2ee9ab46eb67d 100644 (file)
@@ -15,6 +15,7 @@
 #include <string.h>
 #include "internal/nelem.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include "../ssl_local.h"
 #include "statem_local.h"
 
index a4785d1d30dbf2f7122e74bf116a278110f4f218..970160089b73b2fbf3342c04bc79562e5a917860 100644 (file)
@@ -10,6 +10,7 @@
 #include <openssl/ocsp.h>
 #include "../ssl_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include "statem_local.h"
 
 EXT_RETURN tls_construct_ctos_renegotiate(SSL_CONNECTION *s, WPACKET *pkt,
index 4757ee65bf1e9a5905f92852da4d2005974274db..2a225ce952bb7f0732fdba7ef2512c7b4be2b8b2 100644 (file)
@@ -12,6 +12,7 @@
 #include <openssl/ct.h>
 #include "../ssl_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include "statem_local.h"
 
 typedef struct {
index 0e842d5df9cad765d53153fad323080297a5d49d..d77b087ebf1281351419297e9542dbee282ca139 100644 (file)
@@ -11,6 +11,7 @@
 #include "../ssl_local.h"
 #include "statem_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 
 #define COOKIE_STATE_FORMAT_VERSION     1
 
index 67cb26ef46e97f5c4beae2910de4dd665f166934..87ed6c64c5680b204452031e0873735f599bcc13 100644 (file)
@@ -15,6 +15,7 @@
 #endif
 
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/rand.h>
 #include "../ssl_local.h"
 #include "statem_local.h"
index df2eed7594c17e59093fdddb4443dafe35d0d155..eafd7a295a00c4956c04eff5716e59e134e942d0 100644 (file)
@@ -28,6 +28,7 @@
 #include <openssl/param_build.h>
 #include "internal/cryptlib.h"
 #include "internal/comp.h"
+#include "internal/ssl_unwrap.h"
 
 static MSG_PROCESS_RETURN tls_process_as_hello_retry_request(SSL_CONNECTION *s,
                                                              PACKET *pkt);
index b583e312d994a62104d98ebc9b6b20067d5f49de..f25b2b2fa4880cdd54053e7b0ac0d00de0a46749 100644 (file)
@@ -14,6 +14,7 @@
 #include "../ssl_local.h"
 #include "statem_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/buffer.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 1cfd0df40bb3653967ce9e6fa1e5c5064e75553b..3687f2eac893189526879df6cecf4dcbc6b339a6 100644 (file)
@@ -14,6 +14,7 @@
 #include "../ssl_local.h"
 #include "statem_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/buffer.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 3d1cb90018cb400a5220eca19acc0662db675df3..21e5807795d115140a7a0f502b84aaa60609e1dd 100644 (file)
@@ -16,6 +16,7 @@
 #include "statem_local.h"
 #include "internal/constant_time.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/buffer.h>
 #include <openssl/rand.h>
 #include <openssl/objects.h>
index 2e9e24a8cf94a320e9f840cbb9668f237abeef41..8e72b75394ccccab7968883ebfeaabbc6b65deed 100644 (file)
@@ -13,6 +13,7 @@
 #include "record/record_local.h"
 #include "internal/ktls.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/comp.h>
 #include <openssl/evp.h>
 #include <openssl/kdf.h>
index 40abf27d402bb04bd6a285379a781777ec1ea7e2..17eef870fb1785a44413de15943fa6b1d39dfd7c 100644 (file)
@@ -23,6 +23,7 @@
 #include "internal/nelem.h"
 #include "internal/sizes.h"
 #include "internal/tlsgroups.h"
+#include "internal/ssl_unwrap.h"
 #include "ssl_local.h"
 #include "quic/quic_local.h"
 #include <openssl/ct.h>
index 8d6444c50509cec086265c8d762f267f62830c19..37cab668de8eb819787ab179f8935297f3016027 100644 (file)
 
 /* Packet trace support for OpenSSL */
 #include "internal/nelem.h"
+#include "internal/ssl_unwrap.h"
+#include "internal/quic_predef.h"
+#include "internal/quic_trace.h"
+#include "quic/quic_local.h"
 
 typedef struct {
     int num;
index 7846c73a861dff9a610c1a75da0804f5431c684c..82a3244be7ab46b32cc13944f946dd64002683c0 100644 (file)
@@ -12,6 +12,7 @@
 #include "internal/ktls.h"
 #include "record/record_local.h"
 #include "internal/cryptlib.h"
+#include "internal/ssl_unwrap.h"
 #include <openssl/evp.h>
 #include <openssl/kdf.h>
 #include <openssl/core_names.h>
index b9ccfc4188ae9dbd97b277ee103cf33db87d55b4..8df075ae812b44c6ef6e271550950d21cde8dc2d 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <openssl/engine.h>
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 /*
  * Engine APIs are only used to support applications that still use ENGINEs.
index 0451e96bb519f935d54d57bdaa710cea2ed46af7..68283102cd57b15fb3ba1d3b6a5a09fc47b72741 100644 (file)
@@ -21,6 +21,7 @@
 #include <openssl/rand.h>
 #include <openssl/err.h>
 #include "ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 #ifndef OPENSSL_NO_SRP
 # include <openssl/srp.h>
index b11d5e3461315effece525d646225414525e856e..bce96a2226f2a922769dc6085e8a4ebe9caf148c 100644 (file)
@@ -19,6 +19,7 @@
 
 /* for SSL_READ_ETM() */
 #include "../ssl/ssl_local.h"
+#include "internal/ssl_unwrap.h"
 
 static int debug = 0;
 
index f611b3a0780d29c70593b763e56a66c984175f60..89a84a7667aa364595308fdcb7ce00bd1557b98c 100644 (file)
@@ -15,6 +15,7 @@
 #include <openssl/core_names.h>
 
 #include "../../ssl/ssl_local.h"
+#include "internal/ssl_unwrap.h"
 #include "internal/sockets.h"
 #include "internal/nelem.h"
 #include "handshake.h"
index 0e54284f04a43fc5c0da76ce6902ed7cb4d69b4a..9958124ca1c9954d5926accc1a1ae398f310fef2 100644 (file)
@@ -30,6 +30,7 @@
 #include "internal/ktls.h"
 #include "../ssl/ssl_local.h"
 #include "../ssl/statem/statem_local.h"
+#include "internal/ssl_unwrap.h"
 
 static OSSL_LIB_CTX *libctx = NULL;
 static char *cert = NULL;
index daa46606f088f8548638e3e3e8d6632d0683a2c8..935c8e58c446cad5c7d0f2c4abc9f8bc7ecfa39e 100644 (file)
@@ -41,6 +41,7 @@
 #include "internal/nelem.h"
 #include "internal/tlsgroups.h"
 #include "internal/ktls.h"
+#include "internal/ssl_unwrap.h"
 #include "../ssl/ssl_local.h"
 #include "../ssl/record/methods/recmethod_local.h"
 #include "filterprov.h"
index 981b22c23ee47879960128c99319f0273472d636..95468e3bcf9f1d31cc158e3deb02cc9ce282c11f 100644 (file)
 #include <openssl/err.h>
 #include <openssl/engine.h>
 
+#ifndef OPENSSL_NO_QUIC
+/* This test does not link libssl so avoid pulling in QUIC unwrappers. */
+# define OPENSSL_NO_QUIC
+#endif
+
 /* We include internal headers so we can check if the buffers are allocated */
 #include "../ssl/ssl_local.h"
 #include "../ssl/record/record_local.h"
 #include "internal/recordmethod.h"
 #include "../ssl/record/methods/recmethod_local.h"
+#include "internal/ssl_unwrap.h"
 
 #include "internal/packet.h"
 
index 2cbc4521308204694ace53bb09ee4f713bcc8810..e2eba0863a5e8ded3b8ffdb2a360c236c5f66b80 100644 (file)
@@ -11,6 +11,7 @@
 #include <openssl/evp.h>
 
 #include "../ssl/ssl_local.h"
+#include "internal/ssl_unwrap.h"
 #include "testutil.h"
 
 #define IVLEN   12