version 1.5, 1999/12/06 19:04:57 |
version 1.6, 2000/04/14 10:30:29 |
|
|
#include "packet.h" |
#include "packet.h" |
#include <sha1.h> |
#include <sha1.h> |
|
|
/* |
/* |
* try skey authentication, |
* try skey authentication, |
* return 1 on success, 0 on failure, -1 if skey is not available |
* return 1 on success, 0 on failure, -1 if skey is not available |
*/ |
*/ |
|
|
int |
int |
auth_skey_password(struct passwd * pw, const char *password) |
auth_skey_password(struct passwd * pw, const char *password) |
{ |
{ |
if (strncasecmp(password, "s/key", 5) == 0) { |
if (strncasecmp(password, "s/key", 5) == 0) { |
|
|
*/ |
*/ |
static u_int32_t |
static u_int32_t |
hash_collapse(s) |
hash_collapse(s) |
u_char *s; |
u_char *s; |
{ |
{ |
int len, target; |
int len, target; |
u_int32_t i; |
u_int32_t i; |
|
|
if ((strlen(s) % sizeof(u_int32_t)) == 0) |
if ((strlen(s) % sizeof(u_int32_t)) == 0) |
target = strlen(s); /* Multiple of 4 */ |
target = strlen(s); /* Multiple of 4 */ |
else |
else |
target = strlen(s) - (strlen(s) % sizeof(u_int32_t)); |
target = strlen(s) - (strlen(s) % sizeof(u_int32_t)); |
|
|
for (i = 0, len = 0; len < target; len += 4) |
for (i = 0, len = 0; len < target; len += 4) |
i ^= ROUND(s + len); |
i ^= ROUND(s + len); |
|
|
return i; |
return i; |
} |
} |