| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "crypto/cssm_init.h" | 5 #include "crypto/cssm_init.h" |
| 6 | 6 |
| 7 #include <Security/SecBase.h> | 7 #include <Security/SecBase.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 | 14 |
| 15 // When writing crypto code for Mac OS X, you may find the following | 15 // When writing crypto code for Mac OS X, you may find the following |
| 16 // documentation useful: | 16 // documentation useful: |
| 17 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda) | 17 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda) |
| 18 // http://www.opengroup.org/security/cdsa.htm | 18 // http://www.opengroup.org/security/cdsa.htm |
| 19 // - Apple Cryptographic Service Provider Functional Specification | 19 // - Apple Cryptographic Service Provider Functional Specification |
| 20 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/ | 20 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/ |
| 21 | 21 |
| 22 // CSSM functions are deprecated as of OSX 10.7, but have no replacement. |
| 23 // https://bugs.chromium.org/p/chromium/issues/detail?id=590914#c1 |
| 24 #pragma clang diagnostic push |
| 25 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 26 |
| 22 namespace { | 27 namespace { |
| 23 | 28 |
| 24 void* CSSMMalloc(CSSM_SIZE size, void* alloc_ref) { | 29 void* CSSMMalloc(CSSM_SIZE size, void* alloc_ref) { |
| 25 return malloc(size); | 30 return malloc(size); |
| 26 } | 31 } |
| 27 | 32 |
| 28 void CSSMFree(void* mem_ptr, void* alloc_ref) { | 33 void CSSMFree(void* mem_ptr, void* alloc_ref) { |
| 29 free(mem_ptr); | 34 free(mem_ptr); |
| 30 } | 35 } |
| 31 | 36 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 201 } |
| 197 | 202 |
| 198 ScopedCSSMData::~ScopedCSSMData() { | 203 ScopedCSSMData::~ScopedCSSMData() { |
| 199 if (data_.Data) { | 204 if (data_.Data) { |
| 200 CSSMFree(data_.Data); | 205 CSSMFree(data_.Data); |
| 201 data_.Data = NULL; | 206 data_.Data = NULL; |
| 202 } | 207 } |
| 203 } | 208 } |
| 204 | 209 |
| 205 } // namespace crypto | 210 } // namespace crypto |
| 211 |
| 212 #pragma clang diagnostic pop // "-Wdeprecated-declarations" |
| OLD | NEW |