Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non-native arithmetic with variable modulus various fixes #1104

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion std/math/emulated/composition.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func decompose(input *big.Int, nbBits uint, res []*big.Int) error {
// then no such underflow happens and s = a-b (mod p) as the padding is multiple
// of p.
func subPadding(modulus *big.Int, bitsPerLimbs uint, overflow uint, nbLimbs uint) []*big.Int {

if modulus.Cmp(big.NewInt(0)) == 0 {
panic("modulus is zero")
}
// first, we build a number nLimbs, such that nLimbs > b;
// here b is defined by its bounds, that is b is an element with nbLimbs of (bitsPerLimbs+overflow)
// so a number nLimbs > b, is simply taking the next power of 2 over this bound .
Expand Down
Loading