Skip to content

Commit 0f63d1e

Browse files
FAPI: Fix authorization session handling.
If no policy is used the sessíon2 in FAPI context must be initialized with ESYS_TR_NONE in the authorization function. The macro ENC_SESSION_IF_POLIY did produce an invalid ESYS handle if session2 was not initialized. Signed-off-by: Juergen Repp <[email protected]>
1 parent 182b027 commit 0f63d1e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/tss2-fapi/fapi_int.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ typedef struct {
129129

130130
#define ENC_SESSION_IF_POLICY(auth_session) \
131131
(auth_session == ESYS_TR_PASSWORD || auth_session == ESYS_TR_NONE || \
132-
auth_session == context->session2) ? ESYS_TR_NONE : context->session2
132+
auth_session == context->session2 || \
133+
!context->session2) ? ESYS_TR_NONE : context->session2
133134

134135
/** The states for the FAPI's object authorization state*/
135136
enum IFAPI_GET_CERT_STATE {

src/tss2-fapi/fapi_util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,7 @@ ifapi_authorize_object(FAPI_CONTEXT *context, IFAPI_OBJECT *object, ESYS_TR *ses
21772177
else
21782178
/* Use password session if session1 had not been created */
21792179
*session = ESYS_TR_PASSWORD;
2180+
context->session2 = ESYS_TR_NONE;
21802181
break;
21812182
}
21822183

0 commit comments

Comments
 (0)