aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-07-26 20:22:49 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-07-26 22:45:04 +0100
commit68bc6b7a36be4b635adb8d6ac0c849c51dcd8543 (patch)
treeafe23159e9b470a043bb572a85b4f4d9efdf8d74
parent97a7b2ebd97fcacbf354de22496f4d19eb81e515 (diff)
downloadopenssl-68bc6b7a36be4b635adb8d6ac0c849c51dcd8543.tar.gz
Note cipher BIO write errors too.
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 976ef6adcc157233fb641ca99e2424630ef1814f) Conflicts: crypto/evp/bio_enc.c
-rw-r--r--crypto/evp/bio_enc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c
index 590f236e8f..0806f233b6 100644
--- a/crypto/evp/bio_enc.c
+++ b/crypto/evp/bio_enc.c
@@ -265,9 +265,13 @@ static int enc_write(BIO *b, const char *in, int inl)
ctx->buf_off = 0;
while (inl > 0) {
n = (inl > ENC_BLOCK_SIZE) ? ENC_BLOCK_SIZE : inl;
- EVP_CipherUpdate(&(ctx->cipher),
- (unsigned char *)ctx->buf, &ctx->buf_len,
- (unsigned char *)in, n);
+ if (!EVP_CipherUpdate(&ctx->cipher,
+ (unsigned char *)ctx->buf, &ctx->buf_len,
+ (unsigned char *)in, n)) {
+ BIO_clear_retry_flags(b);
+ ctx->ok = 0;
+ return 0;
+ }
inl -= n;
in += n;