Skip to content

Commit 014566e

Browse files
committed
ms-tpm-20-ref: Add simulator_lib.
secure_env uses part of simulator's functionality, so split them out as a separate library so that secure_env can link to it. Add visibility to ensure the library is not abused elsewhere. Bug: b/402294836
1 parent 29c7306 commit 014566e

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

base/cvd/BUILD.ms-tpm-20-ref.bazel

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,41 @@ cc_library(
102102
],
103103
)
104104

105+
cc_library(
106+
name = "simulator_lib",
107+
srcs = [
108+
"TPMCmd/Simulator/src/TPMCmdp.c",
109+
"TPMCmd/Simulator/src/TcpServer.c",
110+
],
111+
copts = [
112+
"-std=gnu11",
113+
"-Werror",
114+
"-Wall",
115+
"-Wformat-security",
116+
"-fstack-protector-all",
117+
"-fPIC",
118+
],
119+
defines = [
120+
"HASH_LIB=Ossl",
121+
"SYM_LIB=Ossl",
122+
"MATH_LIB=TpmBigNum",
123+
"BN_MATH_LIB=Ossl",
124+
],
125+
visibility = [
126+
"@//cuttlefish/host/commands/secure_env:__subpackages__",
127+
],
128+
deps = [
129+
":simulator_headers",
130+
":platform_headers",
131+
":tpm_headers",
132+
],
133+
)
134+
105135
cc_binary(
106136
name = "simulator",
107-
srcs = glob(["TPMCmd/Simulator/**/*.c"]),
137+
srcs = [
138+
"TPMCmd/Simulator/src/TPMCmds.c",
139+
],
108140
copts = [
109141
"-std=gnu11",
110142
"-Werror",
@@ -129,6 +161,7 @@ cc_binary(
129161
deps = [
130162
":platform",
131163
":simulator_headers",
164+
":simulator_lib",
132165
":tpm",
133166
"@boringssl//:crypto",
134167
],

0 commit comments

Comments
 (0)