1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

fsm: Use coin->curve_name

This commit is contained in:
Saleem Rashid 2017-12-09 18:35:37 +00:00 committed by Pavol Rusnak
parent 6e25e0b363
commit 7cd9945905
4 changed files with 7 additions and 4 deletions

View File

@ -29,6 +29,7 @@ def get_fields(coin):
'%d' % coin['forkid'] if coin['forkid'] else '0',
'"%s"' % coin['bech32_prefix'] if coin.get('bech32_prefix') is not None else 'NULL',
'0x%08x' % (0x80000000 + coin['bip44']),
'%s_NAME' % 'secp256k1'.upper(),
'&%s_info' % 'secp256k1',
]

View File

@ -20,6 +20,7 @@
#include <string.h>
#include "coins.h"
#include "address.h"
#include "curves.h"
#include "ecdsa.h"
#include "base58.h"
#include "secp256k1.h"

View File

@ -45,6 +45,7 @@ typedef struct _CoinInfo {
uint32_t forkid;
const char *bech32_prefix;
uint32_t coin_type;
const char *curve_name;
const curve_info *curve;
} CoinInfo;

View File

@ -389,7 +389,7 @@ void fsm_msgGetPublicKey(GetPublicKey *msg)
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
const char *curve = SECP256K1_NAME;
const char *curve = coin->curve_name;
if (msg->has_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);
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;
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);
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;
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);
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;
layoutProgressSwipe(_("Signing"), 0);