Index: build/chrome/cackey-chrome-pkcs11.c ================================================================== --- build/chrome/cackey-chrome-pkcs11.c +++ build/chrome/cackey-chrome-pkcs11.c @@ -602,10 +602,15 @@ break; } tmpDestinationLength = *destinationLength; chk_rv = moduleFunctionList->C_Sign(hSession, data, dataLength, destination, &tmpDestinationLength); + + if (tmpDestinationLength == 0) { + chk_rv = CKR_GENERAL_ERROR; + } + switch (chk_rv) { case CKR_OK: *destinationLength = tmpDestinationLength; retval = CACKEY_CHROME_OK; break; Index: build/chrome/cackey-chrome-plugin.cc ================================================================== --- build/chrome/cackey-chrome-plugin.cc +++ build/chrome/cackey-chrome-plugin.cc @@ -116,11 +116,10 @@ pin = NULL; } incomingCertificateCACKey.certificate = incomingCertificateContents->Map(); incomingCertificateCACKey.certificate_len = incomingCertificateContents->ByteLength(); - outgoingDataLength = sizeof(buffer); signRet = cackey_chrome_signMessage(&incomingCertificateCACKey, incomingData->Map(), incomingData->ByteLength(), buffer, &outgoingDataLength,