Browse Source

fix for V-SCT-VUL-002 and V-SCT-VUL-003

main
Kevin Jue 1 year ago
parent
commit
297a82025f
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      goldilocks/base.go

+ 2
- 2
goldilocks/base.go

@ -193,7 +193,7 @@ func (p *Chip) Reduce(x Variable) Variable {
remainder := NewVariable(result[1]) remainder := NewVariable(result[1])
p.RangeCheck(remainder) p.RangeCheck(remainder)
p.api.AssertIsEqual(x, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
p.api.AssertIsEqual(x.Limb, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
return remainder return remainder
} }
@ -218,7 +218,7 @@ func (p *Chip) ReduceWithMaxBits(x Variable, maxNbBits uint64) Variable {
remainder := NewVariable(result[1]) remainder := NewVariable(result[1])
p.RangeCheck(remainder) p.RangeCheck(remainder)
p.api.AssertIsEqual(x, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
p.api.AssertIsEqual(x.Limb, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
return remainder return remainder
} }

Loading…
Cancel
Save