ESYS: Fix coding style
* Coding-style for long parameter lists was consolidated.
* Also several minor fixes related to coding style were made.
* One typo was fixed.
Signed-off-by: Juergen Repp <Juergen.Repp@sit.fraunhofer.de>
diff --git a/src/tss2-esys/api/Esys_ActivateCredential.c b/src/tss2-esys/api/Esys_ActivateCredential.c
index 30efc59..18d40ba 100644
--- a/src/tss2-esys/api/Esys_ActivateCredential.c
+++ b/src/tss2-esys/api/Esys_ActivateCredential.c
@@ -48,16 +48,16 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] activateHandle Handle of the object associated with certificate in
- * credentialBlob.
+ * @param[in] activateHandle Handle of the object associated with certificate
+ * in credentialBlob.
* @param[in] keyHandle Loaded key used to decrypt the TPMS_SENSITIVE in
* credentialBlob.
* @param[in] shandle1 Session handle for authorization of activateHandle
* @param[in] shandle2 Session handle for authorization of keyHandle
* @param[in] shandle3 Third session handle.
* @param[in] credentialBlob The credential.
- * @param[in] secret KeyHandle algorithm-dependent encrypted seed that protects
- * credentialBlob.
+ * @param[in] secret KeyHandle algorithm-dependent encrypted seed that
+ * protects credentialBlob.
* @param[out] certInfo The decrypted certificate information.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
@@ -77,9 +77,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -97,14 +97,9 @@
{
TSS2_RC r;
- r = Esys_ActivateCredential_Async(esysContext,
- activateHandle,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- credentialBlob,
- secret);
+ r = Esys_ActivateCredential_Async(esysContext, activateHandle, keyHandle,
+ shandle1, shandle2, shandle3,
+ credentialBlob, secret);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -118,8 +113,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ActivateCredential_Finish(esysContext,
- certInfo);
+ r = Esys_ActivateCredential_Finish(esysContext, certInfo);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -142,16 +136,16 @@
* In order to retrieve the TPM's response call Esys_ActivateCredential_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] activateHandle Handle of the object associated with certificate in
- * credentialBlob.
+ * @param[in] activateHandle Handle of the object associated with certificate
+ * in credentialBlob.
* @param[in] keyHandle Loaded key used to decrypt the TPMS_SENSITIVE in
* credentialBlob.
* @param[in] shandle1 Session handle for authorization of activateHandle
* @param[in] shandle2 Session handle for authorization of keyHandle
* @param[in] shandle3 Third session handle.
* @param[in] credentialBlob The credential.
- * @param[in] secret KeyHandle algorithm-dependent encrypted seed that protects
- * credentialBlob.
+ * @param[in] secret KeyHandle algorithm-dependent encrypted seed that
+ * protects credentialBlob.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -164,9 +158,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_ActivateCredential_Async(
@@ -201,8 +195,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, activateHandle, keyHandle,
- credentialBlob,
- secret);
+ credentialBlob, secret);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, activateHandle, &activateHandleNode);
@@ -212,10 +205,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ActivateCredential_Prepare(esysContext->sys,
- (activateHandleNode == NULL) ? TPM2_RH_NULL : activateHandleNode->rsrc.handle,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- credentialBlob,
- secret);
+ (activateHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : activateHandleNode->rsrc.handle,
+ (keyHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle,
+ credentialBlob, secret);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -229,14 +225,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, activateHandleNode, keyHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -320,13 +319,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ActivateCredential_Async(esysContext,
- esysContext->in.ActivateCredential.activateHandle,
- esysContext->in.ActivateCredential.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ActivateCredential.credentialBlob,
- esysContext->in.ActivateCredential.secret);
+ esysContext->in.ActivateCredential.activateHandle,
+ esysContext->in.ActivateCredential.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ActivateCredential.credentialBlob,
+ esysContext->in.ActivateCredential.secret);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -354,15 +353,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ActivateCredential_Complete(esysContext->sys,
- (certInfo != NULL) ? *certInfo : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (certInfo != NULL) ? *certInfo
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Certify.c b/src/tss2-esys/api/Esys_Certify.c
index a2bce65..d905fd2 100644
--- a/src/tss2-esys/api/Esys_Certify.c
+++ b/src/tss2-esys/api/Esys_Certify.c
@@ -49,7 +49,8 @@
*
* @param[in,out] esysContext The ESYS_CONTEXT.
* @param[in] objectHandle Handle of the object to be certified.
- * @param[in] signHandle Handle of the key used to sign the attestation structure.
+ * @param[in] signHandle Handle of the key used to sign the attestation
+ * structure.
* @param[in] shandle1 Session handle for authorization of objectHandle
* @param[in] shandle2 Session handle for authorization of signHandle
* @param[in] shandle3 Third session handle.
@@ -58,8 +59,8 @@
* TPM2_ALG_NULL.
* @param[out] certifyInfo The structure that was signed.
* (callee-allocated)
- * @param[out] signature The asymmetric signature over certifyInfo using the key
- * referenced by signHandle.
+ * @param[out] signature The asymmetric signature over certifyInfo using the
+ * key referenced by signHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -78,9 +79,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -99,14 +100,8 @@
{
TSS2_RC r;
- r = Esys_Certify_Async(esysContext,
- objectHandle,
- signHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme);
+ r = Esys_Certify_Async(esysContext, objectHandle, signHandle, shandle1,
+ shandle2, shandle3, qualifyingData, inScheme);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -120,9 +115,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Certify_Finish(esysContext,
- certifyInfo,
- signature);
+ r = Esys_Certify_Finish(esysContext, certifyInfo, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -146,7 +139,8 @@
*
* @param[in,out] esysContext The ESYS_CONTEXT.
* @param[in] objectHandle Handle of the object to be certified.
- * @param[in] signHandle Handle of the key used to sign the attestation structure.
+ * @param[in] signHandle Handle of the key used to sign the attestation
+ * structure.
* @param[in] shandle1 Session handle for authorization of objectHandle
* @param[in] shandle2 Session handle for authorization of signHandle
* @param[in] shandle3 Third session handle.
@@ -165,9 +159,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Certify_Async(
@@ -201,9 +195,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, objectHandle, signHandle,
- qualifyingData,
- inScheme);
+ store_input_parameters(esysContext, objectHandle, signHandle, qualifyingData,
+ inScheme);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, objectHandle, &objectHandleNode);
@@ -213,10 +206,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Certify_Prepare(esysContext->sys,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- qualifyingData,
- inScheme);
+ (objectHandleNode == NULL) ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle,
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle, qualifyingData,
+ inScheme);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -230,14 +224,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, objectHandleNode, signHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -254,8 +251,8 @@
* @param[in,out] esysContext The ESYS_CONTEXT.
* @param[out] certifyInfo The structure that was signed.
* (callee-allocated)
- * @param[out] signature The asymmetric signature over certifyInfo using the key
- * referenced by signHandle.
+ * @param[out] signature The asymmetric signature over certifyInfo using the
+ * key referenced by signHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -330,14 +327,13 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Certify_Async(esysContext,
- esysContext->in.Certify.objectHandle,
- esysContext->in.Certify.signHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Certify.qualifyingData,
- esysContext->in.Certify.inScheme);
+ r = Esys_Certify_Async(esysContext, esysContext->in.Certify.objectHandle,
+ esysContext->in.Certify.signHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Certify.qualifyingData,
+ esysContext->in.Certify.inScheme);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -365,16 +361,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Certify_Complete(esysContext->sys,
- (certifyInfo != NULL) ? *certifyInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (certifyInfo != NULL) ? *certifyInfo : NULL,
+ (signature != NULL) ? *signature : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_CertifyCreation.c b/src/tss2-esys/api/Esys_CertifyCreation.c
index 746997c..1112f9a 100644
--- a/src/tss2-esys/api/Esys_CertifyCreation.c
+++ b/src/tss2-esys/api/Esys_CertifyCreation.c
@@ -64,14 +64,15 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] signHandle Handle of the key that will sign the attestation block.
+ * @param[in] signHandle Handle of the key that will sign the attestation
+ * block.
* @param[in] objectHandle The object associated with the creation data.
* @param[in] shandle1 Session handle for authorization of signHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] qualifyingData User-provided qualifying data.
- * @param[in] creationHash Hash of the creation data produced by TPM2_Create() or
- * TPM2_CreatePrimary().
+ * @param[in] creationHash Hash of the creation data produced by TPM2_Create()
+ * or TPM2_CreatePrimary().
* @param[in] inScheme TPM2_Signing scheme to use if the scheme for signHandle is
* TPM2_ALG_NULL.
* @param[in] creationTicket Ticket produced by TPM2_Create() or
@@ -97,9 +98,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -120,16 +121,9 @@
{
TSS2_RC r;
- r = Esys_CertifyCreation_Async(esysContext,
- signHandle,
- objectHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- creationHash,
- inScheme,
- creationTicket);
+ r = Esys_CertifyCreation_Async(esysContext, signHandle, objectHandle,
+ shandle1, shandle2, shandle3, qualifyingData,
+ creationHash, inScheme, creationTicket);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -143,9 +137,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_CertifyCreation_Finish(esysContext,
- certifyInfo,
- signature);
+ r = Esys_CertifyCreation_Finish(esysContext, certifyInfo, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -168,14 +160,15 @@
* In order to retrieve the TPM's response call Esys_CertifyCreation_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] signHandle Handle of the key that will sign the attestation block.
+ * @param[in] signHandle Handle of the key that will sign the attestation
+ * block.
* @param[in] objectHandle The object associated with the creation data.
* @param[in] shandle1 Session handle for authorization of signHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] qualifyingData User-provided qualifying data.
- * @param[in] creationHash Hash of the creation data produced by TPM2_Create() or
- * TPM2_CreatePrimary().
+ * @param[in] creationHash Hash of the creation data produced by TPM2_Create()
+ * or TPM2_CreatePrimary().
* @param[in] inScheme TPM2_Signing scheme to use if the scheme for signHandle is
* TPM2_ALG_NULL.
* @param[in] creationTicket Ticket produced by TPM2_Create() or
@@ -192,9 +185,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_CertifyCreation_Async(
@@ -232,11 +225,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, signHandle, objectHandle,
- qualifyingData,
- creationHash,
- inScheme,
- creationTicket);
+ store_input_parameters(esysContext, signHandle, objectHandle, qualifyingData,
+ creationHash, inScheme, creationTicket);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, signHandle, &signHandleNode);
@@ -246,12 +236,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_CertifyCreation_Prepare(esysContext->sys,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle,
- qualifyingData,
- creationHash,
- inScheme,
- creationTicket);
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle,
+ (objectHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle,
+ qualifyingData, creationHash, inScheme,
+ creationTicket);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -264,14 +255,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, signHandleNode, objectHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -364,15 +358,15 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_CertifyCreation_Async(esysContext,
- esysContext->in.CertifyCreation.signHandle,
- esysContext->in.CertifyCreation.objectHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.CertifyCreation.qualifyingData,
- esysContext->in.CertifyCreation.creationHash,
- esysContext->in.CertifyCreation.inScheme,
- esysContext->in.CertifyCreation.creationTicket);
+ esysContext->in.CertifyCreation.signHandle,
+ esysContext->in.CertifyCreation.objectHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.CertifyCreation.qualifyingData,
+ esysContext->in.CertifyCreation.creationHash,
+ esysContext->in.CertifyCreation.inScheme,
+ esysContext->in.CertifyCreation.creationTicket);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -400,16 +394,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_CertifyCreation_Complete(esysContext->sys,
- (certifyInfo != NULL) ? *certifyInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (certifyInfo != NULL) ? *certifyInfo
+ : NULL,
+ (signature != NULL) ? *signature
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ChangeEPS.c b/src/tss2-esys/api/Esys_ChangeEPS.c
index 4ff9e29..3f1c7f8 100644
--- a/src/tss2-esys/api/Esys_ChangeEPS.c
+++ b/src/tss2-esys/api/Esys_ChangeEPS.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_ChangeEPS_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_ChangeEPS_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ChangeEPS_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ChangeEPS_Async(esysContext,
- esysContext->in.ChangeEPS.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.ChangeEPS.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ChangeEPS_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ChangePPS.c b/src/tss2-esys/api/Esys_ChangePPS.c
index e3680e5..78912a3 100644
--- a/src/tss2-esys/api/Esys_ChangePPS.c
+++ b/src/tss2-esys/api/Esys_ChangePPS.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_ChangePPS_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_ChangePPS_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ChangePPS_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ChangePPS_Async(esysContext,
- esysContext->in.ChangePPS.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.ChangePPS.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ChangePPS_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Clear.c b/src/tss2-esys/api/Esys_Clear.c
index 867f8ca..eec871c 100644
--- a/src/tss2-esys/api/Esys_Clear.c
+++ b/src/tss2-esys/api/Esys_Clear.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,7 @@
{
TSS2_RC r;
- r = Esys_Clear_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_Clear_Async(esysContext, authHandle, shandle1, shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +126,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +171,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Clear_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +185,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,11 +267,10 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Clear_Async(esysContext,
- esysContext->in.Clear.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ r = Esys_Clear_Async(esysContext, esysContext->in.Clear.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +297,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Clear_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ClearControl.c b/src/tss2-esys/api/Esys_ClearControl.c
index 1824dac..30f218c 100644
--- a/src/tss2-esys/api/Esys_ClearControl.c
+++ b/src/tss2-esys/api/Esys_ClearControl.c
@@ -36,8 +36,8 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] disable YES if the disableOwnerClear flag is to be SET, NO if the
- * flag is to be CLEAR..
+ * @param[in] disable YES if the disableOwnerClear flag is to be SET, NO if
+ * the flag is to be CLEAR..
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -55,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -78,12 +78,8 @@
{
TSS2_RC r;
- r = Esys_ClearControl_Async(esysContext,
- auth,
- shandle1,
- shandle2,
- shandle3,
- disable);
+ r = Esys_ClearControl_Async(esysContext, auth, shandle1, shandle2, shandle3,
+ disable);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,8 +120,8 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] disable YES if the disableOwnerClear flag is to be SET, NO if the
- * flag is to be CLEAR..
+ * @param[in] disable YES if the disableOwnerClear flag is to be SET, NO if
+ * the flag is to be CLEAR..
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -138,9 +134,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -176,8 +172,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth,
- disable);
+ store_input_parameters(esysContext, auth, disable);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -185,8 +180,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ClearControl_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- disable);
+ (authNode == NULL) ? TPM2_RH_NULL
+ : authNode->rsrc.handle, disable);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +194,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -279,11 +277,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ClearControl_Async(esysContext,
- esysContext->in.ClearControl.auth,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ClearControl.disable);
+ esysContext->in.ClearControl.auth,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ClearControl.disable);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -310,14 +308,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ClearControl_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ClockRateAdjust.c b/src/tss2-esys/api/Esys_ClockRateAdjust.c
index 29d30fa..54ae772 100644
--- a/src/tss2-esys/api/Esys_ClockRateAdjust.c
+++ b/src/tss2-esys/api/Esys_ClockRateAdjust.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_ClockRateAdjust_Async(esysContext,
- auth,
- shandle1,
- shandle2,
- shandle3,
- rateAdjust);
+ r = Esys_ClockRateAdjust_Async(esysContext, auth, shandle1, shandle2,
+ shandle3, rateAdjust);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -174,8 +170,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth,
- rateAdjust);
+ store_input_parameters(esysContext, auth, rateAdjust);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -183,8 +178,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ClockRateAdjust_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- rateAdjust);
+ (authNode == NULL) ? TPM2_RH_NULL
+ : authNode->rsrc.handle, rateAdjust);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -197,14 +192,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -277,11 +275,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ClockRateAdjust_Async(esysContext,
- esysContext->in.ClockRateAdjust.auth,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ClockRateAdjust.rateAdjust);
+ esysContext->in.ClockRateAdjust.auth,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ClockRateAdjust.rateAdjust);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -308,14 +306,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ClockRateAdjust_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ClockSet.c b/src/tss2-esys/api/Esys_ClockSet.c
index e306f88..760a168 100644
--- a/src/tss2-esys/api/Esys_ClockSet.c
+++ b/src/tss2-esys/api/Esys_ClockSet.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_ClockSet_Async(esysContext,
- auth,
- shandle1,
- shandle2,
- shandle3,
- newTime);
+ r = Esys_ClockSet_Async(esysContext, auth, shandle1, shandle2, shandle3,
+ newTime);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -174,8 +170,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth,
- newTime);
+ store_input_parameters(esysContext, auth, newTime);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -183,8 +178,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ClockSet_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- newTime);
+ (authNode == NULL) ? TPM2_RH_NULL
+ : authNode->rsrc.handle, newTime);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -197,14 +192,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -276,12 +274,11 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_ClockSet_Async(esysContext,
- esysContext->in.ClockSet.auth,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ClockSet.newTime);
+ r = Esys_ClockSet_Async(esysContext, esysContext->in.ClockSet.auth,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ClockSet.newTime);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -308,14 +305,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ClockSet_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Commit.c b/src/tss2-esys/api/Esys_Commit.c
index 0bfc622..aa13d93 100644
--- a/src/tss2-esys/api/Esys_Commit.c
+++ b/src/tss2-esys/api/Esys_Commit.c
@@ -87,9 +87,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -110,14 +110,8 @@
{
TSS2_RC r;
- r = Esys_Commit_Async(esysContext,
- signHandle,
- shandle1,
- shandle2,
- shandle3,
- P1,
- s2,
- y2);
+ r = Esys_Commit_Async(esysContext, signHandle, shandle1, shandle2, shandle3,
+ P1, s2, y2);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -131,11 +125,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Commit_Finish(esysContext,
- K,
- L,
- E,
- counter);
+ r = Esys_Commit_Finish(esysContext, K, L, E, counter);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -178,9 +168,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Commit_Async(
@@ -213,10 +203,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, signHandle,
- P1,
- s2,
- y2);
+ store_input_parameters(esysContext, signHandle, P1, s2, y2);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, signHandle, &signHandleNode);
@@ -224,10 +211,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Commit_Prepare(esysContext->sys,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- P1,
- s2,
- y2);
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle, P1, s2, y2);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -240,14 +225,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, signHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -357,14 +345,13 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Commit_Async(esysContext,
- esysContext->in.Commit.signHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Commit.P1,
- esysContext->in.Commit.s2,
- esysContext->in.Commit.y2);
+ r = Esys_Commit_Async(esysContext, esysContext->in.Commit.signHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Commit.P1,
+ esysContext->in.Commit.s2,
+ esysContext->in.Commit.y2);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -392,18 +379,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Commit_Complete(esysContext->sys,
- (K != NULL) ? *K : NULL,
- (L != NULL) ? *L : NULL,
- (E != NULL) ? *E : NULL,
- counter);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (K != NULL) ? *K : NULL,
+ (L != NULL) ? *L : NULL,
+ (E != NULL) ? *E : NULL, counter);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ContextLoad.c b/src/tss2-esys/api/Esys_ContextLoad.c
index 3dc7320..7db7804 100644
--- a/src/tss2-esys/api/Esys_ContextLoad.c
+++ b/src/tss2-esys/api/Esys_ContextLoad.c
@@ -57,13 +57,11 @@
TSS2_RC
Esys_ContextLoad(
ESYS_CONTEXT *esysContext,
- const TPMS_CONTEXT *context,
- ESYS_TR *loadedHandle)
+ const TPMS_CONTEXT *context, ESYS_TR *loadedHandle)
{
TSS2_RC r;
- r = Esys_ContextLoad_Async(esysContext,
- context);
+ r = Esys_ContextLoad_Async(esysContext, context);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -77,8 +75,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ContextLoad_Finish(esysContext,
- loadedHandle);
+ r = Esys_ContextLoad_Finish(esysContext, loadedHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -131,8 +128,7 @@
if (r != TSS2_RC_SUCCESS)
return r;
esysContext->state = _ESYS_STATE_INTERNALERROR;
- store_input_parameters(esysContext,
- context);
+ store_input_parameters(esysContext, context);
size_t offset = 0;
/*
@@ -163,12 +159,12 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_ContextLoad_Prepare(esysContext->sys,
- context);
+ r = Tss2_Sys_ContextLoad_Prepare(esysContext->sys, context);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -205,8 +201,7 @@
*/
TSS2_RC
Esys_ContextLoad_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *loadedHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *loadedHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, loadedHandle=%p",
@@ -263,7 +258,7 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ContextLoad_Async(esysContext,
- esysContext->in.ContextLoad.context);
+ esysContext->in.ContextLoad.context);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -285,9 +280,11 @@
goto error_cleanup;
}
r = Tss2_Sys_ContextLoad_Complete(esysContext->sys,
- &loadedHandleNode->rsrc.handle);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &loadedHandleNode->rsrc.handle);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ContextSave.c b/src/tss2-esys/api/Esys_ContextSave.c
index 833402b..4c8b4c9 100644
--- a/src/tss2-esys/api/Esys_ContextSave.c
+++ b/src/tss2-esys/api/Esys_ContextSave.c
@@ -46,9 +46,9 @@
* @retval TSS2_ESYS_RC_MALFORMED_RESPONSE: if the TPM's response is corrupted.
* @retval TSS2_ESYS_RC_RSP_AUTH_FAILED: if the response HMAC from the TPM
did not verify.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -60,8 +60,7 @@
{
TSS2_RC r;
- r = Esys_ContextSave_Async(esysContext,
- saveHandle);
+ r = Esys_ContextSave_Async(esysContext, saveHandle);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -75,8 +74,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ContextSave_Finish(esysContext,
- context);
+ r = Esys_ContextSave_Finish(esysContext, context);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -108,9 +106,9 @@
* internal operations or return parameters.
* @retval TSS2_RCs produced by lower layers of the software stack may be
returned to the caller unaltered unless handled internally.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_ContextSave_Async(
@@ -139,11 +137,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ContextSave_Prepare(esysContext->sys,
- (saveHandleNode == NULL) ? TPM2_RH_NULL : saveHandleNode->rsrc.handle);
+ (saveHandleNode == NULL) ? TPM2_RH_NULL
+ : saveHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -226,7 +226,7 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ContextSave_Async(esysContext,
- esysContext->in.ContextSave.saveHandle);
+ esysContext->in.ContextSave.saveHandle);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -247,10 +247,11 @@
esysContext->state = _ESYS_STATE_INTERNALERROR;
goto error_cleanup;
}
- r = Tss2_Sys_ContextSave_Complete(esysContext->sys,
- lcontext);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ r = Tss2_Sys_ContextSave_Complete(esysContext->sys, lcontext);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* ESYS Special Handling Code: Extend the context with metadata of the object */
IESYS_CONTEXT_DATA esyscontextData;
@@ -278,7 +279,7 @@
* the ESYS_TR object is invalidated.
*/
if (esys_object->rsrc.rsrcType == IESYSC_SESSION_RSRC) {
- r = Esys_TR_Close(esysContext, &esysContext->in.ContextSave.saveHandle);
+ r = Esys_TR_Close(esysContext, &esysContext->in.ContextSave.saveHandle);
goto_if_error(r, "invalidate object", error_cleanup);
}
if (context != NULL)
diff --git a/src/tss2-esys/api/Esys_Create.c b/src/tss2-esys/api/Esys_Create.c
index eff4445..97e54e3 100644
--- a/src/tss2-esys/api/Esys_Create.c
+++ b/src/tss2-esys/api/Esys_Create.c
@@ -100,9 +100,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -125,15 +125,9 @@
{
TSS2_RC r;
- r = Esys_Create_Async(esysContext,
- parentHandle,
- shandle1,
- shandle2,
- shandle3,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ r = Esys_Create_Async(esysContext, parentHandle, shandle1, shandle2,
+ shandle3, inSensitive, inPublic, outsideInfo,
+ creationPCR);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -147,12 +141,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Create_Finish(esysContext,
- outPrivate,
- outPublic,
- creationData,
- creationHash,
- creationTicket);
+ r = Esys_Create_Finish(esysContext, outPrivate, outPublic, creationData,
+ creationHash, creationTicket);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -197,9 +187,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Create_Async(
@@ -234,11 +224,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, parentHandle,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ store_input_parameters(esysContext, parentHandle, inSensitive, inPublic,
+ outsideInfo, creationPCR);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, parentHandle, &parentHandleNode);
@@ -246,11 +233,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Create_Prepare(esysContext->sys,
- (parentHandleNode == NULL) ? TPM2_RH_NULL : parentHandleNode->rsrc.handle,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ (parentHandleNode == NULL) ? TPM2_RH_NULL
+ : parentHandleNode->rsrc.handle, inSensitive,
+ inPublic, outsideInfo, creationPCR);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -263,14 +248,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, parentHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -400,15 +388,14 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Create_Async(esysContext,
- esysContext->in.Create.parentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Create.inSensitive,
- esysContext->in.Create.inPublic,
- esysContext->in.Create.outsideInfo,
- esysContext->in.Create.creationPCR);
+ r = Esys_Create_Async(esysContext, esysContext->in.Create.parentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Create.inSensitive,
+ esysContext->in.Create.inPublic,
+ esysContext->in.Create.outsideInfo,
+ esysContext->in.Create.creationPCR);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -436,19 +423,23 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Create_Complete(esysContext->sys,
- (outPrivate != NULL) ? *outPrivate : NULL,
- (outPublic != NULL) ? *outPublic : NULL,
- (creationData != NULL) ? *creationData : NULL,
- (creationHash != NULL) ? *creationHash : NULL,
- (creationTicket != NULL) ? *creationTicket : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outPrivate != NULL) ? *outPrivate : NULL,
+ (outPublic != NULL) ? *outPublic : NULL,
+ (creationData != NULL) ? *creationData : NULL,
+ (creationHash != NULL) ? *creationHash : NULL,
+ (creationTicket != NULL) ? *creationTicket
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_CreateLoaded.c b/src/tss2-esys/api/Esys_CreateLoaded.c
index 59ae789..9f2822e 100644
--- a/src/tss2-esys/api/Esys_CreateLoaded.c
+++ b/src/tss2-esys/api/Esys_CreateLoaded.c
@@ -52,7 +52,8 @@
* @param[in] shandle1 Session handle for authorization of parentHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive Values.
+ * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive
+ * Values.
* @param[in] inPublic The public template.
* @param[out] outPrivate The sensitive area of the object (optional).
* (callee-allocated)
@@ -76,9 +77,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -90,20 +91,14 @@
ESYS_TR shandle2,
ESYS_TR shandle3,
const TPM2B_SENSITIVE_CREATE *inSensitive,
- const TPM2B_TEMPLATE *inPublic,
- ESYS_TR *objectHandle,
+ const TPM2B_TEMPLATE *inPublic, ESYS_TR *objectHandle,
TPM2B_PRIVATE **outPrivate,
TPM2B_PUBLIC **outPublic)
{
TSS2_RC r;
- r = Esys_CreateLoaded_Async(esysContext,
- parentHandle,
- shandle1,
- shandle2,
- shandle3,
- inSensitive,
- inPublic);
+ r = Esys_CreateLoaded_Async(esysContext, parentHandle, shandle1, shandle2,
+ shandle3, inSensitive, inPublic);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -117,10 +112,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_CreateLoaded_Finish(esysContext,
- objectHandle,
- outPrivate,
- outPublic);
+ r = Esys_CreateLoaded_Finish(esysContext, objectHandle, outPrivate,
+ outPublic);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -149,7 +142,8 @@
* @param[in] shandle1 Session handle for authorization of parentHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive Values.
+ * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive
+ * Values.
* @param[in] inPublic The public template.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -163,9 +157,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_CreateLoaded_Async(
@@ -197,9 +191,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, parentHandle,
- inSensitive,
- inPublic);
+ store_input_parameters(esysContext, parentHandle, inSensitive, inPublic);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, parentHandle, &parentHandleNode);
@@ -207,9 +199,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_CreateLoaded_Prepare(esysContext->sys,
- (parentHandleNode == NULL) ? TPM2_RH_NULL : parentHandleNode->rsrc.handle,
- inSensitive,
- inPublic);
+ (parentHandleNode == NULL) ? TPM2_RH_NULL
+ : parentHandleNode->rsrc.handle,
+ inSensitive, inPublic);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -222,14 +214,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, parentHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -270,8 +265,7 @@
*/
TSS2_RC
Esys_CreateLoaded_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *objectHandle,
+ ESYS_CONTEXT *esysContext, ESYS_TR *objectHandle,
TPM2B_PRIVATE **outPrivate,
TPM2B_PUBLIC **outPublic)
{
@@ -344,12 +338,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_CreateLoaded_Async(esysContext,
- esysContext->in.CreateLoaded.parentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.CreateLoaded.inSensitive,
- esysContext->in.CreateLoaded.inPublic);
+ esysContext->in.CreateLoaded.parentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.CreateLoaded.inSensitive,
+ esysContext->in.CreateLoaded.inPublic);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -377,18 +371,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_CreateLoaded_Complete(esysContext->sys,
- &objectHandleNode->rsrc.handle,
- (outPrivate != NULL) ? *outPrivate : NULL,
- loutPublic,
- &name);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &objectHandleNode->rsrc.handle,
+ (outPrivate != NULL) ? *outPrivate : NULL,
+ loutPublic, &name);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* Check name and outPublic for consistency */
if (!iesys_compare_name(loutPublic, &name))
diff --git a/src/tss2-esys/api/Esys_CreatePrimary.c b/src/tss2-esys/api/Esys_CreatePrimary.c
index 077af99..71e7ecf 100644
--- a/src/tss2-esys/api/Esys_CreatePrimary.c
+++ b/src/tss2-esys/api/Esys_CreatePrimary.c
@@ -67,7 +67,8 @@
* @param[in] shandle1 Session handle for authorization of primaryHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive Values.
+ * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive
+ * Values.
* @param[in] inPublic The public template.
* @param[in] outsideInfo Data that will be included in the creation data for
* this object to provide permanent, verifiable linkage between
@@ -100,9 +101,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -116,8 +117,7 @@
const TPM2B_SENSITIVE_CREATE *inSensitive,
const TPM2B_PUBLIC *inPublic,
const TPM2B_DATA *outsideInfo,
- const TPML_PCR_SELECTION *creationPCR,
- ESYS_TR *objectHandle,
+ const TPML_PCR_SELECTION *creationPCR, ESYS_TR *objectHandle,
TPM2B_PUBLIC **outPublic,
TPM2B_CREATION_DATA **creationData,
TPM2B_DIGEST **creationHash,
@@ -125,15 +125,9 @@
{
TSS2_RC r;
- r = Esys_CreatePrimary_Async(esysContext,
- primaryHandle,
- shandle1,
- shandle2,
- shandle3,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ r = Esys_CreatePrimary_Async(esysContext, primaryHandle, shandle1, shandle2,
+ shandle3, inSensitive, inPublic, outsideInfo,
+ creationPCR);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -147,12 +141,9 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_CreatePrimary_Finish(esysContext,
- objectHandle,
- outPublic,
- creationData,
- creationHash,
- creationTicket);
+ r = Esys_CreatePrimary_Finish(esysContext, objectHandle, outPublic,
+ creationData, creationHash,
+ creationTicket);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -180,7 +171,8 @@
* @param[in] shandle1 Session handle for authorization of primaryHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive Values.
+ * @param[in] inSensitive The sensitive data, see TPM 2.0 Part 1 Sensitive
+ * Values.
* @param[in] inPublic The public template.
* @param[in] outsideInfo Data that will be included in the creation data for
* this object to provide permanent, verifiable linkage between
@@ -198,9 +190,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_CreatePrimary_Async(
@@ -235,11 +227,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, primaryHandle,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ store_input_parameters(esysContext, primaryHandle, inSensitive, inPublic,
+ outsideInfo, creationPCR);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, primaryHandle, &primaryHandleNode);
@@ -247,11 +236,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_CreatePrimary_Prepare(esysContext->sys,
- (primaryHandleNode == NULL) ? TPM2_RH_NULL : primaryHandleNode->rsrc.handle,
- inSensitive,
- inPublic,
- outsideInfo,
- creationPCR);
+ (primaryHandleNode == NULL) ? TPM2_RH_NULL
+ : primaryHandleNode->rsrc.handle,
+ inSensitive, inPublic, outsideInfo,
+ creationPCR);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -264,14 +252,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, primaryHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -317,8 +308,7 @@
*/
TSS2_RC
Esys_CreatePrimary_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *objectHandle,
+ ESYS_CONTEXT *esysContext, ESYS_TR *objectHandle,
TPM2B_PUBLIC **outPublic,
TPM2B_CREATION_DATA **creationData,
TPM2B_DIGEST **creationHash,
@@ -403,14 +393,14 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_CreatePrimary_Async(esysContext,
- esysContext->in.CreatePrimary.primaryHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.CreatePrimary.inSensitive,
- esysContext->in.CreatePrimary.inPublic,
- esysContext->in.CreatePrimary.outsideInfo,
- esysContext->in.CreatePrimary.creationPCR);
+ esysContext->in.CreatePrimary.primaryHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.CreatePrimary.inSensitive,
+ esysContext->in.CreatePrimary.inPublic,
+ esysContext->in.CreatePrimary.outsideInfo,
+ esysContext->in.CreatePrimary.creationPCR);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -438,20 +428,25 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_CreatePrimary_Complete(esysContext->sys,
- &objectHandleNode->rsrc.handle,
- loutPublic,
- (creationData != NULL) ? *creationData : NULL,
- (creationHash != NULL) ? *creationHash : NULL,
- (creationTicket != NULL) ? *creationTicket : NULL,
- &name);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &objectHandleNode->rsrc.handle,
+ loutPublic,
+ (creationData != NULL) ? *creationData
+ : NULL,
+ (creationHash != NULL) ? *creationHash
+ : NULL,
+ (creationTicket != NULL)
+ ? *creationTicket : NULL, &name);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* Check name and outPublic for consistency */
if (!iesys_compare_name(loutPublic, &name))
diff --git a/src/tss2-esys/api/Esys_DictionaryAttackLockReset.c b/src/tss2-esys/api/Esys_DictionaryAttackLockReset.c
index 78b8a64..300cd3d 100644
--- a/src/tss2-esys/api/Esys_DictionaryAttackLockReset.c
+++ b/src/tss2-esys/api/Esys_DictionaryAttackLockReset.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_DictionaryAttackLockReset_Async(esysContext,
- lockHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_DictionaryAttackLockReset_Async(esysContext, lockHandle, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_DictionaryAttackLockReset_Prepare(esysContext->sys,
- (lockHandleNode == NULL) ? TPM2_RH_NULL : lockHandleNode->rsrc.handle);
+ (lockHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : lockHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +187,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, lockHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,10 +270,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_DictionaryAttackLockReset_Async(esysContext,
- esysContext->in.DictionaryAttackLockReset.lockHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.DictionaryAttackLockReset.lockHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +300,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_DictionaryAttackLockReset_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_DictionaryAttackParameters.c b/src/tss2-esys/api/Esys_DictionaryAttackParameters.c
index 7c4ba01..8e13a7c 100644
--- a/src/tss2-esys/api/Esys_DictionaryAttackParameters.c
+++ b/src/tss2-esys/api/Esys_DictionaryAttackParameters.c
@@ -40,12 +40,12 @@
* @param[in] shandle1 Session handle for authorization of lockHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] newMaxTries Count of authorization failures before the lockout is
- * imposed.
+ * @param[in] newMaxTries Count of authorization failures before the lockout
+ * is imposed.
* @param[in] newRecoveryTime Time in seconds before the authorization failure
* count is automatically decremented.
- * @param[in] lockoutRecovery Time in seconds after a lockoutAuth failure before
- * use of lockoutAuth is allowed.
+ * @param[in] lockoutRecovery Time in seconds after a lockoutAuth failure
+ * before use of lockoutAuth is allowed.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -63,9 +63,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -88,14 +88,9 @@
{
TSS2_RC r;
- r = Esys_DictionaryAttackParameters_Async(esysContext,
- lockHandle,
- shandle1,
- shandle2,
- shandle3,
- newMaxTries,
- newRecoveryTime,
- lockoutRecovery);
+ r = Esys_DictionaryAttackParameters_Async(esysContext, lockHandle, shandle1,
+ shandle2, shandle3, newMaxTries,
+ newRecoveryTime, lockoutRecovery);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,12 +131,12 @@
* @param[in] shandle1 Session handle for authorization of lockHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] newMaxTries Count of authorization failures before the lockout is
- * imposed.
+ * @param[in] newMaxTries Count of authorization failures before the lockout
+ * is imposed.
* @param[in] newRecoveryTime Time in seconds before the authorization failure
* count is automatically decremented.
- * @param[in] lockoutRecovery Time in seconds after a lockoutAuth failure before
- * use of lockoutAuth is allowed.
+ * @param[in] lockoutRecovery Time in seconds after a lockoutAuth failure
+ * before use of lockoutAuth is allowed.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -154,9 +149,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -195,10 +190,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, lockHandle,
- newMaxTries,
- newRecoveryTime,
- lockoutRecovery);
+ store_input_parameters(esysContext, lockHandle, newMaxTries, newRecoveryTime,
+ lockoutRecovery);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, lockHandle, &lockHandleNode);
@@ -206,10 +199,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_DictionaryAttackParameters_Prepare(esysContext->sys,
- (lockHandleNode == NULL) ? TPM2_RH_NULL : lockHandleNode->rsrc.handle,
- newMaxTries,
- newRecoveryTime,
- lockoutRecovery);
+ (lockHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : lockHandleNode->rsrc.handle,
+ newMaxTries, newRecoveryTime,
+ lockoutRecovery);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -222,14 +216,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, lockHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -302,13 +299,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_DictionaryAttackParameters_Async(esysContext,
- esysContext->in.DictionaryAttackParameters.lockHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.DictionaryAttackParameters.newMaxTries,
- esysContext->in.DictionaryAttackParameters.newRecoveryTime,
- esysContext->in.DictionaryAttackParameters.lockoutRecovery);
+ esysContext->in.DictionaryAttackParameters.lockHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.DictionaryAttackParameters.newMaxTries,
+ esysContext->in.DictionaryAttackParameters.newRecoveryTime,
+ esysContext->in.DictionaryAttackParameters.lockoutRecovery);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -335,14 +332,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_DictionaryAttackParameters_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Duplicate.c b/src/tss2-esys/api/Esys_Duplicate.c
index 3743ee1..2e7b00a 100644
--- a/src/tss2-esys/api/Esys_Duplicate.c
+++ b/src/tss2-esys/api/Esys_Duplicate.c
@@ -55,8 +55,8 @@
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] encryptionKeyIn Optional symmetric encryption key.
- * @param[in] symmetricAlg Definition for the symmetric algorithm to be used for
- * the inner wrapper.
+ * @param[in] symmetricAlg Definition for the symmetric algorithm to be used
+ * for the inner wrapper.
* @param[out] encryptionKeyOut TPM2_If the caller provided an encryption key or if
* symmetricAlg was TPM2_ALG_NULL, then this will be the TPM2_Empty
* TPM2_Buffer; otherwise, it shall contain the TPM2_TPM-generated, symmetric
@@ -85,9 +85,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -107,14 +107,9 @@
{
TSS2_RC r;
- r = Esys_Duplicate_Async(esysContext,
- objectHandle,
- newParentHandle,
- shandle1,
- shandle2,
- shandle3,
- encryptionKeyIn,
- symmetricAlg);
+ r = Esys_Duplicate_Async(esysContext, objectHandle, newParentHandle,
+ shandle1, shandle2, shandle3, encryptionKeyIn,
+ symmetricAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -128,10 +123,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Duplicate_Finish(esysContext,
- encryptionKeyOut,
- duplicate,
- outSymSeed);
+ r = Esys_Duplicate_Finish(esysContext, encryptionKeyOut, duplicate,
+ outSymSeed);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -161,8 +154,8 @@
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] encryptionKeyIn Optional symmetric encryption key.
- * @param[in] symmetricAlg Definition for the symmetric algorithm to be used for
- * the inner wrapper.
+ * @param[in] symmetricAlg Definition for the symmetric algorithm to be used
+ * for the inner wrapper.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -175,9 +168,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Duplicate_Async(
@@ -212,8 +205,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, objectHandle, newParentHandle,
- encryptionKeyIn,
- symmetricAlg);
+ encryptionKeyIn, symmetricAlg);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, objectHandle, &objectHandleNode);
@@ -223,10 +215,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Duplicate_Prepare(esysContext->sys,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle,
- (newParentHandleNode == NULL) ? TPM2_RH_NULL : newParentHandleNode->rsrc.handle,
- encryptionKeyIn,
- symmetricAlg);
+ (objectHandleNode == NULL) ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle,
+ (newParentHandleNode == NULL) ? TPM2_RH_NULL
+ : newParentHandleNode->rsrc.handle,
+ encryptionKeyIn, symmetricAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -239,14 +232,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, objectHandleNode, newParentHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -359,13 +355,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_Duplicate_Async(esysContext,
- esysContext->in.Duplicate.objectHandle,
- esysContext->in.Duplicate.newParentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Duplicate.encryptionKeyIn,
- esysContext->in.Duplicate.symmetricAlg);
+ esysContext->in.Duplicate.objectHandle,
+ esysContext->in.Duplicate.newParentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Duplicate.encryptionKeyIn,
+ esysContext->in.Duplicate.symmetricAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -393,17 +389,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Duplicate_Complete(esysContext->sys,
- (encryptionKeyOut != NULL) ? *encryptionKeyOut : NULL,
- (duplicate != NULL) ? *duplicate : NULL,
- (outSymSeed != NULL) ? *outSymSeed : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (encryptionKeyOut != NULL)
+ ? *encryptionKeyOut : NULL,
+ (duplicate != NULL) ? *duplicate : NULL,
+ (outSymSeed != NULL) ? *outSymSeed : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ECC_Parameters.c b/src/tss2-esys/api/Esys_ECC_Parameters.c
index 1c2039e..ffc2b2c 100644
--- a/src/tss2-esys/api/Esys_ECC_Parameters.c
+++ b/src/tss2-esys/api/Esys_ECC_Parameters.c
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_ECC_Parameters_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- curveID);
+ r = Esys_ECC_Parameters_Async(esysContext, shandle1, shandle2, shandle3,
+ curveID);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -91,8 +88,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ECC_Parameters_Finish(esysContext,
- parameters);
+ r = Esys_ECC_Parameters_Finish(esysContext, parameters);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -164,12 +160,10 @@
/* Check and store 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,
- curveID);
+ store_input_parameters(esysContext, curveID);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_ECC_Parameters_Prepare(esysContext->sys,
- curveID);
+ r = Tss2_Sys_ECC_Parameters_Prepare(esysContext->sys, curveID);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -181,14 +175,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -271,11 +268,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_ECC_Parameters_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ECC_Parameters.curveID);
+ r = Esys_ECC_Parameters_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ECC_Parameters.curveID);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -303,15 +299,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ECC_Parameters_Complete(esysContext->sys,
- (parameters != NULL) ? *parameters : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (parameters != NULL) ? *parameters
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ECDH_KeyGen.c b/src/tss2-esys/api/Esys_ECDH_KeyGen.c
index 3a6cef6..ff7f77e 100644
--- a/src/tss2-esys/api/Esys_ECDH_KeyGen.c
+++ b/src/tss2-esys/api/Esys_ECDH_KeyGen.c
@@ -55,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -76,11 +76,8 @@
{
TSS2_RC r;
- r = Esys_ECDH_KeyGen_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_ECDH_KeyGen_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -94,9 +91,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ECDH_KeyGen_Finish(esysContext,
- zPoint,
- pubPoint);
+ r = Esys_ECDH_KeyGen_Finish(esysContext, zPoint, pubPoint);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -135,9 +130,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -177,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ECDH_KeyGen_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -189,14 +185,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -289,10 +288,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ECDH_KeyGen_Async(esysContext,
- esysContext->in.ECDH_KeyGen.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.ECDH_KeyGen.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -320,16 +319,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ECDH_KeyGen_Complete(esysContext->sys,
- (zPoint != NULL) ? *zPoint : NULL,
- (pubPoint != NULL) ? *pubPoint : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (zPoint != NULL) ? *zPoint : NULL,
+ (pubPoint != NULL) ? *pubPoint : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ECDH_ZGen.c b/src/tss2-esys/api/Esys_ECDH_ZGen.c
index 74fdc73..fb3726f 100644
--- a/src/tss2-esys/api/Esys_ECDH_ZGen.c
+++ b/src/tss2-esys/api/Esys_ECDH_ZGen.c
@@ -43,8 +43,8 @@
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] inPoint A public key.
- * @param[out] outPoint X and Y coordinates of the product of the multiplication Z
- * = (xZ , yZ) := [hdS]QB.
+ * @param[out] outPoint X and Y coordinates of the product of the
+ * multiplication Z = (xZ , yZ) := [hdS]QB.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -63,9 +63,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -81,12 +81,8 @@
{
TSS2_RC r;
- r = Esys_ECDH_ZGen_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- inPoint);
+ r = Esys_ECDH_ZGen_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, inPoint);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -100,8 +96,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ECDH_ZGen_Finish(esysContext,
- outPoint);
+ r = Esys_ECDH_ZGen_Finish(esysContext, outPoint);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -141,9 +136,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_ECDH_ZGen_Async(
@@ -173,8 +168,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyHandle,
- inPoint);
+ store_input_parameters(esysContext, keyHandle, inPoint);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -182,8 +176,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ECDH_ZGen_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- inPoint);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, inPoint);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -196,14 +190,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -218,8 +215,8 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] outPoint X and Y coordinates of the product of the multiplication Z
- * = (xZ , yZ) := [hdS]QB.
+ * @param[out] outPoint X and Y coordinates of the product of the
+ * multiplication Z = (xZ , yZ) := [hdS]QB.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -288,11 +285,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ECDH_ZGen_Async(esysContext,
- esysContext->in.ECDH_ZGen.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ECDH_ZGen.inPoint);
+ esysContext->in.ECDH_ZGen.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ECDH_ZGen.inPoint);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -320,15 +317,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ECDH_ZGen_Complete(esysContext->sys,
- (outPoint != NULL) ? *outPoint : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outPoint != NULL) ? *outPoint : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_EC_Ephemeral.c b/src/tss2-esys/api/Esys_EC_Ephemeral.c
index d23e8f2..f3f0703 100644
--- a/src/tss2-esys/api/Esys_EC_Ephemeral.c
+++ b/src/tss2-esys/api/Esys_EC_Ephemeral.c
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_EC_Ephemeral_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- curveID);
+ r = Esys_EC_Ephemeral_Async(esysContext, shandle1, shandle2, shandle3,
+ curveID);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -91,9 +88,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_EC_Ephemeral_Finish(esysContext,
- Q,
- counter);
+ r = Esys_EC_Ephemeral_Finish(esysContext, Q, counter);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -162,12 +157,10 @@
/* Check and store 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,
- curveID);
+ store_input_parameters(esysContext, curveID);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_EC_Ephemeral_Prepare(esysContext->sys,
- curveID);
+ r = Tss2_Sys_EC_Ephemeral_Prepare(esysContext->sys, curveID);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -179,14 +172,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -272,11 +268,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_EC_Ephemeral_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.EC_Ephemeral.curveID);
+ r = Esys_EC_Ephemeral_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.EC_Ephemeral.curveID);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -304,16 +299,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_EC_Ephemeral_Complete(esysContext->sys,
- (Q != NULL) ? *Q : NULL,
- counter);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (Q != NULL) ? *Q : NULL, counter);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_EncryptDecrypt.c b/src/tss2-esys/api/Esys_EncryptDecrypt.c
index d84ea82..11db023 100644
--- a/src/tss2-esys/api/Esys_EncryptDecrypt.c
+++ b/src/tss2-esys/api/Esys_EncryptDecrypt.c
@@ -80,9 +80,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -105,15 +105,8 @@
{
TSS2_RC r;
- r = Esys_EncryptDecrypt_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- decrypt,
- mode,
- ivIn,
- inData);
+ r = Esys_EncryptDecrypt_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, decrypt, mode, ivIn, inData);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -127,9 +120,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_EncryptDecrypt_Finish(esysContext,
- outData,
- ivOut);
+ r = Esys_EncryptDecrypt_Finish(esysContext, outData, ivOut);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -173,9 +164,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -213,11 +204,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyHandle,
- decrypt,
- mode,
- ivIn,
- inData);
+ store_input_parameters(esysContext, keyHandle, decrypt, mode, ivIn, inData);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -225,11 +212,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_EncryptDecrypt_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- decrypt,
- mode,
- ivIn,
- inData);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, decrypt,
+ mode, ivIn, inData);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -242,14 +227,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -342,14 +330,14 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_EncryptDecrypt_Async(esysContext,
- esysContext->in.EncryptDecrypt.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.EncryptDecrypt.decrypt,
- esysContext->in.EncryptDecrypt.mode,
- esysContext->in.EncryptDecrypt.ivIn,
- esysContext->in.EncryptDecrypt.inData);
+ esysContext->in.EncryptDecrypt.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.EncryptDecrypt.decrypt,
+ esysContext->in.EncryptDecrypt.mode,
+ esysContext->in.EncryptDecrypt.ivIn,
+ esysContext->in.EncryptDecrypt.inData);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -377,16 +365,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_EncryptDecrypt_Complete(esysContext->sys,
- (outData != NULL) ? *outData : NULL,
- (ivOut != NULL) ? *ivOut : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outData != NULL) ? *outData : NULL,
+ (ivOut != NULL) ? *ivOut : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_EncryptDecrypt2.c b/src/tss2-esys/api/Esys_EncryptDecrypt2.c
index ab345c8..fd57e74 100644
--- a/src/tss2-esys/api/Esys_EncryptDecrypt2.c
+++ b/src/tss2-esys/api/Esys_EncryptDecrypt2.c
@@ -80,9 +80,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -102,15 +102,8 @@
{
TSS2_RC r;
- r = Esys_EncryptDecrypt2_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- inData,
- decrypt,
- mode,
- ivIn);
+ r = Esys_EncryptDecrypt2_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, inData, decrypt, mode, ivIn);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,9 +117,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_EncryptDecrypt2_Finish(esysContext,
- outData,
- ivOut);
+ r = Esys_EncryptDecrypt2_Finish(esysContext, outData, ivOut);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -170,9 +161,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_EncryptDecrypt2_Async(
@@ -207,11 +198,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyHandle,
- inData,
- decrypt,
- mode,
- ivIn);
+ store_input_parameters(esysContext, keyHandle, inData, decrypt, mode, ivIn);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -219,11 +206,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_EncryptDecrypt2_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- inData,
- decrypt,
- mode,
- ivIn);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, inData,
+ decrypt, mode, ivIn);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -236,14 +221,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -336,14 +324,14 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_EncryptDecrypt2_Async(esysContext,
- esysContext->in.EncryptDecrypt2.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.EncryptDecrypt2.inData,
- esysContext->in.EncryptDecrypt2.decrypt,
- esysContext->in.EncryptDecrypt2.mode,
- esysContext->in.EncryptDecrypt2.ivIn);
+ esysContext->in.EncryptDecrypt2.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.EncryptDecrypt2.inData,
+ esysContext->in.EncryptDecrypt2.decrypt,
+ esysContext->in.EncryptDecrypt2.mode,
+ esysContext->in.EncryptDecrypt2.ivIn);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -371,16 +359,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_EncryptDecrypt2_Complete(esysContext->sys,
- (outData != NULL) ? *outData : NULL,
- (ivOut != NULL) ? *ivOut : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outData != NULL) ? *outData : NULL,
+ (ivOut != NULL) ? *ivOut : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_EventSequenceComplete.c b/src/tss2-esys/api/Esys_EventSequenceComplete.c
index 1450d86..f7e25b6 100644
--- a/src/tss2-esys/api/Esys_EventSequenceComplete.c
+++ b/src/tss2-esys/api/Esys_EventSequenceComplete.c
@@ -65,9 +65,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -87,13 +87,8 @@
{
TSS2_RC r;
- r = Esys_EventSequenceComplete_Async(esysContext,
- pcrHandle,
- sequenceHandle,
- shandle1,
- shandle2,
- shandle3,
- buffer);
+ r = Esys_EventSequenceComplete_Async(esysContext, pcrHandle, sequenceHandle,
+ shandle1, shandle2, shandle3, buffer);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -107,8 +102,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_EventSequenceComplete_Finish(esysContext,
- results);
+ r = Esys_EventSequenceComplete_Finish(esysContext, results);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -149,9 +143,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -187,8 +181,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, pcrHandle, sequenceHandle,
- buffer);
+ store_input_parameters(esysContext, pcrHandle, sequenceHandle, buffer);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, pcrHandle, &pcrHandleNode);
@@ -198,9 +191,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_EventSequenceComplete_Prepare(esysContext->sys,
- (pcrHandleNode == NULL) ? TPM2_RH_NULL : pcrHandleNode->rsrc.handle,
- (sequenceHandleNode == NULL) ? TPM2_RH_NULL : sequenceHandleNode->rsrc.handle,
- buffer);
+ (pcrHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : pcrHandleNode->rsrc.handle,
+ (sequenceHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : sequenceHandleNode->rsrc.handle,
+ buffer);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -214,14 +211,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, pcrHandleNode, sequenceHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -305,12 +305,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_EventSequenceComplete_Async(esysContext,
- esysContext->in.EventSequenceComplete.pcrHandle,
- esysContext->in.EventSequenceComplete.sequenceHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.EventSequenceComplete.buffer);
+ esysContext->in.EventSequenceComplete.pcrHandle,
+ esysContext->in.EventSequenceComplete.sequenceHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.EventSequenceComplete.buffer);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -338,15 +338,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_EventSequenceComplete_Complete(esysContext->sys,
- (results != NULL) ? *results : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (results != NULL) ? *results
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_EvictControl.c b/src/tss2-esys/api/Esys_EvictControl.c
index dc25f17..1df7be6 100644
--- a/src/tss2-esys/api/Esys_EvictControl.c
+++ b/src/tss2-esys/api/Esys_EvictControl.c
@@ -39,8 +39,8 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] persistentHandle If objectHandle is a transient object handle, then
- * this is the persistent handle for the object.
+ * @param[in] persistentHandle If objectHandle is a transient object handle,
+ * then this is the persistent handle for the object.
* @param[out] newObjectHandle ESYS_TR handle of ESYS resource for TPM2_HANDLE.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -59,9 +59,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -79,18 +79,12 @@
ESYS_TR shandle1,
ESYS_TR shandle2,
ESYS_TR shandle3,
- TPMI_DH_PERSISTENT persistentHandle,
- ESYS_TR *newObjectHandle)
+ TPMI_DH_PERSISTENT persistentHandle, ESYS_TR *newObjectHandle)
{
TSS2_RC r;
- r = Esys_EvictControl_Async(esysContext,
- auth,
- objectHandle,
- shandle1,
- shandle2,
- shandle3,
- persistentHandle);
+ r = Esys_EvictControl_Async(esysContext, auth, objectHandle, shandle1,
+ shandle2, shandle3, persistentHandle);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,8 +98,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_EvictControl_Finish(esysContext,
- newObjectHandle);
+ r = Esys_EvictControl_Finish(esysContext, newObjectHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -133,8 +126,8 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] persistentHandle If objectHandle is a transient object handle, then
- * this is the persistent handle for the object.
+ * @param[in] persistentHandle If objectHandle is a transient object handle,
+ * then this is the persistent handle for the object.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -147,9 +140,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -188,8 +181,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth, objectHandle,
- persistentHandle);
+ store_input_parameters(esysContext, auth, objectHandle, persistentHandle);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -204,9 +196,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_EvictControl_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle,
- persistentHandle);
+ (authNode == NULL) ? TPM2_RH_NULL
+ : authNode->rsrc.handle,
+ (objectHandleNode == NULL) ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle,
+ persistentHandle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -219,14 +213,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, objectHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -263,8 +260,7 @@
*/
TSS2_RC
Esys_EvictControl_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *newObjectHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *newObjectHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, newObjectHandle=%p",
@@ -313,12 +309,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_EvictControl_Async(esysContext,
- esysContext->in.EvictControl.auth,
- esysContext->in.EvictControl.objectHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.EvictControl.persistentHandle);
+ esysContext->in.EvictControl.auth,
+ esysContext->in.EvictControl.objectHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.EvictControl.persistentHandle);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -346,14 +342,17 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_EvictControl_Complete(esysContext->sys);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
ESYS_TR objectHandle = esysContext->in.EvictControl.objectHandle;
RSRC_NODE_T *objectHandleNode;
r = esys_GetResourceObject(esysContext, objectHandle, &objectHandleNode);
diff --git a/src/tss2-esys/api/Esys_FieldUpgradeData.c b/src/tss2-esys/api/Esys_FieldUpgradeData.c
index 04bbe16..2b0d090 100644
--- a/src/tss2-esys/api/Esys_FieldUpgradeData.c
+++ b/src/tss2-esys/api/Esys_FieldUpgradeData.c
@@ -79,11 +79,8 @@
{
TSS2_RC r;
- r = Esys_FieldUpgradeData_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- fuData);
+ r = Esys_FieldUpgradeData_Async(esysContext, shandle1, shandle2, shandle3,
+ fuData);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -97,9 +94,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_FieldUpgradeData_Finish(esysContext,
- nextDigest,
- firstDigest);
+ r = Esys_FieldUpgradeData_Finish(esysContext, nextDigest, firstDigest);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -168,12 +163,10 @@
/* Check and store 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,
- fuData);
+ store_input_parameters(esysContext, fuData);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_FieldUpgradeData_Prepare(esysContext->sys,
- fuData);
+ r = Tss2_Sys_FieldUpgradeData_Prepare(esysContext->sys, fuData);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -185,14 +178,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -285,10 +281,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_FieldUpgradeData_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.FieldUpgradeData.fuData);
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.FieldUpgradeData.fuData);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -316,16 +312,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_FieldUpgradeData_Complete(esysContext->sys,
- (nextDigest != NULL) ? *nextDigest : NULL,
- (firstDigest != NULL) ? *firstDigest : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (nextDigest != NULL) ? *nextDigest
+ : NULL,
+ (firstDigest != NULL) ? *firstDigest
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_FieldUpgradeStart.c b/src/tss2-esys/api/Esys_FieldUpgradeStart.c
index 95c26f9..f9acf09 100644
--- a/src/tss2-esys/api/Esys_FieldUpgradeStart.c
+++ b/src/tss2-esys/api/Esys_FieldUpgradeStart.c
@@ -56,8 +56,8 @@
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] fuDigest Digest of the first block in the field upgrade sequence.
- * @param[in] manifestSignature Signature over fuDigest using the key associated
- * with keyHandle (not optional).
+ * @param[in] manifestSignature Signature over fuDigest using the key
+ * associated with keyHandle (not optional).
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -75,9 +75,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -97,14 +97,9 @@
{
TSS2_RC r;
- r = Esys_FieldUpgradeStart_Async(esysContext,
- authorization,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- fuDigest,
- manifestSignature);
+ r = Esys_FieldUpgradeStart_Async(esysContext, authorization, keyHandle,
+ shandle1, shandle2, shandle3, fuDigest,
+ manifestSignature);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -149,8 +144,8 @@
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] fuDigest Digest of the first block in the field upgrade sequence.
- * @param[in] manifestSignature Signature over fuDigest using the key associated
- * with keyHandle (not optional).
+ * @param[in] manifestSignature Signature over fuDigest using the key
+ * associated with keyHandle (not optional).
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -163,9 +158,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -202,9 +197,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authorization, keyHandle,
- fuDigest,
- manifestSignature);
+ store_input_parameters(esysContext, authorization, keyHandle, fuDigest,
+ manifestSignature);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authorization, &authorizationNode);
@@ -214,10 +208,12 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_FieldUpgradeStart_Prepare(esysContext->sys,
- (authorizationNode == NULL) ? TPM2_RH_NULL : authorizationNode->rsrc.handle,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- fuDigest,
- manifestSignature);
+ (authorizationNode == NULL)
+ ? TPM2_RH_NULL
+ : authorizationNode->rsrc.handle,
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle,
+ fuDigest, manifestSignature);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -230,14 +226,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authorizationNode, keyHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -310,13 +309,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_FieldUpgradeStart_Async(esysContext,
- esysContext->in.FieldUpgradeStart.authorization,
- esysContext->in.FieldUpgradeStart.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.FieldUpgradeStart.fuDigest,
- esysContext->in.FieldUpgradeStart.manifestSignature);
+ esysContext->in.FieldUpgradeStart.authorization,
+ esysContext->in.FieldUpgradeStart.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.FieldUpgradeStart.fuDigest,
+ esysContext->in.FieldUpgradeStart.manifestSignature);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -343,14 +342,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_FieldUpgradeStart_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_FirmwareRead.c b/src/tss2-esys/api/Esys_FirmwareRead.c
index b07dbd5..d3fa3eb 100644
--- a/src/tss2-esys/api/Esys_FirmwareRead.c
+++ b/src/tss2-esys/api/Esys_FirmwareRead.c
@@ -33,8 +33,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] sequenceNumber The number of previous calls to this command in this
- * sequence.
+ * @param[in] sequenceNumber The number of previous calls to this command in
+ * this sequence.
* @param[out] fuData Field upgrade image data.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
@@ -71,11 +71,8 @@
{
TSS2_RC r;
- r = Esys_FirmwareRead_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- sequenceNumber);
+ r = Esys_FirmwareRead_Async(esysContext, shandle1, shandle2, shandle3,
+ sequenceNumber);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -89,8 +86,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_FirmwareRead_Finish(esysContext,
- fuData);
+ r = Esys_FirmwareRead_Finish(esysContext, fuData);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -116,8 +112,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] sequenceNumber The number of previous calls to this command in this
- * sequence.
+ * @param[in] sequenceNumber The number of previous calls to this command in
+ * this sequence.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -160,12 +156,10 @@
/* Check and store 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,
- sequenceNumber);
+ store_input_parameters(esysContext, sequenceNumber);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_FirmwareRead_Prepare(esysContext->sys,
- sequenceNumber);
+ r = Tss2_Sys_FirmwareRead_Prepare(esysContext->sys, sequenceNumber);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -177,14 +171,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,11 +264,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_FirmwareRead_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.FirmwareRead.sequenceNumber);
+ r = Esys_FirmwareRead_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.FirmwareRead.sequenceNumber);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -299,15 +295,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_FirmwareRead_Complete(esysContext->sys,
- (fuData != NULL) ? *fuData : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (fuData != NULL) ? *fuData : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_FlushContext.c b/src/tss2-esys/api/Esys_FlushContext.c
index 8f001ec..0b3cdfc 100644
--- a/src/tss2-esys/api/Esys_FlushContext.c
+++ b/src/tss2-esys/api/Esys_FlushContext.c
@@ -44,9 +44,9 @@
* @retval TSS2_ESYS_RC_MALFORMED_RESPONSE: if the TPM's response is corrupted.
* @retval TSS2_ESYS_RC_RSP_AUTH_FAILED: if the response HMAC from the TPM
did not verify.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -57,8 +57,7 @@
{
TSS2_RC r;
- r = Esys_FlushContext_Async(esysContext,
- flushHandle);
+ r = Esys_FlushContext_Async(esysContext, flushHandle);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,9 +103,9 @@
* internal operations or return parameters.
* @retval TSS2_RCs produced by lower layers of the software stack may be
returned to the caller unaltered unless handled internally.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_FlushContext_Async(
@@ -135,11 +134,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_FlushContext_Prepare(esysContext->sys,
- (flushHandleNode == NULL) ? TPM2_RH_NULL : flushHandleNode->rsrc.handle);
+ (flushHandleNode == NULL) ? TPM2_RH_NULL
+ : flushHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -212,7 +213,7 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_FlushContext_Async(esysContext,
- esysContext->in.FlushContext.flushHandle);
+ esysContext->in.FlushContext.flushHandle);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -234,8 +235,9 @@
return r;
}
r = Tss2_Sys_FlushContext_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
/* The ESYS_TR object has to be invalidated */
r = Esys_TR_Close(esysContext, &esysContext->in.FlushContext.flushHandle);
return_if_error(r, "invalidate object");
diff --git a/src/tss2-esys/api/Esys_GetCapability.c b/src/tss2-esys/api/Esys_GetCapability.c
index 7e29dc0..b7d902a 100644
--- a/src/tss2-esys/api/Esys_GetCapability.c
+++ b/src/tss2-esys/api/Esys_GetCapability.c
@@ -37,9 +37,11 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] capability Group selection; determines the format of the response.
+ * @param[in] capability Group selection; determines the format of the
+ * response.
* @param[in] property Further definition of information.
- * @param[in] propertyCount Number of properties of the indicated type to return.
+ * @param[in] propertyCount Number of properties of the indicated type to
+ * return.
* @param[out] moreData Flag to indicate if there are more values of this type.
* (callee-allocated)
* @param[out] capabilityData The capability data.
@@ -84,13 +86,8 @@
{
TSS2_RC r;
- r = Esys_GetCapability_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- capability,
- property,
- propertyCount);
+ r = Esys_GetCapability_Async(esysContext, shandle1, shandle2, shandle3,
+ capability, property, propertyCount);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,9 +101,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetCapability_Finish(esysContext,
- moreData,
- capabilityData);
+ r = Esys_GetCapability_Finish(esysContext, moreData, capabilityData);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -132,9 +127,11 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] capability Group selection; determines the format of the response.
+ * @param[in] capability Group selection; determines the format of the
+ * response.
* @param[in] property Further definition of information.
- * @param[in] propertyCount Number of properties of the indicated type to return.
+ * @param[in] propertyCount Number of properties of the indicated type to
+ * return.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -183,16 +180,11 @@
/* Check and store 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,
- capability,
- property,
- propertyCount);
+ store_input_parameters(esysContext, capability, property, propertyCount);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_GetCapability_Prepare(esysContext->sys,
- capability,
- property,
- propertyCount);
+ r = Tss2_Sys_GetCapability_Prepare(esysContext->sys, capability, property,
+ propertyCount);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -204,14 +196,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -297,13 +292,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_GetCapability_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.GetCapability.capability,
- esysContext->in.GetCapability.property,
- esysContext->in.GetCapability.propertyCount);
+ r = Esys_GetCapability_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.GetCapability.capability,
+ esysContext->in.GetCapability.property,
+ esysContext->in.GetCapability.propertyCount);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -331,16 +325,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
- r = Tss2_Sys_GetCapability_Complete(esysContext->sys,
- moreData,
- (capabilityData != NULL) ? *capabilityData : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ r = Tss2_Sys_GetCapability_Complete(esysContext->sys, moreData,
+ (capabilityData != NULL)
+ ? *capabilityData : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_GetCommandAuditDigest.c b/src/tss2-esys/api/Esys_GetCommandAuditDigest.c
index a245431..98c0285 100644
--- a/src/tss2-esys/api/Esys_GetCommandAuditDigest.c
+++ b/src/tss2-esys/api/Esys_GetCommandAuditDigest.c
@@ -78,9 +78,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -99,14 +99,9 @@
{
TSS2_RC r;
- r = Esys_GetCommandAuditDigest_Async(esysContext,
- privacyHandle,
- signHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme);
+ r = Esys_GetCommandAuditDigest_Async(esysContext, privacyHandle, signHandle,
+ shandle1, shandle2, shandle3,
+ qualifyingData, inScheme);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -120,9 +115,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetCommandAuditDigest_Finish(esysContext,
- auditInfo,
- signature);
+ r = Esys_GetCommandAuditDigest_Finish(esysContext, auditInfo,
+ signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -166,9 +160,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_GetCommandAuditDigest_Async(
@@ -203,8 +197,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, privacyHandle, signHandle,
- qualifyingData,
- inScheme);
+ qualifyingData, inScheme);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, privacyHandle, &privacyHandleNode);
@@ -214,10 +207,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_GetCommandAuditDigest_Prepare(esysContext->sys,
- (privacyHandleNode == NULL) ? TPM2_RH_NULL : privacyHandleNode->rsrc.handle,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- qualifyingData,
- inScheme);
+ (privacyHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : privacyHandleNode->rsrc.handle,
+ (signHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle,
+ qualifyingData, inScheme);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -231,14 +227,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, privacyHandleNode, signHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -331,13 +330,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_GetCommandAuditDigest_Async(esysContext,
- esysContext->in.GetCommandAuditDigest.privacyHandle,
- esysContext->in.GetCommandAuditDigest.signHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.GetCommandAuditDigest.qualifyingData,
- esysContext->in.GetCommandAuditDigest.inScheme);
+ esysContext->in.GetCommandAuditDigest.privacyHandle,
+ esysContext->in.GetCommandAuditDigest.signHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.GetCommandAuditDigest.qualifyingData,
+ esysContext->in.GetCommandAuditDigest.inScheme);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -365,16 +364,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_GetCommandAuditDigest_Complete(esysContext->sys,
- (auditInfo != NULL) ? *auditInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (auditInfo != NULL) ? *auditInfo
+ : NULL,
+ (signature != NULL) ? *signature
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_GetRandom.c b/src/tss2-esys/api/Esys_GetRandom.c
index 7b268e5..703a3c2 100644
--- a/src/tss2-esys/api/Esys_GetRandom.c
+++ b/src/tss2-esys/api/Esys_GetRandom.c
@@ -70,11 +70,8 @@
{
TSS2_RC r;
- r = Esys_GetRandom_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- bytesRequested);
+ r = Esys_GetRandom_Async(esysContext, shandle1, shandle2, shandle3,
+ bytesRequested);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -88,8 +85,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetRandom_Finish(esysContext,
- randomBytes);
+ r = Esys_GetRandom_Finish(esysContext, randomBytes);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -158,12 +154,10 @@
/* Check and store 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,
- bytesRequested);
+ store_input_parameters(esysContext, bytesRequested);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_GetRandom_Prepare(esysContext->sys,
- bytesRequested);
+ r = Tss2_Sys_GetRandom_Prepare(esysContext->sys, bytesRequested);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -175,14 +169,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -265,11 +262,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_GetRandom_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.GetRandom.bytesRequested);
+ r = Esys_GetRandom_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.GetRandom.bytesRequested);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,15 +293,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_GetRandom_Complete(esysContext->sys,
- (randomBytes != NULL) ? *randomBytes : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (randomBytes != NULL) ? *randomBytes
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_GetSessionAuditDigest.c b/src/tss2-esys/api/Esys_GetSessionAuditDigest.c
index c665611..be745c4 100644
--- a/src/tss2-esys/api/Esys_GetSessionAuditDigest.c
+++ b/src/tss2-esys/api/Esys_GetSessionAuditDigest.c
@@ -57,7 +57,8 @@
* @param[in] shandle1 Session handle for authorization of privacyAdminHandle
* @param[in] shandle2 Session handle for authorization of signHandle
* @param[in] shandle3 Third session handle.
- * @param[in] qualifyingData User-provided qualifying data - may be zero-length.
+ * @param[in] qualifyingData User-provided qualifying data - may be
+ * zero-length.
* @param[in] inScheme TPM2_Signing scheme to use if the scheme for signHandle is
* TPM2_ALG_NULL.
* @param[out] auditInfo The audit information that was signed.
@@ -81,9 +82,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -103,15 +104,10 @@
{
TSS2_RC r;
- r = Esys_GetSessionAuditDigest_Async(esysContext,
- privacyAdminHandle,
- signHandle,
- sessionHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme);
+ r = Esys_GetSessionAuditDigest_Async(esysContext, privacyAdminHandle,
+ signHandle, sessionHandle, shandle1,
+ shandle2, shandle3, qualifyingData,
+ inScheme);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -125,9 +121,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetSessionAuditDigest_Finish(esysContext,
- auditInfo,
- signature);
+ r = Esys_GetSessionAuditDigest_Finish(esysContext, auditInfo,
+ signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -157,7 +152,8 @@
* @param[in] shandle1 Session handle for authorization of privacyAdminHandle
* @param[in] shandle2 Session handle for authorization of signHandle
* @param[in] shandle3 Third session handle.
- * @param[in] qualifyingData User-provided qualifying data - may be zero-length.
+ * @param[in] qualifyingData User-provided qualifying data - may be
+ * zero-length.
* @param[in] inScheme TPM2_Signing scheme to use if the scheme for signHandle is
* TPM2_ALG_NULL.
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -172,9 +168,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_GetSessionAuditDigest_Async(
@@ -211,9 +207,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, privacyAdminHandle, signHandle, sessionHandle,
- qualifyingData,
- inScheme);
+ store_input_parameters(esysContext, privacyAdminHandle, signHandle,
+ sessionHandle, qualifyingData, inScheme);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, privacyAdminHandle, &privacyAdminHandleNode);
@@ -225,11 +220,16 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_GetSessionAuditDigest_Prepare(esysContext->sys,
- (privacyAdminHandleNode == NULL) ? TPM2_RH_NULL : privacyAdminHandleNode->rsrc.handle,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- (sessionHandleNode == NULL) ? TPM2_RH_NULL : sessionHandleNode->rsrc.handle,
- qualifyingData,
- inScheme);
+ (privacyAdminHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : privacyAdminHandleNode->rsrc.handle,
+ (signHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle,
+ (sessionHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : sessionHandleNode->rsrc.handle,
+ qualifyingData, inScheme);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -243,14 +243,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, privacyAdminHandleNode, signHandleNode, sessionHandleNode, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -343,14 +346,14 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_GetSessionAuditDigest_Async(esysContext,
- esysContext->in.GetSessionAuditDigest.privacyAdminHandle,
- esysContext->in.GetSessionAuditDigest.signHandle,
- esysContext->in.GetSessionAuditDigest.sessionHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.GetSessionAuditDigest.qualifyingData,
- esysContext->in.GetSessionAuditDigest.inScheme);
+ esysContext->in.GetSessionAuditDigest.privacyAdminHandle,
+ esysContext->in.GetSessionAuditDigest.signHandle,
+ esysContext->in.GetSessionAuditDigest.sessionHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.GetSessionAuditDigest.qualifyingData,
+ esysContext->in.GetSessionAuditDigest.inScheme);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -378,16 +381,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_GetSessionAuditDigest_Complete(esysContext->sys,
- (auditInfo != NULL) ? *auditInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (auditInfo != NULL) ? *auditInfo
+ : NULL,
+ (signature != NULL) ? *signature
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_GetTestResult.c b/src/tss2-esys/api/Esys_GetTestResult.c
index efcf75d..9c38323 100644
--- a/src/tss2-esys/api/Esys_GetTestResult.c
+++ b/src/tss2-esys/api/Esys_GetTestResult.c
@@ -64,10 +64,7 @@
{
TSS2_RC r;
- r = Esys_GetTestResult_Async(esysContext,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_GetTestResult_Async(esysContext, shandle1, shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -81,9 +78,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetTestResult_Finish(esysContext,
- outData,
- testResult);
+ r = Esys_GetTestResult_Finish(esysContext, outData, testResult);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -164,14 +159,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -257,10 +255,9 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_GetTestResult_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ r = Esys_GetTestResult_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -288,16 +285,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_GetTestResult_Complete(esysContext->sys,
- (outData != NULL) ? *outData : NULL,
- testResult);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outData != NULL) ? *outData : NULL,
+ testResult);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_GetTime.c b/src/tss2-esys/api/Esys_GetTime.c
index ab50336..5bd934e 100644
--- a/src/tss2-esys/api/Esys_GetTime.c
+++ b/src/tss2-esys/api/Esys_GetTime.c
@@ -79,9 +79,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -100,14 +100,8 @@
{
TSS2_RC r;
- r = Esys_GetTime_Async(esysContext,
- privacyAdminHandle,
- signHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme);
+ r = Esys_GetTime_Async(esysContext, privacyAdminHandle, signHandle, shandle1,
+ shandle2, shandle3, qualifyingData, inScheme);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -121,9 +115,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_GetTime_Finish(esysContext,
- timeInfo,
- signature);
+ r = Esys_GetTime_Finish(esysContext, timeInfo, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -168,9 +160,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_GetTime_Async(
@@ -205,8 +197,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, privacyAdminHandle, signHandle,
- qualifyingData,
- inScheme);
+ qualifyingData, inScheme);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, privacyAdminHandle, &privacyAdminHandleNode);
@@ -216,10 +207,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_GetTime_Prepare(esysContext->sys,
- (privacyAdminHandleNode == NULL) ? TPM2_RH_NULL : privacyAdminHandleNode->rsrc.handle,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- qualifyingData,
- inScheme);
+ (privacyAdminHandleNode == NULL) ? TPM2_RH_NULL
+ : privacyAdminHandleNode->rsrc.handle,
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle, qualifyingData,
+ inScheme);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -233,14 +225,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, privacyAdminHandleNode, signHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -333,13 +328,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_GetTime_Async(esysContext,
- esysContext->in.GetTime.privacyAdminHandle,
- esysContext->in.GetTime.signHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.GetTime.qualifyingData,
- esysContext->in.GetTime.inScheme);
+ esysContext->in.GetTime.privacyAdminHandle,
+ esysContext->in.GetTime.signHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.GetTime.qualifyingData,
+ esysContext->in.GetTime.inScheme);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -367,16 +362,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_GetTime_Complete(esysContext->sys,
- (timeInfo != NULL) ? *timeInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (timeInfo != NULL) ? *timeInfo : NULL,
+ (signature != NULL) ? *signature : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_HMAC.c b/src/tss2-esys/api/Esys_HMAC.c
index c962c05..203f017 100644
--- a/src/tss2-esys/api/Esys_HMAC.c
+++ b/src/tss2-esys/api/Esys_HMAC.c
@@ -40,7 +40,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] handle Handle for the symmetric signing key providing the HMAC key.
+ * @param[in] handle Handle for the symmetric signing key providing the HMAC
+ * key.
* @param[in] shandle1 Session handle for authorization of handle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -65,9 +66,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -84,13 +85,8 @@
{
TSS2_RC r;
- r = Esys_HMAC_Async(esysContext,
- handle,
- shandle1,
- shandle2,
- shandle3,
- buffer,
- hashAlg);
+ r = Esys_HMAC_Async(esysContext, handle, shandle1, shandle2, shandle3,
+ buffer, hashAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,8 +100,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_HMAC_Finish(esysContext,
- outHMAC);
+ r = Esys_HMAC_Finish(esysContext, outHMAC);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -128,7 +123,8 @@
* In order to retrieve the TPM's response call Esys_HMAC_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] handle Handle for the symmetric signing key providing the HMAC key.
+ * @param[in] handle Handle for the symmetric signing key providing the HMAC
+ * key.
* @param[in] shandle1 Session handle for authorization of handle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -146,9 +142,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_HMAC_Async(
@@ -180,9 +176,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, handle,
- buffer,
- hashAlg);
+ store_input_parameters(esysContext, handle, buffer, hashAlg);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, handle, &handleNode);
@@ -190,9 +184,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_HMAC_Prepare(esysContext->sys,
- (handleNode == NULL) ? TPM2_RH_NULL : handleNode->rsrc.handle,
- buffer,
- hashAlg);
+ (handleNode == NULL) ? TPM2_RH_NULL
+ : handleNode->rsrc.handle, buffer, hashAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -205,14 +198,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, handleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -295,13 +291,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_HMAC_Async(esysContext,
- esysContext->in.HMAC.handle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.HMAC.buffer,
- esysContext->in.HMAC.hashAlg);
+ r = Esys_HMAC_Async(esysContext, esysContext->in.HMAC.handle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.HMAC.buffer,
+ esysContext->in.HMAC.hashAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -329,15 +324,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_HMAC_Complete(esysContext->sys,
- (outHMAC != NULL) ? *outHMAC : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outHMAC != NULL) ? *outHMAC : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_HMAC_Start.c b/src/tss2-esys/api/Esys_HMAC_Start.c
index 43d5162..f38cef0 100644
--- a/src/tss2-esys/api/Esys_HMAC_Start.c
+++ b/src/tss2-esys/api/Esys_HMAC_Start.c
@@ -64,9 +64,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -81,18 +81,12 @@
ESYS_TR shandle2,
ESYS_TR shandle3,
const TPM2B_AUTH *auth,
- TPMI_ALG_HASH hashAlg,
- ESYS_TR *sequenceHandle)
+ TPMI_ALG_HASH hashAlg, ESYS_TR *sequenceHandle)
{
TSS2_RC r;
- r = Esys_HMAC_Start_Async(esysContext,
- handle,
- shandle1,
- shandle2,
- shandle3,
- auth,
- hashAlg);
+ r = Esys_HMAC_Start_Async(esysContext, handle, shandle1, shandle2, shandle3,
+ auth, hashAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -106,8 +100,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_HMAC_Start_Finish(esysContext,
- sequenceHandle);
+ r = Esys_HMAC_Start_Finish(esysContext, sequenceHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -148,9 +141,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -185,9 +178,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, handle,
- auth,
- hashAlg);
+ store_input_parameters(esysContext, handle, auth, hashAlg);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, handle, &handleNode);
@@ -195,9 +186,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_HMAC_Start_Prepare(esysContext->sys,
- (handleNode == NULL) ? TPM2_RH_NULL : handleNode->rsrc.handle,
- auth,
- hashAlg);
+ (handleNode == NULL) ? TPM2_RH_NULL
+ : handleNode->rsrc.handle, auth, hashAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -210,14 +200,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, handleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -254,8 +247,7 @@
*/
TSS2_RC
Esys_HMAC_Start_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *sequenceHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *sequenceHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, sequenceHandle=%p",
@@ -303,13 +295,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_HMAC_Start_Async(esysContext,
- esysContext->in.HMAC_Start.handle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.HMAC_Start.auth,
- esysContext->in.HMAC_Start.hashAlg);
+ r = Esys_HMAC_Start_Async(esysContext, esysContext->in.HMAC_Start.handle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.HMAC_Start.auth,
+ esysContext->in.HMAC_Start.hashAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -337,15 +328,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_HMAC_Start_Complete(esysContext->sys,
- &sequenceHandleNode->rsrc.handle);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &sequenceHandleNode->rsrc.handle);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* The name of a sequence object is an empty buffer */
sequenceHandleNode->rsrc.name.size = 0;
diff --git a/src/tss2-esys/api/Esys_Hash.c b/src/tss2-esys/api/Esys_Hash.c
index 888e389..6170334 100644
--- a/src/tss2-esys/api/Esys_Hash.c
+++ b/src/tss2-esys/api/Esys_Hash.c
@@ -86,13 +86,8 @@
{
TSS2_RC r;
- r = Esys_Hash_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- data,
- hashAlg,
- hierarchy);
+ r = Esys_Hash_Async(esysContext, shandle1, shandle2, shandle3, data, hashAlg,
+ hierarchy);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -106,9 +101,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Hash_Finish(esysContext,
- outHash,
- validation);
+ r = Esys_Hash_Finish(esysContext, outHash, validation);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -180,16 +173,10 @@
/* Check and store 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,
- data,
- hashAlg,
- hierarchy);
+ store_input_parameters(esysContext, data, hashAlg, hierarchy);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_Hash_Prepare(esysContext->sys,
- data,
- hashAlg,
- hierarchy);
+ r = Tss2_Sys_Hash_Prepare(esysContext->sys, data, hashAlg, hierarchy);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -201,14 +188,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -301,13 +291,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Hash_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Hash.data,
- esysContext->in.Hash.hashAlg,
- esysContext->in.Hash.hierarchy);
+ r = Esys_Hash_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Hash.data,
+ esysContext->in.Hash.hashAlg,
+ esysContext->in.Hash.hierarchy);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -335,16 +324,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Hash_Complete(esysContext->sys,
- (outHash != NULL) ? *outHash : NULL,
- (validation != NULL) ? *validation : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outHash != NULL) ? *outHash : NULL,
+ (validation != NULL) ? *validation : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_HashSequenceStart.c b/src/tss2-esys/api/Esys_HashSequenceStart.c
index 1d1109d..0fd125d 100644
--- a/src/tss2-esys/api/Esys_HashSequenceStart.c
+++ b/src/tss2-esys/api/Esys_HashSequenceStart.c
@@ -74,17 +74,12 @@
ESYS_TR shandle2,
ESYS_TR shandle3,
const TPM2B_AUTH *auth,
- TPMI_ALG_HASH hashAlg,
- ESYS_TR *sequenceHandle)
+ TPMI_ALG_HASH hashAlg, ESYS_TR *sequenceHandle)
{
TSS2_RC r;
- r = Esys_HashSequenceStart_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- auth,
- hashAlg);
+ r = Esys_HashSequenceStart_Async(esysContext, shandle1, shandle2, shandle3,
+ auth, hashAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -98,8 +93,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_HashSequenceStart_Finish(esysContext,
- sequenceHandle);
+ r = Esys_HashSequenceStart_Finish(esysContext, sequenceHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -170,14 +164,10 @@
/* Check and store 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,
- auth,
- hashAlg);
+ store_input_parameters(esysContext, auth, hashAlg);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_HashSequenceStart_Prepare(esysContext->sys,
- auth,
- hashAlg);
+ r = Tss2_Sys_HashSequenceStart_Prepare(esysContext->sys, auth, hashAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -189,14 +179,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -233,8 +226,7 @@
*/
TSS2_RC
Esys_HashSequenceStart_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *sequenceHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *sequenceHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, sequenceHandle=%p",
@@ -283,11 +275,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_HashSequenceStart_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.HashSequenceStart.auth,
- esysContext->in.HashSequenceStart.hashAlg);
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.HashSequenceStart.auth,
+ esysContext->in.HashSequenceStart.hashAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -315,15 +307,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_HashSequenceStart_Complete(esysContext->sys,
- &sequenceHandleNode->rsrc.handle);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &sequenceHandleNode->rsrc.handle);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
sequenceHandleNode->rsrc.name.size = 0;
esysContext->state = _ESYS_STATE_INIT;
diff --git a/src/tss2-esys/api/Esys_HierarchyChangeAuth.c b/src/tss2-esys/api/Esys_HierarchyChangeAuth.c
index 25b21ee..254a86d 100644
--- a/src/tss2-esys/api/Esys_HierarchyChangeAuth.c
+++ b/src/tss2-esys/api/Esys_HierarchyChangeAuth.c
@@ -61,9 +61,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -81,12 +81,8 @@
{
TSS2_RC r;
- r = Esys_HierarchyChangeAuth_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- newAuth);
+ r = Esys_HierarchyChangeAuth_Async(esysContext, authHandle, shandle1,
+ shandle2, shandle3, newAuth);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -141,9 +137,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -176,8 +172,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- newAuth);
+ store_input_parameters(esysContext, authHandle, newAuth);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -185,8 +180,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_HierarchyChangeAuth_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- newAuth);
+ (authHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ newAuth);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +196,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -282,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_HierarchyChangeAuth_Async(esysContext,
- esysContext->in.HierarchyChangeAuth.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.HierarchyChangeAuth.newAuth);
+ esysContext->in.HierarchyChangeAuth.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.HierarchyChangeAuth.newAuth);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -324,14 +324,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_HierarchyChangeAuth_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_HierarchyControl.c b/src/tss2-esys/api/Esys_HierarchyControl.c
index 7776239..a8703ba 100644
--- a/src/tss2-esys/api/Esys_HierarchyControl.c
+++ b/src/tss2-esys/api/Esys_HierarchyControl.c
@@ -34,13 +34,14 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle TPM2_RH_ENDORSEMENT, TPM2_RH_OWNER or TPM2_RH_PLATFORM+{PP}.
+ * @param[in] authHandle TPM2_RH_ENDORSEMENT, TPM2_RH_OWNER or
+ * TPM2_RH_PLATFORM+{PP}.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] enable The enable being modified.
- * @param[in] state YES if the enable should be SET, NO if the enable should be
- * CLEAR.
+ * @param[in] state YES if the enable should be SET, NO if the enable should
+ * be CLEAR.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -58,9 +59,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -82,13 +83,8 @@
{
TSS2_RC r;
- r = Esys_HierarchyControl_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- enable,
- state);
+ r = Esys_HierarchyControl_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, enable, state);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -125,13 +121,14 @@
* In order to retrieve the TPM's response call Esys_HierarchyControl_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle TPM2_RH_ENDORSEMENT, TPM2_RH_OWNER or TPM2_RH_PLATFORM+{PP}.
+ * @param[in] authHandle TPM2_RH_ENDORSEMENT, TPM2_RH_OWNER or
+ * TPM2_RH_PLATFORM+{PP}.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
* @param[in] enable The enable being modified.
- * @param[in] state YES if the enable should be SET, NO if the enable should be
- * CLEAR.
+ * @param[in] state YES if the enable should be SET, NO if the enable should
+ * be CLEAR.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -144,9 +141,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -184,9 +181,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- enable,
- state);
+ store_input_parameters(esysContext, authHandle, enable, state);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -194,9 +189,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_HierarchyControl_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- enable,
- state);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle, enable,
+ state);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -209,14 +204,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -289,12 +287,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_HierarchyControl_Async(esysContext,
- esysContext->in.HierarchyControl.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.HierarchyControl.enable,
- esysContext->in.HierarchyControl.state);
+ esysContext->in.HierarchyControl.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.HierarchyControl.enable,
+ esysContext->in.HierarchyControl.state);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -321,14 +319,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_HierarchyControl_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Import.c b/src/tss2-esys/api/Esys_Import.c
index 7e526b3..01108fe 100644
--- a/src/tss2-esys/api/Esys_Import.c
+++ b/src/tss2-esys/api/Esys_Import.c
@@ -80,10 +80,10 @@
* @param[in] duplicate The symmetrically encrypted duplicate object that may
* contain an inner symmetric wrapper.
* @param[in] inSymSeed The seed for the symmetric key and HMAC key.
- * @param[in] symmetricAlg Definition for the symmetric algorithm to use for the
- * inner wrapper.
- * @param[out] outPrivate The sensitive area encrypted with the symmetric key of
- * parentHandle.
+ * @param[in] symmetricAlg Definition for the symmetric algorithm to use for
+ * the inner wrapper.
+ * @param[out] outPrivate The sensitive area encrypted with the symmetric key
+ * of parentHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -102,9 +102,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -124,16 +124,9 @@
{
TSS2_RC r;
- r = Esys_Import_Async(esysContext,
- parentHandle,
- shandle1,
- shandle2,
- shandle3,
- encryptionKey,
- objectPublic,
- duplicate,
- inSymSeed,
- symmetricAlg);
+ r = Esys_Import_Async(esysContext, parentHandle, shandle1, shandle2,
+ shandle3, encryptionKey, objectPublic, duplicate,
+ inSymSeed, symmetricAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -147,8 +140,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Import_Finish(esysContext,
- outPrivate);
+ r = Esys_Import_Finish(esysContext, outPrivate);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -181,8 +173,8 @@
* @param[in] duplicate The symmetrically encrypted duplicate object that may
* contain an inner symmetric wrapper.
* @param[in] inSymSeed The seed for the symmetric key and HMAC key.
- * @param[in] symmetricAlg Definition for the symmetric algorithm to use for the
- * inner wrapper.
+ * @param[in] symmetricAlg Definition for the symmetric algorithm to use for
+ * the inner wrapper.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -195,9 +187,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Import_Async(
@@ -234,12 +226,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, parentHandle,
- encryptionKey,
- objectPublic,
- duplicate,
- inSymSeed,
- symmetricAlg);
+ store_input_parameters(esysContext, parentHandle, encryptionKey,
+ objectPublic, duplicate, inSymSeed, symmetricAlg);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, parentHandle, &parentHandleNode);
@@ -247,12 +235,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Import_Prepare(esysContext->sys,
- (parentHandleNode == NULL) ? TPM2_RH_NULL : parentHandleNode->rsrc.handle,
- encryptionKey,
- objectPublic,
- duplicate,
- inSymSeed,
- symmetricAlg);
+ (parentHandleNode == NULL) ? TPM2_RH_NULL
+ : parentHandleNode->rsrc.handle, encryptionKey,
+ objectPublic, duplicate, inSymSeed,
+ symmetricAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -265,14 +251,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, parentHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -287,8 +276,8 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] outPrivate The sensitive area encrypted with the symmetric key of
- * parentHandle.
+ * @param[out] outPrivate The sensitive area encrypted with the symmetric key
+ * of parentHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -356,16 +345,15 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Import_Async(esysContext,
- esysContext->in.Import.parentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Import.encryptionKey,
- esysContext->in.Import.objectPublic,
- esysContext->in.Import.duplicate,
- esysContext->in.Import.inSymSeed,
- esysContext->in.Import.symmetricAlg);
+ r = Esys_Import_Async(esysContext, esysContext->in.Import.parentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Import.encryptionKey,
+ esysContext->in.Import.objectPublic,
+ esysContext->in.Import.duplicate,
+ esysContext->in.Import.inSymSeed,
+ esysContext->in.Import.symmetricAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -393,15 +381,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Import_Complete(esysContext->sys,
- (outPrivate != NULL) ? *outPrivate : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outPrivate != NULL) ? *outPrivate : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_IncrementalSelfTest.c b/src/tss2-esys/api/Esys_IncrementalSelfTest.c
index 5903c04..f57fd15 100644
--- a/src/tss2-esys/api/Esys_IncrementalSelfTest.c
+++ b/src/tss2-esys/api/Esys_IncrementalSelfTest.c
@@ -79,11 +79,8 @@
{
TSS2_RC r;
- r = Esys_IncrementalSelfTest_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- toTest);
+ r = Esys_IncrementalSelfTest_Async(esysContext, shandle1, shandle2, shandle3,
+ toTest);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -97,8 +94,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_IncrementalSelfTest_Finish(esysContext,
- toDoList);
+ r = Esys_IncrementalSelfTest_Finish(esysContext, toDoList);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -170,12 +166,10 @@
/* Check and store 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,
- toTest);
+ store_input_parameters(esysContext, toTest);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_IncrementalSelfTest_Prepare(esysContext->sys,
- toTest);
+ r = Tss2_Sys_IncrementalSelfTest_Prepare(esysContext->sys, toTest);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -187,14 +181,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -278,10 +275,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_IncrementalSelfTest_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.IncrementalSelfTest.toTest);
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.IncrementalSelfTest.toTest);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -309,15 +306,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_IncrementalSelfTest_Complete(esysContext->sys,
- (toDoList != NULL) ? *toDoList : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (toDoList != NULL) ? *toDoList
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Load.c b/src/tss2-esys/api/Esys_Load.c
index ff0c09c..c9f4270 100644
--- a/src/tss2-esys/api/Esys_Load.c
+++ b/src/tss2-esys/api/Esys_Load.c
@@ -71,9 +71,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -85,18 +85,12 @@
ESYS_TR shandle2,
ESYS_TR shandle3,
const TPM2B_PRIVATE *inPrivate,
- const TPM2B_PUBLIC *inPublic,
- ESYS_TR *objectHandle)
+ const TPM2B_PUBLIC *inPublic, ESYS_TR *objectHandle)
{
TSS2_RC r;
- r = Esys_Load_Async(esysContext,
- parentHandle,
- shandle1,
- shandle2,
- shandle3,
- inPrivate,
- inPublic);
+ r = Esys_Load_Async(esysContext, parentHandle, shandle1, shandle2, shandle3,
+ inPrivate, inPublic);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -110,8 +104,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Load_Finish(esysContext,
- objectHandle);
+ r = Esys_Load_Finish(esysContext, objectHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -153,9 +146,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Load_Async(
@@ -187,9 +180,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, parentHandle,
- inPrivate,
- inPublic);
+ store_input_parameters(esysContext, parentHandle, inPrivate, inPublic);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, parentHandle, &parentHandleNode);
@@ -197,9 +188,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Load_Prepare(esysContext->sys,
- (parentHandleNode == NULL) ? TPM2_RH_NULL : parentHandleNode->rsrc.handle,
- inPrivate,
- inPublic);
+ (parentHandleNode == NULL) ? TPM2_RH_NULL
+ : parentHandleNode->rsrc.handle, inPrivate,
+ inPublic);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -212,14 +203,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, parentHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -256,8 +250,7 @@
*/
TSS2_RC
Esys_Load_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *objectHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *objectHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, objectHandle=%p",
@@ -310,13 +303,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Load_Async(esysContext,
- esysContext->in.Load.parentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Load.inPrivate,
- esysContext->in.Load.inPublic);
+ r = Esys_Load_Async(esysContext, esysContext->in.Load.parentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Load.inPrivate,
+ esysContext->in.Load.inPublic);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -344,16 +336,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
- r = Tss2_Sys_Load_Complete(esysContext->sys,
- &objectHandleNode->rsrc.handle,
- &name);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ r = Tss2_Sys_Load_Complete(esysContext->sys, &objectHandleNode->rsrc.handle,
+ &name);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* Check name and inPublic for consistency */
if (!iesys_compare_name(esysContext->in.Load.inPublic, &name)) {
diff --git a/src/tss2-esys/api/Esys_LoadExternal.c b/src/tss2-esys/api/Esys_LoadExternal.c
index 272877e..f25ae5d 100644
--- a/src/tss2-esys/api/Esys_LoadExternal.c
+++ b/src/tss2-esys/api/Esys_LoadExternal.c
@@ -81,18 +81,12 @@
ESYS_TR shandle3,
const TPM2B_SENSITIVE *inPrivate,
const TPM2B_PUBLIC *inPublic,
- TPMI_RH_HIERARCHY hierarchy,
- ESYS_TR *objectHandle)
+ TPMI_RH_HIERARCHY hierarchy, ESYS_TR *objectHandle)
{
TSS2_RC r;
- r = Esys_LoadExternal_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- inPrivate,
- inPublic,
- hierarchy);
+ r = Esys_LoadExternal_Async(esysContext, shandle1, shandle2, shandle3,
+ inPrivate, inPublic, hierarchy);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -106,8 +100,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_LoadExternal_Finish(esysContext,
- objectHandle);
+ r = Esys_LoadExternal_Finish(esysContext, objectHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -178,16 +171,11 @@
/* Check and store 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,
- inPrivate,
- inPublic,
- hierarchy);
+ store_input_parameters(esysContext, inPrivate, inPublic, hierarchy);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_LoadExternal_Prepare(esysContext->sys,
- inPrivate,
- inPublic,
- hierarchy);
+ r = Tss2_Sys_LoadExternal_Prepare(esysContext->sys, inPrivate, inPublic,
+ hierarchy);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +187,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -243,8 +234,7 @@
*/
TSS2_RC
Esys_LoadExternal_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *objectHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *objectHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, objectHandle=%p",
@@ -295,13 +285,12 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_LoadExternal_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.LoadExternal.inPrivate,
- esysContext->in.LoadExternal.inPublic,
- esysContext->in.LoadExternal.hierarchy);
+ r = Esys_LoadExternal_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.LoadExternal.inPrivate,
+ esysContext->in.LoadExternal.inPublic,
+ esysContext->in.LoadExternal.hierarchy);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -329,16 +318,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_LoadExternal_Complete(esysContext->sys,
- &objectHandleNode->rsrc.handle,
- &name);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &objectHandleNode->rsrc.handle, &name);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* check name against inPublic */
if (!iesys_compare_name(esysContext->in.LoadExternal.inPublic, &name)) {
diff --git a/src/tss2-esys/api/Esys_MakeCredential.c b/src/tss2-esys/api/Esys_MakeCredential.c
index 4726db3..53d8c68 100644
--- a/src/tss2-esys/api/Esys_MakeCredential.c
+++ b/src/tss2-esys/api/Esys_MakeCredential.c
@@ -75,9 +75,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -95,13 +95,8 @@
{
TSS2_RC r;
- r = Esys_MakeCredential_Async(esysContext,
- handle,
- shandle1,
- shandle2,
- shandle3,
- credential,
- objectName);
+ r = Esys_MakeCredential_Async(esysContext, handle, shandle1, shandle2,
+ shandle3, credential, objectName);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -115,9 +110,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_MakeCredential_Finish(esysContext,
- credentialBlob,
- secret);
+ r = Esys_MakeCredential_Finish(esysContext, credentialBlob, secret);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -159,9 +152,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_MakeCredential_Async(
@@ -193,9 +186,7 @@
/* Check and store 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, handle,
- credential,
- objectName);
+ store_input_parameters(esysContext, handle, credential, objectName);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, handle, &handleNode);
@@ -203,9 +194,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_MakeCredential_Prepare(esysContext->sys,
- (handleNode == NULL) ? TPM2_RH_NULL : handleNode->rsrc.handle,
- credential,
- objectName);
+ (handleNode == NULL) ? TPM2_RH_NULL
+ : handleNode->rsrc.handle, credential,
+ objectName);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -217,14 +208,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, handleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -318,12 +312,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_MakeCredential_Async(esysContext,
- esysContext->in.MakeCredential.handle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.MakeCredential.credential,
- esysContext->in.MakeCredential.objectName);
+ esysContext->in.MakeCredential.handle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.MakeCredential.credential,
+ esysContext->in.MakeCredential.objectName);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -351,16 +345,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_MakeCredential_Complete(esysContext->sys,
- (credentialBlob != NULL) ? *credentialBlob : NULL,
- (secret != NULL) ? *secret : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (credentialBlob != NULL)
+ ? *credentialBlob : NULL,
+ (secret != NULL) ? *secret : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_Certify.c b/src/tss2-esys/api/Esys_NV_Certify.c
index cb98fbd..fcd5816 100644
--- a/src/tss2-esys/api/Esys_NV_Certify.c
+++ b/src/tss2-esys/api/Esys_NV_Certify.c
@@ -54,9 +54,10 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] signHandle Handle of the key used to sign the attestation structure.
- * @param[in] authHandle Handle indicating the source of the authorization value
- * for the NV Index.
+ * @param[in] signHandle Handle of the key used to sign the attestation
+ * structure.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value for the NV Index.
* @param[in] nvIndex Index for the area to be certified.
* @param[in] shandle1 Session handle for authorization of signHandle
* @param[in] shandle2 Session handle for authorization of authHandle
@@ -68,8 +69,8 @@
* @param[in] offset Octet offset into the area.
* @param[out] certifyInfo The structure that was signed.
* (callee-allocated)
- * @param[out] signature The asymmetric signature over certifyInfo using the key
- * referenced by signHandle.
+ * @param[out] signature The asymmetric signature over certifyInfo using the
+ * key referenced by signHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -88,9 +89,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -112,17 +113,9 @@
{
TSS2_RC r;
- r = Esys_NV_Certify_Async(esysContext,
- signHandle,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme,
- size,
- offset);
+ r = Esys_NV_Certify_Async(esysContext, signHandle, authHandle, nvIndex,
+ shandle1, shandle2, shandle3, qualifyingData,
+ inScheme, size, offset);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +129,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_NV_Certify_Finish(esysContext,
- certifyInfo,
- signature);
+ r = Esys_NV_Certify_Finish(esysContext, certifyInfo, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -161,9 +152,10 @@
* In order to retrieve the TPM's response call Esys_NV_Certify_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] signHandle Handle of the key used to sign the attestation structure.
- * @param[in] authHandle Handle indicating the source of the authorization value
- * for the NV Index.
+ * @param[in] signHandle Handle of the key used to sign the attestation
+ * structure.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value for the NV Index.
* @param[in] nvIndex Index for the area to be certified.
* @param[in] shandle1 Session handle for authorization of signHandle
* @param[in] shandle2 Session handle for authorization of authHandle
@@ -185,9 +177,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_NV_Certify_Async(
@@ -228,10 +220,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, signHandle, authHandle, nvIndex,
- qualifyingData,
- inScheme,
- size,
- offset);
+ qualifyingData, inScheme, size, offset);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, signHandle, &signHandleNode);
@@ -243,13 +232,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_Certify_Prepare(esysContext->sys,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- qualifyingData,
- inScheme,
- size,
- offset);
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle,
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, qualifyingData,
+ inScheme, size, offset);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -263,14 +252,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, signHandleNode, authHandleNode, nvIndexNode, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -287,8 +279,8 @@
* @param[in,out] esysContext The ESYS_CONTEXT.
* @param[out] certifyInfo The structure that was signed.
* (callee-allocated)
- * @param[out] signature The asymmetric signature over certifyInfo using the key
- * referenced by signHandle.
+ * @param[out] signature The asymmetric signature over certifyInfo using the
+ * key referenced by signHandle.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -364,16 +356,16 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_Certify_Async(esysContext,
- esysContext->in.NV_Certify.signHandle,
- esysContext->in.NV_Certify.authHandle,
- esysContext->in.NV_Certify.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_Certify.qualifyingData,
- esysContext->in.NV_Certify.inScheme,
- esysContext->in.NV_Certify.size,
- esysContext->in.NV_Certify.offset);
+ esysContext->in.NV_Certify.signHandle,
+ esysContext->in.NV_Certify.authHandle,
+ esysContext->in.NV_Certify.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_Certify.qualifyingData,
+ esysContext->in.NV_Certify.inScheme,
+ esysContext->in.NV_Certify.size,
+ esysContext->in.NV_Certify.offset);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -401,16 +393,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_Certify_Complete(esysContext->sys,
- (certifyInfo != NULL) ? *certifyInfo : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (certifyInfo != NULL) ? *certifyInfo : NULL,
+ (signature != NULL) ? *signature : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_ChangeAuth.c b/src/tss2-esys/api/Esys_NV_ChangeAuth.c
index 6d169bd..e70b9a1 100644
--- a/src/tss2-esys/api/Esys_NV_ChangeAuth.c
+++ b/src/tss2-esys/api/Esys_NV_ChangeAuth.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -80,12 +80,8 @@
{
TSS2_RC r;
- r = Esys_NV_ChangeAuth_Async(esysContext,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- newAuth);
+ r = Esys_NV_ChangeAuth_Async(esysContext, nvIndex, shandle1, shandle2,
+ shandle3, newAuth);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -139,9 +135,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -174,8 +170,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, nvIndex,
- newAuth);
+ store_input_parameters(esysContext, nvIndex, newAuth);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, nvIndex, &nvIndexNode);
@@ -183,8 +178,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_ChangeAuth_Prepare(esysContext->sys,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- newAuth);
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, newAuth);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -197,14 +192,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, nvIndexNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -280,11 +278,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_ChangeAuth_Async(esysContext,
- esysContext->in.NV_ChangeAuth.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_ChangeAuth.newAuth);
+ esysContext->in.NV_ChangeAuth.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_ChangeAuth.newAuth);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -322,14 +320,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_ChangeAuth_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_DefineSpace.c b/src/tss2-esys/api/Esys_NV_DefineSpace.c
index 542d978..d9251b1 100644
--- a/src/tss2-esys/api/Esys_NV_DefineSpace.c
+++ b/src/tss2-esys/api/Esys_NV_DefineSpace.c
@@ -70,9 +70,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -87,18 +87,12 @@
ESYS_TR shandle2,
ESYS_TR shandle3,
const TPM2B_AUTH *auth,
- const TPM2B_NV_PUBLIC *publicInfo,
- ESYS_TR *nvHandle)
+ const TPM2B_NV_PUBLIC *publicInfo, ESYS_TR *nvHandle)
{
TSS2_RC r;
- r = Esys_NV_DefineSpace_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- auth,
- publicInfo);
+ r = Esys_NV_DefineSpace_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, auth, publicInfo);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -112,8 +106,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_NV_DefineSpace_Finish(esysContext,
- nvHandle);
+ r = Esys_NV_DefineSpace_Finish(esysContext, nvHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -154,9 +147,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -201,9 +194,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- auth,
- publicInfo);
+ store_input_parameters(esysContext, authHandle, auth, publicInfo);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -211,9 +202,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_DefineSpace_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- auth,
- publicInfo);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle, auth,
+ publicInfo);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -226,14 +217,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -270,8 +264,7 @@
*/
TSS2_RC
Esys_NV_DefineSpace_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *nvHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *nvHandle)
{
TSS2_RC r;
LOG_TRACE("context=%p, nvHandle=%p",
@@ -320,12 +313,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_DefineSpace_Async(esysContext,
- esysContext->in.NV_DefineSpace.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_DefineSpace.auth,
- esysContext->in.NV_DefineSpace.publicInfo);
+ esysContext->in.NV_DefineSpace.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_DefineSpace.auth,
+ esysContext->in.NV_DefineSpace.publicInfo);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -353,14 +346,17 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_DefineSpace_Complete(esysContext->sys);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* Update the meta data of the ESYS_TR object */
nvHandleNode->rsrc.rsrcType = IESYSC_NV_RSRC;
r = iesys_nv_get_name(esysContext->in.NV_DefineSpace.publicInfo,
diff --git a/src/tss2-esys/api/Esys_NV_Extend.c b/src/tss2-esys/api/Esys_NV_Extend.c
index 1500b5f..8d185f3 100644
--- a/src/tss2-esys/api/Esys_NV_Extend.c
+++ b/src/tss2-esys/api/Esys_NV_Extend.c
@@ -40,7 +40,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index to extend.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -63,9 +64,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -84,13 +85,8 @@
{
TSS2_RC r;
- r = Esys_NV_Extend_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- data);
+ r = Esys_NV_Extend_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3, data);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -127,7 +123,8 @@
* In order to retrieve the TPM's response call Esys_NV_Extend_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index to extend.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -145,9 +142,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -183,8 +180,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle, nvIndex,
- data);
+ store_input_parameters(esysContext, authHandle, nvIndex, data);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -194,9 +190,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_Extend_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- data);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, data);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -209,14 +206,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -289,12 +289,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_Extend_Async(esysContext,
- esysContext->in.NV_Extend.authHandle,
- esysContext->in.NV_Extend.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_Extend.data);
+ esysContext->in.NV_Extend.authHandle,
+ esysContext->in.NV_Extend.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_Extend.data);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -321,14 +321,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_Extend_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_GlobalWriteLock.c b/src/tss2-esys/api/Esys_NV_GlobalWriteLock.c
index d6c662c..5108ac5 100644
--- a/src/tss2-esys/api/Esys_NV_GlobalWriteLock.c
+++ b/src/tss2-esys/api/Esys_NV_GlobalWriteLock.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_NV_GlobalWriteLock_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_GlobalWriteLock_Async(esysContext, authHandle, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_GlobalWriteLock_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle);
+ (authHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +187,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,10 +270,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_GlobalWriteLock_Async(esysContext,
- esysContext->in.NV_GlobalWriteLock.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_GlobalWriteLock.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +300,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_GlobalWriteLock_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_Increment.c b/src/tss2-esys/api/Esys_NV_Increment.c
index c4bb9af..41bff51 100644
--- a/src/tss2-esys/api/Esys_NV_Increment.c
+++ b/src/tss2-esys/api/Esys_NV_Increment.c
@@ -32,7 +32,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index to increment.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -54,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +78,8 @@
{
TSS2_RC r;
- r = Esys_NV_Increment_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_Increment_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -119,7 +116,8 @@
* In order to retrieve the TPM's response call Esys_NV_Increment_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index to increment.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -136,9 +134,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -185,8 +183,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_Increment_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +199,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -279,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_Increment_Async(esysContext,
- esysContext->in.NV_Increment.authHandle,
- esysContext->in.NV_Increment.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_Increment.authHandle,
+ esysContext->in.NV_Increment.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -310,14 +313,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_Increment_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR nvIndex = esysContext->in.NV_Write.nvIndex;
RSRC_NODE_T *nvIndexNode;
diff --git a/src/tss2-esys/api/Esys_NV_Read.c b/src/tss2-esys/api/Esys_NV_Read.c
index 270f1d8..bf92b47 100644
--- a/src/tss2-esys/api/Esys_NV_Read.c
+++ b/src/tss2-esys/api/Esys_NV_Read.c
@@ -63,9 +63,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -86,14 +86,8 @@
{
TSS2_RC r;
- r = Esys_NV_Read_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- size,
- offset);
+ r = Esys_NV_Read_Async(esysContext, authHandle, nvIndex, shandle1, shandle2,
+ shandle3, size, offset);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -107,8 +101,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_NV_Read_Finish(esysContext,
- data);
+ r = Esys_NV_Read_Finish(esysContext, data);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -151,9 +144,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -190,9 +183,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle, nvIndex,
- size,
- offset);
+ store_input_parameters(esysContext, authHandle, nvIndex, size, offset);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -202,10 +193,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_Read_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- size,
- offset);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, size, offset);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -218,14 +209,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -308,14 +302,13 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_NV_Read_Async(esysContext,
- esysContext->in.NV_Read.authHandle,
- esysContext->in.NV_Read.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_Read.size,
- esysContext->in.NV_Read.offset);
+ r = Esys_NV_Read_Async(esysContext, esysContext->in.NV_Read.authHandle,
+ esysContext->in.NV_Read.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_Read.size,
+ esysContext->in.NV_Read.offset);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -343,15 +336,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_Read_Complete(esysContext->sys,
- (data != NULL) ? *data : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (data != NULL) ? *data : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_ReadLock.c b/src/tss2-esys/api/Esys_NV_ReadLock.c
index 0b21465..ca424b9 100644
--- a/src/tss2-esys/api/Esys_NV_ReadLock.c
+++ b/src/tss2-esys/api/Esys_NV_ReadLock.c
@@ -55,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -78,12 +78,8 @@
{
TSS2_RC r;
- r = Esys_NV_ReadLock_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_ReadLock_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -138,9 +134,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -187,8 +183,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_ReadLock_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -201,14 +199,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -281,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_ReadLock_Async(esysContext,
- esysContext->in.NV_ReadLock.authHandle,
- esysContext->in.NV_ReadLock.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_ReadLock.authHandle,
+ esysContext->in.NV_ReadLock.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -312,14 +313,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_ReadLock_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR nvIndex = esysContext->in.NV_Write.nvIndex;
RSRC_NODE_T *nvIndexNode;
diff --git a/src/tss2-esys/api/Esys_NV_ReadPublic.c b/src/tss2-esys/api/Esys_NV_ReadPublic.c
index c78ad05..0eb0ff3 100644
--- a/src/tss2-esys/api/Esys_NV_ReadPublic.c
+++ b/src/tss2-esys/api/Esys_NV_ReadPublic.c
@@ -55,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -76,11 +76,8 @@
{
TSS2_RC r;
- r = Esys_NV_ReadPublic_Async(esysContext,
- nvIndex,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_ReadPublic_Async(esysContext, nvIndex, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -94,9 +91,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_NV_ReadPublic_Finish(esysContext,
- nvPublic,
- nvName);
+ r = Esys_NV_ReadPublic_Finish(esysContext, nvPublic, nvName);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -135,9 +130,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -177,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_ReadPublic_Prepare(esysContext->sys,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle);
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -189,14 +185,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, nvIndexNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -287,10 +286,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_ReadPublic_Async(esysContext,
- esysContext->in.NV_ReadPublic.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_ReadPublic.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -318,16 +317,17 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
- r = Tss2_Sys_NV_ReadPublic_Complete(esysContext->sys,
- lnvPublic,
- lnvName);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ r = Tss2_Sys_NV_ReadPublic_Complete(esysContext->sys, lnvPublic, lnvName);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* Update the meta data of the ESYS_TR object */
ESYS_TR nvIndex = esysContext->in.NV_ReadPublic.nvIndex;
diff --git a/src/tss2-esys/api/Esys_NV_SetBits.c b/src/tss2-esys/api/Esys_NV_SetBits.c
index 596bcfe..bf4a0bf 100644
--- a/src/tss2-esys/api/Esys_NV_SetBits.c
+++ b/src/tss2-esys/api/Esys_NV_SetBits.c
@@ -34,7 +34,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex NV Index of the area in which the bit is to be set.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -57,9 +58,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -81,13 +82,8 @@
{
TSS2_RC r;
- r = Esys_NV_SetBits_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- bits);
+ r = Esys_NV_SetBits_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3, bits);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,7 +120,8 @@
* In order to retrieve the TPM's response call Esys_NV_SetBits_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex NV Index of the area in which the bit is to be set.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -142,9 +139,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -183,8 +180,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle, nvIndex,
- bits);
+ store_input_parameters(esysContext, authHandle, nvIndex, bits);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -194,9 +190,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_SetBits_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- bits);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, bits);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -209,14 +206,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -289,12 +289,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_SetBits_Async(esysContext,
- esysContext->in.NV_SetBits.authHandle,
- esysContext->in.NV_SetBits.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_SetBits.bits);
+ esysContext->in.NV_SetBits.authHandle,
+ esysContext->in.NV_SetBits.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_SetBits.bits);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -321,14 +321,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_SetBits_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR nvIndex = esysContext->in.NV_Write.nvIndex;
RSRC_NODE_T *nvIndexNode;
diff --git a/src/tss2-esys/api/Esys_NV_UndefineSpace.c b/src/tss2-esys/api/Esys_NV_UndefineSpace.c
index 2f4dcd9..9ed482e 100644
--- a/src/tss2-esys/api/Esys_NV_UndefineSpace.c
+++ b/src/tss2-esys/api/Esys_NV_UndefineSpace.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_NV_UndefineSpace_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_UndefineSpace_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -185,8 +181,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_UndefineSpace_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +197,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -279,11 +280,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_UndefineSpace_Async(esysContext,
- esysContext->in.NV_UndefineSpace.authHandle,
- esysContext->in.NV_UndefineSpace.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_UndefineSpace.authHandle,
+ esysContext->in.NV_UndefineSpace.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -310,14 +311,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_UndefineSpace_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
/* The ESYS_TR object (nvIndex) has to be invalidated */
r = Esys_TR_Close(esysContext, &esysContext->in.NV_UndefineSpace.nvIndex);
return_if_error(r, "invalidate object");
diff --git a/src/tss2-esys/api/Esys_NV_UndefineSpaceSpecial.c b/src/tss2-esys/api/Esys_NV_UndefineSpaceSpecial.c
index c9f5571..9202480 100644
--- a/src/tss2-esys/api/Esys_NV_UndefineSpaceSpecial.c
+++ b/src/tss2-esys/api/Esys_NV_UndefineSpaceSpecial.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_NV_UndefineSpaceSpecial_Async(esysContext,
- nvIndex,
- platform,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_UndefineSpaceSpecial_Async(esysContext, nvIndex, platform,
+ shandle1, shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -185,8 +181,12 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_UndefineSpaceSpecial_Prepare(esysContext->sys,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- (platformNode == NULL) ? TPM2_RH_NULL : platformNode->rsrc.handle);
+ (nvIndexNode == NULL)
+ ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle,
+ (platformNode == NULL)
+ ? TPM2_RH_NULL
+ : platformNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -200,14 +200,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, nvIndexNode, platformNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -283,11 +286,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_UndefineSpaceSpecial_Async(esysContext,
- esysContext->in.NV_UndefineSpaceSpecial.nvIndex,
- esysContext->in.NV_UndefineSpaceSpecial.platform,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_UndefineSpaceSpecial.nvIndex,
+ esysContext->in.NV_UndefineSpaceSpecial.platform,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -323,7 +326,8 @@
session->rsrc.misc.rsrc_session.sizeHmacValue -= nvIndexNode->auth.size;
/* The ESYS_TR object (nvIndex) has to be invalidated */
- r = Esys_TR_Close(esysContext, &esysContext->in.NV_UndefineSpaceSpecial.nvIndex);
+ r = Esys_TR_Close(esysContext,
+ &esysContext->in.NV_UndefineSpaceSpecial.nvIndex);
return_if_error(r, "TR_Close");
/*
@@ -331,14 +335,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_UndefineSpaceSpecial_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_NV_Write.c b/src/tss2-esys/api/Esys_NV_Write.c
index e15fa3d..08f0d73 100644
--- a/src/tss2-esys/api/Esys_NV_Write.c
+++ b/src/tss2-esys/api/Esys_NV_Write.c
@@ -42,7 +42,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to write.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -66,9 +67,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -88,14 +89,8 @@
{
TSS2_RC r;
- r = Esys_NV_Write_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3,
- data,
- offset);
+ r = Esys_NV_Write_Async(esysContext, authHandle, nvIndex, shandle1, shandle2,
+ shandle3, data, offset);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -132,7 +127,8 @@
* In order to retrieve the TPM's response call Esys_NV_Write_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to write.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -151,9 +147,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -190,9 +186,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle, nvIndex,
- data,
- offset);
+ store_input_parameters(esysContext, authHandle, nvIndex, data, offset);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -202,10 +196,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_Write_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- data,
- offset);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle, data, offset);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -218,14 +212,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -297,14 +294,13 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_NV_Write_Async(esysContext,
- esysContext->in.NV_Write.authHandle,
- esysContext->in.NV_Write.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.NV_Write.data,
- esysContext->in.NV_Write.offset);
+ r = Esys_NV_Write_Async(esysContext, esysContext->in.NV_Write.authHandle,
+ esysContext->in.NV_Write.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.NV_Write.data,
+ esysContext->in.NV_Write.offset);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -331,14 +327,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_Write_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR nvIndex = esysContext->in.NV_Write.nvIndex;
RSRC_NODE_T *nvIndexNode;
diff --git a/src/tss2-esys/api/Esys_NV_WriteLock.c b/src/tss2-esys/api/Esys_NV_WriteLock.c
index e0b63a7..c6b79b9 100644
--- a/src/tss2-esys/api/Esys_NV_WriteLock.c
+++ b/src/tss2-esys/api/Esys_NV_WriteLock.c
@@ -32,7 +32,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to lock.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -54,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +78,8 @@
{
TSS2_RC r;
- r = Esys_NV_WriteLock_Async(esysContext,
- authHandle,
- nvIndex,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_NV_WriteLock_Async(esysContext, authHandle, nvIndex, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -119,7 +116,8 @@
* In order to retrieve the TPM's response call Esys_NV_WriteLock_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to lock.
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
@@ -136,9 +134,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -185,8 +183,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_NV_WriteLock_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +199,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -279,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_NV_WriteLock_Async(esysContext,
- esysContext->in.NV_WriteLock.authHandle,
- esysContext->in.NV_WriteLock.nvIndex,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.NV_WriteLock.authHandle,
+ esysContext->in.NV_WriteLock.nvIndex,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -310,14 +313,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_NV_WriteLock_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR nvIndex = esysContext->in.NV_Write.nvIndex;
RSRC_NODE_T *nvIndexNode;
diff --git a/src/tss2-esys/api/Esys_ObjectChangeAuth.c b/src/tss2-esys/api/Esys_ObjectChangeAuth.c
index a0ac80f..6083fe8 100644
--- a/src/tss2-esys/api/Esys_ObjectChangeAuth.c
+++ b/src/tss2-esys/api/Esys_ObjectChangeAuth.c
@@ -65,9 +65,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -84,13 +84,8 @@
{
TSS2_RC r;
- r = Esys_ObjectChangeAuth_Async(esysContext,
- objectHandle,
- parentHandle,
- shandle1,
- shandle2,
- shandle3,
- newAuth);
+ r = Esys_ObjectChangeAuth_Async(esysContext, objectHandle, parentHandle,
+ shandle1, shandle2, shandle3, newAuth);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,8 +99,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ObjectChangeAuth_Finish(esysContext,
- outPrivate);
+ r = Esys_ObjectChangeAuth_Finish(esysContext, outPrivate);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -146,9 +140,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_ObjectChangeAuth_Async(
@@ -181,8 +175,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, objectHandle, parentHandle,
- newAuth);
+ store_input_parameters(esysContext, objectHandle, parentHandle, newAuth);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, objectHandle, &objectHandleNode);
@@ -192,9 +185,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ObjectChangeAuth_Prepare(esysContext->sys,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle,
- (parentHandleNode == NULL) ? TPM2_RH_NULL : parentHandleNode->rsrc.handle,
- newAuth);
+ (objectHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle,
+ (parentHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : parentHandleNode->rsrc.handle,
+ newAuth);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -207,14 +204,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, objectHandleNode, parentHandleNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -298,12 +298,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ObjectChangeAuth_Async(esysContext,
- esysContext->in.ObjectChangeAuth.objectHandle,
- esysContext->in.ObjectChangeAuth.parentHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ObjectChangeAuth.newAuth);
+ esysContext->in.ObjectChangeAuth.objectHandle,
+ esysContext->in.ObjectChangeAuth.parentHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ObjectChangeAuth.newAuth);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -331,15 +331,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ObjectChangeAuth_Complete(esysContext->sys,
- (outPrivate != NULL) ? *outPrivate : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outPrivate != NULL) ? *outPrivate
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_Allocate.c b/src/tss2-esys/api/Esys_PCR_Allocate.c
index ff466fd..c8b9e6a 100644
--- a/src/tss2-esys/api/Esys_PCR_Allocate.c
+++ b/src/tss2-esys/api/Esys_PCR_Allocate.c
@@ -69,9 +69,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -96,12 +96,8 @@
{
TSS2_RC r;
- r = Esys_PCR_Allocate_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- pcrAllocation);
+ r = Esys_PCR_Allocate_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, pcrAllocation);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -115,11 +111,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PCR_Allocate_Finish(esysContext,
- allocationSuccess,
- maxPCR,
- sizeNeeded,
- sizeAvailable);
+ r = Esys_PCR_Allocate_Finish(esysContext, allocationSuccess, maxPCR,
+ sizeNeeded, sizeAvailable);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -159,9 +152,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -197,8 +190,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- pcrAllocation);
+ store_input_parameters(esysContext, authHandle, pcrAllocation);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -206,8 +198,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_Allocate_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- pcrAllocation);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ pcrAllocation);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -220,14 +213,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -315,11 +311,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_Allocate_Async(esysContext,
- esysContext->in.PCR_Allocate.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_Allocate.pcrAllocation);
+ esysContext->in.PCR_Allocate.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_Allocate.pcrAllocation);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -346,18 +342,18 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
- r = Tss2_Sys_PCR_Allocate_Complete(esysContext->sys,
- allocationSuccess,
- maxPCR,
- sizeNeeded,
- sizeAvailable);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ r = Tss2_Sys_PCR_Allocate_Complete(esysContext->sys, allocationSuccess,
+ maxPCR, sizeNeeded, sizeAvailable);
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_Event.c b/src/tss2-esys/api/Esys_PCR_Event.c
index ca02590..eb8c55a 100644
--- a/src/tss2-esys/api/Esys_PCR_Event.c
+++ b/src/tss2-esys/api/Esys_PCR_Event.c
@@ -62,9 +62,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PCR_Event_Async(esysContext,
- pcrHandle,
- shandle1,
- shandle2,
- shandle3,
- eventData);
+ r = Esys_PCR_Event_Async(esysContext, pcrHandle, shandle1, shandle2,
+ shandle3, eventData);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -102,8 +98,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PCR_Event_Finish(esysContext,
- digests);
+ r = Esys_PCR_Event_Finish(esysContext, digests);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -143,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -178,8 +173,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, pcrHandle,
- eventData);
+ store_input_parameters(esysContext, pcrHandle, eventData);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, pcrHandle, &pcrHandleNode);
@@ -187,8 +181,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_Event_Prepare(esysContext->sys,
- (pcrHandleNode == NULL) ? TPM2_RH_NULL : pcrHandleNode->rsrc.handle,
- eventData);
+ (pcrHandleNode == NULL) ? TPM2_RH_NULL
+ : pcrHandleNode->rsrc.handle, eventData);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -201,14 +195,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, pcrHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -292,11 +289,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_Event_Async(esysContext,
- esysContext->in.PCR_Event.pcrHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_Event.eventData);
+ esysContext->in.PCR_Event.pcrHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_Event.eventData);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -324,15 +321,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PCR_Event_Complete(esysContext->sys,
- (digests != NULL) ? *digests : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (digests != NULL) ? *digests : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_Extend.c b/src/tss2-esys/api/Esys_PCR_Extend.c
index b656550..75b2da7 100644
--- a/src/tss2-esys/api/Esys_PCR_Extend.c
+++ b/src/tss2-esys/api/Esys_PCR_Extend.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PCR_Extend_Async(esysContext,
- pcrHandle,
- shandle1,
- shandle2,
- shandle3,
- digests);
+ r = Esys_PCR_Extend_Async(esysContext, pcrHandle, shandle1, shandle2,
+ shandle3, digests);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -180,8 +176,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, pcrHandle,
- digests);
+ store_input_parameters(esysContext, pcrHandle, digests);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, pcrHandle, &pcrHandleNode);
@@ -189,8 +184,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_Extend_Prepare(esysContext->sys,
- (pcrHandleNode == NULL) ? TPM2_RH_NULL : pcrHandleNode->rsrc.handle,
- digests);
+ (pcrHandleNode == NULL) ? TPM2_RH_NULL
+ : pcrHandleNode->rsrc.handle, digests);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -203,14 +198,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, pcrHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -283,11 +281,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_Extend_Async(esysContext,
- esysContext->in.PCR_Extend.pcrHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_Extend.digests);
+ esysContext->in.PCR_Extend.pcrHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_Extend.digests);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -314,14 +312,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PCR_Extend_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_Read.c b/src/tss2-esys/api/Esys_PCR_Read.c
index 57d1d53..a2aed8f 100644
--- a/src/tss2-esys/api/Esys_PCR_Read.c
+++ b/src/tss2-esys/api/Esys_PCR_Read.c
@@ -86,11 +86,8 @@
{
TSS2_RC r;
- r = Esys_PCR_Read_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- pcrSelectionIn);
+ r = Esys_PCR_Read_Async(esysContext, shandle1, shandle2, shandle3,
+ pcrSelectionIn);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -104,10 +101,8 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PCR_Read_Finish(esysContext,
- pcrUpdateCounter,
- pcrSelectionOut,
- pcrValues);
+ r = Esys_PCR_Read_Finish(esysContext, pcrUpdateCounter, pcrSelectionOut,
+ pcrValues);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -179,12 +174,10 @@
/* Check and store 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,
- pcrSelectionIn);
+ store_input_parameters(esysContext, pcrSelectionIn);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_PCR_Read_Prepare(esysContext->sys,
- pcrSelectionIn);
+ r = Tss2_Sys_PCR_Read_Prepare(esysContext->sys, pcrSelectionIn);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -196,14 +189,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -301,11 +297,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_PCR_Read_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_Read.pcrSelectionIn);
+ r = Esys_PCR_Read_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_Read.pcrSelectionIn);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -333,17 +328,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
- r = Tss2_Sys_PCR_Read_Complete(esysContext->sys,
- pcrUpdateCounter,
- (pcrSelectionOut != NULL) ? *pcrSelectionOut : NULL,
- (pcrValues != NULL) ? *pcrValues : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ r = Tss2_Sys_PCR_Read_Complete(esysContext->sys, pcrUpdateCounter,
+ (pcrSelectionOut != NULL) ? *pcrSelectionOut
+ : NULL,
+ (pcrValues != NULL) ? *pcrValues : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_Reset.c b/src/tss2-esys/api/Esys_PCR_Reset.c
index 1442c0a..6106b48 100644
--- a/src/tss2-esys/api/Esys_PCR_Reset.c
+++ b/src/tss2-esys/api/Esys_PCR_Reset.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_PCR_Reset_Async(esysContext,
- pcrHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PCR_Reset_Async(esysContext, pcrHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_Reset_Prepare(esysContext->sys,
- (pcrHandleNode == NULL) ? TPM2_RH_NULL : pcrHandleNode->rsrc.handle);
+ (pcrHandleNode == NULL) ? TPM2_RH_NULL
+ : pcrHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -188,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, pcrHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_Reset_Async(esysContext,
- esysContext->in.PCR_Reset.pcrHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PCR_Reset.pcrHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -298,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PCR_Reset_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_SetAuthPolicy.c b/src/tss2-esys/api/Esys_PCR_SetAuthPolicy.c
index 1676b81..6f92a07 100644
--- a/src/tss2-esys/api/Esys_PCR_SetAuthPolicy.c
+++ b/src/tss2-esys/api/Esys_PCR_SetAuthPolicy.c
@@ -66,9 +66,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -88,14 +88,8 @@
{
TSS2_RC r;
- r = Esys_PCR_SetAuthPolicy_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- authPolicy,
- hashAlg,
- pcrNum);
+ r = Esys_PCR_SetAuthPolicy_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, authPolicy, hashAlg, pcrNum);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -151,9 +145,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -189,10 +183,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- authPolicy,
- hashAlg,
- pcrNum);
+ store_input_parameters(esysContext, authHandle, authPolicy, hashAlg,
+ pcrNum);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -200,10 +192,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_SetAuthPolicy_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- authPolicy,
- hashAlg,
- pcrNum);
+ (authHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ authPolicy, hashAlg, pcrNum);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -216,14 +208,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -296,13 +291,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_SetAuthPolicy_Async(esysContext,
- esysContext->in.PCR_SetAuthPolicy.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_SetAuthPolicy.authPolicy,
- esysContext->in.PCR_SetAuthPolicy.hashAlg,
- esysContext->in.PCR_SetAuthPolicy.pcrNum);
+ esysContext->in.PCR_SetAuthPolicy.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_SetAuthPolicy.authPolicy,
+ esysContext->in.PCR_SetAuthPolicy.hashAlg,
+ esysContext->in.PCR_SetAuthPolicy.pcrNum);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -329,14 +324,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PCR_SetAuthPolicy_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PCR_SetAuthValue.c b/src/tss2-esys/api/Esys_PCR_SetAuthValue.c
index ce18930..6bec204 100644
--- a/src/tss2-esys/api/Esys_PCR_SetAuthValue.c
+++ b/src/tss2-esys/api/Esys_PCR_SetAuthValue.c
@@ -38,7 +38,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] pcrHandle Handle for a PCR that may have an authorization value set.
+ * @param[in] pcrHandle Handle for a PCR that may have an authorization value
+ * set.
* @param[in] shandle1 Session handle for authorization of pcrHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -60,9 +61,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -80,12 +81,8 @@
{
TSS2_RC r;
- r = Esys_PCR_SetAuthValue_Async(esysContext,
- pcrHandle,
- shandle1,
- shandle2,
- shandle3,
- auth);
+ r = Esys_PCR_SetAuthValue_Async(esysContext, pcrHandle, shandle1, shandle2,
+ shandle3, auth);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -122,7 +119,8 @@
* In order to retrieve the TPM's response call Esys_PCR_SetAuthValue_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] pcrHandle Handle for a PCR that may have an authorization value set.
+ * @param[in] pcrHandle Handle for a PCR that may have an authorization value
+ * set.
* @param[in] shandle1 Session handle for authorization of pcrHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -139,9 +137,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -174,8 +172,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, pcrHandle,
- auth);
+ store_input_parameters(esysContext, pcrHandle, auth);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, pcrHandle, &pcrHandleNode);
@@ -183,8 +180,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PCR_SetAuthValue_Prepare(esysContext->sys,
- (pcrHandleNode == NULL) ? TPM2_RH_NULL : pcrHandleNode->rsrc.handle,
- auth);
+ (pcrHandleNode == NULL) ? TPM2_RH_NULL
+ : pcrHandleNode->rsrc.handle, auth);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -197,14 +194,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, pcrHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -277,11 +277,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PCR_SetAuthValue_Async(esysContext,
- esysContext->in.PCR_SetAuthValue.pcrHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PCR_SetAuthValue.auth);
+ esysContext->in.PCR_SetAuthValue.pcrHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PCR_SetAuthValue.auth);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -308,14 +308,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PCR_SetAuthValue_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PP_Commands.c b/src/tss2-esys/api/Esys_PP_Commands.c
index 7c9d3c2..47c5c51 100644
--- a/src/tss2-esys/api/Esys_PP_Commands.c
+++ b/src/tss2-esys/api/Esys_PP_Commands.c
@@ -71,9 +71,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -95,13 +95,8 @@
{
TSS2_RC r;
- r = Esys_PP_Commands_Async(esysContext,
- auth,
- shandle1,
- shandle2,
- shandle3,
- setList,
- clearList);
+ r = Esys_PP_Commands_Async(esysContext, auth, shandle1, shandle2, shandle3,
+ setList, clearList);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -158,9 +153,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -198,9 +193,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth,
- setList,
- clearList);
+ store_input_parameters(esysContext, auth, setList, clearList);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -208,9 +201,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PP_Commands_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- setList,
- clearList);
+ (authNode == NULL) ? TPM2_RH_NULL
+ : authNode->rsrc.handle, setList,
+ clearList);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -223,14 +216,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -302,13 +298,12 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_PP_Commands_Async(esysContext,
- esysContext->in.PP_Commands.auth,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PP_Commands.setList,
- esysContext->in.PP_Commands.clearList);
+ r = Esys_PP_Commands_Async(esysContext, esysContext->in.PP_Commands.auth,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PP_Commands.setList,
+ esysContext->in.PP_Commands.clearList);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -335,14 +330,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PP_Commands_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyAuthValue.c b/src/tss2-esys/api/Esys_PolicyAuthValue.c
index 13cd15d..9a7fcae 100644
--- a/src/tss2-esys/api/Esys_PolicyAuthValue.c
+++ b/src/tss2-esys/api/Esys_PolicyAuthValue.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_PolicyAuthValue_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyAuthValue_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyAuthValue_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -187,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyAuthValue_Async(esysContext,
- esysContext->in.PolicyAuthValue.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyAuthValue.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyAuthValue_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR policySession = esysContext->in.PolicyAuthValue.policySession;
RSRC_NODE_T *policySessionNode;
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
diff --git a/src/tss2-esys/api/Esys_PolicyAuthorize.c b/src/tss2-esys/api/Esys_PolicyAuthorize.c
index 7a4f1c3..f112f1e 100644
--- a/src/tss2-esys/api/Esys_PolicyAuthorize.c
+++ b/src/tss2-esys/api/Esys_PolicyAuthorize.c
@@ -88,9 +88,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -114,15 +114,9 @@
{
TSS2_RC r;
- r = Esys_PolicyAuthorize_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- approvedPolicy,
- policyRef,
- keySign,
- checkTicket);
+ r = Esys_PolicyAuthorize_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3, approvedPolicy, policyRef,
+ keySign, checkTicket);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -180,9 +174,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -223,11 +217,8 @@
/* Check and store 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, policySession,
- approvedPolicy,
- policyRef,
- keySign,
- checkTicket);
+ store_input_parameters(esysContext, policySession, approvedPolicy, policyRef,
+ keySign, checkTicket);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -235,11 +226,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyAuthorize_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- approvedPolicy,
- policyRef,
- keySign,
- checkTicket);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ approvedPolicy, policyRef, keySign,
+ checkTicket);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -251,14 +242,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -331,14 +325,14 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyAuthorize_Async(esysContext,
- esysContext->in.PolicyAuthorize.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyAuthorize.approvedPolicy,
- esysContext->in.PolicyAuthorize.policyRef,
- esysContext->in.PolicyAuthorize.keySign,
- esysContext->in.PolicyAuthorize.checkTicket);
+ esysContext->in.PolicyAuthorize.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyAuthorize.approvedPolicy,
+ esysContext->in.PolicyAuthorize.policyRef,
+ esysContext->in.PolicyAuthorize.keySign,
+ esysContext->in.PolicyAuthorize.checkTicket);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -365,14 +359,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyAuthorize_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyAuthorizeNV.c b/src/tss2-esys/api/Esys_PolicyAuthorizeNV.c
index 83e1dc9..193e821 100644
--- a/src/tss2-esys/api/Esys_PolicyAuthorizeNV.c
+++ b/src/tss2-esys/api/Esys_PolicyAuthorizeNV.c
@@ -34,7 +34,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to read.
* @param[in] policySession Handle for the policy session being extended.
* @param[in] shandle1 Session handle for authorization of authHandle
@@ -57,9 +58,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -81,13 +82,9 @@
{
TSS2_RC r;
- r = Esys_PolicyAuthorizeNV_Async(esysContext,
- authHandle,
- nvIndex,
- policySession,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyAuthorizeNV_Async(esysContext, authHandle, nvIndex,
+ policySession, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,7 +121,8 @@
* In order to retrieve the TPM's response call Esys_PolicyAuthorizeNV_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to read.
* @param[in] policySession Handle for the policy session being extended.
* @param[in] shandle1 Session handle for authorization of authHandle
@@ -142,9 +140,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -196,9 +194,14 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyAuthorizeNV_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle);
+ (authHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle,
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -211,14 +214,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, policySessionNode, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -291,12 +297,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyAuthorizeNV_Async(esysContext,
- esysContext->in.PolicyAuthorizeNV.authHandle,
- esysContext->in.PolicyAuthorizeNV.nvIndex,
- esysContext->in.PolicyAuthorizeNV.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyAuthorizeNV.authHandle,
+ esysContext->in.PolicyAuthorizeNV.nvIndex,
+ esysContext->in.PolicyAuthorizeNV.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -323,14 +329,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyAuthorizeNV_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyCommandCode.c b/src/tss2-esys/api/Esys_PolicyCommandCode.c
index f1c4951..2cdc2f9 100644
--- a/src/tss2-esys/api/Esys_PolicyCommandCode.c
+++ b/src/tss2-esys/api/Esys_PolicyCommandCode.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_PolicyCommandCode_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- code);
+ r = Esys_PolicyCommandCode_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3, code);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -174,8 +170,7 @@
/* Check and store 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, policySession,
- code);
+ store_input_parameters(esysContext, policySession, code);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -183,8 +178,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyCommandCode_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- code);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ code);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -196,14 +193,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -276,11 +276,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyCommandCode_Async(esysContext,
- esysContext->in.PolicyCommandCode.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyCommandCode.code);
+ esysContext->in.PolicyCommandCode.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyCommandCode.code);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -307,14 +307,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyCommandCode_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyCounterTimer.c b/src/tss2-esys/api/Esys_PolicyCounterTimer.c
index 1e8f622..8d9e853 100644
--- a/src/tss2-esys/api/Esys_PolicyCounterTimer.c
+++ b/src/tss2-esys/api/Esys_PolicyCounterTimer.c
@@ -67,9 +67,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -89,14 +89,9 @@
{
TSS2_RC r;
- r = Esys_PolicyCounterTimer_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- operandB,
- offset,
- operation);
+ r = Esys_PolicyCounterTimer_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3, operandB, offset,
+ operation);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -153,9 +148,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -191,10 +186,8 @@
/* Check and store 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, policySession,
- operandB,
- offset,
- operation);
+ store_input_parameters(esysContext, policySession, operandB, offset,
+ operation);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -202,10 +195,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyCounterTimer_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- operandB,
- offset,
- operation);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ operandB, offset, operation);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -217,14 +210,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -297,13 +293,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyCounterTimer_Async(esysContext,
- esysContext->in.PolicyCounterTimer.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyCounterTimer.operandB,
- esysContext->in.PolicyCounterTimer.offset,
- esysContext->in.PolicyCounterTimer.operation);
+ esysContext->in.PolicyCounterTimer.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyCounterTimer.operandB,
+ esysContext->in.PolicyCounterTimer.offset,
+ esysContext->in.PolicyCounterTimer.operation);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -330,14 +326,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyCounterTimer_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyCpHash.c b/src/tss2-esys/api/Esys_PolicyCpHash.c
index 74aa9cc..1c78871 100644
--- a/src/tss2-esys/api/Esys_PolicyCpHash.c
+++ b/src/tss2-esys/api/Esys_PolicyCpHash.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PolicyCpHash_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- cpHashA);
+ r = Esys_PolicyCpHash_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, cpHashA);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -180,8 +176,7 @@
/* Check and store 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, policySession,
- cpHashA);
+ store_input_parameters(esysContext, policySession, cpHashA);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -189,8 +184,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyCpHash_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- cpHashA);
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ cpHashA);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -202,14 +198,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -282,11 +281,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyCpHash_Async(esysContext,
- esysContext->in.PolicyCpHash.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyCpHash.cpHashA);
+ esysContext->in.PolicyCpHash.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyCpHash.cpHashA);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -313,14 +312,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyCpHash_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyDuplicationSelect.c b/src/tss2-esys/api/Esys_PolicyDuplicationSelect.c
index f8fb6cc..72e40bd 100644
--- a/src/tss2-esys/api/Esys_PolicyDuplicationSelect.c
+++ b/src/tss2-esys/api/Esys_PolicyDuplicationSelect.c
@@ -54,8 +54,8 @@
* @param[in] shandle3 Third session handle.
* @param[in] objectName The Name of the object to be duplicated.
* @param[in] newParentName The Name of the new parent.
- * @param[in] includeObject If YES, the objectName will be included in the value
- * in policySession->policyDigest.
+ * @param[in] includeObject If YES, the objectName will be included in the
+ * value in policySession->policyDigest.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -73,9 +73,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -98,14 +98,9 @@
{
TSS2_RC r;
- r = Esys_PolicyDuplicationSelect_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- objectName,
- newParentName,
- includeObject);
+ r = Esys_PolicyDuplicationSelect_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3, objectName,
+ newParentName, includeObject);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -148,8 +143,8 @@
* @param[in] shandle3 Third session handle.
* @param[in] objectName The Name of the object to be duplicated.
* @param[in] newParentName The Name of the new parent.
- * @param[in] includeObject If YES, the objectName will be included in the value
- * in policySession->policyDigest.
+ * @param[in] includeObject If YES, the objectName will be included in the
+ * value in policySession->policyDigest.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -162,9 +157,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -203,10 +198,8 @@
/* Check and store 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, policySession,
- objectName,
- newParentName,
- includeObject);
+ store_input_parameters(esysContext, policySession, objectName, newParentName,
+ includeObject);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -214,10 +207,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyDuplicationSelect_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- objectName,
- newParentName,
- includeObject);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ objectName, newParentName,
+ includeObject);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -229,14 +223,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -309,13 +306,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyDuplicationSelect_Async(esysContext,
- esysContext->in.PolicyDuplicationSelect.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyDuplicationSelect.objectName,
- esysContext->in.PolicyDuplicationSelect.newParentName,
- esysContext->in.PolicyDuplicationSelect.includeObject);
+ esysContext->in.PolicyDuplicationSelect.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyDuplicationSelect.objectName,
+ esysContext->in.PolicyDuplicationSelect.newParentName,
+ esysContext->in.PolicyDuplicationSelect.includeObject);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -342,14 +339,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyDuplicationSelect_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyGetDigest.c b/src/tss2-esys/api/Esys_PolicyGetDigest.c
index 7424e67..148e6d8 100644
--- a/src/tss2-esys/api/Esys_PolicyGetDigest.c
+++ b/src/tss2-esys/api/Esys_PolicyGetDigest.c
@@ -34,7 +34,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[out] policyDigest The current value of the policySession->policyDigest.
+ * @param[out] policyDigest The current value of the
+ * policySession->policyDigest.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -53,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +74,8 @@
{
TSS2_RC r;
- r = Esys_PolicyGetDigest_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyGetDigest_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -91,8 +89,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PolicyGetDigest_Finish(esysContext,
- policyDigest);
+ r = Esys_PolicyGetDigest_Finish(esysContext, policyDigest);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -131,9 +128,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -173,7 +170,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyGetDigest_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -185,14 +184,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -207,7 +209,8 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] policyDigest The current value of the policySession->policyDigest.
+ * @param[out] policyDigest The current value of the
+ * policySession->policyDigest.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -276,10 +279,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyGetDigest_Async(esysContext,
- esysContext->in.PolicyGetDigest.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyGetDigest.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -307,15 +310,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyGetDigest_Complete(esysContext->sys,
- (policyDigest != NULL) ? *policyDigest : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (policyDigest != NULL) ? *policyDigest
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyLocality.c b/src/tss2-esys/api/Esys_PolicyLocality.c
index 6f46144..3cde902 100644
--- a/src/tss2-esys/api/Esys_PolicyLocality.c
+++ b/src/tss2-esys/api/Esys_PolicyLocality.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_PolicyLocality_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- locality);
+ r = Esys_PolicyLocality_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, locality);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -174,8 +170,7 @@
/* Check and store 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, policySession,
- locality);
+ store_input_parameters(esysContext, policySession, locality);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -183,8 +178,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyLocality_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- locality);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ locality);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -196,14 +193,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -276,11 +276,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyLocality_Async(esysContext,
- esysContext->in.PolicyLocality.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyLocality.locality);
+ esysContext->in.PolicyLocality.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyLocality.locality);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -307,14 +307,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyLocality_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyNV.c b/src/tss2-esys/api/Esys_PolicyNV.c
index e4eea41..22d427a 100644
--- a/src/tss2-esys/api/Esys_PolicyNV.c
+++ b/src/tss2-esys/api/Esys_PolicyNV.c
@@ -46,7 +46,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to read.
* @param[in] policySession Handle for the policy session being extended.
* @param[in] shandle1 Session handle for authorization of authHandle
@@ -72,9 +73,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -96,16 +97,9 @@
{
TSS2_RC r;
- r = Esys_PolicyNV_Async(esysContext,
- authHandle,
- nvIndex,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- operandB,
- offset,
- operation);
+ r = Esys_PolicyNV_Async(esysContext, authHandle, nvIndex, policySession,
+ shandle1, shandle2, shandle3, operandB, offset,
+ operation);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,7 +136,8 @@
* In order to retrieve the TPM's response call Esys_PolicyNV_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] authHandle Handle indicating the source of the authorization value.
+ * @param[in] authHandle Handle indicating the source of the authorization
+ * value.
* @param[in] nvIndex The NV Index of the area to read.
* @param[in] policySession Handle for the policy session being extended.
* @param[in] shandle1 Session handle for authorization of authHandle
@@ -163,9 +158,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -208,9 +203,7 @@
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
store_input_parameters(esysContext, authHandle, nvIndex, policySession,
- operandB,
- offset,
- operation);
+ operandB, offset, operation);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -222,12 +215,13 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyNV_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (nvIndexNode == NULL) ? TPM2_RH_NULL : nvIndexNode->rsrc.handle,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- operandB,
- offset,
- operation);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (nvIndexNode == NULL) ? TPM2_RH_NULL
+ : nvIndexNode->rsrc.handle,
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle, operandB,
+ offset, operation);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -240,14 +234,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, nvIndexNode, policySessionNode, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -319,16 +316,15 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_PolicyNV_Async(esysContext,
- esysContext->in.PolicyNV.authHandle,
- esysContext->in.PolicyNV.nvIndex,
- esysContext->in.PolicyNV.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyNV.operandB,
- esysContext->in.PolicyNV.offset,
- esysContext->in.PolicyNV.operation);
+ r = Esys_PolicyNV_Async(esysContext, esysContext->in.PolicyNV.authHandle,
+ esysContext->in.PolicyNV.nvIndex,
+ esysContext->in.PolicyNV.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyNV.operandB,
+ esysContext->in.PolicyNV.offset,
+ esysContext->in.PolicyNV.operation);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -355,14 +351,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyNV_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyNameHash.c b/src/tss2-esys/api/Esys_PolicyNameHash.c
index 031b5da..e51149d 100644
--- a/src/tss2-esys/api/Esys_PolicyNameHash.c
+++ b/src/tss2-esys/api/Esys_PolicyNameHash.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PolicyNameHash_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- nameHash);
+ r = Esys_PolicyNameHash_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, nameHash);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -180,8 +176,7 @@
/* Check and store 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, policySession,
- nameHash);
+ store_input_parameters(esysContext, policySession, nameHash);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -189,8 +184,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyNameHash_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- nameHash);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ nameHash);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -202,14 +199,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -282,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyNameHash_Async(esysContext,
- esysContext->in.PolicyNameHash.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyNameHash.nameHash);
+ esysContext->in.PolicyNameHash.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyNameHash.nameHash);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -313,14 +313,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyNameHash_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyNvWritten.c b/src/tss2-esys/api/Esys_PolicyNvWritten.c
index 896eaf2..2a61d09 100644
--- a/src/tss2-esys/api/Esys_PolicyNvWritten.c
+++ b/src/tss2-esys/api/Esys_PolicyNvWritten.c
@@ -54,9 +54,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -77,12 +77,8 @@
{
TSS2_RC r;
- r = Esys_PolicyNvWritten_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- writtenSet);
+ r = Esys_PolicyNvWritten_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3, writtenSet);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -136,9 +132,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -174,8 +170,7 @@
/* Check and store 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, policySession,
- writtenSet);
+ store_input_parameters(esysContext, policySession, writtenSet);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -183,8 +178,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyNvWritten_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- writtenSet);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ writtenSet);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -196,14 +193,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -276,11 +276,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyNvWritten_Async(esysContext,
- esysContext->in.PolicyNvWritten.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyNvWritten.writtenSet);
+ esysContext->in.PolicyNvWritten.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyNvWritten.writtenSet);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -307,14 +307,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyNvWritten_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyOR.c b/src/tss2-esys/api/Esys_PolicyOR.c
index d72f2c1..cfa4ea2 100644
--- a/src/tss2-esys/api/Esys_PolicyOR.c
+++ b/src/tss2-esys/api/Esys_PolicyOR.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PolicyOR_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- pHashList);
+ r = Esys_PolicyOR_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, pHashList);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -180,8 +176,7 @@
/* Check and store 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, policySession,
- pHashList);
+ store_input_parameters(esysContext, policySession, pHashList);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -189,8 +184,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyOR_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- pHashList);
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle, pHashList);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -202,14 +197,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -282,11 +280,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyOR_Async(esysContext,
- esysContext->in.PolicyOR.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyOR.pHashList);
+ esysContext->in.PolicyOR.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyOR.pHashList);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -313,14 +311,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyOR_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyPCR.c b/src/tss2-esys/api/Esys_PolicyPCR.c
index 60f8888..661b5e5 100644
--- a/src/tss2-esys/api/Esys_PolicyPCR.c
+++ b/src/tss2-esys/api/Esys_PolicyPCR.c
@@ -50,8 +50,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] pcrDigest Expected digest value of the selected PCR using the hash
- * algorithm of the session; may be zero length.
+ * @param[in] pcrDigest Expected digest value of the selected PCR using the
+ * hash algorithm of the session; may be zero length.
* @param[in] pcrs The PCR to include in the check digest.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -70,9 +70,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -91,13 +91,8 @@
{
TSS2_RC r;
- r = Esys_PolicyPCR_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- pcrDigest,
- pcrs);
+ r = Esys_PolicyPCR_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, pcrDigest, pcrs);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -138,8 +133,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] pcrDigest Expected digest value of the selected PCR using the hash
- * algorithm of the session; may be zero length.
+ * @param[in] pcrDigest Expected digest value of the selected PCR using the
+ * hash algorithm of the session; may be zero length.
* @param[in] pcrs The PCR to include in the check digest.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -153,9 +148,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -190,9 +185,7 @@
/* Check and store 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, policySession,
- pcrDigest,
- pcrs);
+ store_input_parameters(esysContext, policySession, pcrDigest, pcrs);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -200,9 +193,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyPCR_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- pcrDigest,
- pcrs);
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle, pcrDigest,
+ pcrs);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -214,14 +207,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -294,12 +290,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyPCR_Async(esysContext,
- esysContext->in.PolicyPCR.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyPCR.pcrDigest,
- esysContext->in.PolicyPCR.pcrs);
+ esysContext->in.PolicyPCR.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyPCR.pcrDigest,
+ esysContext->in.PolicyPCR.pcrs);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -326,14 +322,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyPCR_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyPassword.c b/src/tss2-esys/api/Esys_PolicyPassword.c
index 9c40bb2..55ac1d1 100644
--- a/src/tss2-esys/api/Esys_PolicyPassword.c
+++ b/src/tss2-esys/api/Esys_PolicyPassword.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_PolicyPassword_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyPassword_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyPassword_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -187,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyPassword_Async(esysContext,
- esysContext->in.PolicyPassword.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyPassword.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyPassword_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
ESYS_TR policySession = esysContext->in.PolicyPassword.policySession;
RSRC_NODE_T *policySessionNode;
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -312,7 +317,8 @@
if (policySessionNode != NULL)
/* Indicate that the authValue of authorized object will be checked */
- policySessionNode->rsrc.misc.rsrc_session.type_policy_session = POLICY_PASSWORD;
+ policySessionNode->rsrc.misc.rsrc_session.type_policy_session =
+ POLICY_PASSWORD;
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyPhysicalPresence.c b/src/tss2-esys/api/Esys_PolicyPhysicalPresence.c
index 879d7b9..9e338c7 100644
--- a/src/tss2-esys/api/Esys_PolicyPhysicalPresence.c
+++ b/src/tss2-esys/api/Esys_PolicyPhysicalPresence.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_PolicyPhysicalPresence_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyPhysicalPresence_Async(esysContext, policySession, shandle1,
+ shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyPhysicalPresence_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -187,14 +186,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,10 +269,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyPhysicalPresence_Async(esysContext,
- esysContext->in.PolicyPhysicalPresence.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyPhysicalPresence.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,14 +299,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyPhysicalPresence_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyRestart.c b/src/tss2-esys/api/Esys_PolicyRestart.c
index e2db6dc..7f57489 100644
--- a/src/tss2-esys/api/Esys_PolicyRestart.c
+++ b/src/tss2-esys/api/Esys_PolicyRestart.c
@@ -51,9 +51,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_PolicyRestart_Async(esysContext,
- sessionHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_PolicyRestart_Async(esysContext, sessionHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -130,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -175,7 +172,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyRestart_Prepare(esysContext->sys,
- (sessionHandleNode == NULL) ? TPM2_RH_NULL : sessionHandleNode->rsrc.handle);
+ (sessionHandleNode == NULL) ? TPM2_RH_NULL
+ : sessionHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -187,14 +185,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, sessionHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -267,10 +268,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyRestart_Async(esysContext,
- esysContext->in.PolicyRestart.sessionHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.PolicyRestart.sessionHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,14 +298,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyRestart_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicySecret.c b/src/tss2-esys/api/Esys_PolicySecret.c
index fc88e4f..e2d0717 100644
--- a/src/tss2-esys/api/Esys_PolicySecret.c
+++ b/src/tss2-esys/api/Esys_PolicySecret.c
@@ -66,16 +66,16 @@
* @param[in] nonceTPM The policy nonce for the session.
* @param[in] cpHashA Digest of the command parameters to which this
* authorization is limited.
- * @param[in] policyRef A reference to a policy relating to the authorization -
- * may be the Empty Buffer.
- * @param[in] expiration Time when authorization will expire, measured in seconds
- * from the time that nonceTPM was generated.
- * @param[out] timeout Implementation-specific time value used to indicate to the
- * TPM when the ticket expires; this ticket will use the
+ * @param[in] policyRef A reference to a policy relating to the authorization
+ * - may be the Empty Buffer.
+ * @param[in] expiration Time when authorization will expire, measured in
+ * seconds from the time that nonceTPM was generated.
+ * @param[out] timeout Implementation-specific time value used to indicate to
+ * the TPM when the ticket expires; this ticket will use the
* TPMT_ST_AUTH_SECRET structure tag.
* (callee-allocated)
- * @param[out] policyTicket Produced if the command succeeds and expiration in the
- * command was non-zero ( See 23.2.5).
+ * @param[out] policyTicket Produced if the command succeeds and expiration in
+ * the command was non-zero ( See 23.2.5).
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -94,9 +94,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -117,16 +117,9 @@
{
TSS2_RC r;
- r = Esys_PolicySecret_Async(esysContext,
- authHandle,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration);
+ r = Esys_PolicySecret_Async(esysContext, authHandle, policySession, shandle1,
+ shandle2, shandle3, nonceTPM, cpHashA, policyRef,
+ expiration);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -140,9 +133,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PolicySecret_Finish(esysContext,
- timeout,
- policyTicket);
+ r = Esys_PolicySecret_Finish(esysContext, timeout, policyTicket);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -173,10 +164,10 @@
* @param[in] nonceTPM The policy nonce for the session.
* @param[in] cpHashA Digest of the command parameters to which this
* authorization is limited.
- * @param[in] policyRef A reference to a policy relating to the authorization -
- * may be the Empty Buffer.
- * @param[in] expiration Time when authorization will expire, measured in seconds
- * from the time that nonceTPM was generated.
+ * @param[in] policyRef A reference to a policy relating to the authorization
+ * - may be the Empty Buffer.
+ * @param[in] expiration Time when authorization will expire, measured in
+ * seconds from the time that nonceTPM was generated.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -189,9 +180,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_PolicySecret_Async(
@@ -229,11 +220,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle, policySession,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration);
+ store_input_parameters(esysContext, authHandle, policySession, nonceTPM,
+ cpHashA, policyRef, expiration);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -243,12 +231,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicySecret_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ nonceTPM, cpHashA, policyRef, expiration);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -261,14 +248,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, policySessionNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -283,12 +273,12 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] timeout Implementation-specific time value used to indicate to the
- * TPM when the ticket expires; this ticket will use the
+ * @param[out] timeout Implementation-specific time value used to indicate to
+ * the TPM when the ticket expires; this ticket will use the
* TPMT_ST_AUTH_SECRET structure tag.
* (callee-allocated)
- * @param[out] policyTicket Produced if the command succeeds and expiration in the
- * command was non-zero ( See 23.2.5).
+ * @param[out] policyTicket Produced if the command succeeds and expiration in
+ * the command was non-zero ( See 23.2.5).
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
* @retval ESYS_RC_SUCCESS if the function call was a success.
@@ -364,15 +354,15 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicySecret_Async(esysContext,
- esysContext->in.PolicySecret.authHandle,
- esysContext->in.PolicySecret.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicySecret.nonceTPM,
- esysContext->in.PolicySecret.cpHashA,
- esysContext->in.PolicySecret.policyRef,
- esysContext->in.PolicySecret.expiration);
+ esysContext->in.PolicySecret.authHandle,
+ esysContext->in.PolicySecret.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicySecret.nonceTPM,
+ esysContext->in.PolicySecret.cpHashA,
+ esysContext->in.PolicySecret.policyRef,
+ esysContext->in.PolicySecret.expiration);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -400,16 +390,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicySecret_Complete(esysContext->sys,
- (timeout != NULL) ? *timeout : NULL,
- (policyTicket != NULL) ? *policyTicket : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (timeout != NULL) ? *timeout : NULL,
+ (policyTicket != NULL) ? *policyTicket
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicySigned.c b/src/tss2-esys/api/Esys_PolicySigned.c
index 5ce7a4b..6405100 100644
--- a/src/tss2-esys/api/Esys_PolicySigned.c
+++ b/src/tss2-esys/api/Esys_PolicySigned.c
@@ -74,16 +74,16 @@
* @param[in] nonceTPM The policy nonce for the session.
* @param[in] cpHashA Digest of the command parameters to which this
* authorization is limited.
- * @param[in] policyRef A reference to a policy relating to the authorization -
- * may be the Empty Buffer.
- * @param[in] expiration Time when authorization will expire, measured in seconds
- * from the time that nonceTPM was generated.
+ * @param[in] policyRef A reference to a policy relating to the authorization
+ * - may be the Empty Buffer.
+ * @param[in] expiration Time when authorization will expire, measured in
+ * seconds from the time that nonceTPM was generated.
* @param[in] auth Signed authorization (not optional).
- * @param[out] timeout Implementation-specific time value, used to indicate to the
- * TPM when the ticket expires.
+ * @param[out] timeout Implementation-specific time value, used to indicate to
+ * the TPM when the ticket expires.
* (callee-allocated)
- * @param[out] policyTicket Produced if the command succeeds and expiration in the
- * command was non-zero; this ticket will use the
+ * @param[out] policyTicket Produced if the command succeeds and expiration in
+ * the command was non-zero; this ticket will use the
* TPMT_ST_AUTH_SIGNED structure tag. See 23.2.5.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS if the function call was a success.
@@ -103,9 +103,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -127,17 +127,9 @@
{
TSS2_RC r;
- r = Esys_PolicySigned_Async(esysContext,
- authObject,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration,
- auth);
+ r = Esys_PolicySigned_Async(esysContext, authObject, policySession, shandle1,
+ shandle2, shandle3, nonceTPM, cpHashA, policyRef,
+ expiration, auth);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -151,9 +143,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_PolicySigned_Finish(esysContext,
- timeout,
- policyTicket);
+ r = Esys_PolicySigned_Finish(esysContext, timeout, policyTicket);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -184,10 +174,10 @@
* @param[in] nonceTPM The policy nonce for the session.
* @param[in] cpHashA Digest of the command parameters to which this
* authorization is limited.
- * @param[in] policyRef A reference to a policy relating to the authorization -
- * may be the Empty Buffer.
- * @param[in] expiration Time when authorization will expire, measured in seconds
- * from the time that nonceTPM was generated.
+ * @param[in] policyRef A reference to a policy relating to the authorization
+ * - may be the Empty Buffer.
+ * @param[in] expiration Time when authorization will expire, measured in
+ * seconds from the time that nonceTPM was generated.
* @param[in] auth Signed authorization (not optional).
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -201,9 +191,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_PolicySigned_Async(
@@ -242,12 +232,8 @@
/* Check and store 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, authObject, policySession,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration,
- auth);
+ store_input_parameters(esysContext, authObject, policySession, nonceTPM,
+ cpHashA, policyRef, expiration, auth);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authObject, &authObjectNode);
@@ -257,13 +243,12 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicySigned_Prepare(esysContext->sys,
- (authObjectNode == NULL) ? TPM2_RH_NULL : authObjectNode->rsrc.handle,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- nonceTPM,
- cpHashA,
- policyRef,
- expiration,
- auth);
+ (authObjectNode == NULL) ? TPM2_RH_NULL
+ : authObjectNode->rsrc.handle,
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ nonceTPM, cpHashA, policyRef, expiration,
+ auth);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -275,14 +260,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authObjectNode, policySessionNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -297,11 +285,11 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] timeout Implementation-specific time value, used to indicate to the
- * TPM when the ticket expires.
+ * @param[out] timeout Implementation-specific time value, used to indicate to
+ * the TPM when the ticket expires.
* (callee-allocated)
- * @param[out] policyTicket Produced if the command succeeds and expiration in the
- * command was non-zero; this ticket will use the
+ * @param[out] policyTicket Produced if the command succeeds and expiration in
+ * the command was non-zero; this ticket will use the
* TPMT_ST_AUTH_SIGNED structure tag. See 23.2.5.
* (callee-allocated)
* @retval TSS2_RC_SUCCESS on success
@@ -378,16 +366,16 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicySigned_Async(esysContext,
- esysContext->in.PolicySigned.authObject,
- esysContext->in.PolicySigned.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicySigned.nonceTPM,
- esysContext->in.PolicySigned.cpHashA,
- esysContext->in.PolicySigned.policyRef,
- esysContext->in.PolicySigned.expiration,
- esysContext->in.PolicySigned.auth);
+ esysContext->in.PolicySigned.authObject,
+ esysContext->in.PolicySigned.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicySigned.nonceTPM,
+ esysContext->in.PolicySigned.cpHashA,
+ esysContext->in.PolicySigned.policyRef,
+ esysContext->in.PolicySigned.expiration,
+ esysContext->in.PolicySigned.auth);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -415,16 +403,20 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicySigned_Complete(esysContext->sys,
- (timeout != NULL) ? *timeout : NULL,
- (policyTicket != NULL) ? *policyTicket : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (timeout != NULL) ? *timeout : NULL,
+ (policyTicket != NULL) ? *policyTicket
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyTemplate.c b/src/tss2-esys/api/Esys_PolicyTemplate.c
index 14e6f5c..8fe87ee 100644
--- a/src/tss2-esys/api/Esys_PolicyTemplate.c
+++ b/src/tss2-esys/api/Esys_PolicyTemplate.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -83,12 +83,8 @@
{
TSS2_RC r;
- r = Esys_PolicyTemplate_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- templateHash);
+ r = Esys_PolicyTemplate_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, templateHash);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -142,9 +138,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -180,8 +176,7 @@
/* Check and store 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, policySession,
- templateHash);
+ store_input_parameters(esysContext, policySession, templateHash);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -189,8 +184,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyTemplate_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- templateHash);
+ (policySessionNode == NULL)
+ ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle,
+ templateHash);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -202,14 +199,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -282,11 +282,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyTemplate_Async(esysContext,
- esysContext->in.PolicyTemplate.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyTemplate.templateHash);
+ esysContext->in.PolicyTemplate.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyTemplate.templateHash);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -313,14 +313,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyTemplate_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_PolicyTicket.c b/src/tss2-esys/api/Esys_PolicyTicket.c
index 50aba04..b33d69b 100644
--- a/src/tss2-esys/api/Esys_PolicyTicket.c
+++ b/src/tss2-esys/api/Esys_PolicyTicket.c
@@ -80,8 +80,8 @@
* @param[in] policyRef Reference to a qualifier for the policy - may be the
* Empty Buffer.
* @param[in] authName Name of the object that provided the authorization.
- * @param[in] ticket An authorization ticket returned by the TPM in response to a
- * TPM2_PolicySigned() or TPM2_PolicySecret().
+ * @param[in] ticket An authorization ticket returned by the TPM in response
+ * to a TPM2_PolicySigned() or TPM2_PolicySecret().
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -99,9 +99,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -123,16 +123,9 @@
{
TSS2_RC r;
- r = Esys_PolicyTicket_Async(esysContext,
- policySession,
- shandle1,
- shandle2,
- shandle3,
- timeout,
- cpHashA,
- policyRef,
- authName,
- ticket);
+ r = Esys_PolicyTicket_Async(esysContext, policySession, shandle1, shandle2,
+ shandle3, timeout, cpHashA, policyRef, authName,
+ ticket);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -179,8 +172,8 @@
* @param[in] policyRef Reference to a qualifier for the policy - may be the
* Empty Buffer.
* @param[in] authName Name of the object that provided the authorization.
- * @param[in] ticket An authorization ticket returned by the TPM in response to a
- * TPM2_PolicySigned() or TPM2_PolicySecret().
+ * @param[in] ticket An authorization ticket returned by the TPM in response
+ * to a TPM2_PolicySigned() or TPM2_PolicySecret().
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -193,9 +186,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -235,12 +228,8 @@
/* Check and store 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, policySession,
- timeout,
- cpHashA,
- policyRef,
- authName,
- ticket);
+ store_input_parameters(esysContext, policySession, timeout, cpHashA,
+ policyRef, authName, ticket);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, policySession, &policySessionNode);
@@ -248,12 +237,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_PolicyTicket_Prepare(esysContext->sys,
- (policySessionNode == NULL) ? TPM2_RH_NULL : policySessionNode->rsrc.handle,
- timeout,
- cpHashA,
- policyRef,
- authName,
- ticket);
+ (policySessionNode == NULL) ? TPM2_RH_NULL
+ : policySessionNode->rsrc.handle, timeout,
+ cpHashA, policyRef, authName, ticket);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -265,14 +251,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, policySessionNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -345,15 +334,15 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_PolicyTicket_Async(esysContext,
- esysContext->in.PolicyTicket.policySession,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.PolicyTicket.timeout,
- esysContext->in.PolicyTicket.cpHashA,
- esysContext->in.PolicyTicket.policyRef,
- esysContext->in.PolicyTicket.authName,
- esysContext->in.PolicyTicket.ticket);
+ esysContext->in.PolicyTicket.policySession,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.PolicyTicket.timeout,
+ esysContext->in.PolicyTicket.cpHashA,
+ esysContext->in.PolicyTicket.policyRef,
+ esysContext->in.PolicyTicket.authName,
+ esysContext->in.PolicyTicket.ticket);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -380,14 +369,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_PolicyTicket_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Quote.c b/src/tss2-esys/api/Esys_Quote.c
index 86dcb31..f46e3c0 100644
--- a/src/tss2-esys/api/Esys_Quote.c
+++ b/src/tss2-esys/api/Esys_Quote.c
@@ -83,9 +83,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -104,14 +104,8 @@
{
TSS2_RC r;
- r = Esys_Quote_Async(esysContext,
- signHandle,
- shandle1,
- shandle2,
- shandle3,
- qualifyingData,
- inScheme,
- PCRselect);
+ r = Esys_Quote_Async(esysContext, signHandle, shandle1, shandle2, shandle3,
+ qualifyingData, inScheme, PCRselect);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -125,9 +119,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Quote_Finish(esysContext,
- quoted,
- signature);
+ r = Esys_Quote_Finish(esysContext, quoted, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -170,9 +162,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Quote_Async(
@@ -205,10 +197,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, signHandle,
- qualifyingData,
- inScheme,
- PCRselect);
+ store_input_parameters(esysContext, signHandle, qualifyingData, inScheme,
+ PCRselect);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, signHandle, &signHandleNode);
@@ -216,10 +206,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Quote_Prepare(esysContext->sys,
- (signHandleNode == NULL) ? TPM2_RH_NULL : signHandleNode->rsrc.handle,
- qualifyingData,
- inScheme,
- PCRselect);
+ (signHandleNode == NULL) ? TPM2_RH_NULL
+ : signHandleNode->rsrc.handle, qualifyingData,
+ inScheme, PCRselect);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -232,14 +221,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, signHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -331,14 +323,13 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Quote_Async(esysContext,
- esysContext->in.Quote.signHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Quote.qualifyingData,
- esysContext->in.Quote.inScheme,
- esysContext->in.Quote.PCRselect);
+ r = Esys_Quote_Async(esysContext, esysContext->in.Quote.signHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Quote.qualifyingData,
+ esysContext->in.Quote.inScheme,
+ esysContext->in.Quote.PCRselect);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -366,16 +357,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Quote_Complete(esysContext->sys,
- (quoted != NULL) ? *quoted : NULL,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (quoted != NULL) ? *quoted : NULL,
+ (signature != NULL) ? *signature : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_RSA_Decrypt.c b/src/tss2-esys/api/Esys_RSA_Decrypt.c
index 101c516..d9a1300 100644
--- a/src/tss2-esys/api/Esys_RSA_Decrypt.c
+++ b/src/tss2-esys/api/Esys_RSA_Decrypt.c
@@ -81,9 +81,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -101,14 +101,8 @@
{
TSS2_RC r;
- r = Esys_RSA_Decrypt_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- cipherText,
- inScheme,
- label);
+ r = Esys_RSA_Decrypt_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, cipherText, inScheme, label);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -122,8 +116,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_RSA_Decrypt_Finish(esysContext,
- message);
+ r = Esys_RSA_Decrypt_Finish(esysContext, message);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -166,9 +159,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_RSA_Decrypt_Async(
@@ -201,10 +194,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyHandle,
- cipherText,
- inScheme,
- label);
+ store_input_parameters(esysContext, keyHandle, cipherText, inScheme, label);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -212,10 +202,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_RSA_Decrypt_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- cipherText,
- inScheme,
- label);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, cipherText,
+ inScheme, label);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -228,14 +217,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -319,13 +311,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_RSA_Decrypt_Async(esysContext,
- esysContext->in.RSA_Decrypt.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.RSA_Decrypt.cipherText,
- esysContext->in.RSA_Decrypt.inScheme,
- esysContext->in.RSA_Decrypt.label);
+ esysContext->in.RSA_Decrypt.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.RSA_Decrypt.cipherText,
+ esysContext->in.RSA_Decrypt.inScheme,
+ esysContext->in.RSA_Decrypt.label);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -353,15 +345,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_RSA_Decrypt_Complete(esysContext->sys,
- (message != NULL) ? *message : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (message != NULL) ? *message : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_RSA_Encrypt.c b/src/tss2-esys/api/Esys_RSA_Encrypt.c
index 4d7be97..8fcb9e8 100644
--- a/src/tss2-esys/api/Esys_RSA_Encrypt.c
+++ b/src/tss2-esys/api/Esys_RSA_Encrypt.c
@@ -82,9 +82,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -102,14 +102,8 @@
{
TSS2_RC r;
- r = Esys_RSA_Encrypt_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- message,
- inScheme,
- label);
+ r = Esys_RSA_Encrypt_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, message, inScheme, label);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -123,8 +117,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_RSA_Encrypt_Finish(esysContext,
- outData);
+ r = Esys_RSA_Encrypt_Finish(esysContext, outData);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -168,9 +161,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_RSA_Encrypt_Async(
@@ -203,10 +196,7 @@
/* Check and store 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, keyHandle,
- message,
- inScheme,
- label);
+ store_input_parameters(esysContext, keyHandle, message, inScheme, label);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -214,10 +204,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_RSA_Encrypt_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- message,
- inScheme,
- label);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, message,
+ inScheme, label);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -229,14 +218,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -320,13 +312,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_RSA_Encrypt_Async(esysContext,
- esysContext->in.RSA_Encrypt.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.RSA_Encrypt.message,
- esysContext->in.RSA_Encrypt.inScheme,
- esysContext->in.RSA_Encrypt.label);
+ esysContext->in.RSA_Encrypt.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.RSA_Encrypt.message,
+ esysContext->in.RSA_Encrypt.inScheme,
+ esysContext->in.RSA_Encrypt.label);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -354,15 +346,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_RSA_Encrypt_Complete(esysContext->sys,
- (outData != NULL) ? *outData : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outData != NULL) ? *outData : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ReadClock.c b/src/tss2-esys/api/Esys_ReadClock.c
index a68bca4..485192b 100644
--- a/src/tss2-esys/api/Esys_ReadClock.c
+++ b/src/tss2-esys/api/Esys_ReadClock.c
@@ -64,10 +64,7 @@
{
TSS2_RC r;
- r = Esys_ReadClock_Async(esysContext,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_ReadClock_Async(esysContext, shandle1, shandle2, shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -81,8 +78,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ReadClock_Finish(esysContext,
- currentTime);
+ r = Esys_ReadClock_Finish(esysContext, currentTime);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -166,14 +162,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -256,10 +255,9 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_ReadClock_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ r = Esys_ReadClock_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -287,15 +285,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ReadClock_Complete(esysContext->sys,
- (currentTime != NULL) ? *currentTime : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (currentTime != NULL) ? *currentTime
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ReadPublic.c b/src/tss2-esys/api/Esys_ReadPublic.c
index 13915ee..4e9ac8c 100644
--- a/src/tss2-esys/api/Esys_ReadPublic.c
+++ b/src/tss2-esys/api/Esys_ReadPublic.c
@@ -57,9 +57,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -79,11 +79,8 @@
{
TSS2_RC r;
- r = Esys_ReadPublic_Async(esysContext,
- objectHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_ReadPublic_Async(esysContext, objectHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -97,10 +94,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ReadPublic_Finish(esysContext,
- outPublic,
- name,
- qualifiedName);
+ r = Esys_ReadPublic_Finish(esysContext, outPublic, name, qualifiedName);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -139,9 +133,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -181,7 +175,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ReadPublic_Prepare(esysContext->sys,
- (objectHandleNode == NULL) ? TPM2_RH_NULL : objectHandleNode->rsrc.handle);
+ (objectHandleNode == NULL) ? TPM2_RH_NULL
+ : objectHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -193,14 +188,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, objectHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -308,10 +306,10 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_ReadPublic_Async(esysContext,
- esysContext->in.ReadPublic.objectHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ esysContext->in.ReadPublic.objectHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -339,17 +337,21 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ReadPublic_Complete(esysContext->sys,
- (outPublic != NULL) ? *outPublic : NULL,
- (name != NULL) ? *name : NULL,
- (qualifiedName != NULL) ? *qualifiedName : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outPublic != NULL) ? *outPublic : NULL,
+ (name != NULL) ? *name : NULL,
+ (qualifiedName != NULL) ? *qualifiedName
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Rewrap.c b/src/tss2-esys/api/Esys_Rewrap.c
index 04e0f1d..0b455e6 100644
--- a/src/tss2-esys/api/Esys_Rewrap.c
+++ b/src/tss2-esys/api/Esys_Rewrap.c
@@ -65,8 +65,8 @@
* inSymSeed.
* @param[in] name The Name of the object being rewrapped.
* @param[in] inSymSeed The seed for the symmetric key and HMAC key.
- * @param[out] outDuplicate An object encrypted using symmetric key derived from
- * outSymSeed.
+ * @param[out] outDuplicate An object encrypted using symmetric key derived
+ * from outSymSeed.
* (callee-allocated)
* @param[out] outSymSeed Seed for a symmetric key protected by newParent
* asymmetric key.
@@ -88,9 +88,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -110,15 +110,8 @@
{
TSS2_RC r;
- r = Esys_Rewrap_Async(esysContext,
- oldParent,
- newParent,
- shandle1,
- shandle2,
- shandle3,
- inDuplicate,
- name,
- inSymSeed);
+ r = Esys_Rewrap_Async(esysContext, oldParent, newParent, shandle1, shandle2,
+ shandle3, inDuplicate, name, inSymSeed);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -132,9 +125,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Rewrap_Finish(esysContext,
- outDuplicate,
- outSymSeed);
+ r = Esys_Rewrap_Finish(esysContext, outDuplicate, outSymSeed);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -178,9 +169,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_Rewrap_Async(
@@ -216,10 +207,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, oldParent, newParent,
- inDuplicate,
- name,
- inSymSeed);
+ store_input_parameters(esysContext, oldParent, newParent, inDuplicate, name,
+ inSymSeed);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, oldParent, &oldParentNode);
@@ -229,11 +218,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Rewrap_Prepare(esysContext->sys,
- (oldParentNode == NULL) ? TPM2_RH_NULL : oldParentNode->rsrc.handle,
- (newParentNode == NULL) ? TPM2_RH_NULL : newParentNode->rsrc.handle,
- inDuplicate,
- name,
- inSymSeed);
+ (oldParentNode == NULL) ? TPM2_RH_NULL
+ : oldParentNode->rsrc.handle,
+ (newParentNode == NULL) ? TPM2_RH_NULL
+ : newParentNode->rsrc.handle, inDuplicate, name,
+ inSymSeed);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -246,14 +235,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, oldParentNode, newParentNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -268,8 +260,8 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] outDuplicate An object encrypted using symmetric key derived from
- * outSymSeed.
+ * @param[out] outDuplicate An object encrypted using symmetric key derived
+ * from outSymSeed.
* (callee-allocated)
* @param[out] outSymSeed Seed for a symmetric key protected by newParent
* asymmetric key.
@@ -347,15 +339,14 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Rewrap_Async(esysContext,
- esysContext->in.Rewrap.oldParent,
- esysContext->in.Rewrap.newParent,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Rewrap.inDuplicate,
- esysContext->in.Rewrap.name,
- esysContext->in.Rewrap.inSymSeed);
+ r = Esys_Rewrap_Async(esysContext, esysContext->in.Rewrap.oldParent,
+ esysContext->in.Rewrap.newParent,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Rewrap.inDuplicate,
+ esysContext->in.Rewrap.name,
+ esysContext->in.Rewrap.inSymSeed);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -383,16 +374,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Rewrap_Complete(esysContext->sys,
- (outDuplicate != NULL) ? *outDuplicate : NULL,
- (outSymSeed != NULL) ? *outSymSeed : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outDuplicate != NULL) ? *outDuplicate : NULL,
+ (outSymSeed != NULL) ? *outSymSeed : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_SelfTest.c b/src/tss2-esys/api/Esys_SelfTest.c
index 70ce3f4..18e3899 100644
--- a/src/tss2-esys/api/Esys_SelfTest.c
+++ b/src/tss2-esys/api/Esys_SelfTest.c
@@ -70,11 +70,8 @@
{
TSS2_RC r;
- r = Esys_SelfTest_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- fullTest);
+ r = Esys_SelfTest_Async(esysContext, shandle1, shandle2, shandle3,
+ fullTest);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -160,12 +157,10 @@
/* Check and store 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,
- fullTest);
+ store_input_parameters(esysContext, fullTest);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_SelfTest_Prepare(esysContext->sys,
- fullTest);
+ r = Tss2_Sys_SelfTest_Prepare(esysContext->sys, fullTest);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -177,14 +172,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -256,11 +254,10 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_SelfTest_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SelfTest.fullTest);
+ r = Esys_SelfTest_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SelfTest.fullTest);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -287,14 +284,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SelfTest_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_SequenceComplete.c b/src/tss2-esys/api/Esys_SequenceComplete.c
index 7409d30..4a5a0f4 100644
--- a/src/tss2-esys/api/Esys_SequenceComplete.c
+++ b/src/tss2-esys/api/Esys_SequenceComplete.c
@@ -68,9 +68,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -88,13 +88,8 @@
{
TSS2_RC r;
- r = Esys_SequenceComplete_Async(esysContext,
- sequenceHandle,
- shandle1,
- shandle2,
- shandle3,
- buffer,
- hierarchy);
+ r = Esys_SequenceComplete_Async(esysContext, sequenceHandle, shandle1,
+ shandle2, shandle3, buffer, hierarchy);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -108,9 +103,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_SequenceComplete_Finish(esysContext,
- result,
- validation);
+ r = Esys_SequenceComplete_Finish(esysContext, result, validation);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -151,9 +144,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_SequenceComplete_Async(
@@ -185,9 +178,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, sequenceHandle,
- buffer,
- hierarchy);
+ store_input_parameters(esysContext, sequenceHandle, buffer, hierarchy);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, sequenceHandle, &sequenceHandleNode);
@@ -195,9 +186,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_SequenceComplete_Prepare(esysContext->sys,
- (sequenceHandleNode == NULL) ? TPM2_RH_NULL : sequenceHandleNode->rsrc.handle,
- buffer,
- hierarchy);
+ (sequenceHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : sequenceHandleNode->rsrc.handle,
+ buffer, hierarchy);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -210,14 +202,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, sequenceHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -311,12 +306,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_SequenceComplete_Async(esysContext,
- esysContext->in.SequenceComplete.sequenceHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SequenceComplete.buffer,
- esysContext->in.SequenceComplete.hierarchy);
+ esysContext->in.SequenceComplete.sequenceHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SequenceComplete.buffer,
+ esysContext->in.SequenceComplete.hierarchy);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -344,18 +339,23 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SequenceComplete_Complete(esysContext->sys,
- (result != NULL) ? *result : NULL,
- (validation != NULL) ? *validation : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (result != NULL) ? *result : NULL,
+ (validation != NULL) ? *validation
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
/* The ESYS_TR sequence object has to be invalidated */
- r = Esys_TR_Close(esysContext, &esysContext->in.SequenceComplete.sequenceHandle);
+ r = Esys_TR_Close(esysContext,
+ &esysContext->in.SequenceComplete.sequenceHandle);
goto_if_error(r, "invalidate object", error_cleanup);
esysContext->state = _ESYS_STATE_INIT;
diff --git a/src/tss2-esys/api/Esys_SequenceUpdate.c b/src/tss2-esys/api/Esys_SequenceUpdate.c
index f48e393..c3f72dc 100644
--- a/src/tss2-esys/api/Esys_SequenceUpdate.c
+++ b/src/tss2-esys/api/Esys_SequenceUpdate.c
@@ -60,9 +60,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -80,12 +80,8 @@
{
TSS2_RC r;
- r = Esys_SequenceUpdate_Async(esysContext,
- sequenceHandle,
- shandle1,
- shandle2,
- shandle3,
- buffer);
+ r = Esys_SequenceUpdate_Async(esysContext, sequenceHandle, shandle1,
+ shandle2, shandle3, buffer);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -139,9 +135,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -174,8 +170,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, sequenceHandle,
- buffer);
+ store_input_parameters(esysContext, sequenceHandle, buffer);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, sequenceHandle, &sequenceHandleNode);
@@ -183,8 +178,10 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_SequenceUpdate_Prepare(esysContext->sys,
- (sequenceHandleNode == NULL) ? TPM2_RH_NULL : sequenceHandleNode->rsrc.handle,
- buffer);
+ (sequenceHandleNode == NULL)
+ ? TPM2_RH_NULL
+ : sequenceHandleNode->rsrc.handle,
+ buffer);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -197,14 +194,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, sequenceHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -277,11 +277,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_SequenceUpdate_Async(esysContext,
- esysContext->in.SequenceUpdate.sequenceHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SequenceUpdate.buffer);
+ esysContext->in.SequenceUpdate.sequenceHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SequenceUpdate.buffer);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -308,14 +308,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SequenceUpdate_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_SetAlgorithmSet.c b/src/tss2-esys/api/Esys_SetAlgorithmSet.c
index fb72c62..d7167e2 100644
--- a/src/tss2-esys/api/Esys_SetAlgorithmSet.c
+++ b/src/tss2-esys/api/Esys_SetAlgorithmSet.c
@@ -36,8 +36,8 @@
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] algorithmSet A TPM vendor-dependent value indicating the algorithm
- * set selection.
+ * @param[in] algorithmSet A TPM vendor-dependent value indicating the
+ * algorithm set selection.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -55,9 +55,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -78,12 +78,8 @@
{
TSS2_RC r;
- r = Esys_SetAlgorithmSet_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- algorithmSet);
+ r = Esys_SetAlgorithmSet_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, algorithmSet);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,8 +120,8 @@
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] algorithmSet A TPM vendor-dependent value indicating the algorithm
- * set selection.
+ * @param[in] algorithmSet A TPM vendor-dependent value indicating the
+ * algorithm set selection.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
* pointers or required output handle references are NULL.
@@ -138,9 +134,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -176,8 +172,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- algorithmSet);
+ store_input_parameters(esysContext, authHandle, algorithmSet);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -185,8 +180,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_SetAlgorithmSet_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- algorithmSet);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ algorithmSet);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -199,14 +195,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -279,11 +278,11 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_SetAlgorithmSet_Async(esysContext,
- esysContext->in.SetAlgorithmSet.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SetAlgorithmSet.algorithmSet);
+ esysContext->in.SetAlgorithmSet.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SetAlgorithmSet.algorithmSet);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -310,14 +309,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SetAlgorithmSet_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_SetCommandCodeAuditStatus.c b/src/tss2-esys/api/Esys_SetCommandCodeAuditStatus.c
index 5c548bb..95626ca 100644
--- a/src/tss2-esys/api/Esys_SetCommandCodeAuditStatus.c
+++ b/src/tss2-esys/api/Esys_SetCommandCodeAuditStatus.c
@@ -52,10 +52,10 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] auditAlg TPM2_Hash algorithm for the audit digest; if TPM2_ALG_NULL, then
- * the hash is not changed.
- * @param[in] setList List of commands that will be added to those that will be
- * audited.
+ * @param[in] auditAlg TPM2_Hash algorithm for the audit digest; if TPM2_ALG_NULL,
+ * then the hash is not changed.
+ * @param[in] setList List of commands that will be added to those that will
+ * be audited.
* @param[in] clearList List of commands that will no longer be audited.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -74,9 +74,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -99,14 +99,9 @@
{
TSS2_RC r;
- r = Esys_SetCommandCodeAuditStatus_Async(esysContext,
- auth,
- shandle1,
- shandle2,
- shandle3,
- auditAlg,
- setList,
- clearList);
+ r = Esys_SetCommandCodeAuditStatus_Async(esysContext, auth, shandle1,
+ shandle2, shandle3, auditAlg,
+ setList, clearList);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -147,10 +142,10 @@
* @param[in] shandle1 Session handle for authorization of auth
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] auditAlg TPM2_Hash algorithm for the audit digest; if TPM2_ALG_NULL, then
- * the hash is not changed.
- * @param[in] setList List of commands that will be added to those that will be
- * audited.
+ * @param[in] auditAlg TPM2_Hash algorithm for the audit digest; if TPM2_ALG_NULL,
+ * then the hash is not changed.
+ * @param[in] setList List of commands that will be added to those that will
+ * be audited.
* @param[in] clearList List of commands that will no longer be audited.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -164,9 +159,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -205,10 +200,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, auth,
- auditAlg,
- setList,
- clearList);
+ store_input_parameters(esysContext, auth, auditAlg, setList, clearList);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, auth, &authNode);
@@ -216,10 +208,11 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_SetCommandCodeAuditStatus_Prepare(esysContext->sys,
- (authNode == NULL) ? TPM2_RH_NULL : authNode->rsrc.handle,
- auditAlg,
- setList,
- clearList);
+ (authNode == NULL)
+ ? TPM2_RH_NULL
+ : authNode->rsrc.handle,
+ auditAlg, setList,
+ clearList);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -232,14 +225,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -312,13 +308,13 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_SetCommandCodeAuditStatus_Async(esysContext,
- esysContext->in.SetCommandCodeAuditStatus.auth,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SetCommandCodeAuditStatus.auditAlg,
- esysContext->in.SetCommandCodeAuditStatus.setList,
- esysContext->in.SetCommandCodeAuditStatus.clearList);
+ esysContext->in.SetCommandCodeAuditStatus.auth,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SetCommandCodeAuditStatus.auditAlg,
+ esysContext->in.SetCommandCodeAuditStatus.setList,
+ esysContext->in.SetCommandCodeAuditStatus.clearList);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -345,14 +341,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SetCommandCodeAuditStatus_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_SetPrimaryPolicy.c b/src/tss2-esys/api/Esys_SetPrimaryPolicy.c
index c63da84..b7dd660 100644
--- a/src/tss2-esys/api/Esys_SetPrimaryPolicy.c
+++ b/src/tss2-esys/api/Esys_SetPrimaryPolicy.c
@@ -45,7 +45,8 @@
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] authPolicy An authorization policy digest; may be the Empty Buffer.
+ * @param[in] authPolicy An authorization policy digest; may be the Empty
+ * Buffer.
* @param[in] hashAlg The hash algorithm to use for the policy.
* @retval TSS2_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -64,9 +65,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -85,13 +86,8 @@
{
TSS2_RC r;
- r = Esys_SetPrimaryPolicy_Async(esysContext,
- authHandle,
- shandle1,
- shandle2,
- shandle3,
- authPolicy,
- hashAlg);
+ r = Esys_SetPrimaryPolicy_Async(esysContext, authHandle, shandle1, shandle2,
+ shandle3, authPolicy, hashAlg);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -133,7 +129,8 @@
* @param[in] shandle1 Session handle for authorization of authHandle
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] authPolicy An authorization policy digest; may be the Empty Buffer.
+ * @param[in] authPolicy An authorization policy digest; may be the Empty
+ * Buffer.
* @param[in] hashAlg The hash algorithm to use for the policy.
* @retval ESYS_RC_SUCCESS if the function call was a success.
* @retval TSS2_ESYS_RC_BAD_REFERENCE if the esysContext or required input
@@ -147,9 +144,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -184,9 +181,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, authHandle,
- authPolicy,
- hashAlg);
+ store_input_parameters(esysContext, authHandle, authPolicy, hashAlg);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, authHandle, &authHandleNode);
@@ -194,9 +189,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_SetPrimaryPolicy_Prepare(esysContext->sys,
- (authHandleNode == NULL) ? TPM2_RH_NULL : authHandleNode->rsrc.handle,
- authPolicy,
- hashAlg);
+ (authHandleNode == NULL) ? TPM2_RH_NULL
+ : authHandleNode->rsrc.handle,
+ authPolicy, hashAlg);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -209,14 +204,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, authHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -289,12 +287,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_SetPrimaryPolicy_Async(esysContext,
- esysContext->in.SetPrimaryPolicy.authHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.SetPrimaryPolicy.authPolicy,
- esysContext->in.SetPrimaryPolicy.hashAlg);
+ esysContext->in.SetPrimaryPolicy.authHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.SetPrimaryPolicy.authPolicy,
+ esysContext->in.SetPrimaryPolicy.hashAlg);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -321,14 +319,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_SetPrimaryPolicy_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Shutdown.c b/src/tss2-esys/api/Esys_Shutdown.c
index d49b6fd..f9e5894 100644
--- a/src/tss2-esys/api/Esys_Shutdown.c
+++ b/src/tss2-esys/api/Esys_Shutdown.c
@@ -70,11 +70,8 @@
{
TSS2_RC r;
- r = Esys_Shutdown_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- shutdownType);
+ r = Esys_Shutdown_Async(esysContext, shandle1, shandle2, shandle3,
+ shutdownType);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -160,12 +157,10 @@
/* Check and store 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);
+ store_input_parameters(esysContext, shutdownType);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_Shutdown_Prepare(esysContext->sys,
- shutdownType);
+ r = Tss2_Sys_Shutdown_Prepare(esysContext->sys, shutdownType);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -177,14 +172,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -256,11 +254,10 @@
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 = Esys_Shutdown_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Shutdown.shutdownType);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -287,14 +284,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Shutdown_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Sign.c b/src/tss2-esys/api/Esys_Sign.c
index 5723cd5..a445d32 100644
--- a/src/tss2-esys/api/Esys_Sign.c
+++ b/src/tss2-esys/api/Esys_Sign.c
@@ -81,9 +81,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -104,14 +104,8 @@
{
TSS2_RC r;
- r = Esys_Sign_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- digest,
- inScheme,
- validation);
+ r = Esys_Sign_Async(esysContext, keyHandle, shandle1, shandle2, shandle3,
+ digest, inScheme, validation);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -125,8 +119,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Sign_Finish(esysContext,
- signature);
+ r = Esys_Sign_Finish(esysContext, signature);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -169,9 +162,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -207,10 +200,8 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyHandle,
- digest,
- inScheme,
- validation);
+ store_input_parameters(esysContext, keyHandle, digest, inScheme,
+ validation);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -218,10 +209,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Sign_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- digest,
- inScheme,
- validation);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, digest, inScheme,
+ validation);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -234,14 +224,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -324,14 +317,13 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Sign_Async(esysContext,
- esysContext->in.Sign.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Sign.digest,
- esysContext->in.Sign.inScheme,
- esysContext->in.Sign.validation);
+ r = Esys_Sign_Async(esysContext, esysContext->in.Sign.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Sign.digest,
+ esysContext->in.Sign.inScheme,
+ esysContext->in.Sign.validation);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -359,15 +351,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Sign_Complete(esysContext->sys,
- (signature != NULL) ? *signature : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (signature != NULL) ? *signature : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_StartAuthSession.c b/src/tss2-esys/api/Esys_StartAuthSession.c
index 0265e77..5bdb81a 100644
--- a/src/tss2-esys/api/Esys_StartAuthSession.c
+++ b/src/tss2-esys/api/Esys_StartAuthSession.c
@@ -57,7 +57,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] nonceCaller Initial nonceCaller, sets nonceTPM size for the session.
+ * @param[in] nonceCaller Initial nonceCaller, sets nonceTPM size for the
+ * session.
* @param[in] sessionType Indicates the type of the session; simple HMAC or
* policy (including a trial policy).
* @param[in] symmetric The algorithm and key size for parameter encryption.
@@ -80,9 +81,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -97,21 +98,13 @@
const TPM2B_NONCE *nonceCaller,
TPM2_SE sessionType,
const TPMT_SYM_DEF *symmetric,
- TPMI_ALG_HASH authHash,
- ESYS_TR *sessionHandle)
+ TPMI_ALG_HASH authHash, ESYS_TR *sessionHandle)
{
TSS2_RC r;
- r = Esys_StartAuthSession_Async(esysContext,
- tpmKey,
- bind,
- shandle1,
- shandle2,
- shandle3,
- nonceCaller,
- sessionType,
- symmetric,
- authHash);
+ r = Esys_StartAuthSession_Async(esysContext, tpmKey, bind, shandle1,
+ shandle2, shandle3, nonceCaller, sessionType,
+ symmetric, authHash);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -125,8 +118,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_StartAuthSession_Finish(esysContext,
- sessionHandle);
+ r = Esys_StartAuthSession_Finish(esysContext, sessionHandle);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -154,7 +146,8 @@
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
- * @param[in] nonceCaller Initial nonceCaller, sets nonceTPM size for the session.
+ * @param[in] nonceCaller Initial nonceCaller, sets nonceTPM size for the
+ * session.
* @param[in] sessionType Indicates the type of the session; simple HMAC or
* policy (including a trial policy).
* @param[in] symmetric The algorithm and key size for parameter encryption.
@@ -171,9 +164,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_StartAuthSession_Async(
@@ -213,11 +206,8 @@
/* Check and store 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, tpmKey, bind,
- nonceCaller,
- sessionType,
- symmetric,
- authHash);
+ store_input_parameters(esysContext, tpmKey, bind, nonceCaller, sessionType,
+ symmetric, authHash);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, tpmKey, &tpmKeyNode);
@@ -247,16 +237,14 @@
nonceCaller = esysContext->in.StartAuthSession.nonceCaller;
}
-
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_StartAuthSession_Prepare(esysContext->sys,
- (tpmKeyNode == NULL) ? TPM2_RH_NULL : tpmKeyNode->rsrc.handle,
- (bindNode == NULL) ? TPM2_RH_NULL : bindNode->rsrc.handle,
- nonceCaller,
- encryptedSalt,
- sessionType,
- symmetric,
- authHash);
+ (tpmKeyNode == NULL) ? TPM2_RH_NULL
+ : tpmKeyNode->rsrc.handle,
+ (bindNode == NULL) ? TPM2_RH_NULL
+ : bindNode->rsrc.handle, nonceCaller,
+ encryptedSalt, sessionType, symmetric,
+ authHash);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -268,14 +256,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, tpmKeyNode, bindNode, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -312,8 +303,7 @@
*/
TSS2_RC
Esys_StartAuthSession_Finish(
- ESYS_CONTEXT *esysContext,
- ESYS_TR *sessionHandle)
+ ESYS_CONTEXT *esysContext, ESYS_TR *sessionHandle)
{
TPM2B_NONCE lnonceTPM;
TSS2_RC r;
@@ -374,15 +364,15 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_StartAuthSession_Async(esysContext,
- esysContext->in.StartAuthSession.tpmKey,
- esysContext->in.StartAuthSession.bind,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.StartAuthSession.nonceCaller,
- esysContext->in.StartAuthSession.sessionType,
- esysContext->in.StartAuthSession.symmetric,
- esysContext->in.StartAuthSession.authHash);
+ esysContext->in.StartAuthSession.tpmKey,
+ esysContext->in.StartAuthSession.bind,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.StartAuthSession.nonceCaller,
+ esysContext->in.StartAuthSession.sessionType,
+ esysContext->in.StartAuthSession.symmetric,
+ esysContext->in.StartAuthSession.authHash);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -410,16 +400,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_StartAuthSession_Complete(esysContext->sys,
- &sessionHandleNode->rsrc.handle,
- &lnonceTPM);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ &sessionHandleNode->rsrc.handle,
+ &lnonceTPM);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
sessionHandleNode->rsrc.misc.rsrc_session.nonceTPM = lnonceTPM;
sessionHandleNode->rsrc.rsrcType = IESYSC_SESSION_RSRC;
diff --git a/src/tss2-esys/api/Esys_Startup.c b/src/tss2-esys/api/Esys_Startup.c
index 65e5b66..fdda44a 100644
--- a/src/tss2-esys/api/Esys_Startup.c
+++ b/src/tss2-esys/api/Esys_Startup.c
@@ -54,8 +54,7 @@
{
TSS2_RC r;
- r = Esys_Startup_Async(esysContext,
- startupType);
+ r = Esys_Startup_Async(esysContext, startupType);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -120,16 +119,15 @@
if (r != TSS2_RC_SUCCESS)
return r;
esysContext->state = _ESYS_STATE_INTERNALERROR;
- store_input_parameters(esysContext,
- startupType);
+ store_input_parameters(esysContext, startupType);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_Startup_Prepare(esysContext->sys,
- startupType);
+ r = Tss2_Sys_Startup_Prepare(esysContext->sys, startupType);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -202,7 +200,7 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_Startup_Async(esysContext,
- esysContext->in.Startup.startupType);
+ esysContext->in.Startup.startupType);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -224,8 +222,9 @@
return r;
}
r = Tss2_Sys_Startup_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_StirRandom.c b/src/tss2-esys/api/Esys_StirRandom.c
index 4d4ee2c..9b1657b 100644
--- a/src/tss2-esys/api/Esys_StirRandom.c
+++ b/src/tss2-esys/api/Esys_StirRandom.c
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_StirRandom_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- inData);
+ r = Esys_StirRandom_Async(esysContext, shandle1, shandle2, shandle3,
+ inData);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -160,12 +157,10 @@
/* Check and store 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,
- inData);
+ store_input_parameters(esysContext, inData);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_StirRandom_Prepare(esysContext->sys,
- inData);
+ r = Tss2_Sys_StirRandom_Prepare(esysContext->sys, inData);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -177,14 +172,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -256,11 +254,10 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_StirRandom_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.StirRandom.inData);
+ r = Esys_StirRandom_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.StirRandom.inData);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -287,14 +284,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_StirRandom_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_TestParms.c b/src/tss2-esys/api/Esys_TestParms.c
index b41bb30..a2e786e 100644
--- a/src/tss2-esys/api/Esys_TestParms.c
+++ b/src/tss2-esys/api/Esys_TestParms.c
@@ -76,11 +76,8 @@
{
TSS2_RC r;
- r = Esys_TestParms_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- parameters);
+ r = Esys_TestParms_Async(esysContext, shandle1, shandle2, shandle3,
+ parameters);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -166,12 +163,10 @@
/* Check and store 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,
- parameters);
+ store_input_parameters(esysContext, parameters);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_TestParms_Prepare(esysContext->sys,
- parameters);
+ r = Tss2_Sys_TestParms_Prepare(esysContext->sys, parameters);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -183,14 +178,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -262,11 +260,10 @@
return r;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_TestParms_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.TestParms.parameters);
+ r = Esys_TestParms_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.TestParms.parameters);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -293,14 +290,17 @@
* parameter decryption have to be done.
*/
r = iesys_check_response(esysContext);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Error: check response");
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_TestParms_Complete(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" );
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" );
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Unseal.c b/src/tss2-esys/api/Esys_Unseal.c
index 85f2086..70566d1 100644
--- a/src/tss2-esys/api/Esys_Unseal.c
+++ b/src/tss2-esys/api/Esys_Unseal.c
@@ -53,9 +53,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_Unseal_Async(esysContext,
- itemHandle,
- shandle1,
- shandle2,
- shandle3);
+ r = Esys_Unseal_Async(esysContext, itemHandle, shandle1, shandle2,
+ shandle3);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -91,8 +88,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Unseal_Finish(esysContext,
- outData);
+ r = Esys_Unseal_Finish(esysContext, outData);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -131,9 +127,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_DECRYPT_PARAM: if one of the sessions has the
* 'decrypt' attribute set and the command does not support encryption
* of the first command parameter.
@@ -173,7 +169,8 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_Unseal_Prepare(esysContext->sys,
- (itemHandleNode == NULL) ? TPM2_RH_NULL : itemHandleNode->rsrc.handle);
+ (itemHandleNode == NULL) ? TPM2_RH_NULL
+ : itemHandleNode->rsrc.handle);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -186,14 +183,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, itemHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -276,11 +276,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Unseal_Async(esysContext,
- esysContext->in.Unseal.itemHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2]);
+ r = Esys_Unseal_Async(esysContext, esysContext->in.Unseal.itemHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2]);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -308,15 +307,18 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Unseal_Complete(esysContext->sys,
- (outData != NULL) ? *outData : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outData != NULL) ? *outData : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_Vendor_TCG_Test.c b/src/tss2-esys/api/Esys_Vendor_TCG_Test.c
index 9509739..26f9874 100644
--- a/src/tss2-esys/api/Esys_Vendor_TCG_Test.c
+++ b/src/tss2-esys/api/Esys_Vendor_TCG_Test.c
@@ -73,11 +73,8 @@
{
TSS2_RC r;
- r = Esys_Vendor_TCG_Test_Async(esysContext,
- shandle1,
- shandle2,
- shandle3,
- inputData);
+ r = Esys_Vendor_TCG_Test_Async(esysContext, shandle1, shandle2, shandle3,
+ inputData);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -91,8 +88,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_Vendor_TCG_Test_Finish(esysContext,
- outputData);
+ r = Esys_Vendor_TCG_Test_Finish(esysContext, outputData);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -158,12 +154,10 @@
/* Check and store 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,
- inputData);
+ store_input_parameters(esysContext, inputData);
/* Initial invocation of SAPI to prepare the command buffer with parameters */
- r = Tss2_Sys_Vendor_TCG_Test_Prepare(esysContext->sys,
- inputData);
+ r = Tss2_Sys_Vendor_TCG_Test_Prepare(esysContext->sys, inputData);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -175,14 +169,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, NULL, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -265,11 +262,10 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_Vendor_TCG_Test_Async(esysContext,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.Vendor_TCG_Test.inputData);
+ r = Esys_Vendor_TCG_Test_Async(esysContext, esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.Vendor_TCG_Test.inputData);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -297,15 +293,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_Vendor_TCG_Test_Complete(esysContext->sys,
- (outputData != NULL) ? *outputData : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outputData != NULL) ? *outputData
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_VerifySignature.c b/src/tss2-esys/api/Esys_VerifySignature.c
index feed71f..e4d3bde 100644
--- a/src/tss2-esys/api/Esys_VerifySignature.c
+++ b/src/tss2-esys/api/Esys_VerifySignature.c
@@ -46,7 +46,8 @@
* parameters is allocated by the function implementation.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] keyHandle Handle of public key that will be used in the validation.
+ * @param[in] keyHandle Handle of public key that will be used in the
+ * validation.
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -71,9 +72,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -93,13 +94,8 @@
{
TSS2_RC r;
- r = Esys_VerifySignature_Async(esysContext,
- keyHandle,
- shandle1,
- shandle2,
- shandle3,
- digest,
- signature);
+ r = Esys_VerifySignature_Async(esysContext, keyHandle, shandle1, shandle2,
+ shandle3, digest, signature);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -113,8 +109,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_VerifySignature_Finish(esysContext,
- validation);
+ r = Esys_VerifySignature_Finish(esysContext, validation);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -137,7 +132,8 @@
* In order to retrieve the TPM's response call Esys_VerifySignature_Finish.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[in] keyHandle Handle of public key that will be used in the validation.
+ * @param[in] keyHandle Handle of public key that will be used in the
+ * validation.
* @param[in] shandle1 First session handle.
* @param[in] shandle2 Second session handle.
* @param[in] shandle3 Third session handle.
@@ -155,9 +151,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_ESYS_RC_NO_ENCRYPT_PARAM: if one of the sessions has the
* 'encrypt' attribute set and the command does not support encryption
* of the first response parameter.
@@ -192,9 +188,7 @@
/* Check and store 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, keyHandle,
- digest,
- signature);
+ store_input_parameters(esysContext, keyHandle, digest, signature);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyHandle, &keyHandleNode);
@@ -202,9 +196,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_VerifySignature_Prepare(esysContext->sys,
- (keyHandleNode == NULL) ? TPM2_RH_NULL : keyHandleNode->rsrc.handle,
- digest,
- signature);
+ (keyHandleNode == NULL) ? TPM2_RH_NULL
+ : keyHandleNode->rsrc.handle, digest,
+ signature);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -216,14 +210,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyHandleNode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -307,12 +304,12 @@
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
r = Esys_VerifySignature_Async(esysContext,
- esysContext->in.VerifySignature.keyHandle,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.VerifySignature.digest,
- esysContext->in.VerifySignature.signature);
+ esysContext->in.VerifySignature.keyHandle,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.VerifySignature.digest,
+ esysContext->in.VerifySignature.signature);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -340,15 +337,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_VerifySignature_Complete(esysContext->sys,
- (validation != NULL) ? *validation : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (validation != NULL) ? *validation
+ : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/api/Esys_ZGen_2Phase.c b/src/tss2-esys/api/Esys_ZGen_2Phase.c
index 49737a6..513cb02 100644
--- a/src/tss2-esys/api/Esys_ZGen_2Phase.c
+++ b/src/tss2-esys/api/Esys_ZGen_2Phase.c
@@ -58,7 +58,8 @@
* @param[in] inQeB Other party's ephemeral public key (Qe,B = (Xe,B, Ye,B)).
* @param[in] inScheme The key exchange scheme.
* @param[in] counter Value returned by TPM2_EC_Ephemeral().
- * @param[out] outZ1 X and Y coordinates of the computed value (scheme dependent).
+ * @param[out] outZ1 X and Y coordinates of the computed value (scheme
+ * dependent).
* (callee-allocated)
* @param[out] outZ2 X and Y coordinates of the second computed value (scheme
* dependent).
@@ -80,9 +81,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- * ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- * are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
* @retval TSS2_RCs produced by lower layers of the software stack may be
* returned to the caller unaltered unless handled internally.
*/
@@ -102,15 +103,8 @@
{
TSS2_RC r;
- r = Esys_ZGen_2Phase_Async(esysContext,
- keyA,
- shandle1,
- shandle2,
- shandle3,
- inQsB,
- inQeB,
- inScheme,
- counter);
+ r = Esys_ZGen_2Phase_Async(esysContext, keyA, shandle1, shandle2, shandle3,
+ inQsB, inQeB, inScheme, counter);
return_if_error(r, "Error in async function");
/* Set the timeout to indefinite for now, since we want _Finish to block */
@@ -124,9 +118,7 @@
* a retransmission of the command via TPM2_RC_YIELDED.
*/
do {
- r = Esys_ZGen_2Phase_Finish(esysContext,
- outZ1,
- outZ2);
+ r = Esys_ZGen_2Phase_Finish(esysContext, outZ1, outZ2);
/* This is just debug information about the reattempt to finish the
command */
if ((r & ~TSS2_RC_LAYER_MASK) == TSS2_BASE_RC_TRY_AGAIN)
@@ -169,9 +161,9 @@
* the 'decrypt' attribute bit set.
* @retval TSS2_ESYS_RC_MULTIPLE_ENCRYPT_SESSIONS: if more than one session has
* the 'encrypt' attribute bit set.
- * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown to the
- ESYS_CONTEXT or are of the wrong type or if required ESYS_TR objects
- are ESYS_TR_NONE.
+ * @retval TSS2_ESYS_RC_BAD_TR: if any of the ESYS_TR objects are unknown
+ * to the ESYS_CONTEXT or are of the wrong type or if required
+ * ESYS_TR objects are ESYS_TR_NONE.
*/
TSS2_RC
Esys_ZGen_2Phase_Async(
@@ -206,11 +198,7 @@
/* Check and store input parameters */
r = check_session_feasibility(shandle1, shandle2, shandle3, 1);
return_state_if_error(r, _ESYS_STATE_INIT, "Check session usage");
- store_input_parameters(esysContext, keyA,
- inQsB,
- inQeB,
- inScheme,
- counter);
+ store_input_parameters(esysContext, keyA, inQsB, inQeB, inScheme, counter);
/* Retrieve the metadata objects for provided handles */
r = esys_GetResourceObject(esysContext, keyA, &keyANode);
@@ -218,11 +206,9 @@
/* Initial invocation of SAPI to prepare the command buffer with parameters */
r = Tss2_Sys_ZGen_2Phase_Prepare(esysContext->sys,
- (keyANode == NULL) ? TPM2_RH_NULL : keyANode->rsrc.handle,
- inQsB,
- inQeB,
- inScheme,
- counter);
+ (keyANode == NULL) ? TPM2_RH_NULL
+ : keyANode->rsrc.handle, inQsB, inQeB,
+ inScheme, counter);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI Prepare returned error.");
/* Calculate the cpHash Values */
@@ -235,14 +221,17 @@
/* Generate the auth values and set them in the SAPI command buffer */
r = iesys_gen_auths(esysContext, keyANode, NULL, NULL, &auths);
- return_state_if_error(r, _ESYS_STATE_INIT, "Error in computation of auth values");
+ return_state_if_error(r, _ESYS_STATE_INIT,
+ "Error in computation of auth values");
+
esysContext->authsCount = auths.count;
r = Tss2_Sys_SetCmdAuths(esysContext->sys, &auths);
return_state_if_error(r, _ESYS_STATE_INIT, "SAPI error on SetCmdAuths");
/* Trigger execution and finish the async invocation */
r = Tss2_Sys_ExecuteAsync(esysContext->sys);
- return_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Finish (Execute Async)");
+ return_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Finish (Execute Async)");
esysContext->state = _ESYS_STATE_SENT;
@@ -257,7 +246,8 @@
* output parameter if the value is not required.
*
* @param[in,out] esysContext The ESYS_CONTEXT.
- * @param[out] outZ1 X and Y coordinates of the computed value (scheme dependent).
+ * @param[out] outZ1 X and Y coordinates of the computed value (scheme
+ * dependent).
* (callee-allocated)
* @param[out] outZ2 X and Y coordinates of the second computed value (scheme
* dependent).
@@ -335,15 +325,14 @@
goto error_cleanup;
}
esysContext->state = _ESYS_STATE_RESUBMISSION;
- r = Esys_ZGen_2Phase_Async(esysContext,
- esysContext->in.ZGen_2Phase.keyA,
- esysContext->session_type[0],
- esysContext->session_type[1],
- esysContext->session_type[2],
- esysContext->in.ZGen_2Phase.inQsB,
- esysContext->in.ZGen_2Phase.inQeB,
- esysContext->in.ZGen_2Phase.inScheme,
- esysContext->in.ZGen_2Phase.counter);
+ r = Esys_ZGen_2Phase_Async(esysContext, esysContext->in.ZGen_2Phase.keyA,
+ esysContext->session_type[0],
+ esysContext->session_type[1],
+ esysContext->session_type[2],
+ esysContext->in.ZGen_2Phase.inQsB,
+ esysContext->in.ZGen_2Phase.inQeB,
+ esysContext->in.ZGen_2Phase.inScheme,
+ esysContext->in.ZGen_2Phase.counter);
if (r != TSS2_RC_SUCCESS) {
LOG_WARNING("Error attempting to resubmit");
/* We do not set esysContext->state here but inherit the most recent
@@ -371,16 +360,19 @@
*/
r = iesys_check_response(esysContext);
goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Error: check response",
- error_cleanup);
+ error_cleanup);
+
/*
* After the verification of the response we call the complete function
* to deliver the result.
*/
r = Tss2_Sys_ZGen_2Phase_Complete(esysContext->sys,
- (outZ1 != NULL) ? *outZ1 : NULL,
- (outZ2 != NULL) ? *outZ2 : NULL);
- goto_state_if_error(r, _ESYS_STATE_INTERNALERROR, "Received error from SAPI"
- " unmarshaling" ,error_cleanup);
+ (outZ1 != NULL) ? *outZ1 : NULL,
+ (outZ2 != NULL) ? *outZ2 : NULL);
+ goto_state_if_error(r, _ESYS_STATE_INTERNALERROR,
+ "Received error from SAPI unmarshaling" ,
+ error_cleanup);
+
esysContext->state = _ESYS_STATE_INIT;
return TSS2_RC_SUCCESS;
diff --git a/src/tss2-esys/esys_crypto_ossl.c b/src/tss2-esys/esys_crypto_ossl.c
index d8bcf67..43088f4 100644
--- a/src/tss2-esys/esys_crypto_ossl.c
+++ b/src/tss2-esys/esys_crypto_ossl.c
@@ -254,7 +254,7 @@
}
if (digest_size != mycontext->hash.hash_len) {
- return_error(TSS2_ESYS_RC_GENERAL_FAILURE,
+ return_error(TSS2_ESYS_RC_GENERAL_FAILURE,
"Invalid size computed by EVP_DigestFinal_ex");
}
@@ -320,7 +320,7 @@
LOG_TRACE("called for context-pointer %p and hmacAlg %d", context, hashAlg);
LOGBLOB_TRACE(key, size, "Starting hmac with");
if (context == NULL || key == NULL) {
- return_error(TSS2_ESYS_RC_BAD_REFERENCE,
+ return_error(TSS2_ESYS_RC_BAD_REFERENCE,
"Null-Pointer passed in for context");
}
IESYS_CRYPTOSSL_CONTEXT *mycontext = calloc(1, sizeof(IESYS_CRYPTOSSL_CONTEXT));
@@ -448,7 +448,7 @@
IESYS_CRYPTOSSL_CONTEXT *mycontext =
(IESYS_CRYPTOSSL_CONTEXT *) * context;
if (mycontext->type != IESYS_CRYPTOSSL_TYPE_HMAC) {
- return_error(TSS2_ESYS_RC_BAD_REFERENCE, "bad context");
+ return_error(TSS2_ESYS_RC_BAD_VALUE, "bad context");
}
if (*size < mycontext->hmac.hmac_len) {
@@ -602,7 +602,7 @@
else
exp = pub_tpm_key->publicArea.parameters.rsaDetail.exponent;
if (1 != BN_set_word(bne, exp)) {
- goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE,
+ goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE,
"Could not set exponent.", cleanup);
}
@@ -611,15 +611,15 @@
"Could not allocate RSA key", cleanup);
}
- if (1 != RSA_generate_key_ex(rsa_key,
- pub_tpm_key->publicArea.parameters.rsaDetail.keyBits,
+ if (1 != RSA_generate_key_ex(rsa_key,
+ pub_tpm_key->publicArea.parameters.rsaDetail.keyBits,
bne, NULL)) {
goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE, "Could not generate RSA key",
cleanup);
}
if (!(evp_rsa_key = EVP_PKEY_new())) {
- goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE,
+ goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE,
"Could not create evp key.", cleanup);
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
@@ -821,7 +821,7 @@
key_size = 66;
break;
default:
- return_error(TSS2_ESYS_RC_NOT_IMPLEMENTED,
+ return_error(TSS2_ESYS_RC_NOT_IMPLEMENTED,
"ECC curve not implemented.");
}
@@ -898,7 +898,7 @@
goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE, "Create point.", cleanup);
}
- if (1 != EC_POINT_mul(group, mul_eph_tpm, NULL,
+ if (1 != EC_POINT_mul(group, mul_eph_tpm, NULL,
tpm_pub_key, eph_priv_key, bctx)) {
goto_error(r, TSS2_ESYS_RC_GENERAL_FAILURE,
"ec point multiplication", cleanup);
@@ -1060,7 +1060,7 @@
}
if (tpm_sym_alg != TPM2_ALG_AES) {
- goto_error(r, TSS2_ESYS_RC_BAD_VALUE,
+ goto_error(r, TSS2_ESYS_RC_BAD_VALUE,
"AES encrypt called with wrong algorithm.", cleanup);
}
diff --git a/src/tss2-esys/esys_int.h b/src/tss2-esys/esys_int.h
index 20dc1b1..e80c890 100644
--- a/src/tss2-esys/esys_int.h
+++ b/src/tss2-esys/esys_int.h
@@ -979,7 +979,11 @@
/** Makro testing parameters against null.
*/
-#define _ESYS_ASSERT_NON_NULL(x) if (x == NULL) { LOG_ERROR(str(x) " == NULL."); return TSS2_ESYS_RC_BAD_REFERENCE; }
+#define _ESYS_ASSERT_NON_NULL(x) \
+ if (x == NULL) { \
+ LOG_ERROR(str(x) " == NULL."); \
+ return TSS2_ESYS_RC_BAD_REFERENCE; \
+ }
#ifdef __cplusplus
}
diff --git a/src/tss2-esys/esys_iutil.c b/src/tss2-esys/esys_iutil.c
index ffcccb0..d8b3985 100644
--- a/src/tss2-esys/esys_iutil.c
+++ b/src/tss2-esys/esys_iutil.c
@@ -402,7 +402,8 @@
TPM2_HT
iesys_get_handle_type(TPM2_HANDLE handle)
{
- TPM2_HT ht = (TPM2_HT) ((handle & TPM2_HR_RANGE_MASK) >> TPM2_HR_SHIFT); /* upper bytes of input data */
+ /* upper bytes of input data */
+ TPM2_HT ht = (TPM2_HT) ((handle & TPM2_HR_RANGE_MASK) >> TPM2_HR_SHIFT);
return ht;
}
@@ -1422,7 +1423,7 @@
/** Check whether the return code corresponds to an TPM error.
*
* if no layer is part of the return code or a layer from the resource manager
- * is given the function will return true.
+ * is given the function will return true.
* @param[in] r The return code to be checked.
* @retval true if r corresponds to an TPM error.
* @retval false in other cases.
diff --git a/src/tss2-esys/esys_mu.h b/src/tss2-esys/esys_mu.h
index 553d4d4..15d2763 100644
--- a/src/tss2-esys/esys_mu.h
+++ b/src/tss2-esys/esys_mu.h
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: BSD-2 */
/*******************************************************************************
- * Copyright 2017, Fraunhofer SIT sponsored by Infineon Technologies AG
+ * Copyright 2017-2018, Fraunhofer SIT sponsored by Infineon Technologies AG
* All rights reserved.
- *******************************************************************************/
+ ******************************************************************************/
#ifndef ESYS_MU_H
#define ESYS_MU_H