]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_keychain/lib/TokenLogin.cpp
Security-58286.20.16.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / TokenLogin.cpp
index 03255cd2fbecd81661a7bfd8e3b587458c97814c..64b45fc9f28df9bd38d43e2fffbf0b9c6ef05f46 100644 (file)
@@ -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)