Skip to content


Browse files Browse the repository at this point in the history
crypto/evp: harden RC4_MD5 cipher.
Originally a crash in 32-bit build was reported CHACHA20-POLY1305
cipher. The crash is triggered by truncated packet and is result
of excessive hashing to the edge of accessible memory (or bogus
MAC value is produced if x86 MD5 assembly module is involved). Since
hash operation is read-only it is not considered to be exploitable
beyond a DoS condition.

Thanks to Robert Święcki for report.


Reviewed-by: Rich Salz <>
  • Loading branch information
Andy Polyakov authored and mattcaswell committed Jan 26, 2017
1 parent 8957add commit 51d0090
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crypto/evp/e_rc4_hmac_md5.c
Expand Up @@ -269,6 +269,8 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
len = p[arg - 2] << 8 | p[arg - 1];

if (!ctx->encrypt) {
if (len < MD5_DIGEST_LENGTH)
return -1;
p[arg - 2] = len >> 8;
p[arg - 1] = len;
Expand Down

0 comments on commit 51d0090

Please sign in to comment.