]> 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)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 11 Sep 2024 07:32:29 +0000 (17:32 +1000)
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 a4cde593857ac38c99b29c328aafd48512bbcc7f..f4fe0f606e80d60fe19bcdaa963ed1c04d2a9d70 100644 (file)
@@ -38,6 +38,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..c9a131f
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * 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)
+# 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 4702c98be07a664ad5209fd54176b119acdc5fa0..5567857aa481ea1c68c9c0e4a6fdc05520de0808 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 396cbe8461da2a0e08079a2291b45f244cdb132e..7c9fa2f81afdb86e2442a228bedbb4d20bbb06e8 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 539d6d9b7892a8e6e5597f17bff1bb2677c8b586..957adc2086264409015691f697cdfcd0dc7a8c6e 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 c8cdc668989277de263ae9a13ad1c2eb2a1401ab..c26164c9c258ffdb36c4ea12d6b6221f9ea424cc 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 bd560c9a91a3091316303c0cead52ec12c10f8b5..b2ad28e5d1f6192d5596a4140b9d9327b89802af 100644 (file)
@@ -11,6 +11,7 @@
 #include "internal/quic_tls.h"
 #include "../ssl_local.h"
 #include "internal/quic_error.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 ee45f8117dcd5e47f9f0a704ed1521bf55ac806a..6fb762bbd6493ceafd0091fecc79c3a1bfda834c 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 1f3b63ba2ef9a6b8116d73c291c78a1f7e656668..858343692b911bb437021b63e697c370ef476a9a 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 b98464256e6c5e8871fc059e64823a830ead97b3..76f665c51d90a5254784b512340bdf29c660b6fa 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 021a1a143eb93d09483bca1f59c16b37c96aab85..af42ce897759fa7d2a0464424ad78068dc98578a 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 e6884b2b43f1083b550406d3160bc0ce519b0ca6..865e660d60f25244c4c879aec1c638d5457dda18 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 d1910fd97db9de684525017785d79e11227410d2..eeeaac1a9c4f966eeb3d56d5f7ca0352a3bf4fb3 100644 (file)
@@ -29,6 +29,7 @@
 #include "internal/refcount.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 c4a0a2f7c1e6b7cb0e75775d972896933b11ad60..8327d17ccf666581e5aff6f45b96ab10460936ea 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"
 
 # ifdef OPENSSL_BUILD_SHLIBSSL
@@ -1797,38 +1798,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)
-# 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 c245c24080f36a377041fc2a408b2b28883f7908..50a8ba75ac72dce3b04d893dac79622ff5203fd0 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 6b5d9bbb24552f769a627a4b3f7c6dd7c93bba4c..140cb23e86de9df03458d8d3a2e521e309538756 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 a467948599f95ace4c32b5d2dfb735aa8f8b8ccb..3f06f1e4520a306d937b4c3bfad00ebc4c15b466 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 9fd84ecfd77c879057d0f846ba18cf83bcd667a5..20826e72001c0cee5ad448bc74188dbdf194b89d 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 fd840e8918e833ff5fe9cda417869e299a07f070..be9e1bb2b18f5fc2046125e416030c5f34939250 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 cb143aa84380d54e5d2d2a1d40838e79ffd50409..e425cb10fa6165f04ba4b0bad3c61f19a3cad010 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 b24ffdc15df0e1edd7c1d488f9e45004a1c24f9d..35ff796f2a28dc7136b236573fad37293c87951f 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 80a997a73c7fa7a369af1a6ec362c6e8f9a9ea16..a1d85599c902fd3e362bc997c6a047dc18155589 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 d1800c193a014914a43b58e516c2ca9496b2caab..1a5c81a5c5025cfed9984106779ffc5cb62789d3 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 d52e2a73844aa702a2330e4b659c12749adb099d..3444e14ba02d6195277ddfdf0718f2aaec9cc62d 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 d1668cb675781342ef76545ec8f80179c277302a..4475f7e997473d55e6c7029f0b59c580905b818b 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 4e4671d01302a0667fb716a4db2d761b1c0f0768..f7bf33b1ef2c39d4b30dc9805845577d97a2c08f 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 ac1199f1742109ba4a9149efa56af7f392b0fd62..51fe07e99950cb7369334755d0283bc9bf08e02d 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 85ed9f25f92959010783f4388e4bc38570fbea0f..b5f3e70e00fc4bee111aedc1d62cce6cb572132f 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 80c70bbaa2a6ac0de534f036894fabf1d10a16cc..00d641191fd50059488c0e4a7a46d17fb4e25073 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 8006fb21a66c801ec2ce21cf60c30bb022d2f4ae..7a2c7bade44c72f49632df63fccf19524191b1a6 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