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)

Bug: 33752052
Change-Id: Ia57cf8b68415742233b5c70e9da901b0f2954e7a
2 files changed