Commit e3e3713822 for openssl.org
commit e3e371382289ad60baa9e67850b284c33f03e763
Author: Neil Horman <nhorman@openssl.org>
Date: Thu Apr 10 09:12:11 2025 -0400
Add OSSL_QUIC_method
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27397)
diff --git a/include/internal/ssl_unwrap.h b/include/internal/ssl_unwrap.h
index 86c1345698..e796cddb7f 100644
--- a/include/internal/ssl_unwrap.h
+++ b/include/internal/ssl_unwrap.h
@@ -51,7 +51,8 @@ struct ssl_connection_st *ossl_quic_obj_get0_handshake_layer(QUIC_OBJ *obj);
# define IS_QUIC_METHOD(m) \
((m) == OSSL_QUIC_client_method() || \
(m) == OSSL_QUIC_client_thread_method() || \
- (m) == OSSL_QUIC_server_method())
+ (m) == OSSL_QUIC_server_method() || \
+ (m) == OSSL_QUIC_method())
# define IS_QUIC_CTX(ctx) IS_QUIC_METHOD((ctx)->method)
diff --git a/include/openssl/quic.h b/include/openssl/quic.h
index 8eacc631eb..69bbb36597 100644
--- a/include/openssl/quic.h
+++ b/include/openssl/quic.h
@@ -67,6 +67,11 @@ __owur const SSL_METHOD *OSSL_QUIC_client_thread_method(void);
*/
__owur const SSL_METHOD *OSSL_QUIC_server_method(void);
+/*
+ * Method used for QUIC client/server connection
+ */
+__owur const SSL_METHOD *OSSL_QUIC_method(void);
+
# ifdef __cplusplus
}
# endif
diff --git a/ssl/quic/quic_method.c b/ssl/quic/quic_method.c
index 8092855efc..ad28db3cf9 100644
--- a/ssl/quic/quic_method.c
+++ b/ssl/quic/quic_method.c
@@ -11,6 +11,16 @@
#include <openssl/objects.h>
#include "quic_local.h"
+/*
+ * NOTE: An endpoint method can be used to create a quic connection
+ * for use as a client or server, based on a subsequent call to
+ * SSL_set_[accept|connect]_state
+ */
+IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION,
+ OSSL_QUIC_method,
+ ssl_undefined_function,
+ ossl_quic_connect, ssl3_undef_enc_method)
+
IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION,
OSSL_QUIC_client_method,
ssl_undefined_function,