Index: cackey.c ================================================================== --- cackey.c +++ cackey.c @@ -1163,16 +1163,10 @@ if (major_rc == 0x61) { /* We need to READ */ CACKEY_DEBUG_PRINTF("Buffer read required"); - if (minor_rc == 0x00) { - CACKEY_DEBUG_PRINTF("Read of 0 bytes is a no-op, returning in success."); - - return(CACKEY_PCSC_S_OK); - } - pcsc_getresp_ret = cackey_send_apdu(slot, GSCIS_CLASS_ISO7816, GSCIS_INSTR_GET_RESPONSE, 0x00, 0x00, 0, NULL, minor_rc, respcode, respdata, &tmp_respdata_len); if (pcsc_getresp_ret != CACKEY_PCSC_S_OK) { CACKEY_DEBUG_PRINTF("Buffer read failed! Returning in failure"); /* End Smartcard Transaction */ @@ -1856,16 +1850,10 @@ CACKEY_DEBUG_PRINTF("Error. buflen is greater than 255 (buflen = %lu)", (unsigned long) buflen); return(-1); } - if (outbuflen > 253) { - le = 253; - } else { - le = outbuflen; - } - if (slot == NULL) { CACKEY_DEBUG_PRINTF("Error. slot is NULL"); return(-1); } @@ -1950,13 +1938,15 @@ tmpbuf_s = tmpbuf; while (tmpbuflen) { if (tmpbuflen > 245) { bytes_to_send = 245; p1 = 0x80; + le = 0x00; } else { bytes_to_send = tmpbuflen; p1 = 0x00; + le = 0x00; } send_ret = cackey_send_apdu(slot, GSCIS_CLASS_GLOBAL_PLATFORM, GSCIS_INSTR_SIGNDECRYPT, p1, 0x00, bytes_to_send, tmpbuf, le, &respcode, outbuf, &outbuflen); if (send_ret != CACKEY_PCSC_S_OK) { CACKEY_DEBUG_PRINTF("ADPU Sending Failed -- returning in error.");