Skip to content

Commit

Permalink
Update qtum support
Browse files Browse the repository at this point in the history
* Add op_sender and update op_call and op_create checks
* Fix get for script size
* Update functions names in the style of the app
* Check op_call and op_create only for qtum
* Update max output size to 500 for Qtum
* Update Qtum to be standalone app
* Add Qtum specific code between macros
* Fix for op_sender output  check
* Add Sign OP_SENDER into UX FLOW
* Add function to get script for sender address
* Add function to check is exist sender sig in the output
* Add size to sender address script
* Add sign op_sender support
* Release more memory for Qtum
* Move the sign sender code in btchip_hash_sender_sign.c
* Add sender signature checks
The signature is empty when signing the output and not empty when signing the inputs.
* Add Qtum specific code between macros
* Increase the max output size from 450 to 500 as before op_sender
Op_sender work well with 500 too after disable Blake2b (350 with Blake2b enabled),
which is not used for hashing in Qtum.
* add qtum testnet
* add support for other derivation path
* Do not use LIB
* Display delegation/contract details

Co-authored-by: timemarkovqtum <[email protected]>
Co-authored-by: codeface <[email protected]>
Co-authored-by: Neil <[email protected]>
  • Loading branch information
3 people committed Nov 4, 2021
1 parent 4d5d1f4 commit 1e809c6
Show file tree
Hide file tree
Showing 13 changed files with 661 additions and 39 deletions.
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,18 @@ else ifeq ($(COIN),qtum)
# Qtum
# Qtum can run significantly different code paths, thus is locked by the OS
# using APP_LOAD_PARAMS instead of BIP44_COIN_TYPE
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=58 COIN_P2SH_VERSION=50 COIN_FAMILY=3 COIN_COINID=\"Qtum\" COIN_COINID_HEADER=\"QTUM\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"QTUM\" COIN_COINID_SHORT=\"QTUM\" COIN_NATIVE_SEGWIT_PREFIX=\"qc\" COIN_KIND=COIN_KIND_QTUM COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=58 COIN_P2SH_VERSION=50 COIN_FAMILY=3 COIN_COINID=\"Qtum\" COIN_COINID_HEADER=\"QTUM\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"QTUM\" COIN_COINID_SHORT=\"QTUM\" COIN_NATIVE_SEGWIT_PREFIX=\"qc\" COIN_KIND=COIN_KIND_QTUM COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT MAX_OUTPUT_TO_CHECK=500 HAVE_QTUM_SUPPORT USE_NO_OVERWINTER
APPNAME ="Qtum"
APP_LOAD_PARAMS += --path "44'/88'" --path "49'/88'" --path "84'/88'" --path "0'/45342'" --path "20698'/3053'/12648430'"
DEFINES_LIB=# we're not using the lib :)
APP_LOAD_PARAMS += --path $(APP_PATH) --path "44'/88'" --path "45'/88'" --path "48'/88'" --path "49'/88'" --path "84'/88'" --path "0'/45342'" --path "20698'/3053'/12648430'"
APP_LOAD_FLAGS=--appFlags 0xa50
else ifeq ($(COIN),qtum_testnet)
# Qtum Testnet
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=120 COIN_P2SH_VERSION=110 COIN_FAMILY=3 COIN_COINID=\"Qtum\" COIN_COINID_HEADER=\"QTUM\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"QTUM\" COIN_COINID_SHORT=\"QTUM\" COIN_NATIVE_SEGWIT_PREFIX=\"tq\" COIN_KIND=COIN_KIND_QTUM COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT MAX_OUTPUT_TO_CHECK=500 HAVE_QTUM_SUPPORT USE_NO_OVERWINTER
APPNAME ="Qtum Test"
DEFINES_LIB=# we're not using the lib :)
APP_LOAD_PARAMS += --path $(APP_PATH) --path "44'/1'" --path "45'/1'" --path "48'/1'" --path "49'/1'" --path "84'/1'" --path "0'/45342'" --path "20698'/3053'/12648430'"
APP_LOAD_FLAGS=--appFlags 0xa50
else ifeq ($(COIN),firo)
DEFINES += BIP44_COIN_TYPE=136 BIP44_COIN_TYPE_2=136 COIN_P2PKH_VERSION=82 COIN_P2SH_VERSION=7 COIN_FAMILY=1 COIN_COINID=\"Zcoin\" COIN_COINID_HEADER=\"FIRO\" COIN_COLOR_HDR=0x3EAD54 COIN_COLOR_DB=0xA3DCAE COIN_COINID_NAME=\"Firo\" COIN_COINID_SHORT=\"FIRO\" COIN_KIND=COIN_KIND_FIRO
APPNAME ="Firo"
Expand Down Expand Up @@ -189,12 +198,12 @@ APPNAME ="Ravencoin"
APP_LOAD_PARAMS += --path $(APP_PATH)
else ifeq ($(COIN),hydra_testnet)
# Hydra testnet
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=66 COIN_P2SH_VERSION=128 COIN_FAMILY=3 COIN_COINID=\"Hydra\" COIN_COINID_HEADER=\"HYDRA\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"HYDRA\" COIN_COINID_SHORT=\"HYDRA\" COIN_NATIVE_SEGWIT_PREFIX=\"hc\" COIN_KIND=COIN_KIND_HYDRA COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=66 COIN_P2SH_VERSION=128 COIN_FAMILY=3 COIN_COINID=\"Hydra\" COIN_COINID_HEADER=\"HYDRA\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"HYDRA\" COIN_COINID_SHORT=\"HYDRA\" COIN_NATIVE_SEGWIT_PREFIX=\"hc\" COIN_KIND=COIN_KIND_HYDRA COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT HAVE_QTUM_SUPPORT
APPNAME ="Hydra"
APP_LOAD_PARAMS += --path "44'/609'"
else ifeq ($(COIN),hydra)
# Hydra mainnet
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=40 COIN_P2SH_VERSION=63 COIN_FAMILY=3 COIN_COINID=\"Hydra\" COIN_COINID_HEADER=\"HYDRA\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"HYDRA\" COIN_COINID_SHORT=\"HYDRA\" COIN_NATIVE_SEGWIT_PREFIX=\"hc\" COIN_KIND=COIN_KIND_HYDRA COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT
DEFINES += BIP44_COIN_TYPE=0 BIP44_COIN_TYPE_2=0 COIN_P2PKH_VERSION=40 COIN_P2SH_VERSION=63 COIN_FAMILY=3 COIN_COINID=\"Hydra\" COIN_COINID_HEADER=\"HYDRA\" COIN_COLOR_HDR=0x2E9AD0 COIN_COLOR_DB=0x97CDE8 COIN_COINID_NAME=\"HYDRA\" COIN_COINID_SHORT=\"HYDRA\" COIN_NATIVE_SEGWIT_PREFIX=\"hc\" COIN_KIND=COIN_KIND_HYDRA COIN_FLAGS=FLAG_SEGWIT_CHANGE_SUPPORT HAVE_QTUM_SUPPORT
APPNAME ="Hydra"
APP_LOAD_PARAMS += --path "44'/609'"
else
Expand Down
10 changes: 10 additions & 0 deletions include/btchip_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include "btchip_secure_value.h"
#include "btchip_filesystem_tx.h"

#ifndef MAX_OUTPUT_TO_CHECK
#define MAX_OUTPUT_TO_CHECK 100
#endif
#define MAX_COIN_ID 13
#define MAX_SHORT_COIN_ID 5

Expand Down Expand Up @@ -96,7 +98,9 @@ typedef enum btchip_output_parsing_state_e btchip_output_parsing_state_t;

typedef union multi_hash {
cx_sha256_t sha256;
#ifndef USE_NO_OVERWINTER
cx_blake2b_t blake2b;
#endif
} multi_hash;

struct segwit_hash_s {
Expand Down Expand Up @@ -171,6 +175,9 @@ struct btchip_context_s {
cx_sha256_t transactionHashAuthorization;
/** Current hash to perform (TRANSACTION_HASH_) */
unsigned char transactionHashOption;
#ifdef HAVE_QTUM_SUPPORT
cx_sha256_t transactionOutputHash;
#endif

/* Segregated Witness changes */

Expand All @@ -185,6 +192,9 @@ struct btchip_context_s {
unsigned char segwitParsedOnce;
/** Prevents display of segwit input warning at each InputHashStart APDU */
unsigned char segwitWarningSeen;
#ifdef HAVE_QTUM_SUPPORT
unsigned char signOpSender;
#endif

/* /Segregated Witness changes */

Expand Down
12 changes: 12 additions & 0 deletions include/btchip_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@ unsigned char btchip_output_script_is_p2sh(unsigned char *buffer);
unsigned char btchip_output_script_is_op_return(unsigned char *buffer);
unsigned char btchip_output_script_is_native_witness(unsigned char *buffer);

#ifdef HAVE_QTUM_SUPPORT
unsigned char btchip_output_script_is_op_create(unsigned char *buffer,
size_t size);
unsigned char btchip_output_script_is_op_call(unsigned char *buffer,
size_t size);
unsigned char btchip_output_script_is_op_sender(unsigned char *buffer,
size_t size);
unsigned char btchip_get_script_size(unsigned char *buffer, size_t maxSize,
unsigned int *scriptSize, unsigned int *discardSize);
unsigned char btchip_get_script_sender_address(unsigned char *buffer,
size_t size, unsigned char *script);
unsigned char btchip_get_sender_sig(unsigned char *buffer,
size_t size, unsigned char **sig, unsigned int *sigSize);
#endif

void btchip_sleep16(unsigned short delay);
void btchip_sleep32(unsigned long int delayEach, unsigned long int delayRepeat);

unsigned long int btchip_read_u16(unsigned char *buffer, unsigned char be,
unsigned char skipSign);
unsigned long int btchip_read_u32(unsigned char *buffer, unsigned char be,
unsigned char skipSign);

Expand Down
3 changes: 3 additions & 0 deletions src/btchip_apdu_get_trusted_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ unsigned short btchip_apdu_get_trusted_input() {
btchip_context_D.transactionHashOption = TRANSACTION_HASH_FULL;
btchip_context_D.usingSegwit = 0;
btchip_context_D.usingOverwinter = 0;
#ifdef HAVE_QTUM_SUPPORT
btchip_context_D.signOpSender = 0;
#endif
} else if (G_io_apdu_buffer[ISO_OFFSET_P1] != GET_TRUSTED_INPUT_P1_NEXT) {
return BTCHIP_SW_INCORRECT_P1_P2;
}
Expand Down
66 changes: 53 additions & 13 deletions src/btchip_apdu_hash_input_finalize_full.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static bool check_output_displayable() {
bool displayable = true;
unsigned char amount[8], isOpReturn, isP2sh, isNativeSegwit, j,
nullAmount = 1;
unsigned char isOpCreate, isOpCall;
unsigned char isOpCreate = 0, isOpCall = 0, isOpSender = 0;

for (j = 0; j < 8; j++) {
if (btchip_context_D.currentOutput[j] != 0) {
Expand All @@ -62,12 +62,19 @@ static bool check_output_displayable() {
isP2sh = btchip_output_script_is_p2sh(btchip_context_D.currentOutput + 8);
isNativeSegwit = btchip_output_script_is_native_witness(
btchip_context_D.currentOutput + 8);
isOpCreate =
btchip_output_script_is_op_create(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8);
isOpCall =
btchip_output_script_is_op_call(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8);
#ifdef HAVE_QTUM_SUPPORT
if(G_coin_config->kind == COIN_KIND_QTUM) {
isOpCreate =
btchip_output_script_is_op_create(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8);
isOpCall =
btchip_output_script_is_op_call(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8);
isOpSender =
btchip_output_script_is_op_sender(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8);
}
#endif
if (((G_coin_config->kind == COIN_KIND_QTUM || G_coin_config->kind == COIN_KIND_HYDRA) &&
!btchip_output_script_is_regular(btchip_context_D.currentOutput + 8) &&
!isP2sh && !(nullAmount && isOpReturn) && !isOpCreate && !isOpCall) ||
Expand All @@ -77,13 +84,32 @@ static bool check_output_displayable() {
PRINTF("Error : Unrecognized output script");
THROW(EXCEPTION);
}
#ifdef HAVE_QTUM_SUPPORT
if((G_coin_config->kind == COIN_KIND_QTUM) && isOpSender && (isOpCreate || isOpCall))
{
unsigned char *sig = 0;
unsigned int sigSize = 0;
btchip_get_sender_sig(btchip_context_D.currentOutput + 8,
sizeof(btchip_context_D.currentOutput) - 8, &sig, &sigSize);
if(!btchip_context_D.signOpSender && sigSize == 0)
{
PRINTF("Error : No op_sender signature");
THROW(EXCEPTION);
}
if(btchip_context_D.signOpSender && sigSize > 0)
{
PRINTF("Error : op_sender is already signed");
THROW(EXCEPTION);
}
}
#endif
if (btchip_context_D.tmpCtx.output.changeInitialized && !isOpReturn) {
bool changeFound = false;
unsigned char addressOffset =
(isNativeSegwit ? OUTPUT_SCRIPT_NATIVE_WITNESS_PROGRAM_OFFSET
: isP2sh ? OUTPUT_SCRIPT_P2SH_PRE_LENGTH
: OUTPUT_SCRIPT_REGULAR_PRE_LENGTH);
if (!isP2sh &&
if (!isP2sh && !isOpSender &&
os_memcmp(btchip_context_D.currentOutput + 8 + addressOffset,
btchip_context_D.tmpCtx.output.changeAddress,
20) == 0) {
Expand Down Expand Up @@ -176,7 +202,7 @@ bool handle_output_state() {
break;
}
scriptSize =
btchip_read_u32(btchip_context_D.currentOutput + 9, 0, 0);
btchip_read_u16(btchip_context_D.currentOutput + 9, 0, 0);
discardSize = 3;
} else {
// Unrealistically large script
Expand Down Expand Up @@ -332,10 +358,13 @@ unsigned short btchip_apdu_hash_input_finalize_full_internal(
sw = BTCHIP_SW_INCORRECT_DATA;
goto discardTransaction;
}
#ifndef USE_NO_OVERWINTER
if (btchip_context_D.usingOverwinter) {
cx_hash(&btchip_context_D.transactionHashFull.blake2b.header, 0, G_io_apdu_buffer + ISO_OFFSET_CDATA + hashOffset, apduLength - hashOffset, NULL, 0);
}
else {
else
#endif
{
PRINTF("--- ADD TO HASH FULL:\n%.*H\n", apduLength - hashOffset, G_io_apdu_buffer + ISO_OFFSET_CDATA + hashOffset);
cx_hash(&btchip_context_D.transactionHashFull.sha256.header, 0,
G_io_apdu_buffer + ISO_OFFSET_CDATA + hashOffset,
Expand Down Expand Up @@ -392,10 +421,13 @@ unsigned short btchip_apdu_hash_input_finalize_full_internal(

if (btchip_context_D.usingSegwit) {
if (!btchip_context_D.segwitParsedOnce) {
#ifndef USE_NO_OVERWINTER
if (btchip_context_D.usingOverwinter) {
cx_hash(&btchip_context_D.transactionHashFull.blake2b.header, CX_LAST, btchip_context_D.segwit.cache.hashedOutputs, 0, btchip_context_D.segwit.cache.hashedOutputs, 32);
}
else {
else
#endif
{
cx_hash(&btchip_context_D.transactionHashFull.sha256.header,
CX_LAST,
btchip_context_D.segwit.cache.hashedOutputs, 0,
Expand Down Expand Up @@ -470,7 +502,11 @@ unsigned short btchip_apdu_hash_input_finalize_full_internal(
}

if (btchip_context_D.usingSegwit &&
!btchip_context_D.segwitParsedOnce) {
!btchip_context_D.segwitParsedOnce
#ifdef HAVE_QTUM_SUPPORT
&& !btchip_context_D.signOpSender
#endif
) {
// This input cannot be signed when using segwit - just restart.
btchip_context_D.segwitParsedOnce = 1;
PRINTF("Segwit parsed once\n");
Expand Down Expand Up @@ -592,7 +628,11 @@ unsigned char btchip_bagl_user_action(unsigned char confirming) {
btchip_context_D.transactionContext.firstSigned = 0;

if (btchip_context_D.usingSegwit &&
!btchip_context_D.segwitParsedOnce) {
!btchip_context_D.segwitParsedOnce
#ifdef HAVE_QTUM_SUPPORT
&& !btchip_context_D.signOpSender
#endif
) {
// This input cannot be signed when using segwit - just restart.
btchip_context_D.segwitParsedOnce = 1;
PRINTF("Segwit parsed once\n");
Expand Down
15 changes: 15 additions & 0 deletions src/btchip_apdu_hash_input_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define P2_NEW_SEGWIT_OVERWINTER 0x04
#define P2_NEW_SEGWIT_SAPLING 0x05
#define P2_CONTINUE 0x80
#define P2_NEW_SENDER 0x81

#define IS_INPUT() \
(G_io_apdu_buffer[ISO_OFFSET_LC] - 1 > 8 \
Expand Down Expand Up @@ -64,6 +65,9 @@ unsigned short btchip_apdu_hash_input_start() {
}

if ((G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW) ||
#ifdef HAVE_QTUM_SUPPORT
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SENDER) ||
#endif
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SEGWIT) ||
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SEGWIT_CASHADDR) ||
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SEGWIT_OVERWINTER) ||
Expand All @@ -78,6 +82,10 @@ unsigned short btchip_apdu_hash_input_start() {
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SEGWIT_SAPLING);
unsigned char usingCashAddr =
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SEGWIT_CASHADDR);
#ifdef HAVE_QTUM_SUPPORT
unsigned char signOpSender =
(G_io_apdu_buffer[ISO_OFFSET_P2] == P2_NEW_SENDER);
#endif
// Request PIN validation
// Only request PIN validation (user presence) to start a new
// transaction signing flow.
Expand All @@ -92,7 +100,14 @@ unsigned short btchip_apdu_hash_input_start() {
btchip_context_D.transactionContext.firstSigned = 1;
btchip_context_D.transactionContext.consumeP2SH = 0;
btchip_context_D.transactionContext.relaxed = 0;
#ifdef HAVE_QTUM_SUPPORT
if(signOpSender)
usingSegwit = 1;
#endif
btchip_context_D.usingSegwit = usingSegwit;
#ifdef HAVE_QTUM_SUPPORT
btchip_context_D.signOpSender = signOpSender;
#endif
btchip_context_D.usingCashAddr =
(G_coin_config->kind == COIN_KIND_BITCOIN_CASH ? usingCashAddr
: 0);
Expand Down
38 changes: 32 additions & 6 deletions src/btchip_apdu_hash_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ unsigned short btchip_apdu_hash_sign() {

// Zcash special - store parameters for later

#ifndef USE_NO_OVERWINTER
if ((btchip_context_D.usingOverwinter) &&
(!btchip_context_D.overwinterSignReady) &&
(btchip_context_D.segwitParsedOnce) &&
Expand All @@ -75,6 +76,7 @@ unsigned short btchip_apdu_hash_sign() {
CLOSE_TRY;
return BTCHIP_SW_OK;
}
#endif

if (btchip_context_D.transactionContext.transactionState !=
BTCHIP_TRANSACTION_SIGN_READY) {
Expand All @@ -83,11 +85,13 @@ unsigned short btchip_apdu_hash_sign() {
goto discardTransaction;
}

#ifndef USE_NO_OVERWINTER
if (btchip_context_D.usingOverwinter && !btchip_context_D.overwinterSignReady) {
PRINTF("Overwinter not ready to sign\n");
sw = BTCHIP_SW_CONDITIONS_OF_USE_NOT_SATISFIED;
goto discardTransaction;
}
#endif

// Read parameters
if (G_io_apdu_buffer[ISO_OFFSET_CDATA] > MAX_BIP32_PATH) {
Expand Down Expand Up @@ -130,9 +134,18 @@ unsigned short btchip_apdu_hash_sign() {
if (!btchip_context_D.usingOverwinter) {
btchip_write_u32_le(dataBuffer, lockTime);
btchip_write_u32_le(dataBuffer + 4, sighashType);
PRINTF("--- ADD TO HASH FULL:\n%.*H\n", sizeof(dataBuffer), dataBuffer);
cx_hash(&btchip_context_D.transactionHashFull.sha256.header, 0,
dataBuffer, sizeof(dataBuffer), NULL, 0);
#ifdef HAVE_QTUM_SUPPORT
if(btchip_context_D.signOpSender)
{
btchip_hash_sender_finalize(dataBuffer, sizeof(dataBuffer));
}
else
#endif
{
PRINTF("--- ADD TO HASH FULL:\n%.*H\n", sizeof(dataBuffer), dataBuffer);
cx_hash(&btchip_context_D.transactionHashFull.sha256.header, 0,
dataBuffer, sizeof(dataBuffer), NULL, 0);
}
}

// Check if the path needs to be enforced
Expand Down Expand Up @@ -179,13 +192,26 @@ void btchip_bagl_user_action_signtx(unsigned char confirming, unsigned char dire
unsigned char hash[32];
// Fetch the private key
btchip_private_derive_keypair(btchip_context_D.transactionSummary.keyPath, 0, NULL, &private_key, NULL);
#ifndef USE_NO_OVERWINTER
if (btchip_context_D.usingOverwinter) {
cx_hash(&btchip_context_D.transactionHashFull.blake2b.header, CX_LAST, hash, 0, hash, 32);
}
else {
else
#endif
{
cx_sha256_t localHash;
cx_hash(&btchip_context_D.transactionHashFull.sha256.header, CX_LAST,
hash, 0, hash, 32);
#ifdef HAVE_QTUM_SUPPORT
if(btchip_context_D.signOpSender)
{
cx_hash(&btchip_context_D.transactionOutputHash.header, CX_LAST,
hash, 0, hash, 32);
}
else
#endif
{
cx_hash(&btchip_context_D.transactionHashFull.sha256.header, CX_LAST,
hash, 0, hash, 32);
}
PRINTF("Hash1\n%.*H\n", sizeof(hash), hash);

// Rehash
Expand Down
Loading

0 comments on commit 1e809c6

Please sign in to comment.