Browse Source

Make trait SignatureVerifierBuilder

master
Brian Lawrence 6 months ago
parent
commit
4037853be8
2 changed files with 25 additions and 5 deletions
  1. +0
    -2
      src/mod65537.rs
  2. +25
    -3
      src/schnorr_prover.rs

+ 0
- 2
src/mod65537.rs

@ -19,8 +19,6 @@ use crate::schnorr::{SchnorrPublicKey, SchnorrSignature};
type GoldF = GoldilocksField;
#[derive(Debug, Default)]
pub struct Mod65537Generator {
a: Target,

+ 25
- 3
src/schnorr_prover.rs

@ -78,8 +78,30 @@ impl SchnorrPublicKeyTarget {
pub struct SchnorrBuilder {}
impl SchnorrBuilder {
pub fn constrain_sig <
pub trait SignatureVerifierBuilder {
fn constrain_sig <
C: GenericConfig<2, F = GoldF>,
> (
&self,
builder: &mut CircuitBuilder::<GoldF, 2>,
sig: &SchnorrSignatureTarget,
msg: &MessageTarget,
pk: &SchnorrPublicKeyTarget,
);
fn verify_sig <
C: GenericConfig<2, F = GoldF>,
> (
&self,
builder: &mut CircuitBuilder::<GoldF, 2>,
sig: &SchnorrSignatureTarget,
msg: &MessageTarget,
pk: &SchnorrPublicKeyTarget,
) -> BoolTarget;
}
impl SignatureVerifierBuilder for SchnorrBuilder {
fn constrain_sig <
C: GenericConfig<2, F = GoldF>,
> (
&self,
@ -93,7 +115,7 @@ impl SchnorrBuilder {
builder.connect(verification_output.target, true_target.target);
}
pub fn verify_sig <
fn verify_sig <
C: GenericConfig<2, F = GoldF>,
> (
&self,

Loading…
Cancel
Save