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

Unified Diff: net/cert/x509_util_openssl_unittest.cc

Issue 361193003: Eliminate ScopedOpenSSL in favour of scoped_ptr<> specializations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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_util_openssl.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_util_openssl_unittest.cc
diff --git a/net/cert/x509_util_openssl_unittest.cc b/net/cert/x509_util_openssl_unittest.cc
index c99f811705dbd373e1b7163c1aae4b4f80e9d769..77746ebca643e33529d4c35f51b643690f3b845c 100644
--- a/net/cert/x509_util_openssl_unittest.cc
+++ b/net/cert/x509_util_openssl_unittest.cc
@@ -5,6 +5,7 @@
#include "base/memory/scoped_ptr.h"
#include "crypto/ec_private_key.h"
#include "crypto/openssl_util.h"
+#include "crypto/scoped_openssl_types.h"
#include "net/cert/x509_util.h"
#include "net/cert/x509_util_openssl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,6 +14,8 @@ namespace net {
namespace {
+typedef crypto::ScopedOpenSSL<X509, X509_free>::Type ScopedX509;
+
// Verify that a given certificate was signed with the private key corresponding
// to a given public key.
// |der_cert| is the DER-encoded X.509 certificate.
@@ -22,8 +25,7 @@ void VerifyCertificateSignature(const std::string& der_cert,
const unsigned char* cert_data =
reinterpret_cast<const unsigned char*>(der_cert.data());
int cert_data_len = static_cast<int>(der_cert.size());
- crypto::ScopedOpenSSL<X509, X509_free> cert(
- d2i_X509(NULL, &cert_data, cert_data_len));
+ ScopedX509 cert(d2i_X509(NULL, &cert_data, cert_data_len));
ASSERT_TRUE(cert.get());
// NOTE: SignatureVerifier wants the DER-encoded ASN.1 AlgorithmIdentifier
@@ -31,8 +33,7 @@ void VerifyCertificateSignature(const std::string& der_cert,
// Use X509_verify() directly instead, which takes an EVP_PKEY.
const unsigned char* pub_key_data = &der_spki.front();
int pub_key_len = static_cast<int>(der_spki.size());
- crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> pub_key(
- d2i_PUBKEY(NULL, &pub_key_data, pub_key_len));
+ crypto::ScopedEVP_PKEY pub_key(d2i_PUBKEY(NULL, &pub_key_data, pub_key_len));
ASSERT_TRUE(pub_key.get());
// NOTE: X509_verify() returns 1 in case of succes, 0 or -1 on error.
@@ -46,15 +47,14 @@ void VerifyDomainBoundCert(const std::string& domain,
const std::string& der_cert) {
// Origin Bound Cert OID.
static const char oid_string[] = "1.3.6.1.4.1.11129.2.1.6";
- crypto::ScopedOpenSSL<ASN1_OBJECT, ASN1_OBJECT_free> oid_obj(
+ crypto::ScopedOpenSSL<ASN1_OBJECT, ASN1_OBJECT_free>::Type oid_obj(
OBJ_txt2obj(oid_string, 0));
ASSERT_TRUE(oid_obj.get());
const unsigned char* cert_data =
reinterpret_cast<const unsigned char*>(der_cert.data());
int cert_data_len = static_cast<int>(der_cert.size());
- crypto::ScopedOpenSSL<X509, X509_free> cert(
- d2i_X509(NULL, &cert_data, cert_data_len));
+ ScopedX509 cert(d2i_X509(NULL, &cert_data, cert_data_len));
ASSERT_TRUE(cert.get());
// Find the extension.
« no previous file with comments | « net/cert/x509_util_openssl.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698