mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
Updated to 9658 client build, SMSG_ADDON_INFO temporary disabled
This commit is contained in:
parent
6aadc16d7d
commit
8f9849969b
19 changed files with 110 additions and 70 deletions
|
|
@ -17,14 +17,40 @@
|
|||
*/
|
||||
|
||||
#include "Auth/SARC4.h"
|
||||
#include "BigNumber.h"
|
||||
#include <openssl/sha.h>
|
||||
|
||||
void SARC4::Init(uint32 len, uint8 *seed)
|
||||
SARC4::SARC4()
|
||||
{
|
||||
RC4_set_key(&m_rc4_key, len, seed);
|
||||
EVP_CIPHER_CTX_init(&m_encryptctx);
|
||||
EVP_EncryptInit_ex(&m_encryptctx, EVP_rc4(), NULL, NULL, NULL);
|
||||
EVP_CIPHER_CTX_set_key_length(&m_encryptctx, SHA_DIGEST_LENGTH);
|
||||
EVP_CIPHER_CTX_init(&m_decryptctx);
|
||||
EVP_DecryptInit_ex(&m_decryptctx, EVP_rc4(), NULL, NULL, NULL);
|
||||
EVP_CIPHER_CTX_set_key_length(&m_decryptctx, SHA_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
void SARC4::Process(uint32 len, uint8 *indata, uint8 *outdata)
|
||||
SARC4::~SARC4()
|
||||
{
|
||||
RC4(&m_rc4_key, len, indata, outdata);
|
||||
EVP_CIPHER_CTX_cleanup(&m_encryptctx);
|
||||
EVP_CIPHER_CTX_cleanup(&m_decryptctx);
|
||||
}
|
||||
|
||||
void SARC4::Init(uint8 *seed1, uint8 *seed2)
|
||||
{
|
||||
EVP_EncryptInit_ex(&m_encryptctx, NULL, NULL, seed1, NULL);
|
||||
EVP_DecryptInit_ex(&m_decryptctx, NULL, NULL, seed2, NULL);
|
||||
}
|
||||
|
||||
void SARC4::Encrypt(uint32 len, uint8 *data)
|
||||
{
|
||||
int outlen = 0;
|
||||
EVP_EncryptUpdate(&m_encryptctx, data, &outlen, data, len);
|
||||
EVP_EncryptFinal_ex(&m_encryptctx, data, &outlen);
|
||||
}
|
||||
|
||||
void SARC4::Decrypt(uint32 len, uint8 *data)
|
||||
{
|
||||
int outlen = 0;
|
||||
EVP_DecryptUpdate(&m_decryptctx, data, &outlen, data, len);
|
||||
EVP_DecryptFinal_ex(&m_decryptctx, data, &outlen);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue