X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/fa7225c82381bac4432a6edf16f53b5370238d85..dd5fb164cf5b32c462296bc65e289e100f74b59a:/OSX/libsecurity_keychain/lib/TokenLogin.cpp diff --git a/OSX/libsecurity_keychain/lib/TokenLogin.cpp b/OSX/libsecurity_keychain/lib/TokenLogin.cpp index 03255cd2..64b45fc9 100644 --- a/OSX/libsecurity_keychain/lib/TokenLogin.cpp +++ b/OSX/libsecurity_keychain/lib/TokenLogin.cpp @@ -41,7 +41,7 @@ extern "C" { #define kSecTokenLoginDomain CFSTR("com.apple.security.tokenlogin") -static CFStringRef cfDataToHex(CFDataRef bin) +static CFStringRef CF_RETURNS_RETAINED cfDataToHex(CFDataRef bin) { size_t len = CFDataGetLength(bin) * 2; CFMutableStringRef str = CFStringCreateMutable(NULL, len); @@ -308,7 +308,17 @@ OSStatus TokenLoginGetLoginData(CFDictionaryRef context, CFDictionaryRef *loginD return errSecSuccess; } -OSStatus TokenLoginUpdateUnlockData(CFDictionaryRef context) +OSStatus TokenLoginGetPin(CFDictionaryRef context, CFStringRef *pin) +{ + if (!pin || !context) { + return errSecParam; + } + *pin = getPin(context); + + return errSecSuccess; +} + +OSStatus TokenLoginUpdateUnlockData(CFDictionaryRef context, CFStringRef password) { if (!context) { return errSecParam; @@ -321,7 +331,7 @@ OSStatus TokenLoginUpdateUnlockData(CFDictionaryRef context) return result; } - return SecKeychainStoreUnlockKeyWithPubKeyHash(getPubKeyHash(context), getTokenId(context), getPubKeyHashWrap(context), loginKeychain, NULL); + return SecKeychainStoreUnlockKeyWithPubKeyHash(getPubKeyHash(context), getTokenId(context), getPubKeyHashWrap(context), loginKeychain, password); } OSStatus TokenLoginCreateLoginData(CFStringRef tokenId, CFDataRef pubKeyHash, CFDataRef pubKeyHashWrap, CFDataRef unlockKey, CFDataRef scBlob)