mldsa44_parse
stdlib/mldsa/mldsa44_parse.nbv
mldsa44_parse(pk, sig)
Decode an ML-DSA-44 public key and signature (FIPS 204 Algorithms 23 and 27) given as byte values, and check the signature response norm.
Returns (pk bits, rho bits, t1 coefficients, ctilde bits, the 18 bits of each v = gamma1 - z, hint bits). Malformed hints and |z| >= gamma1 - beta make the constraints unsatisfiable.
- Calls
bits/bytes_to_bits,bits/from_bits,mldsa/mldsa44_parse_sig,slice- Precompiles
assert_eq!,clone!,len!,loop!,wtns!- Used by
dilithium/mldsa/mldsa44_verify,mersenne61/mldsa/mldsa44_verify,milli/mldsa/mldsa44_verify
Source
# Decode an ML-DSA-44 public key and signature (FIPS 204 Algorithms 23 and
# 27) given as byte values, and check the signature response norm.
#
# Returns (pk bits, rho bits, t1 coefficients, ctilde bits, the 18 bits of each
# v = gamma1 - z, hint bits). Malformed hints and |z| >= gamma1 - beta make
# the constraints unsatisfiable.
(pk, sig)
static K = 4
assert_eq! 1312, len! pk
let pk_bits = bytes_to_bits(pk)
# pkDecode: rho || t1 with 10 bit coefficients
let rho = slice((clone! pk_bits), 0, 256)
let mut t1[256 * K]
loop! 256 * K, i {
t1[i] = wtns! from_bits(slice((clone! pk_bits), 256 + 10 * i, 10))
}
(let ctilde, let v_bits, let h) = mldsa44_parse_sig(sig)
(pk_bits, rho, t1, ctilde, v_bits, h)