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

Side by Side Diff: net/base/x509_certificate.cc

Issue 9699043: net: fallback to online revocation checks for EV status when CRLSet has expired. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 9 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
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/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/base64.h" 14 #include "base/base64.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/pickle.h" 19 #include "base/pickle.h"
20 #include "base/sha1.h" 20 #include "base/sha1.h"
21 #include "base/string_piece.h" 21 #include "base/string_piece.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/time.h" 24 #include "base/time.h"
25 #include "googleurl/src/url_canon_ip.h" 25 #include "googleurl/src/url_canon_ip.h"
26 #include "net/base/cert_status_flags.h" 26 #include "net/base/cert_status_flags.h"
27 #include "net/base/cert_verify_result.h" 27 #include "net/base/cert_verify_result.h"
28 #include "net/base/crl_set.h"
28 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
29 #include "net/base/net_util.h" 30 #include "net/base/net_util.h"
30 #include "net/base/pem_tokenizer.h" 31 #include "net/base/pem_tokenizer.h"
31 32
32 namespace net { 33 namespace net {
33 34
34 namespace { 35 namespace {
35 36
36 // Indicates the order to use when trying to decode binary data, which is 37 // Indicates the order to use when trying to decode binary data, which is
37 // based on (speculation) as to what will be most common -> least common 38 // based on (speculation) as to what will be most common -> least common
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 CRLSet* crl_set, 599 CRLSet* crl_set,
599 CertVerifyResult* verify_result) const { 600 CertVerifyResult* verify_result) const {
600 verify_result->Reset(); 601 verify_result->Reset();
601 verify_result->verified_cert = const_cast<X509Certificate*>(this); 602 verify_result->verified_cert = const_cast<X509Certificate*>(this);
602 603
603 if (IsBlacklisted()) { 604 if (IsBlacklisted()) {
604 verify_result->cert_status |= CERT_STATUS_REVOKED; 605 verify_result->cert_status |= CERT_STATUS_REVOKED;
605 return ERR_CERT_REVOKED; 606 return ERR_CERT_REVOKED;
606 } 607 }
607 608
609 // If we were asked to attempt EV verification and we are missing a CRLSet,
610 // or if the CRLSet has expired, then we enable online revocation checks. If
611 // the online check fails, we wont show the EV status.
wtc 2012/03/16 00:33:10 Nit: wont => won't It may be a good idea to docum
agl 2012/03/20 20:02:19 Done
612 if ((flags & VERIFY_EV_CERT) && (!crl_set || crl_set->IsExpired()))
Ryan Sleevi 2012/03/16 00:50:52 Comment nit: In past reviews, I've been dinged for
agl 2012/03/20 20:02:19 Have de-we'ed the comment.
613 flags |= VERIFY_REV_CHECKING_ENABLED;
614
608 int rv = VerifyInternal(hostname, flags, crl_set, verify_result); 615 int rv = VerifyInternal(hostname, flags, crl_set, verify_result);
609 616
610 // This check is done after VerifyInternal so that VerifyInternal can fill in 617 // This check is done after VerifyInternal so that VerifyInternal can fill in
611 // the list of public key hashes. 618 // the list of public key hashes.
612 if (IsPublicKeyBlacklisted(verify_result->public_key_hashes)) { 619 if (IsPublicKeyBlacklisted(verify_result->public_key_hashes)) {
613 verify_result->cert_status |= CERT_STATUS_REVOKED; 620 verify_result->cert_status |= CERT_STATUS_REVOKED;
614 rv = MapCertStatusToNetError(verify_result->cert_status); 621 rv = MapCertStatusToNetError(verify_result->cert_status);
615 } 622 }
616 623
617 // Check for weak keys in the entire verified chain. 624 // Check for weak keys in the entire verified chain.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash, 869 bool X509Certificate::IsSHA1HashInSortedArray(const SHA1Fingerprint& hash,
863 const uint8* array, 870 const uint8* array,
864 size_t array_byte_len) { 871 size_t array_byte_len) {
865 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length); 872 DCHECK_EQ(0u, array_byte_len % base::kSHA1Length);
866 const size_t arraylen = array_byte_len / base::kSHA1Length; 873 const size_t arraylen = array_byte_len / base::kSHA1Length;
867 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length, 874 return NULL != bsearch(hash.data, array, arraylen, base::kSHA1Length,
868 CompareSHA1Hashes); 875 CompareSHA1Hashes);
869 } 876 }
870 877
871 } // namespace net 878 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698