Skip to content

Commit

Permalink
Merge pull request #280 from openpassport-org/feat/move-imports
Browse files Browse the repository at this point in the history
move imports to @zk-email and circomlib
  • Loading branch information
remicolin authored Dec 29, 2024
2 parents 89b533d + ca98342 commit ce6c61e
Show file tree
Hide file tree
Showing 65 changed files with 82 additions and 3,410 deletions.
6 changes: 3 additions & 3 deletions circuits/circuits/dsc/openpassport_dsc.circom
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pragma circom 2.1.9;

include "../utils/circomlib/bitify/bitify.circom";
include "circomlib/circuits/bitify.circom";
include "../utils/circomlib/hasher/shaBytes/shaBytesDynamic.circom";
include "../utils/circomlib/bitify/comparators.circom";
include "circomlib/circuits/comparators.circom";
include "../utils/circomlib/hasher/hash.circom";
include "../utils/circomlib/merkle-trees/binary-merkle-root.circom";
include "../utils/passport/customHashers.circom";
include "../utils/passport/signatureAlgorithm.circom";
include "../utils/passport/signatureVerifier.circom";
include "../utils/circomlib/utils/bytes.circom";
include "@zk-email/circuits/utils/bytes.circom";


template OPENPASSPORT_DSC(signatureAlgorithm, n_dsc, k_dsc, n_csca, k_csca, max_cert_bytes, dscPubkeyBytesLength, nLevels) {
Expand Down
1 change: 1 addition & 0 deletions circuits/circuits/prove/openpassport_prove.circom
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include "../utils/passport/passportVerifier.circom";
include "../utils/passport/disclose/disclose.circom";
include "../utils/passport/disclose/proveCountryIsNotInList.circom";
include "../utils/passport/ofac/ofac_name.circom";
//include "@zk-email/circuits/utils/bytes.circom";

template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, MAX_SIGNED_ATTR_PADDED_LEN, FORBIDDEN_COUNTRIES_LIST_LENGTH) {
var kLengthFactor = getKLengthFactor(signatureAlgorithm);
Expand Down
4 changes: 2 additions & 2 deletions circuits/circuits/utils/circomlib/bigInt/bigInt.circom
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma circom 2.1.6;

include "../bitify/comparators.circom";
include "../bitify/bitify.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "./bigIntFunc.circom";
include "./bigIntOverflow.circom";
include "../int/arithmetic.circom";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma circom 2.1.6;

include "../bitify/comparators.circom";
include "../bitify/bitify.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "./bigInt.circom";
include "./bigIntFunc.circom";
include "../int/arithmetic.circom";
Expand Down
50 changes: 0 additions & 50 deletions circuits/circuits/utils/circomlib/bitify/bitify.circom

This file was deleted.

142 changes: 0 additions & 142 deletions circuits/circuits/utils/circomlib/bitify/comparators.circom

This file was deleted.

99 changes: 1 addition & 98 deletions circuits/circuits/utils/circomlib/bitify/gates.circom
Original file line number Diff line number Diff line change
@@ -1,101 +1,6 @@
/*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
circom is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with circom. If not, see <https://www.gnu.org/licenses/>.
*/
pragma circom 2.0.0;

template XOR() {
signal input a;
signal input b;
signal output out;

out <== a + b - 2*a*b;
}

template AND() {
signal input a;
signal input b;
signal output out;

out <== a*b;
}

template OR() {
signal input a;
signal input b;
signal output out;

out <== a + b - a*b;
}

template NOT() {
signal input in;
signal output out;

out <== 1 + in - 2*in;
}

template NAND() {
signal input a;
signal input b;
signal output out;

out <== 1 - a*b;
}

template NOR() {
signal input a;
signal input b;
signal output out;

out <== a*b + 1 - a - b;
}

template MultiAND(n) {
signal input in[n];
signal output out;
component and1;
component and2;
component ands[2];
if (n==1) {
out <== in[0];
} else if (n==2) {
and1 = AND();
and1.a <== in[0];
and1.b <== in[1];
out <== and1.out;
} else {
and2 = AND();
var n1 = n\2;
var n2 = n-n\2;
ands[0] = MultiAND(n1);
ands[1] = MultiAND(n2);
var i;
for (i=0; i<n1; i++) ands[0].in[i] <== in[i];
for (i=0; i<n2; i++) ands[1].in[i] <== in[n1+i];
and2.a <== ands[0].out;
and2.b <== ands[1].out;
out <== and2.out;
}
}



// * Beginning of the UNAUDITED section *
include "circomlib/circuits/gates.circom";


// Xor for n pairs
Expand All @@ -108,5 +13,3 @@ template Xor2(n) {
out[k] <== in1[k] + in2[k] - 2 * in1[k] * in2[k];
}
}

// * End of the UNAUDITED section *
4 changes: 2 additions & 2 deletions circuits/circuits/utils/circomlib/bitify/operations.circom
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pragma circom 2.1.6;

include "./bitify.circom";
include "circomlib/circuits/bitify.circom";

//------------------------------------------------------------------------------
// calculate bin sum of NUM numbers each LEN BITS
// out is LEN + NUM - 1 LEN bit number

template BinSum(NUM, LEN){
template BinSum_sha1(NUM, LEN){
assert (LEN + NUM - 1 <= 253);
var OUT_LEN = LEN + NUM - 1;
signal input in[NUM][LEN];
Expand Down
4 changes: 2 additions & 2 deletions circuits/circuits/utils/circomlib/ec/curve.circom
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ include "./powers/brainpoolP256r1pows.circom";
include "./powers/brainpoolP384r1pows.circom";
include "./powers/p256pows.circom";
include "./powers/p384pows.circom";
include "../bitify/bitify.circom";
include "../bitify/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "circomlib/circuits/comparators.circom";
include "../int/arithmetic.circom";
include "./get.circom";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma circom 2.1.6;

include "../../bitify/bitify.circom";
include "circomlib/circuits/bitify.circom";

template H(x) {
template H_sha1(x) {
signal output out[32];
var c[5] = [
0x67452301,
Expand All @@ -20,7 +20,7 @@ template H(x) {
}
}

template K(t) {
template K_sha1(t) {
signal output out[32];
var k[4] = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];

Expand Down
Loading

0 comments on commit ce6c61e

Please sign in to comment.