Ethan Yonker | 98661c1 | 2018-10-17 08:39:28 -0500 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
| 2 | ifeq ($(TW_INCLUDE_CRYPTO), true) |
| 3 | include $(CLEAR_VARS) |
| 4 | |
| 5 | LOCAL_MODULE := libcryptfsfde |
bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 6 | LOCAL_MODULE_TAGS := optional |
Ethan Yonker | 98661c1 | 2018-10-17 08:39:28 -0500 | [diff] [blame] | 7 | LOCAL_SRC_FILES := cryptfs.cpp |
| 8 | LOCAL_SHARED_LIBRARIES := libcrypto libhardware libcutils libstdc++ |
| 9 | LOCAL_STATIC_LIBRARIES := libscrypttwrp_static |
| 10 | LOCAL_C_INCLUDES := external/openssl/include $(commands_recovery_local_path)/crypto/scrypt/lib/crypto |
| 11 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) |
| 12 | LOCAL_C_INCLUDES += bionic external/stlport/stlport |
| 13 | LOCAL_SHARED_LIBRARIES += libstlport |
| 14 | LOCAL_CPPFLAGS := -std=c++11 |
| 15 | endif |
| 16 | |
| 17 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0) |
| 18 | #8.0 or higher |
| 19 | LOCAL_C_INCLUDES += external/boringssl/src/include |
| 20 | LOCAL_SHARED_LIBRARIES += libselinux libc libc++ libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite libe4crypt android.hardware.keymaster@3.0 libkeystore_binder libhidlbase libutils libbinder |
| 21 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0) |
| 22 | #9.0 rules |
| 23 | LOCAL_CFLAGS += -Wno-unused-variable -Wno-sign-compare -Wno-unused-parameter -Wno-comment |
| 24 | LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@4.0 libkeymaster4support libkeyutils |
| 25 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=4 |
| 26 | else |
| 27 | #8.x rules |
| 28 | ifneq ($(wildcard system/core/libkeyutils/Android.bp),) |
| 29 | #only present in some 8.0 trees and should be in all 8.1 trees |
| 30 | LOCAL_SHARED_LIBRARIES += libkeyutils |
| 31 | endif |
| 32 | LOCAL_SHARED_LIBRARIES += libsoftkeymaster |
| 33 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=3 |
| 34 | endif |
| 35 | else |
| 36 | # <= 7.x rules |
| 37 | ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),) |
| 38 | LOCAL_C_INCLUDES += external/boringssl/src/include |
| 39 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=1 |
| 40 | else |
| 41 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=0 |
| 42 | endif |
| 43 | endif |
| 44 | ifeq ($(TARGET_HW_DISK_ENCRYPTION),true) |
| 45 | ifeq ($(TARGET_CRYPTFS_HW_PATH),) |
| 46 | LOCAL_C_INCLUDES += device/qcom/common/cryptfs_hw |
| 47 | else |
| 48 | LOCAL_C_INCLUDES += $(TARGET_CRYPTFS_HW_PATH) |
| 49 | endif |
| 50 | LOCAL_SHARED_LIBRARIES += libcryptfs_hw |
| 51 | LOCAL_CFLAGS += -DCONFIG_HW_DISK_ENCRYPTION |
| 52 | endif |
| 53 | |
| 54 | include $(BUILD_SHARED_LIBRARY) |
| 55 | |
| 56 | |
| 57 | |
| 58 | include $(CLEAR_VARS) |
| 59 | LOCAL_MODULE := twrpdec |
| 60 | LOCAL_MODULE_TAGS := optional |
| 61 | LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES |
| 62 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin |
| 63 | LOCAL_SRC_FILES := main.cpp cryptfs.cpp |
| 64 | LOCAL_SHARED_LIBRARIES := libcrypto libhardware libcutils libc libstdc++ |
| 65 | LOCAL_C_INCLUDES := external/openssl/include $(commands_recovery_local_path)/crypto/scrypt/lib/crypto |
| 66 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) |
| 67 | LOCAL_C_INCLUDES += bionic external/stlport/stlport |
| 68 | LOCAL_SHARED_LIBRARIES += libstlport |
| 69 | LOCAL_CPPFLAGS := -std=c++11 |
| 70 | endif |
| 71 | |
| 72 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0) |
| 73 | #8.0 or higher |
| 74 | LOCAL_C_INCLUDES += external/boringssl/src/include |
| 75 | LOCAL_SHARED_LIBRARIES += libselinux libc libc++ libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite libe4crypt android.hardware.keymaster@3.0 libkeystore_binder libhidlbase libutils libbinder |
| 76 | ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0) |
| 77 | #9.0 rules |
| 78 | LOCAL_CFLAGS += -Wno-unused-variable -Wno-sign-compare -Wno-unused-parameter -Wno-comment |
| 79 | LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@4.0 libkeymaster4support libkeyutils |
| 80 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=4 |
| 81 | else |
| 82 | #8.x rules |
| 83 | ifneq ($(wildcard system/core/libkeyutils/Android.bp),) |
| 84 | #only present in some 8.0 trees and should be in all 8.1 trees |
| 85 | LOCAL_SHARED_LIBRARIES += libkeyutils |
| 86 | endif |
| 87 | LOCAL_SHARED_LIBRARIES += libsoftkeymaster |
| 88 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=3 |
| 89 | endif |
| 90 | else |
| 91 | # <= 7.x rules |
| 92 | ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),) |
| 93 | LOCAL_C_INCLUDES += external/boringssl/src/include |
| 94 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=1 |
| 95 | else |
| 96 | LOCAL_CFLAGS += -DTW_KEYMASTER_MAX_API=0 |
| 97 | endif |
| 98 | endif |
| 99 | ifeq ($(TARGET_HW_DISK_ENCRYPTION),true) |
| 100 | ifeq ($(TARGET_CRYPTFS_HW_PATH),) |
| 101 | LOCAL_C_INCLUDES += device/qcom/common/cryptfs_hw |
| 102 | else |
| 103 | LOCAL_C_INCLUDES += $(TARGET_CRYPTFS_HW_PATH) |
| 104 | endif |
| 105 | LOCAL_SHARED_LIBRARIES += libcryptfs_hw |
| 106 | LOCAL_CFLAGS += -DCONFIG_HW_DISK_ENCRYPTION |
| 107 | endif |
| 108 | |
| 109 | LOCAL_WHOLE_STATIC_LIBRARIES += libscrypttwrp_static |
| 110 | include $(BUILD_EXECUTABLE) |
| 111 | |
| 112 | endif |