Implement BIO_eof() for compatibility

This function (actually a macro in OpenSSL) is used by several projects
(e.g. OpenResty, OpenVPN, ...) so it can useuful to provide it for
compatibility.

However, depending on the semantics of the BIO type (e.g. BIO_pair), the
return value can be meaningless, which might explain why it was removed.

Change-Id: I0e432c92222c267eb994d32b0bc28e999c4b40a7
Reviewed-on: https://boringssl-review.googlesource.com/11020
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
This commit is contained in:
Alessandro Ghedini 2016-09-11 01:49:12 +01:00 committed by CQ bot account: commit-bot@chromium.org
parent a97919791b
commit 32d961ae48
2 changed files with 9 additions and 0 deletions

View File

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

View File

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