pq-code-package / mlkem-native

High-assurance, high-performance ML-KEM implementation for mobile, pc, and server targets
https://pq-code-package.github.io/mlkem-native/dev/bench/
Apache License 2.0
11 stars 9 forks source link

Hoist `poly_{,de}compress_du` out of `polyvec_{,de}compress` #435

Closed mkannwischer closed 2 days ago

mkannwischer commented 2 days ago

In preparation of #410.

In ML-KEM, we need 3 types of compressions and their resp. decompression: Compress_du, Compress_dv, and Compress_1.

Currently Compress_dv is implemented in poly_compress, Compress_du is implemented in polyvec_compress (as it's only needed for vectors), and Compress_1 is implemented in poly_tomsg. This is somewhat confusing.

This PR splits up polyvec_compress and polyvec_decompress and hoists out new functions called poly_compress_du and poly_decompress_du.

It also cleans up the naming and CBMC proofs.

It works in the following steps: