1#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_DIR := $(GET_LOCAL_DIR)
18
19MODULE := $(LOCAL_DIR)
20
21MANIFEST := $(LOCAL_DIR)/manifest.json
22
23MODULE_CONSTANTS := $(LOCAL_DIR)/hwcrypto_consts.json
24
25MODULE_INCLUDES := $(LOCAL_DIR)/include
26
27MODULE_SRCS := \
28	$(LOCAL_DIR)/main.c \
29	$(LOCAL_DIR)/hwrng_srv.c \
30	$(LOCAL_DIR)/hwkey_srv.c \
31
32ifeq (true,$(call TOBOOL,$(WITH_FAKE_HWRNG)))
33MODULE_SRCS += $(LOCAL_DIR)/hwrng_srv_fake_provider.c
34endif
35
36ifeq (true,$(call TOBOOL,$(WITH_FAKE_HWKEY)))
37MODULE_SRCS += $(LOCAL_DIR)/hwkey_srv_fake_provider.c
38endif
39
40MODULE_LIBRARY_DEPS := \
41	external/boringssl \
42	trusty/user/base/interface/hwaes \
43	trusty/user/base/interface/hwrng \
44	trusty/user/base/interface/hwkey \
45	trusty/user/base/lib/libc-trusty \
46	trusty/user/base/lib/system_state \
47	trusty/user/base/lib/tipc \
48
49ifneq ($(APPLOADER_SIGN_PUBLIC_KEY_0_FILE),)
50MODULE_COMPILEFLAGS += \
51	-DAPPLOADER_SIGN_PUBLIC_KEY_0_FILE=\"$(APPLOADER_SIGN_PUBLIC_KEY_0_FILE)\"
52ifeq (true,$(call TOBOOL,$(APPLOADER_SIGN_KEY_0_UNLOCKED_ONLY)))
53MODULE_COMPILEFLAGS += \
54	-DAPPLOADER_SIGN_KEY_0_UNLOCKED_ONLY=1
55endif
56endif
57
58ifneq ($(APPLOADER_SIGN_PUBLIC_KEY_1_FILE),)
59MODULE_COMPILEFLAGS += \
60	-DAPPLOADER_SIGN_PUBLIC_KEY_1_FILE=\"$(APPLOADER_SIGN_PUBLIC_KEY_1_FILE)\"
61ifeq (true,$(call TOBOOL,$(APPLOADER_SIGN_KEY_1_UNLOCKED_ONLY)))
62MODULE_COMPILEFLAGS += \
63	-DAPPLOADER_SIGN_KEY_1_UNLOCKED_ONLY=1
64endif
65endif
66
67ifneq ($(APPLOADER_ENCRYPT_KEY_0_FILE),)
68MODULE_COMPILEFLAGS += \
69	-DAPPLOADER_ENCRYPT_KEY_0_FILE=\"$(APPLOADER_ENCRYPT_KEY_0_FILE)\"
70endif
71
72ifneq ($(APPLOADER_ENCRYPT_KEY_1_FILE),)
73MODULE_COMPILEFLAGS += \
74	-DAPPLOADER_ENCRYPT_KEY_1_FILE=\"$(APPLOADER_ENCRYPT_KEY_1_FILE)\"
75endif
76
77ifeq (true,$(call TOBOOL,$(WITH_FAKE_KEYBOX)))
78MODULE_DEFINES += WITH_FAKE_KEYBOX
79include $(LOCAL_DIR)/keybox/rules.mk
80endif
81
82include make/trusted_app.mk
83