Skip to content

Commit 968a5ea

Browse files
committed
1. Correct conditional compilation tests to include only functions
actually called in each build. 2. Add namespacing to mld_compute_sum_of_products() so works with the multi-level build. Signed-off-by: Rod Chapman <[email protected]>
1 parent e4af543 commit 968a5ea

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

mldsa/src/poly_kl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void mld_poly_uniform_eta(mld_poly *r, const uint8_t seed[MLDSA_CRHBYTES],
468468
#define POLY_UNIFORM_GAMMA1_NBLOCKS \
469469
((MLDSA_POLYZ_PACKEDBYTES + STREAM256_BLOCKBYTES - 1) / STREAM256_BLOCKBYTES)
470470

471-
#if MLD_CONFIG_PARAMETER_SET == 65
471+
#if MLD_CONFIG_PARAMETER_SET == 65 || defined(MLD_CONFIG_SERIAL_FIPS202_ONLY)
472472
MLD_INTERNAL_API
473473
void mld_poly_uniform_gamma1(mld_poly *a, const uint8_t seed[MLDSA_CRHBYTES],
474474
uint16_t nonce)
@@ -495,7 +495,8 @@ void mld_poly_uniform_gamma1(mld_poly *a, const uint8_t seed[MLDSA_CRHBYTES],
495495
mld_zeroize(buf, sizeof(buf));
496496
mld_zeroize(extseed, sizeof(extseed));
497497
}
498-
#endif /* MLD_CONFIG_PARAMETER_SET == 65 */
498+
#endif /* MLD_CONFIG_PARAMETER_SET == 65 || \
499+
defined(MLD_CONFIG_SERIAL_FIPS202_ONLY) */
499500

500501

501502
#if !defined(MLD_CONFIG_SERIAL_FIPS202_ONLY)

mldsa/src/poly_kl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ __contract__(
161161
ensures(array_abs_bound(r3->coeffs, 0, MLDSA_N, MLDSA_ETA + 1))
162162
);
163163

164-
#if MLD_CONFIG_PARAMETER_SET == 65
164+
#if defined(MLD_CONFIG_SERIAL_FIPS202_ONLY)
165165
#define mld_poly_uniform_eta MLD_NAMESPACE_KL(poly_uniform_eta)
166166
/*************************************************
167167
* Name: mld_poly_uniform_eta
@@ -184,8 +184,9 @@ __contract__(
184184
assigns(memory_slice(r, sizeof(mld_poly)))
185185
ensures(array_abs_bound(r->coeffs, 0, MLDSA_N, MLDSA_ETA + 1))
186186
);
187+
#endif
187188

188-
189+
#if MLD_CONFIG_PARAMETER_SET == 65 || defined(MLD_CONFIG_SERIAL_FIPS202_ONLY)
189190
#define mld_poly_uniform_gamma1 MLD_NAMESPACE_KL(poly_uniform_gamma1)
190191
/*************************************************
191192
* Name: mld_poly_uniform_gamma1
@@ -208,7 +209,8 @@ __contract__(
208209
assigns(memory_slice(a, sizeof(mld_poly)))
209210
ensures(array_bound(a->coeffs, 0, MLDSA_N, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1))
210211
);
211-
#endif /* MLD_CONFIG_PARAMETER_SET == 65 */
212+
#endif /* MLD_CONFIG_PARAMETER_SET == 65 || \
213+
defined(MLD_CONFIG_SERIAL_FIPS202_ONLY) */
212214

213215
#define mld_poly_uniform_gamma1_4x MLD_NAMESPACE_KL(poly_uniform_gamma1_4x)
214216
/*************************************************

mldsa/src/polyvec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ void mld_polyvecl_pointwise_acc_montgomery(mld_poly *w, const mld_polyvecl *u,
357357
MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L7 && \
358358
MLD_CONFIG_PARAMETER_SET == 87 */
359359

360+
#define mld_pointwise_sum_of_products \
361+
MLD_NAMESPACE_KL(mld_pointwise_sum_of_products)
360362
static int64_t mld_pointwise_sum_of_products(const mld_polyvecl *u,
361363
const mld_polyvecl *v,
362364
unsigned int i)

0 commit comments

Comments
 (0)