aboutsummaryrefslogtreecommitdiff
path: root/src/bignum.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-12 12:27:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-12 12:27:01 +0200
commit18cf214528d14692941311be154214cab1772ed5 (patch)
treef3525c858aadbff78832fb9a4198077fbbc27b1f /src/bignum.h
parent0424613ba24de94b58f6fa7bf1627fd4e2807208 (diff)
update bitcoin core to git ce148944c776ae8e91cc058f44ddce356c7cebc9
Diffstat (limited to 'src/bignum.h')
-rw-r--r--src/bignum.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bignum.h b/src/bignum.h
index 5b4c78e7fa..5eaa4028b7 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -228,10 +228,13 @@ public:
{
std::vector<unsigned char> vch2(vch.size() + 4);
unsigned int nSize = vch.size();
+ // BIGNUM's byte stream format expects 4 bytes of
+ // big endian size data info at the front
vch2[0] = (nSize >> 24) & 0xff;
vch2[1] = (nSize >> 16) & 0xff;
vch2[2] = (nSize >> 8) & 0xff;
vch2[3] = (nSize >> 0) & 0xff;
+ // swap data to big endian
reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
BN_mpi2bn(&vch2[0], vch2.size(), this);
}