mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-28 18:38:39 +00:00
chore(crypto): Move XPUB_MAXLEN and ADDRESS_MAXLEN from modtrezorcrypto to bip32.h.
This commit is contained in:
parent
c21ca81a1e
commit
c67ecb984b
@ -43,9 +43,6 @@ typedef struct _mp_obj_HDNode_t {
|
|||||||
|
|
||||||
STATIC const mp_obj_type_t mod_trezorcrypto_HDNode_type;
|
STATIC const mp_obj_type_t mod_trezorcrypto_HDNode_type;
|
||||||
|
|
||||||
#define XPUB_MAXLEN 112
|
|
||||||
#define ADDRESS_MAXLEN 39
|
|
||||||
|
|
||||||
/// def __init__(
|
/// def __init__(
|
||||||
/// self,
|
/// self,
|
||||||
/// depth: int,
|
/// depth: int,
|
||||||
|
@ -31,6 +31,12 @@
|
|||||||
#include "ed25519-donna/ed25519.h"
|
#include "ed25519-donna/ed25519.h"
|
||||||
#include "options.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 {
|
typedef struct {
|
||||||
const char *bip32_name; // string for generating BIP32 xprv from seed
|
const char *bip32_name; // string for generating BIP32 xprv from seed
|
||||||
const ecdsa_curve *params; // ecdsa curve parameters, null for ed25519
|
const ecdsa_curve *params; // ecdsa curve parameters, null for ed25519
|
||||||
|
@ -1213,7 +1213,7 @@ END_TEST
|
|||||||
START_TEST(test_bip32_vector_1) {
|
START_TEST(test_bip32_vector_1) {
|
||||||
HDNode node, node2, node3;
|
HDNode node, node2, node3;
|
||||||
uint32_t fingerprint;
|
uint32_t fingerprint;
|
||||||
char str[112];
|
char str[XPUB_MAXLEN];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// init m
|
// init m
|
||||||
@ -1473,7 +1473,7 @@ END_TEST
|
|||||||
START_TEST(test_bip32_vector_2) {
|
START_TEST(test_bip32_vector_2) {
|
||||||
HDNode node, node2, node3;
|
HDNode node, node2, node3;
|
||||||
uint32_t fingerprint;
|
uint32_t fingerprint;
|
||||||
char str[112];
|
char str[XPUB_MAXLEN];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// init m
|
// init m
|
||||||
@ -1770,7 +1770,7 @@ END_TEST
|
|||||||
START_TEST(test_bip32_vector_3) {
|
START_TEST(test_bip32_vector_3) {
|
||||||
HDNode node, node2, node3;
|
HDNode node, node2, node3;
|
||||||
uint32_t fingerprint;
|
uint32_t fingerprint;
|
||||||
char str[112];
|
char str[XPUB_MAXLEN];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// init m
|
// init m
|
||||||
@ -2758,7 +2758,7 @@ END_TEST
|
|||||||
START_TEST(test_bip32_decred_vector_1) {
|
START_TEST(test_bip32_decred_vector_1) {
|
||||||
HDNode node, node2, node3;
|
HDNode node, node2, node3;
|
||||||
uint32_t fingerprint;
|
uint32_t fingerprint;
|
||||||
char str[112];
|
char str[XPUB_MAXLEN];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// init m
|
// init m
|
||||||
@ -3028,7 +3028,7 @@ END_TEST
|
|||||||
START_TEST(test_bip32_decred_vector_2) {
|
START_TEST(test_bip32_decred_vector_2) {
|
||||||
HDNode node, node2, node3;
|
HDNode node, node2, node3;
|
||||||
uint32_t fingerprint;
|
uint32_t fingerprint;
|
||||||
char str[112];
|
char str[XPUB_MAXLEN];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// init m
|
// init m
|
||||||
|
@ -262,7 +262,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
|
|||||||
default: { // show XPUBs
|
default: { // show XPUBs
|
||||||
int index = (screen - 2) / 2;
|
int index = (screen - 2) / 2;
|
||||||
int page = (screen - 2) % 2;
|
int page = (screen - 2) % 2;
|
||||||
char xpub[112] = {0};
|
char xpub[XPUB_MAXLEN] = {0};
|
||||||
const HDNodeType *node_ptr = NULL;
|
const HDNodeType *node_ptr = NULL;
|
||||||
if (multisig->nodes_count) { // use multisig->nodes
|
if (multisig->nodes_count) { // use multisig->nodes
|
||||||
node_ptr = &(multisig->nodes[index]);
|
node_ptr = &(multisig->nodes[index]);
|
||||||
|
Loading…
Reference in New Issue
Block a user