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

Unified Diff: net/quic/test_tools/crypto_test_utils_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 | « net/quic/crypto/p256_key_exchange_openssl.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/crypto_test_utils_openssl.cc
diff --git a/net/quic/test_tools/crypto_test_utils_openssl.cc b/net/quic/test_tools/crypto_test_utils_openssl.cc
index 388d257001f478c187cbfb928ae0d3284da5455d..a6a164b0155e3ed947c4be6af48d6c5e455abf99 100644
--- a/net/quic/test_tools/crypto_test_utils_openssl.cc
+++ b/net/quic/test_tools/crypto_test_utils_openssl.cc
@@ -12,20 +12,13 @@
#include <openssl/sha.h>
#include "crypto/openssl_util.h"
+#include "crypto/scoped_openssl_types.h"
#include "crypto/secure_hash.h"
#include "net/quic/crypto/channel_id.h"
using base::StringPiece;
using std::string;
-namespace {
-
-void EvpMdCtxCleanUp(EVP_MD_CTX* ctx) {
- (void)EVP_MD_CTX_cleanup(ctx);
-}
-
-} // namespace anonymous
-
namespace net {
namespace test {
@@ -41,8 +34,7 @@ class TestChannelIDKey : public ChannelIDKey {
string* out_signature) const OVERRIDE {
EVP_MD_CTX md_ctx;
EVP_MD_CTX_init(&md_ctx);
- crypto::ScopedOpenSSL<EVP_MD_CTX, EvpMdCtxCleanUp>
- md_ctx_cleanup(&md_ctx);
+ crypto::ScopedEVP_MD_CTX md_ctx_cleanup(&md_ctx);
if (EVP_DigestSignInit(&md_ctx, NULL, EVP_sha256(), NULL,
ecdsa_key_.get()) != 1) {
@@ -66,7 +58,7 @@ class TestChannelIDKey : public ChannelIDKey {
}
uint8* derp = der_sig.get();
- crypto::ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free> sig(
+ crypto::ScopedECDSA_SIG sig(
d2i_ECDSA_SIG(NULL, const_cast<const uint8**>(&derp), sig_len));
if (sig.get() == NULL) {
return false;
@@ -104,7 +96,7 @@ class TestChannelIDKey : public ChannelIDKey {
}
private:
- crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> ecdsa_key_;
+ crypto::ScopedEVP_PKEY ecdsa_key_;
};
class TestChannelIDSource : public ChannelIDSource {
@@ -140,25 +132,25 @@ class TestChannelIDSource : public ChannelIDSource {
// clearing the most-significant bit.
digest[0] &= 0x7f;
- crypto::ScopedOpenSSL<BIGNUM, BN_free> k(BN_new());
+ crypto::ScopedBIGNUM k(BN_new());
CHECK(BN_bin2bn(digest, sizeof(digest), k.get()) != NULL);
- crypto::ScopedOpenSSL<EC_GROUP, EC_GROUP_free> p256(
+ crypto::ScopedOpenSSL<EC_GROUP, EC_GROUP_free>::Type p256(
EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1));
CHECK(p256.get());
- crypto::ScopedOpenSSL<EC_KEY, EC_KEY_free> ecdsa_key(EC_KEY_new());
+ crypto::ScopedEC_KEY ecdsa_key(EC_KEY_new());
CHECK(ecdsa_key.get() != NULL &&
EC_KEY_set_group(ecdsa_key.get(), p256.get()));
- crypto::ScopedOpenSSL<EC_POINT, EC_POINT_free> point(
+ crypto::ScopedOpenSSL<EC_POINT, EC_POINT_free>::Type point(
EC_POINT_new(p256.get()));
CHECK(EC_POINT_mul(p256.get(), point.get(), k.get(), NULL, NULL, NULL));
EC_KEY_set_private_key(ecdsa_key.get(), k.get());
EC_KEY_set_public_key(ecdsa_key.get(), point.get());
- crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> pkey(EVP_PKEY_new());
+ crypto::ScopedEVP_PKEY pkey(EVP_PKEY_new());
// EVP_PKEY_set1_EC_KEY takes a reference so no |release| here.
EVP_PKEY_set1_EC_KEY(pkey.get(), ecdsa_key.get());
« no previous file with comments | « net/quic/crypto/p256_key_exchange_openssl.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698