aboutsummaryrefslogtreecommitdiff
path: root/src/device/device_ledger.hpp
diff options
context:
space:
mode:
authorcslashm <cslashm@gmail.com>2018-03-26 12:55:48 +0200
committercslashm <cslashm@gmail.com>2018-03-31 18:00:33 +0200
commitc77d2bfaa0e0390e421b4d337f49451d504f7046 (patch)
treef9ad2766389b0efe78be3ff2dd9f5f65b7ed0f8f /src/device/device_ledger.hpp
parentChange mutex lock model to avoid dead lock and ensure locks are always released. (diff)
downloadmonero-c77d2bfaa0e0390e421b4d337f49451d504f7046.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--src/device/device_ledger.hpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index 2053067bd..652cfb34b 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -32,7 +32,6 @@
#include <cstddef>
#include <string>
-#include <mutex>
#include "device.hpp"
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>
@@ -94,15 +93,21 @@ namespace hw {
DWORD length_recv;
BYTE buffer_recv[BUFFER_RECV_SIZE];
unsigned int id;
-
- Keymap key_map;
-
-
void logCMD(void);
void logRESP(void);
unsigned int exchange(unsigned int ok=0x9000, unsigned int mask=0xFFFF);
void reset_buffer(void);
+ // hw running mode
+ device_mode mode;
+ // map public destination key to ephemeral destination key
+ Keymap key_map;
+
+ // To speed up blockchain parsing the view key maybe handle here.
+ crypto::secret_key viewkey;
+ bool has_view_key;
+
+ //extra debug
#ifdef DEBUG_HWDEVICE
device *controle_device;
#endif
@@ -129,6 +134,7 @@ namespace hw {
bool connect(void) override;
bool disconnect() override;
+ bool set_mode(device_mode mode) override;
/* ======================================================================= */
/* LOCKER */
@@ -175,8 +181,6 @@ namespace hw {
bool open_tx(crypto::secret_key &tx_key) override;
- bool set_signature_mode(unsigned int sig_mode) override;
-
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;
@@ -197,10 +201,9 @@ namespace hw {
};
-
#ifdef DEBUG_HWDEVICE
- extern crypto::secret_key viewkey;
- extern crypto::secret_key spendkey;
+ extern crypto::secret_key dbg_viewkey;
+ extern crypto::secret_key dbg_spendkey;
#endif
#endif //WITH_DEVICE_LEDGER