diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2012-01-18 13:12:08 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2012-01-18 13:12:08 +0000 |
commit | 096327a99a01bdf616a474dfb2a39d6f6474da38 (patch) | |
tree | 4a0a747478d564064bc821cd6eb7227b075597a0 /ssl | |
parent | cc10bcf25e43a097049ca9695ad8059e66b4e29c (diff) |
Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
Thanks to Antonio Martin, Enterprise Secure Access Research and
Development, Cisco Systems, Inc. for discovering this bug and
preparing a fix. (CVE-2012-0050)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/d1_pkt.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c index 83702e5309..b709ebbfaa 100644 --- a/ssl/d1_pkt.c +++ b/ssl/d1_pkt.c @@ -336,6 +336,7 @@ dtls1_process_record(SSL *s) unsigned int mac_size; unsigned char md[EVP_MAX_MD_SIZE]; int decryption_failed_or_bad_record_mac = 0; + unsigned char *mac = NULL; rr= &(s->s3->rrec); @@ -403,19 +404,15 @@ if ( (sess == NULL) || #endif } /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ - if (rr->length < mac_size) + if (rr->length >= mac_size) { -#if 0 /* OK only for stream ciphers */ - al=SSL_AD_DECODE_ERROR; - SSLerr(SSL_F_DTLS1_PROCESS_RECORD,SSL_R_LENGTH_TOO_SHORT); - goto f_err; -#else - decryption_failed_or_bad_record_mac = 1; -#endif + rr->length -= mac_size; + mac = &rr->data[rr->length]; } - rr->length-=mac_size; + else + rr->length = 0; s->method->ssl3_enc->mac(s,md,0); - if (memcmp(md,&(rr->data[rr->length]),mac_size) != 0) + if (mac == NULL || memcmp(md, mac, mac_size) != 0) { decryption_failed_or_bad_record_mac = 1; } |