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