Monero
Loading...
Searching...
No Matches
protocol.cpp File Reference
#include "version.h"
#include "protocol.hpp"
#include <unordered_map>
#include <set>
#include <utility>
#include <boost/endian/conversion.hpp>
#include <common/apply_permutation.h>
#include <common/json_util.h>
#include <crypto/hmac-keccak.h>
#include <ringct/rctSigs.h>
#include <ringct/bulletproofs.h>
#include <ringct/bulletproofs_plus.h>
#include "cryptonote_config.h"
#include <sodium.h>
#include <sodium/crypto_verify_32.h>
#include <sodium/crypto_aead_chacha20poly1305.h>
Include dependency graph for protocol.cpp:

Namespaces

namespace  hw
namespace  hw::trezor
namespace  hw::trezor::protocol
namespace  hw::trezor::protocol::crypto
namespace  hw::trezor::protocol::crypto::chacha
namespace  hw::trezor::protocol::ki
namespace  hw::trezor::protocol::tx

Macros

#define GET_FIELD_STRING(name, type, jtype)
#define GET_FIELD_OTHER(name, type, jtype)
#define GET_STRING_FROM_JSON(json, name, type, mandatory, def)
#define GET_FIELD_FROM_JSON(json, name, type, jtype, mandatory, def)
#define GET_FIELD_FROM_JSON_EX(json, name, type, jtype, mandatory, def, VAL)

Functions

std::string hw::trezor::protocol::key_to_string (const ::crypto::ec_point &key)
std::string hw::trezor::protocol::key_to_string (const ::crypto::ec_scalar &key)
std::string hw::trezor::protocol::key_to_string (const ::crypto::hash &key)
std::string hw::trezor::protocol::key_to_string (const ::rct::key &key)
void hw::trezor::protocol::string_to_key (::crypto::ec_scalar &key, const std::string &str)
void hw::trezor::protocol::string_to_key (::crypto::ec_point &key, const std::string &str)
void hw::trezor::protocol::string_to_key (::rct::key &key, const std::string &str)
void hw::trezor::protocol::crypto::chacha::decrypt (const void *ciphertext, size_t length, const uint8_t *key, const uint8_t *iv, char *plaintext, size_t *plaintext_len)
bool hw::trezor::protocol::ki::key_image_data (wallet_shim *wallet, const std::vector< tools::wallet2::transfer_details > &transfers, std::vector< MoneroTransferDetails > &res)
std::string hw::trezor::protocol::ki::compute_hash (const MoneroTransferDetails &rr)
void hw::trezor::protocol::ki::generate_commitment (std::vector< MoneroTransferDetails > &mtds, const std::vector< tools::wallet2::transfer_details > &transfers, std::shared_ptr< messages::monero::MoneroKeyImageExportInitRequest > &req)
void hw::trezor::protocol::ki::live_refresh_ack (const ::crypto::secret_key &view_key_priv, const ::crypto::public_key &out_key, const std::shared_ptr< messages::monero::MoneroLiveRefreshStepAck > &ack, ::cryptonote::keypair &in_ephemeral, ::crypto::key_image &ki)
void hw::trezor::protocol::tx::translate_address (MoneroAccountPublicAddress *dst, const cryptonote::account_public_address *src)
void hw::trezor::protocol::tx::translate_dst_entry (MoneroTransactionDestinationEntry *dst, const cryptonote::tx_destination_entry *src)
void hw::trezor::protocol::tx::translate_klrki (MoneroMultisigKLRki *dst, const rct::multisig_kLRki *src)
void hw::trezor::protocol::tx::translate_rct_key (MoneroRctKey *dst, const rct::ctkey *src)
std::string hw::trezor::protocol::tx::hash_addr (const MoneroAccountPublicAddress *addr, boost::optional< uint64_t > amount, boost::optional< bool > is_subaddr)
std::string hw::trezor::protocol::tx::hash_addr (const std::string &spend_key, const std::string &view_key, boost::optional< uint64_t > amount, boost::optional< bool > is_subaddr)
std::string hw::trezor::protocol::tx::hash_addr (const ::crypto::public_key *spend_key, const ::crypto::public_key *view_key, boost::optional< uint64_t > amount, boost::optional< bool > is_subaddr)
::crypto::secret_key hw::trezor::protocol::tx::compute_enc_key (const ::crypto::secret_key &private_view_key, const std::string &aux, const std::string &salt)
std::string hw::trezor::protocol::tx::compute_sealing_key (const std::string &master_key, size_t idx, bool is_iv)
static unsigned hw::trezor::protocol::tx::get_rsig_type (const rct::RCTConfig &rct_config, size_t num_outputs)
static void hw::trezor::protocol::tx::generate_rsig_batch_sizes (std::vector< uint64_t > &batches, unsigned rsig_type, size_t num_outputs)
void hw::trezor::protocol::tx::load_tx_key_data (hw::device_cold::tx_key_data_t &res, const std::string &data)
std::shared_ptr< messages::monero::MoneroGetTxKeyRequest > hw::trezor::protocol::tx::get_tx_key (const hw::device_cold::tx_key_data_t &tx_data)
void hw::trezor::protocol::tx::get_tx_key_ack (std::vector<::crypto::secret_key > &tx_keys, const std::string &tx_prefix_hash, const ::crypto::secret_key &view_key_priv, std::shared_ptr< const messages::monero::MoneroGetTxKeyAck > ack)

Macro Definition Documentation

◆ GET_FIELD_FROM_JSON

#define GET_FIELD_FROM_JSON ( json,
name,
type,
jtype,
mandatory,
def )
Value:
GET_FIELD_FROM_JSON_EX(json, name, type, jtype, mandatory, def, GET_FIELD_OTHER)
const char * name
Definition options.c:30
#define GET_FIELD_OTHER(name, type, jtype)
Definition protocol.cpp:48
#define GET_FIELD_FROM_JSON_EX(json, name, type, jtype, mandatory, def, VAL)
Definition protocol.cpp:56
rapidjson::Document json
Definition transport.cpp:49

◆ GET_FIELD_FROM_JSON_EX

#define GET_FIELD_FROM_JSON_EX ( json,
name,
type,
jtype,
mandatory,
def,
VAL )
Value:
type field_##name = static_cast<type>(def); \
bool field_##name##_found = false; \
(void)field_##name##_found; \
do if (json.HasMember(#name)) \
{ \
if (json[#name].Is##jtype()) \
{ \
VAL(name, type, jtype); \
field_##name##_found = true; \
} \
else \
{ \
throw std::invalid_argument("Field " #name " found in JSON, but not " #jtype); \
} \
} \
else if (mandatory) \
{ \
throw std::invalid_argument("Field " #name " not found in JSON");\
} while(0)

◆ GET_FIELD_OTHER

#define GET_FIELD_OTHER ( name,
type,
jtype )
Value:
field_##name = static_cast<type>(json[#name].Get##jtype())

◆ GET_FIELD_STRING

#define GET_FIELD_STRING ( name,
type,
jtype )
Value:
field_##name = std::string(json[#name].GetString(), json[#name].GetStringLength())

◆ GET_STRING_FROM_JSON

#define GET_STRING_FROM_JSON ( json,
name,
type,
mandatory,
def )
Value:
Definition gtest-string.h:58
#define GET_FIELD_STRING(name, type, jtype)
Definition protocol.cpp:47