diff options
-rw-r--r-- | vcard.c | 2 | ||||
-rw-r--r-- | vcard_emul.h | 15 | ||||
-rw-r--r-- | vcard_emul_nss.c | 32 | ||||
-rw-r--r-- | vscclient.c | 2 |
4 files changed, 24 insertions, 27 deletions
@@ -232,7 +232,7 @@ vcard_select_applet(VCard *card, int channel, VCardApplet *applet) ASSERT(channel < MAX_CHANNEL); card->current_applet[channel] = applet; /* reset the applet */ - if (applet->reset_applet) { + if (applet && applet->reset_applet) { applet->reset_applet(card, channel); } } diff --git a/vcard_emul.h b/vcard_emul.h index 9adfc10..f8bc8e3 100644 --- a/vcard_emul.h +++ b/vcard_emul.h @@ -23,6 +23,21 @@ typedef enum { } VCardEmulError; typedef struct VCardEmulOptionsStruct VCardEmulOptions; +typedef struct VirtualReaderOptionsStruct VirtualReaderOptions; + +struct VirtualReaderOptionsStruct { + char *name; + VCardEmulType card_type; + char **cert_name; + int cert_count; +}; + +struct VCardEmulOptionsStruct { + void *nss_db; + VirtualReaderOptions *vreader; + int vreader_count; + VCardEmulType hw_card_type; +}; /* * Login functions diff --git a/vcard_emul_nss.c b/vcard_emul_nss.c index fee56dc..6910dee 100644 --- a/vcard_emul_nss.c +++ b/vcard_emul_nss.c @@ -1,10 +1,10 @@ /* * This is the actual card emulator. * - * These functions can be implemented in different ways on different platforms using - * the underlying system primitives. For Linux it uses NSS, though direct to PKCS #11, - * openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be used. On Windows - * CAPI could be used. + * These functions can be implemented in different ways on different platforms + * using the underlying system primitives. For Linux it uses NSS, though direct + * to PKCS #11, openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be + * used. On Windows CAPI could be used. */ #include "vcard.h" #include "card_7816t.h" @@ -43,24 +43,6 @@ struct VReaderEmulStruct { VCard *saved_vcard; }; -typedef struct VirtualReaderOptionsStruct VirtualReaderOptions; - -struct VirtualReaderOptionsStruct { - char *name; - VCardEmulType card_type; - char **cert_name; - int cert_count; -}; - - -struct VCardEmulOptionsStruct { - void *nss_db; - VirtualReaderOptions *vreader; - int vreader_count; - VCardEmulType hw_card_type; -}; - - /* if we have more that just the slot, define * VCardEmulStruct here */ @@ -141,8 +123,8 @@ vcard_emul_make_key(PK11SlotInfo *slot, CERTCertificate *cert) key->slot = PK11_ReferenceSlot(slot); key->cert = CERT_DupCertificate(cert); /* NOTE: if we aren't logged into the token, this could return NULL */ - /* NOTE: the cert is a temp cert, not necessarily the cert in the token, use the DER - * version of this function */ + /* NOTE: the cert is a temp cert, not necessarily the cert in the token, + * use the DER version of this function */ key->key = PK11_FindKeyByDERCert(slot,cert, NULL); return key; } @@ -386,7 +368,7 @@ vcard_emul_make_card(PK11SlotInfo *slot, VCardEmulType type, VCardEmul *vcard_emul; VCard *vcard; - /* ingnore the inserted card */ + /* ignore the inserted card */ if (type == VCARD_EMUL_NONE) { return NULL; } diff --git a/vscclient.c b/vscclient.c index 9224adc..1e3e511 100644 --- a/vscclient.c +++ b/vscclient.c @@ -19,7 +19,7 @@ typedef unsigned char BYTE; typedef unsigned long LONG; -int verbose = 0; +int verbose = 10; int sock; |