Fix memory leak in keymaster_openssl.

Also, include softkeymaster.h so it can be built from keymaster
dir.  This is needed for the keymaster0 adapter tests.

Bug: 19508876
Change-Id: I8110af586d699d990837005e2a9c209dc1a91c2c
diff --git a/softkeymaster/Android.mk b/softkeymaster/Android.mk
index 2a0a83f..eb32c87 100644
--- a/softkeymaster/Android.mk
+++ b/softkeymaster/Android.mk
@@ -34,7 +34,8 @@
 endif
 LOCAL_MODULE := libsoftkeymaster
 LOCAL_SRC_FILES := keymaster_openssl.cpp
-LOCAL_C_INCLUDES := system/security/keystore
+LOCAL_C_INCLUDES := system/security/keystore \
+	$(LOCAL_PATH)/include
 LOCAL_CFLAGS = -fvisibility=hidden -Wall -Werror
 LOCAL_SHARED_LIBRARIES := libcrypto liblog libkeystore_binder
 LOCAL_MODULE_TAGS := optional
diff --git a/softkeymaster/keymaster_openssl.cpp b/softkeymaster/keymaster_openssl.cpp
index ba58791..edf4db2 100644
--- a/softkeymaster/keymaster_openssl.cpp
+++ b/softkeymaster/keymaster_openssl.cpp
@@ -18,6 +18,7 @@
 #include <stdint.h>
 
 #include <keystore/keystore.h>
+#include <keymaster/softkeymaster.h>
 
 #include <hardware/hardware.h>
 #include <hardware/keymaster0.h>
@@ -422,7 +423,6 @@
         logOpenSSLError("openssl_import_keypair");
         return -1;
     }
-    release_because_ownership_transferred(pkcs8);
 
     if (wrap_key(pkey.get(), EVP_PKEY_type(pkey->type), key_blob, key_blob_length)) {
         return -1;