From 133c0ca0444bdac09a5d2d9c8013f73ace2daa4d Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Wed, 24 Mar 2021 12:14:52 +0100 Subject: [PATCH] Enable lower maxlog levels This patch fixed the setting of maxloglevel during configure wrt unused variables throughout the stack. Signed-off-by: Andreas Fuchs --- src/tss2-fapi/fapi_crypto.c | 6 ++---- src/tss2-fapi/ifapi_policy_calculate.c | 3 +++ src/tss2-tcti/tcti-swtpm.c | 3 +-- test/integration/esys-create-primary-hmac.int.c | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/tss2-fapi/fapi_crypto.c b/src/tss2-fapi/fapi_crypto.c index 07d8efa7c..e2bc9fce7 100644 --- a/src/tss2-fapi/fapi_crypto.c +++ b/src/tss2-fapi/fapi_crypto.c @@ -2019,8 +2019,7 @@ ifapi_verify_ek_cert( "Failed to initialize X509 context.", cleanup); } if (1 != X509_verify_cert(ctx)) { - int rc = X509_STORE_CTX_get_error(ctx); - LOG_ERROR("%s", X509_verify_cert_error_string(rc)); + LOG_ERROR("%s", X509_verify_cert_error_string(X509_STORE_CTX_get_error(ctx))); goto_error(r, TSS2_FAPI_RC_GENERAL_FAILURE, "Failed to verify intermediate certificate", cleanup); } @@ -2042,8 +2041,7 @@ ifapi_verify_ek_cert( } /* Verify the EK certificate. */ if (1 != X509_verify_cert(ctx)) { - int rc = X509_STORE_CTX_get_error(ctx); - LOG_ERROR("%s", X509_verify_cert_error_string(rc)); + LOG_ERROR("%s", X509_verify_cert_error_string(X509_STORE_CTX_get_error(ctx))); goto_error(r, TSS2_FAPI_RC_GENERAL_FAILURE, "Failed to verify EK certificate", cleanup); } diff --git a/src/tss2-fapi/ifapi_policy_calculate.c b/src/tss2-fapi/ifapi_policy_calculate.c index 090d93873..c991c6f17 100644 --- a/src/tss2-fapi/ifapi_policy_calculate.c +++ b/src/tss2-fapi/ifapi_policy_calculate.c @@ -38,6 +38,7 @@ static void copy_policy_digest(TPML_DIGEST_VALUES *dest, TPML_DIGEST_VALUES *src, size_t digest_idx, size_t hash_size, char *txt) { + (void)(txt); /* If max log-leve < debug, this param is unused */ memcpy(&dest->digests[digest_idx].digest, &src->digests[digest_idx].digest, hash_size); dest->digests[digest_idx].hashAlg = src->digests[digest_idx].hashAlg; @@ -57,6 +58,8 @@ static void log_policy_digest(TPML_DIGEST_VALUES *dest, size_t digest_idx, size_t hash_size, char *txt) { + (void)(dest);(void)(digest_idx);(void)(hash_size);(void)(txt); + /* If max log-leve < debug, this param is unused */ LOGBLOB_DEBUG((uint8_t *)&dest->digests[digest_idx].digest, hash_size, "Digest %s", txt); } diff --git a/src/tss2-tcti/tcti-swtpm.c b/src/tss2-tcti/tcti-swtpm.c index c851fb2dc..5d2669bcc 100644 --- a/src/tss2-tcti/tcti-swtpm.c +++ b/src/tss2-tcti/tcti-swtpm.c @@ -112,7 +112,6 @@ TSS2_RC tcti_control_command ( uint32_t *resp_code, void *resp_sdu, size_t *resp_sdu_len) { TSS2_TCTI_SWTPM_CONTEXT *tcti_swtpm = tcti_swtpm_context_cast(tctiContext); - UINT32 rsp = 0; TSS2_RC rc = TSS2_RC_SUCCESS; int ret; uint32_t response_code; @@ -220,7 +219,7 @@ TSS2_RC tcti_control_command ( } if (response_code != 0) { - LOG_ERROR ("Control command failed with error: %" PRIu32, rsp); + LOG_ERROR ("Control command failed with error: %" PRIu32, response_code); rc = TSS2_TCTI_RC_IO_ERROR; goto out; } diff --git a/test/integration/esys-create-primary-hmac.int.c b/test/integration/esys-create-primary-hmac.int.c index a462de263..eab9e706a 100644 --- a/test/integration/esys-create-primary-hmac.int.c +++ b/test/integration/esys-create-primary-hmac.int.c @@ -176,7 +176,6 @@ test_esys_create_primary_hmac(ESYS_CONTEXT * esys_context) &outPublic, &creationData, &creationHash, &creationTicket); goto_if_error(r, "Error esys create primary", error); - r = esys_GetResourceObject(esys_context, objectHandle, &objectHandle_node); goto_if_error(r, "Error Esys GetResourceObject", error); @@ -187,7 +186,7 @@ test_esys_create_primary_hmac(ESYS_CONTEXT * esys_context) goto_if_error(r, "Error during FlushContext", error); LOG_INFO("Done with handle 0x%08x...", tpmHandle); - + (void)(tpmHandle); r = Esys_FlushContext(esys_context, session); goto_if_error(r, "Flushing context", error);