Skip to content

Commit

Permalink
ykcs11: fixed uninitialized sessions when cleaning up functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Jan 28, 2020
1 parent 8947e6c commit e8ff8f6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ykcs11/ykcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_DigestFinal)(
digest_out:
session->op_info.type = YKCS11_NOOP;
DOUT;
return CKR_OK;
return rv;
}

CK_DEFINE_FUNCTION(CK_RV, C_SignInit)(
Expand Down Expand Up @@ -2891,16 +2891,16 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignUpdate)(

if (!pid) {
DBG("libykpiv is not initialized or already finalized");
rv = CKR_CRYPTOKI_NOT_INITIALIZED;
goto sign_out;
DOUT;
return CKR_CRYPTOKI_NOT_INITIALIZED;
}

ykcs11_session_t* session = get_session(hSession);

if (session == NULL || session->slot == NULL) {
DBG("Session is not open");
rv = CKR_SESSION_HANDLE_INVALID;
goto sign_out;
DOUT;
return CKR_SESSION_HANDLE_INVALID;
}

if (session->op_info.type != YKCS11_SIGN) {
Expand Down Expand Up @@ -3174,16 +3174,16 @@ CK_DEFINE_FUNCTION(CK_RV, C_VerifyUpdate)(

if (!pid) {
DBG("libykpiv is not initialized or already finalized");
rv = CKR_CRYPTOKI_NOT_INITIALIZED;
goto verify_out;
DOUT;
return CKR_CRYPTOKI_NOT_INITIALIZED;
}

ykcs11_session_t* session = get_session(hSession);

if (session == NULL || session->slot == NULL) {
DBG("Session is not open");
rv = CKR_SESSION_HANDLE_INVALID;
goto verify_out;
DOUT;
return CKR_SESSION_HANDLE_INVALID;
}

if (pPart == NULL) {
Expand Down

0 comments on commit e8ff8f6

Please sign in to comment.