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

Side by Side Diff: net/cert/cert_verify_proc_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/cert/cert_database_openssl.cc ('k') | net/cert/ct_log_verifier_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_verify_proc_openssl.h" 5 #include "net/cert/cert_verify_proc_openssl.h"
6 6
7 #include <openssl/x509v3.h> 7 #include <openssl/x509v3.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/sha1.h" 13 #include "base/sha1.h"
14 #include "crypto/openssl_util.h" 14 #include "crypto/openssl_util.h"
15 #include "crypto/scoped_openssl_types.h"
15 #include "crypto/sha2.h" 16 #include "crypto/sha2.h"
16 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
17 #include "net/cert/asn1_util.h" 18 #include "net/cert/asn1_util.h"
18 #include "net/cert/cert_status_flags.h" 19 #include "net/cert/cert_status_flags.h"
19 #include "net/cert/cert_verifier.h" 20 #include "net/cert/cert_verifier.h"
20 #include "net/cert/cert_verify_result.h" 21 #include "net/cert/cert_verify_result.h"
21 #include "net/cert/test_root_certs.h" 22 #include "net/cert/test_root_certs.h"
22 #include "net/cert/x509_certificate.h" 23 #include "net/cert/x509_certificate.h"
23 24
24 namespace net { 25 namespace net {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 CRLSet* crl_set, 191 CRLSet* crl_set,
191 const CertificateList& additional_trust_anchors, 192 const CertificateList& additional_trust_anchors,
192 CertVerifyResult* verify_result) { 193 CertVerifyResult* verify_result) {
193 crypto::EnsureOpenSSLInit(); 194 crypto::EnsureOpenSSLInit();
194 195
195 if (!cert->VerifyNameMatch(hostname, 196 if (!cert->VerifyNameMatch(hostname,
196 &verify_result->common_name_fallback_used)) { 197 &verify_result->common_name_fallback_used)) {
197 verify_result->cert_status |= CERT_STATUS_COMMON_NAME_INVALID; 198 verify_result->cert_status |= CERT_STATUS_COMMON_NAME_INVALID;
198 } 199 }
199 200
200 crypto::ScopedOpenSSL<X509_STORE_CTX, X509_STORE_CTX_free> ctx( 201 crypto::ScopedOpenSSL<X509_STORE_CTX, X509_STORE_CTX_free>::Type ctx(
201 X509_STORE_CTX_new()); 202 X509_STORE_CTX_new());
202 203
203 crypto::ScopedOpenSSL<STACK_OF(X509), sk_X509_free_fn> intermediates( 204 crypto::ScopedOpenSSL<STACK_OF(X509), sk_X509_free_fn>::Type intermediates(
204 sk_X509_new_null()); 205 sk_X509_new_null());
205 if (!intermediates.get()) 206 if (!intermediates.get())
206 return ERR_OUT_OF_MEMORY; 207 return ERR_OUT_OF_MEMORY;
207 208
208 const X509Certificate::OSCertHandles& os_intermediates = 209 const X509Certificate::OSCertHandles& os_intermediates =
209 cert->GetIntermediateCertificates(); 210 cert->GetIntermediateCertificates();
210 for (X509Certificate::OSCertHandles::const_iterator it = 211 for (X509Certificate::OSCertHandles::const_iterator it =
211 os_intermediates.begin(); it != os_intermediates.end(); ++it) { 212 os_intermediates.begin(); it != os_intermediates.end(); ++it) {
212 if (!sk_X509_push(intermediates.get(), *it)) 213 if (!sk_X509_push(intermediates.get(), *it))
213 return ERR_OUT_OF_MEMORY; 214 return ERR_OUT_OF_MEMORY;
(...skipping 17 matching lines...) Expand all
231 232
232 GetCertChainInfo(ctx.get(), verify_result); 233 GetCertChainInfo(ctx.get(), verify_result);
233 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes); 234 AppendPublicKeyHashes(ctx.get(), &verify_result->public_key_hashes);
234 if (IsCertStatusError(verify_result->cert_status)) 235 if (IsCertStatusError(verify_result->cert_status))
235 return MapCertStatusToNetError(verify_result->cert_status); 236 return MapCertStatusToNetError(verify_result->cert_status);
236 237
237 return OK; 238 return OK;
238 } 239 }
239 240
240 } // namespace net 241 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_database_openssl.cc ('k') | net/cert/ct_log_verifier_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698