blob: 0c6ef5b566c689c1b7bcd97d7873ce4065d91f7c [file] [log] [blame]
Ethan Yonkerbd7492d2016-12-07 13:55:01 -06001LOCAL_PATH := $(call my-dir)
2ifeq ($(TW_INCLUDE_CRYPTO), true)
3include $(CLEAR_VARS)
4
5LOCAL_MODULE := libe4crypt
6LOCAL_MODULE_TAGS := eng optional
7LOCAL_CFLAGS :=
Ethan Yonkere9afc3d2018-08-30 15:16:27 -05008LOCAL_SRC_FILES := Decrypt.cpp ScryptParameters.cpp Utils.cpp HashPassword.cpp ext4_crypt.cpp
Ethan Yonker58f21322018-08-24 11:17:36 -05009LOCAL_SHARED_LIBRARIES := libselinux libc libc++ libext4_utils libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060010LOCAL_STATIC_LIBRARIES := libscrypt_static
Ethan Yonker95e80072017-08-24 21:45:50 -050011LOCAL_C_INCLUDES := system/extras/ext4_utils system/extras/ext4_utils/include/ext4_utils external/scrypt/lib/crypto system/security/keystore hardware/libhardware/include/hardware system/security/softkeymaster/include/keymaster system/keymaster/include
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060012
13ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),)
14 LOCAL_CFLAGS += -DTW_CRYPTO_HAVE_KEYMASTERX
15 LOCAL_C_INCLUDES += external/boringssl/src/include
16endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -050017ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050018 #8.0 or higher
19 LOCAL_CFLAGS += -DHAVE_GATEKEEPER1
20 LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@3.0 libkeystore_binder libhidlbase libutils libbinder android.hardware.gatekeeper@1.0
21 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
22 #9.0 rules
23 LOCAL_CFLAGS += -DUSE_KEYSTORAGE_4 -Wno-unused-variable -Wno-sign-compare -Wno-unused-parameter -Wno-comment
Ethan Yonker93382822018-11-01 15:25:31 -050024 LOCAL_SRC_FILES += Ext4CryptPie.cpp Keymaster4.cpp KeyStorage4.cpp KeyUtil.cpp MetadataCrypt.cpp KeyBuffer.cpp
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050025 LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@4.0 libkeymaster4support
26 LOCAL_SHARED_LIBRARIES += android.hardware.gatekeeper@1.0 libkeystore_parcelables libkeystore_aidl
Ethan Yonker31344a32017-11-29 12:13:41 -060027 LOCAL_CFLAGS += -DHAVE_SYNTH_PWD_SUPPORT
28 LOCAL_SRC_FILES += Weaver1.cpp
29 LOCAL_SHARED_LIBRARIES += android.hardware.weaver@1.0
Ethan Yonker31344a32017-11-29 12:13:41 -060030 LOCAL_CFLAGS += -DHAVE_LIBKEYUTILS
31 LOCAL_SHARED_LIBRARIES += libkeyutils
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050032 else
33 #8.0 rules
34 LOCAL_CFLAGS += -DUSE_KEYSTORAGE_3
35 LOCAL_SRC_FILES += Ext4Crypt.cpp Keymaster3.cpp KeyStorage3.cpp
36 ifneq ($(wildcard hardware/interfaces/weaver/Android.bp),)
37 #only present in some 8.0 trees and should be in all 8.1 trees
38 LOCAL_CFLAGS += -DHAVE_SYNTH_PWD_SUPPORT
39 LOCAL_SRC_FILES += Weaver1.cpp
40 LOCAL_SHARED_LIBRARIES += android.hardware.weaver@1.0
41 endif
42 ifneq ($(wildcard system/core/libkeyutils/Android.bp),)
43 #only present in some 8.0 trees and should be in all 8.1 trees
44 LOCAL_CFLAGS += -DHAVE_LIBKEYUTILS
45 LOCAL_SHARED_LIBRARIES += libkeyutils
46 endif
Ethan Yonker31344a32017-11-29 12:13:41 -060047 endif
Ethan Yonkerabf1fb02019-04-24 16:09:07 -050048 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
49 LOCAL_REQUIRED_MODULES := keystore_auth
50 else
51 LOCAL_ADDITIONAL_DEPENDENCIES := keystore_auth
52 endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -050053else
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050054 #7.x rules
55 LOCAL_SRC_FILES += Ext4Crypt.cpp Keymaster.cpp KeyStorage.cpp
Ethan Yonkerfefe5912017-09-30 22:22:13 -050056endif
Ethan Yonker58f21322018-08-24 11:17:36 -050057ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 28; echo $$?),0)
58 LOCAL_SHARED_LIBRARIES += libsoftkeymaster
59endif
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060060
61include $(BUILD_SHARED_LIBRARY)
62
63
64
65include $(CLEAR_VARS)
66LOCAL_MODULE := twrpfbe
67LOCAL_MODULE_TAGS := optional
68LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
69LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
70LOCAL_SRC_FILES := main.cpp
71LOCAL_SHARED_LIBRARIES := libe4crypt
72#LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
73
74include $(BUILD_EXECUTABLE)
75
Ethan Yonker79f88bd2016-12-09 14:52:12 -060076include $(CLEAR_VARS)
77LOCAL_MODULE := e4policyget
78LOCAL_MODULE_TAGS := optional
79LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
80LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
81LOCAL_SRC_FILES := e4policyget.cpp
82LOCAL_SHARED_LIBRARIES := libe4crypt
83LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
84
85include $(BUILD_EXECUTABLE)
86
Ethan Yonkere131bec2017-12-15 23:48:02 -060087include $(CLEAR_VARS)
88LOCAL_MODULE := keystore_auth
89LOCAL_MODULE_TAGS := optional
90LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
91LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
92LOCAL_SRC_FILES := keystore_auth.cpp
93LOCAL_SHARED_LIBRARIES := libc libkeystore_binder libutils libbinder liblog
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050094ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
95 #9.0
96 LOCAL_CFLAGS += -DUSE_SECURITY_NAMESPACE
97 LOCAL_SHARED_LIBRARIES += libkeystore_aidl
98endif
Ethan Yonkere131bec2017-12-15 23:48:02 -060099LOCAL_LDFLAGS += -Wl,-dynamic-linker,/sbin/linker64
100
101include $(BUILD_EXECUTABLE)
102
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600103endif