SecKeychainCopyAccess returns "Function or operation not implemented" OSStatus on macOS >= 10.10

Originator:bruienne
Number:rdar://30133583 Date Originated:21-Jan-2017 08:40 PM
Status:Open Resolved:
Product:macOS Product Version:10.12.2
Classification:Security Reproducible:Always
 
Summary:
When calling SecKeychainCopyAccess() from Swift in Xcode 8.1 instead of a returned SecAccess object with an OSStatus of noErr, no SecAccess is returned and the OSStatus is -4 or "Function or operation not implemented" as returned by SecCopyErrorMessageString(). According to the developer documentation this function is available as of macOS 10.10.

Steps to Reproduce:
1. Create a valid SecKeychain object
2. Create a valid SecAccess reference
3. Call SecKeychainCopyAccess() with previously created SecKeychain and SecAccess as parameters

Expected Results:
A valid SecAccess object is returned, OSStatus of 0 aka noErr

Actual Results:
No SecAccess object is returned, OSStatus returned is -4, "Function or operation not implemented" 

Regression:
The issue occurs on macOS 10.12.2 using Xcode 8.1

Notes:
According to https://developer.apple.com/reference/security/1394733-seckeychaincopyaccess this function has been implemented as of macOS 10.10+ The discussion section further states that it was available as of OS X 10.2 but unimplemented before OS X 10.3. Looking at the available OSS version of SecKeychain.cpp and SecKeychainCopyAccess() at https://opensource.apple.com/source/libsecurity_keychain/libsecurity_keychain-55050.9/lib/SecKeychain.cpp indicates that it is still not implemented as of libsecurity_keychain-55050.9: "MacOSError::throwMe(unimpErr);//%%%for now"

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!