35 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
36 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "device"
38 void buffer_to_str(
char *to_buff,
size_t to_len,
const char *buff,
size_t len) {
40 for (
size_t i=0; i<len; i++) {
41 sprintf(to_buff+2*i,
"%.02x", (
unsigned char)buff[i]);
45 void log_hexbuffer(
const std::string &msg,
const char* buff,
size_t len) {
48 MDEBUG(msg<<
": " << logstr);
56 #ifdef WITH_DEVICE_LEDGER
59 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
60 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "device.ledger"
68 void decrypt(
char*
buf,
size_t len) {
69 #if defined(IODUMMYCRYPT_HWDEVICE) || defined(IONOCRYPT_HWDEVICE)
73 for (i = 0; i<32; i++) {
74 if (
buf[i] != 0)
break;
77 memmove(
buf, hw::ledger::dbg_viewkey.data, 32);
81 for (i = 0; i<32; i++) {
82 if (
buf[i] != (
char)0xff)
break;
85 memmove(
buf, hw::ledger::dbg_spendkey.data, 32);
89 #if defined(IODUMMYCRYPT_HWDEVICE)
91 for (i = 0; i<len;i++) {
104 cryptonote::account_keys
decrypt(
const cryptonote::account_keys& keys) {
105 cryptonote::account_keys x = keys;
118 rct::key
decrypt(
const rct::key &sec) {
132 x.reserve(keys.size());
133 for (
unsigned int j = 0; j<keys.size(); j++) {
139 static void check(
const std::string &msg,
const std::string &
info,
const char *h,
const char *d,
size_t len,
bool crypted) {
150 if (memcmp(h,dd,len)) {
157 log_message(
"ASSERT EQ OK", msg +
": "+
info +
": "+ std::string(logstr) );
161 void check32(
const std::string &msg,
const std::string &
info,
const char *h,
const char *d,
bool crypted) {
162 check(msg,
info, h, d, 32, crypted);
165 void check8(
const std::string &msg,
const std::string &
info,
const char *h,
const char *d,
bool crypted) {
166 check(msg,
info, h, d, 8, crypted);
void * memmove(void *a, const void *b, size_t c)
#define CHECK_AND_ASSERT_THROW_MES(expr, message)
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
void decrypt(const void *ciphertext, size_t length, const uint8_t *key, const uint8_t *iv, char *plaintext, size_t *plaintext_len)
void log_hexbuffer(const std::string &msg, const char *buff, size_t len)
void log_message(const std::string &msg, const std::string &info)
void buffer_to_str(char *to_buff, size_t to_len, const char *buff, size_t len)
crypto::secret_key m_view_secret_key
crypto::secret_key m_spend_secret_key