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

Side by Side Diff: net/cert/cert_database_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/openssl_private_key_store_android.cc ('k') | net/cert/cert_verify_proc_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 "net/cert/cert_database.h" 5 #include "net/cert/cert_database.h"
6 6
7 #include <openssl/x509.h> 7 #include <openssl/x509.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/observer_list_threadsafe.h" 10 #include "base/observer_list_threadsafe.h"
11 #include "crypto/openssl_util.h" 11 #include "crypto/scoped_openssl_types.h"
12 #include "net/base/crypto_module.h" 12 #include "net/base/crypto_module.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/base/openssl_private_key_store.h" 14 #include "net/base/openssl_private_key_store.h"
15 #include "net/cert/x509_certificate.h" 15 #include "net/cert/x509_certificate.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 CertDatabase::CertDatabase() 19 CertDatabase::CertDatabase()
20 : observer_list_(new ObserverListThreadSafe<Observer>) { 20 : observer_list_(new ObserverListThreadSafe<Observer>) {
21 } 21 }
(...skipping 11 matching lines...) Expand all
33 // Try to check for a private key in the in-memory store to check 33 // Try to check for a private key in the in-memory store to check
34 // for the case when the browser is trying to install a server-generated 34 // for the case when the browser is trying to install a server-generated
35 // certificate from a <keygen> exchange. 35 // certificate from a <keygen> exchange.
36 int CertDatabase::CheckUserCert(X509Certificate* cert) { 36 int CertDatabase::CheckUserCert(X509Certificate* cert) {
37 if (!cert) 37 if (!cert)
38 return ERR_CERT_INVALID; 38 return ERR_CERT_INVALID;
39 if (cert->HasExpired()) 39 if (cert->HasExpired())
40 return ERR_CERT_DATE_INVALID; 40 return ERR_CERT_DATE_INVALID;
41 41
42 // X509_PUBKEY_get() transfers ownership, not X509_get_X509_PUBKEY() 42 // X509_PUBKEY_get() transfers ownership, not X509_get_X509_PUBKEY()
43 crypto::ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free> public_key( 43 crypto::ScopedEVP_PKEY public_key(
44 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle()))); 44 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())));
45 45
46 if (!OpenSSLPrivateKeyStore::HasPrivateKey(public_key.get())) 46 if (!OpenSSLPrivateKeyStore::HasPrivateKey(public_key.get()))
47 return ERR_NO_PRIVATE_KEY_FOR_CERT; 47 return ERR_NO_PRIVATE_KEY_FOR_CERT;
48 48
49 return OK; 49 return OK;
50 } 50 }
51 51
52 int CertDatabase::AddUserCert(X509Certificate* cert) { 52 int CertDatabase::AddUserCert(X509Certificate* cert) {
53 // There is no certificate store on the Linux/OpenSSL build. 53 // There is no certificate store on the Linux/OpenSSL build.
54 NOTIMPLEMENTED(); 54 NOTIMPLEMENTED();
55 return ERR_NOT_IMPLEMENTED; 55 return ERR_NOT_IMPLEMENTED;
56 } 56 }
57 57
58 } // namespace net 58 } // namespace net
OLDNEW
« no previous file with comments | « net/base/openssl_private_key_store_android.cc ('k') | net/cert/cert_verify_proc_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698