summaryrefslogtreecommitdiffstats
path: root/crypto/signature_verifier_openssl.cc
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 04:39:38 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 04:39:38 +0000
commitcd9b75b1194ef656668b4d848c99d24d5968eb3a (patch)
tree2f0ee7adcb172a43aa6f635538daf57e52e48e6d /crypto/signature_verifier_openssl.cc
parent253a24133db77bda145e3599e2d7582e4f8c7409 (diff)
downloadchromium_src-cd9b75b1194ef656668b4d848c99d24d5968eb3a.zip
chromium_src-cd9b75b1194ef656668b4d848c99d24d5968eb3a.tar.gz
chromium_src-cd9b75b1194ef656668b4d848c99d24d5968eb3a.tar.bz2
Eliminate ScopedOpenSSL in favour of scoped_ptr<> specializations.
Match the NSS, CryptoAPI (Win) and Security (OS X) approaches by declaring the scoped types as specializations of our existing scoped classes. Like NSS, this requires an intermediate helper type, because our scoped_ptr<> doesn't accept deleter functions as template arguments (though they are valid in C++11's unique_ptr<>). A few base cryptographic (non-certificate) types are used in scoped_openssl_types.h, while the remainder are left for implementations to specialize as needed. In an ideal world, this would be scoped_ptr<FOO, FOO_free>, but that will require unique_ptr<> support. BUG=388904 Review URL: https://codereview.chromium.org/361193003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282257 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/signature_verifier_openssl.cc')
-rw-r--r--crypto/signature_verifier_openssl.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/signature_verifier_openssl.cc b/crypto/signature_verifier_openssl.cc
index a85f00b..155a2cf3 100644
--- a/crypto/signature_verifier_openssl.cc
+++ b/crypto/signature_verifier_openssl.cc
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "crypto/openssl_util.h"
+#include "crypto/scoped_openssl_types.h"
namespace crypto {
@@ -31,7 +32,7 @@ const EVP_MD* ToOpenSSLDigest(SignatureVerifier::HashAlgorithm hash_alg) {
} // namespace
struct SignatureVerifier::VerifyContext {
- ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy> ctx;
+ ScopedEVP_MD_CTX ctx;
};
SignatureVerifier::SignatureVerifier()
@@ -49,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> algorithm(
+ ScopedOpenSSL<X509_ALGOR, X509_ALGOR_free>::Type algorithm(
d2i_X509_ALGOR(NULL, &signature_algorithm, signature_algorithm_len));
if (!algorithm.get())
return false;
@@ -135,13 +136,11 @@ bool SignatureVerifier::CommonInit(const EVP_MD* digest,
// BIO_new_mem_buf is not const aware, but it does not modify the buffer.
char* data = reinterpret_cast<char*>(const_cast<uint8*>(public_key_info));
- ScopedOpenSSL<BIO, BIO_free_all> bio(BIO_new_mem_buf(data,
- public_key_info_len));
+ ScopedBIO bio(BIO_new_mem_buf(data, public_key_info_len));
if (!bio.get())
return false;
- ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> public_key(
- d2i_PUBKEY_bio(bio.get(), NULL));
+ ScopedEVP_PKEY public_key(d2i_PUBKEY_bio(bio.get(), NULL));
if (!public_key.get())
return false;