Index: crypto/rsa_private_key_openssl.cc |
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc |
index f191e393288372c98e4ec379f3408224d09b7480..0eb53e9af4978c54061a5f0954c1901da5a36afd 100644 |
--- a/crypto/rsa_private_key_openssl.cc |
+++ b/crypto/rsa_private_key_openssl.cc |
@@ -11,6 +11,7 @@ |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "crypto/openssl_util.h" |
+#include "crypto/scoped_openssl_types.h" |
namespace crypto { |
@@ -29,7 +30,7 @@ bool ExportKey(EVP_PKEY* key, |
return false; |
OpenSSLErrStackTracer err_tracer(FROM_HERE); |
- ScopedOpenSSL<BIO, BIO_free_all> bio(BIO_new(BIO_s_mem())); |
+ ScopedBIO bio(BIO_new(BIO_s_mem())); |
int res = export_fn(bio.get(), key); |
if (!res) |
@@ -50,8 +51,8 @@ bool ExportKey(EVP_PKEY* key, |
RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { |
OpenSSLErrStackTracer err_tracer(FROM_HERE); |
- ScopedOpenSSL<RSA, RSA_free> rsa_key(RSA_new()); |
- ScopedOpenSSL<BIGNUM, BN_free> bn(BN_new()); |
+ ScopedRSA rsa_key(RSA_new()); |
+ ScopedBIGNUM bn(BN_new()); |
if (!rsa_key.get() || !bn.get() || !BN_set_word(bn.get(), 65537L)) |
return NULL; |
@@ -75,15 +76,17 @@ RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo( |
OpenSSLErrStackTracer err_tracer(FROM_HERE); |
// BIO_new_mem_buf is not const aware, but it does not modify the buffer. |
char* data = reinterpret_cast<char*>(const_cast<uint8*>(&input[0])); |
- ScopedOpenSSL<BIO, BIO_free_all> bio(BIO_new_mem_buf(data, input.size())); |
+ ScopedBIO bio(BIO_new_mem_buf(data, input.size())); |
if (!bio.get()) |
return NULL; |
// Importing is a little more involved than exporting, as we must first |
// PKCS#8 decode the input, and then import the EVP_PKEY from Private Key |
// Info structure returned. |
- ScopedOpenSSL<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_free> p8inf( |
- d2i_PKCS8_PRIV_KEY_INFO_bio(bio.get(), NULL)); |
+ scoped_ptr<PKCS8_PRIV_KEY_INFO, |
+ OpenSSLDestroyer<PKCS8_PRIV_KEY_INFO, |
+ PKCS8_PRIV_KEY_INFO_free> > |
+ p8inf(d2i_PKCS8_PRIV_KEY_INFO_bio(bio.get(), NULL)); |
if (!p8inf.get()) |
return NULL; |