mpi: fix gcry_mpi_powm for negative base.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 4 Dec 2013 01:03:57 +0000 (10:03 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 4 Dec 2013 01:31:31 +0000 (10:31 +0900)
commitc56080c26186d25dec05f01831494c77d8d07e13
treee2957ceb59382e54d7d438a472782eb519e53933
parent2ff86db2e1b0f6cc22a1ca86037b526c5fa3be51
mpi: fix gcry_mpi_powm for negative base.

* mpi/mpi-pow.c (gcry_mpi_powm) [USE_ALGORITHM_SIMPLE_EXPONENTIATION]:
Fix for the case where BASE is negative.
* tests/mpitests.c (test_powm): Add a test case of (-17)^6 mod 19.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
mpi/mpi-pow.c
tests/mpitests.c