Introduce openssl-hash feature

The feature allows to not use OpenSSL in QCryptographicHash
implementation and removes OpenSSL from dependencies of QtCore if
disabled.

Fixes: QTBUG-114783
Change-Id: I2a49fa9ddfa5acedcfc95a3330fd7863a8052a5c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bacb04d77b064d1f348d310b5b57aeebe93f590c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2023-06-21 17:13:06 +02:00 committed by Qt Cherry-pick Bot
parent 2a1ba918da
commit eb6784eb87
3 changed files with 9 additions and 3 deletions

View File

@ -813,7 +813,7 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_regularexpression
WrapPCRE2::WrapPCRE2 WrapPCRE2::WrapPCRE2
) )
qt_internal_extend_target(Core CONDITION QT_FEATURE_openssl_linked AND QT_FEATURE_opensslv30 qt_internal_extend_target(Core CONDITION QT_FEATURE_openssl_hash
LIBRARIES LIBRARIES
WrapOpenSSL::WrapOpenSSL WrapOpenSSL::WrapOpenSSL
) )

View File

@ -1017,6 +1017,11 @@ qt_feature("permissions" PUBLIC
LABEL "Application permissions" LABEL "Application permissions"
PURPOSE "Provides support for requesting user permission to access restricted data or APIs" PURPOSE "Provides support for requesting user permission to access restricted data or APIs"
) )
qt_feature("openssl-hash" PUBLIC
LABEL "OpenSSL based cryptographic hash"
CONDITION QT_FEATURE_openssl_linked AND QT_FEATURE_opensslv30
PURPOSE "Uses OpenSSL based implementation of cryptographic hash algorithms."
)
qt_configure_add_summary_section(NAME "Qt Core") qt_configure_add_summary_section(NAME "Qt Core")
qt_configure_add_summary_entry(ARGS "backtrace") qt_configure_add_summary_entry(ARGS "backtrace")
@ -1034,6 +1039,7 @@ qt_configure_add_summary_entry(
ARGS "etw lttng ctf" ARGS "etw lttng ctf"
MESSAGE "Tracing backend" MESSAGE "Tracing backend"
) )
qt_configure_add_summary_entry(ARGS "openssl-hash")
qt_configure_add_summary_section(NAME "Logging backends") qt_configure_add_summary_section(NAME "Logging backends")
qt_configure_add_summary_entry(ARGS "journald") qt_configure_add_summary_entry(ARGS "journald")
qt_configure_add_summary_entry(ARGS "syslog") qt_configure_add_summary_entry(ARGS "syslog")

View File

@ -25,7 +25,7 @@
#include "../../3rdparty/rfc6234/sha.h" #include "../../3rdparty/rfc6234/sha.h"
#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#if !QT_CONFIG(opensslv30) || !QT_CONFIG(openssl_linked) #if !QT_CONFIG(openssl_hash)
// qdoc and qmake only need SHA-1 // qdoc and qmake only need SHA-1
#include "../../3rdparty/md5/md5.h" #include "../../3rdparty/md5/md5.h"
#include "../../3rdparty/md5/md5.cpp" #include "../../3rdparty/md5/md5.cpp"
@ -114,7 +114,7 @@ static inline int SHA384_512AddLength(SHA512Context *context, unsigned int lengt
#endif #endif
#endif // QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #endif // QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(opensslv30) && QT_CONFIG(openssl_linked) #if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(openssl_hash)
#define USING_OPENSSL30 #define USING_OPENSSL30
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/provider.h> #include <openssl/provider.h>