Skip to content

Commit 01362e3

Browse files
manastasovamkannwischer
authored andcommitted
Add the spec and proof for rej_eta function
Notes:: - rej_eta is static, thus, CHECK_FUNCTION_CONTRACTS is defined as rej_eta instead of $(MLD_NAMESPACE)rej_eta in the Makefile. - rej_eta is static, thus, additional assumptions, such as requires(len <= MLDSA_N && buflen <= (POLY_UNIFORM_ETA_NBLOCKS * STREAM256_BLOCKBYTES)) are made. This accelerates the performance of CBMC proofs. Signed-off-by: manastasova <[email protected]>
1 parent b1b71c1 commit 01362e3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mldsa/poly.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ __contract__(
457457
)
458458
{
459459
unsigned int ctr, pos;
460-
int32_t t0, t1;
460+
uint32_t t0, t1;
461461
DBENCH_START();
462462

463463
ctr = pos = 0;
464464
while (ctr < len && pos < buflen)
465465
__loop__(
466466
invariant(0 <= ctr && ctr <= len && pos <= buflen)
467-
invariant(ctr > 0 ==> array_abs_bound(a, 0, ctr, MLDSA_ETA + 1))
467+
invariant(array_abs_bound(a, 0, ctr, MLDSA_ETA + 1))
468468
)
469469
{
470470
t0 = buf[pos] & 0x0F;
@@ -474,21 +474,21 @@ __contract__(
474474
if (t0 < 15)
475475
{
476476
t0 = t0 - (205 * t0 >> 10) * 5;
477-
a[ctr++] = 2 - t0;
477+
a[ctr++] = 2 - (int32_t)t0;
478478
}
479479
if (t1 < 15 && ctr < len)
480480
{
481481
t1 = t1 - (205 * t1 >> 10) * 5;
482-
a[ctr++] = 2 - t1;
482+
a[ctr++] = 2 - (int32_t)t1;
483483
}
484484
#elif MLDSA_ETA == 4
485485
if (t0 < 9)
486486
{
487-
a[ctr++] = 4 - t0;
487+
a[ctr++] = 4 - (int32_t)t0;
488488
}
489489
if (t1 < 9 && ctr < len)
490490
{
491-
a[ctr++] = 4 - t1;
491+
a[ctr++] = 4 - (int32_t)t1;
492492
}
493493
#else
494494
#error "Invalid value of MLDSA_ETA"

0 commit comments

Comments
 (0)