From: ihciah Date: Thu, 11 May 2023 09:30:14 +0000 (+0000) Subject: bio: pass flags on BIO_ctrl to make flush retriable X-Git-Tag: openssl-3.2.0-alpha1~293 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcbc7d60679b79fa4347e33c865306dce41ed985;p=thirdparty%2Fopenssl.git bio: pass flags on BIO_ctrl to make flush retriable Co-authored-by: suikammd Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Todd Short (Merged from https://github.com/openssl/openssl/pull/21298) --- diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index b94c58c0a38..bad465c0729 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -360,6 +360,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) return 0; if (ctx->obuf_len <= 0) { ret = BIO_ctrl(b->next_bio, cmd, num, ptr); + BIO_copy_next_retry(b); break; } @@ -380,6 +381,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) } } ret = BIO_ctrl(b->next_bio, cmd, num, ptr); + BIO_copy_next_retry(b); break; case BIO_CTRL_DUP: dbio = (BIO *)ptr; diff --git a/crypto/bio/bf_lbuf.c b/crypto/bio/bf_lbuf.c index eb23c886476..170e375e7f8 100644 --- a/crypto/bio/bf_lbuf.c +++ b/crypto/bio/bf_lbuf.c @@ -259,6 +259,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) return 0; if (ctx->obuf_len <= 0) { ret = BIO_ctrl(b->next_bio, cmd, num, ptr); + BIO_copy_next_retry(b); break; } @@ -278,6 +279,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) } } ret = BIO_ctrl(b->next_bio, cmd, num, ptr); + BIO_copy_next_retry(b); break; case BIO_CTRL_DUP: dbio = (BIO *)ptr; diff --git a/crypto/comp/c_brotli.c b/crypto/comp/c_brotli.c index 2d98b63a893..df63a43b417 100644 --- a/crypto/comp/c_brotli.c +++ b/crypto/comp/c_brotli.c @@ -716,8 +716,10 @@ static long bio_brotli_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_FLUSH: ret = bio_brotli_flush(b); - if (ret > 0) + if (ret > 0) { ret = BIO_flush(next); + BIO_copy_next_retry(b); + } break; case BIO_C_SET_BUFF_SIZE: diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index 90a1840ecd5..52f2e26a73f 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -640,8 +640,10 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_FLUSH: ret = bio_zlib_flush(b); - if (ret > 0) + if (ret > 0) { ret = BIO_flush(next); + BIO_copy_next_retry(b); + } break; case BIO_C_SET_BUFF_SIZE: diff --git a/crypto/comp/c_zstd.c b/crypto/comp/c_zstd.c index 17dc0f64a41..7f6c5cc72c2 100644 --- a/crypto/comp/c_zstd.c +++ b/crypto/comp/c_zstd.c @@ -762,8 +762,10 @@ static long bio_zstd_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_FLUSH: ret = bio_zstd_flush(b); - if (ret > 0) + if (ret > 0) { ret = BIO_flush(next); + BIO_copy_next_retry(b); + } break; case BIO_C_SET_BUFF_SIZE: diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index 0292c678c91..4822d37ea4b 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -496,6 +496,7 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr) } /* Finally flush the underlying BIO */ ret = BIO_ctrl(next, cmd, num, ptr); + BIO_copy_next_retry(b); break; case BIO_C_DO_STATE_MACHINE: diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index a284b6d9ebf..4a2e5a8303f 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -360,6 +360,7 @@ static long enc_ctrl(BIO *b, int cmd, long num, void *ptr) /* Finally flush the underlying BIO */ ret = BIO_ctrl(next, cmd, num, ptr); + BIO_copy_next_retry(b); break; case BIO_C_GET_CIPHER_STATUS: ret = (long)ctx->ok; diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index a07c9c59983..a72acfb39be 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -372,6 +372,7 @@ static long ok_ctrl(BIO *b, int cmd, long num, void *ptr) /* Finally flush the underlying BIO */ ret = BIO_ctrl(next, cmd, num, ptr); + BIO_copy_next_retry(b); break; case BIO_C_DO_STATE_MACHINE: BIO_clear_retry_flags(b);