diff options
author | Damien Miller <djm@mindrot.org> | 2013-07-18 16:12:44 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-07-18 16:12:44 +1000 |
commit | ce98654674648fb7d58f73edf6aa398656a2dba4 (patch) | |
tree | 0eaf824f5ec795de2204e800d6e1d74d2c905ac8 /hostfile.c | |
parent | 0d02c3e10e1ed16d6396748375a133d348127a2a (diff) |
- djm@cvs.openbsd.org 2013/07/12 00:19:59
[auth-options.c auth-rsa.c bufaux.c buffer.h channels.c hostfile.c]
[hostfile.h mux.c packet.c packet.h roaming_common.c serverloop.c]
fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@
Diffstat (limited to 'hostfile.c')
-rw-r--r-- | hostfile.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/hostfile.c b/hostfile.c index 69d0d289e..2ff4c48b4 100644 --- a/hostfile.c +++ b/hostfile.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hostfile.c,v 1.51 2013/05/17 00:13:13 djm Exp $ */ | 1 | /* $OpenBSD: hostfile.c,v 1.52 2013/07/12 00:19:58 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -64,7 +64,7 @@ struct hostkeys { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | static int | 66 | static int |
67 | extract_salt(const char *s, u_int l, char *salt, size_t salt_len) | 67 | extract_salt(const char *s, u_int l, u_char *salt, size_t salt_len) |
68 | { | 68 | { |
69 | char *p, *b64salt; | 69 | char *p, *b64salt; |
70 | u_int b64len; | 70 | u_int b64len; |
@@ -115,7 +115,8 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len) | |||
115 | { | 115 | { |
116 | const EVP_MD *md = EVP_sha1(); | 116 | const EVP_MD *md = EVP_sha1(); |
117 | HMAC_CTX mac_ctx; | 117 | HMAC_CTX mac_ctx; |
118 | char salt[256], result[256], uu_salt[512], uu_result[512]; | 118 | u_char salt[256], result[256]; |
119 | char uu_salt[512], uu_result[512]; | ||
119 | static char encoded[1024]; | 120 | static char encoded[1024]; |
120 | u_int i, len; | 121 | u_int i, len; |
121 | 122 | ||
@@ -133,7 +134,7 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len) | |||
133 | } | 134 | } |
134 | 135 | ||
135 | HMAC_Init(&mac_ctx, salt, len, md); | 136 | HMAC_Init(&mac_ctx, salt, len, md); |
136 | HMAC_Update(&mac_ctx, host, strlen(host)); | 137 | HMAC_Update(&mac_ctx, (u_char *)host, strlen(host)); |
137 | HMAC_Final(&mac_ctx, result, NULL); | 138 | HMAC_Final(&mac_ctx, result, NULL); |
138 | HMAC_cleanup(&mac_ctx); | 139 | HMAC_cleanup(&mac_ctx); |
139 | 140 | ||
@@ -153,7 +154,7 @@ host_hash(const char *host, const char *name_from_hostfile, u_int src_len) | |||
153 | */ | 154 | */ |
154 | 155 | ||
155 | int | 156 | int |
156 | hostfile_read_key(char **cpp, u_int *bitsp, Key *ret) | 157 | hostfile_read_key(char **cpp, int *bitsp, Key *ret) |
157 | { | 158 | { |
158 | char *cp; | 159 | char *cp; |
159 | 160 | ||
@@ -170,8 +171,10 @@ hostfile_read_key(char **cpp, u_int *bitsp, Key *ret) | |||
170 | 171 | ||
171 | /* Return results. */ | 172 | /* Return results. */ |
172 | *cpp = cp; | 173 | *cpp = cp; |
173 | if (bitsp != NULL) | 174 | if (bitsp != NULL) { |
174 | *bitsp = key_size(ret); | 175 | if ((*bitsp = key_size(ret)) <= 0) |
176 | return 0; | ||
177 | } | ||
175 | return 1; | 178 | return 1; |
176 | } | 179 | } |
177 | 180 | ||