Common/Crypto: Reduce differences between 3.3.5 and 6.x branches

Code functionality shouldn't have been modified.
This commit is contained in:
jackpoz
2016-08-03 23:33:36 +02:00
committed by Aokromes
parent 3c66feafcc
commit 5dcb395e90
5 changed files with 13 additions and 7 deletions

View File

@@ -18,14 +18,14 @@
#include "ARC4.h"
ARC4::ARC4(uint8 len) : m_ctx()
ARC4::ARC4(uint32 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);
}
ARC4::ARC4(uint8 *seed, uint8 len) : m_ctx()
ARC4::ARC4(uint8 *seed, uint32 len) : m_ctx()
{
EVP_CIPHER_CTX_init(&m_ctx);
EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL);

View File

@@ -25,8 +25,8 @@
class ARC4
{
public:
ARC4(uint8 len);
ARC4(uint8 *seed, uint8 len);
ARC4(uint32 len);
ARC4(uint8 *seed, uint32 len);
~ARC4();
void Init(uint8 *seed);
void UpdateData(int len, uint8 *data);

View File

@@ -163,11 +163,16 @@ uint32 BigNumber::AsDword()
return (uint32)BN_get_word(_bn);
}
bool BigNumber::isZero() const
bool BigNumber::IsZero() const
{
return BN_is_zero(_bn);
}
bool BigNumber::IsNegative() const
{
return BN_is_negative(_bn);
}
std::unique_ptr<uint8[]> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
{
int numBytes = GetNumBytes();

View File

@@ -77,7 +77,8 @@ class BigNumber
return t %= bn;
}
bool isZero() const;
bool IsZero() const;
bool IsNegative() const;
BigNumber ModExp(BigNumber const& bn1, BigNumber const& bn2);
BigNumber Exp(BigNumber const&);

View File

@@ -501,7 +501,7 @@ bool AuthSession::HandleLogonProof()
A.SetBinary(logonProof->A, 32);
// SRP safeguard: abort if A == 0
if (A.isZero())
if (A.IsZero())
{
return false;
}