Commit 5a7cadf1 authored by agl's avatar agl Committed by Commit bot

Switch to OpenSSL's |EVP_PKEY_up_ref| signature.

|EVP_PKEY_up_ref| was a BoringSSL addition to OpenSSL The next major,
public OpenSSL release will include it, but it'll return 0/1 rather than
the object being referenced.

This change updates Chromium to expect that function signature (in a
backwards compatible way). Once all callers have been updated likewise,
BoringSSL will align this function with upstream OpenSSL.

BUG=none

Review-Url: https://codereview.chromium.org/2113143004
Cr-Commit-Position: refs/heads/master@{#405192}
parent 21ab2431
......@@ -146,8 +146,10 @@ std::unique_ptr<ECPrivateKey> ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
std::unique_ptr<ECPrivateKey> ECPrivateKey::Copy() const {
std::unique_ptr<ECPrivateKey> copy(new ECPrivateKey());
if (key_)
copy->key_ = EVP_PKEY_up_ref(key_);
if (key_) {
EVP_PKEY_up_ref(key_);
copy->key_ = key_;
}
return copy;
}
......
......@@ -62,7 +62,8 @@ std::unique_ptr<RSAPrivateKey> RSAPrivateKey::CreateFromKey(EVP_PKEY* key) {
if (EVP_PKEY_type(key->type) != EVP_PKEY_RSA)
return nullptr;
std::unique_ptr<RSAPrivateKey> copy(new RSAPrivateKey);
copy->key_ = EVP_PKEY_up_ref(key);
EVP_PKEY_up_ref(key);
copy->key_ = key;
return copy;
}
......
......@@ -455,8 +455,9 @@ class SSLServerSocketTest : public PlatformTest {
ReadTestKey(private_key_file_name);
ASSERT_TRUE(key);
client_ssl_config_.client_private_key = WrapOpenSSLPrivateKey(
crypto::ScopedEVP_PKEY(EVP_PKEY_up_ref(key->key())));
EVP_PKEY_up_ref(key->key());
client_ssl_config_.client_private_key =
WrapOpenSSLPrivateKey(crypto::ScopedEVP_PKEY(key->key()));
}
void ConfigureClientCertsForServer() {
......
......@@ -39,16 +39,18 @@ OpenSSLClientKeyStore::~OpenSSLClientKeyStore() {
}
OpenSSLClientKeyStore::KeyPair::KeyPair(EVP_PKEY* pub_key, EVP_PKEY* priv_key)
: public_key(EVP_PKEY_up_ref(pub_key)),
private_key(EVP_PKEY_up_ref(priv_key)) {
: public_key(pub_key), private_key(priv_key) {
EVP_PKEY_up_ref(pub_key);
EVP_PKEY_up_ref(priv_key);
}
OpenSSLClientKeyStore::KeyPair::~KeyPair() {
}
OpenSSLClientKeyStore::KeyPair::KeyPair(const KeyPair& other)
: public_key(EVP_PKEY_up_ref(other.public_key.get())),
private_key(EVP_PKEY_up_ref(other.private_key.get())) {
: public_key(other.public_key.get()), private_key(other.private_key.get()) {
EVP_PKEY_up_ref(public_key.get());
EVP_PKEY_up_ref(private_key.get());
}
void OpenSSLClientKeyStore::KeyPair::operator=(KeyPair other) {
......@@ -109,8 +111,8 @@ crypto::ScopedEVP_PKEY OpenSSLClientKeyStore::FetchClientCertPrivateKey(
if (index < 0)
return crypto::ScopedEVP_PKEY();
return crypto::ScopedEVP_PKEY(
EVP_PKEY_up_ref(pairs_[index].private_key.get()));
EVP_PKEY_up_ref(pairs_[index].private_key.get());
return crypto::ScopedEVP_PKEY(pairs_[index].private_key.get());
}
void OpenSSLClientKeyStore::Flush() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment