Skip to content

Commit c8b1a2f

Browse files
authored
Add various hybrid array sizes necessary for Kemeleon (#84)
I am working on implementing an obfuscated encoding for ML-KEM encapsulation keys and ciphertexts and there are several non-standard array sizes that will make inter-operating between the custom library and `ml-kem` significantly easier. These would also be useful if the kemeleon encoding strategy is eventually added as a feature inside the `ml-kem` crate itself. The encoding and decoding algorithms are described in section 2.4 of [_Obfuscated Key Exchange_](https://eprint.iacr.org/2024/1086.pdf) by Günther, Stebila, and Veitch. The output byte array sizes are described in `Table 2` on page 8. Co-authored-by: jmwample <[email protected]>
1 parent 7cfa685 commit c8b1a2f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/sizes.rs

+24
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,17 @@ mod extra_sizes {
818818
pub type U35664 = uint!(0 0 0 0 1 0 1 0 1 1 0 1 0 0 0 1);
819819
pub type U49856 = uint!(0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1);
820820

821+
// Kemeleon ML-KEM Encoding sizes
822+
pub type U749 = uint!(0 0 1 0 1 1 1 0 1 1 0 1);
823+
pub type U781 = uint!(0 0 1 1 0 0 0 0 1 1 0 1);
824+
pub type U877 = uint!(0 0 1 1 0 1 1 0 1 1 0 1);
825+
pub type U1124 = uint!(0 1 0 0 0 1 1 0 0 1 0 0);
826+
pub type U1156 = uint!(0 1 0 0 1 0 0 0 0 1 0 0);
827+
pub type U1252 = uint!(0 1 0 0 1 1 1 0 0 1 0 0);
828+
pub type U1498 = uint!(0 1 0 1 1 1 0 1 1 0 1 0);
829+
pub type U1530 = uint!(0 1 0 1 1 1 1 1 1 0 1 0);
830+
pub type U1626 = uint!(0 1 1 0 0 1 0 1 1 0 1 0);
831+
821832
impl_array_sizes! {
822833
1040 => U1040,
823834
1056 => U1056,
@@ -1027,4 +1038,17 @@ mod extra_sizes {
10271038
35664 => U35664,
10281039
49856 => U49856,
10291040
}
1041+
1042+
// Kemeleon ML-KEM Encoding sizes
1043+
impl_array_sizes! {
1044+
749 => U749,
1045+
781 => U781,
1046+
877 => U877,
1047+
1124 => U1124,
1048+
1156 => U1156,
1049+
1252 => U1252,
1050+
1498 => U1498,
1051+
1530 => U1530,
1052+
1626 => U1626,
1053+
}
10301054
}

0 commit comments

Comments
 (0)