Skip to content

Commit b6cd5ee

Browse files
committed
TEST
Signed-off-by: Hanno Becker <[email protected]>
1 parent 053d0e2 commit b6cd5ee

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

.github/workflows/all.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
permissions:
3737
contents: 'read'
3838
id-token: 'write'
39-
needs: [ base ]
4039
uses: ./.github/workflows/cbmc.yml
4140
secrets: inherit
4241
oqs_integration:

mlkem/indcpa.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void mlk_gen_matrix(mlk_polymat a, const uint8_t seed[MLKEM_SYMBYTES],
228228
* This call writes across mlk_polyvec boundaries for K=2 and K=3.
229229
* This is intentional and safe.
230230
*/
231-
mlk_poly_rej_uniform_x4(&a[i], seed_ext);
231+
mlk_poly_rej_uniform_x4(&a[0][0] + i, seed_ext);
232232
}
233233

234234
/* For MLKEM_K == 3, sample the last entry individually. */
@@ -249,7 +249,7 @@ void mlk_gen_matrix(mlk_polymat a, const uint8_t seed[MLKEM_SYMBYTES],
249249
seed_ext[0][MLKEM_SYMBYTES + 1] = x;
250250
}
251251

252-
mlk_poly_rej_uniform(&a[i], seed_ext[0]);
252+
mlk_poly_rej_uniform(&a[0][0] + i, seed_ext[0]);
253253
i++;
254254
}
255255

@@ -261,7 +261,10 @@ void mlk_gen_matrix(mlk_polymat a, const uint8_t seed[MLKEM_SYMBYTES],
261261
*/
262262
for (i = 0; i < MLKEM_K * MLKEM_K; i++)
263263
{
264-
mlk_poly_permute_bitrev_to_custom(a[i].coeffs);
264+
for (j = 0; i < MLKEM_K * MLKEM_K; i++)
265+
{
266+
mlk_poly_permute_bitrev_to_custom(a[i][j].coeffs);
267+
}
265268
}
266269

267270
/* Specification: Partially implements
@@ -288,15 +291,15 @@ void mlk_gen_matrix(mlk_polymat a, const uint8_t seed[MLKEM_SYMBYTES],
288291
* Specification: Implements [FIPS 203, Section 2.4.7, Eq (2.12), (2.13)]
289292
*
290293
**************************************************/
291-
static void mlk_matvec_mul(mlk_polyvec out, const mlk_polymat a,
294+
static void mlk_matvec_mul(mlk_polyvec out, mlk_polymat a,
292295
const mlk_polyvec v, const mlk_polyvec_mulcache vc)
293296
__contract__(
294297
requires(memory_no_alias(out, sizeof(mlk_polyvec)))
295298
requires(memory_no_alias(a, sizeof(mlk_polymat)))
296299
requires(memory_no_alias(v, sizeof(mlk_polyvec)))
297300
requires(memory_no_alias(vc, sizeof(mlk_polyvec_mulcache)))
298-
requires(forall(k0, 0, MLKEM_K * MLKEM_K,
299-
array_bound(a[k0].coeffs, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT)))
301+
requires(forall(k0, 0, MLKEM_K, forall(k4, 0, MLKEM_K,
302+
array_bound(a[k0][k4].coeffs, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))))
300303
requires(forall(k1, 0, MLKEM_K,
301304
array_abs_bound(v[k1].coeffs, 0, MLKEM_N, MLK_NTT_BOUND)))
302305
requires(forall(k2, 0, MLKEM_K,
@@ -313,7 +316,7 @@ __contract__(
313316
invariant(forall(k, 0, i,
314317
array_abs_bound(out[k].coeffs, 0, MLKEM_N, INT16_MAX/2))))
315318
{
316-
mlk_polyvec_basemul_acc_montgomery_cached(&out[i], &a[MLKEM_K * i], v, vc);
319+
mlk_polyvec_basemul_acc_montgomery_cached(&out[i], a[i], v, vc);
317320
}
318321
}
319322

mlkem/indcpa.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ __contract__(
3636
requires(memory_no_alias(seed, MLKEM_SYMBYTES))
3737
requires(transposed == 0 || transposed == 1)
3838
assigns(object_whole(a))
39-
ensures(forall(x, 0, MLKEM_K * MLKEM_K,
40-
array_bound(a[x].coeffs, 0, MLKEM_N, 0, MLKEM_Q)))
39+
ensures(forall(x, 0, MLKEM_K, forall(y, 0, MLKEM_K,
40+
array_bound(a[x][y].coeffs, 0, MLKEM_N, 0, MLKEM_Q))))
4141
);
4242

4343
#define mlk_indcpa_keypair_derand MLK_NAMESPACE_K(indcpa_keypair_derand)

mlkem/poly_k.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/* End of level namespacing */
2121

2222
typedef mlk_poly mlk_polyvec[MLKEM_K];
23-
typedef mlk_poly mlk_polymat[MLKEM_K * MLKEM_K];
23+
typedef mlk_poly mlk_polymat[MLKEM_K][MLKEM_K];
2424
typedef mlk_poly_mulcache mlk_polyvec_mulcache[MLKEM_K];
2525

2626
#define mlk_poly_compress_du MLK_NAMESPACE_K(poly_compress_du)

proofs/cbmc/matvec_mul/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PROOF_UID = mlk_matvec_mul
1111

1212
DEFINES +=
1313
INCLUDES +=
14+
#UNWINDSET += matvec_mul.0:4
1415

1516
REMOVE_FUNCTION_BODY +=
1617

proofs/cbmc/matvec_mul/matvec_mul_harness.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
#include "poly_k.h"
77

88
#define mlk_matvec_mul MLK_NAMESPACE(matvec_mul)
9-
void mlk_matvec_mul(mlk_polyvec out, const mlk_polymat a, mlk_polyvec const v,
9+
void mlk_matvec_mul(mlk_polyvec out, mlk_polymat a, mlk_polyvec const v,
1010
mlk_polyvec_mulcache const vc);
1111

1212
void harness(void)
1313
{
14-
mlk_poly *out, *a, *v;
14+
mlk_poly *out, *v;
15+
mlk_poly (*a)[MLKEM_K];
1516
mlk_poly_mulcache *vc;
1617
mlk_matvec_mul(out, a, v, vc);
1718
}

0 commit comments

Comments
 (0)