Dear opensc developers,
I would like to propose the following simplification of the internal
'struct sc_pkcs15_card'.
typedef struct sc_pkcs15_card {
sc_card_t *card;
unsigned int flags;
unsigned int magic;
unsigned int pin_cache_counter;
sc_file_t *file_app;
sc_file_t *file_odf;
sc_file_t *file_tokeninfo;
sc_file_t *file_unusedspace;
sc_pkcs15_df_t *df_list;
sc_pkcs15_object_t *obj_list;
sc_pkcs15_tokeninfo_t *tokeninfo;
sc_pkcs15_unusedspace_t *unusedspace_list;
void *dll_handle;
struct sc_pkcs15_operations ops;
} sc_pkcs15_card_t;
The main difference to the current definition is, that everything that
belongs to tokeninfo would be accessible through p15card->tokeninfo. In
my opinion, grouping all tokeninfo related attributes under
p15card->tokeninfo better reflects the meaning of these attributes.
The purpose of this redefinition is maintains only and can be seen as a
follow up to changeset [2872][1] by Ludovic Rousseau, who introduced the
dedicated structure sc_pkcs15_tokeninfo_t. And since the upcoming 0.12
release will break (internal) pkcs15 API anyway, inclusion of this
modification should not harm. I will prepare the patch, if reception of
this proposal is positive.
Some additional thoughts:
1. there exists already the data type sc_pkcs15_tokeninfo_t but the
current definition of sc_pkcs15_card_t duplicates all its attributes
[2][3]
2. the attribute 'flags' is overused, because it holds flags from two
completely different domains (pkcs15 and internal flags mixed) [4][5]
3. use_file_cache, use_pin_cache are actually flags and could be defined
as such
4. the current definition has evolved from the very beginning of opensc
with more and more additions of attributes [6]
5. OpenSC source code is almost uncommented, therefore over complex data
structures should be avoided
Kind Regards
Andre Zepezauer
[1] http://www.opensc-project.org/opensc/changeset/2872#file1
[2]
http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/pkcs15.h#L416
[3]
http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/pkcs15.c#L728
[4]
http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/pkcs15.h#L473
[5]
http://www.opensc-project.org/opensc/browser/trunk/src/pkcs15init/pkcs15-lib.c#L2419
[6]
http://www.opensc-project.org/opensc/browser/trunk/src/libopensc/pkcs15.h?rev=571&annotate=blame
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel