diff options
-rw-r--r-- | lib/libskey/skey.5 | 6 | ||||
-rw-r--r-- | lib/libskey/skey.h | 4 | ||||
-rw-r--r-- | lib/libskey/skeysubr.c | 47 | ||||
-rw-r--r-- | usr.bin/skey/Makefile | 8 | ||||
-rw-r--r-- | usr.bin/skey/skey.1 | 16 | ||||
-rw-r--r-- | usr.bin/skey/skey.c | 4 | ||||
-rw-r--r-- | usr.bin/skeyinit/skeyinit.1 | 10 | ||||
-rw-r--r-- | usr.bin/skeyinit/skeyinit.c | 15 |
8 files changed, 31 insertions, 79 deletions
diff --git a/lib/libskey/skey.5 b/lib/libskey/skey.5 index 902a2e5d276..a576db24e55 100644 --- a/lib/libskey/skey.5 +++ b/lib/libskey/skey.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: skey.5,v 1.6 2007/05/31 19:19:37 jmc Exp $ +.\" $OpenBSD: skey.5,v 1.7 2014/03/20 20:39:13 naddy Exp $ .\" .\" Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> .\" @@ -18,7 +18,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: March 20 2014 $ .Dt SKEY 5 .Os .Sh NAME @@ -52,7 +52,7 @@ The name of the user the record describes. This should be the same as the name of the file. .It The hash type used for this entry; -one of md4, md5, sha1, or rmd160. +one of md5, sha1, or rmd160. The default is md5. .It The sequence number. diff --git a/lib/libskey/skey.h b/lib/libskey/skey.h index 6ccaf109b3d..64f5b591c90 100644 --- a/lib/libskey/skey.h +++ b/lib/libskey/skey.h @@ -10,7 +10,7 @@ * * Main client header * - * $OpenBSD: skey.h,v 1.19 2004/08/05 13:31:36 millert Exp $ + * $OpenBSD: skey.h,v 1.20 2014/03/20 20:39:13 naddy Exp $ */ #ifndef _SKEY_H_ @@ -51,7 +51,7 @@ struct mc { /* Max length of S/Key challenge (otp-???? 9999 seed) */ #define SKEY_MAX_CHALLENGE (11 + SKEY_MAX_HASHNAME_LEN + SKEY_MAX_SEED_LEN) -/* Max length of hash algorithm name (md4/md5/sha1/rmd160) */ +/* Max length of hash algorithm name (md5/sha1/rmd160) */ #define SKEY_MAX_HASHNAME_LEN 6 /* Size of a binary key (not NULL-terminated) */ diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c index 4f2cb7e4a36..6a26cc3bee2 100644 --- a/lib/libskey/skeysubr.c +++ b/lib/libskey/skeysubr.c @@ -9,7 +9,7 @@ * * S/Key misc routines. * - * $OpenBSD: skeysubr.c,v 1.31 2013/11/29 19:00:51 deraadt Exp $ + * $OpenBSD: skeysubr.c,v 1.32 2014/03/20 20:39:13 naddy Exp $ */ #include <stdio.h> @@ -19,7 +19,6 @@ #include <signal.h> #include <termios.h> #include <unistd.h> -#include <md4.h> #include <md5.h> #include <sha1.h> #include <rmd160.h> @@ -31,7 +30,6 @@ #define SKEY_HASH_DEFAULT 1 #endif -static int keycrunch_md4(char *, char *, char *); static int keycrunch_md5(char *, char *, char *); static int keycrunch_sha1(char *, char *, char *); static int keycrunch_rmd160(char *, char *, char *); @@ -52,7 +50,6 @@ struct skey_algorithm_table { int (*keycrunch)(char *, char *, char *); }; static struct skey_algorithm_table skey_algorithm_table[] = { - { "md4", keycrunch_md4 }, { "md5", keycrunch_md5 }, { "sha1", keycrunch_sha1 }, { "rmd160", keycrunch_rmd160 } @@ -73,48 +70,6 @@ keycrunch(char *result, char *seed, char *passwd) } static int -keycrunch_md4(char *result, char *seed, char *passwd) -{ - char *buf = NULL; - MD4_CTX md; - u_int32_t results[4]; - unsigned int buflen; - - /* - * If seed and passwd are defined we are in keycrunch() mode, - * else we are in f() mode. - */ - if (seed && passwd) { - buflen = strlen(seed) + strlen(passwd); - if ((buf = malloc(buflen + 1)) == NULL) - return(-1); - (void)strlcpy(buf, seed, buflen + 1); - lowcase(buf); - (void)strlcat(buf, passwd, buflen + 1); - sevenbit(buf); - } else { - buf = result; - buflen = SKEY_BINKEY_SIZE; - } - - /* Crunch the key through MD4 */ - MD4Init(&md); - MD4Update(&md, (unsigned char *)buf, buflen); - MD4Final((unsigned char *)results, &md); - - /* Fold result from 128 to 64 bits */ - results[0] ^= results[2]; - results[1] ^= results[3]; - - (void)memcpy((void *)result, (void *)results, SKEY_BINKEY_SIZE); - - if (buf != result) - (void)free(buf); - - return(0); -} - -static int keycrunch_md5(char *result, char *seed, char *passwd) { char *buf; diff --git a/usr.bin/skey/Makefile b/usr.bin/skey/Makefile index a32e64da341..bd4e1025fec 100644 --- a/usr.bin/skey/Makefile +++ b/usr.bin/skey/Makefile @@ -1,13 +1,11 @@ -# $OpenBSD: Makefile,v 1.13 1997/09/21 11:50:50 deraadt Exp $ +# $OpenBSD: Makefile,v 1.14 2014/03/20 20:39:13 naddy Exp $ PROG= skey MAN= skey.1 skeyprune.8 -LINKS= ${BINDIR}/skey ${BINDIR}/otp-md4 \ - ${BINDIR}/skey ${BINDIR}/otp-md5 \ +LINKS= ${BINDIR}/skey ${BINDIR}/otp-md5 \ ${BINDIR}/skey ${BINDIR}/otp-sha1 \ ${BINDIR}/skey ${BINDIR}/otp-rmd160 -MLINKS= skey.1 otp-md4.1 \ - skey.1 otp-md5.1 \ +MLINKS= skey.1 otp-md5.1 \ skey.1 otp-sha1.1 \ skey.1 otp-rmd160.1 DPADD= ${LIBSKEY} diff --git a/usr.bin/skey/skey.1 b/usr.bin/skey/skey.1 index 9326e663406..1865ed41be9 100644 --- a/usr.bin/skey/skey.1 +++ b/usr.bin/skey/skey.1 @@ -1,17 +1,17 @@ -.\" $OpenBSD: skey.1,v 1.33 2012/09/26 16:12:13 jmc Exp $ +.\" $OpenBSD: skey.1,v 1.34 2014/03/20 20:39:13 naddy Exp $ .\" @(#)skey.1 1.1 10/28/93 .\" -.Dd $Mdocdate: September 26 2012 $ +.Dd $Mdocdate: March 20 2014 $ .Dt SKEY 1 .Os .Sh NAME -.Nm skey , otp-md4 , otp-md5 , otp-rmd160 , otp-sha1 +.Nm skey , otp-md5 , otp-rmd160 , otp-sha1 .Nd respond to an OTP challenge .Sh SYNOPSIS .Nm skey .Op Fl x .Oo -.Fl md4 | md5 | rmd160 | sha1 +.Fl md5 | rmd160 | sha1 .Oc .Op Fl n Ar count .Op Fl p Ar passphrase @@ -22,7 +22,7 @@ is a procedure for using one-time passwords to authenticate access to computer systems. It uses 64 bits of information transformed by the -MD4, MD5, RIPEMD-160, or SHA1 algorithms. +MD5, RIPEMD-160, or SHA1 algorithms. The user supplies the 64 bits in the form of 6 English words that are generated by a secure computer. This implementation of @@ -48,7 +48,7 @@ will use .Ar method as the hash function where .Ar method -is currently one of md4, md5, rmd160, or sha1. +is currently one of md5, rmd160, or sha1. .Pp If you misspell your secret passphrase while running .Nm skey , @@ -62,9 +62,9 @@ prints them capitalized. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl md4 | md5 | rmd160 | sha1 +.It Fl md5 | rmd160 | sha1 Selects the hash algorithm: -MD4, MD5, RMD-160 (160-bit Ripe Message Digest), +MD5, RMD-160 (160-bit Ripe Message Digest), or SHA1 (NIST Secure Hash Algorithm Revision 1). .It Fl n Ar count Prints out diff --git a/usr.bin/skey/skey.c b/usr.bin/skey/skey.c index 3b134a0c131..352e02356e3 100644 --- a/usr.bin/skey/skey.c +++ b/usr.bin/skey/skey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skey.c,v 1.26 2010/04/11 20:20:29 millert Exp $ */ +/* $OpenBSD: skey.c,v 1.27 2014/03/20 20:39:13 naddy Exp $ */ /* * OpenBSD S/Key (skey.c) * @@ -150,7 +150,7 @@ void usage(char *s) { fprintf(stderr, - "usage: %s [-x] [-md4 | -md5 | -rmd160 | -sha1] [-n count]\n\t" + "usage: %s [-x] [-md5 | -rmd160 | -sha1] [-n count]\n\t" "[-p passphrase] <sequence#>[/] key\n", s); exit(1); } diff --git a/usr.bin/skeyinit/skeyinit.1 b/usr.bin/skeyinit/skeyinit.1 index 4e976e3314a..ef8af4c0ae4 100644 --- a/usr.bin/skeyinit/skeyinit.1 +++ b/usr.bin/skeyinit/skeyinit.1 @@ -1,8 +1,8 @@ -.\" $OpenBSD: skeyinit.1,v 1.36 2014/02/12 16:58:44 schwarze Exp $ +.\" $OpenBSD: skeyinit.1,v 1.37 2014/03/20 20:39:13 naddy Exp $ .\" $NetBSD: skeyinit.1,v 1.4 1995/07/07 22:24:09 jtc Exp $ .\" @(#)skeyinit.1 1.1 10/28/93 .\" -.Dd $Mdocdate: February 12 2014 $ +.Dd $Mdocdate: March 20 2014 $ .Dt SKEYINIT 1 .Os .Sh NAME @@ -14,7 +14,7 @@ .Op Fl CDErsx .Op Fl a Ar auth-type .Op Fl n Ar count -.Op Fl md4 | md5 | rmd160 | sha1 +.Op Fl md5 | rmd160 | sha1 .Op Ar user .Ek .Sh DESCRIPTION @@ -91,9 +91,9 @@ Enables access to the S/Key database. Only the superuser may use the .Fl E option. -.It Fl md4 | md5 | rmd160 | sha1 +.It Fl md5 | rmd160 | sha1 Selects the hash algorithm: -MD4, MD5, RMD-160 (160-bit Ripe Message Digest), +MD5, RMD-160 (160-bit Ripe Message Digest), or SHA1 (NIST Secure Hash Algorithm Revision 1). .It Fl n Ar count Start the diff --git a/usr.bin/skeyinit/skeyinit.c b/usr.bin/skeyinit/skeyinit.c index af5a91db982..9a20ddb5d91 100644 --- a/usr.bin/skeyinit/skeyinit.c +++ b/usr.bin/skeyinit/skeyinit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skeyinit.c,v 1.52 2013/11/28 18:24:55 deraadt Exp $ */ +/* $OpenBSD: skeyinit.c,v 1.53 2014/03/20 20:39:13 naddy Exp $ */ /* OpenBSD S/Key (skeyinit.c) * @@ -513,12 +513,11 @@ convert_db(void) continue; if ((cp = strtok(NULL, " \t")) == NULL) continue; - if (isalpha((unsigned char)*cp)) { - hashtype = cp; - if ((cp = strtok(NULL, " \t")) == NULL) - continue; - } else - hashtype = "md4"; + if (!isalpha((unsigned char)*cp)) + continue; + hashtype = cp; + if ((cp = strtok(NULL, " \t")) == NULL) + continue; n = atoi(cp); if ((seed = strtok(NULL, " \t")) == NULL) continue; @@ -559,6 +558,6 @@ usage(void) extern char *__progname; (void)fprintf(stderr, "usage: %s [-CDErsx] [-a auth-type] [-n count]" - "\n\t[-md4 | -md5 | -rmd160 | -sha1] [user]\n", __progname); + "\n\t[-md5 | -rmd160 | -sha1] [user]\n", __progname); exit(1); } |