Skip to content

Commit

Permalink
Merge pull request #349 from zk-passport/fix/circuit-fixes
Browse files Browse the repository at this point in the history
Fix/circuit fixes
  • Loading branch information
0xturboblitz authored Feb 3, 2025
2 parents f04d116 + 0d2ad71 commit 7272b2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pragma circom 2.1.9;

include "../register.circom";

component main { public [ merkle_root ] } = REGISTER(160, 256, 1, 120, 35, 512, 128);
component main { public [ merkle_root ] } = REGISTER(160, 256, 1, 120, 35, 384, 128);
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ include "../FpPowMod.circom";
/// @input signature The RSA signature split into chunks
/// @input hashed The hash of the original message
template VerifyRsaPss65537Sig(CHUNK_SIZE, CHUNK_NUMBER, SALT_LEN, HASH_TYPE, KEY_LENGTH) {
assert((HASH_TYPE == 384 && SALT_LEN == 48) || (HASH_TYPE == 256 && SALT_LEN == 64) || (HASH_TYPE == 256 && SALT_LEN == 32));
assert((HASH_TYPE == 384 && SALT_LEN == 48) || (HASH_TYPE == 256 && SALT_LEN == 64) || (HASH_TYPE == 256 && SALT_LEN == 32) || (HASH_TYPE == 512 && SALT_LEN == 64));

signal input pubkey[CHUNK_NUMBER];
signal input signature[CHUNK_NUMBER];
Expand Down
18 changes: 10 additions & 8 deletions circuits/circuits/utils/passport/signatureVerifier.circom
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ template SignatureVerifier(signatureAlgorithm, n, k) {
rsa65537.modulus <== pubKey;
rsa65537.signature <== signature;

}
if (
} else if (
signatureAlgorithm == 13
|| signatureAlgorithm == 32
|| signatureAlgorithm == 33
Expand All @@ -64,13 +63,14 @@ template SignatureVerifier(signatureAlgorithm, n, k) {
}
rsa3.modulus <== pubKey;
rsa3.signature <== signature;
}
if (
} else if (
signatureAlgorithm == 4
|| signatureAlgorithm == 12
|| signatureAlgorithm == 18
|| signatureAlgorithm == 19
|| signatureAlgorithm == 35
|| signatureAlgorithm == 39
|| signatureAlgorithm == 42
) {
var pubKeyBitsLength = getMinKeyLength(signatureAlgorithm);
var SALT_LEN = HASH_LEN_BITS / 8;
Expand All @@ -80,10 +80,10 @@ template SignatureVerifier(signatureAlgorithm, n, k) {
rsaPss65537ShaVerification.signature <== signature;
rsaPss65537ShaVerification.hashed <== hash; // send the raw hash

}
if (
} else if (
signatureAlgorithm == 16
|| signatureAlgorithm == 17
|| signatureAlgorithm == 43
) {
var pubKeyBitsLength = getMinKeyLength(signatureAlgorithm);
var SALT_LEN = HASH_LEN_BITS / 8;
Expand All @@ -94,8 +94,8 @@ template SignatureVerifier(signatureAlgorithm, n, k) {
rsaPss3ShaVerification.signature <== signature;
rsaPss3ShaVerification.hashed <== hash; // send the raw hash

}
if (signatureAlgorithm == 9
} else if (
signatureAlgorithm == 9
|| signatureAlgorithm == 7
|| signatureAlgorithm == 8
|| signatureAlgorithm == 9
Expand All @@ -116,6 +116,8 @@ template SignatureVerifier(signatureAlgorithm, n, k) {
|| signatureAlgorithm == 44
) {
EcdsaVerifier (signatureAlgorithm, n, k)(signature, pubKey, hash);
} else {
assert(1==0);
}
}

Expand Down

0 comments on commit 7272b2b

Please sign in to comment.