| Index: net/cert/test_root_certs_win.cc
|
| diff --git a/net/cert/test_root_certs_win.cc b/net/cert/test_root_certs_win.cc
|
| index 90a21d65889faf5d849442b26d8758344ad8be67..b276bfa2be51c3d6b1deb1c5705958b550bf999b 100644
|
| --- a/net/cert/test_root_certs_win.cc
|
| +++ b/net/cert/test_root_certs_win.cc
|
| @@ -46,17 +46,19 @@ struct CryptoAPIInjector {
|
| private:
|
| friend struct base::DefaultLazyInstanceTraits<CryptoAPIInjector>;
|
|
|
| - CryptoAPIInjector()
|
| - : original_function(NULL),
|
| - original_handle(NULL) {
|
| + CryptoAPIInjector() : original_function(NULL), original_handle(NULL) {
|
| HCRYPTOIDFUNCSET registered_functions =
|
| CryptInitOIDFunctionSet(CRYPT_OID_OPEN_STORE_PROV_FUNC, 0);
|
|
|
| // Preserve the original handler function in |original_function|. If other
|
| // functions are overridden, they will also need to be preserved.
|
| - BOOL ok = CryptGetOIDFunctionAddress(
|
| - registered_functions, 0, CERT_STORE_PROV_SYSTEM_W, 0,
|
| - reinterpret_cast<void**>(&original_function), &original_handle);
|
| + BOOL ok =
|
| + CryptGetOIDFunctionAddress(registered_functions,
|
| + 0,
|
| + CERT_STORE_PROV_SYSTEM_W,
|
| + 0,
|
| + reinterpret_cast<void**>(&original_function),
|
| + &original_handle);
|
| DCHECK(ok);
|
|
|
| // For now, intercept only the numeric form of the system store
|
| @@ -66,14 +68,16 @@ struct CryptoAPIInjector {
|
| // sz_CERT_STORE_PROV_SYSTEM_[A/W] and CERT_STORE_PROV_SYSTEM_A, based
|
| // on whether or not any third-party CryptoAPI modules have been
|
| // installed.
|
| - const CRYPT_OID_FUNC_ENTRY kFunctionToIntercept =
|
| - { CERT_STORE_PROV_SYSTEM_W, &InterceptedOpenStoreW };
|
| + const CRYPT_OID_FUNC_ENTRY kFunctionToIntercept = {CERT_STORE_PROV_SYSTEM_W,
|
| + &InterceptedOpenStoreW};
|
|
|
| // Inject kFunctionToIntercept at the front of the linked list that
|
| // crypt32 uses when CertOpenStore is called, replacing the existing
|
| // registered function.
|
| - ok = CryptInstallOIDFunctionAddress(NULL, 0,
|
| - CRYPT_OID_OPEN_STORE_PROV_FUNC, 1,
|
| + ok = CryptInstallOIDFunctionAddress(NULL,
|
| + 0,
|
| + CRYPT_OID_OPEN_STORE_PROV_FUNC,
|
| + 1,
|
| &kFunctionToIntercept,
|
| CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG);
|
| DCHECK(ok);
|
| @@ -89,8 +93,8 @@ struct CryptoAPIInjector {
|
| }
|
| };
|
|
|
| -base::LazyInstance<CryptoAPIInjector>::Leaky
|
| - g_capi_injector = LAZY_INSTANCE_INITIALIZER;
|
| +base::LazyInstance<CryptoAPIInjector>::Leaky g_capi_injector =
|
| + LAZY_INSTANCE_INITIALIZER;
|
|
|
| BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider,
|
| DWORD encoding,
|
| @@ -107,9 +111,12 @@ BOOL WINAPI InterceptedOpenStoreW(LPCSTR store_provider,
|
| !g_capi_injector.Get().original_function)
|
| return FALSE;
|
|
|
| - BOOL ok = g_capi_injector.Get().original_function(store_provider, encoding,
|
| - crypt_provider, flags,
|
| - store_name, memory_store,
|
| + BOOL ok = g_capi_injector.Get().original_function(store_provider,
|
| + encoding,
|
| + crypt_provider,
|
| + flags,
|
| + store_name,
|
| + memory_store,
|
| store_info);
|
| // Only the Root store should have certificates injected. If
|
| // CERT_SYSTEM_STORE_RELOCATE_FLAG is set, then |store_name| points to a
|
| @@ -145,9 +152,10 @@ bool TestRootCerts::Add(X509Certificate* certificate) {
|
| // happen.
|
| g_capi_injector.Get();
|
|
|
| - BOOL ok = CertAddCertificateContextToStore(
|
| - temporary_roots_, certificate->os_cert_handle(),
|
| - CERT_STORE_ADD_NEW, NULL);
|
| + BOOL ok = CertAddCertificateContextToStore(temporary_roots_,
|
| + certificate->os_cert_handle(),
|
| + CERT_STORE_ADD_NEW,
|
| + NULL);
|
| if (!ok) {
|
| // If the certificate is already added, return successfully.
|
| return GetLastError() == CRYPT_E_EXISTS;
|
| @@ -176,8 +184,8 @@ HCERTCHAINENGINE TestRootCerts::GetChainEngine() const {
|
| // Windows versions before 7 don't accept the struct size for later versions.
|
| // We report the size of the old struct since we don't need the new members.
|
| static const DWORD kSizeofCertChainEngineConfig =
|
| - SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(
|
| - CERT_CHAIN_ENGINE_CONFIG, CycleDetectionModulus);
|
| + SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(CERT_CHAIN_ENGINE_CONFIG,
|
| + CycleDetectionModulus);
|
|
|
| // Each HCERTCHAINENGINE caches both the configured system stores and
|
| // information about each chain that has been built. In order to ensure
|
| @@ -186,12 +194,9 @@ HCERTCHAINENGINE TestRootCerts::GetChainEngine() const {
|
| // return a new chain engine for every call. Each chain engine creation
|
| // should re-open the root store, ensuring the most recent changes are
|
| // visible.
|
| - CERT_CHAIN_ENGINE_CONFIG engine_config = {
|
| - kSizeofCertChainEngineConfig
|
| - };
|
| + CERT_CHAIN_ENGINE_CONFIG engine_config = {kSizeofCertChainEngineConfig};
|
| engine_config.dwFlags =
|
| - CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE |
|
| - CERT_CHAIN_ENABLE_SHARE_STORE;
|
| + CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE | CERT_CHAIN_ENABLE_SHARE_STORE;
|
| HCERTCHAINENGINE chain_engine = NULL;
|
| BOOL ok = CertCreateCertificateChainEngine(&engine_config, &chain_engine);
|
| DCHECK(ok);
|
| @@ -204,9 +209,11 @@ TestRootCerts::~TestRootCerts() {
|
|
|
| void TestRootCerts::Init() {
|
| empty_ = true;
|
| - temporary_roots_ = CertOpenStore(
|
| - CERT_STORE_PROV_MEMORY, 0, NULL,
|
| - CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL);
|
| + temporary_roots_ = CertOpenStore(CERT_STORE_PROV_MEMORY,
|
| + 0,
|
| + NULL,
|
| + CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG,
|
| + NULL);
|
| DCHECK(temporary_roots_);
|
| }
|
|
|
|
|