blob: 0a0b91a420937f4b3f826d7a95ec5a4694a0d18d [file] [log] [blame]
Hasini Gunasingheaf6ff832022-05-19 23:57:10 +00001# Copyright (C) 2022 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
16LOCAL_DIR := $(GET_LOCAL_DIR)
17
18MODULE := $(LOCAL_DIR)
19
20MANIFEST := $(LOCAL_DIR)/manifest.json
21
22MODULE_SRCS += \
Orlando Arbildoe79b5312022-10-07 23:08:04 +000023 $(LOCAL_DIR)/lib.rs \
Hasini Gunasingheaf6ff832022-05-19 23:57:10 +000024
25MODULE_CRATE_NAME := keymint
26
27MODULE_LIBRARY_DEPS += \
Orlando Arbildoede91282023-02-18 01:14:02 +000028 trusty/user/base/interface/keybox \
Hasini Gunasinghecfae16e2022-12-15 02:52:40 +000029 trusty/user/base/lib/hwbcc/rust \
Orlando Arbildo367ef082022-10-11 22:12:34 +000030 trusty/user/base/lib/hwkey/rust \
Orlando Arbildoe6827812022-11-02 17:21:17 +000031 trusty/user/base/lib/hwwsk/rust \
Hasini Gunasinghe900251b2022-06-15 05:35:51 +000032 trusty/user/base/lib/keymint-rust/boringssl \
Hasini Gunasingheaf6ff832022-05-19 23:57:10 +000033 trusty/user/base/lib/keymint-rust/common \
34 trusty/user/base/lib/keymint-rust/ta \
Per Larsenac9e6f72023-09-08 23:12:29 +000035 $(call FIND_CRATE,log) \
Per Larsen6b6e0232023-09-15 01:11:35 +000036 $(call FIND_CRATE,protobuf)/2.27.1 \
Orlando Arbildo95d17742022-10-28 20:29:39 +000037 trusty/user/base/lib/storage/rust \
Hasini Gunasingheaf6ff832022-05-19 23:57:10 +000038 trusty/user/base/lib/tipc/rust \
Orlando Arbildod3e50642022-12-09 00:56:30 +000039 trusty/user/base/lib/system_state/rust \
Hasini Gunasingheaf6ff832022-05-19 23:57:10 +000040 trusty/user/base/lib/trusty-log \
41 trusty/user/base/lib/trusty-std \
42
Hasini Gunasinghee3bc7002023-01-25 00:48:04 +000043ifdef TRUSTY_KM_RUST_ACCESS_POLICY
44 MODULE_LIBRARY_DEPS+= $(TRUSTY_KM_RUST_ACCESS_POLICY)
45else
46 MODULE_LIBRARY_DEPS+= trusty/user/app/keymint/generic_access_policy
47endif
48
David Drysdalede68aed2022-12-19 11:57:48 +000049MODULE_RUSTFLAGS += \
50 --cfg 'feature="soft_attestation_fallback"' \
David Drysdale94562a52023-02-20 14:43:36 +000051 --cfg 'feature="auto_second_imei"' \
David Drysdalede68aed2022-12-19 11:57:48 +000052
Orlando Arbildoe79b5312022-10-07 23:08:04 +000053MODULE_RUST_TESTS := true
54
David Drysdalef2e821c2024-02-12 15:49:29 +000055# The port tests are built and installed regardless of whether the KeyMint Rust TA
56# is enabled, so set a config value to allow tests that involve the TA to be skipped.
57ifeq (rust,$(TRUSTY_KEYMINT_IMPL))
58 MODULE_RUSTFLAGS += --cfg 'kmr_enabled'
59endif
60
Orlando Arbildoede91282023-02-18 01:14:02 +000061MODULE_BINDGEN_ALLOW_TYPES := \
62 keybox.* \
63
David Drysdale4176f242023-03-21 09:58:59 +000064MODULE_BINDGEN_ALLOW_FUNCTIONS := \
65 trusty_rng_.* \
66
Orlando Arbildoede91282023-02-18 01:14:02 +000067MODULE_BINDGEN_ALLOW_VARS := \
68 KEYBOX.* \
69
70MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/bindings.h
71
David Drysdale2b130242024-05-29 10:29:32 +010072MODULE_RUST_USE_CLIPPY := true
73
Orlando Arbildoe6827812022-11-02 17:21:17 +000074include make/library.mk