-
Notifications
You must be signed in to change notification settings - Fork 57
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
Some fixes for modular inversion #159
Conversation
It should probably always be |
Hm, in some places we also return |
Yeah, subtle's use of I don't really have a better suggestion for |
It's more of a question, whether we should return |
|
Ok, updated to |
I wonder if it even makes sense to define some |
@fjarri sounds like a great idea! |
More things that could be done here:
|
Just in case there's an ambiguity: those things could be done, but not necessarily in this PR since it has already overgrown its initial purpose. |
Done. Uint now has (lhs, rhs) signatures too.
Done
Now lives in
Done |
Limb
size ininv_odd_mod()
- was set to 64 (did not cause errors, just made the inversion twice as slow on 32-bit targets)inv_odd_mod_bounded()
for cases of argument/modulus known to be smallinv_odd_mod_option()
- we do not provide such interface for other constant functionsAdditionally:
CtChoice
newtype for constant-time const fnsWord::MAX
with negationsLimb
andUint
: removedct_cmp()
(we never need it in constant-time context,ct_gt()
/ct_lt()
/ct_eq()
are enough), matched const fns withsubtle
trait methods, matched methods betweenLimb
andUint
SignedWord
andSignedWideWord
Uint
objects are taken by reference where they were previously taken by value.