Index Mathematics Conjectures nbv lettuce Widgets

mldsa_expand_a

stdlib/mldsa/mldsa_expand_a.nbv

mldsa_expand_a(rho, static k, static l)

ExpandA (FIPS 204 Algorithm 32) for a k x l matrix.

rho holds the 256 bits of the public seed. Returns base 2^10 limbs of A_hat, polynomial (r, s) coefficient m at 3 (256 (l r + s) + m), sampled from rho || s || r.

Calls
mldsa/mldsa_rej_ntt_poly, slice_from_start
Precompiles
assert_eq!, clone!, concat!, len!, loop!, to_bits_static!
Used by
dilithium/mldsa/mldsa44_verify, dilithium/mldsa/mldsa44_verify_static, mersenne61/mldsa/mldsa44_verify, milli/mldsa/mldsa44_verify

Source

# ExpandA (FIPS 204 Algorithm 32) for a k x l matrix.
#
# `rho` holds the 256 bits of the public seed. Returns base 2^10 limbs of
# A_hat, polynomial (r, s) coefficient m at 3 (256 (l r + s) + m), sampled
# from rho || s || r.
(rho, static k, static l)

assert_eq! 256, len! rho
let mut out[3 * 256 * k * l]
loop! k, r {
  loop! l, s {
    let seed = concat! (clone! rho), slice_from_start((to_bits_static! s), 8), slice_from_start((to_bits_static! r), 8)
    let poly = mldsa_rej_ntt_poly(seed)
    static base = 3 * 256 * (l * r + s)
    loop! 3 * 256, i {
      out[base + i] = poly[i]
    }
  }
}
out