| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 5 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "crypto/nss_util_internal.h" | 9 #include "crypto/nss_util_internal.h" |
| 10 #include "crypto/scoped_test_nss_chromeos_user.h" | 10 #include "crypto/scoped_test_nss_chromeos_user.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 int VerifyWithAdditionalTrustAnchors( | 78 int VerifyWithAdditionalTrustAnchors( |
| 79 net::CertVerifyProc* verify_proc, | 79 net::CertVerifyProc* verify_proc, |
| 80 const net::CertificateList& additional_trust_anchors, | 80 const net::CertificateList& additional_trust_anchors, |
| 81 net::X509Certificate* cert, | 81 net::X509Certificate* cert, |
| 82 std::string* root_subject_name) { | 82 std::string* root_subject_name) { |
| 83 int flags = 0; | 83 int flags = 0; |
| 84 net::CertVerifyResult verify_result; | 84 net::CertVerifyResult verify_result; |
| 85 int error = | 85 int error = |
| 86 verify_proc->Verify(cert, "127.0.0.1", std::string(), flags, NULL, | 86 verify_proc->Verify(cert, "127.0.0.1", std::string(), flags, NULL, |
| 87 additional_trust_anchors, &verify_result); | 87 additional_trust_anchors, &verify_result); |
| 88 if (verify_result.verified_cert.get() && | 88 if (!verify_result.verified_cert->GetIntermediateCertificates().empty()) { |
| 89 !verify_result.verified_cert->GetIntermediateCertificates().empty()) { | |
| 90 net::X509Certificate::OSCertHandle root = | 89 net::X509Certificate::OSCertHandle root = |
| 91 verify_result.verified_cert->GetIntermediateCertificates().back(); | 90 verify_result.verified_cert->GetIntermediateCertificates().back(); |
| 92 root_subject_name->assign(root->subjectName); | 91 root_subject_name->assign(root->subjectName); |
| 93 } else { | 92 } else { |
| 94 root_subject_name->clear(); | 93 root_subject_name->clear(); |
| 95 } | 94 } |
| 96 return error; | 95 return error; |
| 97 } | 96 } |
| 98 | 97 |
| 99 int Verify(net::CertVerifyProc* verify_proc, | 98 int Verify(net::CertVerifyProc* verify_proc, |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 371 |
| 373 INSTANTIATE_TEST_CASE_P( | 372 INSTANTIATE_TEST_CASE_P( |
| 374 Variations, | 373 Variations, |
| 375 CertVerifyProcChromeOSOrderingTest, | 374 CertVerifyProcChromeOSOrderingTest, |
| 376 ::testing::Combine( | 375 ::testing::Combine( |
| 377 ::testing::Bool(), | 376 ::testing::Bool(), |
| 378 ::testing::Range(0, 1 << 2), | 377 ::testing::Range(0, 1 << 2), |
| 379 ::testing::Values("d12", "d21", "1d2", "12d", "2d1", "21d"))); | 378 ::testing::Values("d12", "d21", "1d2", "12d", "2d1", "21d"))); |
| 380 | 379 |
| 381 } // namespace chromeos | 380 } // namespace chromeos |
| OLD | NEW |