summaryrefslogtreecommitdiffstats
path: root/ssl/t1_enc.c
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2013-01-28 17:33:18 +0000
committerBen Laurie <ben@links.org>2013-01-28 17:33:18 +0000
commit6cb19b7681f600b2f165e4adc57547b097b475fd (patch)
treef0bf30e675c0bbaa29be28db7febd92f1a678936 /ssl/t1_enc.c
parente130841bccfc0bb9da254dc84e23bc6a1c78a64e (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.
Diffstat (limited to 'ssl/t1_enc.c')
-rw-r--r--ssl/t1_enc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
index a46c42143c..67a1fea887 100644
--- a/ssl/t1_enc.c
+++ b/ssl/t1_enc.c
@@ -667,6 +667,15 @@ err:
return(ret);
}
+/* tls1_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/AEAD-authenticator is invalid or, if sending,
+ * an internal error occured.
+ */
int tls1_enc(SSL *s, int send)
{
SSL3_RECORD *rec;
@@ -817,8 +826,6 @@ int tls1_enc(SSL *s, int send)
{
if (l == 0 || l%bs != 0)
{
- if (s->version >= TLS1_1_VERSION)
- return -1;
SSLerr(SSL_F_TLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED);
return 0;
@@ -846,8 +853,6 @@ int tls1_enc(SSL *s, int send)
}
#endif /* KSSL_DEBUG */
- rec->orig_len = rec->length;
-
ret = 1;
if (EVP_MD_CTX_md(s->read_hash) != NULL)
mac_size = EVP_MD_CTX_size(s->read_hash);