Skip to content

Commit

Permalink
fix: full test passes
Browse files Browse the repository at this point in the history
Also reduced constraints on AESGCTR
  • Loading branch information
Autoparallel committed Nov 1, 2024
1 parent 448a3e1 commit ea59a6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 1 addition & 10 deletions circuits/aes-gcm/nivc/aes-gctr-nivc.circom
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template AESGCTRFOLD(DATA_BYTES, MAX_STACK_HEIGHT) {
last_counter_num.in[i] <== last_counter_bits.out[31 - i];
}

counter <== last_counter_num.out - 1;
counter <== last_counter_num.out;

// TODO (Colin): We can't call this `WriteToIndex` array this many times, it is too expensive.
// write new plain text block.
Expand Down Expand Up @@ -85,13 +85,4 @@ template AESGCTRFOLD(DATA_BYTES, MAX_STACK_HEIGHT) {
step_out[i] <== aes.counter[i - (2 * DATA_BYTES)];
}
}

// get counter
// signal counterAccumulator[TOTAL_BYTES_ACROSS_NIVC];
// component writeCounter = WriteToIndex(TOTAL_BYTES_ACROSS_NIVC, 4);
// writeCounter.array_to_write_to <== cipherTextAccumulator;
// writeCounter.array_to_write_at_index <== aes.counter;
// writeCounter.index <== DATA_BYTES*2;
// writeCounter.out ==> step_out;

}
5 changes: 3 additions & 2 deletions circuits/test/full/full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("NIVC_FULL", async () => {
template: "AESGCTRFOLD",
params: [DATA_BYTES, MAX_STACK_HEIGHT],
});
// console.log("#constraints (AES-GCTR):", await aesCircuit.getConstraintCount()); // TODO (Colin): This is at 1.3M constraints...
console.log("#constraints (AES-GCTR):", await aesCircuit.getConstraintCount());
httpParseAndLockStartLineCircuit = await circomkit.WitnessTester(`ParseAndLockStartLine`, {
file: "http/nivc/parse_and_lock_start_line",
template: "ParseAndLockStartLine",
Expand Down Expand Up @@ -103,7 +103,8 @@ describe("NIVC_FULL", async () => {

// Run the 0th chunk of plaintext
const init_nivc_input = Array(TOTAL_BYTES_ACROSS_NIVC).fill(0); // Blank array to write chunks to and pass through NIVC chain
let pt = http_response_plaintext.slice(16, 16 + 16);
let pt = http_response_plaintext.slice(0, 16);
console.log("pt", pt);
aes_gcm = await aesCircuit.compute({ key: Array(16).fill(0), iv: Array(12).fill(0), plainText: pt, aad: Array(16).fill(0), step_in: init_nivc_input }, ["step_out"]);
for (let i = 1; i < (DATA_BYTES / 16); i++) {
// off by one here
Expand Down

0 comments on commit ea59a6d

Please sign in to comment.