Add functions for setting a BIO callback and arg.

These were omitted, but are needed by Chromium now.

Change-Id: I17e1672674311c8dc2ede21539c82b8e2e50f376
Reviewed-on: https://boringssl-review.googlesource.com/1201
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c
index d9f7f40..11e4f65 100644
--- a/crypto/bio/bio.c
+++ b/crypto/bio/bio.c
@@ -359,6 +359,18 @@
   return BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL);
 }
 
+void BIO_set_callback(BIO *bio, bio_info_cb callback_func) {
+  bio->callback = callback_func;
+}
+
+void BIO_set_callback_arg(BIO *bio, char *arg) {
+  bio->cb_arg = arg;
+}
+
+char *BIO_get_callback_arg(const BIO *bio) {
+  return bio->cb_arg;
+}
+
 BIO *BIO_push(BIO *bio, BIO *appended_bio) {
   BIO *last_bio;
 
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 83607e1..af3789e 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -244,6 +244,18 @@
  * otherwise. */
 int BIO_set_close(BIO *bio, int close_flag);
 
+/* BIO_set_callback sets a callback function that will be called before and
+ * after most operations. See the comment above |bio_info_cb|. */
+void BIO_set_callback(BIO *bio, bio_info_cb callback_func);
+
+/* BIO_set_callback_arg sets the opaque pointer value that can be read within a
+ * callback with |BIO_get_callback_arg|. */
+void BIO_set_callback_arg(BIO *bio, char *arg);
+
+/* BIO_get_callback_arg returns the last value of the opaque callback pointer
+ * set by |BIO_set_callback_arg|. */
+char *BIO_get_callback_arg(const BIO *bio);
+
 
 /* Managing chains of BIOs.
  *