提交 8ea92ddd 编写于 作者: A Andy Polyakov

e_rc4_hmac_md5.c: last commit was inappropriate for non-x86[_64] platforms.

PR: 2792
上级 d9a9d10f
...@@ -121,6 +121,7 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ...@@ -121,6 +121,7 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
md5_off = MD5_CBLOCK-key->md.num, md5_off = MD5_CBLOCK-key->md.num,
blocks; blocks;
unsigned int l; unsigned int l;
extern unsigned int OPENSSL_ia32cap_P[];
#endif #endif
size_t plen = key->payload_length; size_t plen = key->payload_length;
...@@ -132,7 +133,8 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ...@@ -132,7 +133,8 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
/* cipher has to "fall behind" */ /* cipher has to "fall behind" */
if (rc4_off>md5_off) md5_off+=MD5_CBLOCK; if (rc4_off>md5_off) md5_off+=MD5_CBLOCK;
if (plen>md5_off && (blocks=(plen-md5_off)/MD5_CBLOCK)) { if (plen>md5_off && (blocks=(plen-md5_off)/MD5_CBLOCK) &&
(OPENSSL_ia32cap_P[0]&(1<<20))==0) {
MD5_Update(&key->md,in,md5_off); MD5_Update(&key->md,in,md5_off);
RC4(&key->ks,rc4_off,in,out); RC4(&key->ks,rc4_off,in,out);
...@@ -172,7 +174,8 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ...@@ -172,7 +174,8 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
if (md5_off>rc4_off) rc4_off += 2*MD5_CBLOCK; if (md5_off>rc4_off) rc4_off += 2*MD5_CBLOCK;
else rc4_off += MD5_CBLOCK; else rc4_off += MD5_CBLOCK;
if (len>rc4_off && (blocks=(len-rc4_off)/MD5_CBLOCK)) { if (len>rc4_off && (blocks=(len-rc4_off)/MD5_CBLOCK) &&
(OPENSSL_ia32cap_P[0]&(1<<20))==0) {
RC4(&key->ks,rc4_off,in,out); RC4(&key->ks,rc4_off,in,out);
MD5_Update(&key->md,out,md5_off); MD5_Update(&key->md,out,md5_off);
...@@ -289,8 +292,6 @@ static EVP_CIPHER r4_hmac_md5_cipher= ...@@ -289,8 +292,6 @@ static EVP_CIPHER r4_hmac_md5_cipher=
const EVP_CIPHER *EVP_rc4_hmac_md5(void) const EVP_CIPHER *EVP_rc4_hmac_md5(void)
{ {
extern unsigned int OPENSSL_ia32cap_P[]; return(&r4_hmac_md5_cipher);
/* RC4_CHAR flag ------------vvvvv */
return(OPENSSL_ia32cap_P[0]&(1<<20) ? NULL : &r4_hmac_md5_cipher);
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册