Skip to content

Commit

Permalink
explicitly include circomlib. cloned and installed circomlib in circu…
Browse files Browse the repository at this point in the history
…its directory. Fixes circom-lsp path issues.
  • Loading branch information
thor314 committed Sep 20, 2024
1 parent 7ad6b0c commit 53535d3
Show file tree
Hide file tree
Showing 72 changed files with 31,953 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ target


node_modules/*

build/*
ptau/*
client/node_modules
Expand Down
6 changes: 3 additions & 3 deletions circuits/aes-ctr/cipher.circom
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pragma circom 2.1.9;

include "key_expansion.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "circomlib/circuits/gates.circom";
include "../circomlib/circuits/comparators.circom";
include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/gates.circom";
include "transformations.circom";
include "mix_columns.circom";

Expand Down
4 changes: 3 additions & 1 deletion circuits/aes-ctr/ctr.circom
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pragma circom 2.1.9;

include "cipher.circom";
include "transformations.circom";
// include "../circomlib/circuits/comparators.circom";
// include "comparators.circom";

template EncryptCTR(l,nk){
signal input plainText[l];
Expand Down Expand Up @@ -141,4 +143,4 @@ template GenerateCounterBlocks(n){
}

}
}
}
6 changes: 3 additions & 3 deletions circuits/aes-ctr/mix_columns.circom
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pragma circom 2.1.9;

include "transformations.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "circomlib/circuits/gates.circom";
include "../circomlib/circuits/comparators.circom";
include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/gates.circom";
include "tbox.circom";

// MixColumns: Applies the equation for each column:
Expand Down
2 changes: 1 addition & 1 deletion circuits/aes-ctr/sbox128.circom
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma circom 2.1.9;

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

template SBox128() {
signal input in;
Expand Down
2 changes: 1 addition & 1 deletion circuits/aes-ctr/tbox.circom
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma circom 2.1.9;

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

//tbox[0] =>> multiplication by 2
//tbox[1] =>> multiplication by 3
Expand Down
6 changes: 3 additions & 3 deletions circuits/aes-ctr/transformations.circom
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma circom 2.1.9;

include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "circomlib/circuits/gates.circom";
include "../circomlib/circuits/comparators.circom";
include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/gates.circom";
include "utils.circom";

// ShiftRows: Performs circular left shift on each row
Expand Down
8 changes: 4 additions & 4 deletions circuits/aes-ctr/utils.circom
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pragma circom 2.1.9;

include "sbox128.circom";
include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/bitify.circom";
include "circomlib/circuits/gates.circom";
include "../circomlib/circuits/comparators.circom";
include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/gates.circom";

// Converts an array of bytes to an array of words
template BytesToWords(n) {
Expand Down Expand Up @@ -158,4 +158,4 @@ template XorBits(){
xor[i].b <== b[i];
out[i] <== xor[i].out;
}
}
}
2 changes: 1 addition & 1 deletion circuits/aes-gcm/aes-gcm.circom
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma circom 2.1.9;
include "../aes-ctr/ctr.circom";
include "ghash.circom";
include "../aes-ctr/cipher.circom";
include "circomlib/circuits/bitify.circom";
include "../circomlib/circuits/bitify.circom";
include "utils.circom";
include "gctr.circom";
include "helper_functions.circom";
Expand Down
2 changes: 1 addition & 1 deletion circuits/aes-gcm/gfmulx.circom
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma circom 2.1.9;

// include "circomlib/circuits/gates.circom";
// include "../circomlib/circuits/gates.circom";
include "helper_functions.circom";

// compute x * `in` over ghash polynomial
Expand Down
6 changes: 3 additions & 3 deletions circuits/aes-gcm/helper_functions.circom
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pragma circom 2.1.9;

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

// parse LE bits to int
template ParseLEBytes64() {
Expand Down
4 changes: 2 additions & 2 deletions circuits/aes-gcm/nistgmul.circom
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pragma circom 2.1.9;

include "utils.circom"; // xor
include "circomlib/circuits/comparators.circom"; // isZero
include "../circomlib/circuits/comparators.circom"; // isZero
include "helper_functions.circom"; // bitwise right shift
include "circomlib/circuits/mux1.circom"; // multiplexer
include "../circomlib/circuits/mux1.circom"; // multiplexer
include "../aes-ctr/utils.circom"; // xorbyte

// Algorithm 1: X •Y
Expand Down
4 changes: 2 additions & 2 deletions circuits/aes-gcm/utils.circom
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma circom 2.1.9;

include "circomlib/circuits/comparators.circom";
include "circomlib/circuits/mux1.circom";
include "../circomlib/circuits/comparators.circom";
include "../circomlib/circuits/mux1.circom";

// Increment a 32-bit word, represented as a 4-byte array
//
Expand Down
20 changes: 20 additions & 0 deletions circuits/circomlib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CircomLib
## AES-proof repo authors note:
Circomlib explicitly included to resolve `circom-lsp` linking errors.

## Description

- This repository contains a library of circuit templates.
- All files are copyrighted under 2018 0KIMS association and part of the free software [circom](https://github.com/iden3/circom) (Zero Knowledge Circuit Compiler).
- You can read more about the circom language in [the circom documentation webpage](https://docs.circom.io/).

## Organisation

This respository contains 5 folders:
- `circuits`: it contains the implementation of different cryptographic primitives in circom language.
- `calcpedersenbases`: set of functions in JavaScript used to find a set of points in [Baby Jubjub](https://github.com/barryWhiteHat/baby_jubjub) elliptic curve that serve as basis for the [Pedersen Hash](https://github.com/zcash/zcash/issues/2234).
- `doc`: it contains some circuit schemes in ASCII (must be opened with Monodraw, an ASCII art editor for Mac).
- `src`: it contains similar implementation of circuits in JavaScript.
- `test`: tests.

A description of the specific circuit templates for the `circuit` folder will be soon updated.
Loading

0 comments on commit 53535d3

Please sign in to comment.