DSA mod inverse fix
authorPauli <paul.dale@oracle.com>
Sun, 28 Oct 2018 20:50:51 +0000 (06:50 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 28 Oct 2018 20:51:55 +0000 (06:51 +1000)
commitf1b12b8713a739f27d74e6911580b2e70aea2fa4
tree2c6420aa04857590c1306e5ef43b3ef9de31748b
parentd2953e5e7d8be6e83b35683f41bc0ae971782d16
DSA mod inverse fix

There is a side channel attack against the division used to calculate one of
the modulo inverses in the DSA algorithm.  This change takes advantage of the
primality of the modulo and Fermat's little theorem to calculate the inverse
without leaking information.

Thanks to Samuel Weiser for finding and reporting this.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/7487)

(cherry picked from commit 415c33563528667868c3c653a612e6fc8736fd79)
crypto/dsa/dsa_ossl.c