summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakob <jakob@openbsd.org>2001-07-27 21:55:36 +0000
committerjakob <jakob@openbsd.org>2001-07-27 21:55:36 +0000
commit715f4a273fb843d8d934dcc37c1cb8f2d84a7a3e (patch)
tree7b9b17bc512d4e4fcf25263629dab297917c4697
parent#ifdef vax -> #ifdef __vax__ (diff)
downloadwireguard-openbsd-715f4a273fb843d8d934dcc37c1cb8f2d84a7a3e.tar.xz
wireguard-openbsd-715f4a273fb843d8d934dcc37c1cb8f2d84a7a3e.zip
add sectok_friendly_open() - like sectok_open() but accepts
the reader as a string instead of an integer. ok rees@
-rw-r--r--lib/libsectok/sectok.c12
-rw-r--r--lib/libsectok/sectok.h3
-rw-r--r--lib/libsectok/shlib_version2
3 files changed, 14 insertions, 3 deletions
diff --git a/lib/libsectok/sectok.c b/lib/libsectok/sectok.c
index d92147b1947..27d5395b84c 100644
--- a/lib/libsectok/sectok.c
+++ b/lib/libsectok/sectok.c
@@ -1,4 +1,4 @@
-/* $Id: sectok.c,v 1.7 2001/07/26 22:15:04 rees Exp $ */
+/* $Id: sectok.c,v 1.8 2001/07/27 21:55:36 jakob Exp $ */
/*
copyright 2000
@@ -180,6 +180,16 @@ int sectok_open(int rn, int flags, int *swp)
return sectok_xopen(rn, flags, NULL, NULL, swp);
}
+int sectok_friendly_open(const char *rn, int flags, int *swp)
+{
+ /* just convert the reader to a integer for now */
+ if (rn != NULL) {
+ return sectok_xopen(atoi(rn), flags, NULL, NULL, swp);
+ } else {
+ return -1;
+ }
+}
+
static int
openReader(int readerNum, int flags)
{
diff --git a/lib/libsectok/sectok.h b/lib/libsectok/sectok.h
index c2955ff1125..87fc526b3aa 100644
--- a/lib/libsectok/sectok.h
+++ b/lib/libsectok/sectok.h
@@ -1,4 +1,4 @@
-/* $Id: sectok.h,v 1.13 2001/07/26 22:15:04 rees Exp $ */
+/* $Id: sectok.h,v 1.14 2001/07/27 21:55:36 jakob Exp $ */
/*
copyright 2001
@@ -70,6 +70,7 @@ extern unsigned char root_fid[];
/* Common card functions */
int sectok_open(int rn, int flags, int *swp);
+int sectok_friendly_open(const char *rn, int flags, int *swp);
int sectok_xopen(int rn, int flags, char *config_path, char *driver_path, int *swp);
int sectok_reset(int fd, int flags, unsigned char *atr, int *swp);
int sectok_apdu(int fd, int cla, int ins, int p1, int p2,
diff --git a/lib/libsectok/shlib_version b/lib/libsectok/shlib_version
index 012c14171d3..3f0196ebf4a 100644
--- a/lib/libsectok/shlib_version
+++ b/lib/libsectok/shlib_version
@@ -1,2 +1,2 @@
major=3
-minor=0
+minor=1