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
This commit is contained in:
Shawn Willden 2015-03-17 20:44:39 -06:00
parent 3bfd091a39
commit 461d97ef95
2 changed files with 3 additions and 2 deletions

View file

@ -34,7 +34,8 @@ LOCAL_MULTILIB := 32
endif endif
LOCAL_MODULE := libsoftkeymaster LOCAL_MODULE := libsoftkeymaster
LOCAL_SRC_FILES := keymaster_openssl.cpp 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_CFLAGS = -fvisibility=hidden -Wall -Werror
LOCAL_SHARED_LIBRARIES := libcrypto liblog libkeystore_binder LOCAL_SHARED_LIBRARIES := libcrypto liblog libkeystore_binder
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional

View file

@ -18,6 +18,7 @@
#include <stdint.h> #include <stdint.h>
#include <keystore/keystore.h> #include <keystore/keystore.h>
#include <keymaster/softkeymaster.h>
#include <hardware/hardware.h> #include <hardware/hardware.h>
#include <hardware/keymaster0.h> #include <hardware/keymaster0.h>
@ -422,7 +423,6 @@ __attribute__((visibility("default"))) int openssl_import_keypair(const keymaste
logOpenSSLError("openssl_import_keypair"); logOpenSSLError("openssl_import_keypair");
return -1; return -1;
} }
release_because_ownership_transferred(pkcs8);
if (wrap_key(pkey.get(), EVP_PKEY_type(pkey->type), key_blob, key_blob_length)) { if (wrap_key(pkey.get(), EVP_PKEY_type(pkey->type), key_blob, key_blob_length)) {
return -1; return -1;