From 56cf56465857e79e814b1e2d50f13e176170fcb3 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Fri, 19 Aug 2016 17:43:45 -0400 Subject: twrpDigest refactor This patch is to refactor twrpDigest using polymorphism and inheritance to use the same call patterns for creating and reading a digest. Now a library. Use SHA2 from libcrypto. SHA2 is default if device has libcrypto. Change string MD5 everywhere to use digest or Digest instead. Updated string tags to digest. Translation will be required. Switch out digest code into a driver class from partitionmanager. SHA2 is better for digest creation due to decreased collision space compared to MD5 and SHA1. See https://en.wikipedia.org/wiki/SHA-2 Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f --- Android.mk | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Android.mk') diff --git a/Android.mk b/Android.mk index 3d3428fa9..85cdd325b 100644 --- a/Android.mk +++ b/Android.mk @@ -51,18 +51,15 @@ LOCAL_SRC_FILES := \ fixContexts.cpp \ twrpTar.cpp \ exclude.cpp \ - twrpDigest.cpp \ - digest/md5.c \ find_file.cpp \ - infomanager.cpp - -LOCAL_SRC_FILES += \ + infomanager.cpp \ data.cpp \ partition.cpp \ partitionmanager.cpp \ progresstracking.cpp \ twinstall.cpp \ twrp-functions.cpp \ + twrpDigestDriver.cpp \ openrecoveryscript.cpp \ tarWrite.c @@ -112,9 +109,11 @@ LOCAL_C_INCLUDES += \ system/core/libsparse \ external/zlib -LOCAL_C_INCLUDES += bionic external/openssl/include +LOCAL_C_INCLUDES += bionic ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) - LOCAL_C_INCLUDES += external/stlport/stlport + LOCAL_C_INCLUDES += external/stlport/stlport external/openssl/include +else + LOCAL_C_INCLUDES += external/boringssl/include endif LOCAL_STATIC_LIBRARIES := @@ -122,10 +121,11 @@ LOCAL_SHARED_LIBRARIES := LOCAL_STATIC_LIBRARIES += libguitwrp LOCAL_SHARED_LIBRARIES += libaosprecovery libz libc libcutils libstdc++ libtar libblkid libminuitwrp libminadbd libmtdutils libminzip libtwadbbu libbootloader_message -LOCAL_SHARED_LIBRARIES += libcrecovery +LOCAL_SHARED_LIBRARIES += libcrecovery libtwadbbu libtwrpdigest ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) LOCAL_SHARED_LIBRARIES += libstlport + LOCAL_CFLAGS += -DTW_NO_SHA2_LIBRARY endif ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) LOCAL_SHARED_LIBRARIES += libmincrypttwrp @@ -159,10 +159,8 @@ ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) #LOCAL_STATIC_LIBRARIES += liblz4 endif endif - LOCAL_C_INCLUDES += external/libselinux/include LOCAL_SHARED_LIBRARIES += libselinux -LOCAL_CFLAGS += -g ifneq ($(TARGET_USERIMAGES_USE_EXT4), true) LOCAL_CFLAGS += -DUSE_EXT4 LOCAL_C_INCLUDES += system/extras/ext4_utils @@ -682,6 +680,7 @@ include $(commands_recovery_local_path)/injecttwrp/Android.mk \ $(commands_recovery_local_path)/simg2img/Android.mk \ $(commands_recovery_local_path)/adbbu/Android.mk \ $(commands_recovery_local_path)/libpixelflinger/Android.mk \ + $(commands_recovery_local_path)/twrpDigest/Android.mk \ $(commands_recovery_local_path)/attr/Android.mk ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) -- cgit v1.2.3