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

Side by Side Diff: crypto/cssm_init.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
« no previous file with comments | « crypto/cssm_init.h ('k') | crypto/curve25519_nss.cc » ('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) 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 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
11 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
12 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
13 14
14 // 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
15 // documentation useful: 16 // documentation useful:
16 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda) 17 // - Common Security: CDSA and CSSM, Version 2 (with corrigenda)
17 // http://www.opengroup.org/security/cdsa.htm 18 // http://www.opengroup.org/security/cdsa.htm
18 // - Apple Cryptographic Service Provider Functional Specification 19 // - Apple Cryptographic Service Provider Functional Specification
19 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/ 20 // - CryptoSample: http://developer.apple.com/SampleCode/CryptoSample/
20 21
21 namespace { 22 namespace {
22 23
23 void* CSSMMalloc(CSSM_SIZE size, void* alloc_ref) { 24 void* CSSMMalloc(CSSM_SIZE size, void* alloc_ref) {
24 return malloc(size); 25 return malloc(size);
25 } 26 }
26 27
27 void CSSMFree(void* mem_ptr, void* alloc_ref) { 28 void CSSMFree(void* mem_ptr, void* alloc_ref) {
28 free(mem_ptr); 29 free(mem_ptr);
29 } 30 }
30 31
31 void* CSSMRealloc(void* ptr, CSSM_SIZE size, void* alloc_ref) { 32 void* CSSMRealloc(void* ptr, CSSM_SIZE size, void* alloc_ref) {
32 return realloc(ptr, size); 33 return realloc(ptr, size);
33 } 34 }
34 35
35 void* CSSMCalloc(uint32 num, CSSM_SIZE size, void* alloc_ref) { 36 void* CSSMCalloc(uint32_t num, CSSM_SIZE size, void* alloc_ref) {
36 return calloc(num, size); 37 return calloc(num, size);
37 } 38 }
38 39
39 class CSSMInitSingleton { 40 class CSSMInitSingleton {
40 public: 41 public:
41 static CSSMInitSingleton* GetInstance() { 42 static CSSMInitSingleton* GetInstance() {
42 return base::Singleton<CSSMInitSingleton, base::LeakySingletonTraits< 43 return base::Singleton<CSSMInitSingleton, base::LeakySingletonTraits<
43 CSSMInitSingleton>>::get(); 44 CSSMInitSingleton>>::get();
44 } 45 }
45 46
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 196 }
196 197
197 ScopedCSSMData::~ScopedCSSMData() { 198 ScopedCSSMData::~ScopedCSSMData() {
198 if (data_.Data) { 199 if (data_.Data) {
199 CSSMFree(data_.Data); 200 CSSMFree(data_.Data);
200 data_.Data = NULL; 201 data_.Data = NULL;
201 } 202 }
202 } 203 }
203 204
204 } // namespace crypto 205 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/cssm_init.h ('k') | crypto/curve25519_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698