Merge "system/security/softkeymaster: don't pass a structure into |d2i_PrivateKey|."
diff --git a/softkeymaster/keymaster_openssl.cpp b/softkeymaster/keymaster_openssl.cpp
index 6f31195..927b4a6 100644
--- a/softkeymaster/keymaster_openssl.cpp
+++ b/softkeymaster/keymaster_openssl.cpp
@@ -208,17 +208,11 @@
         return NULL;
     }
 
-    Unique_EVP_PKEY pkey(EVP_PKEY_new());
+    Unique_EVP_PKEY pkey(d2i_PrivateKey(type, nullptr, &p, privateLen));
     if (pkey.get() == NULL) {
         logOpenSSLError("unwrap_key");
         return NULL;
     }
-    EVP_PKEY* tmp = pkey.get();
-
-    if (d2i_PrivateKey(type, &tmp, &p, privateLen) == NULL) {
-        logOpenSSLError("unwrap_key");
-        return NULL;
-    }
 
     return pkey.release();
 }