e_rc4_hmac_md5.c: oops, can't use rc4_hmac_md5_cipher on legacy Intel CPUs.
[oweals/openssl.git] / crypto / evp / e_rc4_hmac_md5.c
index 1fa2aa2b84bd5e4c4605ccf644b808528fce8761..c25b669cfe49e56d9934fc191ebabba375d79482 100644 (file)
@@ -224,7 +224,7 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
 
                memset (hmac_key,0,sizeof(hmac_key));
 
-               if (arg > sizeof(hmac_key)) {
+               if (arg > (int)sizeof(hmac_key)) {
                        MD5_Init(&key->head);
                        MD5_Update(&key->head,ptr,arg);
                        MD5_Final(hmac_key,&key->head);
@@ -287,6 +287,8 @@ static EVP_CIPHER r4_hmac_md5_cipher=
 
 const EVP_CIPHER *EVP_rc4_hmac_md5(void)
        {
-       return(&r4_hmac_md5_cipher);
+       extern unsigned int OPENSSL_ia32cap_P[];
+       /* RC4_CHAR flag ------------vvvvv */
+       return(OPENSSL_ia32cap_P[0]&(1<<20) ? NULL : &r4_hmac_md5_cipher);
        }
 #endif