Skip to content

Commit

Permalink
Clarify loop conditions in NTT
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Aug 26, 2024
1 parent 79ec696 commit 8857db0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crypto/kyber/pqcrystals_kyber_ref_common/ntt.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ static int16_t fqmul(int16_t a, int16_t b) {
**************************************************/
void ntt(int16_t r[256]) {
unsigned int len, start, j, k;
int16_t t, zeta;

k = 1;
for(len = 128; len >= 2; len >>= 1) {
for(start = 0; start < 256; start = j + len) {
zeta = zetas[k++];
for(start = 0; start < 254; start = j + len) {
const int16_t zeta = zetas[k++];
for(j = start; j < start + len; j++) {
t = fqmul(zeta, r[j + len]);
const int16_t t = fqmul(zeta, r[j + len]);
r[j + len] = r[j] - t;
r[j] = r[j] + t;
}
Expand Down

0 comments on commit 8857db0

Please sign in to comment.