diff options
author | cslashm <cslashm@gmail.com> | 2019-09-25 14:31:14 +0200 |
---|---|---|
committer | cslashm <cslashm@gmail.com> | 2019-10-03 16:01:34 +0200 |
commit | d25acd7a1dbd05b24fba13fc4910886948ab90ba (patch) | |
tree | 41b87143c68535c432a67f233c80c8834f0aed5e /src/device/device_ledger.hpp | |
parent | Merge pull request #5549 (diff) | |
download | monero-d25acd7a1dbd05b24fba13fc4910886948ab90ba.tar.xz |
Add hmac over encrypted value during transaction
Diffstat (limited to 'src/device/device_ledger.hpp')
-rw-r--r-- | src/device/device_ledger.hpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp index 986087128..c2caec3cf 100644 --- a/src/device/device_ledger.hpp +++ b/src/device/device_ledger.hpp @@ -90,6 +90,25 @@ namespace hw { void log(); }; + class SecHMAC { + public: + uint32_t sec[32]; + uint32_t hmac[32]; + + SecHMAC(const uint8_t s[32], const uint8_t m[32]); + + }; + + class HMACmap { + public: + std::vector<SecHMAC> hmacs; + + void find_mac(const uint8_t sec[32], uint8_t hmac[32]) ; + void add_mac(const uint8_t sec[32], const uint8_t hmac[32]) ; + void clear() ; + }; + + #define BUFFER_SEND_SIZE 262 #define BUFFER_RECV_SIZE 262 @@ -115,15 +134,21 @@ namespace hw { int set_command_header(unsigned char ins, unsigned char p1 = 0x00, unsigned char p2 = 0x00); int set_command_header_noopt(unsigned char ins, unsigned char p1 = 0x00, unsigned char p2 = 0x00); void send_simple(unsigned char ins, unsigned char p1 = 0x00); - + void send_secret(const unsigned char sec[32], int &offset); + void receive_secret(unsigned char sec[32], int &offset); // hw running mode device_mode mode; + bool tx_in_progress; + // map public destination key to ephemeral destination key Keymap key_map; bool add_output_key_mapping(const crypto::public_key &Aout, const crypto::public_key &Bout, const bool is_subaddress, const bool is_change, const bool need_additional, const size_t real_output_index, const rct::key &amount_key, const crypto::public_key &out_eph_public_key); + //hmac for some encrypted value + HMACmap hmac_map; + // To speed up blockchain parsing the view key maybe handle here. crypto::secret_key viewkey; bool has_view_key; |