OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ssl_config_service_mac.h" | 5 #include "net/base/ssl_config_service_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 | 8 |
9 #include "base/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 | 10 |
11 using base::TimeDelta; | 11 using base::TimeDelta; |
12 using base::TimeTicks; | 12 using base::TimeTicks; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 static const int kConfigUpdateInterval = 10; // seconds | 18 static const int kConfigUpdateInterval = 10; // seconds |
19 | 19 |
20 static const bool kSSL2EnabledDefaultValue = false; | 20 static const bool kSSL2EnabledDefaultValue = false; |
21 static const bool kSSL3EnabledDefaultValue = true; | 21 static const bool kSSL3EnabledDefaultValue = true; |
22 static const bool kTLS1EnabledDefaultValue = true; | 22 static const bool kTLS1EnabledDefaultValue = true; |
23 | 23 |
24 static CFStringRef kRevocationPreferencesIdentifier = | 24 static CFStringRef kRevocationPreferencesIdentifier = |
25 CFSTR("com.apple.security.revocation"); | 25 CFSTR("com.apple.security.revocation"); |
26 static CFStringRef kOCSPStyleKey = CFSTR("OCSPStyle"); | 26 static CFStringRef kOCSPStyleKey = CFSTR("OCSPStyle"); |
27 static CFStringRef kCRLStyleKey = CFSTR("CRLStyle"); | 27 static CFStringRef kCRLStyleKey = CFSTR("CRLStyle"); |
28 static CFStringRef kNoneRevocationValue = CFSTR("None"); | 28 static CFStringRef kNoneRevocationValue = CFSTR("None"); |
29 static CFStringRef kBestAttemptRevocationValue = CFSTR("BestAttempt"); | 29 static CFStringRef kBestAttemptRevocationValue = CFSTR("BestAttempt"); |
30 static CFStringRef kSSL2EnabledKey = CFSTR("org.chromium.ssl.ssl2"); | 30 static CFStringRef kSSL2EnabledKey = CFSTR("org.chromium.ssl.ssl2"); |
31 static CFStringRef kSSL3EnabledKey = CFSTR("org.chromium.ssl.ssl3"); | 31 static CFStringRef kSSL3EnabledKey = CFSTR("org.chromium.ssl.ssl3"); |
32 static CFStringRef kTLS1EnabledKey = CFSTR("org.chromium.ssl.tls1"); | 32 static CFStringRef kTLS1EnabledKey = CFSTR("org.chromium.ssl.tls1"); |
33 | 33 |
34 bool RevocationStyleIsEnabled(CFStringRef key) { | 34 bool RevocationStyleIsEnabled(CFStringRef key) { |
35 CFPropertyListRef plist_ref = CFPreferencesCopyValue(key, | 35 CFPropertyListRef plist_ref = CFPreferencesCopyValue(key, |
36 kRevocationPreferencesIdentifier, kCFPreferencesCurrentUser, | 36 kRevocationPreferencesIdentifier, kCFPreferencesCurrentUser, |
37 kCFPreferencesAnyHost); | 37 kCFPreferencesAnyHost); |
38 if (plist_ref) { | 38 if (plist_ref) { |
39 scoped_cftyperef<CFPropertyListRef> scoped_plist_ref(plist_ref); | 39 base::mac::ScopedCFTypeRef<CFPropertyListRef> scoped_plist_ref(plist_ref); |
40 if (CFGetTypeID(plist_ref) == CFStringGetTypeID()) { | 40 if (CFGetTypeID(plist_ref) == CFStringGetTypeID()) { |
41 CFStringRef style = reinterpret_cast<CFStringRef>(plist_ref); | 41 CFStringRef style = reinterpret_cast<CFStringRef>(plist_ref); |
42 if (CFStringCompare(kNoneRevocationValue, style, | 42 if (CFStringCompare(kNoneRevocationValue, style, |
43 kCFCompareCaseInsensitive)) | 43 kCFCompareCaseInsensitive)) |
44 return true; | 44 return true; |
45 } | 45 } |
46 } | 46 } |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void SSLConfigServiceMac::UpdateConfig(TimeTicks now) { | 142 void SSLConfigServiceMac::UpdateConfig(TimeTicks now) { |
143 SSLConfig orig_config = config_info_; | 143 SSLConfig orig_config = config_info_; |
144 GetSSLConfigNow(&config_info_); | 144 GetSSLConfigNow(&config_info_); |
145 if (ever_updated_) | 145 if (ever_updated_) |
146 ProcessConfigUpdate(orig_config, config_info_); | 146 ProcessConfigUpdate(orig_config, config_info_); |
147 config_time_ = now; | 147 config_time_ = now; |
148 ever_updated_ = true; | 148 ever_updated_ = true; |
149 } | 149 } |
150 | 150 |
151 } // namespace net | 151 } // namespace net |
OLD | NEW |