Le 20/04/2011 15:03, Martin Paljak a écrit : > Hello, > On Apr 20, 2011, at 13:22 , Frank Morgner wrote: > >> In the svn tree there is a change that breaks my code: The ISO driver >> automatically sends read binary APDUs until the number of requested >> bytes is reached (iso7816.c:136). > You mean r5237 [1] ? > >> Previously only one APDU was sent. The >> change surely intendeds to read as much as possible (and requested). The >> problem is that 6282 is only recognized when the card returns 0 bytes of >> data (iso7816.c:132). > SW 6282 as in "End of file or record reached before reading Le bytes" > > >> There are three alternatives for a fix, I think: >> 1. Offer a flag to disable the new behaviour as it is done for get >> response with SC_APDU_FLAGS_NO_GET_RESP. > Flag for sc_read_binary I assume? > >> 2. Offer a possibilities to read a file to EOF. >> 3. Correctly recognize 6282 even when data is present. > How would the two approaches differ? 2) would return as much as possible, > ignoring such (meaningless in some context?) errors and 3) would correctly > raise the error, even if data is received? > > I think that a flag could be invented for switching between these two modes > of operation (the otherwise unused "flags" parameter to sc_read_binary). > The default could be the mode that honors passed in parameters.
Actually the 0x6282 is mapped to the general SC_ERROR_CARD_CMD_FAILED error. http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/iso7816.c?rev=5237#L35 Possible resolution could be: A new code error is introduced for the SW 0x6282 . The 6282 error is ignored if it's returned by the 'embedded' iso7816_read_binary . http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/iso7816.c?rev=5237#L137 > [1]http://www.opensc-project.org/opensc/changeset/5237 -- Viktor Tarasov <viktor.tara...@opentrust.com> _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel