From: deraadt Date: Thu, 27 Mar 1997 23:02:58 +0000 (+0000) Subject: pretty and one 64bit thingy X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=738f67db54d4d5460c287b191e89b39ed3ec589b;p=openbsd pretty and one 64bit thingy --- diff --git a/usr.bin/passwd/pwd_gensalt.c b/usr.bin/passwd/pwd_gensalt.c index cf6ad0dc3e3..bd3f1985e16 100644 --- a/usr.bin/passwd/pwd_gensalt.c +++ b/usr.bin/passwd/pwd_gensalt.c @@ -37,7 +37,7 @@ #include #include -void to64( char *, long, int n); +void to64 __P((char *, int32_t, int n)); int pwd_gensalt(salt, max, pwd, type) @@ -64,19 +64,19 @@ pwd_gensalt(salt, max, pwd, type) next = option; now = strsep(&next, ","); if (!strcmp(now, "old")) { - if( max < 3 ) + if (max < 3) return 0; to64(&salt[0], arc4random(), 2); salt[2] = '\0'; } else if (!strcmp(now, "newsalt")) { - if( max < 10 ) + if (max < 10) return 0; salt[0] = _PASSWORD_EFMT1; - to64(&salt[1], (long) (29 * 25), 4); + to64(&salt[1], (int32_t) (29 * 25), 4); to64(&salt[5], arc4random(), 4); salt[9] = '\0'; } else if (!strcmp(now, "md5")) { - if( max < 13 ) /* $1$8salt$\0 */ + if (max < 13) /* $1$8salt$\0 */ return 0; strcpy(salt, "$1$"); to64(&salt[3], arc4random(), 4); @@ -95,16 +95,17 @@ pwd_gensalt(salt, max, pwd, type) return 1; } -static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -void to64(s, v, n) - register char *s; - register long v; - register int n; +void +to64(s, v, n) + register char *s; + register int32_t v; + register int n; { - while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; - } + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6; + } }