diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c index 4b5bb720..8f8a1969 100644 --- a/crypto/bio/bio.c +++ b/crypto/bio/bio.c @@ -243,6 +243,10 @@ int BIO_reset(BIO *bio) { return BIO_ctrl(bio, BIO_CTRL_RESET, 0, NULL); } +int BIO_eof(BIO *bio) { + return BIO_ctrl(bio, BIO_CTRL_EOF, 0, NULL); +} + void BIO_set_flags(BIO *bio, int flags) { bio->flags |= flags; } diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 41c30caa..6524371f 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -152,6 +152,11 @@ OPENSSL_EXPORT long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); * otherwise. */ OPENSSL_EXPORT int BIO_reset(BIO *bio); +/* BIO_eof returns non-zero when |bio| has reached end-of-file. The precise + * meaning of which depends on the concrete type of |bio|. Note that in the + * case of BIO_pair this always returns non-zero. */ +OPENSSL_EXPORT int BIO_eof(BIO *bio); + /* BIO_set_flags ORs |flags| with |bio->flags|. */ OPENSSL_EXPORT void BIO_set_flags(BIO *bio, int flags);