import type { MlDsaExports, Sha3Exports } from './types.js'; import type { MlDsaParams } from './params.js'; import { type PreHashAlgorithm } from './hashvariant.js'; /** * ML-DSA.Sign_internal, FIPS 204 Algorithm 7. * * Inputs: * sk , encoded signing key (skBytes per parameter set) * MPrime, domain-separated message bytes (caller-built via constructMPrime) * rnd , 32-byte randomness (random for hedged, all-zero for deterministic, * caller-supplied for derand/CAVP) * * Output: σ (sigBytes), encoded per Algorithm 26 (sigEncode). * * Wipe contract: every WASM region that held a secret or secret-derived * intermediate is zeroed before return. TS-side scratch (μ, ρ'', c̃, the * w1 byte slice) wipes via try/finally even on early throw. */ export declare function mldsaSignInternal(mx: MlDsaExports, sx: Sha3Exports, params: MlDsaParams, sk: Uint8Array, MPrime: Uint8Array, rnd: Uint8Array): Uint8Array; /** * HashML-DSA sign, post-prehash. FIPS 204 §5.4 Algorithm 4 lines 22-24. * Builds M' = 0x01 ‖ |ctx| ‖ ctx ‖ OID(algo) ‖ prehash and drives * Sign_internal with the caller-supplied rnd. * * The caller owns `prehash` (it may be a slice of WASM memory, a * caller-controlled digest, or an internally-computed PH_M); this helper * never wipes it. The caller also owns `rnd` (hedged: caller wipes a * freshly-generated value; deterministic: rnd is zeros, no wipe; derand: * caller-supplied per FIPS 204 §3.4 contract). * * The 12 approved pre-hash functions (`algo`) and their OIDs are FIPS 204 * §5.4.1's full catalog. Domain-sep byte 0x01 inside the M' construction * separates HashML-DSA signatures from pure-ML-DSA signatures on the same * key per §3.6.4. */ export declare function signWithPrehash(mx: MlDsaExports, sx: Sha3Exports, params: MlDsaParams, sk: Uint8Array, prehash: Uint8Array, algo: PreHashAlgorithm, ctx: Uint8Array, rnd: Uint8Array): Uint8Array;