@@ -511,7 +511,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
511
511
const size_t num_digits ,
512
512
const size_t digit_base
513
513
) {
514
- size_t i , scratch_checkpoint ;
514
+ size_t i , scratch_checkpoint , ret ;
515
515
size_t g_offset = digit_base > num_digits ? digit_base : num_digits ;
516
516
/* Compute w = s/t + m + t*d + t^2*r + t^3*c_m. Store w in s*/
517
517
secp256k1_scalar t_pows [8 ], c_poly [8 ], t_inv ;
@@ -590,7 +590,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
590
590
}
591
591
memcpy (gs , gens -> gens , (gens -> n ) * sizeof (secp256k1_ge ));
592
592
593
- return secp256k1_bppp_rangeproof_norm_product_prove (
593
+ ret = secp256k1_bppp_rangeproof_norm_product_prove (
594
594
ctx ,
595
595
scratch ,
596
596
output ,
@@ -607,6 +607,8 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
607
607
c_poly ,
608
608
8
609
609
);
610
+ secp256k1_scratch_apply_checkpoint (& ctx -> error_callback , scratch , scratch_checkpoint );
611
+ return ret ;
610
612
}
611
613
612
614
static int secp256k1_bppp_rangeproof_prove_impl (
@@ -826,6 +828,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
826
828
const unsigned char * extra_commit ,
827
829
size_t extra_commit_len
828
830
) {
831
+ int res ;
829
832
size_t scratch_checkpoint ;
830
833
secp256k1_sha256 transcript ;
831
834
size_t num_digits = n_bits / secp256k1_bppp_log2 (digit_base );
@@ -982,6 +985,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
982
985
num_points = 6 + g_offset ;
983
986
984
987
if (!secp256k1_ecmult_multi_var (& ctx -> error_callback , scratch , & c_commj , NULL , secp256k1_bppp_verify_cb , (void * ) & cb_data , num_points )) {
988
+ secp256k1_scratch_apply_checkpoint (& ctx -> error_callback , scratch , scratch_checkpoint );
985
989
return 0 ;
986
990
}
987
991
@@ -999,7 +1003,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
999
1003
}
1000
1004
secp256k1_scalar_clear (& c_poly [7 ]);
1001
1005
1002
- return secp256k1_bppp_rangeproof_norm_product_verify (
1006
+ res = secp256k1_bppp_rangeproof_norm_product_verify (
1003
1007
ctx ,
1004
1008
scratch ,
1005
1009
& proof [33 * 4 ],
@@ -1013,6 +1017,8 @@ static int secp256k1_bppp_rangeproof_verify_impl(
1013
1017
8 ,
1014
1018
& c_comm
1015
1019
);
1020
+ secp256k1_scratch_apply_checkpoint (& ctx -> error_callback , scratch , scratch_checkpoint );
1021
+ return res ;
1016
1022
}
1017
1023
}
1018
1024
0 commit comments