You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks to Eric Cornelissen for discovering and responsibly reporting
this vulnerability.
The problem was that our tonelliShanks algorithm needed to calculate the
number of least significant zeros in p - 1. This was done by shifting
right until the LSB becomes 1. With p == 1, this process never ends,
because p - 1 == 0, sending us into an infinite loop.
This could be a potential vulnerability, because if a modulus can be
controlled by an adversary, they can cause a process to deadlock.
The fix is to simply check if p == 1, and return 0 in that case, which
makes perfect sense mathematically.
Checking the value of the modulus is also fine from a leakage
perspective, because ModSqrt is explicitly allowed to leak the value of
the modulus.
Co-authored-by: Eric Cornelissen <[email protected]>
0 commit comments