Recover BIO_number_{read|written}.

Android needs it. These functions were removed in the move to BoringSSL.

Change-Id: Ice24a0a1c390930cf07dbd00f72a3e12e6c241f9
Reviewed-on: https://boringssl-review.googlesource.com/1510
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2014-08-12 16:18:08 -07:00 committed by Adam Langley
parent 1b96526c6f
commit e2c4d26214
2 changed files with 18 additions and 4 deletions

View File

@ -144,7 +144,7 @@ void BIO_free_all(BIO *bio) {
}
static int bio_io(BIO *bio, void *buf, int len, size_t method_offset,
int callback_flags, unsigned long *num) {
int callback_flags, size_t *num) {
int i;
typedef int (*io_func_t)(BIO *, char *, int);
io_func_t io_func = NULL;
@ -371,6 +371,14 @@ char *BIO_get_callback_arg(const BIO *bio) {
return bio->cb_arg;
}
OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio) {
return bio->num_read;
}
OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio) {
return bio->num_write;
}
BIO *BIO_push(BIO *bio, BIO *appended_bio) {
BIO *last_bio;

View File

@ -256,6 +256,14 @@ OPENSSL_EXPORT void BIO_set_callback_arg(BIO *bio, char *arg);
* set by |BIO_set_callback_arg|. */
OPENSSL_EXPORT char *BIO_get_callback_arg(const BIO *bio);
/* BIO_number_read returns the number of bytes that have been read from
* |bio|. */
OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio);
/* BIO_number_written returns the number of bytes that have been written to
* |bio|. */
OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio);
/* Managing chains of BIOs.
*
@ -709,9 +717,7 @@ struct bio_st {
/* next_bio points to the next |BIO| in a chain. This |BIO| owns a reference
* to |next_bio|. */
struct bio_st *next_bio; /* used by filter BIOs */
/* TODO(fork): either bring back BIO_number_read and write or remove these. */
unsigned long num_read;
unsigned long num_write;
size_t num_read, num_write;
CRYPTO_EX_DATA ex_data;
};