1# Copyright (C) 2014 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15LOCAL_PATH := $(call my-dir) 16 17### 18# libkeymaster_messages contains just the code necessary to communicate with a 19# AndroidKeymaster implementation, e.g. one running in TrustZone. 20## 21include $(CLEAR_VARS) 22LOCAL_MODULE:= libkeymaster_messages 23LOCAL_SRC_FILES:= \ 24 android_keymaster_messages.cpp \ 25 android_keymaster_utils.cpp \ 26 authorization_set.cpp \ 27 logger.cpp \ 28 serializable.cpp 29LOCAL_C_INCLUDES := \ 30 $(LOCAL_PATH)/include 31LOCAL_CFLAGS = -Wall -Werror -Wunused 32LOCAL_MODULE_TAGS := optional 33LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 34LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 35include $(BUILD_SHARED_LIBRARY) 36 37### 38# libkeymaster1 contains almost everything needed for a keymaster1 39# implementation, lacking only a subclass of the (abstract) KeymasterContext 40# class to provide environment-specific services and a wrapper to translate from 41# the function-based keymaster HAL API to the message-based AndroidKeymaster API. 42### 43include $(CLEAR_VARS) 44LOCAL_MODULE:= libkeymaster1 45LOCAL_SRC_FILES:= \ 46 aes_key.cpp \ 47 aes_operation.cpp \ 48 android_keymaster.cpp \ 49 android_keymaster_messages.cpp \ 50 android_keymaster_utils.cpp \ 51 asymmetric_key.cpp \ 52 asymmetric_key_factory.cpp \ 53 auth_encrypted_key_blob.cpp \ 54 ec_key.cpp \ 55 ec_key_factory.cpp \ 56 ecdsa_operation.cpp \ 57 hkdf.cpp \ 58 hmac.cpp \ 59 hmac_key.cpp \ 60 hmac_operation.cpp \ 61 integrity_assured_key_blob.cpp \ 62 key.cpp \ 63 keymaster_enforcement.cpp \ 64 ocb.c \ 65 ocb_utils.cpp \ 66 openssl_err.cpp \ 67 openssl_utils.cpp \ 68 operation.cpp \ 69 operation_table.cpp \ 70 rsa_key.cpp \ 71 rsa_key_factory.cpp \ 72 rsa_operation.cpp \ 73 symmetric_key.cpp 74LOCAL_C_INCLUDES := \ 75 $(LOCAL_PATH)/include 76LOCAL_SHARED_LIBRARIES := libcrypto libkeymaster_messages 77LOCAL_CFLAGS = -Wall -Werror -Wunused 78LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field 79# Ignore benigh warnings for now. 80LOCAL_CLANG_CFLAGS += -Wno-error=unused-private-field 81LOCAL_MODULE_TAGS := optional 82LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 83LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 84include $(BUILD_SHARED_LIBRARY) 85 86 87### 88# libsoftkeymaster provides a software-based keymaster HAL implementation. 89# This is used by keystore as a fallback for when the hardware keymaster does 90# not support the request. 91### 92include $(CLEAR_VARS) 93LOCAL_MODULE := libsoftkeymasterdevice 94LOCAL_SRC_FILES := \ 95 ec_keymaster0_key.cpp \ 96 keymaster0_engine.cpp \ 97 rsa_keymaster0_key.cpp \ 98 soft_keymaster_context.cpp \ 99 soft_keymaster_device.cpp \ 100 soft_keymaster_logger.cpp 101LOCAL_C_INCLUDES := \ 102 system/security/keystore \ 103 $(LOCAL_PATH)/include 104LOCAL_CFLAGS = -Wall -Werror -Wunused 105LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field 106LOCAL_SHARED_LIBRARIES := libkeymaster_messages libkeymaster1 liblog libcrypto 107LOCAL_MODULE_TAGS := optional 108LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 109LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 110include $(BUILD_SHARED_LIBRARY) 111 112# Unit tests for libkeymaster 113include $(CLEAR_VARS) 114LOCAL_MODULE := keymaster_tests 115LOCAL_SRC_FILES := \ 116 android_keymaster_messages_test.cpp \ 117 android_keymaster_test.cpp \ 118 android_keymaster_test_utils.cpp \ 119 authorization_set_test.cpp \ 120 hkdf_test.cpp \ 121 hmac_test.cpp \ 122 key_blob_test.cpp \ 123 keymaster_enforcement_test.cpp 124LOCAL_C_INCLUDES := \ 125 $(LOCAL_PATH)/include 126LOCAL_CFLAGS = -Wall -Werror -Wunused 127LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field 128LOCAL_MODULE_TAGS := tests 129LOCAL_SHARED_LIBRARIES := \ 130 libsoftkeymasterdevice \ 131 libkeymaster_messages \ 132 libkeymaster1 \ 133 libcrypto \ 134 libsoftkeymaster 135LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 136include $(BUILD_NATIVE_TEST) 137 138