mpi: mpi-pow improvements
authorWerner Koch <wk@gnupg.org>
Fri, 18 Oct 2013 08:54:55 +0000 (10:54 +0200)
committerWerner Koch <wk@gnupg.org>
Fri, 18 Oct 2013 08:54:55 +0000 (10:54 +0200)
commitcad8216f9a0b33c9dc84ecc4f385b00045e7b496
treebe5a0880917db2bd31bcc17acdb14c19deb20728
parent0bdf121d1dcf98d7df28af67272caaac07f6f581
mpi: mpi-pow improvements

* mpi/mpi-pow.c (USE_ALGORITHM_SIMPLE_EXPONENTIATION): New.
(mul_mod) [!USE_ALGORITHM_SIMPLE_EXPONENTIATION]: New.
(mpi_powm) [!USE_ALGORITHM_SIMPLE_EXPONENTIATION]: New implementation
of left-to-right k-ary exponentiation.
--

This is a backport from Libgcrypt commit
45aa6131e93fac89d46733b3436d960f35fb99b2

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
    For the Yarom/Falkner flush+reload cache side-channel attack, we
    changed the code so that it always calls the multiplication
    routine (even if we can skip it to get result).  This results some
    performance regression.

    This change is for recovering performance with efficient
    algorithm.

Signed-off-by: Werner Koch <wk@gnupg.org>
mpi/mpi-pow.c