Skip navigation.
 
mlSecKeychainItemCopyContent for ppc on Leopard
FROM : Jon Crosby
DATE : Thu Nov 01 22:13:44 2007

I have noticed a difference in the behavior of a unit test 
(SenTestCase) when it is run in Release mode against the i386 arch and 
the ppc arch in Xcode 3.0 on Leopard.

The following code correctly populates the SecKeychainAttributeList 
"list" for i386. This exact same code, when run from the exact same 
unit test fails with "errSecAuthFailed" (code -25293) for ppc:

    SecKeychainItemRef item;
    NSString *serviceName = @"MyService";
    OSStatus status = SecKeychainFindGenericPassword(NULL,
                                                      [serviceName 
length],
                                                      [serviceName 
UTF8String],
                                                      0,
                                                      NULL,
                                                      NULL,
                                                      NULL,
                                                      &item);
    if (status != noErr) {
        return nil; // status is always 0. always works up to this 
point.
    }

    // from Advanced Mac OS X Programming, ch. 16
    UInt32 length;
    char *password;
    SecKeychainAttribute attributes[8];
    SecKeychainAttributeList list;
   
    attributes[0].tag = kSecAccountItemAttr;
    attributes[1].tag = kSecDescriptionItemAttr;
    attributes[2].tag = kSecLabelItemAttr;
    attributes[3].tag = kSecModDateItemAttr;

    list.count = 4;
    list.attr = attributes;

    // status is always 0 on i386, -25293 on ppc
    status = SecKeychainItemCopyContent(item, NULL, &list, &length, 
(void **)&password);

Does anyone have ideas about the source of this difference?

-Jon Crosby

Related mailsAuthorDate
mlSecKeychainItemCopyContent for ppc on Leopard Jon Crosby Nov 1, 22:13
mlRe: SecKeychainItemCopyContent for ppc on Leopard Nick Zitzmann Nov 1, 22:24
mlRe: SecKeychainItemCopyContent for ppc on Leopard Jon Crosby Nov 1, 23:34
mlRe: SecKeychainItemCopyContent for ppc on Leopard Jon Crosby Nov 2, 05:10
mlRe: SecKeychainItemCopyContent for ppc on Leopard Wade Tregaskis Nov 2, 06:43