diff options
author | davidben <davidben@chromium.org> | 2015-02-20 16:51:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-21 00:53:10 +0000 |
commit | e94fe096ed8c20a9388c6b321dc20a4b3eaa0a34 (patch) | |
tree | 42937ee5029fd600b1c9e0cd03c0c7d360895461 /crypto/scoped_openssl_types.h | |
parent | c8870c6897b0a970b8475f61e5823761c1b2589a (diff) | |
download | chromium_src-e94fe096ed8c20a9388c6b321dc20a4b3eaa0a34.zip chromium_src-e94fe096ed8c20a9388c6b321dc20a4b3eaa0a34.tar.gz chromium_src-e94fe096ed8c20a9388c6b321dc20a4b3eaa0a34.tar.bz2 |
Convert crypto::ScopedOpenSSL to type aliases.
This avoids having to put '::Type' everywhere.
BUG=none
Review URL: https://codereview.chromium.org/948543002
Cr-Commit-Position: refs/heads/master@{#317462}
Diffstat (limited to 'crypto/scoped_openssl_types.h')
-rw-r--r-- | crypto/scoped_openssl_types.h | 34 |
1 files changed, 16 insertions, 18 deletions
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 |