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 10:51:09 +0000 (11:51 +0100)
(cherry picked from commit 8545f73b8919770a5d012fe7a82d6785b69baa27)

ssl/d1_pkt.c
ssl/s3_pkt.c

index 9db44c95f9bd843ea98bbd33b4c5beb6e3294130..55765d1cfb846c296ef96095b125cd232bcd421c 100644 (file)
@@ -362,7 +362,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:
@@ -394,6 +393,9 @@ printf("\n");
                mac_size=EVP_MD_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 707738be94c46f7ec29383bd6808e3e1b262a266..ff54ab75fb60f0ceef547fd3c6398e9c0c73ff47 100644 (file)
@@ -351,7 +351,6 @@ again:
 
        /* 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:
@@ -382,6 +381,9 @@ printf("\n");
                mac_size=EVP_MD_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