ssl/*: remove SSL3_RECORD->orig_len to restore binary compatibility.
[openssl.git] / ssl / s3_enc.c
index 170953ca8d6ae84958ba4300705c2b20ab642b40..409a15b8a75790a48e3860bf99d77cea71a24609 100644 (file)
@@ -587,7 +587,7 @@ int ssl3_mac(SSL *ssl, unsigned char *md, int send)
        EVP_MD_CTX md_ctx;
        const EVP_MD *hash;
        unsigned char *p,rec_char;
-       size_t md_size;
+       size_t md_size, orig_len;
        int npad;
 
        if (send)
@@ -608,6 +608,10 @@ int ssl3_mac(SSL *ssl, unsigned char *md, int send)
        md_size=EVP_MD_size(hash);
        npad=(48/md_size)*md_size;
 
+       /* kludge: ssl3_cbc_remove_padding passes padding length in rec->type */
+       orig_len = rec->length+md_size+((unsigned int)rec->type>>8);
+       rec->type &= 0xff;
+
        if (!send &&
            EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
            ssl3_cbc_record_digest_supported(hash))
@@ -639,7 +643,7 @@ int ssl3_mac(SSL *ssl, unsigned char *md, int send)
                        hash,
                        md, &md_size,
                        header, rec->input,
-                       rec->length + md_size, rec->orig_len,
+                       rec->length + md_size, orig_len,
                        mac_sec, md_size,
                        1 /* is SSLv3 */);
                }