Skip to content

Commit 316f4ba

Browse files
committed
Constant-time: Use value barriers in poly_chknorm
Signed-off-by: Matthias J. Kannwischer <[email protected]>
1 parent f88f034 commit 316f4ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mldsa/poly.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdint.h>
77
#include <string.h>
88

9+
#include "ct.h"
910
#include "debug.h"
1011
#include "fips202/fips202x4.h"
1112
#include "ntt.h"
@@ -253,8 +254,7 @@ int mld_poly_chknorm(const mld_poly *a, int32_t B)
253254
)
254255
{
255256
/* Absolute value */
256-
t = a->coeffs[i] >> 31;
257-
t = a->coeffs[i] - (t & 2 * a->coeffs[i]);
257+
t = mld_ct_abs_i32(a->coeffs[i]);
258258

259259
if (t >= B)
260260
{

0 commit comments

Comments
 (0)