From 27259f85241cb9a8293fe716c5de439c7921fd91 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 14 Jun 2022 23:18:42 +0200 Subject: Core/Crypto: Fixed loading legacy openssl provider for RC4 on windows --- src/common/Cryptography/ARC4.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/common/Cryptography/ARC4.cpp') diff --git a/src/common/Cryptography/ARC4.cpp b/src/common/Cryptography/ARC4.cpp index faa2265ef71..8f21cd7c6a0 100644 --- a/src/common/Cryptography/ARC4.cpp +++ b/src/common/Cryptography/ARC4.cpp @@ -18,24 +18,16 @@ #include "ARC4.h" #include "Errors.h" -#if OPENSSL_VERSION_NUMBER >= 0x30000000L -#include -#endif - Trinity::Crypto::ARC4::ARC4() : _ctx(EVP_CIPHER_CTX_new()) { - EVP_CIPHER const* cipher; #if OPENSSL_VERSION_NUMBER >= 0x30000000L - _libCtx = OSSL_LIB_CTX_new(); - _legacyProvider = OSSL_PROVIDER_load(_libCtx, "legacy"); - - cipher = EVP_CIPHER_fetch(_libCtx, "RC4", ""); + _cipher = EVP_CIPHER_fetch(nullptr, "RC4", nullptr); #else - cipher = EVP_rc4(); + _cipher = EVP_rc4(); #endif EVP_CIPHER_CTX_init(_ctx); - int result = EVP_EncryptInit_ex(_ctx, cipher, nullptr, nullptr, nullptr); + int result = EVP_EncryptInit_ex(_ctx, _cipher, nullptr, nullptr, nullptr); ASSERT(result == 1); } @@ -44,8 +36,7 @@ Trinity::Crypto::ARC4::~ARC4() EVP_CIPHER_CTX_free(_ctx); #if OPENSSL_VERSION_NUMBER >= 0x30000000L - OSSL_PROVIDER_unload(_legacyProvider); - OSSL_LIB_CTX_free(_libCtx); + EVP_CIPHER_free(_cipher); #endif } -- cgit v1.2.3