Cleanup of setting external buffer Don't use |BIO_set_foo_buffer_size| when setting the sizes of the buffers while making buffer pair. Since it happens in pair.c we know the BIOs are BIO pairs and using bio_ctrl here complicates setting external buffers. Also zero out bio_bio_st during construction. This fixes a problem that would happen if the default buffer sizes were not set, since buf_externally_allocated was not yet initialized. Remove BIO_C_SET_BUFF_SIZE and BIO_CTRL_RESET which are not used for bio pairs. Change-Id: I365091d5f44f6f1c5522c325a771bdf03d8fe950 Reviewed-on: https://boringssl-review.googlesource.com/2370 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 3f64dd3..4d89d11 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h
@@ -588,19 +588,16 @@ /* BIO_new_bio_pair_external_buf is the same as |BIO_new_bio_pair| with the * difference that the caller keeps ownership of the write buffers - * |ext_writebuf1| and |ext_writebuf2|. This is useful when using zero copy API - * for read and write operations, in cases where the buffers need to outlive the - * BIO pairs. It returns one on success and zero on error. */ + * |ext_writebuf1_len| and |ext_writebuf2_len|. This is useful when using zero + * copy API for read and write operations, in cases where the buffers need to + * outlive the BIO pairs. It returns one on success and zero on error. */ OPENSSL_EXPORT int BIO_new_bio_pair_external_buf(BIO** bio1_p, - size_t writebuf1, + size_t writebuf1_len, uint8_t* ext_writebuf1, BIO** bio2_p, - size_t writebuf2, + size_t writebuf2_len, uint8_t* ext_writebuf2); -/* BIO_s_bio returns the method for a BIO pair. */ -OPENSSL_EXPORT const BIO_METHOD *BIO_s_bio(void); - /* BIO_ctrl_get_read_request returns the number of bytes that the other side of * |bio| tried (unsuccessfully) to read. */ OPENSSL_EXPORT size_t BIO_ctrl_get_read_request(BIO *bio);