Skip to content

Commit

Permalink
Merge pull request #278 from openpassport-org/del/dummy-from-circuits
Browse files Browse the repository at this point in the history
run test
  • Loading branch information
motemotech authored Dec 27, 2024
2 parents b35b853 + 8563343 commit a3cbd17
Show file tree
Hide file tree
Showing 48 changed files with 165 additions and 634 deletions.
1 change: 0 additions & 1 deletion circuits/circuits/disclose/vc_and_disclose.circom
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ template VC_AND_DISCLOSE( nLevels,FORBIDDEN_COUNTRIES_LIST_LENGTH) {
component poseidon_nullifier = PoseidonHash(2);
poseidon_nullifier.in[0] <== secret;
poseidon_nullifier.in[1] <== scope;
poseidon_nullifier.dummy <== 0;
signal output nullifier <== poseidon_nullifier.out;
signal output revealedData_packed[3] <== disclose.revealedData_packed;
signal output older_than[2] <== disclose.older_than;
Expand Down
6 changes: 2 additions & 4 deletions circuits/circuits/dsc/openpassport_dsc.circom
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ template OPENPASSPORT_DSC(signatureAlgorithm, n_dsc, k_dsc, n_csca, k_csca, max_
signal input path[nLevels];
signal input siblings[nLevels];

signal dummy <== 0;

// leaf
signal leaf <== LeafHasher(kScaled)(csca_pubKey, signatureAlgorithm);

Expand All @@ -45,7 +43,7 @@ template OPENPASSPORT_DSC(signatureAlgorithm, n_dsc, k_dsc, n_csca, k_csca, max_
// verify certificate signature
signal hashedCertificate[hashLength] <== ShaBytesDynamic(hashLength, max_cert_bytes)(raw_dsc_cert, raw_dsc_cert_padded_bytes);

SignatureVerifier(signatureAlgorithm, n_csca, k_csca)(hashedCertificate, csca_pubKey, signature, dummy);
SignatureVerifier(signatureAlgorithm, n_csca, k_csca)(hashedCertificate, csca_pubKey, signature);

// verify DSC csca_pubKey
component shiftLeft = VarShiftLeft(max_cert_bytes, dscPubkeyBytesLength); // use select subarray for dscPubKey variable length
Expand All @@ -59,6 +57,6 @@ template OPENPASSPORT_DSC(signatureAlgorithm, n_dsc, k_dsc, n_csca, k_csca, max_

// blinded dsc commitment
signal pubkeyHash <== CustomHasher(k_dsc)(dsc_pubKey);
signal output blinded_dsc_commitment <== PoseidonHash(2)([secret, pubkeyHash], 0);
signal output blinded_dsc_commitment <== PoseidonHash(2)([secret, pubkeyHash]);
}

7 changes: 2 additions & 5 deletions circuits/circuits/prove/openpassport_prove.circom
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, M
signal input secret;
signal input dsc_secret;

signal dummy <== 0;

signal attestation_id <== 1;

signal selectorModeDisclosure <== selector_mode[0];
Expand All @@ -59,7 +57,7 @@ template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, M
isWrongSelectorMode === 0;

// verify passport signature
PassportVerifier(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, MAX_SIGNED_ATTR_PADDED_LEN)(dg1,dg1_hash_offset, dg2_hash, eContent,eContent_padded_length, signed_attr, signed_attr_padded_length, signed_attr_econtent_hash_offset, pubKey, signature, dummy);
PassportVerifier(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, MAX_SIGNED_ATTR_PADDED_LEN)(dg1,dg1_hash_offset, dg2_hash, eContent,eContent_padded_length, signed_attr, signed_attr_padded_length, signed_attr_econtent_hash_offset, pubKey, signature);
// verify passport is not expired
component isValid = IsValid();
isValid.currDate <== current_date;
Expand All @@ -72,7 +70,6 @@ template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, M
component poseidon_hasher = PoseidonHash(2);
poseidon_hasher.in[0] <== signatureHashed;
poseidon_hasher.in[1] <== scope;
poseidon_hasher.dummy <== 0;
signal output nullifier <== poseidon_hasher.out;

// DISCLOSE (optional)
Expand Down Expand Up @@ -116,6 +113,6 @@ template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, M
signal output commitment <== commitmentPrivate * selectorModeCommitment;
// // blinded dsc commitment
signal pubkeyHash <== CustomHasher(kScaled)(pubKey);
signal blindedDscCommitmenPrivate <== PoseidonHash(2)([dsc_secret, pubkeyHash],0);
signal blindedDscCommitmenPrivate <== PoseidonHash(2)([dsc_secret, pubkeyHash]);
signal output blinded_dsc_commitment <== blindedDscCommitmenPrivate * selectorModeBlindedDscCommitment;
}
Loading

0 comments on commit a3cbd17

Please sign in to comment.