Skip to content

Commit 2b60254

Browse files
committed
CBMC: Add x86-64 HOL-Light-based contracts and proofs
- This commit introduces CBMC verification for several x86-64 optimized assembly functions. The contracts for these functions are derived from their corresponding HOL-Light correctness proofs. - For each assembly function, a CBMC contract has been added to `arith_native_x86_64.h`. Additionally, new proof harnesses have been creat to formally verify that the generic C implementations (`*_native`) correctly utilize these assembly backends and adhere to the top-level API contracts. - The following functions now have CBMC proofs based on their HOL-Light specifications: - polyvec_basemul_acc_montgomery_cached_asm_k2/k3/k4: - Pre-conditions: `<= &2 pow 12`(HOL_LIGHT) v.s. `MLKEM_UINT12_LIMIT + 1`(CBMC) - Adds a CBMC pre-condition: `requires(array_abs_bound(a, 0, 4 * MLKEM_N, MLKEM_UINT12_LIMIT +` `1))` - ntt_avx2: - Pre-condition: `<= &8191`(HOL_LIGHT) v.s. `8191 + 1`(CBMC) - Post-condition: `<= &23594`(HOL_LIGHT) v.s. `23594 + 1`(CBMC) - Adds a CBMC pre-condition: `requires(array_abs_bound(r, 0, MLKEM_N, 8192))` - Adds a CBMC post-condition: `ensures(array_abs_bound(r, 0, MLKEM_N, 23595))` - intt_avx2: - Post-condition: `<= &26631` v.s. `26631 + 1`(CBMC) - Adds a CBMC post-condition: `ensures(array_abs_bound(r, 0, MLKEM_N, 26632))` - reduce_avx2: - Post-condition: `< &3329`(HOL_LIGHT) v.s. `3329 == MLKEM_Q`(CBMC) - Adds a CBMC post-condition: `ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))` - tobytes_avx2: - Pre-condition: `num_of_wordlist (MAP word_zx l:(12 word)list))`(HOL_LIGHT) v.s. `MLKEM_UINT12_LIMIT`(CBMC) - Adds a CBMC pre-condition: `requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))` - frombytes_avx2: - Post-conditions: `read (memory :> bytes(a,dimindex(:32) * 12)) s0 = num_of_wordlist (l:(12 word)list)` - Adds a CBMC post-condition: `ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))` - mlk_rej_uniform_asm: - This proof are reference from aarch64 one, and change requires: `requires(buflen % 24 == 0)` to `requires(buflen % 12 == 0)` - mlk_tomont_avx2: - Post conditions: `(ival z_i == (tomont_3329 (ival o x)) i) (mod &3329) /\ abs(ival z_i) <= &3328)` v.s. `ensures(array_abs_bound(r, 0, MLKEM_N, MLKEM_Q))` - Add a CBMC post-condition: `ensures(array_abs_bound(r, 0, MLKEM_N, 3328 + 1))` Signed-off-by: willieyz <[email protected]>
1 parent 3924baf commit 2b60254

File tree

23 files changed

+958
-29
lines changed

23 files changed

+958
-29
lines changed

dev/x86_64/src/arith_native_x86_64.h

Lines changed: 103 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,69 @@
77

88
#include "../../../common.h"
99

10-
#include <immintrin.h>
1110
#include <stdint.h>
1211
#include "consts.h"
1312

1413
#define MLK_AVX2_REJ_UNIFORM_BUFLEN \
1514
(3 * 168) /* REJ_UNIFORM_NBLOCKS * SHAKE128_RATE */
1615

17-
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)
18-
uint64_t mlk_rej_uniform_asm(int16_t *r, const uint8_t *buf, unsigned buflen,
19-
const uint8_t *table);
20-
2116
#define mlk_rej_uniform_table MLK_NAMESPACE(rej_uniform_table)
2217
extern const uint8_t mlk_rej_uniform_table[];
2318

19+
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)
20+
uint64_t mlk_rej_uniform_asm(int16_t *r, const uint8_t *buf, unsigned buflen,
21+
const uint8_t *table)
22+
/* This must be kept in sync with the HOL-Light specification
23+
* in proofs/hol_light/x86/proofs/mlkem_rej_uniform.ml. */
24+
__contract__(
25+
requires(buflen % 12 == 0)
26+
requires(memory_no_alias(buf, buflen))
27+
requires(table == mlk_rej_uniform_table)
28+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
29+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
30+
ensures(return_value <= MLKEM_N)
31+
ensures(array_bound(r, 0, (unsigned) return_value, 0, MLKEM_Q))
32+
);
33+
2434
#define mlk_ntt_avx2 MLK_NAMESPACE(ntt_avx2)
25-
void mlk_ntt_avx2(int16_t *r, const int16_t *mlk_qdata);
35+
void mlk_ntt_avx2(int16_t *r, const int16_t *qdata)
36+
/* This must be kept in sync with the HOL-Light specification
37+
* in proofs/hol_light/x86/proofs/mlkem_ntt.ml */
38+
__contract__(
39+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
40+
requires(array_abs_bound(r, 0, MLKEM_N, 8192))
41+
requires(qdata == mlk_qdata)
42+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
43+
/* check-magic: off */
44+
ensures(array_abs_bound(r, 0, MLKEM_N, 23595))
45+
/* check-magic: on */
46+
);
2647

2748
#define mlk_invntt_avx2 MLK_NAMESPACE(invntt_avx2)
28-
void mlk_invntt_avx2(int16_t *r, const int16_t *mlk_qdata);
49+
void mlk_invntt_avx2(int16_t *r, const int16_t *qdata)
50+
/* This must be kept in sync with the HOL-Light specification
51+
* in proofs/hol_light/x86/proofs/mlkem_intt.ml */
52+
__contract__(
53+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
54+
requires(qdata == mlk_qdata)
55+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
56+
/* check-magic: off */
57+
ensures(array_abs_bound(r, 0, MLKEM_N, 26632))
58+
/* check-magic: on */
59+
);
2960

3061
#define mlk_nttunpack_avx2 MLK_NAMESPACE(nttunpack_avx2)
3162
void mlk_nttunpack_avx2(int16_t *r);
3263

3364
#define mlk_reduce_avx2 MLK_NAMESPACE(reduce_avx2)
34-
void mlk_reduce_avx2(int16_t *r);
65+
void mlk_reduce_avx2(int16_t *r)
66+
/* This must be kept in sync with the HOL-Light specification
67+
* in proofs/hol_light/x86/proofs/mlkem_reduce.ml */
68+
__contract__(
69+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
70+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
71+
ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
72+
);
3573

3674
#define mlk_poly_mulcache_compute_avx2 MLK_NAMESPACE(poly_mulcache_compute_avx2)
3775
void mlk_poly_mulcache_compute_avx2(int16_t *out, const int16_t *in,
@@ -42,30 +80,81 @@ void mlk_poly_mulcache_compute_avx2(int16_t *out, const int16_t *in,
4280
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(int16_t *r,
4381
const int16_t *a,
4482
const int16_t *b,
45-
const int16_t *b_cache);
83+
const int16_t *b_cache)
84+
/* This must be kept in sync with the HOL-Light specification in
85+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k2.ml.
86+
*/
87+
__contract__(
88+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
89+
requires(memory_no_alias(a, sizeof(int16_t) * 2 * MLKEM_N))
90+
requires(memory_no_alias(b, sizeof(int16_t) * 2 * MLKEM_N))
91+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 2 * (MLKEM_N / 2)))
92+
requires(array_abs_bound(a, 0, 2 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
93+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
94+
);
4695

4796
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k3 \
4897
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k3)
4998
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(int16_t *r,
5099
const int16_t *a,
51100
const int16_t *b,
52-
const int16_t *b_cache);
101+
const int16_t *b_cache)
102+
/* This must be kept in sync with the HOL-Light specification in
103+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k3.ml.
104+
*/
105+
__contract__(
106+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
107+
requires(memory_no_alias(a, sizeof(int16_t) * 3 * MLKEM_N))
108+
requires(memory_no_alias(b, sizeof(int16_t) * 3 * MLKEM_N))
109+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 3 * (MLKEM_N / 2)))
110+
requires(array_abs_bound(a, 0, 3 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
111+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
112+
);
53113

54114
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k4 \
55115
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k4)
56116
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(int16_t *r,
57117
const int16_t *a,
58118
const int16_t *b,
59-
const int16_t *b_cache);
119+
const int16_t *b_cache)
120+
/* This must be kept in sync with the HOL-Light specification in
121+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k4.ml.
122+
*/
123+
__contract__(
124+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
125+
requires(memory_no_alias(a, sizeof(int16_t) * 4 * MLKEM_N))
126+
requires(memory_no_alias(b, sizeof(int16_t) * 4 * MLKEM_N))
127+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 4 * (MLKEM_N / 2)))
128+
requires(array_abs_bound(a, 0, 4 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
129+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
130+
);
60131

61132
#define mlk_ntttobytes_avx2 MLK_NAMESPACE(ntttobytes_avx2)
62-
void mlk_ntttobytes_avx2(uint8_t *r, const int16_t *a);
133+
void mlk_ntttobytes_avx2(uint8_t *r, const int16_t *a)
134+
__contract__(
135+
requires(memory_no_alias(r, MLKEM_POLYBYTES))
136+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
137+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
138+
assigns(object_whole(r))
139+
);
63140

64141
#define mlk_nttfrombytes_avx2 MLK_NAMESPACE(nttfrombytes_avx2)
65-
void mlk_nttfrombytes_avx2(int16_t *r, const uint8_t *a);
142+
void mlk_nttfrombytes_avx2(int16_t *r, const uint8_t *a)
143+
__contract__(
144+
requires(memory_no_alias(a, MLKEM_POLYBYTES))
145+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
146+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
147+
ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
148+
);
66149

67150
#define mlk_tomont_avx2 MLK_NAMESPACE(tomont_avx2)
68-
void mlk_tomont_avx2(int16_t *r, const int16_t *mlk_qdata);
151+
void mlk_tomont_avx2(int16_t *r, const int16_t *qdata)
152+
__contract__(
153+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
154+
requires(qdata == mlk_qdata)
155+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
156+
ensures(array_abs_bound(r, 0, MLKEM_N, 3329))
157+
);
69158

70159
#define mlk_poly_compress_d4_avx2 MLK_NAMESPACE(poly_compress_d4_avx2)
71160
void mlk_poly_compress_d4_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4],

mlkem/src/native/x86_64/src/arith_native_x86_64.h

Lines changed: 103 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,69 @@
77

88
#include "../../../common.h"
99

10-
#include <immintrin.h>
1110
#include <stdint.h>
1211
#include "consts.h"
1312

1413
#define MLK_AVX2_REJ_UNIFORM_BUFLEN \
1514
(3 * 168) /* REJ_UNIFORM_NBLOCKS * SHAKE128_RATE */
1615

17-
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)
18-
uint64_t mlk_rej_uniform_asm(int16_t *r, const uint8_t *buf, unsigned buflen,
19-
const uint8_t *table);
20-
2116
#define mlk_rej_uniform_table MLK_NAMESPACE(rej_uniform_table)
2217
extern const uint8_t mlk_rej_uniform_table[];
2318

19+
#define mlk_rej_uniform_asm MLK_NAMESPACE(rej_uniform_asm)
20+
uint64_t mlk_rej_uniform_asm(int16_t *r, const uint8_t *buf, unsigned buflen,
21+
const uint8_t *table)
22+
/* This must be kept in sync with the HOL-Light specification
23+
* in proofs/hol_light/x86/proofs/mlkem_rej_uniform.ml. */
24+
__contract__(
25+
requires(buflen % 12 == 0)
26+
requires(memory_no_alias(buf, buflen))
27+
requires(table == mlk_rej_uniform_table)
28+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
29+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
30+
ensures(return_value <= MLKEM_N)
31+
ensures(array_bound(r, 0, (unsigned) return_value, 0, MLKEM_Q))
32+
);
33+
2434
#define mlk_ntt_avx2 MLK_NAMESPACE(ntt_avx2)
25-
void mlk_ntt_avx2(int16_t *r, const int16_t *mlk_qdata);
35+
void mlk_ntt_avx2(int16_t *r, const int16_t *qdata)
36+
/* This must be kept in sync with the HOL-Light specification
37+
* in proofs/hol_light/x86/proofs/mlkem_ntt.ml */
38+
__contract__(
39+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
40+
requires(array_abs_bound(r, 0, MLKEM_N, 8192))
41+
requires(qdata == mlk_qdata)
42+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
43+
/* check-magic: off */
44+
ensures(array_abs_bound(r, 0, MLKEM_N, 23595))
45+
/* check-magic: on */
46+
);
2647

2748
#define mlk_invntt_avx2 MLK_NAMESPACE(invntt_avx2)
28-
void mlk_invntt_avx2(int16_t *r, const int16_t *mlk_qdata);
49+
void mlk_invntt_avx2(int16_t *r, const int16_t *qdata)
50+
/* This must be kept in sync with the HOL-Light specification
51+
* in proofs/hol_light/x86/proofs/mlkem_intt.ml */
52+
__contract__(
53+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
54+
requires(qdata == mlk_qdata)
55+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
56+
/* check-magic: off */
57+
ensures(array_abs_bound(r, 0, MLKEM_N, 26632))
58+
/* check-magic: on */
59+
);
2960

3061
#define mlk_nttunpack_avx2 MLK_NAMESPACE(nttunpack_avx2)
3162
void mlk_nttunpack_avx2(int16_t *r);
3263

3364
#define mlk_reduce_avx2 MLK_NAMESPACE(reduce_avx2)
34-
void mlk_reduce_avx2(int16_t *r);
65+
void mlk_reduce_avx2(int16_t *r)
66+
/* This must be kept in sync with the HOL-Light specification
67+
* in proofs/hol_light/x86/proofs/mlkem_reduce.ml */
68+
__contract__(
69+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
70+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
71+
ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_Q))
72+
);
3573

3674
#define mlk_poly_mulcache_compute_avx2 MLK_NAMESPACE(poly_mulcache_compute_avx2)
3775
void mlk_poly_mulcache_compute_avx2(int16_t *out, const int16_t *in,
@@ -42,30 +80,81 @@ void mlk_poly_mulcache_compute_avx2(int16_t *out, const int16_t *in,
4280
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(int16_t *r,
4381
const int16_t *a,
4482
const int16_t *b,
45-
const int16_t *b_cache);
83+
const int16_t *b_cache)
84+
/* This must be kept in sync with the HOL-Light specification in
85+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k2.ml.
86+
*/
87+
__contract__(
88+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
89+
requires(memory_no_alias(a, sizeof(int16_t) * 2 * MLKEM_N))
90+
requires(memory_no_alias(b, sizeof(int16_t) * 2 * MLKEM_N))
91+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 2 * (MLKEM_N / 2)))
92+
requires(array_abs_bound(a, 0, 2 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
93+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
94+
);
4695

4796
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k3 \
4897
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k3)
4998
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(int16_t *r,
5099
const int16_t *a,
51100
const int16_t *b,
52-
const int16_t *b_cache);
101+
const int16_t *b_cache)
102+
/* This must be kept in sync with the HOL-Light specification in
103+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k3.ml.
104+
*/
105+
__contract__(
106+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
107+
requires(memory_no_alias(a, sizeof(int16_t) * 3 * MLKEM_N))
108+
requires(memory_no_alias(b, sizeof(int16_t) * 3 * MLKEM_N))
109+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 3 * (MLKEM_N / 2)))
110+
requires(array_abs_bound(a, 0, 3 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
111+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
112+
);
53113

54114
#define mlk_polyvec_basemul_acc_montgomery_cached_asm_k4 \
55115
MLK_NAMESPACE(polyvec_basemul_acc_montgomery_cached_asm_k4)
56116
void mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(int16_t *r,
57117
const int16_t *a,
58118
const int16_t *b,
59-
const int16_t *b_cache);
119+
const int16_t *b_cache)
120+
/* This must be kept in sync with the HOL-Light specification in
121+
* proofs/hol_light/x86/proofs/mlkem_poly_basemul_acc_montgomery_cached_k4.ml.
122+
*/
123+
__contract__(
124+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
125+
requires(memory_no_alias(a, sizeof(int16_t) * 4 * MLKEM_N))
126+
requires(memory_no_alias(b, sizeof(int16_t) * 4 * MLKEM_N))
127+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 4 * (MLKEM_N / 2)))
128+
requires(array_abs_bound(a, 0, 4 * MLKEM_N, MLKEM_UINT12_LIMIT + 1))
129+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
130+
);
60131

61132
#define mlk_ntttobytes_avx2 MLK_NAMESPACE(ntttobytes_avx2)
62-
void mlk_ntttobytes_avx2(uint8_t *r, const int16_t *a);
133+
void mlk_ntttobytes_avx2(uint8_t *r, const int16_t *a)
134+
__contract__(
135+
requires(memory_no_alias(r, MLKEM_POLYBYTES))
136+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
137+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
138+
assigns(object_whole(r))
139+
);
63140

64141
#define mlk_nttfrombytes_avx2 MLK_NAMESPACE(nttfrombytes_avx2)
65-
void mlk_nttfrombytes_avx2(int16_t *r, const uint8_t *a);
142+
void mlk_nttfrombytes_avx2(int16_t *r, const uint8_t *a)
143+
__contract__(
144+
requires(memory_no_alias(a, MLKEM_POLYBYTES))
145+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
146+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
147+
ensures(array_bound(r, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
148+
);
66149

67150
#define mlk_tomont_avx2 MLK_NAMESPACE(tomont_avx2)
68-
void mlk_tomont_avx2(int16_t *r, const int16_t *mlk_qdata);
151+
void mlk_tomont_avx2(int16_t *r, const int16_t *qdata)
152+
__contract__(
153+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
154+
requires(qdata == mlk_qdata)
155+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
156+
ensures(array_abs_bound(r, 0, MLKEM_N, 3329))
157+
);
69158

70159
#define mlk_poly_compress_d4_avx2 MLK_NAMESPACE(poly_compress_d4_avx2)
71160
void mlk_poly_compress_d4_avx2(uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4],
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) The mlkem-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
include ../Makefile_params.common
5+
6+
HARNESS_ENTRY = harness
7+
HARNESS_FILE = intt_native_x86_64_harness
8+
9+
# This should be a unique identifier for this proof, and will appear on the
10+
# Litani dashboard. It can be human-readable and contain spaces if you wish.
11+
PROOF_UID = intt_native_x86_64
12+
13+
# We need to set MLK_CHECK_APIS as otherwise mlkem/src/native/api.h won't be
14+
# included, which contains the CBMC specifications.
15+
DEFINES += -DMLK_CONFIG_USE_NATIVE_BACKEND_ARITH -DMLK_CONFIG_ARITH_BACKEND_FILE="\"$(SRCDIR)/mlkem/src/native/x86_64/meta.h\"" -DMLK_CHECK_APIS
16+
INCLUDES +=
17+
18+
REMOVE_FUNCTION_BODY +=
19+
UNWINDSET +=
20+
21+
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
22+
PROJECT_SOURCES += $(SRCDIR)/mlkem/src/poly.c $(SRCDIR)/mlkem/src/native/x86_64/src/consts.c
23+
24+
CHECK_FUNCTION_CONTRACTS=mlk_intt_native
25+
USE_FUNCTION_CONTRACTS=mlk_invntt_avx2 mlk_sys_check_capability
26+
APPLY_LOOP_CONTRACTS=on
27+
USE_DYNAMIC_FRAMES=1
28+
29+
# Disable any setting of EXTERNAL_SAT_SOLVER, and choose SMT backend instead
30+
EXTERNAL_SAT_SOLVER=
31+
CBMCFLAGS=--smt2
32+
33+
FUNCTION_NAME = intt_native_x86_64
34+
35+
# If this proof is found to consume huge amounts of RAM, you can set the
36+
# EXPENSIVE variable. With new enough versions of the proof tools, this will
37+
# restrict the number of EXPENSIVE CBMC jobs running at once. See the
38+
# documentation in Makefile.common under the "Job Pools" heading for details.
39+
# EXPENSIVE = true
40+
41+
# This function is large enough to need...
42+
CBMC_OBJECT_BITS = 8
43+
44+
# If you require access to a file-local ("static") function or object to conduct
45+
# your proof, set the following (and do not include the original source file
46+
# ("mlkem/src/poly.c") in PROJECT_SOURCES).
47+
# REWRITTEN_SOURCES = $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i
48+
# include ../Makefile.common
49+
# $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_SOURCE = $(SRCDIR)/mlkem/src/poly.c
50+
# $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_FUNCTIONS = foo bar
51+
# $(PROOFDIR)/<__SOURCE_FILE_BASENAME__>.i_OBJECTS = baz
52+
# Care is required with variables on the left-hand side: REWRITTEN_SOURCES must
53+
# be set before including Makefile.common, but any use of variables on the
54+
# left-hand side requires those variables to be defined. Hence, _SOURCE,
55+
# _FUNCTIONS, _OBJECTS is set after including Makefile.common.
56+
57+
include ../Makefile.common

0 commit comments

Comments
 (0)