Hello, On Mon, Apr 23, 2012 at 11:05, Frank Morgner <morg...@informatik.hu-berlin.de> wrote: > On Monday, April 23 at 02:11PM, Nguyễn Hồng Quân wrote: >> Hello all, >> >> I'm starting to code for OpenSC (with the focus on OpenPGP card). >> I found in opensc-explorer.c, the do_update_binary() and >> do_update_record() function use the buffer of 240bytes in size. >> I want to know if 240 is just convention or a limit of something? >> I want to replace the hardcode with a defined constant. Do you have a >> rule about defining constant: name, which file to place...? > > looks like these numbers could indeed be replaced with a define. The > buffer size is limitation to the application and is only loosely bound > to libopensc. Sometimes [1] SC_MAX_APDU_BUFFER_SIZE is chosen as upper > limit, but sc_update_binary, for example, sends multiple APDUs if the > buffer doesn't fit into a single command. So I would opt to go for a > opensc-explorer specific define.
opensc-explorer is a quite conservative application. For example, reading binary files with 128 byte chunks, not even 256 byte chunks, not to mention reading files like certificates in one go, which usually are around thousand-somehundred bytes or so, which would be a perfect fit for extended APDU-s. As opensc-explorer is supposed to be a failsafe debugging tool, relying on lowest common denominators is somewhat understandable (but far from a best solution). There is a hackish card-specific limitation available, max_recv/send_size which could be re-used. Based on detected card/reader capabilities extended APDU should also be possible through opensc-explorer. When not available/limited, using the standard defaults (255 for outgoing, 256 (0x00 for Le) for incoming) should be preferred. Martin _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel