Switch BORINGSSL_INTERNAL_CXX_TYPES in favor of subclassing games.
The previous attempt around the 'struct ssl_st' compatibility mess
offended OSS-Fuzz and UBSan because one compilation unit passed a
function pointer with ssl_st* and another called it with
bssl::SSLConnection*.
Linkers don't retain such types, of course, but to silence this alert,
instead make C-visible types be separate from the implementation and
subclass the public type. This does mean we risk polluting the symbol
namespace, but hopefully the compiler is smart enough to inline the
visible struct's constructor and destructor.
Bug: 132
Change-Id: Ia75a89b3a22a202883ad671a630b72d0aeef680e
Reviewed-on: https://boringssl-review.googlesource.com/18224
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index e60bb88..04ec4b8 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -3985,22 +3985,8 @@
/* TODO(davidben): Opaquify most or all of |SSL_CTX| and |SSL_SESSION| so these
* forward declarations are not needed. */
-#if defined(BORINGSSL_INTERNAL_CXX_TYPES)
-extern "C++" {
-namespace bssl {
-struct CERT;
-struct SSLProtocolMethod;
-struct SSLX509Method;
-}
-using SSL_CERT_CONFIG = bssl::CERT;
-using SSL_PROTOCOL_METHOD = bssl::SSLProtocolMethod;
-using SSL_X509_METHOD = bssl::SSLX509Method;
-}
-#else
-typedef struct ssl_cert_config_st SSL_CERT_CONFIG;
typedef struct ssl_protocol_method_st SSL_PROTOCOL_METHOD;
typedef struct ssl_x509_method_st SSL_X509_METHOD;
-#endif
DECLARE_STACK_OF(SSL_CUSTOM_EXTENSION)
@@ -4298,7 +4284,7 @@
uint32_t mode;
uint32_t max_cert_list;
- SSL_CERT_CONFIG *cert;
+ struct cert_st *cert;
/* callback that allows applications to peek at protocol messages */
void (*msg_callback)(int write_p, int version, int content_type,