summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-11-18 12:56:26 +0000
committerMatt Caswell <matt@openssl.org>2014-11-27 21:53:02 +0000
commit244d0955adc027c0f41a3251e55d145bf940f9ce (patch)
tree63651fb25221470b925809bc66b1faa6881bc8b4
parent061e68c554a29ea30152d1c34e96abeca2f9652c (diff)
Add checks to the return value of EVP_Cipher to prevent silent encryption failure.
PR#1767 Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r--ssl/d1_enc.c3
-rw-r--r--ssl/d1_pkt.c2
-rw-r--r--ssl/s3_enc.c3
-rw-r--r--ssl/s3_pkt.c3
4 files changed, 6 insertions, 5 deletions
diff --git a/ssl/d1_enc.c b/ssl/d1_enc.c
index 712c4647f2..3da2b4c8c2 100644
--- a/ssl/d1_enc.c
+++ b/ssl/d1_enc.c
@@ -241,7 +241,8 @@ int dtls1_enc(SSL *s, int send)
return 0;
}
- EVP_Cipher(ds,rec->data,rec->input,l);
+ if(EVP_Cipher(ds,rec->data,rec->input,l) < 1)
+ return -1;
#ifdef KSSL_DEBUG
{
diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index 438c0913d2..edd17df54b 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -1619,7 +1619,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
wr->length += bs;
}
- s->method->ssl3_enc->enc(s,1);
+ if(s->method->ssl3_enc->enc(s,1) < 1) goto err;
/* record length after mac and block padding */
/* if (type == SSL3_RT_APPLICATION_DATA ||
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index 9db45af7ea..89c133e681 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -535,7 +535,8 @@ int ssl3_enc(SSL *s, int send)
/* otherwise, rec->length >= bs */
}
- EVP_Cipher(ds,rec->data,rec->input,l);
+ if(EVP_Cipher(ds,rec->data,rec->input,l) < 1)
+ return -1;
if (EVP_MD_CTX_md(s->read_hash) != NULL)
mac_size = EVP_MD_CTX_size(s->read_hash);
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 4c9285f355..d1cd752209 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -856,8 +856,7 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
wr->length += eivlen;
}
- /* ssl3_enc can only have an error on read */
- s->method->ssl3_enc->enc(s,1);
+ if(s->method->ssl3_enc->enc(s,1)<1) goto err;
/* record length after mac and block padding */
s2n(wr->length,plen);