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