Closed thhofer closed 7 years ago
modPowInsecure(1, -1, 1) used to fail in the earlier version of libgmp I had (5.1.0). Took me a while to build the target version (6.1.1) on Windows (sigh). I've fixed the text values so that they make sense and work.
Hi Thomas!
Thanks for the patch. I took a look, and it seemed like we could open this up even more. Take a look at https://github.com/square/jna-gmp/pull/27
I deleted some test code because I think those cases can now be handled by the small exhaustive tests.
By the way, I think we'd be fine with a windows binary version, but up to now no one's come along and asked for it.
Hi!
I've considered including the secure version here, but I feel this approach would leak the sign byte of the exponent to a timing attack. This might be acceptable but I didn't feel comfortable making this call on my own.
Allow negative exponents in calls for modPowInsecure, by taking the modInverse of the base and negating the exponent. Yields the expected ArithmeticException when the value cannot be inverted.