summaryrefslogtreecommitdiff
path: root/libcacard/vcard_emul_nss.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2013-03-05 16:27:43 +0200
committerAlon Levy <alevy@redhat.com>2013-04-24 11:48:03 +0300
commit0b6a16c1a47b622b1a692ab179013d9e30e9cf3b (patch)
tree06dba3ec6c9f1d17c593a3da45c18cce1f45a299 /libcacard/vcard_emul_nss.c
parent7a6858962457c54be44715d6562504c765d9ea76 (diff)
downloadqemu-0b6a16c1a47b622b1a692ab179013d9e30e9cf3b.tar.gz
qemu-0b6a16c1a47b622b1a692ab179013d9e30e9cf3b.tar.bz2
qemu-0b6a16c1a47b622b1a692ab179013d9e30e9cf3b.zip
libcacard: move atr setting from macro to function
Only because qemu's checkpatch complains about it. Signed-off-by: Alon Levy <alevy@redhat.com> Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
Diffstat (limited to 'libcacard/vcard_emul_nss.c')
-rw-r--r--libcacard/vcard_emul_nss.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 9ba80fbdad..1a3e5683bc 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -33,6 +33,9 @@
#include "vreader.h"
#include "vevent.h"
+#include "libcacard/vcardt_internal.h"
+
+
typedef enum {
VCardEmulUnknown = -1,
VCardEmulFalse = 0,
@@ -519,18 +522,23 @@ vcard_emul_reader_get_slot(VReader *vreader)
}
/*
- * Card ATR's map to physical cards. VCARD_ATR_PREFIX will set appropriate
+ * Card ATR's map to physical cards. vcard_alloc_atr will set appropriate
* historical bytes for any software emulated card. The remaining bytes can be
* used to indicate the actual emulator
*/
-static const unsigned char nss_atr[] = { VCARD_ATR_PREFIX(3), 'N', 'S', 'S' };
+static unsigned char *nss_atr;
+static int nss_atr_len;
void
vcard_emul_get_atr(VCard *card, unsigned char *atr, int *atr_len)
{
- int len = MIN(sizeof(nss_atr), *atr_len);
+ int len;
assert(atr != NULL);
+ if (nss_atr == NULL) {
+ nss_atr = vcard_alloc_atr("NSS", &nss_atr_len);
+ }
+ len = MIN(nss_atr_len, *atr_len);
memcpy(atr, nss_atr, len);
*atr_len = len;
}