Files
zeekay d753a24a30 crypto/pq/mldsa: export NewKeyFromSeed for all three parameter sets
Unblocks deterministic ML-DSA key derivation from cSHAKE-derived child
seeds (HD wallet derivation, validator identity, DKG round seeds).

mldsa44, mldsa65, mldsa87 each expose:
  NewKeyFromSeed(seed []byte) (PublicKey, PrivateKey, error)

Seed contract:
  len < 32        -> ErrSeedTooShort (FIPS 204 minimum)
  len == 32       -> used verbatim as xi (FIPS 204 5.1)
  len > 32        -> xi = cSHAKE-256(seed, S=per-set customization)

cSHAKE customization strings ("LUX/FIPS204/MLDSA{44,65,87}/seed") provide
parameter-set domain separation: the same oversized parent seed handed to
all three packages yields three independent keypairs (NIST SP 800-185 3.3).

Each subpackage also re-exports GenerateKey / Sign / Verify so consumers
do not have to import the underlying primitive alongside.

Patch-bump.
2026-05-10 19:56:00 -07:00

27 lines
1.2 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package mldsa is the canonical Lux entry point for ML-DSA
// (Module-Lattice-Based Digital Signature Algorithm, FIPS 204).
//
// Each FIPS 204 parameter set lives in its own subpackage. Choose the
// security level at compile time by importing the right one:
//
// github.com/luxfi/crypto/pq/mldsa/mldsa44 // NIST Level 2
// github.com/luxfi/crypto/pq/mldsa/mldsa65 // NIST Level 3 (recommended)
// github.com/luxfi/crypto/pq/mldsa/mldsa87 // NIST Level 5
//
// Each subpackage exposes:
//
// GenerateKey(rand io.Reader) — random keygen
// NewKeyFromSeed(seed []byte) — deterministic keygen (FIPS 204 §5.1)
// Sign(sk, msg, ctx) ([]byte, error) — domain-separated signing
// Verify(pk, msg, ctx, sig) bool — domain-separated verification
//
// Deterministic keygen is the entry point HD-wallet derivation, validator
// identity provisioning, and DKG round-seed paths use to materialize a
// keypair from a child seed produced by a cSHAKE-derived chain. The
// per-parameter-set constant SeedSize is exactly the FIPS 204 §5.1 ξ
// length (32 bytes).
package mldsa