aboutsummaryrefslogtreecommitdiff
path: root/src/common/Cryptography/ARC4.cpp
diff options
context:
space:
mode:
authorWarlockbugs <Warlockbugs@users.noreply.github.com>2018-03-04 17:26:08 +0300
committerShauren <shauren.trinity@gmail.com>2018-03-04 15:26:08 +0100
commit87bd1126ff3a6e8ba83fc01985d20e3436d926be (patch)
treeb19d78acf6407b0afc4151a5e871d1370a1b5f5b /src/common/Cryptography/ARC4.cpp
parent7e643662fda63c92f32cf78323acdbd08732ccea (diff)
Core/Crypto: Transitional Cryptography update for OpenSSL 1.1 (#21534)
Support for both OpenSSL 1.0 LTS and OpenSSL 1.1 versions. Many Linux distributions are still on 1.0 and will stay on LTS for quite some time. Port of CMaNGOS commit: https://github.com/cmangos/mangos-wotlk/commit/e1b0048f052eda46bb27d20224d0339960816ac2
Diffstat (limited to 'src/common/Cryptography/ARC4.cpp')
-rw-r--r--src/common/Cryptography/ARC4.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/common/Cryptography/ARC4.cpp b/src/common/Cryptography/ARC4.cpp
index cc10dc39c9c..a5e77e92646 100644
--- a/src/common/Cryptography/ARC4.cpp
+++ b/src/common/Cryptography/ARC4.cpp
@@ -18,34 +18,34 @@
#include "ARC4.h"
-ARC4::ARC4(uint32 len) : m_ctx()
+ARC4::ARC4(uint32 len) : m_ctx(EVP_CIPHER_CTX_new())
{
- EVP_CIPHER_CTX_init(&m_ctx);
- EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
- EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
+ EVP_CIPHER_CTX_init(m_ctx);
+ EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr);
+ EVP_CIPHER_CTX_set_key_length(m_ctx, len);
}
-ARC4::ARC4(uint8 *seed, uint32 len) : m_ctx()
+ARC4::ARC4(uint8* seed, uint32 len) : m_ctx(EVP_CIPHER_CTX_new())
{
- EVP_CIPHER_CTX_init(&m_ctx);
- EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);
- EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
- EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL);
+ EVP_CIPHER_CTX_init(m_ctx);
+ EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr);
+ EVP_CIPHER_CTX_set_key_length(m_ctx, len);
+ EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr);
}
ARC4::~ARC4()
{
- EVP_CIPHER_CTX_cleanup(&m_ctx);
+ EVP_CIPHER_CTX_free(m_ctx);
}
-void ARC4::Init(uint8 *seed)
+void ARC4::Init(uint8* seed)
{
- EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL);
+ EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr);
}
-void ARC4::UpdateData(int len, uint8 *data)
+void ARC4::UpdateData(int len, uint8* data)
{
int outlen = 0;
- EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
- EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
+ EVP_EncryptUpdate(m_ctx, data, &outlen, data, len);
+ EVP_EncryptFinal_ex(m_ctx, data, &outlen);
}