Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_CRYPTO_CAPI_UTIL_H_ | |
| 6 #define BASE_CRYPTO_CAPI_UTIl_H_ | |
| 7 | |
| 8 #include <windows.h> | |
| 9 #include <wincrypt.h> | |
| 10 | |
| 11 namespace base { | |
| 12 | |
| 13 // CryptAcquireContext when passed CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET in | |
| 14 // flags is not thread-safe. For such calls, we create a global lock to | |
| 15 // synchronize it. | |
| 16 // | |
| 17 // From "Threading Issues with Cryptographic Service Providers", | |
| 18 // <http://msdn.microsoft.com/en-us/library/aa388149(v=VS.85).aspx>: | |
| 19 // | |
| 20 // "The CryptAcquireContext function is generally thread safe unless | |
| 21 // CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET is specified in the dwFlags | |
| 22 // parameter." | |
| 23 BOOL CryptAcquireContextLocked(HCRYPTPROV* prov, | |
|
wtc
2010/06/23 16:44:15
Suggestion for future work: also add CryptoAcquire
| |
| 24 const TCHAR* container, | |
| 25 const TCHAR* provider, | |
| 26 DWORD prov_type, | |
| 27 DWORD flags); | |
| 28 | |
| 29 } // namespace base | |
| 30 | |
| 31 #endif // BASE_CRYPTO_CAPI_UTIl_H_ | |
| OLD | NEW |