-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libssl: Move SSL object unwrapping macros to separate header
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from #23334)
- Loading branch information
Showing
48 changed files
with
207 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.