LOCAL: add boringssl support

The code should check if OPENSSL_IS_BORINGSSL is defined.

Change-Id: I331eb3b952025c5d7a9affbf30d7e2e1861b0084
diff --git a/asio/include/asio/ssl/detail/impl/engine.ipp b/asio/include/asio/ssl/detail/impl/engine.ipp
index b59cf18..984d2cd 100644
--- a/asio/include/asio/ssl/detail/impl/engine.ipp
+++ b/asio/include/asio/ssl/detail/impl/engine.ipp
@@ -25,6 +25,14 @@
 
 #include "asio/detail/push_options.hpp"
 
+#if defined(OPENSSL_IS_BORINGSSL)
+extern "C" {
+#if !defined(SSL_R_SHORT_READ)
+# define SSL_R_SHORT_READ    SSL_R_UNEXPECTED_RECORD
+#endif // !defined(SSL_R_SHORT_READ)
+}
+#endif // defined(OPENSSL_IS_BORINGSSL)
+
 namespace asio {
 namespace ssl {
 namespace detail {
diff --git a/asio/include/asio/ssl/detail/impl/openssl_init.ipp b/asio/include/asio/ssl/detail/impl/openssl_init.ipp
index da66fc1..80ca899 100644
--- a/asio/include/asio/ssl/detail/impl/openssl_init.ipp
+++ b/asio/include/asio/ssl/detail/impl/openssl_init.ipp
@@ -26,6 +26,12 @@
 
 #include "asio/detail/push_options.hpp"
 
+#if defined(OPENSSL_IS_BORINGSSL)
+extern "C" {
+inline void CONF_modules_unload(int p) {}
+}
+#endif // defined(OPENSSL_IS_BORINGSSL)
+
 namespace asio {
 namespace ssl {
 namespace detail {
diff --git a/asio/include/asio/ssl/impl/rfc2818_verification.ipp b/asio/include/asio/ssl/impl/rfc2818_verification.ipp
index 9b6ef04..e84cde6 100644
--- a/asio/include/asio/ssl/impl/rfc2818_verification.ipp
+++ b/asio/include/asio/ssl/impl/rfc2818_verification.ipp
@@ -54,7 +54,11 @@
   // or IP address entries.
   GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>(
       X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0));
+#if defined(OPENSSL_IS_BORINGSSL)
+  for (size_t i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
+#else
   for (int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
+#endif
   {
     GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
     if (gen->type == GEN_DNS && !is_address)