OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "base/crypto/cssm_init.h" | 5 #include "base/crypto/cssm_init.h" |
6 | |
7 #include <Security/cssm.h> | |
8 | |
9 #include "base/logging.h" | 6 #include "base/logging.h" |
10 #include "base/singleton.h" | 7 #include "base/singleton.h" |
11 | 8 |
12 // When writing crypto code for Mac OS X, you may find the following | 9 // When writing crypto code for Mac OS X, you may find the following |
13 // documentation useful: | 10 // documentation useful: |
14 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda) | 11 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda) |
15 // http://www.opengroup.org/security/cdsa.htm | 12 // http://www.opengroup.org/security/cdsa.htm |
16 // - Apple Cryptographic Service Provider Functional Specification | 13 // - Apple Cryptographic Service Provider Functional Specification |
17 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/ | 14 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/ |
18 | 15 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 59 }; |
63 | 60 |
64 } // namespace | 61 } // namespace |
65 | 62 |
66 namespace base { | 63 namespace base { |
67 | 64 |
68 void EnsureCSSMInit() { | 65 void EnsureCSSMInit() { |
69 Singleton<CSSMInitSingleton>::get(); | 66 Singleton<CSSMInitSingleton>::get(); |
70 } | 67 } |
71 | 68 |
| 69 void* CSSMMalloc(CSSM_SIZE size, void *alloc_ref) { |
| 70 return malloc(size); |
| 71 } |
| 72 |
| 73 void CSSMFree(void* mem_ptr, void* alloc_ref) { |
| 74 free(mem_ptr); |
| 75 } |
| 76 |
| 77 void* CSSMRealloc(void* ptr, CSSM_SIZE size, void* alloc_ref) { |
| 78 return realloc(ptr, size); |
| 79 } |
| 80 |
| 81 void* CSSMCalloc(uint32 num, CSSM_SIZE size, void* alloc_ref) { |
| 82 return calloc(num, size); |
| 83 } |
| 84 |
| 85 const CSSM_API_MEMORY_FUNCS kCssmMemoryFunctions = { |
| 86 CSSMMalloc, |
| 87 CSSMFree, |
| 88 CSSMRealloc, |
| 89 CSSMCalloc, |
| 90 NULL |
| 91 }; |
| 92 |
72 } // namespace base | 93 } // namespace base |
OLD | NEW |