mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-03 04:58:25 +00:00
signing: use the new hasher_InitParam API
This commit is contained in:
parent
77a6718f76
commit
7e3d0a0a77
@ -527,9 +527,9 @@ void signing_init(const SignTx *msg, const CoinInfo *_coin, const HDNode *_root)
|
|||||||
|
|
||||||
// segwit hashes for hashPrevouts and hashSequence
|
// segwit hashes for hashPrevouts and hashSequence
|
||||||
if (overwintered) {
|
if (overwintered) {
|
||||||
hasher_Init(&hasher_prevouts, HASHER_OVERWINTER_PREVOUTS);
|
hasher_InitParam(&hasher_prevouts, HASHER_BLAKE2B_PERSONAL, "ZcashPrevoutHash", 16);
|
||||||
hasher_Init(&hasher_sequence, HASHER_OVERWINTER_SEQUENCE);
|
hasher_InitParam(&hasher_sequence, HASHER_BLAKE2B_PERSONAL, "ZcashSequencHash", 16);
|
||||||
hasher_Init(&hasher_outputs, HASHER_OVERWINTER_OUTPUTS);
|
hasher_InitParam(&hasher_outputs, HASHER_BLAKE2B_PERSONAL, "ZcashOutputsHash", 16);
|
||||||
hasher_Init(&hasher_check, coin->curve->hasher_sign);
|
hasher_Init(&hasher_check, coin->curve->hasher_sign);
|
||||||
} else {
|
} else {
|
||||||
hasher_Init(&hasher_prevouts, coin->curve->hasher_sign);
|
hasher_Init(&hasher_prevouts, coin->curve->hasher_sign);
|
||||||
@ -769,7 +769,8 @@ static void signing_hash_bip143(const TxInputType *txinput, uint8_t *hash) {
|
|||||||
static void signing_hash_zip143(const TxInputType *txinput, uint8_t *hash) {
|
static void signing_hash_zip143(const TxInputType *txinput, uint8_t *hash) {
|
||||||
uint32_t hash_type = signing_hash_type();
|
uint32_t hash_type = signing_hash_type();
|
||||||
Hasher hasher_preimage;
|
Hasher hasher_preimage;
|
||||||
hasher_Init(&hasher_preimage, HASHER_OVERWINTER_PREIMAGE);
|
// BRANCH_ID = 0x5ba81b19 / Overwinter
|
||||||
|
hasher_InitParam(&hasher_preimage, HASHER_BLAKE2B_PERSONAL, "ZcashSigHash\x19\x1b\xa8\x5b", 16);
|
||||||
uint32_t ver = version | TX_OVERWINTERED; // 1. nVersion | fOverwintered
|
uint32_t ver = version | TX_OVERWINTERED; // 1. nVersion | fOverwintered
|
||||||
hasher_Update(&hasher_preimage, (const uint8_t *)&ver, 4);
|
hasher_Update(&hasher_preimage, (const uint8_t *)&ver, 4);
|
||||||
hasher_Update(&hasher_preimage, (const uint8_t *)&version_group_id, 4); // 2. nVersionGroupId
|
hasher_Update(&hasher_preimage, (const uint8_t *)&version_group_id, 4); // 2. nVersionGroupId
|
||||||
@ -793,7 +794,8 @@ static void signing_hash_zip143(const TxInputType *txinput, uint8_t *hash) {
|
|||||||
static void signing_hash_zip243(const TxInputType *txinput, uint8_t *hash) {
|
static void signing_hash_zip243(const TxInputType *txinput, uint8_t *hash) {
|
||||||
uint32_t hash_type = signing_hash_type();
|
uint32_t hash_type = signing_hash_type();
|
||||||
Hasher hasher_preimage;
|
Hasher hasher_preimage;
|
||||||
hasher_Init(&hasher_preimage, HASHER_SAPLING_PREIMAGE);
|
// BRANCH_ID = 0x76b809bb / Sapling
|
||||||
|
hasher_InitParam(&hasher_preimage, HASHER_BLAKE2B_PERSONAL, "ZcashSigHash\xbb\x09\xb8\x76", 16);
|
||||||
uint32_t ver = version | TX_OVERWINTERED; // 1. nVersion | fOverwintered
|
uint32_t ver = version | TX_OVERWINTERED; // 1. nVersion | fOverwintered
|
||||||
hasher_Update(&hasher_preimage, (const uint8_t *)&ver, 4);
|
hasher_Update(&hasher_preimage, (const uint8_t *)&ver, 4);
|
||||||
hasher_Update(&hasher_preimage, (const uint8_t *)&version_group_id, 4); // 2. nVersionGroupId
|
hasher_Update(&hasher_preimage, (const uint8_t *)&version_group_id, 4); // 2. nVersionGroupId
|
||||||
|
2
vendor/trezor-crypto
vendored
2
vendor/trezor-crypto
vendored
@ -1 +1 @@
|
|||||||
Subproject commit d1c52401e4c76c74a10455682ace0655b7aa644c
|
Subproject commit 21391dc5be9917bc32a518cf98376f79103727af
|
Loading…
Reference in New Issue
Block a user