mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 01:18:28 +00:00
fsm: Use coin->curve_name
This commit is contained in:
parent
6e25e0b363
commit
7cd9945905
@ -29,6 +29,7 @@ def get_fields(coin):
|
|||||||
'%d' % coin['forkid'] if coin['forkid'] else '0',
|
'%d' % coin['forkid'] if coin['forkid'] else '0',
|
||||||
'"%s"' % coin['bech32_prefix'] if coin.get('bech32_prefix') is not None else 'NULL',
|
'"%s"' % coin['bech32_prefix'] if coin.get('bech32_prefix') is not None else 'NULL',
|
||||||
'0x%08x' % (0x80000000 + coin['bip44']),
|
'0x%08x' % (0x80000000 + coin['bip44']),
|
||||||
|
'%s_NAME' % 'secp256k1'.upper(),
|
||||||
'&%s_info' % 'secp256k1',
|
'&%s_info' % 'secp256k1',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "coins.h"
|
#include "coins.h"
|
||||||
#include "address.h"
|
#include "address.h"
|
||||||
|
#include "curves.h"
|
||||||
#include "ecdsa.h"
|
#include "ecdsa.h"
|
||||||
#include "base58.h"
|
#include "base58.h"
|
||||||
#include "secp256k1.h"
|
#include "secp256k1.h"
|
||||||
|
@ -45,6 +45,7 @@ typedef struct _CoinInfo {
|
|||||||
uint32_t forkid;
|
uint32_t forkid;
|
||||||
const char *bech32_prefix;
|
const char *bech32_prefix;
|
||||||
uint32_t coin_type;
|
uint32_t coin_type;
|
||||||
|
const char *curve_name;
|
||||||
const curve_info *curve;
|
const curve_info *curve;
|
||||||
} CoinInfo;
|
} CoinInfo;
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ void fsm_msgGetPublicKey(GetPublicKey *msg)
|
|||||||
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
||||||
if (!coin) return;
|
if (!coin) return;
|
||||||
|
|
||||||
const char *curve = SECP256K1_NAME;
|
const char *curve = coin->curve_name;
|
||||||
if (msg->has_ecdsa_curve_name) {
|
if (msg->has_ecdsa_curve_name) {
|
||||||
curve = msg->ecdsa_curve_name;
|
curve = msg->ecdsa_curve_name;
|
||||||
}
|
}
|
||||||
@ -501,7 +501,7 @@ void fsm_msgSignTx(SignTx *msg)
|
|||||||
|
|
||||||
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
||||||
if (!coin) return;
|
if (!coin) return;
|
||||||
const HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, 0, 0);
|
const HDNode *node = fsm_getDerivedNode(coin->curve_name, 0, 0);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
signing_init(msg->inputs_count, msg->outputs_count, coin, node, msg->version, msg->lock_time);
|
signing_init(msg->inputs_count, msg->outputs_count, coin, node, msg->version, msg->lock_time);
|
||||||
@ -670,7 +670,7 @@ void fsm_msgGetAddress(GetAddress *msg)
|
|||||||
|
|
||||||
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
||||||
if (!coin) return;
|
if (!coin) return;
|
||||||
HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, msg->address_n, msg->address_n_count);
|
HDNode *node = fsm_getDerivedNode(coin->curve_name, msg->address_n, msg->address_n_count);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
hdnode_fill_public_key(node);
|
hdnode_fill_public_key(node);
|
||||||
|
|
||||||
@ -852,7 +852,7 @@ void fsm_msgSignMessage(SignMessage *msg)
|
|||||||
|
|
||||||
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
||||||
if (!coin) return;
|
if (!coin) return;
|
||||||
HDNode *node = fsm_getDerivedNode(SECP256K1_NAME, msg->address_n, msg->address_n_count);
|
HDNode *node = fsm_getDerivedNode(coin->curve_name, msg->address_n, msg->address_n_count);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
layoutProgressSwipe(_("Signing"), 0);
|
layoutProgressSwipe(_("Signing"), 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user