More scopers.
Note the legacy client cert callback case fixes a leak.
Change-Id: I2772167bd03d308676d9e00885c751207002b31e
Reviewed-on: https://boringssl-review.googlesource.com/18824
Commit-Queue: Steven Valdez <svaldez@google.com>
Reviewed-by: Steven Valdez <svaldez@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/include/openssl/base.h b/include/openssl/base.h
index e575069..6b43c76 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -413,6 +413,9 @@
T *get() { return &ctx_; }
const T *get() const { return &ctx_; }
+ T *operator->() { return &ctx_; }
+ const T *operator->() const { return &ctx_; }
+
void Reset() {
cleanup(&ctx_);
init(&ctx_);
diff --git a/include/openssl/x509.h b/include/openssl/x509.h
index 40b2332..138c060 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h
@@ -1094,7 +1094,9 @@
#ifdef __cplusplus
}
+#endif
+#if !defined(BORINGSSL_NO_CXX)
extern "C++" {
namespace bssl {
@@ -1118,11 +1120,14 @@
BORINGSSL_MAKE_DELETER(X509_STORE_CTX, X509_STORE_CTX_free)
BORINGSSL_MAKE_DELETER(X509_VERIFY_PARAM, X509_VERIFY_PARAM_free)
+using ScopedX509_STORE_CTX =
+ internal::StackAllocated<X509_STORE_CTX, void, X509_STORE_CTX_zero,
+ X509_STORE_CTX_cleanup>;
+
} // namespace bssl
} /* extern C++ */
-
-#endif
+#endif /* !BORINGSSL_NO_CXX */
#define X509_R_AKID_MISMATCH 100
#define X509_R_BAD_PKCS7_VERSION 101
diff --git a/include/openssl/x509_vfy.h b/include/openssl/x509_vfy.h
index ac739ea..4abd9cd 100644
--- a/include/openssl/x509_vfy.h
+++ b/include/openssl/x509_vfy.h
@@ -449,6 +449,7 @@
OPENSSL_EXPORT int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+OPENSSL_EXPORT void X509_STORE_CTX_zero(X509_STORE_CTX *ctx);
OPENSSL_EXPORT void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
OPENSSL_EXPORT int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
X509 *x509, STACK_OF(X509) *chain);