Skip to content

Fix EvalAtIndexKeyGen hang on extreme rotation indices - #1317

Open
dsuponitskiy wants to merge 2 commits into
devfrom
1254-evalatindexkeygen-hangs
Open

dsuponitskiy wants to merge 2 commits into
devfrom
1254-evalatindexkeygen-hangs

Conversation

@dsuponitskiy

Copy link
Copy Markdown
Collaborator
  • Compute automorphism indices with ModExp instead of one loop iteration per rotation step, and widen before negating since std::abs(INT_MIN) is UB. Wrap the index modulo the slot count, so |index| >= N no longer selects an unrelated automorphism. Reject m that is not a power of two greater than 2.

  • Rotation index parameters become int32_t across FindAutomorphismIndex, EvalFastRotation and EvalFastRotationExt; FindAutomorphismIndices keeps its vector<uint32_t> overload so existing callers still compile.

@dsuponitskiy dsuponitskiy added this to the Release 1.6.0 milestone Sep 15, 2026
@dsuponitskiy dsuponitskiy self-assigned this Sep 15, 2026
@dsuponitskiy dsuponitskiy added the bug Something isn't working label Sep 15, 2026
@dsuponitskiy dsuponitskiy linked an issue Sep 15, 2026 that may be closed by this pull request
@dsuponitskiy
dsuponitskiy force-pushed the 1254-evalatindexkeygen-hangs branch from e726a41 to bbba430 Compare September 16, 2026 13:17
@dsuponitskiy
dsuponitskiy requested review from pascoec and removed request for pascoec September 16, 2026 13:28
@pascoec pascoec modified the milestones: Release 1.6.0, Release 1.6.1 Sep 16, 2026
- Compute automorphism indices with ModExp instead of one loop iteration per rotation step, and widen before negating since std::abs(INT_MIN) is UB.
Wrap the index modulo the slot count, so |index| >= N no longer selects an unrelated automorphism. Reject m that is not a power of two greater than 2.

- Rotation index parameters become int32_t across FindAutomorphismIndex, EvalFastRotation and EvalFastRotationExt; FindAutomorphismIndices keeps its
vector<uint32_t> overload so existing callers still compile.
@dsuponitskiy
dsuponitskiy force-pushed the 1254-evalatindexkeygen-hangs branch from bbba430 to fb050a7 Compare November 11, 2026 18:58

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BFV/BGV EvalAtIndexKeyGen hangs on INT_MIN

3 participants