blob: aafd7a0bce1cfcd33d03771bd7258176c5424d14 [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
6LOCAL_MODULE_TAGS := eng optional
7LOCAL_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
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
35else
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
43endif
44ifeq ($(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
52endif
53
54include $(BUILD_SHARED_LIBRARY)
55
56
57
58include $(CLEAR_VARS)
59LOCAL_MODULE := twrpdec
60LOCAL_MODULE_TAGS := optional
61LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
62LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
63LOCAL_SRC_FILES := main.cpp cryptfs.cpp
64LOCAL_SHARED_LIBRARIES := libcrypto libhardware libcutils libc libstdc++
65LOCAL_C_INCLUDES := external/openssl/include $(commands_recovery_local_path)/crypto/scrypt/lib/crypto
66ifeq ($(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
70endif
71
72ifeq ($(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
90else
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
98endif
99ifeq ($(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
107endif
108
109LOCAL_WHOLE_STATIC_LIBRARIES += libscrypttwrp_static
110include $(BUILD_EXECUTABLE)
111
112endif