From e745c1e38da8e54032660894bb2db0e9a49cccf2 Mon Sep 17 00:00:00 2001 From: cslashm Date: Tue, 20 Feb 2018 17:01:27 +0100 Subject: Code modifications to integrate Ledger HW device into monero-wallet-cli. The basic approach it to delegate all sensitive data (master key, secret ephemeral key, key derivation, ....) and related operations to the device. As device has low memory, it does not keep itself the values (except for view/spend keys) but once computed there are encrypted (with AES are equivalent) and return back to monero-wallet-cli. When they need to be manipulated by the device, they are decrypted on receive. Moreover, using the client for storing the value in encrypted form limits the modification in the client code. Those values are transfered from one C-structure to another one as previously. The code modification has been done with the wishes to be open to any other hardware wallet. To achieve that a C++ class hw::Device has been introduced. Two initial implementations are provided: the "default", which remaps all calls to initial Monero code, and the "Ledger", which delegates all calls to Ledger device. --- tests/performance_tests/generate_key_image_helper.h | 3 ++- tests/performance_tests/is_out_to_acc.h | 2 +- tests/performance_tests/rct_mlsag.h | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/performance_tests') diff --git a/tests/performance_tests/generate_key_image_helper.h b/tests/performance_tests/generate_key_image_helper.h index 869e595fd..ede48b6ca 100644 --- a/tests/performance_tests/generate_key_image_helper.h +++ b/tests/performance_tests/generate_key_image_helper.h @@ -35,6 +35,7 @@ #include "cryptonote_basic/cryptonote_format_utils.h" #include "single_tx_test_base.h" +#include "device/device.hpp" class test_generate_key_image_helper : public single_tx_test_base { @@ -48,6 +49,6 @@ public: std::unordered_map subaddresses; subaddresses[m_bob.get_keys().m_account_address.m_spend_public_key] = {0,0}; crypto::public_key out_key = boost::get(m_tx.vout[0].target).key; - return cryptonote::generate_key_image_helper(m_bob.get_keys(), subaddresses, out_key, m_tx_pub_key, m_additional_tx_pub_keys, 0, in_ephemeral, ki); + return cryptonote::generate_key_image_helper(m_bob.get_keys(), subaddresses, out_key, m_tx_pub_key, m_additional_tx_pub_keys, 0, in_ephemeral, ki, hw::get_device("default")); } }; diff --git a/tests/performance_tests/is_out_to_acc.h b/tests/performance_tests/is_out_to_acc.h index 2aaf00b36..9f81995ac 100644 --- a/tests/performance_tests/is_out_to_acc.h +++ b/tests/performance_tests/is_out_to_acc.h @@ -66,7 +66,7 @@ public: std::unordered_map subaddresses; subaddresses[m_bob.get_keys().m_account_address.m_spend_public_key] = {0,0}; std::vector additional_derivations; - boost::optional info = cryptonote::is_out_to_acc_precomp(subaddresses, tx_out.key, m_derivation, additional_derivations, 0); + boost::optional info = cryptonote::is_out_to_acc_precomp(subaddresses, tx_out.key, m_derivation, additional_derivations, 0, hw::get_device("default")); return (bool)info; } diff --git a/tests/performance_tests/rct_mlsag.h b/tests/performance_tests/rct_mlsag.h index 70fb36aec..888f4b260 100644 --- a/tests/performance_tests/rct_mlsag.h +++ b/tests/performance_tests/rct_mlsag.h @@ -65,7 +65,7 @@ public: { sk[j] = xm[ind][j]; } - IIccss = MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows); + IIccss = MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows, hw::get_device("default")); return true; } @@ -75,7 +75,7 @@ public: if (ver) MLSAG_Ver(rct::identity(), P, IIccss, rows); else - MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows); + MLSAG_Gen(rct::identity(), P, sk, NULL, NULL, ind, rows, hw::get_device("default")); return true; } -- cgit v1.2.3