@@ -511,7 +511,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
511511    const  size_t  num_digits ,
512512    const  size_t  digit_base 
513513) {
514-     size_t  i , scratch_checkpoint ;
514+     size_t  i , scratch_checkpoint ,  ret ;
515515    size_t  g_offset  =  digit_base  >  num_digits  ? digit_base  : num_digits ;
516516    /* Compute w = s/t + m + t*d + t^2*r + t^3*c_m. Store w in s*/ 
517517    secp256k1_scalar  t_pows [8 ], c_poly [8 ], t_inv ;
@@ -590,7 +590,7 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
590590    }
591591    memcpy (gs , gens -> gens , (gens -> n ) *  sizeof (secp256k1_ge ));
592592
593-     return  secp256k1_bppp_rangeproof_norm_product_prove (
593+     ret   =  secp256k1_bppp_rangeproof_norm_product_prove (
594594        ctx ,
595595        scratch ,
596596        output ,
@@ -607,6 +607,8 @@ static int secp256k1_bppp_rangeproof_prove_round4_impl(
607607        c_poly ,
608608        8 
609609    );
610+     secp256k1_scratch_apply_checkpoint (& ctx -> error_callback , scratch , scratch_checkpoint );
611+     return  ret ;
610612}
611613
612614static  int  secp256k1_bppp_rangeproof_prove_impl (
@@ -826,6 +828,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
826828    const  unsigned char  *  extra_commit ,
827829    size_t  extra_commit_len 
828830) {
831+     int  res ;
829832    size_t  scratch_checkpoint ;
830833    secp256k1_sha256  transcript ;
831834    size_t  num_digits  =  n_bits  / secp256k1_bppp_log2 (digit_base );
@@ -982,6 +985,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
982985        num_points  =  6  +  g_offset ;
983986
984987        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 );
985989            return  0 ;
986990        }
987991
@@ -999,7 +1003,7 @@ static int secp256k1_bppp_rangeproof_verify_impl(
9991003        }
10001004        secp256k1_scalar_clear (& c_poly [7 ]);
10011005
1002-         return  secp256k1_bppp_rangeproof_norm_product_verify (
1006+         res   =  secp256k1_bppp_rangeproof_norm_product_verify (
10031007            ctx ,
10041008            scratch ,
10051009            & proof [33 * 4 ],
@@ -1013,6 +1017,8 @@ static int secp256k1_bppp_rangeproof_verify_impl(
10131017            8 ,
10141018            & c_comm 
10151019        );
1020+         secp256k1_scratch_apply_checkpoint (& ctx -> error_callback , scratch , scratch_checkpoint );
1021+         return  res ;
10161022    }
10171023}
10181024
0 commit comments