Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTT: Simplify computation of zeta index #677

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions mlkem/ntt.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ __contract__(
ensures(array_abs_bound(r, 0, MLKEM_N, (layer + 1) * MLKEM_Q)))
{
unsigned start, k;
/* `layer` is a ghost variable only needed in the CBMC specification */
((void)layer);
/* Twiddle factors for layer n start at index 2^(layer-1) */
k = MLKEM_N / (2 * len);
/* Twiddle factors for layer n are at indices 2^(n-1)..2^n-1. */
k = 1u << (layer - 1);
for (start = 0; start < MLKEM_N; start += 2 * len)
__loop__(
invariant(start < MLKEM_N + 2 * len)
Expand Down Expand Up @@ -172,9 +170,9 @@ __contract__(
ensures(array_abs_bound(r, 0, MLKEM_N, MLKEM_Q)))
{
unsigned start, k;
/* `layer` is a ghost variable used only in the specification */
((void)layer);
k = MLKEM_N / len - 1;
/* Twiddle factors for layer n are at indices 2^(n-1)..2^n-1.
* The inverse NTT uses them in backwards order. */
k = (1u << layer) - 1;
hanno-becker marked this conversation as resolved.
Show resolved Hide resolved
for (start = 0; start < MLKEM_N; start += 2 * len)
__loop__(
invariant(array_abs_bound(r, 0, MLKEM_N, MLKEM_Q))
Expand Down
Loading