Note cipher BIO write errors too.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 976ef6adcc)

Conflicts:
	crypto/evp/bio_enc.c
This commit is contained in:
Dr. Stephen Henson 2016-07-26 20:22:49 +01:00
parent 97a7b2ebd9
commit 68bc6b7a36

View file

@ -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;