Don't consider a Bluetooth adapter present until it has an address.
[chromium-blink-merge.git] / crypto / apple_keychain_mac.mm
blob545be1957f741df2e3b52e71d01faac5a25879bb
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
3 // found in the LICENSE file.
5 #include "crypto/apple_keychain.h"
7 #import <Foundation/Foundation.h>
9 namespace crypto {
11 AppleKeychain::AppleKeychain() {}
13 AppleKeychain::~AppleKeychain() {}
15 OSStatus AppleKeychain::ItemCopyAttributesAndData(
16     SecKeychainItemRef itemRef,
17     SecKeychainAttributeInfo* info,
18     SecItemClass* itemClass,
19     SecKeychainAttributeList** attrList,
20     UInt32* length,
21     void** outData) const {
22   return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass,
23                                               attrList, length, outData);
26 OSStatus AppleKeychain::ItemModifyAttributesAndData(
27     SecKeychainItemRef itemRef,
28     const SecKeychainAttributeList* attrList,
29     UInt32 length,
30     const void* data) const {
31   return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length,
32                                                 data);
35 OSStatus AppleKeychain::ItemFreeAttributesAndData(
36     SecKeychainAttributeList* attrList,
37     void* data) const {
38   return SecKeychainItemFreeAttributesAndData(attrList, data);
41 OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
42   return SecKeychainItemDelete(itemRef);
45 OSStatus AppleKeychain::SearchCreateFromAttributes(
46     CFTypeRef keychainOrArray,
47     SecItemClass itemClass,
48     const SecKeychainAttributeList* attrList,
49     SecKeychainSearchRef* searchRef) const {
50   return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass,
51                                                attrList, searchRef);
54 OSStatus AppleKeychain::SearchCopyNext(SecKeychainSearchRef searchRef,
55                                        SecKeychainItemRef* itemRef) const {
56   return SecKeychainSearchCopyNext(searchRef, itemRef);
59 OSStatus AppleKeychain::AddInternetPassword(
60     SecKeychainRef keychain,
61     UInt32 serverNameLength,
62     const char* serverName,
63     UInt32 securityDomainLength,
64     const char* securityDomain,
65     UInt32 accountNameLength,
66     const char* accountName,
67     UInt32 pathLength,
68     const char* path,
69     UInt16 port,
70     SecProtocolType protocol,
71     SecAuthenticationType authenticationType,
72     UInt32 passwordLength,
73     const void* passwordData,
74     SecKeychainItemRef* itemRef) const {
75   return SecKeychainAddInternetPassword(keychain,
76                                         serverNameLength, serverName,
77                                         securityDomainLength, securityDomain,
78                                         accountNameLength, accountName,
79                                         pathLength, path,
80                                         port, protocol, authenticationType,
81                                         passwordLength, passwordData,
82                                         itemRef);
85 OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
86                                             UInt32 serviceNameLength,
87                                             const char* serviceName,
88                                             UInt32 accountNameLength,
89                                             const char* accountName,
90                                             UInt32* passwordLength,
91                                             void** passwordData,
92                                             SecKeychainItemRef* itemRef) const {
93   return SecKeychainFindGenericPassword(keychainOrArray,
94                                         serviceNameLength,
95                                         serviceName,
96                                         accountNameLength,
97                                         accountName,
98                                         passwordLength,
99                                         passwordData,
100                                         itemRef);
103 OSStatus AppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
104                                         void* data) const {
105   return SecKeychainItemFreeContent(attrList, data);
108 OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain,
109                                            UInt32 serviceNameLength,
110                                            const char* serviceName,
111                                            UInt32 accountNameLength,
112                                            const char* accountName,
113                                            UInt32 passwordLength,
114                                            const void* passwordData,
115                                            SecKeychainItemRef* itemRef) const {
116   return SecKeychainAddGenericPassword(keychain,
117                                        serviceNameLength,
118                                        serviceName,
119                                        accountNameLength,
120                                        accountName,
121                                        passwordLength,
122                                        passwordData,
123                                        itemRef);
126 void AppleKeychain::Free(CFTypeRef ref) const {
127   if (ref)
128     CFRelease(ref);
131 }  // namespace crypto