From 77c8093c4a345cc581d69d2904e1254019e6c9f5 Mon Sep 17 00:00:00 2001 From: Tyler Fanelli Date: Wed, 6 Nov 2024 22:14:07 -0500 Subject: [PATCH 1/2] as: Don't use all-verifier features The verifier/all-verifier option is already enabled with the default build. Yet, if a user wants to optionally compile with a subset of verifiers, they cannot due so unless disabling the all-verifier feature in the dependency. Signed-off-by: Tyler Fanelli --- attestation-service/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attestation-service/Cargo.toml b/attestation-service/Cargo.toml index 237ce6d46..f7dfc6115 100644 --- a/attestation-service/Cargo.toml +++ b/attestation-service/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [features] -default = [ "restful-bin", "rvps-grpc", "rvps-builtin" ] +default = [ "restful-bin", "rvps-grpc", "rvps-builtin", "all-verifier" ] all-verifier = [ "verifier/all-verifier" ] tdx-verifier = [ "verifier/tdx-verifier" ] sgx-verifier = [ "verifier/sgx-verifier" ] @@ -66,7 +66,7 @@ tonic = { workspace = true, optional = true } uuid = { version = "1.1.2", features = ["v4"] } [target.'cfg(not(target_arch = "s390x"))'.dependencies] -verifier = { path = "../deps/verifier", default-features = false, features = ["all-verifier"] } +verifier = { path = "../deps/verifier", default-features = false } [target.'cfg(target_arch = "s390x")'.dependencies] verifier = { path = "../deps/verifier", default-features = false, features = ["se-verifier"] } From f25a21a7ecac4e8ec933d48868364dec38e484cb Mon Sep 17 00:00:00 2001 From: Tyler Fanelli Date: Wed, 6 Nov 2024 22:35:41 -0500 Subject: [PATCH 2/2] as/Makefile: Allow conditional features Supplying a FEATURES argument to the attestation service's Makefile can conditionally compile features into the build. The FEATURES argument will disable default features and instead supply the selected features. For example `FEATURES=restful-bin,rvps-grpc,snp-verifier make grpc-as` will expand to: cargo build --bin grpc-as --release \ --no-default-features \ --features grpc-bin,restful-bin,rvps-grpc,snp-verifier Signed-off-by: Tyler Fanelli --- attestation-service/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/attestation-service/Makefile b/attestation-service/Makefile index 60e285b12..67ca32953 100644 --- a/attestation-service/Makefile +++ b/attestation-service/Makefile @@ -8,6 +8,16 @@ BIN_NAMES := grpc-as restful-as DEBUG ?= DESTDIR ?= $(PREFIX)/bin +FEATURES ?= + +ifdef FEATURES + OPTIONAL_FEATURES := ,$(FEATURES) + default-features := --no-default-features +else + OPTIONAL_FEATURES := + default-features := +endif + ifdef DEBUG release := TARGET_DIR := $(TARGET_DIR)/debug @@ -19,10 +29,10 @@ endif build: grpc-as restful-as grpc-as: - cargo build --bin grpc-as $(release) --features grpc-bin + cargo build --bin grpc-as $(release) $(default-features) --features grpc-bin$(OPTIONAL_FEATURES) restful-as: - cargo build --bin restful-as $(release) --features restful-bin + cargo build --bin restful-as $(release) $(default-features) --features restful-bin$(OPTIONAL_FEATURES) install: for bin_name in $(BIN_NAMES); do \