diff options
author | Ben Laurie <ben@links.org> | 2013-01-28 17:33:18 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2013-02-05 16:50:33 +0000 |
commit | b3a959a337b8083bc855623f24cebaf43a477350 (patch) | |
tree | 43d6f17c5ed90d33a78c97a59a6d63b6c67a47eb /ssl/s3_enc.c | |
parent | 2928cb4c82d6516d9e65ede4901a5957d8c39c32 (diff) |
Don't crash when processing a zero-length, TLS >= 1.1 record.
The previous CBC patch was bugged in that there was a path through enc()
in s3_pkt.c/d1_pkt.c which didn't set orig_len. orig_len would be left
at the previous value which could suggest that the packet was a
sufficient length when it wasn't.
(cherry picked from commit 6cb19b7681f600b2f165e4adc57547b097b475fd)
(cherry picked from commit 2c948c1bb218f4ae126e14fd3453d42c62b93235)
Conflicts:
ssl/s3_enc.c
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r-- | ssl/s3_enc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 6471ac4901..a7830a2d43 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -433,6 +433,15 @@ void ssl3_cleanup_key_block(SSL *s) s->s3->tmp.key_block_length=0; } +/* ssl3_enc encrypts/decrypts the record in |s->wrec| / |s->rrec|, respectively. + * + * Returns: + * 0: (in non-constant time) if the record is publically invalid (i.e. too + * short etc). + * 1: if the record's padding is valid / the encryption was successful. + * -1: if the record's padding is invalid or, if sending, an internal error + * occured. + */ int ssl3_enc(SSL *s, int send) { SSL3_RECORD *rec; @@ -503,6 +512,7 @@ int ssl3_enc(SSL *s, int send) if (s->read_hash != NULL) mac_size = EVP_MD_size(s->read_hash); + if ((bs != 1) && !send) return ssl3_cbc_remove_padding(s, rec, bs, mac_size); } |