diff options
Diffstat (limited to 'libcacard/vcard_emul_nss.c')
-rw-r--r-- | libcacard/vcard_emul_nss.c | 14 |
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; } |