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

Unified Diff: net/cert/x509_certificate_openssl.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/cert/x509_certificate_ios.cc ('k') | net/cert/x509_util_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_openssl.cc
diff --git a/net/cert/x509_certificate_openssl.cc b/net/cert/x509_certificate_openssl.cc
index e22ea9f099db2a1050f948b60f21e4d10e8a1b60..e7d62ffa218b88bc9744705bc951e2a62e5c8b90 100644
--- a/net/cert/x509_certificate_openssl.cc
+++ b/net/cert/x509_certificate_openssl.cc
@@ -22,7 +22,6 @@
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/cert/x509_util_openssl.h"
@@ -36,9 +35,6 @@ namespace net {
namespace {
-using ScopedGENERAL_NAMES =
- crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free>;
-
void CreateOSCertHandlesFromPKCS7Bytes(
const char* data,
size_t length,
@@ -106,7 +102,7 @@ void ParseSubjectAltName(X509Certificate::OSCertHandle cert,
if (!alt_name_ext)
return;
- ScopedGENERAL_NAMES alt_names(
+ bssl::UniquePtr<GENERAL_NAMES> alt_names(
reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(alt_name_ext)));
if (!alt_names.get())
return;
@@ -164,16 +160,11 @@ class X509InitSingleton {
ResetCertStore();
}
- crypto::ScopedOpenSSL<X509_STORE, X509_STORE_free> store_;
+ bssl::UniquePtr<X509_STORE> store_;
DISALLOW_COPY_AND_ASSIGN(X509InitSingleton);
};
-// Used to free a list of X509_NAMEs and the objects it points to.
-void sk_X509_NAME_free_all(STACK_OF(X509_NAME)* sk) {
- sk_X509_NAME_pop_free(sk, X509_NAME_free);
-}
-
} // namespace
// static
@@ -361,11 +352,10 @@ void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
*type = kPublicKeyTypeUnknown;
*size_bits = 0;
- crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert_handle));
+ bssl::UniquePtr<EVP_PKEY> scoped_key(X509_get_pubkey(cert_handle));
if (!scoped_key.get())
return;
- CHECK(scoped_key.get());
EVP_PKEY* key = scoped_key.get();
switch (key->type) {
@@ -395,8 +385,7 @@ bool X509Certificate::IsIssuedByEncoded(
// Convert to a temporary list of X509_NAME objects.
// It will own the objects it points to.
- crypto::ScopedOpenSSL<STACK_OF(X509_NAME), sk_X509_NAME_free_all>
- issuer_names(sk_X509_NAME_new_null());
+ bssl::UniquePtr<STACK_OF(X509_NAME)> issuer_names(sk_X509_NAME_new_null());
if (!issuer_names.get())
return false;
@@ -442,7 +431,7 @@ bool X509Certificate::IsIssuedByEncoded(
// static
bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
- crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert_handle));
+ bssl::UniquePtr<EVP_PKEY> scoped_key(X509_get_pubkey(cert_handle));
if (!scoped_key)
return false;
if (!X509_verify(cert_handle, scoped_key.get()))
« no previous file with comments | « net/cert/x509_certificate_ios.cc ('k') | net/cert/x509_util_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698