Files
zeekayandHanzo Dev 84272319a4 Make magnetar primitives total over malformed input
Four adversarial inputs each reached a crash or a wrong answer:

- thbsseReconstructGF judged evaluation points by raw value, so x == p
  (the reserved secret point 0 mod p) passed the zero guard and x, x+p
  read as two points instead of one; the same unreduced x also underflowed
  the Lagrange denominator (p + x_i - x_j wraps when x_j > p). Reduce every
  point mod p once and guard on the reduced value.
- VerifyForsThreshold never length-checked the public digest, so a short
  digest panicked inside forsPkFromSig. Refuse it with ErrForsShape, as
  the producing door already does.
- AggregateShareEnvelope indexed ReceivedShares[partyIndex-1]; a zero or
  out-of-range 1-based index wrapped to a huge uint and panicked. An
  unknown party aggregates to the zero row.
- slhVerify handed the zero id slhdsaIDForMode returns for an unknown mode
  straight to circl, which panics. An unrecognised mode is a failed
  verification, not a crash.

Each fix has a regression test in the area's tracked test file.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-21 10:51:38 -07:00
..