Commit graph

36 commits

Author SHA1 Message Date
Jason Rhinelander 13409ad00e
run clang format 2023-04-13 17:15:12 -03:00
Thomas Winget 1311a20e9f merge dev branch with RPC/wallet3 changes
Incomplete, many things to fix, some annotated with
a comment MERGEFIX
2022-07-11 20:40:50 -04:00
Thomas Winget ecb62e8fab Wallet3 squashed initial commit
tx scanning for basic transactions working
  - TODO: subadresses.  The scanning code is there, but it does not
  currently know/care about any subaddresses.

daemon comms for basic syncing working

(multi-)wallet sync more or less working properly
  - seem to have a dangling shared_ptr somewhere when removing a wallet from
  daemon comms, so not working perfectly yet.

Lots of TODOs and cleanup needed, as well as further features of course.
2021-11-30 16:31:54 -05:00
Jason Rhinelander b8ecb6724c device: C++ cleanups and modernization
- Clean up a bunch of not very nice C and older C++ code in the
`device/` tree.

- Rename device/device_io_* source files to io_*, and remove their `_io`
suffix from the class names (since they are *already* inside an `io`
namespace).
2021-11-04 01:35:44 -03:00
Sean Darcy 8023b59867 rebrand lns -> ons 2021-04-12 10:27:57 +10:00
Jason Rhinelander 438f403c01 Don't invoke cryptonote_core functions from device code
We can't call cryptonote::add_tx_secret_key_to_tx_extra from `device`
code because that isn't necessarily available in `device` (though for
some odd reason this only actually showed up on the i386 build).

This amends the call to just get the secret key, leaving the actual job
of adding it to tx.extra to the caller (which is a cleaner way to do it
anyway).
2020-12-14 11:51:29 -04:00
Jason Rhinelander 46b25d5ef4 Move LNS signature generation into device code
Includes Ledger implementation.
2020-12-06 23:21:24 -04:00
Jason Rhinelander 4104244576 Fix extracted txversion/txtype 2020-12-06 23:19:20 -04:00
Jason Rhinelander 07aad36120 Ledger: Add stake unlock signature support 2020-12-06 23:17:07 -04:00
Jason Rhinelander ff26b83b45 Add tx secret key via device layer
We add the tx secret key to the tx_extra in staking transactions so that
values can be decoded, but the tx secret key value that we have on hand
is encrypted and so we can't access it.

This moves the call that adds the secret key into the device code so
that devices can provide this.  It also adds the tx version/type earlier
in the process (into `open_tx`) so that the device can know early on
that this is a stake transaction and therefore that leaking the tx
secret key is okay (and can also apply other stake-specific behaviour).
2020-12-04 11:56:46 -04:00
Jason Rhinelander 052d012745 Move key image signature generation into device
We don't have access to output private keys, so without this we can't
generate staking transactions.
2020-12-04 11:54:33 -04:00
Jason Rhinelander 540d097810 Improve crappy ledger C++ code
Fixes lots of crappy C++ code.  I strongly get the impression from these
changes that whoever wrote this code was a C programmer with very little
C++ experience.  Sadly no one in the upstream Monero PR review tried to
help or seemed to care about the code quality.

- Get rid of superfluous `this->` throughout the ledger code.
- DRY: abstract away sending sequences of bytes, replacing:
    memmove(buffer, this->buffer_send+offset, 32);
    offset += 32
  with:
    send_bytes(buffer, 32, offset);
- DRY: abstract sending/receiving u32
- DRY: abstract receiving bytes/u32
- properly prefix memcpy/memmove with std::
- use std::string_view and std::string for setting/retrieving name
- rename `this->controle_device` to `debug_device`
- replace `f(void)` -> `f()` (on C++ methods, FFS!)
- DRY: replace set-length-then-exchange dance with a function
- DRY: merge nearly-identical exchange() and exchange_wait_for_input()
- remove never-used ok/mask arguments from exchange()
- Remove ASSERT_SW macro used only in one place
- Replace dumb ASSERT_X macro that was just an alias for another macro
- remove ASSERT_T0 macro that isn't used anywhere
2020-11-30 00:47:12 -04:00
Jason Rhinelander 4a9767ead3 Reformat length function signatures
Function signatures (especially in headers) should be readable!

Also removes useless "const" on pass-by-value parameters from headers,
and pass the bool argument by value instead of by const lvalue
reference.
2020-11-30 00:47:12 -04:00
Jason Rhinelander d39afe00ea Remove mlsag generation
The blockchain doesn't accept MLSAG txes anymore (since HF16 + 10
blocks), so there is no need to keep the generation code around.

Also renames mlsag_prehash to clsag_prehash since that is where it is
primarily used now.
2020-11-30 00:47:12 -04:00
Sarang Noether 534346656a CLSAG device support 2020-09-16 20:43:12 -03:00
Jason Rhinelander 96354a0e0f boost::optional -> std::optional 2020-07-02 12:52:12 -03:00
Doyle a5e21b3c24 Merge commit '688a3e87e712123d182ae6715610c461988f9e74' into MergeUpstream3 2020-05-29 10:50:19 +10:00
cslashm 688a3e87e7 Add timelock verification on device 2020-04-08 11:12:32 +02:00
Doyle 9d1df98f37 Merge commit '4308a2e' into LokiMergeUpstream 2019-04-12 18:00:11 +10:00
Doyle 892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10:00
cslashm 7c44091541 Add get_tx_proof support, needed for new sanity check
Enhance debug info
2019-03-28 18:26:15 +01:00
cslashm 98fdcb2aa5 Add support for V11 protocol with BulletProofV2 and short amount.
New scheme key destination contrfol
Fix dummy decryption in debug mode
2019-03-28 18:26:15 +01:00
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
cslashm d0e0e89651 New scheme key destination contrfol
Implies protocol version management.
2019-02-20 17:09:16 +11:00
cslashm 460da140ec New scheme key destination contrfol
Implies protocol version management.
2019-02-08 17:02:44 +01:00
moneromooo-monero 99d946e619
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
2019-01-22 23:17:31 +00:00
moneromooo-monero 4d0a8db06d
device: fix warnings about overridden functions 2018-09-21 19:33:15 +00:00
m2049r bce474be7d
query backing device 2018-09-19 18:25:38 +02:00
stoffu bcab579864
wallet: allow adjusting number of rounds for the key derivation function 2018-08-08 01:56:54 +09:00
moneromooo-monero f914df8494
device: add a one off override keyword where appropriate 2018-04-14 10:59:38 +01:00
cslashm 2c274e05fe Fix sub-address tx scan.
When additional keys was needed, the TX scan failed because the
derivation data was always recomputed with the main tx_key and not
the corresponding additional one.

Moreover this patch avoid perf decreasing when not using HW device.
2018-04-12 13:58:57 +02:00
cslashm c77d2bfaa0 Add the possibility to export private view key for fast scan.
On client startup the device asks for authorization to export the private view key.
If user agree, the client hold the private view key allowing a fast blockchain scan.
If the user does not agree, the blockchain scan is fully done via the device.
2018-03-31 18:00:33 +02:00
cslashm 100b7bc10d Change mutex lock model to avoid dead lock and ensure locks are always released.
Additional cosmetic fixes:
 move 'name' as protected
 remove unnecessary local var
 Fix debug log
2018-03-31 18:00:33 +02:00
stoffu c9b38b4765
device: made function prototypes consistent with pre-#3303 codebase 2018-03-14 21:00:06 +09:00
Cédric 73dd883d51 Ledger HW Bug fixes
Fix the way the REAL mode is handle:
  Let create_transactions_2 and create_transactions_from construct the vector of transactions.
  Then iterate on it and resign.
  We just need to add 'outs' list in the TX struct for that.

Fix default secret keys value when DEBUG_HWDEVICE mode is off
  The magic value (00...00 for view key and FF..FF for spend key) was not correctly set
  when DEBUG_HWDEVICE was off. Both was set to 00...00.

Add sub-address info in ABP map in order to correctly display destination sub-address on device

Fix DEBUG_HWDEVICE mode:
   - Fix compilation errors.
   - Fix control device init in ledger device.
   - Add more log.

Fix sub addr control

Fix debug Info
2018-03-12 10:43:06 +01:00
cslashm e745c1e38d 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.
2018-03-04 12:54:53 +01:00