summaryrefslogtreecommitdiffstats
path: root/Android.mk
blob: ed1a06e5ea23313bd976890d84948e16a8a15202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

###
# libkeymaster_messages contains just the code necessary to communicate with a
# AndroidKeymaster implementation, e.g. one running in TrustZone.
##
include $(CLEAR_VARS)
LOCAL_MODULE:= libkeymaster_messages
LOCAL_SRC_FILES:= \
		android_keymaster_messages.cpp \
		android_keymaster_utils.cpp \
		authorization_set.cpp \
		logger.cpp \
		serializable.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror -Wunused
LOCAL_MODULE_TAGS := optional
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_SHARED_LIBRARY)

###
# libkeymaster1 contains almost everything needed for a keymaster1
# implementation, lacking only a subclass of the (abstract) KeymasterContext
# class to provide environment-specific services and a wrapper to translate from
# the function-based keymaster HAL API to the message-based AndroidKeymaster API.
###
include $(CLEAR_VARS)
LOCAL_MODULE:= libkeymaster1
LOCAL_SRC_FILES:= \
		aes_key.cpp \
		aes_operation.cpp \
		android_keymaster.cpp \
		android_keymaster_messages.cpp \
		android_keymaster_utils.cpp \
		asymmetric_key.cpp \
		asymmetric_key_factory.cpp \
		auth_encrypted_key_blob.cpp \
		ec_key.cpp \
		ec_key_factory.cpp \
		ecdsa_operation.cpp \
		hkdf.cpp \
		hmac.cpp \
		hmac_key.cpp \
		hmac_operation.cpp \
		integrity_assured_key_blob.cpp \
		key.cpp \
		keymaster_enforcement.cpp \
		ocb.c \
		ocb_utils.cpp \
		openssl_err.cpp \
		openssl_utils.cpp \
		operation.cpp \
		operation_table.cpp \
		rsa_key.cpp \
		rsa_key_factory.cpp \
		rsa_operation.cpp \
		symmetric_key.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := libcrypto libkeymaster_messages
LOCAL_CFLAGS = -Wall -Werror -Wunused
LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
# Ignore benigh warnings for now.
LOCAL_CLANG_CFLAGS += -Wno-error=unused-private-field
LOCAL_MODULE_TAGS := optional
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_SHARED_LIBRARY)


###
# libsoftkeymaster provides a software-based keymaster HAL implementation.
# This is used by keystore as a fallback for when the hardware keymaster does
# not support the request.
###
include $(CLEAR_VARS)
LOCAL_MODULE := libsoftkeymasterdevice
LOCAL_SRC_FILES := \
	ec_keymaster0_key.cpp \
	keymaster0_engine.cpp \
	rsa_keymaster0_key.cpp \
	soft_keymaster_context.cpp \
	soft_keymaster_device.cpp \
	soft_keymaster_logger.cpp
LOCAL_C_INCLUDES := \
	system/security/keystore \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror -Wunused
LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
LOCAL_SHARED_LIBRARIES := libkeymaster_messages libkeymaster1 liblog libcrypto
LOCAL_MODULE_TAGS := optional
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)

# Unit tests for libkeymaster
include $(CLEAR_VARS)
LOCAL_MODULE := keymaster_tests
LOCAL_SRC_FILES := \
	android_keymaster_messages_test.cpp \
	android_keymaster_test.cpp \
	android_keymaster_test_utils.cpp \
	authorization_set_test.cpp \
	hkdf_test.cpp \
	hmac_test.cpp \
	key_blob_test.cpp \
	keymaster_enforcement_test.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror -Wunused
LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := \
	libsoftkeymasterdevice \
	libkeymaster_messages \
	libkeymaster1 \
	libcrypto \
	libsoftkeymaster
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_NATIVE_TEST)