mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Crypto: Fixed loading legacy openssl provider for RC4 on windows
This commit is contained in:
@@ -18,24 +18,16 @@
|
||||
#include "ARC4.h"
|
||||
#include "Errors.h"
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/provider.h>
|
||||
#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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user