@@ -213,7 +213,9 @@ static bool display_data_content_and_confirm(dispatcher_context_t* dc,
213
213
if (address_type == -1 || redeemer_address_len == -1 ) {
214
214
PRINTF ("Error: Address type or address length is invalid\n" );
215
215
SEND_SW (dc , SW_INCORRECT_DATA );
216
- ui_post_processing_confirm_withdraw (dc , false);
216
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
217
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
218
+ }
217
219
return false;
218
220
}
219
221
if (!check_address (bip32_path ,
@@ -222,7 +224,9 @@ static bool display_data_content_and_confirm(dispatcher_context_t* dc,
222
224
redeemer_address_len ,
223
225
address_type )) {
224
226
SEND_SW (dc , SW_INCORRECT_DATA );
225
- ui_post_processing_confirm_withdraw (dc , false);
227
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
228
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
229
+ }
226
230
return false;
227
231
}
228
232
@@ -298,7 +302,9 @@ void fetch_and_add_chunk_to_hash(dispatcher_context_t* dc,
298
302
CHUNK_SIZE_IN_BYTES );
299
303
if (current_chunk_len < 0 ) {
300
304
SAFE_SEND_SW (dc , SW_WRONG_DATA_LENGTH );
301
- ui_post_processing_confirm_withdraw (dc , false);
305
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
306
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
307
+ }
302
308
return ;
303
309
}
304
310
size_t field_buffer_size = FIELD_SIZE ;
@@ -351,7 +357,9 @@ void fetch_and_add_chunk_to_buffer(dispatcher_context_t* dc,
351
357
CHUNK_SIZE_IN_BYTES );
352
358
if (current_chunk_len < 0 ) {
353
359
SAFE_SEND_SW (dc , SW_WRONG_DATA_LENGTH );
354
- ui_post_processing_confirm_withdraw (dc , false);
360
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
361
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
362
+ }
355
363
return ;
356
364
}
357
365
size_t input_buffer_size ;
@@ -583,7 +591,9 @@ uint32_t sign_tx_hash(dispatcher_context_t* dc,
583
591
if (sig_len < 0 ) {
584
592
// unexpected error when signing
585
593
SAFE_SEND_SW (dc , SW_BAD_STATE );
586
- ui_post_processing_confirm_message (dc , false);
594
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
595
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
596
+ }
587
597
return -1 ;
588
598
}
589
599
return info ;
@@ -635,13 +645,17 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
635
645
!buffer_read_varint (& dc -> read_buffer , & n_chunks ) ||
636
646
!buffer_read_bytes (& dc -> read_buffer , data_merkle_root , 32 )) {
637
647
SEND_SW (dc , SW_WRONG_DATA_LENGTH );
638
- ui_post_processing_confirm_withdraw (dc , false);
648
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
649
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
650
+ }
639
651
return ;
640
652
}
641
653
642
654
if (bip32_path_len > MAX_BIP32_PATH_STEPS ) {
643
655
SEND_SW (dc , SW_INCORRECT_DATA );
644
- ui_post_processing_confirm_withdraw (dc , false);
656
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
657
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
658
+ }
645
659
return ;
646
660
}
647
661
@@ -657,7 +671,9 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
657
671
bip32_path ,
658
672
bip32_path_len )) {
659
673
SEND_SW (dc , SW_DENY );
660
- ui_post_processing_confirm_withdraw (dc , false);
674
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
675
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
676
+ }
661
677
return ;
662
678
}
663
679
@@ -670,7 +686,9 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
670
686
char tx_hash_str [65 ];
671
687
if (!format_hex (tx_hash , KECCAK_256_HASH_SIZE , tx_hash_str , sizeof (tx_hash_str ))) {
672
688
SEND_SW (dc , SW_BAD_STATE );
673
- ui_post_processing_confirm_message (dc , false);
689
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
690
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
691
+ }
674
692
return ;
675
693
};
676
694
@@ -689,7 +707,9 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
689
707
690
708
if (r_length > 33 || s_length > 33 ) {
691
709
SEND_SW (dc , SW_BAD_STATE ); // can never happen
692
- ui_post_processing_confirm_message (dc , false);
710
+ if (!ui_post_processing_confirm_withdraw (dc , false)) {
711
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
712
+ }
693
713
return ;
694
714
}
695
715
@@ -705,6 +725,8 @@ void handler_withdraw(dispatcher_context_t* dc, uint8_t protocol_version) {
705
725
result [0 ] = 27 + 4 + ((info & CX_ECCINFO_PARITY_ODD ) ? 1 : 0 );
706
726
707
727
SEND_RESPONSE (dc , result , sizeof (result ), SW_OK );
708
- ui_post_processing_confirm_message (dc , true);
728
+ if (!ui_post_processing_confirm_withdraw (dc , true)) {
729
+ PRINTF ("Error in ui_post_processing_confirm_withdraw" );
730
+ }
709
731
return ;
710
732
}
0 commit comments