Skip to content

Comments

store pqcrystals polynomial in secure memory#5362

Open
falko-strenzke wants to merge 2 commits intomasterfrom
polynomial-secmem
Open

store pqcrystals polynomial in secure memory#5362
falko-strenzke wants to merge 2 commits intomasterfrom
polynomial-secmem

Conversation

@falko-strenzke
Copy link
Collaborator

No description provided.

@reneme
Copy link
Collaborator

reneme commented Feb 19, 2026

Note that the PolynomialVector class is tightly coupled with the Polynomial class in a sense that it can borrow its byte storage (that's what the redundant std::span is for). I.e. also the std::vector in the PolynomialVector should be replaced by secure_vector then.

@randombit
Copy link
Owner

How much does this affect performance?

@randombit
Copy link
Owner

Actually @reneme isn't this always of known length namely Trait::N? Why not a std::array?

@reneme
Copy link
Collaborator

reneme commented Feb 23, 2026

Actually @reneme isn't this always of known length namely Trait::N? Why not a std::array?

This was done to allow the Polynomial class to borrow its storage from the PolynomialVector, in which case the array would just be wasted stack space. Essentially, instances of polynomials can be free-standing (owning their own storage in the std::vector) or part of a vector of polynomials where the storage is coalesced into a single (appropriately larger) std::vector in the outer PolynomialVector instance. I'm not 100% sure anymore why we added this complexity, frankly. I believe it was faster.

Anyway, the computation is always implemented over the std::span<T, Trait::N> to let the compiler leverage the statically known bounds.

@coveralls
Copy link

Coverage Status

coverage: 90.335% (-1.6%) from 91.974%
when pulling b312daa on polynomial-secmem
into b4032cd on master.

@falko-strenzke falko-strenzke marked this pull request as ready for review February 24, 2026 13:17
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.

4 participants