Skip to content

Commit 2a0240c

Browse files
committed
Add the safety properties of x86 mlkem_reduce for 4 variants (IBT x Windows)
This patch adds the safety properties of x86 mlkem_reduce for 4 variants: whether it has IBT or not, and whether it has Windows ABI or not. This also has a lot of changes that affect safety proofs other than x86 mlkem_reduce: - The name of PROVE_SAFETY_SPEC is changed to PROVE_SAFETY_SPEC_TAC - The theorem for weakly_valid_component of bytes256 was wrong; I fixed it. - The `mk_safety_spec` takes an extra argument for keeping the MAYCHANGE part of ensures. This is needed if the spec is going to be used for compositional reasoning.
1 parent dcb8fc4 commit 2a0240c

37 files changed

+653
-107
lines changed

arm/proofs/arm.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,11 @@ let ARM_QUICKSIM_TAC execth pats snums =
648648
(* More convenient wrappings of basic simulation flow. *)
649649
(* ------------------------------------------------------------------------- *)
650650

651-
let ARM_SIM_TAC ?(preprocess_tac=ALL_TAC) ?(canonicalize_pc_diff=true)
651+
let ARM_SIM_TAC ?(preprocess_tac:tactic option) ?(canonicalize_pc_diff=true)
652652
execth snums =
653653
REWRITE_TAC(!simulation_precanon_thms) THEN
654-
ENSURES_INIT_TAC "s0" THEN preprocess_tac THEN
654+
ENSURES_INIT_TAC "s0" THEN
655+
(match preprocess_tac with Some t -> t | None -> ALL_TAC) THEN
655656
ARM_STEPS_TAC execth snums THEN
656657
ENSURES_FINAL_STATE_TAC THEN ASM_REWRITE_TAC[] THEN
657658
(if canonicalize_pc_diff then

arm/proofs/bignum_copy_row_from_table.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ needs "arm/proofs/consttime.ml";;
627627
needs "arm/proofs/subroutine_signatures.ml";;
628628

629629
let full_spec,public_vars = mk_safety_spec
630+
~keep_maychanges:false
630631
(assoc "bignum_copy_row_from_table" subroutine_signatures)
631632
BIGNUM_COPY_ROW_FROM_TABLE_SUBROUTINE_CORRECT
632633
BIGNUM_COPY_ROW_FROM_TABLE_EXEC;;

arm/proofs/bignum_copy_row_from_table_16.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ needs "arm/proofs/consttime.ml";;
347347
needs "arm/proofs/subroutine_signatures.ml";;
348348

349349
let full_spec,public_vars = mk_safety_spec
350+
~keep_maychanges:false
350351
(assoc "bignum_copy_row_from_table_16" subroutine_signatures)
351352
BIGNUM_COPY_ROW_FROM_TABLE_16_SUBROUTINE_CORRECT
352353
BIGNUM_COPY_ROW_FROM_TABLE_16_EXEC;;

arm/proofs/bignum_copy_row_from_table_32.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ needs "arm/proofs/consttime.ml";;
373373
needs "arm/proofs/subroutine_signatures.ml";;
374374

375375
let full_spec,public_vars = mk_safety_spec
376+
~keep_maychanges:false
376377
(assoc "bignum_copy_row_from_table_32" subroutine_signatures)
377378
BIGNUM_COPY_ROW_FROM_TABLE_32_SUBROUTINE_CORRECT
378379
BIGNUM_COPY_ROW_FROM_TABLE_32_EXEC;;

arm/proofs/bignum_copy_row_from_table_8n.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ needs "arm/proofs/consttime.ml";;
887887
needs "arm/proofs/subroutine_signatures.ml";;
888888

889889
let full_spec,public_vars = mk_safety_spec
890+
~keep_maychanges:false
890891
(assoc "bignum_copy_row_from_table_8n" subroutine_signatures)
891892
BIGNUM_COPY_ROW_FROM_TABLE_8N_SUBROUTINE_CORRECT
892893
BIGNUM_COPY_ROW_FROM_TABLE_8N_EXEC;;

arm/proofs/bignum_emontredc_8n.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,6 +2956,7 @@ needs "arm/proofs/consttime.ml";;
29562956
needs "arm/proofs/subroutine_signatures.ml";;
29572957

29582958
let full_spec,public_vars = mk_safety_spec
2959+
~keep_maychanges:false
29592960
(assoc "bignum_emontredc_8n" subroutine_signatures)
29602961
BIGNUM_EMONTREDC_8N_SUBROUTINE_CORRECT
29612962
BIGNUM_EMONTREDC_8N_EXEC;;

arm/proofs/bignum_ge.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ needs "arm/proofs/consttime.ml";;
366366
needs "arm/proofs/subroutine_signatures.ml";;
367367

368368
let full_spec,public_vars = mk_safety_spec
369+
~keep_maychanges:false
369370
(assoc "bignum_ge" subroutine_signatures)
370371
BIGNUM_GE_SUBROUTINE_CORRECT
371372
BIGNUM_GE_EXEC;;

arm/proofs/bignum_mul.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ needs "arm/proofs/consttime.ml";;
461461
needs "arm/proofs/subroutine_signatures.ml";;
462462

463463
let full_spec,public_vars = mk_safety_spec
464+
~keep_maychanges:false
464465
(assoc "bignum_mul" subroutine_signatures)
465466
BIGNUM_MUL_SUBROUTINE_CORRECT
466467
BIGNUM_MUL_EXEC;;

arm/proofs/bignum_optsub.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ needs "arm/proofs/consttime.ml";;
197197
needs "arm/proofs/subroutine_signatures.ml";;
198198

199199
let full_spec,public_vars = mk_safety_spec
200+
~keep_maychanges:false
200201
(assoc "bignum_optsub" subroutine_signatures)
201202
BIGNUM_OPTSUB_SUBROUTINE_CORRECT
202203
BIGNUM_OPTSUB_EXEC;;

arm/proofs/bignum_sqr.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ needs "arm/proofs/consttime.ml";;
588588
needs "arm/proofs/subroutine_signatures.ml";;
589589

590590
let full_spec,public_vars = mk_safety_spec
591+
~keep_maychanges:false
591592
(assoc "bignum_sqr" subroutine_signatures)
592593
BIGNUM_SQR_SUBROUTINE_CORRECT
593594
BIGNUM_SQR_EXEC;;

0 commit comments

Comments
 (0)