Hi, I propose to introduce a data type with the 'free' handler to be actually used for the 'parameter' of the 'xxkey_info' data .
It will allow the using of non-trivial key parameters, to be more flexible in pkcs15init when transmitting parameters from supplied arguments to the libopensc data (supply from the upper level the data specific free handler or simply to not free in libopensc the data passed by pointer). Pkcs15init and pkcs15 functions are in the same libopensc library, but between them the data are allocated/copied. (For ex. from 'pkcs15init_keygen_args' to 'pkcs15_prkey_info'.) There is no immediate necessity of this change (it simply nice) . I use it in the emulation of pkcs15init for PIV card which hardly will be committed . This change can be seen as beginning of future pkcs15init optimization. So, have you any objections ? Kind wishes, Viktor.
Index: src/libopensc/pkcs15.h =================================================================== --- src/libopensc/pkcs15.h (révision 5387) +++ src/libopensc/pkcs15.h (copie de travail) @@ -319,6 +319,12 @@ typedef struct sc_pkcs15_accessrule sc_pkcs15_accessrule_t; +struct sc_pkcs15_key_info_params { + void *data; + size_t len; + void (*free)(void *); +}; + struct sc_pkcs15_prkey_info { struct sc_pkcs15_id id; /* correlates to public certificate id */ unsigned int usage, access_flags; @@ -331,8 +337,7 @@ struct sc_pkcs15_der subject; - void *params; - size_t params_len; + struct sc_pkcs15_key_info_params params; struct sc_path path; }; @@ -350,8 +355,7 @@ struct sc_pkcs15_der subject; - void *params; - size_t params_len; + struct sc_pkcs15_key_info_params params; struct sc_path path; };
_______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel