From: Dr. Stephen Henson Date: Tue, 26 Jul 2016 19:22:49 +0000 (+0100) Subject: Note cipher BIO write errors too. X-Git-Tag: OpenSSL_1_0_2i~101 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=68bc6b7a36be4b635adb8d6ac0c849c51dcd8543;p=oweals%2Fopenssl.git Note cipher BIO write errors too. Reviewed-by: Rich Salz (cherry picked from commit 976ef6adcc157233fb641ca99e2424630ef1814f) Conflicts: crypto/evp/bio_enc.c --- 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;