Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.13.0, 5.13.1
-
None
-
windows 10 x64
Description
//project.pro QT -= gui QT += core QT += network QT += concurrent CONFIG += c++17 console CONFIG -= app_bundle win32:INCLUDEPATH += "C:/Program Files/OpenSSL/include" win32:LIBS += "C:/Program Files/OpenSSL/lib/*.lib"
Additional projects:
https://github.com/yhirose/cpp-httplib
Operating System:windows 10 x64
openssl version: 1.1.1d, 1.1.1b, 1.1.0 k, 1.1.1 c
//Bug reproduction code
#ifndef CPPHTTPLIB_OPENSSL_SUPPORT
#define CPPHTTPLIB_OPENSSL_SUPPORT
#endif
#include <httplib.h>
//httplib.h Lead to qt bug
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
My guess, qt internally used the openssl x509.h related code, which caused the problem
---------------------------------------------------------------------------------------------------------------
2019/9/22 UTC+8 13:14
I found a reference to openssl x509 and proved my guess.
https://github.com/qt/qtbase/blob/5.12/src/network/ssl/qsslsocket_openssl_p.h#L94
https://github.com/qt/qtbase/blob/5.15/src/network/ssl/qsslsocket_openssl_p.h#L97
//openssl x509
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/x509_vfy.h>
I think that disabling ssl and recompiling qt can solve the problem. But I haven't verified yet
---------------------------------------------------------------------------------------------------------------
2019/9/23 UTC+8 11:33
I think of a solution:
1, I recompile the qt module myself
2, I myself encapsulate the conflict function into lib or qt lib, through the binary assembly, resolve conflicts
In addition, I think the fact that most c++ ssl will use the openssl library, so I compile a lib myself is the best.
---------------------------------------------------------------------------------------------------------------
2019/9/23 UTC+8 18:12
I found the solution after testing, in the sub-project lib non-header files (*cpp), add openssl code, can be compiled normally. I will soon share the code to reproduce the bug in github, thank you very much.
---------------------------------------------------------------------------------------------------------------
2019/9/23 UTC+8 18:28
https://github.com/HeMinzhang/opensslbug/blob/master/src/makeBug/main.cpp
Sorry, this bug is not a qt bug, I am very sorry.
//
#include <openssl/sha.h>
#include <openssl/aes.h>
#include <openssl/evp.h>
Because of the conflict between the above code and the httplib project
[ openssl isssue|https://github.com/openssl/openssl/issues/9981]