Chromium Code Reviews| Index: crypto/rsa_private_key_openssl.cc |
| diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc |
| index b9902a0e3d243ab2388aa4552a071610d8b27d59..63efb9c4f875e2e50b85ded1c7ed2664bca0aff7 100644 |
| --- a/crypto/rsa_private_key_openssl.cc |
| +++ b/crypto/rsa_private_key_openssl.cc |
| @@ -40,8 +40,7 @@ bool ExportKey(EVP_PKEY* key, |
| if (!data || len < 0) |
| return false; |
| - std::vector<uint8> for_output(data, data + len); |
| - output->swap(for_output); |
| + output->assign(data, data + len); |
| return true; |
| } |
| @@ -76,11 +75,12 @@ RSAPrivateKey* RSAPrivateKey::CreateSensitive(uint16 num_bits) { |
| // static |
| RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo( |
| const std::vector<uint8>& input) { |
| - OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| + if (input.empty()) |
| + return NULL; |
| + 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*>( |
| - vector_as_array(&input))); |
|
Denis Lagno
2011/07/20 11:13:59
some methods from stl_util are still widely used a
|
| + char* data = reinterpret_cast<char*>(const_cast<uint8*>(&input[0])); |
| ScopedOpenSSL<BIO, BIO_free_all> bio(BIO_new_mem_buf(data, input.size())); |
| if (!bio.get()) |
| return NULL; |