summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-08-08 17:15:12 +0300
committerAlon Levy <alevy@redhat.com>2010-08-15 16:46:32 +0300
commitc4523f6d1a009ebcb93b4161c86e3ce02dfa9b4c (patch)
tree8acae3c9f05fdc1312194889a63f37a4907a9e29
parentc2cc49a5578f415d3ddd5a5a81c2e8771a015c4c (diff)
move VCardEmulOptions to h file for use by vssclient
-rw-r--r--vcard.c2
-rw-r--r--vcard_emul.h15
-rw-r--r--vcard_emul_nss.c32
-rw-r--r--vscclient.c2
4 files changed, 24 insertions, 27 deletions
diff --git a/vcard.c b/vcard.c
index 46abd55..d57540d 100644
--- a/vcard.c
+++ b/vcard.c
@@ -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;