summarylogtreecommitdiffstats
path: root/0017-Allow-configuring-use-of-OpenSSL-in-QPasswordDigesto.patch
blob: 1b861a5870e64b85cace976ddb645334d38b5960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From bd1394d242f334b99fd8159e1774943d072a3a3c Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Mon, 14 Jul 2025 23:40:15 +0200
Subject: [PATCH 17/20] Allow configuring use of OpenSSL in QPasswordDigestors
 specifically

So far Qt Network always links against OpenSSL when the feature
`openssl-linked` is enabled to use it for QPasswordDigestors. This has the
disadvantage that OpenSSL is always used - even though a concrete
application using the build of Qt is otherwise only using the Schannel TLS
backend or no TLS backend at all.

With this change one can disable the use of OpenSSL for QPasswordDigestors
despite the use of `openssl-linked` with the feature flag
`openssl-password-digestor`. Then applications can still use the OpenSSL
TLS plugin (which is still linked against OpenSSL) but applications
preferring other TLS backends don't need to depend on OpenSSL.

Change-Id: I273fe5ad73db76c6432c39d0d09230d19a1f5608
---
 configure.cmake                       | 7 +++++++
 src/network/CMakeLists.txt            | 2 +-
 src/network/ssl/qpassworddigestor.cpp | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.cmake b/configure.cmake
index 49cb0baaa64..0d4dba06330 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1183,6 +1183,12 @@ qt_feature("openssl-linked" PUBLIC
     ENABLE INPUT_openssl STREQUAL 'linked'
 )
 qt_feature_definition("openssl-linked" "QT_LINKED_OPENSSL")
+qt_feature("openssl-password-digestor" PUBLIC
+    LABEL "OpenSSL based QPasswordDigestors."
+    AUTODETECT ON
+    CONDITION QT_FEATURE_openssl_linked AND QT_FEATURE_opensslv30
+    PURPOSE "Uses OpenSSL based implementation of QPasswordDigestors."
+)
 qt_feature("opensslv11" PUBLIC
     LABEL "OpenSSL 1.1"
     CONDITION TEST_opensslv11 OR TEST_opensslv11_headers
@@ -1443,6 +1449,7 @@ qt_configure_add_summary_entry(ARGS "Using vcpkg" TYPE "message" MESSAGE "${_vcp
 qt_configure_add_summary_entry(ARGS "libudev")
 qt_configure_add_summary_entry(ARGS "openssl")
 qt_configure_add_summary_entry(ARGS "openssl-linked")
+qt_configure_add_summary_entry(ARGS "openssl-password-digestor")
 qt_configure_add_summary_entry(ARGS "opensslv11")
 qt_configure_add_summary_entry(ARGS "opensslv30")
 qt_configure_add_summary_entry(ARGS "system-zlib")
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index dae0162b90b..4a0b7325c5e 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -349,7 +349,7 @@ qt_internal_extend_target(Network CONDITION QT_FEATURE_localserver AND WIN32
         socket/qlocalsocket_win.cpp
 )
 
-qt_internal_extend_target(Network CONDITION QT_FEATURE_openssl_linked AND QT_FEATURE_opensslv30
+qt_internal_extend_target(Network CONDITION QT_FEATURE_openssl_password_digestor AND QT_FEATURE_opensslv30
     LIBRARIES
         WrapOpenSSL::WrapOpenSSL
 )
diff --git a/src/network/ssl/qpassworddigestor.cpp b/src/network/ssl/qpassworddigestor.cpp
index f2b896124a0..2835ef83ef2 100644
--- a/src/network/ssl/qpassworddigestor.cpp
+++ b/src/network/ssl/qpassworddigestor.cpp
@@ -9,11 +9,12 @@
 #include <QtCore/QtEndian>
 #include <QtCore/QList>
 
+#include "qconfig.h"
 #include "qtcore-config_p.h"
 
 #include <limits>
 
-#if QT_CONFIG(opensslv30) && QT_CONFIG(openssl_linked)
+#if QT_CONFIG(opensslv30) && QT_CONFIG(openssl_password_digestor)
 #define USING_OPENSSL30
 #include <openssl/core_names.h>
 #include <openssl/kdf.h>
-- 
2.51.0