Skip to content

Commit

Permalink
Fix OpenSSL3 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Dec 18, 2022
1 parent 035d30f commit 86552d0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/shared/Auth/SARC4.cpp
Original file line number Diff line number Diff line change
@@ -18,9 +18,15 @@

#include "Auth/SARC4.h"
#include <openssl/sha.h>
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
#include <openssl/provider.h>
#endif

SARC4::SARC4(uint8 len)
{
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
OSSL_PROVIDER_load(NULL, "legacy");
#endif
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
m_ctx = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(m_ctx);
@@ -35,6 +41,9 @@ SARC4::SARC4(uint8 len)

SARC4::SARC4(uint8* seed, uint8 len)
{
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
OSSL_PROVIDER_load(NULL, "legacy");
#endif
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
m_ctx = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(m_ctx);
@@ -61,6 +70,9 @@ SARC4::~SARC4()

void SARC4::Init(uint8 const* seed)
{
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
OSSL_PROVIDER_load(NULL, "legacy");
#endif
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr);
#else

0 comments on commit 86552d0

Please sign in to comment.