aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-04-12 11:15:27 +0200
committerRiccardo Spagni <ric@spagni.net>2018-04-12 11:15:27 +0200
commit3a9290ba6f9093ba60cbbcf918d06a49bf6b6fe1 (patch)
treedad02f4b7b8d20e31af62875270306025a6f42b3 /src
parentMerge pull request #3502 (diff)
parentdevice: fix endianess dependence on subaddress secret key generation (diff)
downloadmonero-3a9290ba6f9093ba60cbbcf918d06a49bf6b6fe1.tar.xz
Merge pull request #3511
0beb94f3 device: fix endianess dependence on subaddress secret key generation (moneromooo-monero)
Diffstat (limited to '')
-rw-r--r--src/device/device_default.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/device/device_default.cpp b/src/device/device_default.cpp
index 96838a289..56bd1e164 100644
--- a/src/device/device_default.cpp
+++ b/src/device/device_default.cpp
@@ -31,6 +31,7 @@
#include "device_default.hpp"
+#include "common/int-util.h"
#include "cryptonote_basic/account.h"
#include "cryptonote_basic/subaddress_index.h"
#include "ringct/rctOps.h"
@@ -195,10 +196,13 @@ namespace hw {
crypto::secret_key device_default::get_subaddress_secret_key(const crypto::secret_key &a, const cryptonote::subaddress_index &index) {
const char prefix[] = "SubAddr";
- char data[sizeof(prefix) + sizeof(crypto::secret_key) + sizeof(cryptonote::subaddress_index)];
+ char data[sizeof(prefix) + sizeof(crypto::secret_key) + 2 * sizeof(uint32_t)];
memcpy(data, prefix, sizeof(prefix));
memcpy(data + sizeof(prefix), &a, sizeof(crypto::secret_key));
- memcpy(data + sizeof(prefix) + sizeof(crypto::secret_key), &index, sizeof(cryptonote::subaddress_index));
+ uint32_t idx = SWAP32LE(index.major);
+ memcpy(data + sizeof(prefix) + sizeof(crypto::secret_key), &idx, sizeof(uint32_t));
+ idx = SWAP32LE(index.minor);
+ memcpy(data + sizeof(prefix) + sizeof(crypto::secret_key) + sizeof(uint32_t), &idx, sizeof(uint32_t));
crypto::secret_key m;
crypto::hash_to_scalar(data, sizeof(data), m);
return m;