mirror of
https://github.com/cygnusxi/CurecoinSource.git
synced 2025-07-27 15:44:25 +02:00
Merge pull request #55 from Nuitari/Fix-Bignum-Compile
Fix bignum compile
This commit is contained in:
commit
3ef6a62ee7
23
src/bignum.h
23
src/bignum.h
@ -94,30 +94,15 @@ public:
|
|||||||
CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
||||||
CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
||||||
CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
||||||
// CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
||||||
CBigNum(int64_t n) { init(); setint64(n); }
|
CBigNum(long long n) { init(); setint64(n); }
|
||||||
CBigNum(unsigned char n) { init(); setulong(n); }
|
CBigNum(unsigned char n) { init(); setulong(n); }
|
||||||
CBigNum(unsigned short n) { init(); setulong(n); }
|
CBigNum(unsigned short n) { init(); setulong(n); }
|
||||||
CBigNum(unsigned int n) { init(); setulong(n); }
|
CBigNum(unsigned int n) { init(); setulong(n); }
|
||||||
// CBigNum(unsigned long n) { init(); setulong(n); }
|
CBigNum(unsigned long n) { init(); setulong(n); }
|
||||||
CBigNum(uint64_t n) { init(); setuint64(n); }
|
CBigNum(unsigned long long n) { init(); setuint64(n); }
|
||||||
CBigNum(long long int n) { init(); setuint64(n); }
|
|
||||||
explicit CBigNum(uint256 n) { init(); setuint256(n); }
|
explicit CBigNum(uint256 n) { init(); setuint256(n); }
|
||||||
|
|
||||||
//CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'.
|
|
||||||
/* CBigNum(signed char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
|
||||||
CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
|
||||||
CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
|
||||||
CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
|
||||||
CBigNum(int64 n) { BN_init(this); setint64(n); }
|
|
||||||
CBigNum(unsigned char n) { BN_init(this); setulong(n); }
|
|
||||||
CBigNum(unsigned short n) { BN_init(this); setulong(n); }
|
|
||||||
CBigNum(unsigned int n) { BN_init(this); setulong(n); }
|
|
||||||
CBigNum(unsigned long n) { BN_init(this); setulong(n); }
|
|
||||||
CBigNum(uint64 n) { BN_init(this); setuint64(n); }
|
|
||||||
*/
|
|
||||||
// explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); }
|
|
||||||
|
|
||||||
explicit CBigNum(const std::vector<unsigned char>& vch)
|
explicit CBigNum(const std::vector<unsigned char>& vch)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -60,11 +60,11 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned
|
|||||||
|
|
||||||
bool fOk = true;
|
bool fOk = true;
|
||||||
|
|
||||||
EVP_CIPHER_CTX_init(ctx);
|
ctx = EVP_CIPHER_CTX_new();
|
||||||
if (fOk) fOk = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
|
if (fOk) fOk = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
|
||||||
if (fOk) fOk = EVP_EncryptUpdate(ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen);
|
if (fOk) fOk = EVP_EncryptUpdate(ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen);
|
||||||
if (fOk) fOk = EVP_EncryptFinal_ex(ctx, (&vchCiphertext[0])+nCLen, &nFLen);
|
if (fOk) fOk = EVP_EncryptFinal_ex(ctx, (&vchCiphertext[0])+nCLen, &nFLen);
|
||||||
EVP_CIPHER_CTX_cleanup(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
|
|
||||||
if (!fOk) return false;
|
if (!fOk) return false;
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingM
|
|||||||
|
|
||||||
bool fOk = true;
|
bool fOk = true;
|
||||||
|
|
||||||
EVP_CIPHER_CTX_init(ctx);
|
ctx = EVP_CIPHER_CTX_new();
|
||||||
if (fOk) fOk = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
|
if (fOk) fOk = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
|
||||||
if (fOk) fOk = EVP_DecryptUpdate(ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen);
|
if (fOk) fOk = EVP_DecryptUpdate(ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen);
|
||||||
if (fOk) fOk = EVP_DecryptFinal_ex(ctx, (&vchPlaintext[0])+nPLen, &nFLen);
|
if (fOk) fOk = EVP_DecryptFinal_ex(ctx, (&vchPlaintext[0])+nPLen, &nFLen);
|
||||||
EVP_CIPHER_CTX_cleanup(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
|
|
||||||
if (!fOk) return false;
|
if (!fOk) return false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user