]> granicus.if.org Git - openssl/commitdiff
bn/bn_exp.c: prefer MULX/AD*X over AVX2.
authorAndy Polyakov <appro@openssl.org>
Wed, 9 Oct 2013 09:08:52 +0000 (11:08 +0200)
committerAndy Polyakov <appro@openssl.org>
Wed, 9 Oct 2013 09:08:52 +0000 (11:08 +0200)
crypto/bn/bn_exp.c

index cfbaf2b66fd10f0c6a9c0831eadc25b81543b953..6e3a7264d5141197dda2ac7d2da3d6546fdc9701 100644 (file)
@@ -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;