Skip to content

Commit

Permalink
tcti-msim: Fix call of socket_xmit_buf in send_sim_session_end.
Browse files Browse the repository at this point in the history
* socket_xmit_buf was not called after successful marshalling.
* The result of the write function was not set in the wrapper function for
  write in the teardown function.

Fixes: #2915

Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT committed Dec 3, 2024
1 parent d68270b commit dcbe69c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tss2-tcti/tcti-mssim.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ send_sim_session_end (
TSS2_RC rc;

rc = Tss2_MU_UINT32_Marshal (TPM_SESSION_END, buf, sizeof (buf), NULL);
if (rc == TSS2_RC_SUCCESS) {
if (rc != TSS2_RC_SUCCESS) {
return rc;
}
return socket_xmit_buf (sock, buf, sizeof (buf));
Expand Down
3 changes: 3 additions & 0 deletions test/unit/tcti-mssim.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ tcti_socket_teardown (void **state)
{
TSS2_TCTI_CONTEXT *ctx = (TSS2_TCTI_CONTEXT*)*state;

will_return (__wrap_write, 4);
will_return (__wrap_write, 4);

Tss2_Tcti_Finalize (ctx);
free (ctx);
return 0;
Expand Down

0 comments on commit dcbe69c

Please sign in to comment.