botan icon indicating copy to clipboard operation
botan copied to clipboard

Refactor: Kyber internals

Open reneme opened this issue 1 year ago • 3 comments

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.

reneme avatar Jan 16 '24 14:01 reneme

Coverage Status

coverage: 92.027% (-0.004%) from 92.031% when pulling a630490afeea3b4d0141d34a3d1aac719238e5a6 on Rohde-Schwarz:refactor/kyber into 11b88e5899ca0a30036f35c57fa94b83d4de10cd on randombit:master.

coveralls avatar Jan 16 '24 15:01 coveralls

Force-pushed after #3888, to fix CI.

reneme avatar Jan 17 '24 07:01 reneme

Rebased and resolved conflicts after #3874 got merged.

reneme avatar Feb 16 '24 15:02 reneme

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.

reneme avatar Mar 19 '24 21:03 reneme

Resolved a conflict with master.

reneme avatar Apr 19 '24 10:04 reneme

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.

reneme avatar Apr 19 '24 10:04 reneme