@@ -436,7 +436,7 @@ static int secp256k1_norm_arg_verify(
436
436
return res ;
437
437
}
438
438
439
- void norm_arg_zero (void ) {
439
+ void norm_arg_prove_edge (void ) {
440
440
secp256k1_scalar n_vec [64 ], l_vec [64 ], c_vec [64 ];
441
441
secp256k1_scalar r , q ;
442
442
secp256k1_ge commit ;
@@ -495,23 +495,32 @@ void norm_arg_zero(void) {
495
495
CHECK (secp256k1_norm_arg_verify (scratch , proof , plen , & r , gs , n_vec_len , c_vec , c_vec_len , & commit ));
496
496
secp256k1_bppp_generators_destroy (ctx , gs );
497
497
}
498
+ }
498
499
499
- /* Verify |c| = 0 */
500
- {
501
- unsigned int n_vec_len = 1 ;
502
- unsigned int c_vec_len = 1 ;
503
- secp256k1_bppp_generators * gs = secp256k1_bppp_generators_create (ctx , n_vec_len + c_vec_len );
504
- size_t plen = sizeof (proof );
505
- random_scalar_order (& n_vec [0 ]);
506
- random_scalar_order (& c_vec [0 ]);
507
- random_scalar_order (& l_vec [0 ]);
508
- CHECK (secp256k1_bppp_commit (ctx , scratch , & commit , gs , n_vec , n_vec_len , l_vec , c_vec_len , c_vec , c_vec_len , & q ));
509
- CHECK (secp256k1_norm_arg_prove (scratch , proof , & plen , & r , gs , n_vec , n_vec_len , l_vec , c_vec_len , c_vec , c_vec_len , & commit ));
510
- CHECK (secp256k1_norm_arg_verify (scratch , proof , plen , & r , gs , n_vec_len , c_vec , c_vec_len , & commit ));
511
- CHECK (!secp256k1_norm_arg_verify (scratch , proof , plen , & r , gs , n_vec_len , c_vec , 0 , & commit ));
500
+ /* Verify |c| = 0 */
501
+ void norm_arg_verify_zero_len (void ) {
502
+ secp256k1_scalar n_vec [64 ], l_vec [64 ], c_vec [64 ];
503
+ secp256k1_scalar r , q ;
504
+ secp256k1_ge commit ;
505
+ secp256k1_scratch * scratch = secp256k1_scratch_space_create (ctx , 1000 * 10 ); /* shouldn't need much */
506
+ unsigned char proof [1000 ];
507
+ unsigned int n_vec_len = 1 ;
508
+ unsigned int c_vec_len = 1 ;
509
+ secp256k1_bppp_generators * gs = secp256k1_bppp_generators_create (ctx , n_vec_len + c_vec_len );
510
+ size_t plen = sizeof (proof );
512
511
513
- secp256k1_bppp_generators_destroy (ctx , gs );
514
- }
512
+ random_scalar_order (& r );
513
+ secp256k1_scalar_sqr (& q , & r );
514
+
515
+ random_scalar_order (& n_vec [0 ]);
516
+ random_scalar_order (& c_vec [0 ]);
517
+ random_scalar_order (& l_vec [0 ]);
518
+ CHECK (secp256k1_bppp_commit (ctx , scratch , & commit , gs , n_vec , n_vec_len , l_vec , c_vec_len , c_vec , c_vec_len , & q ));
519
+ CHECK (secp256k1_norm_arg_prove (scratch , proof , & plen , & r , gs , n_vec , n_vec_len , l_vec , c_vec_len , c_vec , c_vec_len , & commit ));
520
+ CHECK (secp256k1_norm_arg_verify (scratch , proof , plen , & r , gs , n_vec_len , c_vec , c_vec_len , & commit ));
521
+ CHECK (!secp256k1_norm_arg_verify (scratch , proof , plen , & r , gs , n_vec_len , c_vec , 0 , & commit ));
522
+
523
+ secp256k1_bppp_generators_destroy (ctx , gs );
515
524
516
525
secp256k1_scratch_space_destroy (ctx , scratch );
517
526
}
@@ -650,7 +659,8 @@ void run_bppp_tests(void) {
650
659
test_bppp_generators_fixed ();
651
660
test_bppp_tagged_hash ();
652
661
653
- norm_arg_zero ();
662
+ norm_arg_prove_edge ();
663
+ norm_arg_verify_zero_len ();
654
664
norm_arg_test (1 , 1 );
655
665
norm_arg_test (1 , 64 );
656
666
norm_arg_test (64 , 1 );
0 commit comments