Mercurial > hg > bitcoin
changeset 2880:6efcc24c473b draft
Merge branch '0.5.x' into 0.6.0.x
Conflicts:
src/keystore.cpp
author | Luke Dashjr <luke-jr+git@utopios.org> |
---|---|
date | Thu, 05 Apr 2012 18:22:47 -0400 |
parents | 05111c7d8ff7 (current diff) 44fc2f0d171c (diff) |
children | c5b81cf9ed1f |
files | contrib/gitian-downloader/linux-download-config contrib/gitian-downloader/win32-download-config src/crypter.cpp src/keystore.cpp src/qt/bitcoingui.cpp |
diffstat | 3 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -73,13 +73,15 @@ EVP_CIPHER_CTX ctx; - EVP_CIPHER_CTX_init(&ctx); - EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); + bool fOk = true; - EVP_EncryptUpdate(&ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen); - EVP_EncryptFinal_ex(&ctx, (&vchCiphertext[0])+nCLen, &nFLen); + EVP_CIPHER_CTX_init(&ctx); + 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_EncryptFinal_ex(&ctx, (&vchCiphertext[0])+nCLen, &nFLen); + EVP_CIPHER_CTX_cleanup(&ctx); - EVP_CIPHER_CTX_cleanup(&ctx); + if (!fOk) return false; vchCiphertext.resize(nCLen + nFLen); return true; @@ -98,13 +100,15 @@ EVP_CIPHER_CTX ctx; - EVP_CIPHER_CTX_init(&ctx); - EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); + bool fOk = true; - EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); - EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); + EVP_CIPHER_CTX_init(&ctx); + 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_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); + EVP_CIPHER_CTX_cleanup(&ctx); - EVP_CIPHER_CTX_cleanup(&ctx); + if (!fOk) return false; vchPlaintext.resize(nPLen + nFLen); return true;
--- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -84,6 +84,8 @@ CSecret vchSecret; if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) return false; + if (vchSecret.size() != 32) + return false; CKey key; key.SetPubKey(vchPubKey); key.SetSecret(vchSecret); @@ -146,6 +148,8 @@ CSecret vchSecret; if (!DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) return false; + if (vchSecret.size() != 32) + return false; keyOut.SetPubKey(vchPubKey); keyOut.SetSecret(vchSecret); return true;
--- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -515,7 +515,7 @@ } // Set icon state: spinning if catching up, tick otherwise - if(secs < 30*60) + if(secs < 90*60) { tooltip = tr("Up to date") + QString(".\n") + tooltip; labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));