aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Cryptography/BigNumber.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/Cryptography/BigNumber.cpp b/src/common/Cryptography/BigNumber.cpp
index fd14c117e33..96f9144181e 100644
--- a/src/common/Cryptography/BigNumber.cpp
+++ b/src/common/Cryptography/BigNumber.cpp
@@ -184,11 +184,11 @@ std::unique_ptr<uint8[]> BigNumber::AsByteArray(int32 minSize, bool littleEndian
if (length > numBytes)
memset((void*)array, 0, length);
- BN_bn2bin(_bn, (unsigned char *)array);
+ BN_bn2bin(_bn, array + (length-numBytes));
// openssl's BN stores data internally in big endian format, reverse if little endian desired
if (littleEndian)
- std::reverse(array, array + numBytes);
+ std::reverse(array, array + length);
std::unique_ptr<uint8[]> ret(array);
return ret;