From 68bc6b7a36be4b635adb8d6ac0c849c51dcd8543 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Tue, 26 Jul 2016 20:22:49 +0100 Subject: [PATCH] Note cipher BIO write errors too. Reviewed-by: Rich Salz (cherry picked from commit 976ef6adcc157233fb641ca99e2424630ef1814f) Conflicts: crypto/evp/bio_enc.c --- crypto/evp/bio_enc.c | 10 +++++++--- 1 file 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; -- 2.25.1