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

Side by Side Diff: crypto/cssm_init.h

Issue 7491061: Rename CRYPTO_API to CRYPTO_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « crypto/crypto_export.h ('k') | crypto/encryptor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CRYPTO_CSSM_INIT_H_ 5 #ifndef CRYPTO_CSSM_INIT_H_
6 #define CRYPTO_CSSM_INIT_H_ 6 #define CRYPTO_CSSM_INIT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <Security/cssm.h> 9 #include <Security/cssm.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "crypto/crypto_api.h" 12 #include "crypto/crypto_export.h"
13 13
14 namespace crypto { 14 namespace crypto {
15 15
16 // Initialize CSSM if it isn't already initialized. This must be called before 16 // Initialize CSSM if it isn't already initialized. This must be called before
17 // any other CSSM functions. This function is thread-safe, and CSSM will only 17 // any other CSSM functions. This function is thread-safe, and CSSM will only
18 // ever be initialized once. CSSM will be properly shut down on program exit. 18 // ever be initialized once. CSSM will be properly shut down on program exit.
19 CRYPTO_API void EnsureCSSMInit(); 19 CRYPTO_EXPORT void EnsureCSSMInit();
20 20
21 // Returns the shared CSP handle used by CSSM functions. 21 // Returns the shared CSP handle used by CSSM functions.
22 CSSM_CSP_HANDLE GetSharedCSPHandle(); 22 CSSM_CSP_HANDLE GetSharedCSPHandle();
23 23
24 // Returns the shared CL handle used by CSSM functions. 24 // Returns the shared CL handle used by CSSM functions.
25 CRYPTO_API CSSM_CL_HANDLE GetSharedCLHandle(); 25 CRYPTO_EXPORT CSSM_CL_HANDLE GetSharedCLHandle();
26 26
27 // Returns the shared TP handle used by CSSM functions. 27 // Returns the shared TP handle used by CSSM functions.
28 CRYPTO_API CSSM_TP_HANDLE GetSharedTPHandle(); 28 CRYPTO_EXPORT CSSM_TP_HANDLE GetSharedTPHandle();
29 29
30 // Set of pointers to memory function wrappers that are required for CSSM 30 // Set of pointers to memory function wrappers that are required for CSSM
31 extern const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions; 31 extern const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions;
32 32
33 // Utility function to log an error message including the error name. 33 // Utility function to log an error message including the error name.
34 CRYPTO_API void LogCSSMError(const char *function_name, CSSM_RETURN err); 34 CRYPTO_EXPORT void LogCSSMError(const char *function_name, CSSM_RETURN err);
35 35
36 // Utility functions to allocate and release CSSM memory. 36 // Utility functions to allocate and release CSSM memory.
37 void* CSSMMalloc(CSSM_SIZE size); 37 void* CSSMMalloc(CSSM_SIZE size);
38 CRYPTO_API void CSSMFree(void* ptr); 38 CRYPTO_EXPORT void CSSMFree(void* ptr);
39 39
40 // Wrapper class for CSSM_DATA type. This should only be used when using the 40 // Wrapper class for CSSM_DATA type. This should only be used when using the
41 // CL/TP/CSP handles from above, since that's the only time we're guaranteed (or 41 // CL/TP/CSP handles from above, since that's the only time we're guaranteed (or
42 // supposed to be guaranteed) that our memory management functions will be used. 42 // supposed to be guaranteed) that our memory management functions will be used.
43 // Apple's Sec* APIs manage their own memory so it shouldn't be used for those. 43 // Apple's Sec* APIs manage their own memory so it shouldn't be used for those.
44 // The constructor initializes data_ to zero and the destructor releases the 44 // The constructor initializes data_ to zero and the destructor releases the
45 // data properly. 45 // data properly.
46 class ScopedCSSMData { 46 class ScopedCSSMData {
47 public: 47 public:
48 ScopedCSSMData(); 48 ScopedCSSMData();
49 ~ScopedCSSMData(); 49 ~ScopedCSSMData();
50 operator CSSM_DATA*() { return &data_; } 50 operator CSSM_DATA*() { return &data_; }
51 CSSM_DATA* operator ->() { return &data_; } 51 CSSM_DATA* operator ->() { return &data_; }
52 52
53 private: 53 private:
54 CSSM_DATA data_; 54 CSSM_DATA data_;
55 55
56 DISALLOW_COPY_AND_ASSIGN(ScopedCSSMData); 56 DISALLOW_COPY_AND_ASSIGN(ScopedCSSMData);
57 }; 57 };
58 58
59 } // namespace crypto 59 } // namespace crypto
60 60
61 #endif // CRYPTO_CSSM_INIT_H_ 61 #endif // CRYPTO_CSSM_INIT_H_
OLDNEW
« no previous file with comments | « crypto/crypto_export.h ('k') | crypto/encryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698