Blame SOURCES/openssl-1.0.1e-enc-fail.patch

83c29f
diff -up openssl-1.0.1e/crypto/evp/bio_enc.c.enc-fail openssl-1.0.1e/crypto/evp/bio_enc.c
83c29f
--- openssl-1.0.1e/crypto/evp/bio_enc.c.enc-fail	2013-02-11 16:26:04.000000000 +0100
83c29f
+++ openssl-1.0.1e/crypto/evp/bio_enc.c	2014-03-04 15:21:12.185821738 +0100
83c29f
@@ -198,10 +198,15 @@ static int enc_read(BIO *b, char *out, i
83c29f
 			}
83c29f
 		else
83c29f
 			{
83c29f
-			EVP_CipherUpdate(&(ctx->cipher),
83c29f
+			if (!EVP_CipherUpdate(&(ctx->cipher),
83c29f
 				(unsigned char *)ctx->buf,&ctx->buf_len,
83c29f
-				(unsigned char *)&(ctx->buf[BUF_OFFSET]),i);
83c29f
-			ctx->cont=1;
83c29f
+				(unsigned char *)&(ctx->buf[BUF_OFFSET]),i))
83c29f
+				{
83c29f
+				ctx->ok = 0;
83c29f
+				ctx->cont = 0;
83c29f
+				}
83c29f
+			else
83c29f
+				ctx->cont=1;
83c29f
 			/* Note: it is possible for EVP_CipherUpdate to
83c29f
 			 * decrypt zero bytes because this is or looks like
83c29f
 			 * the final block: if this happens we should retry
83c29f
@@ -257,9 +262,14 @@ static int enc_write(BIO *b, const char
83c29f
 	while (inl > 0)
83c29f
 		{
83c29f
 		n=(inl > ENC_BLOCK_SIZE)?ENC_BLOCK_SIZE:inl;
83c29f
-		EVP_CipherUpdate(&(ctx->cipher),
83c29f
+		if (!EVP_CipherUpdate(&(ctx->cipher),
83c29f
 			(unsigned char *)ctx->buf,&ctx->buf_len,
83c29f
-			(unsigned char *)in,n);
83c29f
+			(unsigned char *)in,n))
83c29f
+			{
83c29f
+			BIO_copy_next_retry(b);
83c29f
+			ctx->ok = 0;
83c29f
+			return ret - inl;
83c29f
+			}
83c29f
 		inl-=n;
83c29f
 		in+=n;
83c29f