From 94c7b6642c24ff79a3a51ae026142113355d632e Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Thu, 2 May 2024 16:00:10 +0200 Subject: [PATCH] IWYU: Convert SYS tests Signed-off-by: Andreas Fuchs --- test/helper/tpm_cmd_tcti_dummy.c | 28 ++++++------ test/integration/main-sys.c | 14 +++--- test/integration/sys-abi-version.int.c | 14 +++--- .../sys-asymmetric-encrypt-decrypt.int.c | 19 ++++---- .../sys-create-keyedhash-sha1-hmac.int.c | 13 +++--- test/integration/sys-create-loaded.int.c | 16 ++++--- test/integration/sys-encrypt-decrypt-2.int.c | 17 +++++--- test/integration/sys-encrypt-decrypt.int.c | 17 +++++--- test/integration/sys-entity-util.c | 10 +++-- test/integration/sys-evict-ctrl.int.c | 12 ++++-- test/integration/sys-get-random.int.c | 13 +++--- .../sys-hierarchy-change-auth.int.c | 12 +++--- test/integration/sys-hmac-auth.int.c | 17 ++++---- test/integration/sys-hmac.int.c | 22 ++++------ test/integration/sys-mac.int.c | 22 ++++------ test/integration/sys-nv-policy-locality.int.c | 19 ++++---- test/integration/sys-nv-readwrite.int.c | 15 +++---- .../sys-param-encrypt-decrypt.int.c | 23 +++++----- test/integration/sys-pcr-extension.int.c | 16 ++++--- test/integration/sys-policy-authorizeNV.int.c | 25 +++++------ test/integration/sys-policy-template.int.c | 20 +++++---- .../sys-primary-rsa-2K-aes128cfb.int.c | 11 +++-- test/integration/sys-read-clock.int.c | 14 +++--- test/integration/sys-self-test.int.c | 10 ++--- test/integration/sys-session-util.c | 23 +++++++--- test/integration/sys-start-auth-session.int.c | 14 +++--- test/integration/sys-stir-random.int.c | 13 +++--- test/integration/sys-sys-initialize.int.c | 12 +++--- test/integration/sys-system-api.int.c | 16 ++++--- test/integration/sys-tpm-properties.int.c | 11 ++--- test/integration/sys-util.c | 24 ++++++----- test/integration/sys-util.h | 9 ++-- test/integration/test-common.c | 25 ++++++----- test/integration/test-common.h | 4 +- test/tpmclient/tpmclient.int.c | 43 ++++++++++--------- 35 files changed, 316 insertions(+), 277 deletions(-) diff --git a/test/helper/tpm_cmd_tcti_dummy.c b/test/helper/tpm_cmd_tcti_dummy.c index c0b2b242d..b332f4b40 100644 --- a/test/helper/tpm_cmd_tcti_dummy.c +++ b/test/helper/tpm_cmd_tcti_dummy.c @@ -4,24 +4,20 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "tss2_sys.h" -#include "tss2_mu.h" - -#include "tcti-common.h" -#include "tcti-cmd-test.h" +#include // for errno, EINTR +#include // for uint8_t, PRIu32 +#include // for true, bool, false +#include // for ferror, fread, setvbuf, stdin, size_t +#include // for exit, EXIT_FAILURE, EXIT_SUCCESS +#include // for strcmp, strerror, memcmp +#include // for getpid + +#include "tcti-cmd-test.h" // for getcap_command, getcap_good_resp +#include "tcti-common.h" // for tpm_header_t, TPM_HEADER_SIZE, header_unm... +#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS #define LOGMODULE test -#include "util/log.h" +#include "util/log.h" // for LOG_ERROR, LOG_DEBUG, LOGBLOB_DEBUG /* * A malformed header response. The header reports smaller than the actual diff --git a/test/integration/main-sys.c b/test/integration/main-sys.c index b462d1ac7..4faa248db 100644 --- a/test/integration/main-sys.c +++ b/test/integration/main-sys.c @@ -8,16 +8,12 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include - #define LOGMODULE test -#include "tss2_tctildr.h" -#include "tss2_sys.h" -#include "util/log.h" -#include "test.h" - -#include "test-common.h" +#include "test-common.h" // for test_sys_checks_post, test_sys_checks_pre +#include "test.h" // for test_invoke +#include "tss2_common.h" // for TSS2_RC +#include "util/aux_util.h" // for UNUSED +#include "util/log.h" // for LOG_ERROR /** * This program is a template for integration tests (ones that use the TCTI diff --git a/test/integration/sys-abi-version.int.c b/test/integration/sys-abi-version.int.c index 1cf86b17d..aee82c45d 100644 --- a/test/integration/sys-abi-version.int.c +++ b/test/integration/sys-abi-version.int.c @@ -8,15 +8,17 @@ #include "config.h" // IWYU pragma: keep #endif -#include +#include // for NULL +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_ABI_VERSION, TSS2_SYS_RC_ABI_MISMATCH +#include "tss2_sys.h" // for Tss2_Sys_Initialize, Tss2_Sys_GetContextSize +#include "tss2_tcti.h" // for TSS2_TCTI_CONTEXT -#include #define LOGMODULE test -#include "util/log.h" -#include "test-common.h" -#include "test.h" +#include "test-common.h" // for TEST_ABI_VERSION, TSSWG_INTEROP, TSS_SYS_FI... +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /** */ diff --git a/test/integration/sys-asymmetric-encrypt-decrypt.int.c b/test/integration/sys-asymmetric-encrypt-decrypt.int.c index df62338cd..53a28133b 100644 --- a/test/integration/sys-asymmetric-encrypt-decrypt.int.c +++ b/test/integration/sys-asymmetric-encrypt-decrypt.int.c @@ -8,18 +8,19 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include +#include // for PRIx32 +#include // for exit +#include // for memcpy, strlen -#include "tss2_tcti.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, UINT32, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_FlushContext, Tss2_Sys_Create +#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPMT_PUBLIC, TPM2B_PUBLIC... #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for TSS2_RETRY_EXP +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO + /** * This program contains integration test for asymmetric encrypt and * decrypt use case that has SYSs Tss2_Sys_CreatePrimary, diff --git a/test/integration/sys-create-keyedhash-sha1-hmac.int.c b/test/integration/sys-create-keyedhash-sha1-hmac.int.c index c1673f17f..ff16cd302 100644 --- a/test/integration/sys-create-keyedhash-sha1-hmac.int.c +++ b/test/integration/sys-create-keyedhash-sha1-hmac.int.c @@ -8,15 +8,16 @@ #include "config.h" // IWYU pragma: keep #endif -#include +#include // for PRIx32 -#include "tss2_tpm2_types.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_Create, Tss2_Sys_FlushContext +#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPMT_PUBLIC, TPM2_ALG_SHA1 -#include "inttypes.h" #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test.h" +#include "sys-util.h" // for create_primary_rsa_2048_aes_128_cfb +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-create-loaded.int.c b/test/integration/sys-create-loaded.int.c index f40b51c63..b92b984c0 100644 --- a/test/integration/sys-create-loaded.int.c +++ b/test/integration/sys-create-loaded.int.c @@ -8,16 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for PRIx32, uint8_t +#include // for exit, NULL, size_t +#include // for memset, memcpy -#include "tss2_mu.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS, TSS2_BASE_RC_... +#include "tss2_mu.h" // for Tss2_MU_TPMT_PUBLIC_Marshal +#include "tss2_sys.h" // for Tss2_Sys_CreateLoaded, Tss2_Sys_FlushCo... +#include "tss2_tpm2_types.h" // for TPMT_PUBLIC, TPM2B_NAME, TPMS_RSA_PARMS #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" +#include "sys-util.h" // for TPM2B_NAME_INIT +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOGBLOB_INFO TSS2_RC test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-encrypt-decrypt-2.int.c b/test/integration/sys-encrypt-decrypt-2.int.c index 0c9732aef..7945edb73 100644 --- a/test/integration/sys-encrypt-decrypt-2.int.c +++ b/test/integration/sys-encrypt-decrypt-2.int.c @@ -8,15 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for PRIx32 +#include // for exit +#include // for strcmp, strcpy, strlen #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test-esys.h" -#include "test.h" +#include "sys-util.h" // for create_aes_128_cfb, create_primary_rsa_... +#include "test-esys.h" // for EXIT_SKIP +#include "test.h" // for test_invoke +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_FlushContext, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_MAX_BUFFER, TPM2_HANDLE, TPM2_RC_... +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOG_WARNING #define ENC_STR "test-data-test-data-test-data" diff --git a/test/integration/sys-encrypt-decrypt.int.c b/test/integration/sys-encrypt-decrypt.int.c index 1eaa8a0ed..b3933bc3a 100644 --- a/test/integration/sys-encrypt-decrypt.int.c +++ b/test/integration/sys-encrypt-decrypt.int.c @@ -8,15 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for PRIx32 +#include // for exit +#include // for strcmp, strcpy, strlen #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test-esys.h" -#include "test.h" +#include "sys-util.h" // for create_aes_128_cfb, create_primary_rsa_... +#include "test-esys.h" // for EXIT_SKIP +#include "test.h" // for test_invoke +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_FlushContext, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_MAX_BUFFER, TPM2_HANDLE, TPM2_RC_... +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOG_WARNING #define ENC_STR "test-data-test-data-test-data" diff --git a/test/integration/sys-entity-util.c b/test/integration/sys-entity-util.c index 2c74dae67..4d6cfcd38 100644 --- a/test/integration/sys-entity-util.c +++ b/test/integration/sys-entity-util.c @@ -8,9 +8,13 @@ #include "config.h" // IWYU pragma: keep #endif -#include "tss2_tpm2_types.h" -#include "sys-util.h" -#include "session-util.h" +#include // for calloc, free, NULL +#include // for UT_hash_handle, HASH_FIND_INT, HASH_ADD... + +#include "session-util.h" // for ENTITY, AddEntity, DeleteEntity, GetEntity +#include "sys-util.h" // for CopySizedByteBuffer +#include "tss2_tpm2_types.h" // for TPM2_HANDLE, TPM2B_AUTH +#include "util/tpm2b.h" // for TPM2B static ENTITY *entities = NULL; diff --git a/test/integration/sys-evict-ctrl.int.c b/test/integration/sys-evict-ctrl.int.c index 7b28e83db..e392e5256 100644 --- a/test/integration/sys-evict-ctrl.int.c +++ b/test/integration/sys-evict-ctrl.int.c @@ -9,11 +9,15 @@ #include "config.h" // IWYU pragma: keep #endif -#include "inttypes.h" #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test.h" +#include // for PRIx32 + +#include "sys-util.h" // for create_primary_rsa_2048_aes_128_cfb +#include "test.h" // for test_invoke +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_EvictControl, Tss2_Sys_FlushCo... +#include "tss2_tpm2_types.h" // for TPM2_RH_OWNER, TPM2_HANDLE, TPM2_RC_SUC... +#include "util/log.h" // for LOG_INFO, LOG_ERROR int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-get-random.int.c b/test/integration/sys-get-random.int.c index 056d2b9be..f33ae3f0a 100644 --- a/test/integration/sys-get-random.int.c +++ b/test/integration/sys-get-random.int.c @@ -8,15 +8,16 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for exit +#include // for memcmp -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_GetRandom, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_DIGEST #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /** * This program contains integration test for SYS Tss2_Sys_GetRandom. diff --git a/test/integration/sys-hierarchy-change-auth.int.c b/test/integration/sys-hierarchy-change-auth.int.c index 2de01bd4f..38b37df97 100644 --- a/test/integration/sys-hierarchy-change-auth.int.c +++ b/test/integration/sys-hierarchy-change-auth.int.c @@ -8,15 +8,15 @@ #include "config.h" // IWYU pragma: keep #endif -#include +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for BYTE, UINT32 +#include "tss2_sys.h" // for Tss2_Sys_HierarchyChangeAuth, TSS2L_SYS... +#include "tss2_tpm2_types.h" // for TPM2B_AUTH, TPMS_AUTH_COMMAND, TPM2_RC_... -#include "inttypes.h" #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /* * Test auth value changes for Owner Auth diff --git a/test/integration/sys-hmac-auth.int.c b/test/integration/sys-hmac-auth.int.c index 3fe4bd5e6..37269b680 100644 --- a/test/integration/sys-hmac-auth.int.c +++ b/test/integration/sys-hmac-auth.int.c @@ -7,18 +7,17 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include -#include +#include // for NULL +#include // for memcmp -#include "tss2_sys.h" +#include "session-util.h" // for roll_nonces, SESSION, check_response_hmac +#include "sys-util.h" // for DefineNvIndex, TPM2B_SIZE, TSS2_RETRY_EXP +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, BYTE +#include "tss2_sys.h" // for Tss2_Sys_PolicyAuthValue, TSS2L_SYS_AUT... +#include "tss2_tpm2_types.h" // for TPM2_RH_NULL, TPMS_AUTH_COMMAND, TPM2B_... -#include "sys-util.h" -#include "session-util.h" #define LOGMODULE test -#include "util/log.h" +#include "util/log.h" // for LOG_ERROR, LOG_INFO #define TPM20_INDEX_PASSWORD_TEST 0x01500020 diff --git a/test/integration/sys-hmac.int.c b/test/integration/sys-hmac.int.c index 24283d5e0..1310e016a 100644 --- a/test/integration/sys-hmac.int.c +++ b/test/integration/sys-hmac.int.c @@ -8,22 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include "tss2_tpm2_types.h" -#include "tss2_sys.h" -#include "util/tpm2b.h" +#include // for NULL +#include // for exit +#include // for memcpy -#include -#include -#include -#include - -#include "tss2_tcti.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_BASE_RC_BAD_REFER... +#include "tss2_sys.h" // for Tss2_Sys_CreatePrimary, Tss2_Sys_FlushC... +#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPM2B_DIGEST, TPMT_PUBLIC #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for TSS2_RETRY_EXP +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR int test_sys_hmac(TSS2_SYS_CONTEXT * sys_context) diff --git a/test/integration/sys-mac.int.c b/test/integration/sys-mac.int.c index 87be8d4cb..27e7ed3f7 100644 --- a/test/integration/sys-mac.int.c +++ b/test/integration/sys-mac.int.c @@ -8,22 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include "tss2_tpm2_types.h" -#include "tss2_sys.h" -#include "util/tpm2b.h" +#include // for NULL +#include // for exit +#include // for memcpy -#include -#include -#include -#include - -#include "tss2_tcti.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_BASE_RC_BAD_REFER... +#include "tss2_sys.h" // for Tss2_Sys_CreatePrimary, Tss2_Sys_FlushC... +#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPM2B_DIGEST, TPMT_PUBLIC #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for TSS2_RETRY_EXP +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR int test_sys_mac(TSS2_SYS_CONTEXT * sys_context) diff --git a/test/integration/sys-nv-policy-locality.int.c b/test/integration/sys-nv-policy-locality.int.c index 94a52f391..583aa94d4 100644 --- a/test/integration/sys-nv-policy-locality.int.c +++ b/test/integration/sys-nv-policy-locality.int.c @@ -7,19 +7,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include -#include -#include +#include // for assert +#include // for uint8_t, PRIu32, PRIu8 +#include // for memcpy -#include "tss2_sys.h" +#include "sys-util.h" // for GetDigestSize, TSS2_RETRY_EXP +#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS, TSS2_TCTI_RC_... +#include "tss2_sys.h" // for TSS2_SYS_CONTEXT, TSS2L_SYS_AUTH_COMMAND +#include "tss2_tcti.h" // for Tss2_Tcti_SetLocality, TSS2_TCTI_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_DIGEST, TPM2B_MAX_NV_BUFFER, TPM2... -#include "sys-util.h" -#include "util/aux_util.h" #define LOGMODULE test -#include "util/log.h" +#include "util/log.h" // for return_if_error, LOG_INFO, goto_if_error #define NV_INDEX 0x01800003 #define NV_SIZE 96 diff --git a/test/integration/sys-nv-readwrite.int.c b/test/integration/sys-nv-readwrite.int.c index 3d6afb624..40455bef9 100644 --- a/test/integration/sys-nv-readwrite.int.c +++ b/test/integration/sys-nv-readwrite.int.c @@ -7,18 +7,15 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include +#include // for memcmp -#include "tss2_sys.h" +#include "sys-util.h" // for GetDigestSize, TSS2_RETRY_EXP +#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS +#include "tss2_sys.h" // for TSS2_SYS_CONTEXT, TSS2L_SYS_AUTH_RESPONSE +#include "tss2_tpm2_types.h" // for TPM2B_MAX_NV_BUFFER, TPM2B_DIGEST, TPM2... -#include "sys-util.h" -#include "session-util.h" -#include "util/aux_util.h" #define LOGMODULE test -#include "util/log.h" +#include "util/log.h" // for return_if_error, LOG_ERROR, LOGBLOB_DEBUG #define NV_PS_INDEX_SIZE 34 #define INDEX_LCP_OWN 0x01400001 diff --git a/test/integration/sys-param-encrypt-decrypt.int.c b/test/integration/sys-param-encrypt-decrypt.int.c index 9767c0b7b..d0c31ac1a 100644 --- a/test/integration/sys-param-encrypt-decrypt.int.c +++ b/test/integration/sys-param-encrypt-decrypt.int.c @@ -8,17 +8,20 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include - -#include "tss2_sys.h" -#include "sys-util.h" -#include "session-util.h" +#include // for PRIx32, uint8_t +#include // for size_t +#include // for memcpy, memcmp + +#include "session-util.h" // for roll_nonces, end_auth_session, SESSION +#include "sys-util.h" // for CopySizedByteBuffer +#include "tss2_common.h" // for TSS2_RC, UINT32 +#include "tss2_sys.h" // for TSS2L_SYS_AUTH_COMMAND, Tss2_Sys_Execute +#include "tss2_tpm2_types.h" // for TPMS_AUTH_COMMAND, TPM2B_MAX_NV_BUFFER +#include "util/tpm2b.h" // for TPM2B + #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOGBLOB_ERROR, LOG... #define TEST_DATA "test data to encrypt" #define TEST_DATA_LEN 21 diff --git a/test/integration/sys-pcr-extension.int.c b/test/integration/sys-pcr-extension.int.c index 910803996..db447b55d 100644 --- a/test/integration/sys-pcr-extension.int.c +++ b/test/integration/sys-pcr-extension.int.c @@ -8,16 +8,18 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for exit +#include // for memcpy, memcmp -#include "tss2_sys.h" +#include "tss2_common.h" // for BYTE, UINT8, TSS2_RC_SUCCESS, UINT16 +#include "tss2_sys.h" // for Tss2_Sys_PCR_Read, Tss2_Sys_GetCapability +#include "tss2_tpm2_types.h" // for TPMS_PCR_SELECTION, TPML_PCR_SELECTION #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for GetDigestSize +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO + #define PCR_8 8 #define EXIT_SKIP 77 /** diff --git a/test/integration/sys-policy-authorizeNV.int.c b/test/integration/sys-policy-authorizeNV.int.c index 98457fdb2..1c19cec0e 100644 --- a/test/integration/sys-policy-authorizeNV.int.c +++ b/test/integration/sys-policy-authorizeNV.int.c @@ -8,21 +8,22 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include +#include // for PRIx32, uint8_t +#include // for RAND_bytes +#include // for NULL, size_t +#include // for exit +#include // for memcpy, memset -#include - -#include "tss2_mu.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_mu.h" // for Tss2_MU_INT16_Marshal, Tss2_MU_TPMT_PUB... +#include "tss2_sys.h" // for TSS2L_SYS_AUTH_COMMAND, Tss2_Sys_FlushC... +#include "tss2_tpm2_types.h" // for TPMS_AUTH_COMMAND, TPMT_PUBLIC, TPM2B_N... #define LOGMODULE test -#include "util/log.h" -#include "test-esys.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for TSS2_RETRY_EXP, TPM2B_IV_INIT, TPM2B_MA... +#include "test-esys.h" // for EXIT_SKIP +#include "test.h" // for NO, test_invoke +#include "util/log.h" // for LOG_INFO, LOG_ERROR, LOGBLOB_DEBUG, LOG... int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-policy-template.int.c b/test/integration/sys-policy-template.int.c index 9f8ff2e0a..a3cc7d395 100644 --- a/test/integration/sys-policy-template.int.c +++ b/test/integration/sys-policy-template.int.c @@ -8,18 +8,20 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include +#include // for PRIx32, uint8_t +#include // for NULL, size_t +#include // for exit +#include // for memcpy, memset -#include "tss2_mu.h" -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_mu.h" // for Tss2_MU_TPM2B_PUBLIC_Marshal +#include "tss2_sys.h" // for TSS2L_SYS_AUTH_COMMAND, Tss2_Sys_Create... +#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPMS_AUTH_COMMAND, TPMT_P... #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for hash, TPM2B_DIGEST_INIT, TPM2B_NAME_INIT +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOGBLOB_DEBUG int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-primary-rsa-2K-aes128cfb.int.c b/test/integration/sys-primary-rsa-2K-aes128cfb.int.c index 4164152ea..2197ce60b 100644 --- a/test/integration/sys-primary-rsa-2K-aes128cfb.int.c +++ b/test/integration/sys-primary-rsa-2K-aes128cfb.int.c @@ -8,12 +8,15 @@ #include "config.h" // IWYU pragma: keep #endif -#include +#include // for PRIx32 #define LOGMODULE test -#include "util/log.h" -#include "sys-util.h" -#include "test.h" +#include "sys-util.h" // for create_primary_rsa_2048_aes_128_cfb +#include "test.h" // for test_invoke +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_FlushContext, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2_HANDLE +#include "util/log.h" // for LOG_ERROR int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-read-clock.int.c b/test/integration/sys-read-clock.int.c index 4acd34dc2..8b693eb8b 100644 --- a/test/integration/sys-read-clock.int.c +++ b/test/integration/sys-read-clock.int.c @@ -8,15 +8,17 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for PRIx32 +#include // for NULL +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, TSS2_RESMGR_R... +#include "tss2_sys.h" // for TSS2L_SYS_AUTH_COMMAND, Tss2_Sys_Execute +#include "tss2_tpm2_types.h" // for TPMS_AUTH_COMMAND, TPM2_RC_AUTH_CONTEXT #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO, LOG_WARNING #define EXIT_SKIP 77 /* diff --git a/test/integration/sys-self-test.int.c b/test/integration/sys-self-test.int.c index 6bcacfdc4..6c07668ea 100644 --- a/test/integration/sys-self-test.int.c +++ b/test/integration/sys-self-test.int.c @@ -8,14 +8,14 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_SelfTest, TSS2_SYS_CONTEXT #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for YES, NO, test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /* * This program contains integration test for SYS Tss2_Sys_SelfTest diff --git a/test/integration/sys-session-util.c b/test/integration/sys-session-util.c index 455b3dc40..8be48e023 100644 --- a/test/integration/sys-session-util.c +++ b/test/integration/sys-session-util.c @@ -8,15 +8,24 @@ #include "config.h" // IWYU pragma: keep #endif -#include +#include // for PRIu16, uint8_t +#include // for bool, false, true +#include // for free, calloc +#include // for memcpy, NULL, memset, strlen, size_t +#include // for UT_hash_handle, HASH_DEL, HASH_FIND_INT + +#include "session-util.h" // for SESSION, GetEntity, ENTITY, KDFa, chec... +#include "sys-util.h" // for ConcatSizedByteBuffer, CopySizedByteBu... +#include "test-common.h" // for TEST_ABI_VERSION +#include "tss2_common.h" // for TSS2_RC, BYTE, TSS2_RC_SUCCESS, TSS2_S... +#include "tss2_sys.h" // for TSS2_SYS_CONTEXT, TSS2L_SYS_AUTH_COMMAND +#include "tss2_tcti.h" // for TSS2_TCTI_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_MAX_BUFFER, TPM2B_DIGEST, TPM2_R... +#include "util/tpm2b.h" // for TPM2B +#include "util/tss2_endian.h" // for BE_TO_HOST_32 -#include "tss2_tcti.h" -#include "test-common.h" -#include "session-util.h" -#include "sys-util.h" -#include "util/tss2_endian.h" #define LOGMODULE test -#include "util/log.h" +#include "util/log.h" // for LOGBLOB_DEBUG, LOG_ERROR, LOGBLOB_ERROR static SESSION *sessions = NULL; diff --git a/test/integration/sys-start-auth-session.int.c b/test/integration/sys-start-auth-session.int.c index 8e276bc9a..07dc82855 100644 --- a/test/integration/sys-start-auth-session.int.c +++ b/test/integration/sys-start-auth-session.int.c @@ -8,15 +8,17 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for PRIx32 +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_FlushContext, Tss2_Sys_StartAu... +#include "tss2_tpm2_types.h" // for TPM2B_NONCE, TPM2_RH_NULL, TPM2_SHA256_... #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_INFO, LOG_ERROR + /* * This is an incredibly simple test to create the most simple session * (which ends up being a trial policy) and then just tear it down. diff --git a/test/integration/sys-stir-random.int.c b/test/integration/sys-stir-random.int.c index 2b3bb4bf2..ad15c0909 100644 --- a/test/integration/sys-stir-random.int.c +++ b/test/integration/sys-stir-random.int.c @@ -8,15 +8,16 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include +#include // for NULL +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, TSS2_SYS_RC_B... +#include "tss2_sys.h" // for Tss2_Sys_StirRandom, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_SENSITIVE_DATA #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /** * This program contains integration test for SYS Tss2_Sys_StirRandom. diff --git a/test/integration/sys-sys-initialize.int.c b/test/integration/sys-sys-initialize.int.c index eab9f0a0b..b13de8dbe 100644 --- a/test/integration/sys-sys-initialize.int.c +++ b/test/integration/sys-sys-initialize.int.c @@ -8,14 +8,16 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_ABI_VERSION, TSS2_SYS_RC_BAD_REFERENCE +#include "tss2_sys.h" // for Tss2_Sys_Initialize, TSS2_SYS_CONTEXT, Tss2... +#include "tss2_tcti.h" // for TSS2_TCTI_CONTEXT, TSS2_TCTI_RECEIVE, TSS2_... #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO + /** */ int diff --git a/test/integration/sys-system-api.int.c b/test/integration/sys-system-api.int.c index ed7363055..247bb2e13 100644 --- a/test/integration/sys-system-api.int.c +++ b/test/integration/sys-system-api.int.c @@ -8,15 +8,19 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include +#include // for uint8_t +#include // for NULL, size_t +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_SYS_RC_BAD_SEQUENCE +#include "tss2_sys.h" // for Tss2_Sys_ExecuteAsync, Tss2_Sys_GetTest... +#include "tss2_tcti.h" // for TSS2_TCTI_TIMEOUT_BLOCK +#include "tss2_tpm2_types.h" // for TPM2B_MAX_BUFFER, TPM2B_NAME, TPM2B_PUBLIC #define LOGMODULE test -#include "util/log.h" -#include "test.h" -#include "sys-util.h" +#include "sys-util.h" // for TPM2B_NAMED_INIT, TPM2B_NAME_INIT +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_ERROR, LOG_INFO /* * System API tests including invalid cases diff --git a/test/integration/sys-tpm-properties.int.c b/test/integration/sys-tpm-properties.int.c index fc44ac639..c12bee140 100644 --- a/test/integration/sys-tpm-properties.int.c +++ b/test/integration/sys-tpm-properties.int.c @@ -8,14 +8,15 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include +#include // for exit -#include "tss2_sys.h" +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC +#include "tss2_sys.h" // for Tss2_Sys_GetCapability, TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPMS_TAGGED_PROPERTY, TPMS_CAPABILITY_DATA #define LOGMODULE test -#include "util/log.h" -#include "test.h" +#include "test.h" // for test_invoke +#include "util/log.h" // for LOG_INFO, LOG_ERROR int test_invoke (TSS2_SYS_CONTEXT *sys_context) diff --git a/test/integration/sys-util.c b/test/integration/sys-util.c index d386e43a4..7d4084c04 100644 --- a/test/integration/sys-util.c +++ b/test/integration/sys-util.c @@ -5,26 +5,28 @@ * All rights reserved. ***********************************************************************/ #ifdef HAVE_CONFIG_H -#include "config.h" // IWYU pragma: keep +#include "config.h" // for HAVE_EVP_SM3 #endif -#include -#include -#include -#include - -#include -#include +#include // for assert +#include // for uint8_t, uint32_t +#include // for EVP_MD_CTX_free, EVP_sm3, EVP_CIPHER... +#include // for OPENSSL_VERSION_NUMBER +#include // for SHA1, SHA256, SHA384, SHA512 +#include // for NULL, calloc, exit, free, size_t +#include // for memcpy, memcmp, memmove #if OPENSSL_VERSION_NUMBER < 0x30000000L #include #else -#include +#include // for OSSL_ALG_PARAM_DIGEST +#include // for EVP_MD, OSSL_PARAM, EVP_CIPHER, EVP_... #endif #define LOGMODULE testintegration -#include "util/log.h" #include "sys-util.h" -#include "test.h" +#include "test.h" // for NO, YES +#include "util/log.h" // for LOG_INFO, LOG_ERROR + /* * Use te provide SYS context to create & load a primary key. The key will * be a 2048 bit (restricted decryption) RSA key. The associated symmetric diff --git a/test/integration/sys-util.h b/test/integration/sys-util.h index dd38e386a..7fae2d3b2 100644 --- a/test/integration/sys-util.h +++ b/test/integration/sys-util.h @@ -7,9 +7,12 @@ #ifndef TEST_INTEGRATION_SYS_UTIL_H #define TEST_INTEGRATION_SYS_UTIL_H -#include "tss2_tpm2_types.h" -#include "tss2_sys.h" -#include "util/tpm2b.h" +#include // for NULL + +#include "tss2_common.h" // for TSS2_RC, UINT16 +#include "tss2_sys.h" // for TSS2_SYS_CONTEXT +#include "tss2_tpm2_types.h" // for TPM2B_MAX_BUFFER, TPM2B_DIGEST, TPM2B_NAME +#include "util/tpm2b.h" // for TPM2B /* * This macro is like the GNU TEMP_FAILURE_RETRY macro for the diff --git a/test/integration/test-common.c b/test/integration/test-common.c index 957ea90b6..bc459569a 100644 --- a/test/integration/test-common.c +++ b/test/integration/test-common.c @@ -8,23 +8,22 @@ #include "config.h" // IWYU pragma: keep #endif -#include -#include -#include -#include -#include - - -#include "tss2_tpm2_types.h" -#include "tss2_tctildr.h" -#include "tss2_mu.h" +#include // for PRIx32, uint8_t, int32_t, uint32_t, uin... +#include // for bool +#include // for NULL, size_t +#include // for free, malloc, EXIT_SUCCESS, getenv +#include // for memset, memcmp, memcpy + +#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, UINT32, TSS2_... +#include "tss2_mu.h" // for Tss2_MU_TPMS_CAPABILITY_DATA_Marshal +#include "tss2_tctildr.h" // for Tss2_TctiLdr_Finalize, Tss2_TctiLdr_Ini... +#include "tss2_tpm2_types.h" // for TPMS_CAPABILITY_DATA, TPM2_CAP_HANDLES #ifdef TEST_ESYS -#include "tss2_esys.h" +#include "tss2_esys.h" // for Esys_Finalize, Esys_GetSysContext, Esys... #endif #define LOGMODULE test -#include "util/log.h" - #include "test-common.h" +#include "util/log.h" // for LOG_ERROR, LOG_DEBUG, LOGBLOB_ERROR #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) diff --git a/test/integration/test-common.h b/test/integration/test-common.h index 8c16b897f..47fe62003 100644 --- a/test/integration/test-common.h +++ b/test/integration/test-common.h @@ -7,10 +7,10 @@ #ifndef TEST_COMMON_H #define TEST_COMMON_H -#include "tss2_tcti.h" -#include "tss2_sys.h" #include "tss2_esys.h" #include "tss2_fapi.h" +#include "tss2_sys.h" +#include "tss2_tcti.h" #define ENV_TCTI "TPM20TEST_TCTI" diff --git a/test/tpmclient/tpmclient.int.c b/test/tpmclient/tpmclient.int.c index 556a18939..42229d399 100644 --- a/test/tpmclient/tpmclient.int.c +++ b/test/tpmclient/tpmclient.int.c @@ -6,34 +6,37 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" // IWYU pragma: keep +#include "config.h" // for TCTI_MSSIM, TCTI_SWTPM #endif -#include -#include -#include -#include -#include - -#include "tss2_sys.h" -#include "tss2-tcti/tctildr.h" -#include "tss2-tcti/tcti-pcap.h" -#include "tss2_tcti_device.h" -#include "tss2_tcti_libtpms.h" +#include // for uint8_t, uint64_t, PRIx32 +#include // for bool, false, true +#include // for size_t, NULL, fprintf, printf +#include // for free, calloc, exit +#include // for memcpy, strcpy, memcmp, strlen + +#include "tss2-tcti/tcti-pcap.h" // for TCTI_PCAP_MAGIC, TSS2_TCTI_... +#include "tss2-tcti/tctildr.h" // for TCTILDR_MAGIC, TSS2_TCTILDR... +#include "tss2_common.h" // for BYTE, UINT32, TSS2_RC, UINT8 +#include "tss2_sys.h" // for TSS2L_SYS_AUTH_COMMAND, Tss... +#include "tss2_tcti.h" // for TSS2_TCTI_CONTEXT, Tss2_Tct... +#include "tss2_tpm2_types.h" // for TPM2_RC_SUCCESS, TPMS_PCR_S... +#include "util/tpm2b.h" // for TPM2B #ifdef TCTI_MSSIM -#include "tss2_tcti_mssim.h" +#include "tss2_tcti_mssim.h" // for tcti_platform_command, MS_S... #endif /* TCTI_MSSIM */ #ifdef TCTI_SWTPM -#include "tss2_tcti_swtpm.h" +#include "tss2_tcti_swtpm.h" // for Tss2_Tcti_Swtpm_Reset #endif /* TCTI_SWTPM */ -#include "../integration/test-common.h" -#include "../integration/sys-util.h" -#include "../integration/session-util.h" -#include "util/tss2_endian.h" -#include "sysapi_util.h" +#include "../integration/session-util.h" // for SESSION, create_auth_session +#include "../integration/sys-util.h" // for CopySizedByteBuffer, Define... +#include "../integration/test-common.h" // for TEST_ABI_VERSION +#include "sysapi_util.h" // for _TSS2_SYS_CONTEXT_BLOB, res... +#include "util/tss2_endian.h" // for BE_TO_HOST_32 + #define LOGMODULE testtpmclient -#include "util/log.h" +#include "util/log.h" // for LOG_INFO, LOG_ERROR, LOGBLO... /* * TPM indices and sizes