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

Unified Diff: chrome/common/net/x509_certificate_model_openssl.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 | « no previous file | content/child/webcrypto/platform_crypto_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/net/x509_certificate_model_openssl.cc
diff --git a/chrome/common/net/x509_certificate_model_openssl.cc b/chrome/common/net/x509_certificate_model_openssl.cc
index 044a5eec53f2204d5f2ff174b257a99259790aba..97628899382bd633b3b208ed8710cd59d786ac2e 100644
--- a/chrome/common/net/x509_certificate_model_openssl.cc
+++ b/chrome/common/net/x509_certificate_model_openssl.cc
@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "crypto/openssl_bio_string.h"
#include "crypto/openssl_util.h"
+#include "crypto/scoped_openssl_types.h"
#include "grit/generated_resources.h"
#include "net/base/net_util.h"
#include "net/cert/x509_util_openssl.h"
@@ -463,7 +464,7 @@ std::string ProcessNSCertTypeExtension(X509_EXTENSION* ex) {
{NS_OBJSIGN_CA, IDS_CERT_USAGE_OBJECT_SIGNER},
};
- crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free> value(
+ crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free>::Type value(
reinterpret_cast<ASN1_BIT_STRING*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -486,7 +487,7 @@ std::string ProcessKeyUsageExtension(X509_EXTENSION* ex) {
{KU_DECIPHER_ONLY, IDS_CERT_X509_KEY_USAGE_DECIPHER_ONLY},
};
- crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free> value(
+ crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free>::Type value(
reinterpret_cast<ASN1_BIT_STRING*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -498,7 +499,7 @@ std::string ProcessKeyUsageExtension(X509_EXTENSION* ex) {
std::string ProcessBasicConstraints(X509_EXTENSION* ex) {
std::string rv;
- crypto::ScopedOpenSSL<BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free> value(
+ crypto::ScopedOpenSSL<BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free>::Type value(
reinterpret_cast<BASIC_CONSTRAINTS*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -523,8 +524,8 @@ std::string ProcessBasicConstraints(X509_EXTENSION* ex) {
std::string ProcessExtKeyUsage(X509_EXTENSION* ex) {
std::string rv;
- crypto::ScopedOpenSSL<EXTENDED_KEY_USAGE, EXTENDED_KEY_USAGE_free> value(
- reinterpret_cast<EXTENDED_KEY_USAGE*>(X509V3_EXT_d2i(ex)));
+ crypto::ScopedOpenSSL<EXTENDED_KEY_USAGE, EXTENDED_KEY_USAGE_free>::Type
+ value(reinterpret_cast<EXTENDED_KEY_USAGE*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
for (int i = 0; i < sk_ASN1_OBJECT_num(value.get()); i++) {
@@ -672,7 +673,7 @@ std::string ProcessGeneralNames(GENERAL_NAMES* names) {
}
std::string ProcessAltName(X509_EXTENSION* ex) {
- crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free> alt_names(
+ crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free>::Type alt_names(
reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ex)));
if (!alt_names.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -681,7 +682,7 @@ std::string ProcessAltName(X509_EXTENSION* ex) {
}
std::string ProcessSubjectKeyId(X509_EXTENSION* ex) {
- crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free> value(
+ crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>::Type value(
reinterpret_cast<ASN1_OCTET_STRING*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -693,7 +694,7 @@ std::string ProcessSubjectKeyId(X509_EXTENSION* ex) {
std::string ProcessAuthKeyId(X509_EXTENSION* ex) {
std::string rv;
- crypto::ScopedOpenSSL<AUTHORITY_KEYID, AUTHORITY_KEYID_free> value(
+ crypto::ScopedOpenSSL<AUTHORITY_KEYID, AUTHORITY_KEYID_free>::Type value(
reinterpret_cast<AUTHORITY_KEYID*>(X509V3_EXT_d2i(ex)));
if (!value.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -749,8 +750,8 @@ std::string ProcessUserNotice(USERNOTICE* notice) {
std::string ProcessCertificatePolicies(X509_EXTENSION* ex) {
std::string rv;
- crypto::ScopedOpenSSL<CERTIFICATEPOLICIES, CERTIFICATEPOLICIES_free> policies(
- reinterpret_cast<CERTIFICATEPOLICIES*>(X509V3_EXT_d2i(ex)));
+ crypto::ScopedOpenSSL<CERTIFICATEPOLICIES, CERTIFICATEPOLICIES_free>::Type
+ policies(reinterpret_cast<CERTIFICATEPOLICIES*>(X509V3_EXT_d2i(ex)));
if (!policies.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -820,8 +821,8 @@ std::string ProcessCrlDistPoints(X509_EXTENSION* ex) {
const int kDistPointRelativeName = 1;
std::string rv;
- crypto::ScopedOpenSSL<CRL_DIST_POINTS, CRL_DIST_POINTS_free> dist_points(
- reinterpret_cast<CRL_DIST_POINTS*>(X509V3_EXT_d2i(ex)));
+ crypto::ScopedOpenSSL<CRL_DIST_POINTS, CRL_DIST_POINTS_free>::Type
+ dist_points(reinterpret_cast<CRL_DIST_POINTS*>(X509V3_EXT_d2i(ex)));
if (!dist_points.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -861,8 +862,8 @@ std::string ProcessCrlDistPoints(X509_EXTENSION* ex) {
std::string ProcessAuthInfoAccess(X509_EXTENSION* ex) {
std::string rv;
- crypto::ScopedOpenSSL<AUTHORITY_INFO_ACCESS, AUTHORITY_INFO_ACCESS_free> aia(
- reinterpret_cast<AUTHORITY_INFO_ACCESS*>(X509V3_EXT_d2i(ex)));
+ crypto::ScopedOpenSSL<AUTHORITY_INFO_ACCESS, AUTHORITY_INFO_ACCESS_free>::Type
+ aia(reinterpret_cast<AUTHORITY_INFO_ACCESS*>(X509V3_EXT_d2i(ex)));
if (!aia.get())
return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR);
@@ -894,7 +895,7 @@ std::string ProcessAuthInfoAccess(X509_EXTENSION* ex) {
std::string ProcessIA5StringData(ASN1_OCTET_STRING* asn1_string) {
const unsigned char* data = ASN1_STRING_data(asn1_string);
- crypto::ScopedOpenSSL<ASN1_IA5STRING, ASN1_IA5STRING_free> ia5_string(
+ crypto::ScopedOpenSSL<ASN1_IA5STRING, ASN1_IA5STRING_free>::Type ia5_string(
d2i_ASN1_IA5STRING(NULL, &data, ASN1_STRING_length(asn1_string)));
if (!ia5_string.get())
@@ -907,7 +908,7 @@ std::string ProcessIA5StringData(ASN1_OCTET_STRING* asn1_string) {
std::string ProcessBMPStringData(ASN1_OCTET_STRING* asn1_string) {
const unsigned char* data = ASN1_STRING_data(asn1_string);
- crypto::ScopedOpenSSL<ASN1_BMPSTRING, ASN1_BMPSTRING_free> bmp_string(
+ crypto::ScopedOpenSSL<ASN1_BMPSTRING, ASN1_BMPSTRING_free>::Type bmp_string(
d2i_ASN1_BMPSTRING(NULL, &data, ASN1_STRING_length(asn1_string)));
if (!bmp_string.get())
@@ -970,7 +971,7 @@ std::string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) {
if (!name.empty())
return name;
- crypto::ScopedOpenSSL<BIO, BIO_free_all> bio(crypto::BIO_new_string(&name));
+ crypto::ScopedBIO bio(crypto::BIO_new_string(&name));
if (!bio.get())
return name;
X509_NAME_print_ex(bio.get(),
@@ -1080,7 +1081,7 @@ std::string GetTitle(net::X509Certificate::OSCertHandle cert_handle) {
if (!title.empty())
return title;
- crypto::ScopedOpenSSL<BIO, BIO_free_all> bio(crypto::BIO_new_string(&title));
+ crypto::ScopedBIO bio(crypto::BIO_new_string(&title));
if (!bio.get())
return title;
X509_NAME_print_ex(bio.get(),
@@ -1150,7 +1151,7 @@ void DestroyCertChain(net::X509Certificate::OSCertHandles* cert_handles) {
std::string GetCMSString(const net::X509Certificate::OSCertHandles& cert_chain,
size_t start, size_t end) {
std::string rv;
- crypto::ScopedOpenSSL<PKCS7, PKCS7_free> p7(PKCS7_new());
+ crypto::ScopedOpenSSL<PKCS7, PKCS7_free>::Type p7(PKCS7_new());
if (!p7.get())
return rv;
if (!PKCS7_set_type(p7.get(), NID_pkcs7_signed))
@@ -1161,7 +1162,8 @@ std::string GetCMSString(const net::X509Certificate::OSCertHandles& cert_chain,
return rv;
}
- crypto::ScopedOpenSSL<BIO, BIO_free_all> bio(crypto::BIO_new_string(&rv));
+ crypto::ScopedOpenSSL<BIO, BIO_free_all>::Type bio(
+ crypto::BIO_new_string(&rv));
if (!bio.get())
return rv;
@@ -1192,13 +1194,13 @@ std::string ProcessSecAlgorithmSignatureWrap(
std::string ProcessSubjectPublicKeyInfo(
net::X509Certificate::OSCertHandle cert_handle) {
std::string rv;
- crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> public_key(
+ crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free>::Type public_key(
X509_get_pubkey(cert_handle));
if (!public_key.get())
return rv;
switch (EVP_PKEY_type(public_key.get()->type)) {
case EVP_PKEY_RSA: {
- crypto::ScopedOpenSSL<RSA, RSA_free> rsa_key(
+ crypto::ScopedOpenSSL<RSA, RSA_free>::Type rsa_key(
EVP_PKEY_get1_RSA(public_key.get()));
if (!rsa_key.get())
return rv;
« no previous file with comments | « no previous file | content/child/webcrypto/platform_crypto_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698