Skip to content

Commit

Permalink
bn/bn_exp.c: prefer MULX/AD*X over AVX2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Polyakov committed Oct 9, 2013
1 parent 2d75273 commit 37de2b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/bn/bn_exp.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
* RSAZ exponentiation. For further information see
* crypto/bn/rsaz_exp.c and accompanying assembly modules.
*/
if ((16 == a->top) && (16 == p->top) && (BN_num_bits(m) == 1024)
if (((OPENSSL_ia32cap_P[2]&0x80100) != 0x80100) /* check for MULX/AD*X */
&& (16 == a->top) && (16 == p->top) && (BN_num_bits(m) == 1024)
&& rsaz_avx2_eligible())
{
if (NULL == bn_wexpand(rr, 16)) goto err;
Expand Down

0 comments on commit 37de2b5

Please sign in to comment.