Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2120)

Unified Diff: net/ssl/openssl_ssl_util.cc

Issue 2400033005: Use BoringSSL scopers in //net. (Closed)
Patch Set: eroman comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/openssl_ssl_util.h ('k') | net/ssl/scoped_openssl_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/openssl_ssl_util.cc
diff --git a/net/ssl/openssl_ssl_util.cc b/net/ssl/openssl_ssl_util.cc
index da97124adbae612de4654350de1381f9abea26bb..52316bc8501a5df392d0e158da6e8cdff26a0dbe 100644
--- a/net/ssl/openssl_ssl_util.cc
+++ b/net/ssl/openssl_ssl_util.cc
@@ -7,6 +7,7 @@
#include <errno.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
+#include <openssl/x509.h>
#include <utility>
#include "base/bind.h"
@@ -220,23 +221,24 @@ int GetNetSSLVersion(SSL* ssl) {
}
}
-ScopedX509 OSCertHandleToOpenSSL(X509Certificate::OSCertHandle os_handle) {
+bssl::UniquePtr<X509> OSCertHandleToOpenSSL(
+ X509Certificate::OSCertHandle os_handle) {
#if defined(USE_OPENSSL_CERTS)
- return ScopedX509(X509Certificate::DupOSCertHandle(os_handle));
-#else // !defined(USE_OPENSSL_CERTS)
+ return bssl::UniquePtr<X509>(X509Certificate::DupOSCertHandle(os_handle));
+#else // !defined(USE_OPENSSL_CERTS)
std::string der_encoded;
if (!X509Certificate::GetDEREncoded(os_handle, &der_encoded))
- return ScopedX509();
+ return bssl::UniquePtr<X509>();
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_encoded.data());
- return ScopedX509(d2i_X509(NULL, &bytes, der_encoded.size()));
+ return bssl::UniquePtr<X509>(d2i_X509(NULL, &bytes, der_encoded.size()));
#endif // defined(USE_OPENSSL_CERTS)
}
-ScopedX509Stack OSCertHandlesToOpenSSL(
+bssl::UniquePtr<STACK_OF(X509)> OSCertHandlesToOpenSSL(
const X509Certificate::OSCertHandles& os_handles) {
- ScopedX509Stack stack(sk_X509_new_null());
+ bssl::UniquePtr<STACK_OF(X509)> stack(sk_X509_new_null());
for (size_t i = 0; i < os_handles.size(); i++) {
- ScopedX509 x509 = OSCertHandleToOpenSSL(os_handles[i]);
+ bssl::UniquePtr<X509> x509 = OSCertHandleToOpenSSL(os_handles[i]);
if (!x509)
return nullptr;
sk_X509_push(stack.get(), x509.release());
« no previous file with comments | « net/ssl/openssl_ssl_util.h ('k') | net/ssl/scoped_openssl_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698