From 402fc2b1e1a5b1c4e546324874f6764bc3fa5e56 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Sat, 30 Mar 2019 08:42:12 -0400 Subject: [PATCH] tpm12: Build without support for maintentance commands Introduce TPM_NOMAINTENANCE_COMMANDS #define to build the TPM 1.2 code without maintenance commands support. The state for the maintenance commands has been written out so far, so we have to leave this part alive even though nothing can be done with the maintenance key anymore. Signed-off-by: Stefan Berger --- src/Makefile.am | 2 ++ src/tpm12/tpm_maint.c | 2 +- src/tpm12/tpm_owner.c | 2 +- src/tpm12/tpm_process.c | 10 +++++----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index fbaa3a58..529ed61a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,6 +44,8 @@ libtpms_tpm12_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS libtpms_tpm12_la_CFLAGS += -DTPM_NV_DISK # build a POSIX type of TPM libtpms_tpm12_la_CFLAGS += -DTPM_POSIX +# build without maintenance commands +libtpms_tpm12_la_CFLAGS += -DTPM_NOMAINTENANCE_COMMANDS libtpms_tpm12_la_CFLAGS += @DEBUG_DEFINES@ diff --git a/src/tpm12/tpm_maint.c b/src/tpm12/tpm_maint.c index 6cb65c74..98753a2c 100644 --- a/src/tpm12/tpm_maint.c +++ b/src/tpm12/tpm_maint.c @@ -37,7 +37,7 @@ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /********************************************************************************/ -#ifndef TPM_NOMAINTENANCE +#if !defined(TPM_NOMAINTENANCE) && !defined(TPM_NOMAINTENANCE_COMMANDS) #include #include diff --git a/src/tpm12/tpm_owner.c b/src/tpm12/tpm_owner.c index d0521504..6553b985 100644 --- a/src/tpm12/tpm_owner.c +++ b/src/tpm12/tpm_owner.c @@ -1035,7 +1035,7 @@ TPM_RESULT TPM_OwnerClearCommon(tpm_state_t *tpm_state, tpm_state->tpm_permanent_flags.disableFullDALogicInfo = FALSE; #endif /* f. allowMaintenance */ -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) tpm_state->tpm_permanent_flags.allowMaintenance = FALSE; #else tpm_state->tpm_permanent_flags.allowMaintenance = TRUE; diff --git a/src/tpm12/tpm_process.c b/src/tpm12/tpm_process.c index f144a1b6..d6a3b8e5 100644 --- a/src/tpm12/tpm_process.c +++ b/src/tpm12/tpm_process.c @@ -633,7 +633,7 @@ static TPM_ORDINAL_TABLE tpm_ordinal_table[] = FALSE}, {TPM_ORD_CreateMaintenanceArchive, -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) TPM_Process_Unused, TPM_Process_Unused, FALSE, FALSE, @@ -1172,7 +1172,7 @@ static TPM_ORDINAL_TABLE tpm_ordinal_table[] = FALSE}, {TPM_ORD_KillMaintenanceFeature, -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) TPM_Process_Unused, TPM_Process_Unused, FALSE, FALSE, @@ -1256,7 +1256,7 @@ static TPM_ORDINAL_TABLE tpm_ordinal_table[] = FALSE}, {TPM_ORD_LoadMaintenanceArchive, -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) TPM_Process_Unused, TPM_Process_Unused, FALSE, FALSE, @@ -1275,7 +1275,7 @@ static TPM_ORDINAL_TABLE tpm_ordinal_table[] = FALSE}, {TPM_ORD_LoadManuMaintPub, -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) TPM_Process_Unused, TPM_Process_Unused, FALSE, FALSE, @@ -1567,7 +1567,7 @@ static TPM_ORDINAL_TABLE tpm_ordinal_table[] = FALSE}, {TPM_ORD_ReadManuMaintPub, -#ifdef TPM_NOMAINTENANCE +#if defined(TPM_NOMAINTENANCE) || defined(TPM_NOMAINTENANCE_COMMANDS) TPM_Process_Unused, TPM_Process_Unused, FALSE, FALSE,