mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
OPENSSL-3 Drop Openssl-1.x support
This commit is contained in:
parent
96d1440672
commit
5e7de4cb5d
@ -64,7 +64,7 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR}/ui")
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
add_compile_definitions(OPENSSL_SUPPRESS_DEPRECATED QT_MESSAGELOGCONTEXT)
|
||||
add_compile_definitions(QT_MESSAGELOGCONTEXT)
|
||||
|
||||
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas)
|
||||
if (ADDRESS_SANITIZER)
|
||||
@ -88,11 +88,6 @@ add_executable(xcaexport ${PROJECT_BINARY_DIR}/local.h)
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
|
||||
if (NOT OPENSSL_VERSION)
|
||||
# Educated guess
|
||||
set(OPENSSL_VERSION 3.0.0)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
execute_process(COMMAND brew --prefix OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE BREW_PREFIX ERROR_QUIET)
|
||||
@ -104,11 +99,6 @@ elseif(WIN32)
|
||||
if (NOT CMAKE_PREFIX_PATH)
|
||||
set(CMAKE_PREFIX_PATH $ENV{UserProfile} $ENV{PROGRAMFILES}/OpenSSL-Win64)
|
||||
endif()
|
||||
if (OPENSSL_VERSION VERSION_GREATER_EQUAL 3.0.0)
|
||||
set(OPENSSL_LIBRARY_MAJOR "3")
|
||||
else()
|
||||
set(OPENSSL_LIBRARY_MAJOR "1_1")
|
||||
endif()
|
||||
file(TO_CMAKE_PATH $ENV{WINDIR}/system32 SYSTEM32)
|
||||
endif()
|
||||
|
||||
@ -298,7 +288,7 @@ elseif(WIN32)
|
||||
${CMAKE_BINARY_DIR}/libstdc++-6.dll
|
||||
${CMAKE_BINARY_DIR}/libwinpthread-1.dll
|
||||
${SYSTEM32}/vcruntime140.dll
|
||||
${OPENSSL_ROOT_DIR}/bin/libcrypto-${OPENSSL_LIBRARY_MAJOR}-x64.dll
|
||||
${OPENSSL_ROOT_DIR}/bin/libcrypto-3-x64.dll
|
||||
DESTINATION ${RUNTIME_DEST}
|
||||
)
|
||||
install(CODE "execute_process(COMMAND cmake -E chdir \${CMAKE_INSTALL_PREFIX} tar cvf ${RUNTIME_DEST}.zip --format=zip -- ${RUNTIME_DEST})")
|
||||
|
||||
@ -19,7 +19,7 @@ builtin_curves.h pki_temp.h
|
||||
database_model.cpp oid.cpp pki_x509.cpp
|
||||
database_model.h oid.h pki_x509.h
|
||||
db_base.cpp opensc-pkcs11.h pki_x509req.cpp
|
||||
db_base.h openssl_compat.h pki_x509req.h
|
||||
db_base.h pki_x509req.h
|
||||
db_crl.cpp pass_info.cpp pki_x509super.cpp
|
||||
db_crl.h pass_info.h pki_x509super.h
|
||||
db_key.cpp pk11_attribute.cpp settings.cpp
|
||||
|
||||
20
lib/main.cpp
20
lib/main.cpp
@ -25,9 +25,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
#include <openssl/ui.h>
|
||||
|
||||
#include <QTextStream>
|
||||
@ -118,25 +116,23 @@ int main(int argc, char *argv[])
|
||||
is_gui_app = true;
|
||||
}
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
{
|
||||
QString path;
|
||||
QString path;
|
||||
#if defined(Q_OS_WIN32)
|
||||
path = QCoreApplication::applicationDirPath();
|
||||
path = QCoreApplication::applicationDirPath();
|
||||
#elif defined(Q_OS_MACOS)
|
||||
path = QCoreApplication::applicationDirPath() + "/../PlugIns";
|
||||
path = QCoreApplication::applicationDirPath() + "/../PlugIns";
|
||||
#endif
|
||||
if (!path.isEmpty()) {
|
||||
OSSL_PROVIDER_set_default_search_path(NULL, path.toUtf8().data());
|
||||
qDebug() << "OSSL_PROVIDER_set_default_search_path" << path;
|
||||
}
|
||||
if (!path.isEmpty()) {
|
||||
OSSL_PROVIDER_set_default_search_path(NULL, path.toUtf8().data());
|
||||
qDebug() << "OSSL_PROVIDER_set_default_search_path" << path;
|
||||
}
|
||||
|
||||
MainWindow::legacy_loaded = OSSL_PROVIDER_try_load(0, "legacy", 1);
|
||||
if (MainWindow::legacy_loaded)
|
||||
qDebug() << "Legacy provider loaded";
|
||||
else
|
||||
qWarning() << "Legacy provider NOT loaded";
|
||||
#endif
|
||||
|
||||
QSharedPointer<UI_METHOD> uimeth(
|
||||
UI_create_method("xca-method"), UI_destroy_method);
|
||||
UI_method_set_writer(uimeth.data(), uiwriter);
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
/* vi: set sw=4 ts=4:
|
||||
*
|
||||
* Copyright (C) 2017 Christian Hohnstaedt.
|
||||
*
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/* This header equalizes a lot of OpenSSL 1.1.0 vs. 1.1.1
|
||||
API clashes by defining some macros if OpenSSL < 1.1.1
|
||||
is used. This way the code is written with the new API
|
||||
and have much less #ifdefs
|
||||
*/
|
||||
|
||||
#ifndef __OPENSS_COMPAT_XCA_H
|
||||
#define __OPENSS_COMPAT_XCA_H
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10101000L
|
||||
|
||||
static inline int
|
||||
EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret,
|
||||
size_t *siglen, const unsigned char *tbs, size_t tbslen)
|
||||
{
|
||||
return EVP_DigestSignUpdate(ctx, tbs, tbslen) &&
|
||||
EVP_DigestSignFinal(ctx, sigret, siglen);
|
||||
}
|
||||
|
||||
static inline int
|
||||
EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret,
|
||||
size_t siglen, const unsigned char *tbs, size_t tbslen)
|
||||
{
|
||||
return EVP_DigestVerifyUpdate(ctx, tbs, tbslen) &&
|
||||
EVP_DigestVerifyFinal(ctx, (unsigned char *)sigret, siglen);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -661,11 +661,7 @@ static int eng_finish(ENGINE *e)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
static int eng_pmeth_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
|
||||
#else
|
||||
static int eng_pmeth_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
|
||||
#endif
|
||||
{
|
||||
void *p = EVP_PKEY_CTX_get_app_data((EVP_PKEY_CTX *)src);
|
||||
EVP_PKEY_CTX_set_app_data(dst, p);
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
#include "entropy.h"
|
||||
#include "BioByteArray.h"
|
||||
#include "XcaProgress.h"
|
||||
#include "openssl_compat.h"
|
||||
|
||||
#include "PwDialogCore.h"
|
||||
#include "XcaWarningCore.h"
|
||||
@ -23,9 +22,7 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/err.h>
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
#include <openssl/proverr.h>
|
||||
#endif
|
||||
|
||||
Passwd pki_evp::passwd;
|
||||
|
||||
@ -225,9 +222,7 @@ bool pki_evp::openssl_pw_error() const
|
||||
case ERR_PACK(ERR_LIB_PEM, 0, PEM_R_BAD_DECRYPT):
|
||||
case ERR_PACK(ERR_LIB_PEM, 0, PEM_R_BAD_PASSWORD_READ):
|
||||
case ERR_PACK(ERR_LIB_EVP, 0, EVP_R_BAD_DECRYPT):
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
case ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BAD_DECRYPT):
|
||||
#endif
|
||||
case ERR_PACK(ERR_LIB_PKCS12, 0, PKCS12_R_PKCS12_CIPHERFINAL_ERROR):
|
||||
pki_ign_openssl_error();
|
||||
return true;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<Fragment>
|
||||
<DirectoryRef Id="INSTALLDIR">
|
||||
<Component Id="Clibcrypto11x64" Guid="44133d17-96b5-4aee-8a24-9c722482add5">
|
||||
<File Id="libcrypto11x64.dll" Source="@OPENSSL_ROOT_DIR@/bin/libcrypto-@OPENSSL_LIBRARY_MAJOR@-x64.dll" KeyPath="yes"/>
|
||||
<File Id="libcrypto11x64.dll" Source="@OPENSSL_ROOT_DIR@/bin/libcrypto-3-x64.dll" KeyPath="yes"/>
|
||||
</Component>
|
||||
<Component Id="Cvcruntime140" Guid="f0b03b2a-14f7-4631-bfe3-d4c6c9b57e1d">
|
||||
<File Id="vcruntime140.dll" Source="@SYSTEM32@/vcruntime140.dll" KeyPath="yes"/>
|
||||
|
||||
@ -9,11 +9,7 @@
|
||||
#include <QFile>
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
#include <openssl/provider.h>
|
||||
#else
|
||||
#define OSSL_PROVIDER_try_load(a,b,c) do{}while(0)
|
||||
#endif
|
||||
|
||||
#include "widgets/MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user