summaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorTimo Schulz <twoaday@freakmail.de>2003-08-14 14:20:08 +0200
committerTimo Schulz <twoaday@freakmail.de>2003-08-14 14:20:08 +0200
commitabbb66e037ff7565d2f4b196cf4d14fddbad02b2 (patch)
treea0d34880fadf1182579ccfb8d1ce4b529010aa8e /scd
parent*** empty log message *** (diff)
downloadgnupg2-abbb66e037ff7565d2f4b196cf4d14fddbad02b2.tar.xz
gnupg2-abbb66e037ff7565d2f4b196cf4d14fddbad02b2.zip
* Always use 'dynload.h' instead of 'dlfcn.h'.
Diffstat (limited to 'scd')
-rw-r--r--scd/ChangeLog6
-rw-r--r--scd/apdu.c55
-rw-r--r--scd/app.c3
-rw-r--r--scd/atr.c2
-rw-r--r--scd/iso7816.c2
5 files changed, 36 insertions, 32 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog
index ae2e6ce6e..d78c4aa16 100644
--- a/scd/ChangeLog
+++ b/scd/ChangeLog
@@ -1,3 +1,9 @@
+2003-08-14 Timo Schulz <twoaday@freakmail.de>
+
+ * apdu.c (ct_activate_card): Change the code a little to avoid
+ problems with other readers.
+ * Always use 'dynload.h' instead of 'dlfcn.h'.
+
2003-08-05 Werner Koch <wk@gnupg.org>
* app-openpgp.c (dump_all_do): Don't analyze constructed DOs after
diff --git a/scd/apdu.c b/scd/apdu.c
index 60de5b953..6afcd6711 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -23,11 +23,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
#include <assert.h>
#include "scdaemon.h"
#include "apdu.h"
+#include "dynload.h"
#define MAX_READER 4 /* Number of readers we support concurrently. */
#define CARD_CONNECT_TIMEOUT 1 /* Number of seconds to wait for
@@ -232,40 +232,37 @@ ct_activate_card (int reader)
return -1;
}
- if (buf[0] == 0x05)
- { /* Connected, now activate the card. */
- dad[0] = 1; /* Destination address: CT. */
- sad[0] = 2; /* Source address: Host. */
+ /* Connected, now activate the card. */
+ dad[0] = 1; /* Destination address: CT. */
+ sad[0] = 2; /* Source address: Host. */
- cmd[0] = 0x20; /* Class byte. */
- cmd[1] = 0x12; /* Request ICC. */
- cmd[2] = 0x01; /* From first interface. */
- cmd[3] = 0x01; /* Return card's ATR. */
- cmd[4] = 0x00;
-
- buflen = DIM(buf);
+ cmd[0] = 0x20; /* Class byte. */
+ cmd[1] = 0x12; /* Request ICC. */
+ cmd[2] = 0x01; /* From first interface. */
+ cmd[3] = 0x01; /* Return card's ATR. */
+ cmd[4] = 0x00;
- rc = CT_data (reader, dad, sad, 5, cmd, &buflen, buf);
- if (rc || buflen < 2 || buf[buflen-2] != 0x90)
- {
- log_error ("ct_activate_card(%d): activation failed: %s\n",
- reader, ct_error_string (rc));
- return -1;
- }
+ buflen = DIM(buf);
- /* Store the type and the ATR. */
- if (buflen - 2 > DIM (reader_table[0].atr))
- {
- log_error ("ct_activate_card(%d): ATR too long\n", reader);
- return -1;
- }
+ rc = CT_data (reader, dad, sad, 5, cmd, &buflen, buf);
+ if (rc || buflen < 2 || buf[buflen-2] != 0x90)
+ {
+ log_error ("ct_activate_card(%d): activation failed: %s\n",
+ reader, ct_error_string (rc));
+ return -1;
+ }
- reader_table[reader].status = buf[buflen - 1];
- memcpy (reader_table[reader].atr, buf, buflen - 2);
- reader_table[reader].atrlen = buflen - 2;
- return 0;
+ /* Store the type and the ATR. */
+ if (buflen - 2 > DIM (reader_table[0].atr))
+ {
+ log_error ("ct_activate_card(%d): ATR too long\n", reader);
+ return -1;
}
+ reader_table[reader].status = buf[buflen - 1];
+ memcpy (reader_table[reader].atr, buf, buflen - 2);
+ reader_table[reader].atrlen = buflen - 2;
+ return 0;
}
log_info ("ct_activate_card(%d): timeout waiting for card\n", reader);
diff --git a/scd/app.c b/scd/app.c
index 04b421b55..fa5df8a72 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -23,12 +23,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
+
#include "scdaemon.h"
#include "app-common.h"
#include "apdu.h"
#include "iso7816.h"
+#include "dynload.h"
static char *default_reader_port;
diff --git a/scd/atr.c b/scd/atr.c
index 4e15aad50..6475e83f8 100644
--- a/scd/atr.c
+++ b/scd/atr.c
@@ -23,12 +23,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
#include <assert.h>
#include "scdaemon.h"
#include "apdu.h"
#include "atr.h"
+#include "dynload.h"
static int const fi_table[16] = { 0, 372, 558, 744, 1116,1488, 1860, -1,
-1, 512, 768, 1024, 1536, 2048, -1, -1 };
diff --git a/scd/iso7816.c b/scd/iso7816.c
index 8903d8a5c..2b06103ef 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -23,11 +23,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
#include "scdaemon.h"
#include "iso7816.h"
#include "apdu.h"
+#include "dynload.h"
#define CMD_SELECT_FILE 0xA4
#define CMD_VERIFY 0x20