1 // Copyright (c) 2009 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. 4 5 #include "chrome/browser/keychain_mac.h" 6 7 OSStatus MacKeychain::ItemCopyAttributesAndData( 8 SecKeychainItemRef itemRef, SecKeychainAttributeInfo *info, 9 SecItemClass *itemClass, SecKeychainAttributeList **attrList, 10 UInt32 *length, void **outData) const { 11 return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass, 12 attrList, length, outData); 13 } 14 15 OSStatus MacKeychain::ItemModifyAttributesAndData( 16 SecKeychainItemRef itemRef, const SecKeychainAttributeList *attrList, 17 UInt32 length, const void *data) const { 18 return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length, 19 data); 20 } 21 22 OSStatus MacKeychain::ItemFreeAttributesAndData( 23 SecKeychainAttributeList *attrList, void *data) const { 24 return SecKeychainItemFreeAttributesAndData(attrList, data); 25 } 26 27 OSStatus MacKeychain::ItemDelete(SecKeychainItemRef itemRef) const { 28 return SecKeychainItemDelete(itemRef); 29 } 30 31 OSStatus MacKeychain::SearchCreateFromAttributes( 32 CFTypeRef keychainOrArray, SecItemClass itemClass, 33 const SecKeychainAttributeList *attrList, 34 SecKeychainSearchRef *searchRef) const { 35 return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass, 36 attrList, searchRef); 37 } 38 39 OSStatus MacKeychain::SearchCopyNext(SecKeychainSearchRef searchRef, 40 SecKeychainItemRef *itemRef) const { 41 return SecKeychainSearchCopyNext(searchRef, itemRef); 42 } 43 44 OSStatus MacKeychain::AddInternetPassword( 45 SecKeychainRef keychain, 46 UInt32 serverNameLength, const char *serverName, 47 UInt32 securityDomainLength, const char *securityDomain, 48 UInt32 accountNameLength, const char *accountName, 49 UInt32 pathLength, const char *path, 50 UInt16 port, SecProtocolType protocol, 51 SecAuthenticationType authenticationType, 52 UInt32 passwordLength, const void *passwordData, 53 SecKeychainItemRef *itemRef) const { 54 return SecKeychainAddInternetPassword(keychain, 55 serverNameLength, serverName, 56 securityDomainLength, securityDomain, 57 accountNameLength, accountName, 58 pathLength, path, 59 port, protocol, authenticationType, 60 passwordLength, passwordData, 61 itemRef); 62 } 63 64 OSStatus MacKeychain::FindGenericPassword(CFTypeRef keychainOrArray, 65 UInt32 serviceNameLength, 66 const char *serviceName, 67 UInt32 accountNameLength, 68 const char *accountName, 69 UInt32 *passwordLength, 70 void **passwordData, 71 SecKeychainItemRef *itemRef) const { 72 return SecKeychainFindGenericPassword(keychainOrArray, 73 serviceNameLength, 74 serviceName, 75 accountNameLength, 76 accountName, 77 passwordLength, 78 passwordData, 79 itemRef); 80 } 81 82 OSStatus MacKeychain::ItemFreeContent(SecKeychainAttributeList *attrList, 83 void *data) const { 84 return SecKeychainItemFreeContent(attrList, data); 85 } 86 87 OSStatus MacKeychain::AddGenericPassword(SecKeychainRef keychain, 88 UInt32 serviceNameLength, 89 const char *serviceName, 90 UInt32 accountNameLength, 91 const char *accountName, 92 UInt32 passwordLength, 93 const void *passwordData, 94 SecKeychainItemRef *itemRef) const { 95 return SecKeychainAddGenericPassword(keychain, 96 serviceNameLength, 97 serviceName, 98 accountNameLength, 99 accountName, 100 passwordLength, 101 passwordData, 102 itemRef); 103 } 104 105 void MacKeychain::Free(CFTypeRef ref) const { 106 if (ref) { 107 CFRelease(ref); 108 } 109 } 110