Home | History | Annotate | Download | only in keymaster
      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 
     15 LOCAL_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 ##
     21 include $(CLEAR_VARS)
     22 LOCAL_MODULE:= libkeymaster_messages
     23 LOCAL_SRC_FILES:= \
     24 		android_keymaster_messages.cpp \
     25 		android_keymaster_utils.cpp \
     26 		authorization_set.cpp \
     27 		logger.cpp \
     28 		serializable.cpp
     29 LOCAL_C_INCLUDES := \
     30 	$(LOCAL_PATH)/include
     31 LOCAL_CFLAGS = -Wall -Werror -Wunused
     32 LOCAL_MODULE_TAGS := optional
     33 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
     34 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
     35 include $(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 ###
     43 include $(CLEAR_VARS)
     44 LOCAL_MODULE:= libkeymaster1
     45 LOCAL_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
     74 LOCAL_C_INCLUDES := \
     75 	$(LOCAL_PATH)/include
     76 LOCAL_SHARED_LIBRARIES := libcrypto libkeymaster_messages
     77 LOCAL_CFLAGS = -Wall -Werror -Wunused
     78 LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
     79 # Ignore benigh warnings for now.
     80 LOCAL_CLANG_CFLAGS += -Wno-error=unused-private-field
     81 LOCAL_MODULE_TAGS := optional
     82 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
     83 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
     84 include $(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 ###
     92 include $(CLEAR_VARS)
     93 LOCAL_MODULE := libsoftkeymasterdevice
     94 LOCAL_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
    101 LOCAL_C_INCLUDES := \
    102 	system/security/keystore \
    103 	$(LOCAL_PATH)/include
    104 LOCAL_CFLAGS = -Wall -Werror -Wunused
    105 LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
    106 LOCAL_SHARED_LIBRARIES := libkeymaster_messages libkeymaster1 liblog libcrypto
    107 LOCAL_MODULE_TAGS := optional
    108 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    109 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
    110 include $(BUILD_SHARED_LIBRARY)
    111 
    112 # Unit tests for libkeymaster
    113 include $(CLEAR_VARS)
    114 LOCAL_MODULE := keymaster_tests
    115 LOCAL_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
    124 LOCAL_C_INCLUDES := \
    125 	$(LOCAL_PATH)/include
    126 LOCAL_CFLAGS = -Wall -Werror -Wunused
    127 LOCAL_CLANG_CFLAGS += -Wno-error=unused-const-variable -Wno-error=unused-private-field
    128 LOCAL_MODULE_TAGS := tests
    129 LOCAL_SHARED_LIBRARIES := \
    130 	libsoftkeymasterdevice \
    131 	libkeymaster_messages \
    132 	libkeymaster1 \
    133 	libcrypto \
    134 	libsoftkeymaster
    135 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    136 include $(BUILD_NATIVE_TEST)
    137 
    138