From da7a5feaa694f1df9626b4986dc41ae0510d11d1 Mon Sep 17 00:00:00 2001 From: AriDEV Date: Sun, 7 Jan 2024 14:15:06 +0100 Subject: [PATCH] Server/Crypto: Load Provider --- CMakeLists.txt | 2 +- src/server/authserver/Main.cpp | 2 +- src/server/shared/Cryptography/ARC4.cpp | 11 ++++++++++- src/server/worldserver/Main.cpp | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd08e45d22f..e189e29767f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ endif() include(CheckPlatform) -set(OPENSSL_EXPECTED_VERSION 1.1.1) +set(OPENSSL_EXPECTED_VERSION 3.3.0) set(ACE_EXPECTED_VERSION 6.4.5) find_package(PCHSupport) diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index a90fe975f4a..aec583e24d2 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -10,7 +10,7 @@ * This file contains the main program for the * authentication server */ - +#pragma comment (lib, "Crypt32") #include #include #include diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp index b0d4d28bc08..b6c9eb6dd55 100644 --- a/src/server/shared/Cryptography/ARC4.cpp +++ b/src/server/shared/Cryptography/ARC4.cpp @@ -5,16 +5,25 @@ #include "ARC4.h" #include +#include ARC4::ARC4() : m_ctx(EVP_CIPHER_CTX_new()) { +#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && (OPENSSL_VERSION_MINOR >= 3) + OSSL_PROVIDER_load(NULL, "legacy"); +#endif + +#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3) && (OPENSSL_VERSION_MINOR < 3) +#error "UNSUPORTED OPENSSL VERSION, SKYFIRE REQUIRES 3.3 or newer." +#endif + EVP_CIPHER_CTX_reset(m_ctx); EVP_EncryptInit_ex(m_ctx, EVP_rc4(), NULL, NULL, NULL); } ARC4::~ARC4() { - EVP_CIPHER_CTX_reset(m_ctx); + EVP_CIPHER_CTX_free(m_ctx); } void ARC4::Init(uint8* seed, uint32 len) diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index b3e01e43a86..c2a4c647679 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -6,7 +6,7 @@ /// \addtogroup Trinityd Skyfire Daemon /// @{ /// \file - +#pragma comment (lib, "Crypt32") #include #include #include