| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, | 93 BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider, |
| 94 DWORD encoding, | 94 DWORD encoding, |
| 95 HCRYPTPROV crypt_provider, | 95 HCRYPTPROV crypt_provider, |
| 96 DWORD flags, | 96 DWORD flags, |
| 97 const void* store_name, | 97 const void* store_name, |
| 98 HCERTSTORE memory_store, | 98 HCERTSTORE memory_store, |
| 99 PCERT_STORE_PROV_INFO store_info) { | 99 PCERT_STORE_PROV_INFO store_info) { |
| 100 // 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. |
| 101 // 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 |
| 102 // documentation for CryptGetOIDFunctionAddress for more information. | 102 // documentation for CryptGetOIDFunctionAddress for more information. |
| 103 uint32_t store_as_uint = reinterpret_cast<uint32_t>(store_provider); | 103 uintptr_t store_as_uintptr = reinterpret_cast<uintptr_t>(store_provider); |
| 104 if (store_as_uint > 0xFFFF || store_provider != CERT_STORE_PROV_SYSTEM_W || | 104 if (store_as_uintptr > 0xFFFF || store_provider != CERT_STORE_PROV_SYSTEM_W || |
| 105 !g_capi_injector.Get().original_function) | 105 !g_capi_injector.Get().original_function) |
| 106 return FALSE; | 106 return FALSE; |
| 107 | 107 |
| 108 BOOL ok = g_capi_injector.Get().original_function(store_provider, encoding, | 108 BOOL ok = g_capi_injector.Get().original_function(store_provider, encoding, |
| 109 crypt_provider, flags, | 109 crypt_provider, flags, |
| 110 store_name, memory_store, | 110 store_name, memory_store, |
| 111 store_info); | 111 store_info); |
| 112 // Only the Root store should have certificates injected. If | 112 // Only the Root store should have certificates injected. If |
| 113 // 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 |
| 114 // CERT_SYSTEM_STORE_RELOCATE_PARA structure, rather than a | 114 // CERT_SYSTEM_STORE_RELOCATE_PARA structure, rather than a |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 void TestRootCerts::Init() { | 205 void TestRootCerts::Init() { |
| 206 empty_ = true; | 206 empty_ = true; |
| 207 temporary_roots_ = CertOpenStore( | 207 temporary_roots_ = CertOpenStore( |
| 208 CERT_STORE_PROV_MEMORY, 0, NULL, | 208 CERT_STORE_PROV_MEMORY, 0, NULL, |
| 209 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); | 209 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); |
| 210 DCHECK(temporary_roots_); | 210 DCHECK(temporary_roots_); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace net | 213 } // namespace net |
| OLD | NEW |