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

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

Issue 23441005: net: mark cert as revoked if EV revocation check receives revoked response (Win). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « no previous file | net/url_request/url_request_unittest.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_win.h" 5 #include "net/cert/cert_verify_proc_win.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 NULL, // reserved 628 NULL, // reserved
629 &chain_context)) { 629 &chain_context)) {
630 verify_result->cert_status |= CERT_STATUS_INVALID; 630 verify_result->cert_status |= CERT_STATUS_INVALID;
631 return MapSecurityError(GetLastError()); 631 return MapSecurityError(GetLastError());
632 } 632 }
633 633
634 CRLSetResult crl_set_result = kCRLSetUnknown; 634 CRLSetResult crl_set_result = kCRLSetUnknown;
635 if (crl_set) 635 if (crl_set)
636 crl_set_result = CheckRevocationWithCRLSet(chain_context, crl_set); 636 crl_set_result = CheckRevocationWithCRLSet(chain_context, crl_set);
637 637
638 // redo_with_revocation_checking controls whether we verify the chain a
639 // second time, but with online revocation checking. If
640 // hard_fail_revocation_checking_when_redoing is also true then revocation
641 // information must be returned.
642 bool redo_with_revocation_checking = false;
643 bool hard_fail_revocation_checking_when_redoing = false;
644
638 if (crl_set_result == kCRLSetRevoked) { 645 if (crl_set_result == kCRLSetRevoked) {
639 verify_result->cert_status |= CERT_STATUS_REVOKED; 646 verify_result->cert_status |= CERT_STATUS_REVOKED;
640 } else if (crl_set_result == kCRLSetUnknown && 647 } else if (crl_set_result == kCRLSetUnknown &&
641 (flags & CertVerifier::VERIFY_REV_CHECKING_ENABLED_EV_ONLY) && 648 (flags & CertVerifier::VERIFY_REV_CHECKING_ENABLED_EV_ONLY) &&
642 !rev_checking_enabled && 649 !rev_checking_enabled &&
643 ev_policy_oid != NULL) { 650 ev_policy_oid != NULL) {
644 // We don't have fresh information about this chain from the CRLSet and 651 // We don't have fresh information about this chain from the CRLSet and
645 // it's probably an EV certificate. Retry with online revocation checking. 652 // it's probably an EV certificate. Retry with online revocation checking.
646 rev_checking_enabled = true; 653 redo_with_revocation_checking = true;
647 chain_flags &= ~CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY;
648 verify_result->cert_status |= CERT_STATUS_REV_CHECKING_ENABLED;
649
650 if (!CertGetCertificateChain(
651 chain_engine,
652 cert_list.get(),
653 NULL, // current system time
654 cert_list->hCertStore,
655 &chain_para,
656 chain_flags,
657 NULL, // reserved
658 &chain_context)) {
659 verify_result->cert_status |= CERT_STATUS_INVALID;
660 return MapSecurityError(GetLastError());
661 }
662 } 654 }
663 655
664 if (chain_context->TrustStatus.dwErrorStatus & 656 if (chain_context->TrustStatus.dwErrorStatus &
Ryan Sleevi 2013/08/27 19:25:07 So, there's a slight side-effect of changing the o
agl 2013/08/28 16:42:58 Ok, that's a fair point and I was really shuffling
665 CERT_TRUST_IS_NOT_VALID_FOR_USAGE) { 657 CERT_TRUST_IS_NOT_VALID_FOR_USAGE) {
666 ev_policy_oid = NULL; 658 ev_policy_oid = NULL;
667 chain_para.RequestedIssuancePolicy.Usage.cUsageIdentifier = 0; 659 chain_para.RequestedIssuancePolicy.Usage.cUsageIdentifier = 0;
668 chain_para.RequestedIssuancePolicy.Usage.rgpszUsageIdentifier = NULL; 660 chain_para.RequestedIssuancePolicy.Usage.rgpszUsageIdentifier = NULL;
669 CertFreeCertificateChain(chain_context); 661 CertFreeCertificateChain(chain_context);
670 if (!CertGetCertificateChain( 662 if (!CertGetCertificateChain(
671 chain_engine, 663 chain_engine,
672 cert_list.get(), 664 cert_list.get(),
673 NULL, // current system time 665 NULL, // current system time
674 cert_list->hCertStore, 666 cert_list->hCertStore,
675 &chain_para, 667 &chain_para,
676 chain_flags, 668 chain_flags,
677 NULL, // reserved 669 NULL, // reserved
678 &chain_context)) { 670 &chain_context)) {
679 verify_result->cert_status |= CERT_STATUS_INVALID; 671 verify_result->cert_status |= CERT_STATUS_INVALID;
680 return MapSecurityError(GetLastError()); 672 return MapSecurityError(GetLastError());
681 } 673 }
682 } 674 }
683 675
684 CertVerifyResult temp_verify_result = *verify_result; 676 CertVerifyResult temp_verify_result = *verify_result;
685 GetCertChainInfo(chain_context, verify_result); 677 GetCertChainInfo(chain_context, verify_result);
686 if (!verify_result->is_issued_by_known_root && 678 if (!verify_result->is_issued_by_known_root &&
687 (flags & CertVerifier::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS)) { 679 (flags & CertVerifier::VERIFY_REV_CHECKING_REQUIRED_LOCAL_ANCHORS)) {
680 // Hard-fail revocation checking has been requested for locally installed
681 // CAs.
682 redo_with_revocation_checking = true;
683 hard_fail_revocation_checking_when_redoing = true;
684 }
685
686 if (redo_with_revocation_checking) {
688 *verify_result = temp_verify_result; 687 *verify_result = temp_verify_result;
689 688
690 rev_checking_enabled = true; 689 rev_checking_enabled = true;
691 verify_result->cert_status |= CERT_STATUS_REV_CHECKING_ENABLED; 690 verify_result->cert_status |= CERT_STATUS_REV_CHECKING_ENABLED;
692 chain_flags &= ~CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY; 691 chain_flags &= ~CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY;
693 692
694 CertFreeCertificateChain(chain_context); 693 CertFreeCertificateChain(chain_context);
695 if (!CertGetCertificateChain( 694 if (!CertGetCertificateChain(
696 chain_engine, 695 chain_engine,
697 cert_list.get(), 696 cert_list.get(),
698 NULL, // current system time 697 NULL, // current system time
699 cert_list->hCertStore, 698 cert_list->hCertStore,
700 &chain_para, 699 &chain_para,
701 chain_flags, 700 chain_flags,
702 NULL, // reserved 701 NULL, // reserved
703 &chain_context)) { 702 &chain_context)) {
704 verify_result->cert_status |= CERT_STATUS_INVALID; 703 verify_result->cert_status |= CERT_STATUS_INVALID;
705 return MapSecurityError(GetLastError()); 704 return MapSecurityError(GetLastError());
706 } 705 }
707 GetCertChainInfo(chain_context, verify_result); 706 GetCertChainInfo(chain_context, verify_result);
708 707
709 if (chain_context->TrustStatus.dwErrorStatus & 708 if (hard_fail_revocation_checking_when_redoing &&
710 CERT_TRUST_IS_OFFLINE_REVOCATION) { 709 (chain_context->TrustStatus.dwErrorStatus &
710 CERT_TRUST_IS_OFFLINE_REVOCATION)) {
711 verify_result->cert_status |= CERT_STATUS_REVOKED; 711 verify_result->cert_status |= CERT_STATUS_REVOKED;
712 } 712 }
713 } 713 }
714 714
715 ScopedPCCERT_CHAIN_CONTEXT scoped_chain_context(chain_context); 715 ScopedPCCERT_CHAIN_CONTEXT scoped_chain_context(chain_context);
716 716
717 verify_result->cert_status |= MapCertChainErrorStatusToCertStatus( 717 verify_result->cert_status |= MapCertChainErrorStatusToCertStatus(
718 chain_context->TrustStatus.dwErrorStatus); 718 chain_context->TrustStatus.dwErrorStatus);
719 719
720 // Flag certificates that have a Subject common name with a NULL character. 720 // Flag certificates that have a Subject common name with a NULL character.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 return MapCertStatusToNetError(verify_result->cert_status); 781 return MapCertStatusToNetError(verify_result->cert_status);
782 782
783 if (ev_policy_oid && 783 if (ev_policy_oid &&
784 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { 784 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) {
785 verify_result->cert_status |= CERT_STATUS_IS_EV; 785 verify_result->cert_status |= CERT_STATUS_IS_EV;
786 } 786 }
787 return OK; 787 return OK;
788 } 788 }
789 789
790 } // namespace net 790 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698