capeprivacy / tf-trusted

tf-trusted allows you to run TensorFlow models in secure enclaves
https://capeprivacy.com/
Apache License 2.0
87 stars 11 forks source link

"tf_trusted_config_proto" or "tf_trusted_config_proto_cc" as target deps in BUILD file? #3

Closed saxenauts closed 5 years ago

saxenauts commented 5 years ago

In the following rules definitions (tf_trusted/BUILD), the rule name defined in sim_enclave is "tf_trusted_config_proto", and the dependencies in sim_enclave and enclave_loader is named "tf_trusted_config_proto_cc".

Just wanted to check if this is intended.

# Contains extensions to enclave protos.
asylo_proto_library(
    name = "tf_trusted_config_proto",
    srcs = ["tf_trusted_config.proto"],
    deps = ["@com_google_asylo//asylo:enclave_proto"],
)

# The enclave
sim_enclave(
    name = "tf_trusted_enclave.so",
    srcs = ["tf_trusted_enclave.cc"],
    config = "@com_google_asylo//asylo/grpc/util:grpc_enclave_config",
    deps = [
        ":tf_trusted_config_proto_cc",
        ":model_server",
        "@com_github_grpc_grpc//:grpc++",
        "@com_github_grpc_grpc//:grpc++_reflection",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/synchronization",
        "@com_google_asylo//asylo:enclave_runtime",
        "@com_google_asylo//asylo/util:status",
    ],
)

# The driver for the gRPC server enclave.
enclave_loader(
    name = "tf_trusted",
    srcs = ["tf_trusted_driver.cc"],
    enclaves = {"enclave": ":tf_trusted_enclave.so"},
    loader_args = ["--enclave_path='{enclave}'"],
    deps = [
        ":tf_trusted_config_proto_cc",
        "@com_github_gflags_gflags//:gflags_nothreads",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/time",
        "@com_google_asylo//asylo:enclave_client",
        "@com_google_asylo//asylo/util:logging",
    ],
)
justin1121 commented 5 years ago

Hello there,

Thanks for the question. sim_enclave is using the correct rule. I'm not a bazel expert but what I think is happening is that the asylo_proto_library function is generating a new rule called tf_trusted_config_proto_cc. This BUILD file was developed based on the Asylo tutorials and you can see that they're doing a similar thing here: https://asylo.dev/docs/guides/quickstart.html#building-and-running-an-enclave-application

Let me know if you have further questions. Happy to help.