Skip to content

Commit c87cc96

Browse files
committed
Correct x86 ML-KEM inverse NTT output bound
While integrating the x86 ML-KEM inverse NTT proof into mlkem-native (more specifically when adding the corresponding CBMC contract and trying to prove its adherence to out API contracts), we noticed that the output bound in the HOL-Light specification is off by one: mlkem-native requires < 26632 (8q), while the HOL-Light specification states <= 26632. This commit corrects the specification. No change to the proof is required. - See pq-code-package/mlkem-native#1394 Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 4ea8450 commit c87cc96

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

x86/proofs/mlkem_intt.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ let MLKEM_INTT_CORRECT = prove
11041104
==> let zi =
11051105
read(memory :> bytes16(word_add a (word(2 * i)))) s in
11061106
(ival zi == avx2_inverse_ntt (ival o x) i) (mod &3329) /\
1107-
abs(ival zi) <= &26632))
1107+
abs(ival zi) <= &26631))
11081108
(MAYCHANGE_REGS_AND_FLAGS_PERMITTED_BY_ABI ,,
11091109
MAYCHANGE [ZMM0; ZMM1; ZMM2; ZMM3; ZMM4; ZMM5; ZMM6; ZMM7; ZMM8;
11101110
ZMM9; ZMM10; ZMM11; ZMM12; ZMM13; ZMM14; ZMM15] ,,
@@ -1240,7 +1240,7 @@ let MLKEM_INTT_NOIBT_SUBROUTINE_CORRECT = prove
12401240
==> let zi =
12411241
read(memory :> bytes16(word_add a (word(2 * i)))) s in
12421242
(ival zi == avx2_inverse_ntt (ival o x) i) (mod &3329) /\
1243-
abs(ival zi) <= &26632))
1243+
abs(ival zi) <= &26631))
12441244
(MAYCHANGE [RSP] ,, MAYCHANGE_REGS_AND_FLAGS_PERMITTED_BY_ABI ,,
12451245
MAYCHANGE [memory :> bytes(a, 512)])`,
12461246
let TWEAK_CONV = ONCE_DEPTH_CONV WORDLIST_FROM_MEMORY_CONV in
@@ -1270,7 +1270,7 @@ let MLKEM_INTT_SUBROUTINE_CORRECT = prove
12701270
==> let zi =
12711271
read(memory :> bytes16(word_add a (word(2 * i)))) s in
12721272
(ival zi == avx2_inverse_ntt (ival o x) i) (mod &3329) /\
1273-
abs(ival zi) <= &26632))
1273+
abs(ival zi) <= &26631))
12741274
(MAYCHANGE [RSP] ,, MAYCHANGE_REGS_AND_FLAGS_PERMITTED_BY_ABI ,,
12751275
MAYCHANGE [memory :> bytes(a, 512)])`,
12761276
let TWEAK_CONV = ONCE_DEPTH_CONV WORDLIST_FROM_MEMORY_CONV in
@@ -1315,7 +1315,7 @@ let MLKEM_INTT_NOIBT_WINDOWS_SUBROUTINE_CORRECT = prove
13151315
==> let zi =
13161316
read(memory :> bytes16(word_add a (word(2 * i)))) s in
13171317
(ival zi == avx2_inverse_ntt (ival o x) i) (mod &3329) /\
1318-
abs(ival zi) <= &26632))
1318+
abs(ival zi) <= &26631))
13191319
(MAYCHANGE [RSP] ,, WINDOWS_MAYCHANGE_REGS_AND_FLAGS_PERMITTED_BY_ABI ,,
13201320
MAYCHANGE [memory :> bytes(word_sub stackpointer (word 176), 176)] ,,
13211321
MAYCHANGE [memory :> bytes(a, 512)])`,
@@ -1446,7 +1446,7 @@ let MLKEM_INTT_WINDOWS_SUBROUTINE_CORRECT = prove
14461446
==> let zi =
14471447
read(memory :> bytes16(word_add a (word(2 * i)))) s in
14481448
(ival zi == avx2_inverse_ntt (ival o x) i) (mod &3329) /\
1449-
abs(ival zi) <= &26632))
1449+
abs(ival zi) <= &26631))
14501450
(MAYCHANGE [RSP] ,, WINDOWS_MAYCHANGE_REGS_AND_FLAGS_PERMITTED_BY_ABI ,,
14511451
MAYCHANGE [memory :> bytes(word_sub stackpointer (word 176), 176)] ,,
14521452
MAYCHANGE [memory :> bytes(a, 512)])`,

0 commit comments

Comments
 (0)