From 3de800cb717624b03ae4660904732708572e3686 Mon Sep 17 00:00:00 2001 From: yash1io Date: Sat, 3 Aug 2024 15:18:07 +0530 Subject: [PATCH] add ctr support for 2^32 blocks --- circuits/ctr.circom | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/circuits/ctr.circom b/circuits/ctr.circom index e2e1977..696d295 100644 --- a/circuits/ctr.circom +++ b/circuits/ctr.circom @@ -117,6 +117,7 @@ template AddCipher(){ // converts iv to counter blocks // iv is 16 bytes template GenerateCounterBlocks(n){ + assert(n < 0xffffffff); signal input iv[16]; signal output counterBlocks[n][4][4]; @@ -131,6 +132,13 @@ template GenerateCounterBlocks(n){ ivr[15] = (ivr[15] + 1)%256; if (ivr[15] == 0){ ivr[14] = (ivr[14] + 1)%256; + if (ivr[14] == 0){ + ivr[13] = (ivr[13] + 1)%256; + if (ivr[13] == 0){ + ivr[12] = (ivr[12] + 1)%256; + } + } } + } } \ No newline at end of file