Hi, please find my latest patches to improve the support for OpenPGP cards on: https://github.com/marschap/OpenSC/commits/OpenPGP-20110520
I am not attaching them here as they are too big, and my older mail from two days ago still awaits moderator approval [due to size constraints]. If you do not consider this kind of presenting patches correct, please let me know and I will send the patches to the ML. It starts with the ones already sent to the mailing list a few times. with all the changes that have been requested (via github comments, mails, ...) applied: * 0001-OpenPGP-fix-top-level-DOs-according-to-spec.patch * 0002-OpenPGP-add-indication-of-2048-RSA-agorithm-for-Open.patch * 0003-OpenPGP-try-to-match-flags-with-specification.patch * 0004-OpenPGP-re-factor-pgp_enumerate_blob.patch * 0005-OpenPGP-implement-function-to-free-the-fake-file-sys.patch * 0006-OpenPGP-NULL-ify-free-d-pointer.patch * 0008-OpenPGP-add-some-comments.patch * 0009-OpenPGP-use-symbolic-names-for-errors-success.patch * 0010-OpenPGP-catch-calloc-errors-in-pgp_new_blob.patch * 0011-OpenPGP-update-card-capabilities-from-historical-byt.patch * 0012-OpenPGP-use-card-extended-Lc-Le-capabilities.patch * 0013-OpenPGP-allow-extended-APDUs-in-all-functions.patch * 0014-OpenPGP-free-memory-when-selecting-the-application-f.patch * 0015-OpenPGP-implement-card_ctl-command-SC_CARDCTL_GET_SE.patch If you do not have any objections against them, please let at least them go into OpenSC mainline. And here are newer ones: They too have the changes applied that have been requested via comments on Github, mails, ...) * 0016-OpenPGP-remove-unused-element-from-structure.patch [PATCH 16/32] OpenPGP: remove unused element from structure The element size in struct do_info is never used. Get rid of it. * 0017-OpenPGP-briefly-document-each-function.patch [PATCH 17/32] OpenPGP: briefly document each function Write a short comment at the beginning of each function, shortly sketching what the function does. * 0018-OpenPGP-sprinkle-with-LOG_.-macros.patch [PATCH 18/32] OpenPGP: sprinkle with LOG_... macros Instrument functions used in the card operations table pgp_ops[] with log macros to ease debugging. * 0019-OpenPGP-re-factor-pgp_finish.patch [PATCH 19/32] OpenPGP: re-factor pgp_finish() Re-structure pgp_finish() for easier reading. While at it, check for priv != NULL before free()ing it. * 0020-OpenPGP-clean-up-with-pgp_finish.patch [PATCH 20/32] OpenPGP: clean up with pgp_finish() Use pgp_finish() wherever possible to clean up. * 0021-OpenPGP-comment-use-of-current.patch [PATCH 21/32] OpenPGP: comment use of "current" * 0022-OpenPGP-re-factor-pgp_select_file.patch [PATCH 22/32] OpenPGP: re-factor pgp_select_file() * remove unnecessary copy operations with a temporary path object, instead increase the start index. * add comments * 0023-OpenPGP-read-BCD-version-from-card.patch [PATCH 23/32] OpenPGP: read BCD version from card * 0024-OpenPGP-deal-with-DOs-depending-on-card-version.patch [PATCH 24/32] OpenPGP: deal with DOs depending on card version Have separate copies of pgp_objects[] data elements specific to the card's version, and extend these structures with additional information: * Some spec changes cannot be compatibly expressed in one common simple data structure without making it too complex. * depending on specification version, only deal with those DOs that are legal within that version * add information or read & write access conditions * add information for non-toplevel and/or write-only DOs * use symbolic names for constants * 0025-OpenPGP-check-for-get_fn-NULL-in-pgp_read_blob.patch [PATCH 25/32] OpenPGP: check for get_fn != NULL in pgp_read_blob() In pgp_read_blob(), check if the pointer to the function we want to call is defined. * 0026-OpenPGP-new-function-to-get-card-s-features.patch [PATCH 26/32] OpenPGP: new function to get card's features Add a new function pgp_get_card_features() to get the card's capabilities, algorithms, features, ... instead of doing it all in pgp_init(): * get SC_CARD_CAP_APDU_EXT capability from ATR * for openPGP 2.0 cards, if not found in ATR, get SC_CARD_CAP_APDU_EXT capability from "historical bytes" DO 0x5f52 * 0027-OpenPGP-extend-pgp_get_card_features.patch [PATCH 27/32] OpenPGP: extend pgp_get_card_features() Extend pgp_get_card_features() with these features: * get SC_CARD_CAP_RNG capability from "extended capabilities" DO 0x00c0 * for OpenPGP 2.0 cards get max_send_size / max_recv_size values from "extended capabilities" DO 0x00c0 * get max_pin_len from "CHV status bytes" DO 0x00c4 * 0028-OpenPGP-get-flags-algorithms-in-pgp_get_card_feature.patch [PATCH 28/32] OpenPGP: get flags & algorithms in pgp_get_card_features() Extend pgp_get_card_features() to get card's flags & supported algorithms from the card: * get algorithm values from "algorithm attributes" DOs 0x00c1 - 0x00c3 * 0029-OpenPGP-re-factor-pgp_get_blob.patch [PATCH 29/32] OpenPGP: re-factor pgp_get_blob() Instead of jumping out of the loop when the correct child is found, and checking afterwards again if we found the correct object, do everything directly in the loop and return from there. * 0030-OpenPGP-re-factor-pgp_list_files.patch [PATCH 30/32] OpenPGP: re-factor pgp_list_files() Use ushort2bebytes instead of calculating the mapping to IDs ourselves. * 0031-rewrite-bebyte-conversion-functions-NULL-check-retur.patch [PATCH 31/32] rewrite bebyte conversion functions: NULL check, return buffer Rewrite bebyte conversion functions: * check whether the buffer passed is non-NULL * for conversions to bebytes, return the buffer passed * 0032-OpenPGP-use-updated-ushort2bebytes-in-pgp_get_pubkey.patch [PATCH 32/32] OpenPGP: use updated ushort2bebytes() in pgp_get_pubkey() It would be great if they too would make it into OpenSC mainline, now that OpenSC 0.12.1 is out. Best regards Peter -- Peter Marschall pe...@adpm.de _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel