1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 00:48:19 +00:00

chore(crypto): Move XPUB_MAXLEN and ADDRESS_MAXLEN from modtrezorcrypto to bip32.h.

This commit is contained in:
Andrew Kozlik 2020-10-13 10:50:12 +02:00 committed by Andrew Kozlik
parent c21ca81a1e
commit c67ecb984b
4 changed files with 12 additions and 9 deletions

View File

@ -43,9 +43,6 @@ typedef struct _mp_obj_HDNode_t {
STATIC const mp_obj_type_t mod_trezorcrypto_HDNode_type;
#define XPUB_MAXLEN 112
#define ADDRESS_MAXLEN 39
/// def __init__(
/// self,
/// depth: int,

View File

@ -31,6 +31,12 @@
#include "ed25519-donna/ed25519.h"
#include "options.h"
// Maximum length of a Base58Check-encoded extended public or private key.
#define XPUB_MAXLEN 112
// Maximum length of a Base58Check-encoded address.
#define ADDRESS_MAXLEN 39
typedef struct {
const char *bip32_name; // string for generating BIP32 xprv from seed
const ecdsa_curve *params; // ecdsa curve parameters, null for ed25519

View File

@ -1213,7 +1213,7 @@ END_TEST
START_TEST(test_bip32_vector_1) {
HDNode node, node2, node3;
uint32_t fingerprint;
char str[112];
char str[XPUB_MAXLEN];
int r;
// init m
@ -1473,7 +1473,7 @@ END_TEST
START_TEST(test_bip32_vector_2) {
HDNode node, node2, node3;
uint32_t fingerprint;
char str[112];
char str[XPUB_MAXLEN];
int r;
// init m
@ -1770,7 +1770,7 @@ END_TEST
START_TEST(test_bip32_vector_3) {
HDNode node, node2, node3;
uint32_t fingerprint;
char str[112];
char str[XPUB_MAXLEN];
int r;
// init m
@ -2758,7 +2758,7 @@ END_TEST
START_TEST(test_bip32_decred_vector_1) {
HDNode node, node2, node3;
uint32_t fingerprint;
char str[112];
char str[XPUB_MAXLEN];
int r;
// init m
@ -3028,7 +3028,7 @@ END_TEST
START_TEST(test_bip32_decred_vector_2) {
HDNode node, node2, node3;
uint32_t fingerprint;
char str[112];
char str[XPUB_MAXLEN];
int r;
// init m

View File

@ -262,7 +262,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
default: { // show XPUBs
int index = (screen - 2) / 2;
int page = (screen - 2) % 2;
char xpub[112] = {0};
char xpub[XPUB_MAXLEN] = {0};
const HDNodeType *node_ptr = NULL;
if (multisig->nodes_count) { // use multisig->nodes
node_ptr = &(multisig->nodes[index]);