Files
pulsar/jasmin/lib/polyvec_scalarmul.jinc
zeekay c79fe61d62 consolidate: merge pulsar-mptc submission framework into canonical luxfi/pulsar
Single repo, one canonical impl + spec + proofs + KAT + cut tool.

Per "ONE and ONLY ONE way to do things" the prior dual-repo split
(luxfi/pulsar = production library, luxfi/pulsar-mptc = NIST MPTC
submission framework) is collapsed into a single canonical home at
github.com/luxfi/pulsar. SINGLE-IMPL-PLAN.md (now marked COMPLETED)
describes the steps; this commit lands the final step.

Files moved (89 new):
  16 submission docs (SUBMISSION, NIST-SUBMISSION, SPEC, SUITE,
     PATENTS, AXIOM-INVENTORY, PROOF-CLAIMS, FIPS-TRACEABILITY,
     TRUSTED-COMPUTING-BASE, HANZO-CRYPTO-SUITE, INFORMATION-
     ARCHITECTURE, ROADMAP, CHANGELOG, SYNC-STATUS, STATUS-
     SUBMISSION-READINESS, SINGLE-IMPL-PLAN)
  10 docs/ supplements (ietf-draft-skeleton, magnetar, evaluation,
     patent-claims, x-wing-sig, design-decisions, family-architecture,
     threat-model, nist-mptc-category, patent-notes-draft)
  19 proofs/ (13 EC theories + 2 EC lemmas + 4 metadata/READMEs +
     lean-easycrypt-bridge.md)
  14 jasmin/ (lib/* + ml-dsa-65 fetch + threshold/{combine,round1,
     round2}.jazz + READMEs)
  10 ct/dudect/ (Makefile, combine_ct.go, dudect_combine.c,
     dudect_compat.h, dudect_verify.c, fetch.sh, README, run-
     submission.sh, verify_ct.go) + ct/jasmin-ct-libjade.md
  1 .github/workflows/ci.yml
  1 test/interoperability/n1_class_test.go (19/19 N1 subtests)
  1 bench/results/REPORT.md
  11 scripts/ (cut-submission, check-high-assurance, check-lean-
     bridge, nightly, extract-jasmin-ec, checks/{ec-admits, ec-
     compile, ec-refinement-scaffold, ec-regressions, extraction,
     jasmin}, checks/test/{go-unit, interop, kat, no-secret-logs})

Files merged (16 overlapping, mptc-canonical chosen because newer +
post-rewire-correct; pulsar versions still bore stale "Pulsar-M" /
"pulsarm" branding):
  README.md, BLOCKERS.md, CONTRIBUTING.md, LICENSE, LICENSING.md,
  SECURITY.md, .gitignore, bench/run_all.sh, vectors/dkg.json (v1.0.7
  regen), scripts/{bench,build,gen_vectors,sbom,test}.sh,
  spec/{pulsar,parameters,system-model}.tex,
  CRYPTOGRAPHER-SIGN-OFF.md (path refs).

Pulsar-only spec supplements preserved:
  spec/{blockers,design-decisions,family-architecture,nist-mptc-
  category,patent-notes,threat-model}.tex.

Path rewrites applied: 158 occurrences across 26 files
  github.com/luxfi/pulsar-mptc -> github.com/luxfi/pulsar
  ~/work/lux/pulsar-mptc/      -> ~/work/lux/pulsar/
  luxfi/pulsar-mptc            -> luxfi/pulsar
  pulsar-mptc/                  -> ./

Narrative collapses (no more two-repo framing):
  SUBMISSION.md "At a glance" — single Repository row
  SYNC-STATUS.md — rewritten to single-repo state
  SINGLE-IMPL-PLAN.md — marked COMPLETED 2026-05-18
  HANZO-CRYPTO-SUITE.md — tier 1 row = single canonical home
  scripts/cut-submission.sh — replace/vendor dance removed; cuts
  directly from in-tree canonical sources

go.mod: dropped mptc's replace directive (no longer needed since this
IS the canonical pulsar repo). Module path is github.com/luxfi/pulsar.
Deps: cloudflare/circl v1.6.3, golang.org/x/crypto v0.32.0.

Verification:
  GOWORK=off go build ./...              PASS
  GOWORK=off go test -count=1 ./...      PASS (1.4s)
  GOWORK=off go test -race ./ref/...     PASS (14.7s)
  go test ./test/interoperability/       PASS (19/19 N1 subtests)
  scripts/check-high-assurance.sh        PASS
  scripts/check-lean-bridge.sh           PASS (5/5 bridges)
  scripts/gen_vectors.sh                 byte-identical replay
  scripts/cut-submission.sh --help       PASS
2026-05-18 19:53:08 -07:00

103 lines
3.3 KiB
Plaintext

// Scalar-times-polynomial-vector multiplication over R_q for Pulsar's
// threshold sign.
//
// Pulsar needs to multiply a Montgomery-form scalar lambda (the
// per-party Lagrange coefficient) by polyvecl/polyveck values that
// either are in coefficient domain or in NTT (Montgomery) domain.
//
// libjade's `mult_scalar_vec`/`mult_scalar_veck` (polyvec_end.jinc)
// expect a polynomial f, not a scalar - they do POINTWISE NTT-domain
// multiplication. To scale every coefficient of a polyvec by a single
// scalar lambda we need a different primitive:
//
// poly_scalar_mont(lambda_mont, p, out):
// for k in 0..256:
// out[k] = REDC(lambda_mont * p[k])
//
// This is correct in BOTH domains: scalar multiplication commutes with
// NTT, so the result is the NTT of (lambda * p_coefdomain) if p is in
// NTT domain, and the coefficient-domain form of (lambda * p_coefdomain)
// if p is in coefficient domain.
//
// Constant-time: lambda is PUBLIC in every Pulsar call site (Lagrange
// coefficients are computed from public EvalPoints), and `p` may be
// secret. The routine has straight-line control flow and no
// data-dependent memory accesses by construction.
require "pulsar_params.jinc"
from Jade require "crypto_sign/dilithium/common/amd64/montgomery.jinc"
// Scale a single polynomial by a Montgomery-form scalar.
// out[k] = REDC(lambda_mont * p[k])
// The output coefficients live in Montgomery form. If `p` was in normal
// form, the output is `lambda * p` in Montgomery form, ready for an
// `ifft_to_mont` to bring it to normal form. If `p` was in Montgomery
// form (e.g. NTT output), the output is `lambda * p` still in Mont
// form, ready for a further Montgomery-domain operation.
inline
fn poly_scalar_mont(
reg u32 lambda_mont,
reg ptr u32[Li2_polydeg] p,
reg ptr u32[Li2_polydeg] out)
-> reg ptr u32[Li2_polydeg]
{
reg u64 i;
reg u32 a, r;
reg u64 lam64, prod;
reg u32 prod_redc;
lam64 = (64u) lambda_mont;
?{}, i = #set0_64();
while (i < Li2_polydeg) {
a = p[i];
prod = (64u) a;
prod *= lam64;
prod_redc = montgomery_REDC(prod);
out[i] = prod_redc;
i += 1;
}
return out;
}
// Scale every polynomial of a polyvecl (l = Li2_l polynomials) by a
// scalar lambda (Montgomery form). Result stored in `out`.
inline
fn polyvecl_scalar_mont(
reg u32 lambda_mont,
reg ptr u32[Li2_l * Li2_polydeg] v,
reg ptr u32[Li2_l * Li2_polydeg] out)
-> reg ptr u32[Li2_l * Li2_polydeg]
{
inline int ii;
reg ptr u32[Li2_polydeg] p_in, p_out;
for ii = 0 to Li2_l {
p_in = v[ii * Li2_polydeg : Li2_polydeg];
p_out = out[ii * Li2_polydeg : Li2_polydeg];
p_out = poly_scalar_mont(lambda_mont, p_in, p_out);
out[ii * Li2_polydeg : Li2_polydeg] = p_out;
}
return out;
}
// Same for a polyveck (k = Li2_k polynomials).
inline
fn polyveck_scalar_mont(
reg u32 lambda_mont,
reg ptr u32[Li2_k * Li2_polydeg] v,
reg ptr u32[Li2_k * Li2_polydeg] out)
-> reg ptr u32[Li2_k * Li2_polydeg]
{
inline int ii;
reg ptr u32[Li2_polydeg] p_in, p_out;
for ii = 0 to Li2_k {
p_in = v[ii * Li2_polydeg : Li2_polydeg];
p_out = out[ii * Li2_polydeg : Li2_polydeg];
p_out = poly_scalar_mont(lambda_mont, p_in, p_out);
out[ii * Li2_polydeg : Li2_polydeg] = p_out;
}
return out;
}