aboutsummaryrefslogtreecommitdiff
path: root/src/tss2-esys/api/Esys_Shutdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tss2-esys/api/Esys_Shutdown.c')
-rw-r--r--src/tss2-esys/api/Esys_Shutdown.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/tss2-esys/api/Esys_Shutdown.c b/src/tss2-esys/api/Esys_Shutdown.c
index b31dd3b0..aea577a1 100644
--- a/src/tss2-esys/api/Esys_Shutdown.c
+++ b/src/tss2-esys/api/Esys_Shutdown.c
@@ -15,14 +15,6 @@
#include "util/log.h"
#include "util/aux_util.h"
-/** Store command parameters inside the ESYS_CONTEXT for use during _Finish */
-static void store_input_parameters (
- ESYS_CONTEXT *esysContext,
- TPM2_SU shutdownType)
-{
- esysContext->in.Shutdown.shutdownType = shutdownType;
-}
-
/** One-Call function for TPM2_Shutdown
*
* This function invokes the TPM2_Shutdown command in a one-call
@@ -155,10 +147,9 @@ Esys_Shutdown_Async(
return r;
esysContext->state = _ESYS_STATE_INTERNALERROR;
- /* Check and store input parameters */
+ /* Check input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 0);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, shutdownType);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Shutdown_Prepare(esysContext->sys, shutdownType);
@@ -233,7 +224,8 @@ Esys_Shutdown_Finish(
}
/* Check for correct sequence and set sequence to irregular for now */
- if (esysContext->state != _ESYS_STATE_SENT) {
+ if (esysContext->state != _ESYS_STATE_SENT &&
+ esysContext->state != _ESYS_STATE_RESUBMISSION) {
LOG_ERROR("Esys called in bad sequence.");
return TSS2_ESYS_RC_BAD_SEQUENCE;
}
@@ -251,16 +243,13 @@ Esys_Shutdown_Finish(
if (r == TPM2_RC_RETRY || r == TPM2_RC_TESTING || r == TPM2_RC_YIELDED) {
LOG_DEBUG("TPM returned RETRY, TESTING or YIELDED, which triggers a "
"resubmission: %" PRIx32, r);
- if (esysContext->submissionCount >= _ESYS_MAX_SUBMISSIONS) {
+ if (esysContext->submissionCount++ >= _ESYS_MAX_SUBMISSIONS) {
LOG_WARNING("Maximum number of (re)submissions has been reached.");
esysContext->state = _ESYS_STATE_INIT;
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Shutdown_Async(esysContext, esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Shutdown.shutdownType);
+ r = Tss2_Sys_ExecuteAsync(esysContext->sys);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent