Always use Fermat's Little Theorem in ecdsa_sign_setup.
The case where ec_group_get_mont_data is NULL is only for arbitrary groups
which we now require to be prime order. BN_mod_exp_mont is fine with a NULL
BN_MONT_CTX. It will just compute it. Saves a bit of special-casing.
Also don't mark p-2 as BN_FLG_CONSTTIME as the exponent is public anyway.
(cherry picked from commit 8cf79af7d1497c07bd684764b96c9659e7b32ae1)
(cherry picked from commit 5e7ef724aead3c33184f34ac7c684e9c2a859b87)
2 files changed