diff options
author | Winfidonarleyan <dowlandtop@yandex.com> | 2022-11-23 21:12:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-24 01:12:20 +0700 |
commit | a1a1528cb4a9ed6f0220621fe6ecf9e2c36a5534 (patch) | |
tree | 04598163bda650f353cc1e12872c03f94537f700 /src/common/Cryptography/ARC4.cpp | |
parent | 4a2964e10a03a2b6ba2077e6b362b8a6ba6675fb (diff) |
feat(Core/Crypto): add support `OpenSSL 3.0` (#13354)
Diffstat (limited to 'src/common/Cryptography/ARC4.cpp')
-rw-r--r-- | src/common/Cryptography/ARC4.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/Cryptography/ARC4.cpp b/src/common/Cryptography/ARC4.cpp index 4356deae01..90535f7477 100644 --- a/src/common/Cryptography/ARC4.cpp +++ b/src/common/Cryptography/ARC4.cpp @@ -18,17 +18,26 @@ #include "ARC4.h" #include "Errors.h" -Acore::Crypto::ARC4::ARC4() - : _ctx(EVP_CIPHER_CTX_new()) +Acore::Crypto::ARC4::ARC4() : _ctx(EVP_CIPHER_CTX_new()) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + _cipher = EVP_CIPHER_fetch(nullptr, "RC4", nullptr); +#else + EVP_CIPHER const* _cipher = EVP_rc4(); +#endif + EVP_CIPHER_CTX_init(_ctx); - int result = EVP_EncryptInit_ex(_ctx, EVP_rc4(), nullptr, nullptr, nullptr); + int result = EVP_EncryptInit_ex(_ctx, _cipher, nullptr, nullptr, nullptr); ASSERT(result == 1); } Acore::Crypto::ARC4::~ARC4() { EVP_CIPHER_CTX_free(_ctx); + +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + EVP_CIPHER_free(_cipher); +#endif } void Acore::Crypto::ARC4::Init(uint8 const* seed, size_t len) |