mirror of
https://github.com/luxfi/threshold.git
synced 2026-10-30 15:15:53 +00:00
saferith.Nat.Cmp mutates limb storage on both sides (resizedLimbs zero-fills the expanded slice and writes a mask) even on the comparison-only path. Two parties sharing the same PublicKey can race when they both encrypt concurrently and both reach the range-check at the top of EncWithNonce. mAbs aliases m's internals for small enough m, so we clone defensively into a per-call scratch Nat before the Cmp. nHalf is already a private clone of pk.nNat (Rsh on the local copy), so it stays. Per CGGMP21 round-trip race-detector findings in the 2026-05-31 audit.