]> git.saurik.com Git - apple/security.git/blobdiff - OSX/sec/Security/SecKey.c
Security-57740.51.3.tar.gz
[apple/security.git] / OSX / sec / Security / SecKey.c
index 1375ce93b2d3e0192bfe18bd5d2e86f42c21c0ec..62fb980a9b2c7f58d6e0bc04689cdb3b130e17cb 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * SecKey.c - CoreFoundation based key object
  */
-
+#include <Security/SecBase.h>
 
 #include <Security/SecKeyInternal.h>
 #include <Security/SecItem.h>
 #include "SecECKeyPriv.h"
 #include "SecCTKKeyPriv.h"
 #include "SecBasePriv.h"
+#include <Security/SecKeyPriv.h>
 
 #include <CoreFoundation/CFNumber.h>
 #include <CoreFoundation/CFString.h>
-#include <Security/SecBase.h>
 #include <pthread.h>
 #include <string.h>
 #include <AssertMacros.h>
@@ -191,6 +191,8 @@ static Boolean SecKeyEqual(CFTypeRef cf1, CFTypeRef cf2)
     d2 = SecKeyCopyAttributeDictionary(key2);
     // Returning NULL is an error; bail out of the equality check
     if(!d1 || !d2) {
+        CFReleaseSafe(d1);
+        CFReleaseSafe(d2);
         return false;
     }
     Boolean result = CFEqual(d1, d2);
@@ -560,7 +562,7 @@ static OSStatus SecKeyPerformLegacyOperation(SecKeyRef key,
     CFErrorRef error = NULL;
     OSStatus status = errSecSuccess;
     CFDataRef in1 = CFDataCreateWithBytesNoCopy(NULL, in1Ptr, in1Len, kCFAllocatorNull);
-    CFDataRef in2 = in2Ptr ? CFDataCreateWithBytesNoCopy(NULL, in2Ptr, in2Len, kCFAllocatorNull) : NULL;
+    CFDataRef in2 = CFDataCreateWithBytesNoCopy(NULL, in2Ptr, in2Len, kCFAllocatorNull);
     CFRange range = { 0, -1 };
     CFTypeRef output = operation(in1, in2, &range, &error);
     require_quiet(output, out);
@@ -619,7 +621,7 @@ OSStatus SecKeyRawVerify(
     }
     OSStatus status = SecKeyPerformLegacyOperation(key, signedData, signedDataLen, sig, sigLen, NULL, NULL,
                                                    ^CFTypeRef(CFDataRef in1, CFDataRef in2, CFRange *range, CFErrorRef *error) {
-                                                       return in2 != NULL && SecKeyVerifySignature(key, algorithm, in1, in2, error)
+                                                       return SecKeyVerifySignature(key, algorithm, in1, in2, error)
                                                        ? kCFBooleanTrue : NULL;
                                                    });
     return status;