Skip to content

Commit 474660e

Browse files
committed
Update READMEs to reflect x86_64 assembly verification coverage
All x86_64 ML-KEM arithmetic intrinsics have been rewritten in assembly and verified, so update the verification claims accordingly. Note that the x86_64 FIPS-202 (Keccak) backend remains in C intrinsics and is not yet covered by proof. Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 6776884 commit 474660e

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ mlkem-native is a secure, fast, and portable C90[^C90] implementation of ML-KEM[
1717
It is a fork of the ML-KEM reference implementation[^REF].
1818

1919
All C code in [mlkem/src/*](mlkem) and [mlkem/src/fips202/*](mlkem/src/fips202) is proved memory-safe (no memory overflow) and type-safe (no integer overflow)
20-
using [CBMC](https://github.com/diffblue/cbmc). All AArch64 assembly is proved functionally correct at the object code level using
21-
[HOL-Light](https://github.com/jrh13/hol-light).
20+
using [CBMC](https://github.com/diffblue/cbmc). All AArch64 assembly and all x86_64 ML-KEM arithmetic assembly is proved functionally correct at the object code level using
21+
[HOL-Light](https://github.com/jrh13/hol-light). The x86_64 FIPS-202 (Keccak) backend is still in C intrinsics and not yet covered by proof.
2222

2323
mlkem-native includes native backends for Arm (64-bit, Neon), Intel/AMD (64-bit, AVX2), and RISC-V (64-bit, RVV). See [benchmarks](https://pq-code-package.github.io/mlkem-native/dev/bench/) for performance data.
2424

@@ -61,9 +61,10 @@ All C code in [mlkem/src/*](mlkem) and [mlkem/src/fips202/*](mlkem/src/fips202)
6161
This uses the [C Bounded Model Checker (CBMC)](https://github.com/diffblue/cbmc) and builds on function contracts and loop invariant annotations
6262
in the source code. See [proofs/cbmc](proofs/cbmc) for details.
6363

64-
All AArch64 assembly is proved functionally correct at the object-code level. This uses the [HOL-Light](https://github.com/jrh13/hol-light)
65-
interactive theorem prover and the [s2n-bignum](https://github.com/awslabs/s2n-bignum/) verification infrastructure (which includes a model of the
66-
relevant parts of the Arm architecture). See [proofs/hol_light/aarch64](proofs/hol_light/aarch64) for details.
64+
All AArch64 assembly and all x86_64 ML-KEM arithmetic assembly is proved functionally correct at the object-code level. This uses the [HOL-Light](https://github.com/jrh13/hol-light)
65+
interactive theorem prover and the [s2n-bignum](https://github.com/awslabs/s2n-bignum/) verification infrastructure (which includes models of the
66+
relevant parts of the Arm and x86 architectures). See [proofs/hol_light](proofs/hol_light) for details.
67+
The x86_64 FIPS-202 (Keccak) backend is still in C intrinsics and not yet covered by proof.
6768

6869
## Security
6970

proofs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ We use the [C Bounded Model Checker (CBMC)](https://github.com/diffblue/cbmc) to
1010

1111
## Assembly verification: HOL-Light
1212

13-
We use the [HOL-Light](https://github.com/jrh13/hol-light) interactive theorem prover alongside the verification infrastructure from [s2n-bignum](https://github.com/awslabs/s2n-bignum) to show the functional correctness of various highly optimized assembly routines in mlkem-native at the object-code level. See [proofs/hol_light/aarch64](hol_light/aarch64).
13+
We use the [HOL-Light](https://github.com/jrh13/hol-light) interactive theorem prover alongside the verification infrastructure from [s2n-bignum](https://github.com/awslabs/s2n-bignum) to show the functional correctness of all AArch64 assembly and all x86_64 ML-KEM arithmetic assembly in mlkem-native at the object-code level. See [proofs/hol_light](hol_light).

proofs/hol_light/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# HOL Light functional correctness proofs
44

5-
This directory contains functional correctness proofs for all of the AArch64 and x86_64 assembly in mlkem-native.
5+
This directory contains functional correctness proofs for all AArch64 assembly and all x86_64 ML-KEM arithmetic assembly in mlkem-native.
66
They are written in the [HOL Light](https://hol-light.github.io/) theorem prover, utilizing the assembly verification
77
infrastructure from [s2n-bignum](https://github.com/awslabs/s2n-bignum).
88

@@ -11,8 +11,7 @@ contains the byte code being verified, as well as the specification that is bein
1111

1212
## Intrinsics
1313

14-
The x86_64 backend still includes some native code written in C intrinsics. This code is **not** covered by proof, currently.
15-
We are working on rewriting all intrinsics code in assembly and verifying it in HOL-Light/s2n-bignum.
14+
The x86_64 FIPS-202 (Keccak) backend is still in C intrinsics and not yet covered by proof.
1615

1716
## Primer
1817

@@ -99,7 +98,9 @@ echo '1+1;;' | nc -w 5 127.0.0.1 2012
9998

10099
## What is covered?
101100

102-
All AArch64 assembly routines used in mlkem-native are covered. Those are:
101+
All AArch64 assembly routines and all x86_64 ML-KEM arithmetic assembly routines used in mlkem-native are covered. The x86_64 FIPS-202 (Keccak) backend is still in C intrinsics and not yet covered; see [above](#intrinsics).
102+
103+
### AArch64
103104

104105
- ML-KEM Arithmetic:
105106
* AArch64 forward NTT: [mlkem_ntt.S](aarch64/mlkem/mlkem_ntt.S)
@@ -119,22 +120,20 @@ All AArch64 assembly routines used in mlkem-native are covered. Those are:
119120

120121
The NTT and invNTT functions are super-optimized using [SLOTHY](https://github.com/slothy-optimizer/slothy/).
121122

122-
All x86_64 assembly routines used in mlkem-native are covered:
123+
### x86_64
123124
- ML-KEM Arithmetic:
124125
* x86_64 forward NTT: [mlkem_ntt.S](x86_64/mlkem/mlkem_ntt.S)
125126
* x86_64 inverse NTT: [mlkem_intt.S](x86_64/mlkem/mlkem_intt.S)
126127
* x86_64 base multiplications: [mlkem_poly_basemul_acc_montgomery_cached_k2.S](x86_64/mlkem/mlkem_poly_basemul_acc_montgomery_cached_k2.S) [mlkem_poly_basemul_acc_montgomery_cached_k3.S](x86_64/mlkem/mlkem_poly_basemul_acc_montgomery_cached_k3.S) [mlkem_poly_basemul_acc_montgomery_cached_k4.S](x86_64/mlkem/mlkem_poly_basemul_acc_montgomery_cached_k4.S)
127128
* x86_64 modular reduction: [mlkem_reduce.S](x86_64/mlkem/mlkem_reduce.S)
128-
* x86_64 polynomial compression: [mlkem_tobytes.S](x86_64/mlkem/mlkem_tobytes.S)
129+
* x86_64 polynomial compression: [mlkem_tobytes.S](x86_64/mlkem/mlkem_tobytes.S) [mlkem_poly_compress_d4.S](x86_64/mlkem/mlkem_poly_compress_d4.S) [mlkem_poly_compress_d5.S](x86_64/mlkem/mlkem_poly_compress_d5.S) [mlkem_poly_compress_d10.S](x86_64/mlkem/mlkem_poly_compress_d10.S) [mlkem_poly_compress_d11.S](x86_64/mlkem/mlkem_poly_compress_d11.S)
129130
* x86_64 rejection sampling: [mlkem_rej_uniform.S](x86_64/mlkem/mlkem_rej_uniform.S)
130131
* x86_64 polynomial deserialization: [mlkem_frombytes.S](x86_64/mlkem/mlkem_frombytes.S)
131132
* x86_64 conversion to Montgomery form: [mlkem_tomont.S](x86_64/mlkem/mlkem_tomont.S)
132133
* x86_64 polynomial unpacking: [mlkem_unpack.S](x86_64/mlkem/mlkem_unpack.S)
133134
* x86_64 'multiplication cache' computation: [mlkem_mulcache_compute.S](x86_64/mlkem/mlkem_mulcache_compute.S)
134135
* x86_64 polynomial decompression: [mlkem_poly_decompress_d4.S](x86_64/mlkem/mlkem_poly_decompress_d4.S) [mlkem_poly_decompress_d5.S](x86_64/mlkem/mlkem_poly_decompress_d5.S) [mlkem_poly_decompress_d10.S](x86_64/mlkem/mlkem_poly_decompress_d10.S) [mlkem_poly_decompress_d11.S](x86_64/mlkem/mlkem_poly_decompress_d11.S)
135136

136-
Note again, though, that parts of the x86_64 backend are still in intrinsics; see [above](#intrinsics).
137-
138137
<!--- bibliography --->
139138
[^HYBRID]: Becker, Kannwischer: Hybrid scalar/vector implementations of Keccak and SPHINCS+ on AArch64, [https://eprint.iacr.org/2022/1243](https://eprint.iacr.org/2022/1243)
140139
[^SLOTHY]: Abdulrahman, Becker, Kannwischer, Klein: SLOTHY superoptimizer, [https://github.com/slothy-optimizer/slothy/](https://github.com/slothy-optimizer/slothy/)

0 commit comments

Comments
 (0)