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

Side by Side Diff: crypto/ec_private_key_openssl.cc

Issue 1129083007: Replace EVP_PKEY_dup calls with EVP_PKEY_up_ref. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | crypto/rsa_private_key_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/ec_private_key.h" 5 #include "crypto/ec_private_key.h"
6 6
7 #include <openssl/ec.h> 7 #include <openssl/ec.h>
8 #include <openssl/evp.h> 8 #include <openssl/evp.h>
9 #include <openssl/pkcs12.h> 9 #include <openssl/pkcs12.h>
10 #include <openssl/x509.h> 10 #include <openssl/x509.h>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } // namespace 81 } // namespace
82 82
83 ECPrivateKey::~ECPrivateKey() { 83 ECPrivateKey::~ECPrivateKey() {
84 if (key_) 84 if (key_)
85 EVP_PKEY_free(key_); 85 EVP_PKEY_free(key_);
86 } 86 }
87 87
88 ECPrivateKey* ECPrivateKey::Copy() const { 88 ECPrivateKey* ECPrivateKey::Copy() const {
89 scoped_ptr<ECPrivateKey> copy(new ECPrivateKey); 89 scoped_ptr<ECPrivateKey> copy(new ECPrivateKey);
90 if (key_) 90 if (key_)
91 copy->key_ = EVP_PKEY_dup(key_); 91 copy->key_ = EVP_PKEY_up_ref(key_);
92 return copy.release(); 92 return copy.release();
93 } 93 }
94 94
95 // static 95 // static
96 bool ECPrivateKey::IsSupported() { return true; } 96 bool ECPrivateKey::IsSupported() { return true; }
97 97
98 // static 98 // static
99 ECPrivateKey* ECPrivateKey::Create() { 99 ECPrivateKey* ECPrivateKey::Create() {
100 OpenSSLErrStackTracer err_tracer(FROM_HERE); 100 OpenSSLErrStackTracer err_tracer(FROM_HERE);
101 101
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 OpenSSLErrStackTracer err_tracer(FROM_HERE); 229 OpenSSLErrStackTracer err_tracer(FROM_HERE);
230 ScopedEC_KEY ec_key(EVP_PKEY_get1_EC_KEY(key_)); 230 ScopedEC_KEY ec_key(EVP_PKEY_get1_EC_KEY(key_));
231 return ExportKey(ec_key.get(), 231 return ExportKey(ec_key.get(),
232 reinterpret_cast<ExportDataFunction>(i2d_ECParameters), 232 reinterpret_cast<ExportDataFunction>(i2d_ECParameters),
233 output); 233 output);
234 } 234 }
235 235
236 ECPrivateKey::ECPrivateKey() : key_(NULL) {} 236 ECPrivateKey::ECPrivateKey() : key_(NULL) {}
237 237
238 } // namespace crypto 238 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | crypto/rsa_private_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698