1818 */
1919
2020#include "signing.h"
21+ #include "buttons.h"
2122#include "config.h"
2223#include "crypto.h"
2324#include "ecdsa.h"
@@ -793,7 +794,8 @@ void phase1_request_next_input(void) {
793794
794795 // Confirm original TXID.
795796 layoutConfirmReplacement (description , orig_hash );
796- if (!protectButton (ButtonRequestType_ButtonRequest_SignTx , false)) {
797+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_SignTx , true, 0 ,
798+ 1 ) != KEY_CONFIRM ) {
797799 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
798800 signing_abort ();
799801 return ;
@@ -2055,8 +2057,8 @@ static bool compile_output(TxOutputType *in, TxOutputBinType *out,
20552057 layoutConfirmOpReturn (in -> op_return_data .bytes ,
20562058 in -> op_return_data .size );
20572059 }
2058- if (! protectButton (ButtonRequestType_ButtonRequest_ConfirmOutput ,
2059- false) ) {
2060+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_ConfirmOutput ,
2061+ true, 0 , 1 ) != KEY_CONFIRM ) {
20602062 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
20612063 signing_abort ();
20622064 return false;
@@ -2425,8 +2427,8 @@ static bool signing_add_orig_output(TxOutputType *orig_output) {
24252427 for (int page = 0 ; page < 2 ; ++ page ) {
24262428 layoutConfirmModifyOutput (coin , amount_unit , & output , orig_output ,
24272429 page );
2428- if (! protectButton (ButtonRequestType_ButtonRequest_ConfirmOutput ,
2429- false) ) {
2430+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_ConfirmOutput ,
2431+ true, 0 , 1 ) != KEY_CONFIRM ) {
24302432 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
24312433 signing_abort ();
24322434 return false;
@@ -2451,7 +2453,8 @@ static bool signing_add_orig_output(TxOutputType *orig_output) {
24512453static bool payment_confirm_tx (void ) {
24522454 if (has_unverified_external_input ) {
24532455 layoutConfirmUnverifiedExternalInputs ();
2454- if (!protectButton (ButtonRequestType_ButtonRequest_SignTx , false)) {
2456+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_SignTx , true, 0 ,
2457+ 1 ) != KEY_CONFIRM ) {
24552458 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
24562459 signing_abort ();
24572460 return false;
@@ -2475,8 +2478,8 @@ static bool payment_confirm_tx(void) {
24752478 fee = total_in - total_out ;
24762479 if (fee > ((uint64_t )tx_weight * coin -> maxfee_kb ) / 4000 ) {
24772480 layoutFeeOverThreshold (coin , amount_unit , fee );
2478- if (! protectButton (ButtonRequestType_ButtonRequest_FeeOverThreshold ,
2479- false) ) {
2481+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_FeeOverThreshold ,
2482+ true, 0 , 1 ) != KEY_CONFIRM ) {
24802483 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
24812484 signing_abort ();
24822485 return false;
@@ -2488,7 +2491,8 @@ static bool payment_confirm_tx(void) {
24882491
24892492 if (change_count > MAX_SILENT_CHANGE_COUNT ) {
24902493 layoutChangeCountOverThreshold (change_count );
2491- if (!protectButton (ButtonRequestType_ButtonRequest_SignTx , false)) {
2494+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_SignTx , true, 0 ,
2495+ 1 ) != KEY_CONFIRM ) {
24922496 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
24932497 signing_abort ();
24942498 return false;
@@ -2548,7 +2552,8 @@ static bool payment_confirm_tx(void) {
25482552 // Fee modification.
25492553 if (fee != orig_fee ) {
25502554 layoutConfirmModifyFee (coin , amount_unit , orig_fee , fee , tx_weight );
2551- if (!protectButton (ButtonRequestType_ButtonRequest_SignTx , false)) {
2555+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_SignTx , true, 0 ,
2556+ 1 ) != KEY_CONFIRM ) {
25522557 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
25532558 signing_abort ();
25542559 return false;
@@ -2560,7 +2565,8 @@ static bool payment_confirm_tx(void) {
25602565 if (info .lock_time != 0 ) {
25612566 bool lock_time_disabled = (info .min_sequence == SEQUENCE_FINAL );
25622567 layoutConfirmNondefaultLockTime (info .lock_time , lock_time_disabled );
2563- if (!protectButton (ButtonRequestType_ButtonRequest_SignTx , false)) {
2568+ if (protectWaitKeyValue (ButtonRequestType_ButtonRequest_SignTx , true, 0 ,
2569+ 1 ) != KEY_CONFIRM ) {
25642570 fsm_sendFailure (FailureType_Failure_ActionCancelled , NULL );
25652571 signing_abort ();
25662572 return false;
0 commit comments