diff options
author | Jim Rees <rees@cvs.openbsd.org> | 2001-06-07 16:10:02 +0000 |
---|---|---|
committer | Jim Rees <rees@cvs.openbsd.org> | 2001-06-07 16:10:02 +0000 |
commit | 47643908694ed46da22982d25c33cd6aa716c613 (patch) | |
tree | fa8d47ff4017117cc0c8d30cdc3dc23ced310b02 | |
parent | 903085f6f0ebab29946c945754764d4d77638383 (diff) |
fix compiler warnings
-rw-r--r-- | lib/libsectok/atr.c | 33 | ||||
-rw-r--r-- | lib/libsectok/cmdtab.c | 110 | ||||
-rw-r--r-- | lib/libsectok/ifdhandler.c | 4 | ||||
-rw-r--r-- | lib/libsectok/input.c | 5 | ||||
-rw-r--r-- | lib/libsectok/r1r2.c | 5 | ||||
-rw-r--r-- | lib/libsectok/sc7816.c | 4 | ||||
-rw-r--r-- | lib/libsectok/scio.c | 5 | ||||
-rw-r--r-- | lib/libsectok/scrw.c | 4 | ||||
-rw-r--r-- | lib/libsectok/todos_atr.c | 10 | ||||
-rw-r--r-- | lib/libsectok/todos_scrw.h | 3 |
10 files changed, 82 insertions, 101 deletions
diff --git a/lib/libsectok/atr.c b/lib/libsectok/atr.c index 618ba4b7b19..2549f70293a 100644 --- a/lib/libsectok/atr.c +++ b/lib/libsectok/atr.c @@ -5,7 +5,7 @@ * * Jim Rees, University of Michigan CITI */ -static char *rcsid = "$Id: atr.c,v 1.1 2001/06/07 15:17:32 rees Exp $"; +static char *rcsid = "$Id: atr.c,v 1.2 2001/06/07 16:09:59 rees Exp $"; #ifdef __palmos__ #include <Common.h> @@ -134,9 +134,6 @@ parse_atr(int ttyn, int flags, unsigned char *atr, int len, struct scparam *para printf("inverse conversion\n"); for (i = 0; i < len; i++) atr[i] = scinvert[atr[i]]; -#ifdef SCPPS - scsetflags(ttyn, SCOINVRT, SCOINVRT); -#endif } ts = *ap++; @@ -248,36 +245,8 @@ parse_atr(int ttyn, int flags, unsigned char *atr, int len, struct scparam *para if (!(flags & SCRTODOS)) { for (i = 0; bps[i].bps; i++) { if (((TA1 >> 4) & 0xf) >= bps[i].Fi && (TA1 & 0xf) >= bps[i].Di) { - int j; - unsigned char c; - static unsigned char pps[4] = {0xff, 0x10, 0, 0}; - - pps[2] = (bps[i].Fi << 4) | bps[i].Di; - pps[3] = 0; - if (flags & SCRV) printf("speed %ld\n", bps[i].bps); - -#ifdef SCPPS - /* Compute checksum */ - for (j = 0; j < 3; j++) - pps[3] ^= pps[j]; - - for (j = 0; j < 4; j++) - scputc(ttyn, pps[j]); - for (j = 0; j < 4; j++) - if (scgetc(ttyn, &c, 100) != SCEOK || c != pps[j]) - break; - if (j != 4) - continue; - if (scsetspeed(ttyn, bps[i].bps) < 0) { - /* We already sent the pps, can't back out now, so fail. */ - if (flags & SCRV) - printf("scsetspeed %ld failed\n", bps[i].bps); - param->t = -1; - return len; - } -#endif Fi = bps[i].Fi; Di = bps[i].Di; break; diff --git a/lib/libsectok/cmdtab.c b/lib/libsectok/cmdtab.c index 5985ee11cd6..62b626c6e66 100644 --- a/lib/libsectok/cmdtab.c +++ b/lib/libsectok/cmdtab.c @@ -2,7 +2,7 @@ * See copyright notice at end of file */ -static char *rcsid = "$Id: cmdtab.c,v 1.1 2001/06/07 15:17:32 rees Exp $"; +static char *rcsid = "$Id: cmdtab.c,v 1.2 2001/06/07 16:09:59 rees Exp $"; #ifdef __palmos__ #include <Common.h> @@ -22,67 +22,67 @@ struct cmd { char *name; } cmdtab[] = { /* 7816-4 */ - 0x0e, 0, "erase binary", - 0x20, 0, "verify", - 0x70, 0, "manage channel", - 0x82, 0, "ext auth", - 0x84, 1, "get challenge", - 0x88, 0, "int auth", - 0xa4, 0, "select", - 0xb0, 1, "read binary", - 0xb2, 1, "read record", - 0xc0, 1, "get response", - 0xc2, 0, "envelope", - 0xca, 0, "get data", - 0xd0, 0, "write binary", - 0xd2, 0, "write record", - 0xd6, 0, "update binary", - 0xda, 0, "put data", - 0xdc, 0, "update record", - 0xe2, 0, "append record", + {0x0e, 0, "erase binary"}, + {0x20, 0, "verify"}, + {0x70, 0, "manage channel"}, + {0x82, 0, "ext auth"}, + {0x84, 1, "get challenge"}, + {0x88, 0, "int auth"}, + {0xa4, 0, "select"}, + {0xb0, 1, "read binary"}, + {0xb2, 1, "read record"}, + {0xc0, 1, "get response"}, + {0xc2, 0, "envelope"}, + {0xca, 0, "get data"}, + {0xd0, 0, "write binary"}, + {0xd2, 0, "write record"}, + {0xd6, 0, "update binary"}, + {0xda, 0, "put data"}, + {0xdc, 0, "update record"}, + {0xe2, 0, "append record"}, /* Webcard */ - 0xfe, 0, "ip7816", + {0xfe, 0, "ip7816"}, /* Cyberflex Access */ - 0x04, 0, "invalidate", - 0x08, 0, "manage instance", - 0x0a, 0, "manage program", - 0x0c, 0, "execute method", - 0x22, 0, "logout all", - 0x24, 0, "change PIN", - 0x2a, 0, "verify key", - 0x2c, 0, "unblock", - 0x44, 0, "rehabilitate", - 0xa8, 1, "directory", - 0xe0, 0, "create", - 0xe4, 0, "delete", - 0xfa, 0, "change java atr", - 0xfc, 0, "change acl", -/* 0xfe, 1, "get acl",*/ + {0x04, 0, "invalidate"}, + {0x08, 0, "manage instance"}, + {0x0a, 0, "manage program"}, + {0x0c, 0, "execute method"}, + {0x22, 0, "logout all"}, + {0x24, 0, "change PIN"}, + {0x2a, 0, "verify key"}, + {0x2c, 0, "unblock"}, + {0x44, 0, "rehabilitate"}, + {0xa8, 1, "directory"}, + {0xe0, 0, "create"}, + {0xe4, 0, "delete"}, + {0xfa, 0, "change java atr"}, + {0xfc, 0, "change acl"}, +/* {0xfe, 1, "get acl"},*/ /* GSM */ - 0x26, 0, "disable PIN", - 0x28, 0, "enable PIN", - 0x30, 0, "decrease", - 0x32, 0, "increase", - 0xf2, 1, "get status", + {0x26, 0, "disable PIN"}, + {0x28, 0, "enable PIN"}, + {0x30, 0, "decrease"}, + {0x32, 0, "increase"}, + {0xf2, 1, "get status"}, /* Visa cash / open platform */ - 0x50, 0, "init update", - 0x80, 0, "install default app", + {0x50, 0, "init update"}, + {0x80, 0, "install default app"}, #ifdef PAYFLEX /* Payflex */ - 0x52, 0, "credit", - 0x54, 0, "debit", - 0x56, 0, "replace debit", - 0x58, 0, "token debit", - 0x5a, 0, "token purchase", - 0x5c, 0, "update currency", - 0x8a, 0, "cert credit", - 0x8c, 0, "cert debit", - 0x8e, 0, "generate diversified key", - 0xd8, 0, "load key", - 0xde, 0, "update max amount", - 0xf4, 0, "load exe", + {0x52, 0, "credit"}, + {0x54, 0, "debit"}, + {0x56, 0, "replace debit"}, + {0x58, 0, "token debit"}, + {0x5a, 0, "token purchase"}, + {0x5c, 0, "update currency"}, + {0x8a, 0, "cert credit"}, + {0x8c, 0, "cert debit"}, + {0x8e, 0, "generate diversified key"}, + {0xd8, 0, "load key"}, + {0xde, 0, "update max amount"}, + {0xf4, 0, "load exe"}, #endif /* PAYFLEX */ - 0, 0, NULL + {0, 0, NULL} }; struct cmd * diff --git a/lib/libsectok/ifdhandler.c b/lib/libsectok/ifdhandler.c index 296e8a60e12..11e8901bafe 100644 --- a/lib/libsectok/ifdhandler.c +++ b/lib/libsectok/ifdhandler.c @@ -5,7 +5,7 @@ * * Jim Rees, University of Michigan CITI, August 2000 */ -static char *rcsid = "$Id: ifdhandler.c,v 1.1 2001/06/07 15:17:32 rees Exp $"; +static char *rcsid = "$Id: ifdhandler.c,v 1.2 2001/06/07 16:09:59 rees Exp $"; #include <sys/types.h> #include <stdio.h> @@ -190,7 +190,7 @@ IFD_Transmit_to_ICC(struct SCARD_IO_HEADER SendPci, struct SCARD_IO_HEADER *RecvPci) { unsigned char buf[255+2]; - int n, p3, sw1, sw2; + int n, sw1, sw2; #ifdef DEBUG printf("p3 %x ilen %x *olen %x\n", ibuf[4], ilen, *olen); diff --git a/lib/libsectok/input.c b/lib/libsectok/input.c index df0043238a6..c93fa9dee0e 100644 --- a/lib/libsectok/input.c +++ b/lib/libsectok/input.c @@ -5,10 +5,13 @@ * * Jim Rees, University of Michigan, July 2000 */ -static char *rcsid = "$Id: input.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: input.c,v 1.2 2001/06/07 16:09:59 rees Exp $"; #include <stdio.h> #include <ctype.h> +#include <string.h> + +#include "sectok.h" #ifdef TEST main(ac, av) diff --git a/lib/libsectok/r1r2.c b/lib/libsectok/r1r2.c index c9c4c075c95..af079c0ab92 100644 --- a/lib/libsectok/r1r2.c +++ b/lib/libsectok/r1r2.c @@ -3,7 +3,7 @@ * * See copyright notice at end of file */ -static char *rcsid = "$Id: r1r2.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: r1r2.c,v 1.2 2001/06/07 16:10:00 rees Exp $"; #ifdef __palmos__ #define NULL 0 @@ -94,7 +94,6 @@ char * scr1r2s(int r1, int r2) { int i; - char *s; static char buf[64]; for (i = 0; r1r2s[i].s; i++) @@ -124,7 +123,7 @@ fdump_reply(FILE *f, unsigned char *p, int n, int r1, int r2) int dump_reply(unsigned char *p, int n, int r1, int r2) { - fdump_reply(stdout, p, n, r1, r2); + return fdump_reply(stdout, p, n, r1, r2); } #endif diff --git a/lib/libsectok/sc7816.c b/lib/libsectok/sc7816.c index 8b0464f3667..6a3fc3df04b 100644 --- a/lib/libsectok/sc7816.c +++ b/lib/libsectok/sc7816.c @@ -7,10 +7,12 @@ * Mukesh Agrawal * University of Michigan CITI, August 2000 */ -static char *rcsid = "$Id: sc7816.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: sc7816.c,v 1.2 2001/06/07 16:10:00 rees Exp $"; #include <sys/types.h> #include <sys/time.h> +#include <stdlib.h> +#include <unistd.h> #include <stdio.h> #include <string.h> #include <dlfcn.h> diff --git a/lib/libsectok/scio.c b/lib/libsectok/scio.c index 8d5ee9cd9d6..682eafff8b0 100644 --- a/lib/libsectok/scio.c +++ b/lib/libsectok/scio.c @@ -5,7 +5,7 @@ * * Jim Rees, University of Michigan, October 1997 */ -static char *rcsid = "$Id: scio.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: scio.c,v 1.2 2001/06/07 16:10:00 rees Exp $"; #include <sys/ioctl.h> #include <sys/file.h> @@ -24,6 +24,9 @@ static char *rcsid = "$Id: scio.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; #include "sectok.h" #include "todos_scrw.h" +int todos_scfdopen(int ttyn, int fd, int flags, int *ep); +int todos_sccts(int ttyn); + #ifdef __linux static char ttynametmpl[] = "/dev/cua%01d"; #elif _AIX diff --git a/lib/libsectok/scrw.c b/lib/libsectok/scrw.c index 57180c34954..b71b329b218 100644 --- a/lib/libsectok/scrw.c +++ b/lib/libsectok/scrw.c @@ -5,7 +5,7 @@ * * Jim Rees, University of Michigan, October 1997 */ -static char *rcsid = "$Id: scrw.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: scrw.c,v 1.2 2001/06/07 16:10:00 rees Exp $"; #ifdef __palmos__ #include <Common.h> @@ -49,7 +49,7 @@ int todos_scioT1(int ttyn, int cla, int ins, int p1, int p2, int ilen, unsigned int todos_scxreset(int ttyn, int flags, unsigned char *atr, int *ep) { - unsigned char *ap, buf[33]; + unsigned char buf[33]; int n, err; if (ep) diff --git a/lib/libsectok/todos_atr.c b/lib/libsectok/todos_atr.c index 151428fb13f..1619da0548b 100644 --- a/lib/libsectok/todos_atr.c +++ b/lib/libsectok/todos_atr.c @@ -5,7 +5,7 @@ * * Jim Rees, University of Michigan CITI */ -static char *rcsid = "$Id: todos_atr.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; +static char *rcsid = "$Id: todos_atr.c,v 1.2 2001/06/07 16:10:00 rees Exp $"; #ifdef __palmos__ #include <Common.h> @@ -23,6 +23,10 @@ static char *rcsid = "$Id: todos_atr.c,v 1.1 2001/06/07 15:17:33 rees Exp $"; #include "sectok.h" #include "todos_scrw.h" +#ifdef __unix__ +#define SCPPS +#endif + /* * 7816 says ATR will appear within 40000 clocks (12 msec) * BUT some cards violate the spec and require more time @@ -129,9 +133,9 @@ static struct bps { int todos_get_atr(int ttyn, int flags, unsigned char *atr, struct scparam *param) { - int len, i, c, t, ts, t0, tck, nhb, pbn; + int len, i, t, ts, t0, tck, nhb, pbn; int F, D, Fi, Di, N, etu, WI; - unsigned char *ap, *hb; + unsigned char *ap; unsigned char tpb[8][4]; int hiproto = 0; diff --git a/lib/libsectok/todos_scrw.h b/lib/libsectok/todos_scrw.h index 65a6366f28b..ccc3b0e0a00 100644 --- a/lib/libsectok/todos_scrw.h +++ b/lib/libsectok/todos_scrw.h @@ -1,7 +1,7 @@ /* * See copyright notice at end of file * - * $Id: todos_scrw.h,v 1.1 2001/06/07 15:17:33 rees Exp $ + * $Id: todos_scrw.h,v 1.2 2001/06/07 16:10:01 rees Exp $ */ extern unsigned char todos_scinvert[]; @@ -10,6 +10,7 @@ extern unsigned char todos_scinvert[]; int todos_scopen(int ttyn, int flags, int *ep); int todos_scsetflags(int ttyn, int flags, int mask); +int todos_scsetspeed(int ttyn, int speed); int todos_scrw(int ttyn, int cla, int ins, int p1, int p2, int ilen, unsigned char *ibuf, int olen, unsigned char *obuf, int *sw1p, int *sw2p); int todos_sccardpresent(int ttyn); int todos_scdsr(int ttyn); |