Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.h" | 5 #include "net/cert/cert_verify_proc.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 DigestAlgorithm::Sha384; | 635 DigestAlgorithm::Sha384; |
| 636 | 636 |
| 637 struct CertParams { | 637 struct CertParams { |
| 638 // Certificate.signatureAlgorithm | 638 // Certificate.signatureAlgorithm |
| 639 DigestAlgorithm cert_algorithm; | 639 DigestAlgorithm cert_algorithm; |
| 640 | 640 |
| 641 // TBSCertificate.algorithm | 641 // TBSCertificate.algorithm |
| 642 DigestAlgorithm tbs_algorithm; | 642 DigestAlgorithm tbs_algorithm; |
| 643 }; | 643 }; |
| 644 | 644 |
| 645 // On iOS trying to import a certificate with mismatched signature will | 645 // On iOS trying to import a certificate with mismatched signature will |
|
eroman
2017/03/14 06:35:02
Can you update this comment?
eroman
2017/03/14 07:15:55
(FTR, I checked the commit box before you could re
| |
| 646 // fail. Consequently the rest of the tests can't be performed. | 646 // fail. Consequently the rest of the tests can't be performed. |
| 647 WARN_UNUSED_RESULT bool SupportsImportingMismatchedAlgorithms() const { | 647 WARN_UNUSED_RESULT bool SupportsImportingMismatchedAlgorithms() const { |
| 648 #if defined(OS_IOS) | 648 #if defined(OS_IOS) |
| 649 LOG(INFO) << "Skipping test on iOS because certs with mismatched " | 649 LOG(INFO) << "Skipping test on iOS because certs with mismatched " |
| 650 "algorithms cannot be imported"; | 650 "algorithms cannot be imported"; |
| 651 return false; | 651 return false; |
| 652 #elif defined(OS_MACOSX) | |
| 653 if (base::mac::IsAtLeastOS10_12()) { | |
| 654 LOG(INFO) << "Skipping test on macOS >= 10.12 because certs with " | |
| 655 "mismatched algorithms cannot be imported"; | |
| 656 return false; | |
| 657 } | |
| 658 return true; | |
| 652 #else | 659 #else |
| 653 return true; | 660 return true; |
| 654 #endif | 661 #endif |
| 655 } | 662 } |
| 656 | 663 |
| 657 // Shorthand for VerifyChain() where only the leaf's parameters need | 664 // Shorthand for VerifyChain() where only the leaf's parameters need |
| 658 // to be specified. | 665 // to be specified. |
| 659 WARN_UNUSED_RESULT int VerifyLeaf(const CertParams& leaf_params) { | 666 WARN_UNUSED_RESULT int VerifyLeaf(const CertParams& leaf_params) { |
| 660 return VerifyChain({// Target | 667 return VerifyChain({// Target |
| 661 leaf_params, | 668 leaf_params, |
| (...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2310 int flags = 0; | 2317 int flags = 0; |
| 2311 CertVerifyResult verify_result; | 2318 CertVerifyResult verify_result; |
| 2312 int error = verify_proc->Verify(cert.get(), "127.0.0.1", std::string(), flags, | 2319 int error = verify_proc->Verify(cert.get(), "127.0.0.1", std::string(), flags, |
| 2313 NULL, CertificateList(), &verify_result); | 2320 NULL, CertificateList(), &verify_result); |
| 2314 EXPECT_EQ(OK, error); | 2321 EXPECT_EQ(OK, error); |
| 2315 histograms.ExpectTotalCount(kTLSFeatureExtensionHistogram, 0); | 2322 histograms.ExpectTotalCount(kTLSFeatureExtensionHistogram, 0); |
| 2316 histograms.ExpectTotalCount(kTLSFeatureExtensionOCSPHistogram, 0); | 2323 histograms.ExpectTotalCount(kTLSFeatureExtensionOCSPHistogram, 0); |
| 2317 } | 2324 } |
| 2318 | 2325 |
| 2319 } // namespace net | 2326 } // namespace net |
| OLD | NEW |