aboutsummaryrefslogtreecommitdiffstats
path: root/g10/apdu.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-01-25 14:18:56 +0000
committerWerner Koch <[email protected]>2005-01-25 14:18:56 +0000
commitaa87314e6f393863416e1fa7655efc386f81f36f (patch)
treebb6aaf381f4c8eaaaed8559d68d02b1a48ffdb60 /g10/apdu.c
parent* libcurl.m4: All versions of curl-config support --feature. (diff)
downloadgnupg-aa87314e6f393863416e1fa7655efc386f81f36f.tar.gz
gnupg-aa87314e6f393863416e1fa7655efc386f81f36f.zip
(get_cached_data): New arg GET_IMMEDIATE to bypass
the cache. Changed all callers. (get_one_do): Bypass the cache if the value would have been read directly for v1.1 cards.It makes things a bit slower but obnly for 1.0 cards and there are not that many cards out in the wild. This is required to fix a caching bug when generating new keys; as a side effect of the retrieval of the the C4 DO from the 6E DO the chaced fingerprint will get updated to the old value and later when signing the generated key the checking of the fingerprint fails becuase it won't match the new one. Thanks to Moritz for analyzing this problem. (verify_chv3): Removed the CHV status reread logic because we won't cache the C4 DO anymore.
Diffstat (limited to 'g10/apdu.c')
-rw-r--r--g10/apdu.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/g10/apdu.c b/g10/apdu.c
index 1f7194c17..040de1461 100644
--- a/g10/apdu.c
+++ b/g10/apdu.c
@@ -65,11 +65,16 @@
#include "dynload.h"
#include "ccid-driver.h"
+
+/* To to conflicting use of threading libraries we usually can't link
+ against libpcsclite. Instead we use a wrapper program. */
#ifdef USE_GNU_PTH
+#ifndef HAVE_W32_SYSTEM
#define NEED_PCSC_WRAPPER 1
#endif
+#endif
-
+
#define MAX_READER 4 /* Number of readers we support concurrently. */
@@ -1482,7 +1487,6 @@ open_pcsc_reader (const char *portstr)
}
strcpy (reader_table[slot].rdrname, portstr? portstr : list);
xfree (list);
- list = NULL;
err = pcsc_connect (reader_table[slot].pcsc.context,
reader_table[slot].rdrname,
@@ -1496,11 +1500,11 @@ open_pcsc_reader (const char *portstr)
{
log_error ("pcsc_connect failed: %s (0x%lx)\n",
pcsc_error_string (err), err);
-
- pcsc_release_context (reader_table[slot].pcsc.context);
+ pcsc_release_context (reader_table[slot].pcsc.context);
xfree (reader_table[slot].rdrname);
reader_table[slot].rdrname = NULL;
reader_table[slot].used = 0;
+ xfree (list);
return -1;
}
@@ -2717,8 +2721,8 @@ apdu_send_le(int slot, int class, int ins, int p0, int p1,
resultlen -= 2;
if (DBG_CARD_IO)
{
- log_debug (" response: sw=%04X datalen=%u\n",
- sw, (unsigned int)resultlen);
+ log_debug (" response: sw=%04X datalen=%d\n",
+ sw, (unsigned int)resultlen);
if ( !retbuf && (sw == SW_SUCCESS || (sw & 0xff00) == SW_MORE_DATA))
log_printhex (" dump: ", result, resultlen);
}
@@ -2784,8 +2788,8 @@ apdu_send_le(int slot, int class, int ins, int p0, int p1,
resultlen -= 2;
if (DBG_CARD_IO)
{
- log_debug (" more: sw=%04X datalen=%u\n",
- sw, (unsigned int)resultlen);
+ log_debug (" more: sw=%04X datalen=%d\n",
+ sw, (unsigned int)resultlen);
if (!retbuf && (sw==SW_SUCCESS || (sw&0xff00)==SW_MORE_DATA))
log_printhex (" dump: ", result, resultlen);
}
@@ -2918,8 +2922,8 @@ apdu_send_direct (int slot, const unsigned char *apdudata, size_t apdudatalen,
resultlen -= 2;
if (DBG_CARD_IO)
{
- log_debug (" response: sw=%04X datalen=%u\n",
- sw, (unsigned int)resultlen);
+ log_debug (" response: sw=%04X datalen=%d\n",
+ sw, (unsigned int)resultlen);
if ( !retbuf && (sw == SW_SUCCESS || (sw & 0xff00) == SW_MORE_DATA))
log_printhex (" dump: ", result, resultlen);
}
@@ -2971,8 +2975,8 @@ apdu_send_direct (int slot, const unsigned char *apdudata, size_t apdudatalen,
resultlen -= 2;
if (DBG_CARD_IO)
{
- log_debug (" more: sw=%04X datalen=%u\n",
- sw, (unsigned int)resultlen);
+ log_debug (" more: sw=%04X datalen=%d\n",
+ sw, (unsigned int)resultlen);
if (!retbuf && (sw==SW_SUCCESS || (sw&0xff00)==SW_MORE_DATA))
log_printhex (" dump: ", result, resultlen);
}