Skip to content

Conversation

@tlepoint
Copy link
Owner

@tlepoint tlepoint commented Feb 1, 2026

Collapse Poly’s runtime state machine into type‑level representations. Today Representation, has_lazy_coefficients, and allow_variable_time_computations drive lots of branching and repeated checks across mod.rs and ops.rs. Split into Poly, Poly, Poly, plus VarTime/ConstTime wrappers, and eliminate override_representation + many runtime panics.

@tlepoint tlepoint marked this pull request as ready for review February 1, 2026 21:30
@tlepoint tlepoint merged commit e0c34a4 into main Feb 1, 2026
6 checks passed
@tlepoint tlepoint deleted the new-poky branch February 1, 2026 21:30
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cb4e06adb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +86 to +88
let ctx = c.ctx().clone();
let c_inner = std::mem::replace(c.as_mut(), Poly::<Ntt>::zero(&ctx));
let c = c_inner.into_power_basis();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve zeroization when converting c to power basis

Here c is a Zeroizing<Poly<…>> built from ciphertext and secret‑key derived products, so it previously got wiped when the guard dropped. The new std::mem::replace moves the sensitive value into c_inner and then into_power_basis() produces a plain Poly that is no longer wrapped, so the secret‑dependent coefficients are now left in memory after this function returns. In a crypto library this is a security regression; to keep the prior behavior, keep the value inside a Zeroizing wrapper (or zeroize after use) rather than moving it out unprotected.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants