aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-06 19:49:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-02-12 12:16:45 +0000
commit6ba3a116377ffdf03e0c3580ef5a0c7c6743f69f (patch)
tree1202fb01fad655c724be61964570e6259f30918a /src/device
parentringct: save 3 bytes on bulletproof size (diff)
downloadmonero-6ba3a116377ffdf03e0c3580ef5a0c7c6743f69f.tar.xz
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
Diffstat (limited to '')
-rw-r--r--src/device/device.hpp4
-rw-r--r--src/device/device_default.cpp8
-rw-r--r--src/device/device_default.hpp4
-rw-r--r--src/device/device_ledger.cpp8
-rw-r--r--src/device/device_ledger.hpp4
5 files changed, 14 insertions, 14 deletions
diff --git a/src/device/device.hpp b/src/device/device.hpp
index cb9117650..b619a952b 100644
--- a/src/device/device.hpp
+++ b/src/device/device.hpp
@@ -188,8 +188,8 @@ namespace hw {
return encrypt_payment_id(payment_id, public_key, secret_key);
}
- virtual bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) = 0;
- virtual bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) = 0;
+ virtual bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec, bool short_amount) = 0;
+ virtual bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec, bool short_amount) = 0;
virtual bool add_output_key_mapping(const crypto::public_key &Aout, const crypto::public_key &Bout, const bool is_subaddress, const size_t real_output_index,
const rct::key &amount_key, const crypto::public_key &out_eph_public_key) = 0;
diff --git a/src/device/device_default.cpp b/src/device/device_default.cpp
index a4f40e041..0234d7b38 100644
--- a/src/device/device_default.cpp
+++ b/src/device/device_default.cpp
@@ -302,13 +302,13 @@ namespace hw {
return true;
}
- bool device_default::ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) {
- rct::ecdhEncode(unmasked, sharedSec);
+ bool device_default::ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec, bool short_amount) {
+ rct::ecdhEncode(unmasked, sharedSec, short_amount);
return true;
}
- bool device_default::ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) {
- rct::ecdhDecode(masked, sharedSec);
+ bool device_default::ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec, bool short_amount) {
+ rct::ecdhDecode(masked, sharedSec, short_amount);
return true;
}
diff --git a/src/device/device_default.hpp b/src/device/device_default.hpp
index 5c59a9066..54d159b11 100644
--- a/src/device/device_default.hpp
+++ b/src/device/device_default.hpp
@@ -111,8 +111,8 @@ namespace hw {
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) override;
- bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
- bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
+ bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec, bool short_amount) override;
+ bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec, bool short_amount) override;
bool add_output_key_mapping(const crypto::public_key &Aout, const crypto::public_key &Bout, const bool is_subaddress, const size_t real_output_index,
const rct::key &amount_key, const crypto::public_key &out_eph_public_key) override;
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index a17784960..8acc42bf9 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -1142,13 +1142,13 @@ namespace hw {
return true;
}
- bool device_ledger::ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & AKout) {
+ bool device_ledger::ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & AKout, bool short_amount) {
AUTO_LOCK_CMD();
#ifdef DEBUG_HWDEVICE
const rct::key AKout_x = hw::ledger::decrypt(AKout);
rct::ecdhTuple unmasked_x = unmasked;
- this->controle_device->ecdhEncode(unmasked_x, AKout_x);
+ this->controle_device->ecdhEncode(unmasked_x, AKout_x, short_amount);
#endif
int offset = set_command_header_noopt(INS_BLIND);
@@ -1179,13 +1179,13 @@ namespace hw {
return true;
}
- bool device_ledger::ecdhDecode(rct::ecdhTuple & masked, const rct::key & AKout) {
+ bool device_ledger::ecdhDecode(rct::ecdhTuple & masked, const rct::key & AKout, bool short_amount) {
AUTO_LOCK_CMD();
#ifdef DEBUG_HWDEVICE
const rct::key AKout_x = hw::ledger::decrypt(AKout);
rct::ecdhTuple masked_x = masked;
- this->controle_device->ecdhDecode(masked_x, AKout_x);
+ this->controle_device->ecdhDecode(masked_x, AKout_x, short_amount);
#endif
int offset = set_command_header_noopt(INS_UNBLIND);
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index dde69fbfd..505fa5ffa 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -190,8 +190,8 @@ namespace hw {
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) override;
- bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
- bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
+ bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec, bool short_format) override;
+ bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec, bool short_format) override;
bool add_output_key_mapping(const crypto::public_key &Aout, const crypto::public_key &Bout, const bool is_subaddress, const size_t real_output_index,
const rct::key &amount_key, const crypto::public_key &out_eph_public_key) override;