@@ -54,9 +54,9 @@ use ark_ff::{
5454 PrimeField ,
5555} ;
5656use ark_serialize:: { CanonicalDeserialize , CanonicalSerialize } ;
57- use ark_std:: { cfg_iter, fmt:: Debug , io :: Write , rand:: RngCore , vec:: Vec , UniformRand } ;
57+ use ark_std:: { cfg_iter, fmt:: Debug , rand:: RngCore , vec:: Vec , UniformRand } ;
5858use digest:: { Digest , DynDigest } ;
59- use schnorr_pok :: { error :: SchnorrError , impl_proof_of_knowledge_of_discrete_log } ;
59+
6060use zeroize:: { Zeroize , ZeroizeOnDrop } ;
6161
6262use core:: iter:: once;
@@ -434,8 +434,6 @@ impl_public_key!(PublicKeyG2, G2Affine, SignatureParamsG1);
434434impl_public_key ! ( PublicKeyG1 , G1Affine , SignatureParamsG2 ) ;
435435impl_keypair ! ( KeypairG2 , G2Projective , PublicKeyG2 , SignatureParamsG1 ) ;
436436impl_keypair ! ( KeypairG1 , G1Projective , PublicKeyG1 , SignatureParamsG2 ) ;
437- impl_proof_of_knowledge_of_discrete_log ! ( PoKSecretKeyInPublicKeyG2 , PoKSecretKeyInPublicKeyG2Proof ) ;
438- impl_proof_of_knowledge_of_discrete_log ! ( PoKSecretKeyInPublicKeyG1 , PoKSecretKeyInPublicKeyG1Proof ) ;
439437
440438#[ serde_as]
441439#[ derive(
@@ -603,7 +601,10 @@ mod tests {
603601 use ark_bls12_381:: Bls12_381 ;
604602 use ark_std:: rand:: { rngs:: StdRng , SeedableRng } ;
605603 use blake2:: Blake2b512 ;
606- use schnorr_pok:: compute_random_oracle_challenge;
604+ use schnorr_pok:: {
605+ compute_random_oracle_challenge,
606+ discrete_log:: { PokDiscreteLog , PokDiscreteLogProtocol } ,
607+ } ;
607608
608609 type Fr = <Bls12_381 as Pairing >:: ScalarField ;
609610
@@ -731,7 +732,7 @@ mod tests {
731732 #[ test]
732733 fn proof_of_knowledge_of_public_key ( ) {
733734 macro_rules! check {
734- ( $group_affine: ident, $protocol_name : ident , $proof_name : ident , $ public_key: ident, $params: ident) => {
735+ ( $group_affine: ident, $public_key: ident, $params: ident) => {
735736 let mut rng = StdRng :: seed_from_u64( 0u64 ) ;
736737 let params = $params:: <Bls12_381 >:: new:: <Blake2b512 >( "test" . as_bytes( ) , 5 ) ;
737738 let seed = [ 0 , 1 , 2 , 10 , 11 ] ;
@@ -742,17 +743,18 @@ mod tests {
742743 let witness = sk. 0 . clone( ) ;
743744 let blinding = Fr :: rand( & mut rng) ;
744745
745- let protocol = $protocol_name:: <<Bls12_381 as Pairing >:: $group_affine>:: init(
746- witness, blinding, base,
747- ) ;
746+ let protocol =
747+ PokDiscreteLogProtocol :: <<Bls12_381 as Pairing >:: $group_affine>:: init(
748+ witness, blinding, base,
749+ ) ;
748750
749751 let mut chal_contrib_prover = vec![ ] ;
750752 protocol
751753 . challenge_contribution( base, & pk. 0 , & mut chal_contrib_prover)
752754 . unwrap( ) ;
753755
754756 test_serialization!(
755- $protocol_name <<Bls12_381 as Pairing >:: $group_affine>,
757+ PokDiscreteLogProtocol <<Bls12_381 as Pairing >:: $group_affine>,
756758 protocol
757759 ) ;
758760
@@ -771,23 +773,11 @@ mod tests {
771773 assert_eq!( chal_contrib_prover, chal_contrib_verifier) ;
772774 assert_eq!( challenge_prover, challenge_verifier) ;
773775
774- test_serialization!( $proof_name <<Bls12_381 as Pairing >:: $group_affine>, proof) ;
776+ test_serialization!( PokDiscreteLog <<Bls12_381 as Pairing >:: $group_affine>, proof) ;
775777 } ;
776778 }
777779
778- check ! (
779- G2Affine ,
780- PoKSecretKeyInPublicKeyG2 ,
781- PoKSecretKeyInPublicKeyG2Proof ,
782- PublicKeyG2 ,
783- SignatureParamsG1
784- ) ;
785- check ! (
786- G1Affine ,
787- PoKSecretKeyInPublicKeyG1 ,
788- PoKSecretKeyInPublicKeyG1Proof ,
789- PublicKeyG1 ,
790- SignatureParamsG2
791- ) ;
780+ check ! ( G2Affine , PublicKeyG2 , SignatureParamsG1 ) ;
781+ check ! ( G1Affine , PublicKeyG1 , SignatureParamsG2 ) ;
792782 }
793783}
0 commit comments