1//
2// Copyright (C) 2020 The Android Open-Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20cc_library {
21    name: "libcuttlefish_security",
22    defaults: [
23        "cuttlefish_host",
24        "hidl_defaults",
25    ],
26    srcs: [
27        "keymaster_channel.cpp",
28    ],
29    header_libs: [
30        "libhardware_headers",
31    ],
32    shared_libs: [
33        "libbase",
34        "libcuttlefish_transport",
35        "libcuttlefish_utils_result",
36        "libgatekeeper",
37        "libkeymaster_messages",
38        "liblog",
39    ],
40    target: {
41        android: {
42            shared_libs: ["libcuttlefish_fs"],
43            srcs: [
44                "confui_sign.cpp",
45                "gatekeeper_channel_sharedfd.cpp",
46                "keymaster_channel_sharedfd.cpp",
47            ],
48        },
49        darwin: {
50            enabled: true,
51        },
52        not_windows: { // Actually means "not-windows host code"
53            shared_libs: ["libcuttlefish_fs"],
54            srcs: [
55                "confui_sign.cpp",
56                "gatekeeper_channel_sharedfd.cpp",
57                "keymaster_channel_sharedfd.cpp",
58            ],
59        },
60        windows: {
61            enabled: true,
62            srcs: [
63                "gatekeeper_channel_windows.cpp",
64                "keymaster_channel_windows.cpp",
65            ],
66        },
67    },
68}
69
70cc_test {
71    name: "libcuttlefish_security_tests",
72    srcs: [
73        "keymaster_channel_test.cpp",
74    ],
75    shared_libs: [
76        "libbase",
77        "libcuttlefish_fs",
78        "libcuttlefish_security",
79        "libcuttlefish_utils_result",
80        "libgatekeeper",
81        "libkeymaster_messages",
82        "liblog",
83    ],
84    static_libs: [
85        "libgmock",
86        "libgtest",
87    ],
88    defaults: ["cuttlefish_buildhost_only"],
89    test_suites: ["general-tests"],
90    test_options: {
91        unit_test: true,
92    },
93}
94