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

Side by Side Diff: net/cert/cert_verify_proc_builtin.cc

Issue 2760723002: Check X509Certificate::CreateFromHandle result. (Closed)
Patch Set: 2nd round of updates Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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_builtin.h" 5 #include "net/cert/cert_verify_proc_builtin.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #if defined(USE_NSS_CERTS) 10 #if defined(USE_NSS_CERTS)
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 intermediates.push_back(CreateOSCertHandle(path.path.certs[i])); 302 intermediates.push_back(CreateOSCertHandle(path.path.certs[i]));
303 303
304 if (path.path.trust_anchor) { 304 if (path.path.trust_anchor) {
305 // TODO(eroman): This assumes that TrustAnchor::cert() cannot be null, 305 // TODO(eroman): This assumes that TrustAnchor::cert() cannot be null,
306 // which disagrees with the documentation. 306 // which disagrees with the documentation.
307 intermediates.push_back(CreateOSCertHandle(path.path.trust_anchor->cert())); 307 intermediates.push_back(CreateOSCertHandle(path.path.trust_anchor->cert()));
308 } 308 }
309 309
310 scoped_refptr<X509Certificate> result = X509Certificate::CreateFromHandle( 310 scoped_refptr<X509Certificate> result = X509Certificate::CreateFromHandle(
311 target_cert->os_cert_handle(), intermediates); 311 target_cert->os_cert_handle(), intermediates);
312 // |target_cert| was already successfully parsed, so this should never fail.
313 DCHECK(result);
312 314
313 for (const X509Certificate::OSCertHandle handle : intermediates) 315 for (const X509Certificate::OSCertHandle handle : intermediates)
314 X509Certificate::FreeOSCertHandle(handle); 316 X509Certificate::FreeOSCertHandle(handle);
315 317
316 return result; 318 return result;
317 } 319 }
318 320
319 // TODO(crbug.com/649017): Make use of |flags|, |crl_set|, and |ocsp_response|. 321 // TODO(crbug.com/649017): Make use of |flags|, |crl_set|, and |ocsp_response|.
320 // Also handle key usages, policies and EV. 322 // Also handle key usages, policies and EV.
321 // 323 //
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 : OK; 429 : OK;
428 } 430 }
429 431
430 } // namespace 432 } // namespace
431 433
432 scoped_refptr<CertVerifyProc> CreateCertVerifyProcBuiltin() { 434 scoped_refptr<CertVerifyProc> CreateCertVerifyProcBuiltin() {
433 return scoped_refptr<CertVerifyProc>(new CertVerifyProcBuiltin()); 435 return scoped_refptr<CertVerifyProc>(new CertVerifyProcBuiltin());
434 } 436 }
435 437
436 } // namespace net 438 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698