diff options
author | Timo Schulz <[email protected]> | 2003-08-14 12:20:08 +0000 |
---|---|---|
committer | Timo Schulz <[email protected]> | 2003-08-14 12:20:08 +0000 |
commit | abbb66e037ff7565d2f4b196cf4d14fddbad02b2 (patch) | |
tree | a0d34880fadf1182579ccfb8d1ce4b529010aa8e /scd/apdu.c | |
parent | *** empty log message *** (diff) | |
download | gnupg-abbb66e037ff7565d2f4b196cf4d14fddbad02b2.tar.gz gnupg-abbb66e037ff7565d2f4b196cf4d14fddbad02b2.zip |
* Always use 'dynload.h' instead of 'dlfcn.h'.
Diffstat (limited to '')
-rw-r--r-- | scd/apdu.c | 55 |
1 files changed, 26 insertions, 29 deletions
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); |