Skip to content

Commit

Permalink
session: do not delete on flush
Browse files Browse the repository at this point in the history
This behavior would not be backwards compat, but this patch does the
bare minimum so we can just revert it on the next major release.

Signed-off-by: Bill Roberts <[email protected]>
  • Loading branch information
williamcroberts committed Dec 20, 2023
1 parent 87528cc commit 5d2ae38
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
10 changes: 2 additions & 8 deletions lib/tpm2_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,8 @@ tool_rc tpm2_session_close(tpm2_session **s) {
}

if ((*s)->internal.delete && path) {
if (remove(path)) {
LOG_ERR("File \"%s\" can't be deleted.", path);
rc = tool_rc_general_error;
goto out2;
} else {
rc = tool_rc_success;
goto out2;
}
rc = tool_rc_success;
goto out2;
}

FILE *session_file = path ? fopen(path, "w+b") : NULL;
Expand Down
5 changes: 0 additions & 5 deletions test/integration/tests/unseal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,4 @@ tpm2 sessionconfig enc_session.ctx --enable-encrypt --disable-continuesession
unsealed=`tpm2 unseal -c seal_key.ctx -p sealkeypass -S enc_session.ctx`
test "$unsealed" == "$secret"

if [ -e enc_session.ctx ]; then
echo "enc_session.ctx was not deleted.";
exit 1
fi

exit 0

0 comments on commit 5d2ae38

Please sign in to comment.