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

Unified Diff: base/crypto/cssm_init.h

Issue 6312157: Add ability to create self signed certs to mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More code cleanup Created 9 years, 10 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 | base/crypto/cssm_init.cc » ('j') | base/crypto/cssm_init.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/crypto/cssm_init.h
diff --git a/base/crypto/cssm_init.h b/base/crypto/cssm_init.h
index 5644d7e62189111725902c753735dc6d2359336a..b51a3b57199cf407825766a64361eb13856c0a8b 100644
--- a/base/crypto/cssm_init.h
+++ b/base/crypto/cssm_init.h
@@ -8,7 +8,7 @@
#include <Security/cssm.h>
-#include "base/scoped_ptr.h"
+#include "base/basictypes.h"
namespace base {
@@ -22,12 +22,22 @@ void EnsureCSSMInit();
// Returns the shared CSP handle used by CSSM functions.
CSSM_CSP_HANDLE GetSharedCSPHandle();
+// Returns the shared CL handle used by CSSM functions.
+CSSM_CL_HANDLE GetSharedCLHandle();
+
+// Returns the shared TP handle used by CSSM functions.
+CSSM_TP_HANDLE GetSharedTPHandle();
+
// Set of pointers to memory function wrappers that are required for CSSM
extern const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions;
wtc 2011/02/09 01:03:31 Delete the kCssmMemoryFunctions declaration.
// Utility function to log an error message including the error name.
void LogCSSMError(const char *function_name, CSSM_RETURN err);
+// Utility functions to allocate and release CSSM memory.
+void* CSSMMalloc(CSSM_SIZE size);
+void CSSMFree(void* ptr);
+
// The OS X certificate and key management wrappers over CSSM are not
// thread-safe. In particular, code that accesses the CSSM database is
// problematic.
@@ -35,6 +45,25 @@ void LogCSSMError(const char *function_name, CSSM_RETURN err);
// http://developer.apple.com/mac/library/documentation/Security/Reference/certifkeytrustservices/Reference/reference.html
Lock& GetMacSecurityServicesLock();
+// Wrapper class for CSSM_DATA type. This should only be used when using the
+// CL/TP/CSP handles from above, since that's the only time we're guaranteed (or
+// supposed to be guaranteed) that our memory management functions will be used.
+// Apple's Sec* APIs manage their own memory so it shouldn't be used for those.
+// The constructor initializes data_ to zero and the destructor releases the
+// data properly.
+class ScopedCSSMData {
+ public:
+ ScopedCSSMData();
+ ~ScopedCSSMData();
+ operator CSSM_DATA*() { return &data_; }
+ CSSM_DATA* operator ->() { return &data_; }
+
+ private:
+ CSSM_DATA data_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedCSSMData);
+};
+
} // namespace base
#endif // BASE_CRYPTO_CSSM_INIT_H_
« no previous file with comments | « no previous file | base/crypto/cssm_init.cc » ('j') | base/crypto/cssm_init.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698