summaryrefslogtreecommitdiffstats
path: root/ssl/s3_enc.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2013-02-01 15:31:50 +0100
committerDr. Stephen Henson <steve@openssl.org>2013-02-06 13:56:15 +0000
commiteeb486a5f41a6d71708f02bb32b07f023f5d5ea7 (patch)
treeaeefc335174eb97e9bb9c97d6547d8ae412a86a7 /ssl/s3_enc.c
parentd7f55e76f2bf963d92ebe494c4a9c29897d626a9 (diff)
ssl/*: remove SSL3_RECORD->orig_len to restore binary compatibility.
Kludge alert. This is arranged by passing padding length in unused bits of SSL3_RECORD->type, so that orig_len can be reconstructed. (cherry picked from commit 8bfd4c659f180a6ce34f21c0e62956b362067fba)
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r--ssl/s3_enc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index 0282ef4620..196f0739d5 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -730,7 +730,7 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
EVP_MD_CTX md_ctx;
const EVP_MD_CTX *hash;
unsigned char *p,rec_char;
- size_t md_size;
+ size_t md_size, orig_len;
int npad;
int t;
@@ -755,6 +755,10 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
md_size=t;
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))
@@ -786,7 +790,7 @@ int n_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 */);
}