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

Side by Side Diff: crypto/apple_keychain_mac.mm

Issue 2932473004: Remove depprecated methods in AppleKeychain. (Closed)
Patch Set: Clean up everything Created 3 years, 6 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
« no previous file with comments | « crypto/apple_keychain.h ('k') | crypto/mock_apple_keychain.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) 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/apple_keychain.h" 5 #include "crypto/apple_keychain.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "crypto/mac_security_services_lock.h" 10 #include "crypto/mac_security_services_lock.h"
11 11
12 namespace crypto { 12 namespace crypto {
13 13
14 AppleKeychain::AppleKeychain() {} 14 AppleKeychain::AppleKeychain() {}
15 15
16 AppleKeychain::~AppleKeychain() {} 16 AppleKeychain::~AppleKeychain() {}
17 17
18 OSStatus AppleKeychain::ItemCopyAttributesAndData(
19 SecKeychainItemRef itemRef,
20 SecKeychainAttributeInfo* info,
21 SecItemClass* itemClass,
22 SecKeychainAttributeList** attrList,
23 UInt32* length,
24 void** outData) const {
25 base::AutoLock lock(GetMacSecurityServicesLock());
26 return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass,
27 attrList, length, outData);
28 }
29
30 OSStatus AppleKeychain::ItemModifyAttributesAndData(
31 SecKeychainItemRef itemRef,
32 const SecKeychainAttributeList* attrList,
33 UInt32 length,
34 const void* data) const {
35 base::AutoLock lock(GetMacSecurityServicesLock());
36 return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length,
37 data);
38 }
39
40 OSStatus AppleKeychain::ItemFreeAttributesAndData(
41 SecKeychainAttributeList* attrList,
42 void* data) const {
43 base::AutoLock lock(GetMacSecurityServicesLock());
44 return SecKeychainItemFreeAttributesAndData(attrList, data);
45 }
46
47 OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const { 18 OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
48 base::AutoLock lock(GetMacSecurityServicesLock()); 19 base::AutoLock lock(GetMacSecurityServicesLock());
49 return SecKeychainItemDelete(itemRef); 20 return SecKeychainItemDelete(itemRef);
50 } 21 }
51 22
52 OSStatus AppleKeychain::SearchCreateFromAttributes(
53 CFTypeRef keychainOrArray,
54 SecItemClass itemClass,
55 const SecKeychainAttributeList* attrList,
56 SecKeychainSearchRef* searchRef) const {
57 base::AutoLock lock(GetMacSecurityServicesLock());
58 // Eventually, this deprecated method should be removed entirely.
59 // https://crbug.com/595468
60 #pragma clang diagnostic push
61 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
62 return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass,
63 attrList, searchRef);
64 #pragma clang diagnostic pop
65 }
66
67 OSStatus AppleKeychain::SearchCopyNext(SecKeychainSearchRef searchRef,
68 SecKeychainItemRef* itemRef) const {
69 base::AutoLock lock(GetMacSecurityServicesLock());
70 // Eventually, this deprecated method should be removed entirely.
71 // https://crbug.com/595468
72 #pragma clang diagnostic push
73 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
74 return SecKeychainSearchCopyNext(searchRef, itemRef);
75 #pragma clang diagnostic pop
76 }
77
78 OSStatus AppleKeychain::AddInternetPassword(
79 SecKeychainRef keychain,
80 UInt32 serverNameLength,
81 const char* serverName,
82 UInt32 securityDomainLength,
83 const char* securityDomain,
84 UInt32 accountNameLength,
85 const char* accountName,
86 UInt32 pathLength,
87 const char* path,
88 UInt16 port,
89 SecProtocolType protocol,
90 SecAuthenticationType authenticationType,
91 UInt32 passwordLength,
92 const void* passwordData,
93 SecKeychainItemRef* itemRef) const {
94 base::AutoLock lock(GetMacSecurityServicesLock());
95 return SecKeychainAddInternetPassword(keychain,
96 serverNameLength, serverName,
97 securityDomainLength, securityDomain,
98 accountNameLength, accountName,
99 pathLength, path,
100 port, protocol, authenticationType,
101 passwordLength, passwordData,
102 itemRef);
103 }
104
105 OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray, 23 OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
106 UInt32 serviceNameLength, 24 UInt32 serviceNameLength,
107 const char* serviceName, 25 const char* serviceName,
108 UInt32 accountNameLength, 26 UInt32 accountNameLength,
109 const char* accountName, 27 const char* accountName,
110 UInt32* passwordLength, 28 UInt32* passwordLength,
111 void** passwordData, 29 void** passwordData,
112 SecKeychainItemRef* itemRef) const { 30 SecKeychainItemRef* itemRef) const {
113 base::AutoLock lock(GetMacSecurityServicesLock()); 31 base::AutoLock lock(GetMacSecurityServicesLock());
114 return SecKeychainFindGenericPassword(keychainOrArray, 32 return SecKeychainFindGenericPassword(keychainOrArray,
(...skipping 24 matching lines...) Expand all
139 return SecKeychainAddGenericPassword(keychain, 57 return SecKeychainAddGenericPassword(keychain,
140 serviceNameLength, 58 serviceNameLength,
141 serviceName, 59 serviceName,
142 accountNameLength, 60 accountNameLength,
143 accountName, 61 accountName,
144 passwordLength, 62 passwordLength,
145 passwordData, 63 passwordData,
146 itemRef); 64 itemRef);
147 } 65 }
148 66
149 void AppleKeychain::Free(CFTypeRef ref) const {
150 if (ref)
151 CFRelease(ref);
152 }
153
154 } // namespace crypto 67 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/apple_keychain.h ('k') | crypto/mock_apple_keychain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698