Conversation
There was a problem hiding this comment.
💡 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".
| 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(); |
There was a problem hiding this comment.
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 👍 / 👎.
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.