summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls/openssl/qsslcontext_openssl.cpp
diff options
context:
space:
mode:
authorTim Blechmann <tim.blechmann@qt.io>2025-07-18 12:19:31 +0800
committerTim Blechmann <tim.blechmann@qt.io>2025-08-16 08:57:26 +0800
commit9d8ffc0685eb28198cf04c8afdfae62a449552e8 (patch)
tree3d4bd3ac9e6b06e3c291f928323b398f5e6b6208 /src/plugins/tls/openssl/qsslcontext_openssl.cpp
parent3acd2d81d0c32d14644faefe51adbfac875b29f2 (diff)
openssl: ensure namespacing
Functions are declared as extern "C", which prevents them from being mangled. Since they are onyly passed as callacks to openssl, but we don't need to prevent mangling, we can remove the extern "C" statements from them Pick-to: 6.10 Task-number: QTBUG-138543 Change-Id: I0f4cca0cf799ebb6b2df980d2a607c6b336aa8c9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/tls/openssl/qsslcontext_openssl.cpp')
-rw-r--r--src/plugins/tls/openssl/qsslcontext_openssl.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/plugins/tls/openssl/qsslcontext_openssl.cpp b/src/plugins/tls/openssl/qsslcontext_openssl.cpp
index e7358da7148..7dfd7ebc408 100644
--- a/src/plugins/tls/openssl/qsslcontext_openssl.cpp
+++ b/src/plugins/tls/openssl/qsslcontext_openssl.cpp
@@ -29,31 +29,29 @@ Q_GLOBAL_STATIC(bool, forceSecurityLevel)
namespace QTlsPrivate
{
// These callback functions are defined in qtls_openssl.cpp.
-extern "C" int q_X509Callback(int ok, X509_STORE_CTX *ctx);
-extern "C" int q_X509CallbackDirect(int ok, X509_STORE_CTX *ctx);
+int q_X509Callback(int ok, X509_STORE_CTX *ctx);
+int q_X509CallbackDirect(int ok, X509_STORE_CTX *ctx);
#if QT_CONFIG(ocsp)
-extern "C" int qt_OCSP_status_server_callback(SSL *ssl, void *);
+int qt_OCSP_status_server_callback(SSL *ssl, void *);
#endif // ocsp
+#ifdef TLS1_3_VERSION
+int q_ssl_sess_set_new_cb(SSL *context, SSL_SESSION *session);
+#endif // TLS1_3_VERSION
+
} // namespace QTlsPrivate
#if QT_CONFIG(dtls)
// defined in qdtls_openssl.cpp:
namespace dtlscallbacks
{
-extern "C" int q_X509DtlsCallback(int ok, X509_STORE_CTX *ctx);
-extern "C" int q_generate_cookie_callback(SSL *ssl, unsigned char *dst,
- unsigned *cookieLength);
-extern "C" int q_verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
- unsigned cookieLength);
-}
+int q_X509DtlsCallback(int ok, X509_STORE_CTX *ctx);
+int q_generate_cookie_callback(SSL *ssl, unsigned char *dst, unsigned *cookieLength);
+int q_verify_cookie_callback(SSL *ssl, const unsigned char *cookie, unsigned cookieLength);
+} // namespace dtlscallbacks
#endif // dtls
-#ifdef TLS1_3_VERSION
-extern "C" int q_ssl_sess_set_new_cb(SSL *context, SSL_SESSION *session);
-#endif // TLS1_3_VERSION
-
static inline QString msgErrorSettingBackendConfig(const QString &why)
{
return QSslSocket::tr("Error when setting the OpenSSL configuration (%1)").arg(why);
@@ -689,7 +687,7 @@ QT_WARNING_POP
#ifdef TLS1_3_VERSION
// NewSessionTicket callback:
if (mode == QSslSocket::SslClientMode && !isDtls) {
- q_SSL_CTX_sess_set_new_cb(sslContext->ctx, q_ssl_sess_set_new_cb);
+ q_SSL_CTX_sess_set_new_cb(sslContext->ctx, QTlsPrivate::q_ssl_sess_set_new_cb);
q_SSL_CTX_set_session_cache_mode(sslContext->ctx, SSL_SESS_CACHE_CLIENT);
}