blob: 8b1372b55f5cc916ff977cd3b0243924e7267dca [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
bigbiffd58ba182020-03-23 10:02:29 -04006LOCAL_MODULE_TAGS := optional
Ethan Yonkerbd7492d2016-12-07 13:55:01 -06007LOCAL_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
bigbiffd58ba182020-03-23 10:02:29 -040011LOCAL_C_INCLUDES := system/extras/ext4_utils \
12 system/extras/ext4_utils/include/ext4_utils \
13 external/scrypt/lib/crypto \
14 system/security/keystore/include \
15 hardware/libhardware/include/hardware \
16 system/security/softkeymaster/include/keymaster \
17 system/keymaster/include
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060018
19ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),)
20 LOCAL_CFLAGS += -DTW_CRYPTO_HAVE_KEYMASTERX
21 LOCAL_C_INCLUDES += external/boringssl/src/include
22endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -050023ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050024 #8.0 or higher
25 LOCAL_CFLAGS += -DHAVE_GATEKEEPER1
bigbiffd58ba182020-03-23 10:02:29 -040026 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 29; echo $$?),0)
27 LOCAL_SHARED_LIBRARIES += android.hardware.confirmationui@1.0
bigbiffd58ba182020-03-23 10:02:29 -040028 endif
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050029 LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@3.0 libkeystore_binder libhidlbase libutils libbinder android.hardware.gatekeeper@1.0
30 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
31 #9.0 rules
32 LOCAL_CFLAGS += -DUSE_KEYSTORAGE_4 -Wno-unused-variable -Wno-sign-compare -Wno-unused-parameter -Wno-comment
Ethan Yonker93382822018-11-01 15:25:31 -050033 LOCAL_SRC_FILES += Ext4CryptPie.cpp Keymaster4.cpp KeyStorage4.cpp KeyUtil.cpp MetadataCrypt.cpp KeyBuffer.cpp
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050034 LOCAL_SHARED_LIBRARIES += android.hardware.keymaster@4.0 libkeymaster4support
35 LOCAL_SHARED_LIBRARIES += android.hardware.gatekeeper@1.0 libkeystore_parcelables libkeystore_aidl
Ethan Yonker31344a32017-11-29 12:13:41 -060036 LOCAL_CFLAGS += -DHAVE_SYNTH_PWD_SUPPORT
37 LOCAL_SRC_FILES += Weaver1.cpp
38 LOCAL_SHARED_LIBRARIES += android.hardware.weaver@1.0
Ethan Yonker31344a32017-11-29 12:13:41 -060039 LOCAL_CFLAGS += -DHAVE_LIBKEYUTILS
40 LOCAL_SHARED_LIBRARIES += libkeyutils
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050041 else
42 #8.0 rules
43 LOCAL_CFLAGS += -DUSE_KEYSTORAGE_3
44 LOCAL_SRC_FILES += Ext4Crypt.cpp Keymaster3.cpp KeyStorage3.cpp
45 ifneq ($(wildcard hardware/interfaces/weaver/Android.bp),)
46 #only present in some 8.0 trees and should be in all 8.1 trees
47 LOCAL_CFLAGS += -DHAVE_SYNTH_PWD_SUPPORT
48 LOCAL_SRC_FILES += Weaver1.cpp
49 LOCAL_SHARED_LIBRARIES += android.hardware.weaver@1.0
50 endif
51 ifneq ($(wildcard system/core/libkeyutils/Android.bp),)
52 #only present in some 8.0 trees and should be in all 8.1 trees
53 LOCAL_CFLAGS += -DHAVE_LIBKEYUTILS
54 LOCAL_SHARED_LIBRARIES += libkeyutils
55 endif
Ethan Yonker31344a32017-11-29 12:13:41 -060056 endif
Ethan Yonkerabf1fb02019-04-24 16:09:07 -050057 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
58 LOCAL_REQUIRED_MODULES := keystore_auth
59 else
60 LOCAL_ADDITIONAL_DEPENDENCIES := keystore_auth
61 endif
Ethan Yonkerfefe5912017-09-30 22:22:13 -050062else
Ethan Yonkere9afc3d2018-08-30 15:16:27 -050063 #7.x rules
64 LOCAL_SRC_FILES += Ext4Crypt.cpp Keymaster.cpp KeyStorage.cpp
Ethan Yonkerfefe5912017-09-30 22:22:13 -050065endif
Ethan Yonker58f21322018-08-24 11:17:36 -050066ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 28; echo $$?),0)
67 LOCAL_SHARED_LIBRARIES += libsoftkeymaster
68endif
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060069
70include $(BUILD_SHARED_LIBRARY)
71
72
73
74include $(CLEAR_VARS)
75LOCAL_MODULE := twrpfbe
76LOCAL_MODULE_TAGS := optional
77LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
bigbiffad58e1b2020-07-06 20:24:34 -040078LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060079LOCAL_SRC_FILES := main.cpp
80LOCAL_SHARED_LIBRARIES := libe4crypt
Ethan Yonkerbd7492d2016-12-07 13:55:01 -060081
82include $(BUILD_EXECUTABLE)
83
Ethan Yonker79f88bd2016-12-09 14:52:12 -060084include $(CLEAR_VARS)
85LOCAL_MODULE := e4policyget
86LOCAL_MODULE_TAGS := optional
87LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
bigbiffad58e1b2020-07-06 20:24:34 -040088LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/
Ethan Yonker79f88bd2016-12-09 14:52:12 -060089LOCAL_SRC_FILES := e4policyget.cpp
90LOCAL_SHARED_LIBRARIES := libe4crypt
bigbiffad58e1b2020-07-06 20:24:34 -040091LOCAL_LDFLAGS += -Wl,-dynamic-linker,/system/bin/linker64
Ethan Yonker79f88bd2016-12-09 14:52:12 -060092
93include $(BUILD_EXECUTABLE)
94
Ethan Yonkere131bec2017-12-15 23:48:02 -060095include $(CLEAR_VARS)
96LOCAL_MODULE := keystore_auth
97LOCAL_MODULE_TAGS := optional
98LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
bigbiffad58e1b2020-07-06 20:24:34 -040099LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/
Ethan Yonkere131bec2017-12-15 23:48:02 -0600100LOCAL_SRC_FILES := keystore_auth.cpp
101LOCAL_SHARED_LIBRARIES := libc libkeystore_binder libutils libbinder liblog
Ethan Yonkere9afc3d2018-08-30 15:16:27 -0500102ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28; echo $$?),0)
103 #9.0
104 LOCAL_CFLAGS += -DUSE_SECURITY_NAMESPACE
105 LOCAL_SHARED_LIBRARIES += libkeystore_aidl
106endif
bigbiffad58e1b2020-07-06 20:24:34 -0400107LOCAL_LDFLAGS += -Wl,-dynamic-linker,/system/bin/linker64
Ethan Yonkere131bec2017-12-15 23:48:02 -0600108
109include $(BUILD_EXECUTABLE)
110
Ethan Yonkerbd7492d2016-12-07 13:55:01 -0600111endif