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