OLD | NEW |
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-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 "base/nss_init.h" | 5 #include "base/nss_init.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <nss.h> | 8 #include <nss.h> |
9 #include <plarena.h> | 9 #include <plarena.h> |
10 #include <prerror.h> | 10 #include <prerror.h> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (slot) { | 108 if (slot) { |
109 if (PK11_NeedUserInit(slot)) | 109 if (PK11_NeedUserInit(slot)) |
110 PK11_InitPin(slot, NULL, NULL); | 110 PK11_InitPin(slot, NULL, NULL); |
111 PK11_FreeSlot(slot); | 111 PK11_FreeSlot(slot); |
112 } | 112 } |
113 | 113 |
114 root_ = InitDefaultRootCerts(); | 114 root_ = InitDefaultRootCerts(); |
115 | 115 |
116 NSS_SetDomesticPolicy(); | 116 NSS_SetDomesticPolicy(); |
117 | 117 |
| 118 #if defined(USE_SYSTEM_SSL) |
118 // Use late binding to avoid scary but benign warning | 119 // Use late binding to avoid scary but benign warning |
119 // "Symbol `SSL_ImplementedCiphers' has different size in shared object, | 120 // "Symbol `SSL_ImplementedCiphers' has different size in shared object, |
120 // consider re-linking" | 121 // consider re-linking" |
121 const PRUint16* pSSL_ImplementedCiphers = static_cast<const PRUint16*>( | 122 const PRUint16* pSSL_ImplementedCiphers = static_cast<const PRUint16*>( |
122 dlsym(RTLD_DEFAULT, "SSL_ImplementedCiphers")); | 123 dlsym(RTLD_DEFAULT, "SSL_ImplementedCiphers")); |
123 if (pSSL_ImplementedCiphers == NULL) { | 124 if (pSSL_ImplementedCiphers == NULL) { |
124 NOTREACHED() << "Can't get list of supported ciphers"; | 125 NOTREACHED() << "Can't get list of supported ciphers"; |
125 return; | 126 return; |
126 } | 127 } |
| 128 #else |
| 129 #define pSSL_ImplementedCiphers SSL_ImplementedCiphers |
| 130 #endif |
127 | 131 |
128 // Explicitly enable exactly those ciphers with keys of at least 80 bits | 132 // Explicitly enable exactly those ciphers with keys of at least 80 bits |
129 for (int i = 0; i < SSL_NumImplementedCiphers; i++) { | 133 for (int i = 0; i < SSL_NumImplementedCiphers; i++) { |
130 SSLCipherSuiteInfo info; | 134 SSLCipherSuiteInfo info; |
131 if (SSL_GetCipherSuiteInfo(pSSL_ImplementedCiphers[i], &info, | 135 if (SSL_GetCipherSuiteInfo(pSSL_ImplementedCiphers[i], &info, |
132 sizeof(info)) == SECSuccess) { | 136 sizeof(info)) == SECSuccess) { |
133 SSL_CipherPrefSetDefault(pSSL_ImplementedCiphers[i], | 137 SSL_CipherPrefSetDefault(pSSL_ImplementedCiphers[i], |
134 (info.effectiveKeyBits >= 80)); | 138 (info.effectiveKeyBits >= 80)); |
135 } | 139 } |
136 } | 140 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 176 |
173 void EnsureNSPRInit() { | 177 void EnsureNSPRInit() { |
174 Singleton<NSPRInitSingleton>::get(); | 178 Singleton<NSPRInitSingleton>::get(); |
175 } | 179 } |
176 | 180 |
177 void EnsureNSSInit() { | 181 void EnsureNSSInit() { |
178 Singleton<NSSInitSingleton>::get(); | 182 Singleton<NSSInitSingleton>::get(); |
179 } | 183 } |
180 | 184 |
181 } // namespace base | 185 } // namespace base |
OLD | NEW |