Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: base/crypto/scoped_capi_types.h

Issue 2668005: Bring the handling of <keygen> and support for the application/x-x509-user-ce... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Whitespace/style Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/renderer_host/x509_user_cert_resource_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/crypto/scoped_capi_types.h
===================================================================
--- base/crypto/scoped_capi_types.h (revision 49024)
+++ base/crypto/scoped_capi_types.h (working copy)
@@ -15,9 +15,20 @@
namespace base {
// Simple destructor for the Free family of CryptoAPI functions, such as
-// CryptDestroyHash, which take only a single argument to release.
+// CertFreeCertificateChain, which take a single argument to release and
+// return VOID
+template <typename CAPIHandle, VOID (WINAPI *Destroyer)(CAPIHandle)>
+struct CAPIDestroyerVOID {
+ void operator()(CAPIHandle handle) const {
+ if (handle) Destroyer(handle);
+ }
+};
+
+// Simple destructor for the Free family of CryptoAPI functions, such as
+// CryptDestroyHash, which take only a single argument to release and return
+// BOOL
template <typename CAPIHandle, BOOL (WINAPI *Destroyer)(CAPIHandle)>
-struct CAPIDestroyer {
+struct CAPIDestroyerBOOL {
void operator()(CAPIHandle handle) const {
if (handle) {
BOOL ok = Destroyer(handle);
@@ -113,11 +124,13 @@
CAPIDestroyerWithFlags<HCRYPTPROV,
CryptReleaseContext, 0> > ScopedHCRYPTPROV;
-typedef ScopedCAPIHandle<
- HCRYPTKEY, CAPIDestroyer<HCRYPTKEY, CryptDestroyKey> > ScopedHCRYPTKEY;
+typedef ScopedCAPIHandle<HCRYPTKEY,
+ CAPIDestroyerBOOL<HCRYPTKEY,
+ CryptDestroyKey> > ScopedHCRYPTKEY;
-typedef ScopedCAPIHandle<
- HCRYPTHASH, CAPIDestroyer<HCRYPTHASH, CryptDestroyHash> > ScopedHCRYPTHASH;
+typedef ScopedCAPIHandle<HCRYPTHASH,
+ CAPIDestroyerBOOL<HCRYPTHASH,
+ CryptDestroyHash> > ScopedHCRYPTHASH;
} // namespace base
« no previous file with comments | « no previous file | chrome/browser/renderer_host/x509_user_cert_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698