mldsa_pointwise
stdlib/milli/mldsa/mldsa_pointwise.nbv only in the milli field
mldsa_pointwise(a, z_hat, static k)
Products A_hat * z_hat in the NTT domain (FIPS 204 Algorithm 8, step 7).
a holds base 2^10 limbs of A_hat (k x l polynomials, coefficients below q), polynomial (i, s) coefficient m at 3 (256 (l i + s) + m). z_hat holds 23 bits per coefficient of l polynomials. Returns 23 bits per coefficient of the k polynomials sum_s A_hat[i][s] * z_hat[s], values below 2^23 and congruent mod q.
- Calls
mldsa/mldsa_limbs,milli/mldsa/mldsa_reduce,slice- Precompiles
assert_eq!,clone!,div_exact!,len!,loop!- Used by
milli/mldsa/mldsa44_w_approx
Source
# Products A_hat * z_hat in the NTT domain (FIPS 204 Algorithm 8, step 7).
#
# `a` holds base 2^10 limbs of A_hat (k x l polynomials, coefficients below q),
# polynomial (i, s) coefficient m at 3 (256 (l i + s) + m). `z_hat` holds 23
# bits per coefficient of l polynomials. Returns 23 bits per coefficient of
# the k polynomials sum_s A_hat[i][s] * z_hat[s], values below 2^23 and
# congruent mod q.
(a, z_hat, static k)
static l = div_exact! (len! z_hat), 23 * 256
assert_eq! (len! a), 3 * 256 * k * l
# limb bounds: A_hat < q and z_hat < 2^23 have limbs <= (1023, 1023, 7)
static x_max = [
l * 1023 * 1023
l * 2 * 1023 * 1023
l * (2 * 7 * 1023 + 1023 * 1023)
l * 2 * 7 * 1023
l * 7 * 7
]
let mut out[23 * 256 * k]
loop! 256, m {
# limbs of z_hat[s][m]
let mut zl[3 * l]
loop! l, s {
let limbs = mldsa_limbs(slice((clone! z_hat), 23 * (256 * s + m), 23))
loop! 3, t {
zl[3 * s + t] = limbs[t]
}
}
loop! k, i {
let mut x[5]
loop! l, s {
static base = 3 * (256 * (l * i + s) + m)
loop! 3, u {
loop! 3, v {
x[u + v] = x[u + v] + a[base + u] * zl[3 * s + v]
}
}
}
let bits = mldsa_reduce(x, (clone! x_max), 0)
loop! 23, b {
out[23 * (256 * i + m) + b] = bits[b]
}
}
}
out