mldsa44_w_approx
stdlib/mersenne61/mldsa/mldsa44_w_approx.nbv only in the mersenne61 field
mldsa44_w_approx(a_hat, v_bits, c, t1)
w_approx = NTT^-1(A_hat NTT(z) - NTT(c) NTT(2^13 t1)) for ML-DSA-44 in the 61 bit Mersenne field (FIPS 204 Algorithm 8, step 7).
Products and sums of values mod q fit in a field element, so every reduction is a single quotient hint (see mldsa_reduce). a_hat holds limbs from mldsa_expand_a, v_bits the 18 bits of each v = gamma1 - z, c the challenge coefficients in {-1, 0, 1} and t1 the public key coefficients. Returns 23 bits per canonical coefficient of w_approx.
- Calls
bits/from_bits,mersenne61/mldsa/mldsa_intt,mersenne61/mldsa/mldsa_ntt_q,mersenne61/mldsa/mldsa_pointwise,slice,valloc- Precompiles
clone!,loop!,wtns!- Used by
mersenne61/mldsa/mldsa44_verify
Source
# w_approx = NTT^-1(A_hat NTT(z) - NTT(c) NTT(2^13 t1)) for ML-DSA-44 in the
# 61 bit Mersenne field (FIPS 204 Algorithm 8, step 7).
#
# Products and sums of values mod q fit in a field element, so every
# reduction is a single quotient hint (see mldsa_reduce). `a_hat` holds limbs
# from mldsa_expand_a, `v_bits` the 18 bits of each v = gamma1 - z, `c` the
# challenge coefficients in {-1, 0, 1} and `t1` the public key coefficients.
# Returns 23 bits per canonical coefficient of w_approx.
(a_hat, v_bits, c, t1)
static Q = 8380417
static K = 4
static L = 4
static GAMMA1 = 131072
let mut v[256 * L]
loop! 256 * L, i {
v[i] = wtns! from_bits(slice((clone! v_bits), 18 * i, 18))
}
# z = gamma1 - v, c = (c + 1) - 1, 2^13 t1
let z_hat = mldsa_ntt_q(v, 262143, 1, GAMMA1, 1)
let c_hat = mldsa_ntt_q(c + valloc(256, 1), 2, 0, Q - 1, 1)
let t_hat = mldsa_ntt_q(t1, 1023, 0, 0, 8192)
let y = mldsa_pointwise(a_hat, z_hat, c_hat, t_hat, K)
mldsa_intt(y)