Skip to content

Commit

Permalink
IWYU: Convert ESYS tests
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Fuchs <andreas.fuchs@infineon.com>
  • Loading branch information
AndreasFuchsTPM committed May 3, 2024
1 parent 9ccded5 commit 4624f65
Show file tree
Hide file tree
Showing 81 changed files with 533 additions and 466 deletions.
12 changes: 6 additions & 6 deletions test/integration/esys-act-set-timeout.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS, TSS2_RESMGR_R...
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_FlushContext, Esys_A...
#include "tss2_tpm2_types.h" // for TPM2_RC_COMMAND_CODE, TPM2B_NONCE, TPM2...

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR

/** Test of the ESAPI function Esys_ACT_SetTimeout.
*
Expand Down
12 changes: 6 additions & 6 deletions test/integration/esys-audit.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC_SUCCESS, UINT32, TSS2_RC, TSS2_...
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2_ALG_SHA256, TPM2_ALG_NULL, TPM2_RC...

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_WARNING

/** This test is intended to test the ESYS audit commands.
*
Expand Down
12 changes: 7 additions & 5 deletions test/integration/esys-auto-session-flags.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include "tss2_esys.h"
#include "esys_iutil.h"
#include <stdlib.h> // for free, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_ESYS_RC_GENERAL_F...
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_FlushContext, Esys_S...
#include "tss2_tpm2_types.h" // for TPM2B_MAX_NV_BUFFER, TPM2_ALG_SHA256

#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR

/** This test is intended to test auto adjust and restore session flags in ESYS
*
Expand Down
10 changes: 5 additions & 5 deletions test/integration/esys-certify-creation.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2B_AUTH, TPM2B_DATA, TPM2B_PUBLIC

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO

/** This test is intended to test the command Esys_CertifyCreation.
*
Expand Down
10 changes: 5 additions & 5 deletions test/integration/esys-certify.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS
#include "tss2_esys.h" // for Esys_Free, Esys_FlushContext, ESYS_TR_NONE
#include "tss2_tpm2_types.h" // for TPM2B_AUTH, TPM2B_DATA, TPM2B_PUBLIC

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO

/** This test is intended to test the command Esys_Certify.
*
Expand Down
12 changes: 6 additions & 6 deletions test/integration/esys-certifyX509.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS, TSS2_RESMGR_R...
#include "tss2_esys.h" // for Esys_Free, Esys_FlushContext, ESYS_TR_NONE
#include "tss2_tpm2_types.h" // for TPM2_ALG_SHA256, TPM2_RC_COMMAND_CODE

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO

/** This test is intended to test the command Esys_CertifyX509.
*
Expand Down
12 changes: 6 additions & 6 deletions test/integration/esys-change-eps.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC, TSS2_RESMGR_RC_LAYER, TSS2_RES...
#include "tss2_esys.h" // for Esys_ChangeEPS, ESYS_CONTEXT, ESYS_TR_NONE
#include "tss2_tpm2_types.h" // for TPM2_RC_COMMAND_CODE, TPM2_RC_BAD_AUTH

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for LOG_WARNING, goto_if_error, number_rc

/** Test the ESYS function Esys_ChangeEPS.
*
Expand Down
10 changes: 5 additions & 5 deletions test/integration/esys-check-auth-with-trailing-zero.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, UINT16
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_Free, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2_ALG_SHA256, TPM2B_PUBLIC, TPM2B_AUTH

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR

/** This test is intended to test trailing zeros in an auth value
*
Expand Down
12 changes: 6 additions & 6 deletions test/integration/esys-clear-control.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, goto_error_if_not_failed
#include "tss2_common.h" // for TSS2_RC
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_ClearControl, ESYS_T...
#include "tss2_tpm2_types.h" // for TPM2_NO, TPM2_RC_BAD_AUTH, TPM2_RC_HIER...

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, number_rc, LOG_WARNING

/** Test the ESYS function Esys_ClearControl.
*
Expand Down
13 changes: 7 additions & 6 deletions test/integration/esys-clear.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS
#include <string.h> // for memset

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC
#include "tss2_esys.h" // for Esys_Clear, ESYS_CONTEXT, ESYS_TR_NONE
#include "tss2_tpm2_types.h" // for TPM2_RC_BAD_AUTH

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for LOG_WARNING, goto_if_error, number_rc

/** Test of the ESYS function Esys_Clear.
*
Expand Down
12 changes: 6 additions & 6 deletions test/integration/esys-clockset.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for EXIT_FAILURE, EXIT_SUCCESS, NULL

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, TSS2_RESMGR_R...
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_ClockRateAdjust, Esy...
#include "tss2_tpm2_types.h" // for TPM2_RC_AUTH_CONTEXT, TPMS_TIME_INFO

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_WARNING

/** Test the ESYS function Esys_ClockSet and Esys_ReadClock.
*
Expand Down
13 changes: 7 additions & 6 deletions test/integration/esys-commit.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS
#include <string.h> // for memset

#include "tss2_esys.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, UINT16
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2B_ECC_POINT, TPM2B_PUBLIC, TPM2_ALG...

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO, LOG...

/** This test is intended to test Esys_Commit.
* based on an ECC key
Expand Down
15 changes: 9 additions & 6 deletions test/integration/esys-create-fail.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "esys_int.h" // for RSRC_NODE_T
#include "esys_iutil.h" // for esys_GetResourceObject
#include "esys_types.h" // for IESYS_RESOURCE
#include "test-esys.h" // for goto_error_if_not_failed, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC, TSS2_RC_SUCCESS
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_Create
#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPM2B_SENSITIVE_CREATE

#include "test-esys.h"
#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_INFO, LOG_ERROR

/** This test is intended to test password authentication.
*
Expand Down
13 changes: 8 additions & 5 deletions test/integration/esys-create-password-auth.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "esys_int.h" // for RSRC_NODE_T
#include "esys_iutil.h" // for esys_GetResourceObject
#include "esys_types.h" // for IESYS_RESOURCE
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2B_SENSITIVE_CREATE, TPM2B_PUBLIC

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_INFO, LOG_ERROR

/** This test is intended to test password authentication for the ESYS command
* Create.
Expand Down
10 changes: 5 additions & 5 deletions test/integration/esys-create-policy-auth.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_Free, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPM2_ALG_SHA256, TPM2B_SE...

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO

/** This test is intended to test policy authentication for the ESYS command
* Create.
Expand Down
13 changes: 8 additions & 5 deletions test/integration/esys-create-primary-hmac.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "esys_int.h" // for RSRC_NODE_T
#include "esys_iutil.h" // for esys_GetResourceObject
#include "esys_types.h" // for IESYS_RESOURCE
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC
#include "tss2_esys.h" // for Esys_Free, Esys_FlushContext, ESYS_TR_NONE
#include "tss2_tpm2_types.h" // for TPM2B_PUBLIC, TPM2_ALG_NULL, TPM2_ALG_S...

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO, MAY...

/** This test is intended to test Esys_CreatePrimary with hmac verification.
*
Expand Down
13 changes: 8 additions & 5 deletions test/integration/esys-create-session-auth.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdlib.h>
#include <stdlib.h> // for NULL, free, EXIT_FAILURE, EXIT_SUCCESS

#include "tss2_esys.h"
#include "esys_int.h" // for RSRC_NODE_T
#include "esys_iutil.h" // for esys_GetResourceObject
#include "esys_types.h" // for IESYS_RESOURCE
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC
#include "tss2_esys.h" // for Esys_Free, ESYS_TR_NONE, Esys_FlushContext
#include "tss2_tpm2_types.h" // for TPM2B_SENSITIVE_CREATE, TPM2_ALG_SHA256

#include "esys_iutil.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for goto_if_error, LOG_ERROR, LOG_INFO

/** This test is intended to test parameter encryption/decryption, session management,
* hmac computation, and session key generation.
Expand Down
17 changes: 9 additions & 8 deletions test/integration/esys-createloaded.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
#include "config.h" // IWYU pragma: keep
#endif

#include <stdbool.h>
#include <stdlib.h>
#include <stdbool.h> // for bool, false
#include <stdlib.h> // for NULL, EXIT_FAILURE, EXIT_SUCCESS, size_t
#include <string.h> // for memcmp, memset

#include "tss2_esys.h"
#include "tss2_mu.h"
#include "test-esys.h" // for EXIT_SKIP, test_invoke_esys
#include "tss2_common.h" // for TSS2_RC_SUCCESS, TSS2_RC, BYTE, TSS2_RE...
#include "tss2_esys.h" // for ESYS_TR_NONE, Esys_FlushContext, Esys_Free
#include "tss2_mu.h" // for Tss2_MU_TPMT_PUBLIC_Marshal
#include "tss2_tpm2_types.h" // for TPM2B_NAME, TPM2_ALG_SHA256, TPM2B_AUTH

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"
#include "util/log.h" // for SAFE_FREE, goto_if_error, LOG_ERROR

static bool check_name(ESYS_CONTEXT * esys_context, ESYS_TR object_handle)
{
Expand Down
Loading

0 comments on commit 4624f65

Please sign in to comment.