Revert scoped_types.h change.
This reverts commits:
8d79ed67407e433d80ebc8d3aa080e8ce16e6eb7
19fdcb523402ed13ab798cf811fb0119e3e7b104
8d79ed67407e433d80ebc8d3aa080e8ce16e6eb7
Because WebRTC (at least) includes our headers in an extern "C" block,
which precludes having any C++ in them.
Change-Id: Ia849f43795a40034cbd45b22ea680b51aab28b2d
diff --git a/include/openssl/aead.h b/include/openssl/aead.h
index 7d9ee1f..7895825 100644
--- a/include/openssl/aead.h
+++ b/include/openssl/aead.h
@@ -333,18 +333,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEVP_AEAD_CTX =
- ScopedContext<EVP_AEAD_CTX, void, EVP_AEAD_CTX_zero, EVP_AEAD_CTX_cleanup>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_AEAD_H */
diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h
index e1c9447..42c9535 100644
--- a/include/openssl/asn1.h
+++ b/include/openssl/asn1.h
@@ -1016,17 +1016,6 @@
#ifdef __cplusplus
}
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedASN1_TYPE = ScopedType<ASN1_TYPE, ASN1_TYPE_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define ASN1_R_ASN1_LENGTH_MISMATCH 100
diff --git a/include/openssl/base.h b/include/openssl/base.h
index 21eb04f..68df107 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -170,13 +170,6 @@
#define OPENSSL_MSVC_PRAGMA(arg)
#endif
-/* MSVC doesn't set __cplusplus to 201103 to indicate C++11 support (see
- * https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l)
- * so MSVC is just assumed to support C++11. */
-#if defined(__cplusplus) && (__cplusplus >= 201103 || defined(_MSC_VER))
-#define BORINGSSL_HAVE_CXX11
-#endif
-
/* CRYPTO_THREADID is a dummy value. */
typedef int CRYPTO_THREADID;
@@ -300,9 +293,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
namespace bssl {
template<typename T, void (*func)(T*)>
@@ -342,6 +332,4 @@
#endif
-#endif
-
#endif /* OPENSSL_HEADER_BASE_H */
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 5ec40b2..5416c65 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -895,17 +895,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedBIO = ScopedType<BIO, BIO_vfree>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define BIO_R_BAD_FOPEN_MODE 100
diff --git a/include/openssl/bn.h b/include/openssl/bn.h
index 03ea7dc..a686696 100644
--- a/include/openssl/bn.h
+++ b/include/openssl/bn.h
@@ -866,19 +866,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedBIGNUM = ScopedType<BIGNUM, BN_free>;
-using ScopedBN_CTX = ScopedType<BN_CTX, BN_CTX_free>;
-using ScopedBN_MONT_CTX = ScopedType<BN_MONT_CTX, BN_MONT_CTX_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define BN_R_ARG2_LT_ARG3 100
diff --git a/include/openssl/bytestring.h b/include/openssl/bytestring.h
index b969662..c24281a 100644
--- a/include/openssl/bytestring.h
+++ b/include/openssl/bytestring.h
@@ -393,17 +393,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedCBB = ScopedContext<CBB, void, CBB_zero, CBB_cleanup>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_BYTESTRING_H */
diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h
index 984e3f3..5312308 100644
--- a/include/openssl/cipher.h
+++ b/include/openssl/cipher.h
@@ -540,19 +540,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEVP_CIPHER_CTX =
- ScopedContext<EVP_CIPHER_CTX, int, EVP_CIPHER_CTX_init,
- EVP_CIPHER_CTX_cleanup>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define CIPHER_R_AES_KEY_SETUP_FAILED 100
diff --git a/include/openssl/cmac.h b/include/openssl/cmac.h
index e66ac4f..0bb44b9 100644
--- a/include/openssl/cmac.h
+++ b/include/openssl/cmac.h
@@ -71,17 +71,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedCMAC_CTX = ScopedType<CMAC_CTX, CMAC_CTX_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_CMAC_H */
diff --git a/include/openssl/curve25519.h b/include/openssl/curve25519.h
index e5b847a..a9441cd 100644
--- a/include/openssl/curve25519.h
+++ b/include/openssl/curve25519.h
@@ -167,17 +167,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedSPAKE2_CTX = ScopedType<SPAKE2_CTX, SPAKE2_CTX_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_CURVE25519_H */
diff --git a/include/openssl/dh.h b/include/openssl/dh.h
index b929c67..a087651 100644
--- a/include/openssl/dh.h
+++ b/include/openssl/dh.h
@@ -255,17 +255,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedDH = ScopedType<DH, DH_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define DH_R_BAD_GENERATOR 100
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
index d13dfc8..07ea07a 100644
--- a/include/openssl/digest.h
+++ b/include/openssl/digest.h
@@ -260,18 +260,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEVP_MD_CTX =
- ScopedContext<EVP_MD_CTX, int, EVP_MD_CTX_init, EVP_MD_CTX_cleanup>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define DIGEST_R_INPUT_NOT_INITIALIZED 100
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index b149c45..32aded6 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -353,26 +353,14 @@
OPENSSL_EXPORT size_t EC_get_builtin_curves(EC_builtin_curve *out_curves,
size_t max_num_curves);
+/* Old code expects to get EC_KEY from ec.h. */
+#include <openssl/ec_key.h>
+
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEC_GROUP = ScopedType<EC_GROUP, EC_GROUP_free>;
-using ScopedEC_POINT = ScopedType<EC_POINT, EC_POINT_free>;
-
-} // namespace bssl
-
#endif
-#endif
-
-/* Old code expects to get EC_KEY from ec.h. */
-#include <openssl/ec_key.h>
-
#define EC_R_BUFFER_TOO_SMALL 100
#define EC_R_COORDINATES_OUT_OF_RANGE 101
#define EC_R_D2I_ECPKPARAMETERS_FAILURE 102
diff --git a/include/openssl/ec_key.h b/include/openssl/ec_key.h
index 5b0f516..63554a7 100644
--- a/include/openssl/ec_key.h
+++ b/include/openssl/ec_key.h
@@ -322,17 +322,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEC_KEY = ScopedType<EC_KEY, EC_KEY_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_EC_KEY_H */
diff --git a/include/openssl/ecdsa.h b/include/openssl/ecdsa.h
index 3a04adf..a060eab 100644
--- a/include/openssl/ecdsa.h
+++ b/include/openssl/ecdsa.h
@@ -194,17 +194,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedECDSA_SIG = ScopedType<ECDSA_SIG, ECDSA_SIG_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define ECDSA_R_BAD_SIGNATURE 100
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 263944e..5407407 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -747,18 +747,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedEVP_PKEY = ScopedType<EVP_PKEY, EVP_PKEY_free>;
-using ScopedEVP_PKEY_CTX = ScopedType<EVP_PKEY_CTX, EVP_PKEY_CTX_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define EVP_R_BUFFER_TOO_SMALL 100
diff --git a/include/openssl/hmac.h b/include/openssl/hmac.h
index 6a6c8c0..5a4e9c7 100644
--- a/include/openssl/hmac.h
+++ b/include/openssl/hmac.h
@@ -153,18 +153,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedHMAC_CTX =
- ScopedContext<HMAC_CTX, void, HMAC_CTX_init, HMAC_CTX_cleanup>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_HMAC_H */
diff --git a/include/openssl/mem.h b/include/openssl/mem.h
index 172198d..d773752 100644
--- a/include/openssl/mem.h
+++ b/include/openssl/mem.h
@@ -134,8 +134,6 @@
#if defined(__cplusplus)
} /* extern C */
-#if defined(BORINGSSL_HAVE_CXX11)
-
namespace bssl {
template<typename T>
@@ -145,13 +143,8 @@
}
};
-using ScopedBytes = std::unique_ptr<uint8_t, Free<uint8_t>>;
-using ScopedString = std::unique_ptr<char, Free<char>>;
-
} // namespace bssl
#endif
-#endif
-
#endif /* OPENSSL_HEADER_MEM_H */
diff --git a/include/openssl/newhope.h b/include/openssl/newhope.h
index 3d91ce7..487e03f 100644
--- a/include/openssl/newhope.h
+++ b/include/openssl/newhope.h
@@ -142,17 +142,6 @@
#if defined(__cplusplus)
} /* extern "C" */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedNEWHOPE_POLY = ScopedType<NEWHOPE_POLY, NEWHOPE_POLY_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_NEWHOPE_H */
diff --git a/include/openssl/pkcs8.h b/include/openssl/pkcs8.h
index 87d1e05..28cf6ac 100644
--- a/include/openssl/pkcs8.h
+++ b/include/openssl/pkcs8.h
@@ -187,19 +187,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedPKCS8_PRIV_KEY_INFO =
- ScopedType<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>;
-using ScopedPKCS12 = ScopedType<PKCS12, PKCS12_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define PKCS8_R_BAD_PKCS12_DATA 100
diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h
index f6abdfb..063d2e8 100644
--- a/include/openssl/rsa.h
+++ b/include/openssl/rsa.h
@@ -612,17 +612,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedRSA = ScopedType<RSA, RSA_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define RSA_R_BAD_ENCODING 100
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 583cbf8..2ae5ab1 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -4505,19 +4505,6 @@
#if defined(__cplusplus)
} /* extern C */
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedSSL = ScopedType<SSL, SSL_free>;
-using ScopedSSL_CTX = ScopedType<SSL_CTX, SSL_CTX_free>;
-using ScopedSSL_SESSION = ScopedType<SSL_SESSION, SSL_SESSION_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define SSL_R_APP_DATA_IN_HANDSHAKE 100
diff --git a/include/openssl/stack.h b/include/openssl/stack.h
index b521353..913db50 100644
--- a/include/openssl/stack.h
+++ b/include/openssl/stack.h
@@ -291,8 +291,6 @@
#if defined(__cplusplus)
} /* extern C */
-#if defined(BORINGSSL_HAVE_CXX11)
-
namespace bssl {
template<typename StackType, typename T, void (*func)(T*)>
@@ -308,9 +306,6 @@
std::unique_ptr<StackType, StackDeleter<StackType, T, func>>;
} // namespace bssl
-
-#endif
-
#endif
#endif /* OPENSSL_HEADER_STACK_H */
diff --git a/include/openssl/x509.h b/include/openssl/x509.h
index e57d615..bbc263e 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h
@@ -1225,22 +1225,6 @@
#ifdef __cplusplus
}
-
-#if defined(BORINGSSL_HAVE_CXX11)
-
-namespace bssl {
-
-using ScopedX509 = ScopedType<X509, X509_free>;
-using ScopedX509_ALGOR = ScopedType<X509_ALGOR, X509_ALGOR_free>;
-using ScopedX509_SIG = ScopedType<X509_SIG, X509_SIG_free>;
-using ScopedX509_STORE_CTX = ScopedType<X509_STORE_CTX, X509_STORE_CTX_free>;
-
-using ScopedX509Stack = ScopedStack<STACK_OF(X509), X509, X509_free>;
-
-} // namespace bssl
-
-#endif
-
#endif
#define X509_R_AKID_MISMATCH 100