X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fbignum.h;h=9962b78372f5804c6f7dc9e012a966f512bd9c18;hb=3374c3ef094b328e6c6957fdaf5a9abff0c53a33;hp=135eade6792ed77a82532001bdd2952fe9b90a78;hpb=26ce92b3526430d4a40b2faccef4facb966d6a0a;p=novacoin.git diff --git a/src/bignum.h b/src/bignum.h index 135eade..9962b78 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2011 The Bitcoin developers +// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BIGNUM_H @@ -11,6 +11,7 @@ #include "util.h" +/** Errors thrown by the bignum class */ class bignum_error : public std::runtime_error { public: @@ -18,7 +19,7 @@ public: }; - +/** RAII encapsulated BN_CTX (OpenSSL bignum context) */ class CAutoBN_CTX { protected: @@ -46,7 +47,7 @@ public: }; - +/** C++ wrapper for BIGNUM (OpenSSl bignum) */ class CBigNum : public BIGNUM { public: @@ -243,7 +244,7 @@ public: std::vector getvch() const { unsigned int nSize = BN_bn2mpi(this, NULL); - if (nSize < 4) + if (nSize <= 4) return std::vector(); std::vector vch(nSize); BN_bn2mpi(this, &vch[0]); @@ -300,7 +301,7 @@ public: while (isxdigit(*psz)) { *this <<= 4; - int n = phexdigit[*psz++]; + int n = phexdigit[(unsigned char)*psz++]; *this += n; } if (fNegative)