Commit fe78f08d authored by Matt Caswell's avatar Matt Caswell
Browse files

Add checks to the return value of EVP_Cipher to prevent silent encryption failure.



PR#1767

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent fc3968a2
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1632,7 +1632,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
	if (eivlen)
	if (eivlen)
		wr->length += eivlen;
		wr->length += eivlen;


	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 */
	/* record length after mac and block padding */
/*	if (type == SSL3_RT_APPLICATION_DATA ||
/*	if (type == SSL3_RT_APPLICATION_DATA ||
+2 −1
Original line number Original line Diff line number Diff line
@@ -556,7 +556,8 @@ int ssl3_enc(SSL *s, int send)
			/* otherwise, rec->length >= bs */
			/* 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)
		if (EVP_MD_CTX_md(s->read_hash) != NULL)
			mac_size = EVP_MD_CTX_size(s->read_hash);
			mac_size = EVP_MD_CTX_size(s->read_hash);
+1 −2
Original line number Original line Diff line number Diff line
@@ -1118,8 +1118,7 @@ static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
		wr->length += eivlen;
		wr->length += eivlen;
		}
		}


	/* ssl3_enc can only have an error on read */
	if(s->method->ssl3_enc->enc(s,1)<1) goto err;
	s->method->ssl3_enc->enc(s,1);


	if (SSL_USE_ETM(s) && mac_size != 0)
	if (SSL_USE_ETM(s) && mac_size != 0)
		{
		{