Make libmincrypttwrp a shared library

Change-Id: I8c3f084fc34b00edb4cd1b652290df8bc80ea1db
diff --git a/Android.mk b/Android.mk
index fc13afc..5bf90ce 100644
--- a/Android.mk
+++ b/Android.mk
@@ -442,8 +442,7 @@
 
 LOCAL_MODULE := libfusesideload
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
-LOCAL_SHARED_LIBRARIES := libcutils libc
-LOCAL_STATIC_LIBRARIES := libmincrypttwrp
+LOCAL_SHARED_LIBRARIES := libcutils libc libmincrypttwrp
 include $(BUILD_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
@@ -476,8 +475,7 @@
 LOCAL_MODULE_TAGS := eng optional
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/libmincrypt/includes
 LOCAL_SRC_FILES = adb_install.cpp asn1_decoder.cpp bootloader.cpp verifier.cpp mtdutils/mtdutils.c legacy_property_service.c
-LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils libfusesideload
-LOCAL_STATIC_LIBRARIES += libmincrypttwrp
+LOCAL_SHARED_LIBRARIES += libc liblog libcutils libmtdutils libfusesideload libmincrypttwrp
 
 ifneq ($(BOARD_RECOVERY_BLDRMSG_OFFSET),)
     LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOARD_RECOVERY_BLDRMSG_OFFSET)
diff --git a/crypto/lollipop/Android.mk b/crypto/lollipop/Android.mk
index cce070b..40b4d5f 100644
--- a/crypto/lollipop/Android.mk
+++ b/crypto/lollipop/Android.mk
@@ -44,9 +44,9 @@
 #    hardware/libhardware/include/hardware \
 #	system/security/softkeymaster/include/keymaster
 #LOCAL_SHARED_LIBRARIES += libc liblog libcutils libcrypto libext4_utils
-LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
+LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libmincrypttwrp liblogwrap
 LOCAL_C_INCLUDES := external/openssl/include $(common_c_includes)
-LOCAL_STATIC_LIBRARIES += libfs_mgr libscrypt_static liblogwrap libmincrypttwrp
+LOCAL_WHOLE_STATIC_LIBRARIES += libfs_mgr libscrypt_static
 
 include $(BUILD_SHARED_LIBRARY)
 endif
diff --git a/libmincrypt/Android.mk b/libmincrypt/Android.mk
index 034b05f..fa6bc78 100644
--- a/libmincrypt/Android.mk
+++ b/libmincrypt/Android.mk
@@ -14,4 +14,11 @@
 LOCAL_C_INCLUDES := $(commands_recovery_local_path)/libmincrypt/includes
 LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
 LOCAL_CFLAGS := -Wall -Werror
-include $(BUILD_HOST_STATIC_LIBRARY)
\ No newline at end of file
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmincrypttwrp
+LOCAL_C_INCLUDES := $(commands_recovery_local_path)/libmincrypt/includes
+LOCAL_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
+LOCAL_CFLAGS := -Wall -Werror
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index dbcf9bf..7e88da7 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -67,7 +67,7 @@
 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind.so
 RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind-ptrace.so
 # end libraries from lollipop
-#RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypt.so
+RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypttwrp.so
 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toolbox
 ifneq ($(TW_OEM_BUILD),true)
     RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/twrp