Use uint64_t for num_read and num_write in BIO
This matches upstream OpenSSL. It's also counting a total number of
bytes, not a single buffer. On a 32-bit platform, one may still transfor
more than 4GiB of data through a single BIO.
Change-Id: I1c668d84ee5ce13f7ab5c476cb168ae9c0e0109e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66167
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c
index abe753c..3206f6e 100644
--- a/crypto/bio/bio.c
+++ b/crypto/bio/bio.c
@@ -345,11 +345,11 @@
return (int)BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL);
}
-OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio) {
+OPENSSL_EXPORT uint64_t BIO_number_read(const BIO *bio) {
return bio->num_read;
}
-OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio) {
+OPENSSL_EXPORT uint64_t BIO_number_written(const BIO *bio) {
return bio->num_write;
}
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index b28439a..4700799 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -269,11 +269,11 @@
// BIO_number_read returns the number of bytes that have been read from
// |bio|.
-OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio);
+OPENSSL_EXPORT uint64_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);
+OPENSSL_EXPORT uint64_t BIO_number_written(const BIO *bio);
// Managing chains of BIOs.
@@ -894,7 +894,7 @@
// next_bio points to the next |BIO| in a chain. This |BIO| owns a reference
// to |next_bio|.
BIO *next_bio; // used by filter BIOs
- size_t num_read, num_write;
+ uint64_t num_read, num_write;
};
#define BIO_C_SET_CONNECT 100