|
| 1 | +/******************************************************************************* |
| 2 | + * (c) 2018 - 2025 Zondax AG |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + ********************************************************************************/ |
| 16 | +#include "bech32.h" |
| 17 | +#include "crypto_helper.h" |
| 18 | +#include "parser_impl.h" |
| 19 | +#include "zxformat.h" |
| 20 | + |
| 21 | +// void print_buffer(bytes_t *buffer, const char *title) { |
| 22 | +// #if defined(LEDGER_SPECIFIC) |
| 23 | +// ZEMU_LOGF(50, "%s\n", title); |
| 24 | +// char print[1000] = {0}; |
| 25 | +// array_to_hexstr(print, sizeof(print), buffer->ptr, buffer->len); |
| 26 | +// ZEMU_LOGF(1000, "%s\n", print); |
| 27 | +// #else |
| 28 | +// printf("%s %d: ", title, buffer->len); |
| 29 | +// for (uint16_t i = 0; i < buffer->len; i++) { |
| 30 | +// printf("%02x", buffer->ptr[i]); |
| 31 | +// } |
| 32 | +// printf("\n"); |
| 33 | +// #endif |
| 34 | +// } |
| 35 | + |
| 36 | +// void print_buffer_u8(bytes_t *buffer, const char *title) { |
| 37 | +// #if defined(LEDGER_SPECIFIC) |
| 38 | +// ZEMU_LOGF(50, "%s\n", title); |
| 39 | +// char print[1000] = {0}; |
| 40 | +// array_to_hexstr(print, sizeof(print), buffer->ptr, buffer->len); |
| 41 | +// ZEMU_LOGF(1000, "%s\n", print); |
| 42 | +// #else |
| 43 | +// printf("%s %d: [", title, buffer->len); |
| 44 | +// for (uint16_t i = 0; i < buffer->len; i++) { |
| 45 | +// printf("%d, ", buffer->ptr[i]); |
| 46 | +// } |
| 47 | +// printf("]\n"); |
| 48 | +// #endif |
| 49 | +// } |
| 50 | + |
| 51 | +// void print_buffer_str(bytes_t *buffer, const char *title) { |
| 52 | +// #if defined(LEDGER_SPECIFIC) |
| 53 | +// ZEMU_LOGF(50, "%s\n", title); |
| 54 | +// char print[1000] = {0}; |
| 55 | +// array_to_hexstr(print, sizeof(print), buffer->ptr, buffer->len); |
| 56 | +// ZEMU_LOGF(1000, "%s\n", print); |
| 57 | +// #else |
| 58 | +// uint8_t buff[1000] = {0}; |
| 59 | +// memcpy(buff, buffer->ptr, buffer->len); |
| 60 | +// printf("%s %s\n", title, buff); |
| 61 | +// #endif |
| 62 | +// } |
| 63 | + |
| 64 | +void print_string(const char *str) { |
| 65 | +#if defined(LEDGER_SPECIFIC) |
| 66 | + char print[1000] = {0}; |
| 67 | + MEMCPY(print, str, strlen(str)); |
| 68 | + ZEMU_LOGF(100, "%s\n", str); |
| 69 | +#else |
| 70 | + printf("%s\n", str); |
| 71 | +#endif |
| 72 | +} |
| 73 | + |
| 74 | +// void print_string_title(const char *str, const char *title) { |
| 75 | +// #if defined(LEDGER_SPECIFIC) |
| 76 | +// ZEMU_LOGF(100, "%s: %s\n", title, str); |
| 77 | +// #else |
| 78 | +// printf("%s: %s\n", title, str); |
| 79 | +// #endif |
| 80 | +// } |
| 81 | + |
| 82 | +// void print_u8(const char *str, uint8_t val) { |
| 83 | +// #if defined(LEDGER_SPECIFIC) |
| 84 | +// ZEMU_LOGF(100, "%s: %d\n", str, val); |
| 85 | +// #else |
| 86 | +// printf("%s: %d\n", str, val); |
| 87 | +// #endif |
| 88 | +// } |
| 89 | + |
| 90 | +// void print_u16(const char *str, uint16_t val) { |
| 91 | +// #if defined(LEDGER_SPECIFIC) |
| 92 | +// ZEMU_LOGF(100, "%s: %d\n", str, val); |
| 93 | +// #else |
| 94 | +// printf("%s: %d\n", str, val); |
| 95 | +// #endif |
| 96 | +// } |
| 97 | + |
| 98 | +// void print_u32(const char *str, uint32_t val) { |
| 99 | +// #if defined(LEDGER_SPECIFIC) |
| 100 | +// ZEMU_LOGF(100, "%s: %d\n", str, val); |
| 101 | +// #else |
| 102 | +// printf("%s: %u\n", str, val); |
| 103 | +// #endif |
| 104 | +// } |
| 105 | + |
| 106 | +// void print_u64(const char *str, uint64_t val) { |
| 107 | +// #if defined(LEDGER_SPECIFIC) |
| 108 | +// ZEMU_LOGF(100, "%s: %lu\n", str, val); |
| 109 | +// #else |
| 110 | +// printf("%s: %llu\n", str, val); |
| 111 | +// #endif |
| 112 | +// } |
| 113 | + |
| 114 | +// void print_u64_hex(const char *str, uint64_t val) { |
| 115 | +// #if defined(LEDGER_SPECIFIC) |
| 116 | +// ZEMU_LOGF(100, "%s: %lu\n", str, val); |
| 117 | +// #else |
| 118 | +// printf("%s: 0x%llx\n", str, val); |
| 119 | +// #endif |
| 120 | +// } |
0 commit comments