botan
botan copied to clipboard
Refactor: Kyber internals
This is an iteration of the Kyber internals, in preparation of an ML-KEM implementation. Also, it retrofits the helpers we added along the way in the last two years. Most notably: BufferStuffer and BufferSlicer and Strong<> types. Especially the strong types made it possible to restrict the "symmetric algorithms" in kyber_symmetric_primitives.h.
Before, most of the algorithm (i.e. the Polynomial structures) was hidden away in the kyber.cpp compilation unit in the kyber_common module. For added flexibility, I restructured the code into a few distinct header and implementation files. Also, the kyber and kyber_90s modules now moved inside a new internal kyber_round3 module. These changes make room for an upcoming ML-KEM-ipd implementation that reuses as much of the implementation as possible.
The public interface isn't affected by any of those changes.
coverage: 92.027% (-0.004%) from 92.031% when pulling a630490afeea3b4d0141d34a3d1aac719238e5a6 on Rohde-Schwarz:refactor/kyber into 11b88e5899ca0a30036f35c57fa94b83d4de10cd on randombit:master.
Force-pushed after #3888, to fix CI.
Rebased and resolved conflicts after #3874 got merged.
Thanks for the review! We have a further iteration for this in the pipeline, though.
It'll be a few weeks before we're done with it, unfortunately. Currently busy preparing the concluding workshop for BSI's project 481.
Resolved a conflict with master.
I realized that the planned changes, I mentioned last month, can be easily added on top of this. So, let's merge this now and we'll continue working on master.