summaryrefslogtreecommitdiffstats
path: root/Android.mk
blob: 1c86ccd928c226ac1cfeb66f7245e960b2f302aa (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
# 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
# GoogleKeymaster implementation, e.g. one running in TrustZone.
##
include $(CLEAR_VARS)
LOCAL_MODULE:= libkeymaster_messages
LOCAL_SRC_FILES:= \
		authorization_set.cpp \
		google_keymaster_messages.cpp \
		google_keymaster_utils.cpp \
		key_blob.cpp \
		logger.cpp \
		serializable.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror
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) GoogleKeymaster
# class to provide environment-specific services and a wrapper to translate from
# the function-based keymaster HAL API to the message-based GoogleKeymaster API.
###
include $(CLEAR_VARS)
LOCAL_MODULE:= libkeymaster1
LOCAL_SRC_FILES:= \
		aead_mode_operation.cpp \
		aes_key.cpp \
		aes_operation.cpp \
		asymmetric_key.cpp \
		ec_key.cpp \
		ecdsa_operation.cpp \
		google_keymaster.cpp \
		google_keymaster_messages.cpp \
		google_keymaster_utils.cpp \
		hkdf.cpp \
		hmac.cpp \
		hmac_key.cpp \
		hmac_operation.cpp \
		key.cpp \
		ocb.c \
		openssl_err.cpp \
		openssl_utils.cpp \
		operation.cpp \
		operation_table.cpp \
		rsa_key.cpp \
		rsa_operation.cpp \
		symmetric_key.cpp \
		unencrypted_key_blob.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := libcrypto libkeymaster_messages
LOCAL_CFLAGS = -Wall -Werror
# 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 := \
	soft_keymaster_device.cpp \
	soft_keymaster_logger.cpp
LOCAL_C_INCLUDES := \
	system/security/keystore \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror
LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable
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 := libkeymaster_test
LOCAL_SRC_FILES := \
	abstract_factory_registry_test.cpp \
	authorization_set_test.cpp \
	google_keymaster_messages_test.cpp \
	google_keymaster_test.cpp \
	google_keymaster_test_utils.cpp \
	hkdf_test.cpp \
	hmac_test.cpp \
	key_blob_test.cpp \
	keymaster_enforcement.cpp \
	keymaster_enforcement_test.cpp
LOCAL_C_INCLUDES := \
	$(LOCAL_PATH)/include
LOCAL_CFLAGS = -Wall -Werror
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := libsoftkeymasterdevice libkeymaster_messages libkeymaster1 libcrypto
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
include $(BUILD_NATIVE_TEST)