summaryrefslogtreecommitdiff
path: root/usr.bin/sectok
diff options
context:
space:
mode:
authorJim Rees <rees@cvs.openbsd.org>2002-03-20 22:30:59 +0000
committerJim Rees <rees@cvs.openbsd.org>2002-03-20 22:30:59 +0000
commit1d23cc4c475d038d30faba78dbf60cc2c4d635ee (patch)
treea08dac7f3ed6c8cd3aaf9e18a81736aa8caa0f75 /usr.bin/sectok
parentb5ebf27807976948d5fea4562fdcdb7fc5ca7b0a (diff)
fix for palm again
get_AUT0: "-" means DFLTAUT0
Diffstat (limited to 'usr.bin/sectok')
-rw-r--r--usr.bin/sectok/cmds.c14
-rw-r--r--usr.bin/sectok/cyberflex.c29
2 files changed, 29 insertions, 14 deletions
diff --git a/usr.bin/sectok/cmds.c b/usr.bin/sectok/cmds.c
index 3f02a3b0e94..4744054694e 100644
--- a/usr.bin/sectok/cmds.c
+++ b/usr.bin/sectok/cmds.c
@@ -1,4 +1,4 @@
-/* $Id: cmds.c,v 1.18 2002/03/14 21:11:50 rees Exp $ */
+/* $Id: cmds.c,v 1.19 2002/03/20 22:30:58 rees Exp $ */
/*
* Smartcard commander.
@@ -81,7 +81,9 @@ struct dispatchtable dispatch_table[] = {
{ "write", "input-filename", dwrite },
{ "challenge", "[ size ]", challenge },
{ "pin", "[ -k keyno ] [ PIN ]", vfypin },
+#ifndef __palmos__
{ "chpin", "[ -k keyno ]", chpin },
+#endif
/* Cyberflex commands */
{ "ls", "[ -l ]", ls },
@@ -535,8 +537,14 @@ int vfypin(int ac, char *av[])
if (ac - optind >= 1)
pin = av[optind++];
- else
+ else {
+#ifndef __palmos__
pin = getpass("Enter PIN: ");
+#else
+ printf("usage: pin PIN\n");
+ return -1;
+#endif
+ }
sectok_apdu(fd, cla, 0x20, 0, keyno, strlen(pin), pin, 0, NULL, &sw);
bzero(pin, strlen(pin));
@@ -548,6 +556,7 @@ int vfypin(int ac, char *av[])
return 0;
}
+#ifndef __palmos__
int chpin(int ac, char *av[])
{
int keyno = 1, i, sw;
@@ -575,3 +584,4 @@ int chpin(int ac, char *av[])
}
return 0;
}
+#endif
diff --git a/usr.bin/sectok/cyberflex.c b/usr.bin/sectok/cyberflex.c
index 064d4e72653..2c52997cbc6 100644
--- a/usr.bin/sectok/cyberflex.c
+++ b/usr.bin/sectok/cyberflex.c
@@ -1,4 +1,4 @@
-/* $Id: cyberflex.c,v 1.21 2002/03/14 20:28:04 rees Exp $ */
+/* $Id: cyberflex.c,v 1.22 2002/03/20 22:30:58 rees Exp $ */
/*
copyright 1999, 2000
@@ -121,20 +121,25 @@ get_AUT0(int ac, char *av[], char *prompt, int confirm, unsigned char *digest)
if (!dflag && !xflag) {
SHA1Init(&ctx);
+ /* "-" means DFLTAUT0 */
s = getpass(prompt);
- if (confirm) {
- s2 = strdup(s);
- s = getpass("Re-enter passphrase: ");
- if (strcmp(s, s2)) {
- printf("passphrase mismatch\n");
- return -1;
+ if (!strcmp(s, "-"))
+ memcpy(digest, DFLTAUT0, sizeof DFLTAUT0);
+ else {
+ if (confirm) {
+ s2 = strdup(s);
+ s = getpass("Re-enter passphrase: ");
+ if (strcmp(s, s2)) {
+ printf("passphrase mismatch\n");
+ return -1;
+ }
+ bzero(s2, strlen(s2));
+ free(s2);
}
- bzero(s2, strlen(s2));
- free(s2);
+ SHA1Update(&ctx, s, strlen(s));
+ bzero(s, strlen(s));
+ SHA1Final(digest, &ctx);
}
- SHA1Update(&ctx, s, strlen(s));
- bzero(s, strlen(s));
- SHA1Final(digest, &ctx);
}
#endif