Index: cackey.c ================================================================== --- cackey.c +++ cackey.c @@ -5180,10 +5180,18 @@ return(sign_ret); } CACKEY_DEBUG_PRINTF("Error. SignFinal() returned failure (rv = %lu).", (unsigned long) sign_ret); + return(sign_ret); + } + + if (pSignature == NULL) { + CACKEY_DEBUG_PRINTF("pSignature specified as NULL, undoing C_SignUpdate()", (unsigned long) sign_ret); + + cackey_sessions[hSession].sign_bufused = start_sign_bufused; + return(sign_ret); } CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK);