mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
Implement OpenSSL 1.1.x support
This commit is contained in:
parent
bad84c407e
commit
738f332015
9 changed files with 68 additions and 50 deletions
|
|
@ -27,32 +27,32 @@
|
|||
|
||||
ARC4::ARC4(uint8 len) : m_ctx()
|
||||
{
|
||||
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);
|
||||
m_ctx = EVP_CIPHER_CTX_new();
|
||||
EVP_EncryptInit_ex(m_ctx, EVP_rc4(), NULL, NULL, NULL);
|
||||
EVP_CIPHER_CTX_set_key_length(m_ctx, len);
|
||||
}
|
||||
|
||||
ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx()
|
||||
{
|
||||
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);
|
||||
m_ctx = EVP_CIPHER_CTX_new();
|
||||
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);
|
||||
}
|
||||
|
||||
ARC4::~ARC4()
|
||||
{
|
||||
EVP_CIPHER_CTX_cleanup(&m_ctx);
|
||||
EVP_CIPHER_CTX_free(m_ctx);
|
||||
}
|
||||
|
||||
void ARC4::Init(uint8 *seed)
|
||||
{
|
||||
EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL);
|
||||
EVP_EncryptInit_ex(m_ctx, NULL, NULL, seed, NULL);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue