aboutsummaryrefslogtreecommitdiff
path: root/src/device/device.hpp
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-03-05 14:24:48 +0900
committerstoffu <stoffu@protonmail.ch>2018-03-14 21:00:06 +0900
commitc9b38b4765a7eea11bb57b4fce1694c382c80936 (patch)
tree8e6057e827809809840f0c39467f563a4a9c1167 /src/device/device.hpp
parentMerge pull request #3378 (diff)
downloadmonero-c9b38b4765a7eea11bb57b4fce1694c382c80936.tar.xz
device: made function prototypes consistent with pre-#3303 codebase
Diffstat (limited to '')
-rw-r--r--src/device/device.hpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/device/device.hpp b/src/device/device.hpp
index 614d2c243..1d2181fa3 100644
--- a/src/device/device.hpp
+++ b/src/device/device.hpp
@@ -109,10 +109,10 @@ namespace hw {
/* SUB ADDRESS */
/* ======================================================================= */
virtual bool derive_subaddress_public_key(const crypto::public_key &pub, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_pub) = 0;
- virtual bool get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index, crypto::public_key &D) = 0;
- virtual bool get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) = 0;
- virtual bool get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) = 0;
- virtual bool get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index, crypto::secret_key &sub_sec) = 0;
+ virtual crypto::public_key get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index) = 0;
+ virtual std::vector<crypto::public_key> get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) = 0;
+ virtual cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) = 0;
+ virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) = 0;
/* ======================================================================= */
/* DERIVATION & KEY */
@@ -121,7 +121,7 @@ namespace hw {
virtual bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) = 0;
virtual bool scalarmultBase(rct::key &aG, const rct::key &a) = 0;
virtual bool sc_secret_add( crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) = 0;
- virtual bool generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) = 0;
+ virtual crypto::secret_key generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key = crypto::secret_key(), bool recover = false) = 0;
virtual bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) = 0;
virtual bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) = 0;
virtual bool derive_secret_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::secret_key &sec, crypto::secret_key &derived_sec) = 0;
@@ -129,6 +129,21 @@ namespace hw {
virtual bool secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub) = 0;
virtual bool generate_key_image(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_image &image) = 0;
+ // alternative prototypes available in libringct
+ rct::key scalarmultKey(const rct::key &P, const rct::key &a)
+ {
+ rct::key aP;
+ scalarmultKey(aP, P, a);
+ return aP;
+ }
+
+ rct::key scalarmultBase(const rct::key &a)
+ {
+ rct::key aG;
+ scalarmultBase(aG, a);
+ return aG;
+ }
+
/* ======================================================================= */
/* TRANSACTION */
/* ======================================================================= */
@@ -137,7 +152,12 @@ namespace hw {
virtual bool set_signature_mode(unsigned int sig_mode) = 0;
- virtual bool encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id ) = 0;
+ virtual bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) = 0;
+ bool decrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key)
+ {
+ // Encryption and decryption are the same operation (xor with a key)
+ 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;