Browse Source

Have the issuer consume the messages it receives

This deters accidental reuse of protocol messages.  The client was
already doing this.
Ian Goldberg 3 years ago
parent
commit
987098c14b
2 changed files with 7 additions and 7 deletions
  1. 3 3
      src/ggm.rs
  2. 4 4
      tests/ggm.rs

+ 3 - 3
src/ggm.rs

@@ -188,7 +188,7 @@ pub mod issue_nonblind_5 {
     impl Issuer {
         // Issue a credential with (for example) 5 given attributes.  In
         // this (nonblinded) version, the issuer sees all of the attributes.
-        pub fn issue_nonblind_5(&self, req: &CredentialRequest)
+        pub fn issue_nonblind_5(&self, req: CredentialRequest)
                 -> CredentialResponse {
             let A : &RistrettoPoint = &CMZ_A;
             let B : &RistrettoPoint = &CMZ_B;
@@ -444,7 +444,7 @@ pub mod issue_blind124_5 {
     impl Issuer {
         // Issue a credential with 5 attributes, of which attributes 1, 2,
         // and 4 are blinded from the issuer, and 3 and 5 are visible.
-        pub fn issue_blind124_5(&self, req: &CredentialRequest)
+        pub fn issue_blind124_5(&self, req: CredentialRequest)
                 -> Result<CredentialResponse, ProofError> {
             let A : &RistrettoPoint = &CMZ_A;
             let B : &RistrettoPoint = &CMZ_B;
@@ -717,7 +717,7 @@ pub mod show_blind345_5 {
         // will end up with verified Pedersen commitments Cm3, Cm4, Cm5
         // to the blinded attributes, so that additional things can be
         // proved about those attributes in zero knowledge if desired.
-        pub fn verify_blind345_5(&self, showmsg: &ShowMessage)
+        pub fn verify_blind345_5(&self, showmsg: ShowMessage)
                 -> Result<VerifiedCredential, ProofError> {
             let A : &RistrettoPoint = &CMZ_A;
 

+ 4 - 4
tests/ggm.rs

@@ -40,7 +40,7 @@ fn nonblind_5_test() {
     let m4 = Scalar::random(&mut rng);
     let m5 = Scalar::random(&mut rng);
     let (req,state) = issue_nonblind_5::request(&m1, &m2, &m3, &m4, &m5);
-    let resp = issuer.issue_nonblind_5(&req);
+    let resp = issuer.issue_nonblind_5(req);
     let result = issue_nonblind_5::verify(state, resp, &issuer.pubkey);
     assert!(result.is_ok());
 }
@@ -55,7 +55,7 @@ fn blind124_5_test() {
     let m4 = Scalar::random(&mut rng);
     let m5 = Scalar::random(&mut rng);
     let (req,state) = issue_blind124_5::request(&m1, &m2, &m3, &m4, &m5);
-    let resp = issuer.issue_blind124_5(&req);
+    let resp = issuer.issue_blind124_5(req);
     assert!(resp.is_ok());
     let result = issue_blind124_5::verify(state, resp.unwrap(), &issuer.pubkey);
     assert!(result.is_ok());
@@ -71,13 +71,13 @@ fn show_blind345_5_test() {
     let m4 = Scalar::random(&mut rng);
     let m5 = Scalar::random(&mut rng);
     let (req,state) = issue_blind124_5::request(&m1, &m2, &m3, &m4, &m5);
-    let resp = issuer.issue_blind124_5(&req);
+    let resp = issuer.issue_blind124_5(req);
     assert!(resp.is_ok());
     let result = issue_blind124_5::verify(state, resp.unwrap(), &issuer.pubkey);
     assert!(result.is_ok());
     let cred = result.unwrap();
     let showmsg = show_blind345_5::show(&cred, &issuer.pubkey);
-    let showresult = issuer.verify_blind345_5(&showmsg);
+    let showresult = issuer.verify_blind345_5(showmsg);
     assert!(showresult.is_ok());
     let verifiedcred = showresult.unwrap();
     println!("Received credential: {:?}", verifiedcred);