aboutsummaryrefslogtreecommitdiffstats
path: root/ssl/s3_enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r--ssl/s3_enc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index 170953ca8d6a..5d8f8ae52a15 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -504,8 +504,6 @@ int ssl3_enc(SSL *s, int send)
EVP_Cipher(ds,rec->data,rec->input,l);
- rec->orig_len = rec->length;
-
if (s->read_hash != NULL)
mac_size = EVP_MD_size(s->read_hash);
@@ -587,7 +585,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 +606,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 +641,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 */);
}