Rename BIO_print_errors_fp back to ERR_print_errors_fp & refactor it.
A previous change in BoringSSL renamed ERR_print_errors_fp to
BIO_print_errors_fp as part of refactoring the code to improve the
layering of modules within BoringSSL. Rename it back for better
compatibility with code that was using the function under the original
name. Move its definition back to crypto/err using an implementation
that avoids depending on crypto/bio.
Change-Id: Iee7703bb1eb4a3d640aff6485712bea71d7c1052
Reviewed-on: https://boringssl-review.googlesource.com/4310
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 349a073..0a637e4 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -62,6 +62,7 @@
#include <stdarg.h>
#include <stdio.h> /* For FILE */
+#include <openssl/err.h> /* for ERR_print_errors_fp */
#include <openssl/ex_data.h>
#include <openssl/stack.h>
@@ -331,10 +332,6 @@
OPENSSL_EXPORT int BIO_hexdump(BIO *bio, const uint8_t *data, size_t len,
unsigned indent);
-/* BIO_print_errors_fp prints the current contents of the error stack to |out|
- * using human readable strings where possible. */
-OPENSSL_EXPORT void BIO_print_errors_fp(FILE *out);
-
/* BIO_print_errors prints the current contents of the error stack to |bio|
* using human readable strings where possible. */
OPENSSL_EXPORT void BIO_print_errors(BIO *bio);
@@ -706,6 +703,14 @@
#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
+/* Android compatibility section.
+ *
+ * A previous version of BoringSSL used in Android renamed ERR_print_errors_fp
+ * to BIO_print_errors_fp. It has subsequently been renamed back to
+ * ERR_print_errors_fp. */
+#define BIO_print_errors_fp ERR_print_errors_fp
+
+
/* Private functions */
#define BIO_FLAGS_READ 0x01
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 340cf9b..738e8c5 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -109,6 +109,8 @@
#ifndef OPENSSL_HEADER_ERR_H
#define OPENSSL_HEADER_ERR_H
+#include <stdio.h>
+
#include <openssl/base.h>
#include <openssl/thread.h>
#include <openssl/lhash.h>
@@ -251,6 +253,10 @@
void *ctx);
+/* ERR_print_errors_fp prints the current contents of the error stack to |file|
+ * using human readable strings where possible. */
+OPENSSL_EXPORT void ERR_print_errors_fp(FILE *file);
+
/* Clearing errors. */
/* ERR_clear_error clears the error queue for the current thread. */