Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "crypto/cssm_init.h" | 5 #include "crypto/cssm_init.h" |
| 6 | 6 |
| 7 #include <Security/SecBase.h> | 7 #include <Security/SecBase.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 LeakySingletonTraits<CSSMInitSingleton> >::get(); | 43 LeakySingletonTraits<CSSMInitSingleton> >::get(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 CSSM_CSP_HANDLE csp_handle() const { return csp_handle_; } | 46 CSSM_CSP_HANDLE csp_handle() const { return csp_handle_; } |
| 47 CSSM_CL_HANDLE cl_handle() const { return cl_handle_; } | 47 CSSM_CL_HANDLE cl_handle() const { return cl_handle_; } |
| 48 CSSM_TP_HANDLE tp_handle() const { return tp_handle_; } | 48 CSSM_TP_HANDLE tp_handle() const { return tp_handle_; } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 CSSMInitSingleton() | 51 CSSMInitSingleton() |
| 52 : inited_(false), csp_loaded_(false), cl_loaded_(false), | 52 : inited_(false), csp_loaded_(false), cl_loaded_(false), |
| 53 tp_loaded_(false), csp_handle_(NULL), cl_handle_(NULL), | 53 tp_loaded_(false), csp_handle_(0), cl_handle_(0), tp_handle_(0) { |
|
Mark Mentovai
2012/03/27 21:09:59
CSSM_INVALID_HANDLE
| |
| 54 tp_handle_(NULL) { | |
| 55 static CSSM_VERSION version = {2, 0}; | 54 static CSSM_VERSION version = {2, 0}; |
| 56 // TODO(wtc): what should our caller GUID be? | 55 // TODO(wtc): what should our caller GUID be? |
| 57 static const CSSM_GUID test_guid = { | 56 static const CSSM_GUID test_guid = { |
| 58 0xFADE, 0, 0, { 1, 2, 3, 4, 5, 6, 7, 0 } | 57 0xFADE, 0, 0, { 1, 2, 3, 4, 5, 6, 7, 0 } |
| 59 }; | 58 }; |
| 60 CSSM_RETURN crtn; | 59 CSSM_RETURN crtn; |
| 61 CSSM_PVC_MODE pvc_policy = CSSM_PVC_NONE; | 60 CSSM_PVC_MODE pvc_policy = CSSM_PVC_NONE; |
| 62 crtn = CSSM_Init(&version, CSSM_PRIVILEGE_SCOPE_NONE, &test_guid, | 61 crtn = CSSM_Init(&version, CSSM_PRIVILEGE_SCOPE_NONE, &test_guid, |
| 63 CSSM_KEY_HIERARCHY_NONE, &pvc_policy, NULL); | 62 CSSM_KEY_HIERARCHY_NONE, &pvc_policy, NULL); |
| 64 if (crtn) { | 63 if (crtn) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 } | 194 } |
| 196 | 195 |
| 197 ScopedCSSMData::~ScopedCSSMData() { | 196 ScopedCSSMData::~ScopedCSSMData() { |
| 198 if (data_.Data) { | 197 if (data_.Data) { |
| 199 CSSMFree(data_.Data); | 198 CSSMFree(data_.Data); |
| 200 data_.Data = NULL; | 199 data_.Data = NULL; |
| 201 } | 200 } |
| 202 } | 201 } |
| 203 | 202 |
| 204 } // namespace crypto | 203 } // namespace crypto |
| OLD | NEW |