mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
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.
This commit is contained in:
parent
421ab3119c
commit
e745c1e38d
53 changed files with 4130 additions and 223 deletions
|
@ -42,7 +42,10 @@ add_executable(cncrypto-tests
|
|||
${crypto_headers})
|
||||
target_link_libraries(cncrypto-tests
|
||||
PRIVATE
|
||||
wallet
|
||||
cryptonote_core
|
||||
common
|
||||
device
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
${EXTRA_LIBRARIES})
|
||||
set_property(TARGET cncrypto-tests
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "crypto-tests.h"
|
||||
|
||||
bool check_scalar(const crypto::ec_scalar &scalar) {
|
||||
return crypto::sc_check(crypto::operator &(scalar)) == 0;
|
||||
return sc_check(crypto::operator &(scalar)) == 0;
|
||||
}
|
||||
|
||||
void random_scalar(crypto::ec_scalar &res) {
|
||||
|
@ -45,13 +45,13 @@ void hash_to_scalar(const void *data, std::size_t length, crypto::ec_scalar &res
|
|||
}
|
||||
|
||||
void hash_to_point(const crypto::hash &h, crypto::ec_point &res) {
|
||||
crypto::ge_p2 point;
|
||||
crypto::ge_fromfe_frombytes_vartime(&point, reinterpret_cast<const unsigned char *>(&h));
|
||||
crypto::ge_tobytes(crypto::operator &(res), &point);
|
||||
ge_p2 point;
|
||||
ge_fromfe_frombytes_vartime(&point, reinterpret_cast<const unsigned char *>(&h));
|
||||
ge_tobytes(crypto::operator &(res), &point);
|
||||
}
|
||||
|
||||
void hash_to_ec(const crypto::public_key &key, crypto::ec_point &res) {
|
||||
crypto::ge_p3 tmp;
|
||||
ge_p3 tmp;
|
||||
crypto::hash_to_ec(key, tmp);
|
||||
crypto::ge_p3_tobytes(crypto::operator &(res), &tmp);
|
||||
ge_p3_tobytes(crypto::operator &(res), &tmp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue