diff options
-rw-r--r-- | chrome/common/net/x509_certificate_model_openssl.cc | 32 | ||||
-rw-r--r-- | content/child/webcrypto/openssl/aes_cbc_openssl.cc | 2 | ||||
-rw-r--r-- | content/child/webcrypto/openssl/aes_ctr_openssl.cc | 2 | ||||
-rw-r--r-- | content/child/webcrypto/openssl/util_openssl.cc | 7 | ||||
-rw-r--r-- | crypto/ec_private_key_openssl.cc | 6 | ||||
-rw-r--r-- | crypto/rsa_private_key_openssl.cc | 6 | ||||
-rw-r--r-- | crypto/scoped_openssl_types.h | 34 | ||||
-rw-r--r-- | crypto/signature_verifier_openssl.cc | 2 | ||||
-rw-r--r-- | extensions/common/cast/cast_cert_validator_openssl.cc | 7 | ||||
-rw-r--r-- | net/base/keygen_handler_openssl.cc | 2 | ||||
-rw-r--r-- | net/cert/cert_verify_proc_openssl.cc | 4 | ||||
-rw-r--r-- | net/cert/ct_objects_extractor_openssl.cc | 4 | ||||
-rw-r--r-- | net/cert/sha256_legacy_support_openssl_win.cc | 5 | ||||
-rw-r--r-- | net/cert/x509_certificate_openssl.cc | 8 | ||||
-rw-r--r-- | net/cert/x509_util_openssl.cc | 19 | ||||
-rw-r--r-- | net/cert/x509_util_openssl_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_openssl.cc | 3 | ||||
-rw-r--r-- | net/ssl/scoped_openssl_types.h | 8 |
18 files changed, 73 insertions, 80 deletions
diff --git a/chrome/common/net/x509_certificate_model_openssl.cc b/chrome/common/net/x509_certificate_model_openssl.cc index 28de57c..fea0d5e 100644 --- a/chrome/common/net/x509_certificate_model_openssl.cc +++ b/chrome/common/net/x509_certificate_model_openssl.cc @@ -465,7 +465,7 @@ std::string ProcessNSCertTypeExtension(X509_EXTENSION* ex) { {NS_OBJSIGN_CA, IDS_CERT_USAGE_OBJECT_SIGNER}, }; - crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free>::Type value( + crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free> value( reinterpret_cast<ASN1_BIT_STRING*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -488,7 +488,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>::Type value( + crypto::ScopedOpenSSL<ASN1_BIT_STRING, ASN1_BIT_STRING_free> value( reinterpret_cast<ASN1_BIT_STRING*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -500,7 +500,7 @@ std::string ProcessKeyUsageExtension(X509_EXTENSION* ex) { std::string ProcessBasicConstraints(X509_EXTENSION* ex) { std::string rv; - crypto::ScopedOpenSSL<BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free>::Type value( + crypto::ScopedOpenSSL<BASIC_CONSTRAINTS, BASIC_CONSTRAINTS_free> value( reinterpret_cast<BASIC_CONSTRAINTS*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -525,8 +525,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>::Type - value(reinterpret_cast<EXTENDED_KEY_USAGE*>(X509V3_EXT_d2i(ex))); + crypto::ScopedOpenSSL<EXTENDED_KEY_USAGE, EXTENDED_KEY_USAGE_free> value( + reinterpret_cast<EXTENDED_KEY_USAGE*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); for (size_t i = 0; i < sk_ASN1_OBJECT_num(value.get()); i++) { @@ -674,7 +674,7 @@ std::string ProcessGeneralNames(GENERAL_NAMES* names) { } std::string ProcessAltName(X509_EXTENSION* ex) { - crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free>::Type alt_names( + crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free> alt_names( reinterpret_cast<GENERAL_NAMES*>(X509V3_EXT_d2i(ex))); if (!alt_names.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -683,7 +683,7 @@ std::string ProcessAltName(X509_EXTENSION* ex) { } std::string ProcessSubjectKeyId(X509_EXTENSION* ex) { - crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>::Type value( + crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free> value( reinterpret_cast<ASN1_OCTET_STRING*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -695,7 +695,7 @@ std::string ProcessSubjectKeyId(X509_EXTENSION* ex) { std::string ProcessAuthKeyId(X509_EXTENSION* ex) { std::string rv; - crypto::ScopedOpenSSL<AUTHORITY_KEYID, AUTHORITY_KEYID_free>::Type value( + crypto::ScopedOpenSSL<AUTHORITY_KEYID, AUTHORITY_KEYID_free> value( reinterpret_cast<AUTHORITY_KEYID*>(X509V3_EXT_d2i(ex))); if (!value.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -751,8 +751,8 @@ std::string ProcessUserNotice(USERNOTICE* notice) { std::string ProcessCertificatePolicies(X509_EXTENSION* ex) { std::string rv; - crypto::ScopedOpenSSL<CERTIFICATEPOLICIES, CERTIFICATEPOLICIES_free>::Type - policies(reinterpret_cast<CERTIFICATEPOLICIES*>(X509V3_EXT_d2i(ex))); + crypto::ScopedOpenSSL<CERTIFICATEPOLICIES, CERTIFICATEPOLICIES_free> policies( + reinterpret_cast<CERTIFICATEPOLICIES*>(X509V3_EXT_d2i(ex))); if (!policies.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -822,8 +822,8 @@ std::string ProcessCrlDistPoints(X509_EXTENSION* ex) { const int kDistPointRelativeName = 1; std::string rv; - crypto::ScopedOpenSSL<CRL_DIST_POINTS, CRL_DIST_POINTS_free>::Type - dist_points(reinterpret_cast<CRL_DIST_POINTS*>(X509V3_EXT_d2i(ex))); + crypto::ScopedOpenSSL<CRL_DIST_POINTS, CRL_DIST_POINTS_free> dist_points( + reinterpret_cast<CRL_DIST_POINTS*>(X509V3_EXT_d2i(ex))); if (!dist_points.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -863,8 +863,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>::Type - aia(reinterpret_cast<AUTHORITY_INFO_ACCESS*>(X509V3_EXT_d2i(ex))); + crypto::ScopedOpenSSL<AUTHORITY_INFO_ACCESS, AUTHORITY_INFO_ACCESS_free> aia( + reinterpret_cast<AUTHORITY_INFO_ACCESS*>(X509V3_EXT_d2i(ex))); if (!aia.get()) return l10n_util::GetStringUTF8(IDS_CERT_EXTENSION_DUMP_ERROR); @@ -896,7 +896,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>::Type ia5_string( + crypto::ScopedOpenSSL<ASN1_IA5STRING, ASN1_IA5STRING_free> ia5_string( d2i_ASN1_IA5STRING(NULL, &data, ASN1_STRING_length(asn1_string))); if (!ia5_string.get()) @@ -909,7 +909,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>::Type bmp_string( + crypto::ScopedOpenSSL<ASN1_BMPSTRING, ASN1_BMPSTRING_free> bmp_string( d2i_ASN1_BMPSTRING(NULL, &data, ASN1_STRING_length(asn1_string))); if (!bmp_string.get()) diff --git a/content/child/webcrypto/openssl/aes_cbc_openssl.cc b/content/child/webcrypto/openssl/aes_cbc_openssl.cc index e2a9585..5645935 100644 --- a/content/child/webcrypto/openssl/aes_cbc_openssl.cc +++ b/content/child/webcrypto/openssl/aes_cbc_openssl.cc @@ -65,7 +65,7 @@ Status AesCbcEncryptDecrypt(EncryptOrDecrypt cipher_operation, return Status::ErrorDataTooLarge(); // Note: PKCS padding is enabled by default - crypto::ScopedOpenSSL<EVP_CIPHER_CTX, EVP_CIPHER_CTX_free>::Type context( + crypto::ScopedOpenSSL<EVP_CIPHER_CTX, EVP_CIPHER_CTX_free> context( EVP_CIPHER_CTX_new()); if (!context.get()) diff --git a/content/child/webcrypto/openssl/aes_ctr_openssl.cc b/content/child/webcrypto/openssl/aes_ctr_openssl.cc index 65bcdf7..43a1837 100644 --- a/content/child/webcrypto/openssl/aes_ctr_openssl.cc +++ b/content/child/webcrypto/openssl/aes_ctr_openssl.cc @@ -50,7 +50,7 @@ Status AesCtrEncrypt128BitCounter(const EVP_CIPHER* cipher, DCHECK_EQ(16u, counter.byte_length()); crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); - crypto::ScopedOpenSSL<EVP_CIPHER_CTX, EVP_CIPHER_CTX_free>::Type context( + crypto::ScopedOpenSSL<EVP_CIPHER_CTX, EVP_CIPHER_CTX_free> context( EVP_CIPHER_CTX_new()); if (!context.get()) diff --git a/content/child/webcrypto/openssl/util_openssl.cc b/content/child/webcrypto/openssl/util_openssl.cc index f60fb3c..b03c632 100644 --- a/content/child/webcrypto/openssl/util_openssl.cc +++ b/content/child/webcrypto/openssl/util_openssl.cc @@ -101,8 +101,7 @@ Status AeadEncryptDecrypt(EncryptOrDecrypt mode, return Status::OperationError(); } - crypto::ScopedOpenSSL<EVP_AEAD_CTX, EVP_AEAD_CTX_cleanup>::Type ctx_cleanup( - &ctx); + crypto::ScopedOpenSSL<EVP_AEAD_CTX, EVP_AEAD_CTX_cleanup> ctx_cleanup(&ctx); size_t len; int ok; @@ -226,8 +225,8 @@ Status ImportUnverifiedPkeyFromPkcs8(const CryptoData& key_data, crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); const uint8_t* ptr = key_data.bytes(); - crypto::ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>::Type - p8inf(d2i_PKCS8_PRIV_KEY_INFO(nullptr, &ptr, key_data.byte_length())); + crypto::ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free> p8inf( + d2i_PKCS8_PRIV_KEY_INFO(nullptr, &ptr, key_data.byte_length())); if (!p8inf.get() || ptr != key_data.bytes() + key_data.byte_length()) return Status::DataError(); diff --git a/crypto/ec_private_key_openssl.cc b/crypto/ec_private_key_openssl.cc index 2d44759..b6b004c 100644 --- a/crypto/ec_private_key_openssl.cc +++ b/crypto/ec_private_key_openssl.cc @@ -25,9 +25,9 @@ namespace { // style guide, hence the unusual parameter placement / types. typedef int (*ExportBioFunction)(BIO* bio, const void* key); -typedef ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>::Type - ScopedPKCS8_PRIV_KEY_INFO; -typedef ScopedOpenSSL<X509_SIG, X509_SIG_free>::Type ScopedX509_SIG; +using ScopedPKCS8_PRIV_KEY_INFO = + ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>; +using ScopedX509_SIG = ScopedOpenSSL<X509_SIG, X509_SIG_free>; // Helper to export |key| into |output| via the specified ExportBioFunction. bool ExportKeyWithBio(const void* key, diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc index 799d0f0..9f8352d 100644 --- a/crypto/rsa_private_key_openssl.cc +++ b/crypto/rsa_private_key_openssl.cc @@ -19,13 +19,13 @@ namespace crypto { namespace { -typedef ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>::Type - ScopedPKCS8_PRIV_KEY_INFO; +using ScopedPKCS8_PRIV_KEY_INFO = + ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>; // Function pointer definition, for injecting the required key export function // into ExportKey, below. The supplied function should export EVP_PKEY into // the supplied BIO, returning 1 on success or 0 on failure. -typedef int (ExportFunction)(BIO*, EVP_PKEY*); +using ExportFunction = int (*)(BIO*, EVP_PKEY*); // Helper to export |key| into |output| via the specified ExportFunction. bool ExportKey(EVP_PKEY* key, diff --git a/crypto/scoped_openssl_types.h b/crypto/scoped_openssl_types.h index 87e0f94..b392a07 100644 --- a/crypto/scoped_openssl_types.h +++ b/crypto/scoped_openssl_types.h @@ -22,15 +22,13 @@ namespace crypto { // base::internal::RunnableAdapter<>, but that's far too heavy weight. template <typename Type, void (*Destroyer)(Type*)> struct OpenSSLDestroyer { - typedef void AllowSelfReset; + using AllowSelfReset = void; void operator()(Type* ptr) const { Destroyer(ptr); } }; template <typename PointerType, void (*Destroyer)(PointerType*)> -struct ScopedOpenSSL { - typedef scoped_ptr<PointerType, OpenSSLDestroyer<PointerType, Destroyer> > - Type; -}; +using ScopedOpenSSL = + scoped_ptr<PointerType, OpenSSLDestroyer<PointerType, Destroyer>>; struct OpenSSLFree { void operator()(uint8_t* ptr) const { OPENSSL_free(ptr); } @@ -40,21 +38,21 @@ struct OpenSSLFree { // short-hand and prevalence. Note that OpenSSL types related to X.509 are // intentionally not included, as crypto/ does not generally deal with // certificates or PKI. -typedef ScopedOpenSSL<BIGNUM, BN_free>::Type ScopedBIGNUM; -typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY; -typedef ScopedOpenSSL<BIO, BIO_free_all>::Type ScopedBIO; -typedef ScopedOpenSSL<DSA, DSA_free>::Type ScopedDSA; -typedef ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>::Type ScopedECDSA_SIG; -typedef ScopedOpenSSL<EC_GROUP, EC_GROUP_free>::Type ScopedEC_GROUP; -typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY; -typedef ScopedOpenSSL<EC_POINT, EC_POINT_free>::Type ScopedEC_POINT; -typedef ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy>::Type ScopedEVP_MD_CTX; -typedef ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free>::Type ScopedEVP_PKEY; -typedef ScopedOpenSSL<EVP_PKEY_CTX, EVP_PKEY_CTX_free>::Type ScopedEVP_PKEY_CTX; -typedef ScopedOpenSSL<RSA, RSA_free>::Type ScopedRSA; +using ScopedBIGNUM = ScopedOpenSSL<BIGNUM, BN_free>; +using ScopedEC_Key = ScopedOpenSSL<EC_KEY, EC_KEY_free>; +using ScopedBIO = ScopedOpenSSL<BIO, BIO_free_all>; +using ScopedDSA = ScopedOpenSSL<DSA, DSA_free>; +using ScopedECDSA_SIG = ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>; +using ScopedEC_GROUP = ScopedOpenSSL<EC_GROUP, EC_GROUP_free>; +using ScopedEC_KEY = ScopedOpenSSL<EC_KEY, EC_KEY_free>; +using ScopedEC_POINT = ScopedOpenSSL<EC_POINT, EC_POINT_free>; +using ScopedEVP_MD_CTX = ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy>; +using ScopedEVP_PKEY = ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free>; +using ScopedEVP_PKEY_CTX = ScopedOpenSSL<EVP_PKEY_CTX, EVP_PKEY_CTX_free>; +using ScopedRSA = ScopedOpenSSL<RSA, RSA_free>; // The bytes must have been allocated with OPENSSL_malloc. -typedef scoped_ptr<uint8_t, OpenSSLFree> ScopedOpenSSLBytes; +using ScopedOpenSSLBytes = scoped_ptr<uint8_t, OpenSSLFree>; } // namespace crypto diff --git a/crypto/signature_verifier_openssl.cc b/crypto/signature_verifier_openssl.cc index 93ce9ba..a33d665 100644 --- a/crypto/signature_verifier_openssl.cc +++ b/crypto/signature_verifier_openssl.cc @@ -50,7 +50,7 @@ bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm, const uint8* public_key_info, int public_key_info_len) { OpenSSLErrStackTracer err_tracer(FROM_HERE); - ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free>::Type algorithm( + ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free> algorithm( d2i_X509_ALGOR(NULL, &signature_algorithm, signature_algorithm_len)); if (!algorithm.get()) return false; diff --git a/extensions/common/cast/cast_cert_validator_openssl.cc b/extensions/common/cast/cast_cert_validator_openssl.cc index 8c2e4c0..326aa49 100644 --- a/extensions/common/cast/cast_cert_validator_openssl.cc +++ b/extensions/common/cast/cast_cert_validator_openssl.cc @@ -18,14 +18,13 @@ #include "extensions/browser/api/cast_channel/cast_auth_ica.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_util_openssl.h" +#include "net/ssl/scoped_openssl_types.h" namespace extensions { namespace core_api { namespace cast_crypto { namespace { -typedef crypto::ScopedOpenSSL<X509, X509_free>::Type ScopedX509; - class CertVerificationContextOpenSSL : public CertVerificationContext { public: // Takes ownership of the passed-in x509 object @@ -80,7 +79,7 @@ class CertVerificationContextOpenSSL : public CertVerificationContext { } private: - ScopedX509 x509_; + net::ScopedX509 x509_; }; } // namespace @@ -127,7 +126,7 @@ VerificationResult VerifyDeviceCert( const uint8_t* device_cert_der_ptr = reinterpret_cast<const uint8_t*>(device_cert.data()); const uint8_t* device_cert_der_end = device_cert_der_ptr + device_cert.size(); - ScopedX509 device_cert_x509( + net::ScopedX509 device_cert_x509( d2i_X509(NULL, &device_cert_der_ptr, device_cert.size())); if (!device_cert_x509 || device_cert_der_ptr != device_cert_der_end) { return VerificationResult("Failed to parse device certificate.", diff --git a/net/base/keygen_handler_openssl.cc b/net/base/keygen_handler_openssl.cc index aeb64a8..38bb81a 100644 --- a/net/base/keygen_handler_openssl.cc +++ b/net/base/keygen_handler_openssl.cc @@ -23,7 +23,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { if (stores_key_) OpenSSLPrivateKeyStore::StoreKeyPair(url_, pkey); - crypto::ScopedOpenSSL<NETSCAPE_SPKI, NETSCAPE_SPKI_free>::Type spki( + crypto::ScopedOpenSSL<NETSCAPE_SPKI, NETSCAPE_SPKI_free> spki( NETSCAPE_SPKI_new()); ASN1_STRING_set(spki.get()->spkac->challenge, challenge_.data(), challenge_.size()); diff --git a/net/cert/cert_verify_proc_openssl.cc b/net/cert/cert_verify_proc_openssl.cc index a74bbc3..890462e 100644 --- a/net/cert/cert_verify_proc_openssl.cc +++ b/net/cert/cert_verify_proc_openssl.cc @@ -204,10 +204,10 @@ int CertVerifyProcOpenSSL::VerifyInternal( verify_result->cert_status |= CERT_STATUS_COMMON_NAME_INVALID; } - crypto::ScopedOpenSSL<X509_STORE_CTX, X509_STORE_CTX_free>::Type ctx( + crypto::ScopedOpenSSL<X509_STORE_CTX, X509_STORE_CTX_free> ctx( X509_STORE_CTX_new()); - crypto::ScopedOpenSSL<STACK_OF(X509), sk_X509_free_fn>::Type intermediates( + crypto::ScopedOpenSSL<STACK_OF(X509), sk_X509_free_fn> intermediates( sk_X509_new_null()); if (!intermediates.get()) return ERR_OUT_OF_MEMORY; diff --git a/net/cert/ct_objects_extractor_openssl.cc b/net/cert/ct_objects_extractor_openssl.cc index 7ec241f..80fed58 100644 --- a/net/cert/ct_objects_extractor_openssl.cc +++ b/net/cert/ct_objects_extractor_openssl.cc @@ -29,8 +29,8 @@ void FreeX509_EXTENSIONS(X509_EXTENSIONS* ptr) { sk_X509_EXTENSION_pop_free(ptr, X509_EXTENSION_free); } -typedef crypto::ScopedOpenSSL<X509_EXTENSIONS, FreeX509_EXTENSIONS>::Type - ScopedX509_EXTENSIONS; +using ScopedX509_EXTENSIONS = + crypto::ScopedOpenSSL<X509_EXTENSIONS, FreeX509_EXTENSIONS>; // The wire form of the OID 1.3.6.1.4.1.11129.2.4.2. See Section 3.3 of // RFC6962. diff --git a/net/cert/sha256_legacy_support_openssl_win.cc b/net/cert/sha256_legacy_support_openssl_win.cc index 991f051..2c5fc70 100644 --- a/net/cert/sha256_legacy_support_openssl_win.cc +++ b/net/cert/sha256_legacy_support_openssl_win.cc @@ -18,8 +18,7 @@ namespace sha256_interception { namespace { -typedef crypto::ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free>::Type - ScopedX509_ALGOR; +using ScopedX509_ALGOR = crypto::ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free>; // Parses |subject_signature| and writes the components into |*out_tbs_data|, // |*out_algor|, and |*out_signature|. The BIT STRING in the signature must be @@ -151,4 +150,4 @@ BOOL CryptVerifyCertificateSignatureExHook( } // namespace sha256_interception -} // namespace net
\ No newline at end of file +} // namespace net diff --git a/net/cert/x509_certificate_openssl.cc b/net/cert/x509_certificate_openssl.cc index e92f3a1..5d043d1 100644 --- a/net/cert/x509_certificate_openssl.cc +++ b/net/cert/x509_certificate_openssl.cc @@ -34,8 +34,8 @@ namespace net { namespace { -typedef crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free>::Type - ScopedGENERAL_NAMES; +using ScopedGENERAL_NAMES = + crypto::ScopedOpenSSL<GENERAL_NAMES, GENERAL_NAMES_free>; void CreateOSCertHandlesFromPKCS7Bytes( const char* data, int length, @@ -161,7 +161,7 @@ class X509InitSingleton { ResetCertStore(); } - crypto::ScopedOpenSSL<X509_STORE, X509_STORE_free>::Type store_; + crypto::ScopedOpenSSL<X509_STORE, X509_STORE_free> store_; DISALLOW_COPY_AND_ASSIGN(X509InitSingleton); }; @@ -404,7 +404,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>::Type + crypto::ScopedOpenSSL<STACK_OF(X509_NAME), sk_X509_NAME_free_all> issuer_names(sk_X509_NAME_new_null()); if (!issuer_names.get()) return false; diff --git a/net/cert/x509_util_openssl.cc b/net/cert/x509_util_openssl.cc index 8ecd0dd..6bbf12d 100644 --- a/net/cert/x509_util_openssl.cc +++ b/net/cert/x509_util_openssl.cc @@ -23,16 +23,15 @@ namespace net { namespace { -typedef crypto::ScopedOpenSSL<ASN1_INTEGER, ASN1_INTEGER_free>::Type - ScopedASN1_INTEGER; -typedef crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>::Type - ScopedASN1_OCTET_STRING; -typedef crypto::ScopedOpenSSL<ASN1_STRING, ASN1_STRING_free>::Type - ScopedASN1_STRING; -typedef crypto::ScopedOpenSSL<ASN1_TIME, ASN1_TIME_free>::Type ScopedASN1_TIME; -typedef crypto::ScopedOpenSSL<X509_EXTENSION, X509_EXTENSION_free>::Type - ScopedX509_EXTENSION; -typedef crypto::ScopedOpenSSL<X509_NAME, X509_NAME_free>::Type ScopedX509_NAME; +using ScopedASN1_INTEGER = + crypto::ScopedOpenSSL<ASN1_INTEGER, ASN1_INTEGER_free>; +using ScopedASN1_OCTET_STRING = + crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>; +using ScopedASN1_STRING = crypto::ScopedOpenSSL<ASN1_STRING, ASN1_STRING_free>; +using ScopedASN1_TIME = crypto::ScopedOpenSSL<ASN1_TIME, ASN1_TIME_free>; +using ScopedX509_EXTENSION = + crypto::ScopedOpenSSL<X509_EXTENSION, X509_EXTENSION_free>; +using ScopedX509_NAME = crypto::ScopedOpenSSL<X509_NAME, X509_NAME_free>; const EVP_MD* ToEVP(x509_util::DigestAlgorithm alg) { switch (alg) { diff --git a/net/cert/x509_util_openssl_unittest.cc b/net/cert/x509_util_openssl_unittest.cc index b6a2afe..070fba4 100644 --- a/net/cert/x509_util_openssl_unittest.cc +++ b/net/cert/x509_util_openssl_unittest.cc @@ -46,7 +46,7 @@ void VerifyChannelID(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>::Type oid_obj( + crypto::ScopedOpenSSL<ASN1_OBJECT, ASN1_OBJECT_free> oid_obj( OBJ_txt2obj(oid_string, 0)); ASSERT_TRUE(oid_obj.get()); diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 764ce9e..f166b69 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -78,8 +78,7 @@ void FreeX509Stack(STACK_OF(X509)* ptr) { sk_X509_pop_free(ptr, X509_free); } -typedef crypto::ScopedOpenSSL<STACK_OF(X509), FreeX509Stack>::Type - ScopedX509Stack; +using ScopedX509Stack = crypto::ScopedOpenSSL<STACK_OF(X509), FreeX509Stack>; #if OPENSSL_VERSION_NUMBER < 0x1000103fL // This method doesn't seem to have made it into the OpenSSL headers. diff --git a/net/ssl/scoped_openssl_types.h b/net/ssl/scoped_openssl_types.h index ca3b8f5..8bbdbd5 100644 --- a/net/ssl/scoped_openssl_types.h +++ b/net/ssl/scoped_openssl_types.h @@ -13,10 +13,10 @@ namespace net { using ScopedPKCS8_PRIV_KEY_INFO = - crypto::ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>::Type; -using ScopedSSL = crypto::ScopedOpenSSL<SSL, SSL_free>::Type; -using ScopedSSL_CTX = crypto::ScopedOpenSSL<SSL_CTX, SSL_CTX_free>::Type; -using ScopedX509 = crypto::ScopedOpenSSL<X509, X509_free>::Type; + crypto::ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free>; +using ScopedSSL = crypto::ScopedOpenSSL<SSL, SSL_free>; +using ScopedSSL_CTX = crypto::ScopedOpenSSL<SSL_CTX, SSL_CTX_free>; +using ScopedX509 = crypto::ScopedOpenSSL<X509, X509_free>; } // namespace net |