Hello,

I would like to introduce the placeholder for the non-PIN authentication 
objects.
So that there will be possibility to develop the support of the 'biometric', 
'authKey' authentication types.

The general idea is to replace the 'sc_pkcs15_pin_info' structure by the more 
general data type
where the actual pin-info would be as a sub-type.

The total patch is rather trivial but huge,
so here in attachment there is only the difference between existing and 
proposed data types.

On the same occasion I propose to remove the 'magic' member.

If no objections, I will commit it after release.

Kind wishes,
Viktor.

Index: src/libopensc/pkcs15.h
===================================================================
--- src/libopensc/pkcs15.h      (révision 5446)
+++ src/libopensc/pkcs15.h      (copie de travail)
@@ -73,21 +73,32 @@
 #define SC_PKCS15_PIN_AUTH_TYPE_AUTH_KEY               1
 #define SC_PKCS15_PIN_AUTH_TYPE_SM_KEY                 2
 
-struct sc_pkcs15_pin_info {
-       struct sc_pkcs15_id auth_id;
-       int reference;
-       unsigned int flags, type;
-       unsigned int auth_method;
-       size_t min_length, stored_length, max_length;
-       u8 pad_char;
-       struct sc_path path;
-       int tries_left;
-       int max_tries;
+struct sc_pkcs15_pin_attributes {
+       unsigned int  flags, type;
+       size_t  min_length, stored_length, max_length;
+       int  reference;
+       u8  pad_char;
+ };
+struct sc_pkcs15_authkey_attributes {
+       int derived;
+       struct sc_pkcs15_id skey_id;
+ };
+struct sc_pkcs15_biometric_attributes {
+ };
+struct sc_pkcs15_auth_info {
+       struct sc_pkcs15_id  auth_id;
+       struct sc_path  path;
+       unsigned auth_type;
+       union {
+               struct sc_pkcs15_pin_attributes pin;
+               struct sc_pkcs15_biometric_attributes bio;
+               struct sc_pkcs15_authkey_attributes authkey;
+       } attrs;
+       unsigned int  auth_method;
+       int  tries_left, max_tries;
+ };
+typedef struct sc_pkcs15_auth_info sc_pkcs15_auth_info_t;
 
-       unsigned int magic;
-};
-typedef struct sc_pkcs15_pin_info sc_pkcs15_pin_info_t;
-
 #define SC_PKCS15_ALGO_OP_COMPUTE_CHECKSUM     0x01
 #define SC_PKCS15_ALGO_OP_COMPUTE_SIGNATURE    0x02
 #define SC_PKCS15_ALGO_OP_VERIFY_CHECKSUM      0x04
@@ -753,7 +764,7 @@
 void sc_pkcs15_free_pubkey_info(sc_pkcs15_pubkey_info_t *key);
 void sc_pkcs15_free_cert_info(sc_pkcs15_cert_info_t *cert);
 void sc_pkcs15_free_data_info(sc_pkcs15_data_info_t *data);
-void sc_pkcs15_free_pin_info(sc_pkcs15_pin_info_t *pin);
+void sc_pkcs15_free_auth_info(sc_pkcs15_auth_info_t *auth_info);
 void sc_pkcs15_free_object(sc_pkcs15_object_t *obj);
 
 /* File content wrapping */
@@ -846,7 +857,7 @@
                        const sc_pkcs15_object_t *, const void *);
 /* some wrapper functions for sc_pkcs15emu_object_add */
 int sc_pkcs15emu_add_pin_obj(sc_pkcs15_card_t *,
-       const sc_pkcs15_object_t *, const sc_pkcs15_pin_info_t *);
+       const sc_pkcs15_object_t *, const sc_pkcs15_auth_info_t *);
 int sc_pkcs15emu_add_rsa_prkey(sc_pkcs15_card_t *,
        const sc_pkcs15_object_t *, const sc_pkcs15_prkey_info_t *);
 int sc_pkcs15emu_add_rsa_pubkey(sc_pkcs15_card_t *,
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to