ssl/[d1|s3]_pkt.c: harmomize orig_len handling.
authorAndy Polyakov <appro@openssl.org>
Thu, 7 Feb 2013 21:47:05 +0000 (22:47 +0100)
committerAndy Polyakov <appro@openssl.org>
Fri, 8 Feb 2013 09:40:51 +0000 (10:40 +0100)
(cherry picked from commit 8545f73b8919770a5d012fe7a82d6785b69baa27)

ssl/d1_pkt.c
ssl/s3_pkt.c

index 0ad8b5f5590e4936134e28135d4dede948ac8238..429649d2536902ce4df695eed4197519850fcb0b 100644 (file)
@@ -410,7 +410,6 @@ dtls1_process_record(SSL *s)
 
        /* decrypt in place in 'rr->input' */
        rr->data=rr->input;
-       orig_len=rr->length;
 
        enc_err = s->method->ssl3_enc->enc(s,0);
        /* enc_err is:
@@ -442,6 +441,9 @@ printf("\n");
                mac_size=EVP_MD_CTX_size(s->read_hash);
                OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE);
 
+               /* kludge: *_cbc_remove_padding passes padding length in rr->type */
+               orig_len = rr->length+((unsigned int)rr->type>>8);
+
                /* orig_len is the length of the record before any padding was
                 * removed. This is public information, as is the MAC in use,
                 * therefore we can safely process the record in a different
index 64cef2abfae205e50d1bc55c280e20862d46ed7f..f2c413e0ef1dac371b203520613ca24c67ed1425 100644 (file)
@@ -400,7 +400,6 @@ fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length);
 
        /* decrypt in place in 'rr->input' */
        rr->data=rr->input;
-       orig_len=rr->length;
 
        enc_err = s->method->ssl3_enc->enc(s,0);
        /* enc_err is:
@@ -431,6 +430,9 @@ printf("\n");
                mac_size=EVP_MD_CTX_size(s->read_hash);
                OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE);
 
+               /* kludge: *_cbc_remove_padding passes padding length in rr->type */
+               orig_len = rr->length+((unsigned int)rr->type>>8);
+
                /* orig_len is the length of the record before any padding was
                 * removed. This is public information, as is the MAC in use,
                 * therefore we can safely process the record in a different