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/test_root_certs.h" | 5 #include "net/cert/test_root_certs.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include <stdint.h> |
| 8 |
8 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/win/win_util.h" | 11 #include "base/win/win_util.h" |
11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
12 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, | 93 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, |
93 DWORD encoding, | 94 DWORD encoding, |
94 HCRYPTPROV crypt_provider, | 95 HCRYPTPROV crypt_provider, |
95 DWORD flags, | 96 DWORD flags, |
96 const void* store_name, | 97 const void* store_name, |
97 HCERTSTORE memory_store, | 98 HCERTSTORE memory_store, |
98 PCERT_STORE_PROV_INFO store_info) { | 99 PCERT_STORE_PROV_INFO store_info) { |
99 // If the high word is all zeroes, then |store_provider| is a numeric ID. | 100 // If the high word is all zeroes, then |store_provider| is a numeric ID. |
100 // Otherwise, it's a pointer to a null-terminated ASCII string. See the | 101 // Otherwise, it's a pointer to a null-terminated ASCII string. See the |
101 // documentation for CryptGetOIDFunctionAddress for more information. | 102 // documentation for CryptGetOIDFunctionAddress for more information. |
102 uint32 store_as_uint = reinterpret_cast<uint32>(store_provider); | 103 uint32_t store_as_uint = reinterpret_cast<uint32_t>(store_provider); |
103 if (store_as_uint > 0xFFFF || store_provider != CERT_STORE_PROV_SYSTEM_W || | 104 if (store_as_uint > 0xFFFF || store_provider != CERT_STORE_PROV_SYSTEM_W || |
104 !g_capi_injector.Get().original_function) | 105 !g_capi_injector.Get().original_function) |
105 return FALSE; | 106 return FALSE; |
106 | 107 |
107 BOOL ok = g_capi_injector.Get().original_function(store_provider, encoding, | 108 BOOL ok = g_capi_injector.Get().original_function(store_provider, encoding, |
108 crypt_provider, flags, | 109 crypt_provider, flags, |
109 store_name, memory_store, | 110 store_name, memory_store, |
110 store_info); | 111 store_info); |
111 // Only the Root store should have certificates injected. If | 112 // Only the Root store should have certificates injected. If |
112 // CERT_SYSTEM_STORE_RELOCATE_FLAG is set, then |store_name| points to a | 113 // CERT_SYSTEM_STORE_RELOCATE_FLAG is set, then |store_name| points to a |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 void TestRootCerts::Init() { | 205 void TestRootCerts::Init() { |
205 empty_ = true; | 206 empty_ = true; |
206 temporary_roots_ = CertOpenStore( | 207 temporary_roots_ = CertOpenStore( |
207 CERT_STORE_PROV_MEMORY, 0, NULL, | 208 CERT_STORE_PROV_MEMORY, 0, NULL, |
208 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); | 209 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); |
209 DCHECK(temporary_roots_); | 210 DCHECK(temporary_roots_); |
210 } | 211 } |
211 | 212 |
212 } // namespace net | 213 } // namespace net |
OLD | NEW |