Restore function powModSecInteger

Authored by ocheron on Sep 11 2017, 2:12 PM.



The function existed in integer-gmp- but was removed as
part of integer-gmp2 rewrite in Trac #9281. This is to bring it back.

Test Plan

Case integerGmpInternals, with GMP 4.3.2 and GMP 6.1.2

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
ocheron created this revision.Sep 11 2017, 2:12 PM

On things to note:

  • this also restores conditional compilation based on autoconf variable HaveSecurePowm instead of testing GMP version directly. File wrappers.c already has tests on __GNU_MP_VERSION but here the goal is to have the same test in C and Haskell.
  • E == 0 is now listed as supported. This case was working with integer-gmp- and works too in the GMP function.
bgamari requested changes to this revision.Sep 13 2017, 10:50 AM

This looks reasonable, I just want to make sure I understand the powm change.


It's not clear to me what is going on here; can you explain?


Ahh, I guess the configure logic was never even removed.

This revision now requires changes to proceed.Sep 13 2017, 10:50 AM

Added some explanations.


This part is entirely optional: it removes redundancy with the if block above which already tests and deals with a zero exponent.

It's here only because I have the same code in integer_gmp_powm_sec below, and I find it less ambiguous without redundant tests.


Yes, that doesn't mean one should use it, but probably left as decision if needed.

bgamari accepted this revision.Sep 19 2017, 10:58 AM

Okay, looks good to me. Thanks @ocheron!

This revision is now accepted and ready to land.Sep 19 2017, 10:58 AM
This revision was automatically updated to reflect the committed changes.