version 1.51, 2013/05/17 00:13:13 |
version 1.52, 2013/07/12 00:19:58 |
|
|
}; |
}; |
|
|
static int |
static int |
extract_salt(const char *s, u_int l, char *salt, size_t salt_len) |
extract_salt(const char *s, u_int l, u_char *salt, size_t salt_len) |
{ |
{ |
char *p, *b64salt; |
char *p, *b64salt; |
u_int b64len; |
u_int b64len; |
|
|
{ |
{ |
const EVP_MD *md = EVP_sha1(); |
const EVP_MD *md = EVP_sha1(); |
HMAC_CTX mac_ctx; |
HMAC_CTX mac_ctx; |
char salt[256], result[256], uu_salt[512], uu_result[512]; |
u_char salt[256], result[256]; |
|
char uu_salt[512], uu_result[512]; |
static char encoded[1024]; |
static char encoded[1024]; |
u_int i, len; |
u_int i, len; |
|
|
|
|
} |
} |
|
|
HMAC_Init(&mac_ctx, salt, len, md); |
HMAC_Init(&mac_ctx, salt, len, md); |
HMAC_Update(&mac_ctx, host, strlen(host)); |
HMAC_Update(&mac_ctx, (u_char *)host, strlen(host)); |
HMAC_Final(&mac_ctx, result, NULL); |
HMAC_Final(&mac_ctx, result, NULL); |
HMAC_cleanup(&mac_ctx); |
HMAC_cleanup(&mac_ctx); |
|
|
|
|
*/ |
*/ |
|
|
int |
int |
hostfile_read_key(char **cpp, u_int *bitsp, Key *ret) |
hostfile_read_key(char **cpp, int *bitsp, Key *ret) |
{ |
{ |
char *cp; |
char *cp; |
|
|
|
|
|
|
/* Return results. */ |
/* Return results. */ |
*cpp = cp; |
*cpp = cp; |
if (bitsp != NULL) |
if (bitsp != NULL) { |
*bitsp = key_size(ret); |
if ((*bitsp = key_size(ret)) <= 0) |
|
return 0; |
|
} |
return 1; |
return 1; |
} |
} |
|
|