blob: 4fd8b0b75ffa2c360bb434d66d341b5ddaf05087 [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
17ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
18 #8.0 or higher
19 LOCAL_C_INCLUDES += external/boringssl/src/include
bigbiff7ba75002020-04-11 20:47:09 -040020 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 Yonker98661c12018-10-17 08:39:28 -050027 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
41else
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
49endif
50ifeq ($(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
58endif
59
60include $(BUILD_SHARED_LIBRARY)
61
62
63
64include $(CLEAR_VARS)
65LOCAL_MODULE := twrpdec
66LOCAL_MODULE_TAGS := optional
67LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
68LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
69LOCAL_SRC_FILES := main.cpp cryptfs.cpp
70LOCAL_SHARED_LIBRARIES := libcrypto libhardware libcutils libc libstdc++
71LOCAL_C_INCLUDES := external/openssl/include $(commands_recovery_local_path)/crypto/scrypt/lib/crypto
72ifeq ($(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
76endif
77
78ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
79 #8.0 or higher
80 LOCAL_C_INCLUDES += external/boringssl/src/include
bigbiff7ba75002020-04-11 20:47:09 -040081 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 Yonker98661c12018-10-17 08:39:28 -050088 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
102else
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
110endif
111ifeq ($(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
119endif
120
121LOCAL_WHOLE_STATIC_LIBRARIES += libscrypttwrp_static
122include $(BUILD_EXECUTABLE)
123
124endif