diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-06-14 23:18:42 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-09-05 18:48:43 +0200 |
commit | 3fa46c6dc10459163aa9d225f27e59cb4cc7d498 (patch) | |
tree | 400bcfb884240cc172c0a78e71cc41d6160251a4 /src/common/Cryptography/ARC4.cpp | |
parent | 13c44517da23d6e1adf2cb9b526d3181516a1cb2 (diff) |
Core/Crypto: Fixed loading legacy openssl provider for RC4 on windows
Diffstat (limited to 'src/common/Cryptography/ARC4.cpp')
-rw-r--r-- | src/common/Cryptography/ARC4.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
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 <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 } |