[opensc-devel] Buffer size and defining constant
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...? Thanks. -- Regards, Quân ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] Buffer size and defining constant
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. Feel free to fork OpenSC on github and send a pull request, when you're done. See http://www.opensc-project.org/opensc/wiki/GetInvolved for further information. [1] Yes, this is somewhat of inconsistent as it is not always done... -- Frank Morgner Virtual Smart Card Architecture http://vsmartcard.sourceforge.net OpenPACE http://openpace.sourceforge.net IFD Handler for libnfc Devices http://sourceforge.net/projects/ifdnfc pgpZ27g4V987V.pgp Description: PGP signature ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] Buffer size and defining constant
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
Re: [opensc-devel] Buffer size and defining constant
Thanks, I made a pull request at https://github.com/martinpaljak/OpenSC/pull/19 On 04/23/2012 03:05 PM, Frank Morgner 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. Feel free to fork OpenSC on github and send a pull request, when you're done. See http://www.opensc-project.org/opensc/wiki/GetInvolved for further information. [1] Yes, this is somewhat of inconsistent as it is not always done... ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel -- Regards, Quân ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] Buffer size and defining constant
Le 23 avril 2012 11:09, Nguyễn Hồng Quân quanngu...@mbm.vn a écrit : Thanks, I made a pull request at https://github.com/martinpaljak/OpenSC/pull/19 I can't accept your pull request because: - you cloned martinpaljak/OpenSC instead of OpenSC/OpenSC - use the staging branch instead of the master branch - you made a lot of reformat and/or white spaces modifications Have a look at https://github.com/martinpaljak/OpenSC/pull/19/files Bye -- Dr. Ludovic Rousseau ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] Buffer size and defining constant
Thanks, Because I focus on OpenPGP support, I base my branch on Martin's. Some coding convention (from GNU C for example) recommend not to place any space character at the end of lines. I think doing such is a good practice. Because I just start with this project, I think I should let my modification be considered by 1 core member's branch (Martin for instance) before go to the main branch. On Mon 23 Apr 2012 04:17:21 PM ICT, Ludovic Rousseau wrote: Le 23 avril 2012 11:09, Nguyễn Hồng Quân quanngu...@mbm.vn a écrit : Thanks, I made a pull request at https://github.com/martinpaljak/OpenSC/pull/19 I can't accept your pull request because: - you cloned martinpaljak/OpenSC instead of OpenSC/OpenSC - use the staging branch instead of the master branch - you made a lot of reformat and/or white spaces modifications Have a look at https://github.com/martinpaljak/OpenSC/pull/19/files Bye -- Regards, Quân ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] Buffer size and defining constant
Le 23 avril 2012 11:41, Nguyễn Hồng Quân quanngu...@mbm.vn a écrit : Thanks, Because I focus on OpenPGP support, I base my branch on Martin's. Some coding convention (from GNU C for example) recommend not to place any space character at the end of lines. I think doing such is a good practice. I fully agree with removing extra spaces. But please use 2 different and independent commits: - one commit for the white spaces correction - one commit for your buffer size change commit Bye -- Dr. Ludovic Rousseau ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel