Skip to content

Commit 4f91ed5

Browse files
FAPI: Fix and improve state error reporting.
Signed-off-by: Andreas Fuchs <andreas.fuchs@infineon.com>
1 parent 6b524e2 commit 4f91ed5

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/tss2-fapi/api/Fapi_GetInfo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ Fapi_GetInfo_Finish(
226226
IFAPI_INFO *infoObj = &command->info_obj;
227227
TPMS_CAPABILITY_DATA *capabilityData = NULL;
228228

229+
LOG_TRACE("Current state is: %i", context->state);
230+
229231
switch (context->state) {
230232
case GET_INFO_GET_CAP:
231233
/* Initialize the property for the first ESAPI call */

src/tss2-fapi/fapi_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,8 @@ ifapi_capability_get(FAPI_CONTEXT *context, TPM2_CAP capability,
42634263
TSS2_RC r = TSS2_RC_SUCCESS;
42644264
ESYS_CONTEXT *ectx = context->esys;
42654265

4266+
LOG_TRACE("Current state is: %i", context->state);
4267+
42664268
switch (context->state) {
42674269
statecase(context->state, GET_INFO_GET_CAP);
42684270
/* fetch capability info */

src/tss2-fapi/ifapi_macros.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@
134134

135135
#define statecasedefault(VAR) \
136136
default: \
137-
LOG_ERROR("Bad state for " str(VAR)); \
137+
LOG_ERROR("Bad state for " str(VAR) ": %i", VAR); \
138138
return TSS2_FAPI_RC_BAD_SEQUENCE;
139139

140140
#define statecasedefault_error(VAR, r, label) \
141141
default: \
142-
LOG_ERROR("Bad state for " str(VAR)); \
142+
LOG_ERROR("Bad state for " str(VAR) ": %i", VAR); \
143143
(r) = TSS2_FAPI_RC_BAD_SEQUENCE; \
144144
goto label;
145145

src/tss2-fapi/ifapi_policy_callbacks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ ifapi_exec_auth_policy(
14651465
cb_ctx->cb_state = POL_CB_EXECUTE_INIT;
14661466
break;
14671467

1468-
statecasedefault_error(cb_ctx->state, r, cleanup);
1468+
statecasedefault_error(cb_ctx->cb_state, r, cleanup);
14691469
}
14701470
cleanup:
14711471
SAFE_FREE(names);
@@ -1637,7 +1637,7 @@ ifapi_exec_auth_nv_policy(
16371637
cb_ctx->cb_state = POL_CB_EXECUTE_INIT;
16381638
break;
16391639

1640-
statecasedefault_error(cb_ctx->state, r, cleanup);
1640+
statecasedefault_error(cb_ctx->cb_state, r, cleanup);
16411641
}
16421642
cleanup:
16431643
cleanup_policy_list(current_policy->policy_list);

0 commit comments

Comments
 (0)