diff options
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.34 2001/04/30 15:50:46 markus Exp $"); | 26 | RCSID("$OpenBSD: kex.c,v 1.35 2001/06/23 15:12:18 itojun Exp $"); |
27 | 27 | ||
28 | #include <openssl/crypto.h> | 28 | #include <openssl/crypto.h> |
29 | 29 | ||
@@ -43,11 +43,12 @@ RCSID("$OpenBSD: kex.c,v 1.34 2001/04/30 15:50:46 markus Exp $"); | |||
43 | 43 | ||
44 | #define KEX_COOKIE_LEN 16 | 44 | #define KEX_COOKIE_LEN 16 |
45 | 45 | ||
46 | void kex_kexinit_finish(Kex *kex); | 46 | /* prototype */ |
47 | void kex_choose_conf(Kex *k); | 47 | static void kex_kexinit_finish(Kex *); |
48 | static void kex_choose_conf(Kex *); | ||
48 | 49 | ||
49 | /* put algorithm proposal into buffer */ | 50 | /* put algorithm proposal into buffer */ |
50 | void | 51 | static void |
51 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | 52 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) |
52 | { | 53 | { |
53 | u_int32_t rand = 0; | 54 | u_int32_t rand = 0; |
@@ -67,7 +68,7 @@ kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | |||
67 | } | 68 | } |
68 | 69 | ||
69 | /* parse buffer and return algorithm proposal */ | 70 | /* parse buffer and return algorithm proposal */ |
70 | char ** | 71 | static char ** |
71 | kex_buf2prop(Buffer *raw) | 72 | kex_buf2prop(Buffer *raw) |
72 | { | 73 | { |
73 | Buffer b; | 74 | Buffer b; |
@@ -95,7 +96,7 @@ kex_buf2prop(Buffer *raw) | |||
95 | return proposal; | 96 | return proposal; |
96 | } | 97 | } |
97 | 98 | ||
98 | void | 99 | static void |
99 | kex_prop_free(char **proposal) | 100 | kex_prop_free(char **proposal) |
100 | { | 101 | { |
101 | int i; | 102 | int i; |
@@ -105,13 +106,13 @@ kex_prop_free(char **proposal) | |||
105 | xfree(proposal); | 106 | xfree(proposal); |
106 | } | 107 | } |
107 | 108 | ||
108 | void | 109 | static void |
109 | kex_protocol_error(int type, int plen, void *ctxt) | 110 | kex_protocol_error(int type, int plen, void *ctxt) |
110 | { | 111 | { |
111 | error("Hm, kex protocol error: type %d plen %d", type, plen); | 112 | error("Hm, kex protocol error: type %d plen %d", type, plen); |
112 | } | 113 | } |
113 | 114 | ||
114 | void | 115 | static void |
115 | kex_clear_dispatch(void) | 116 | kex_clear_dispatch(void) |
116 | { | 117 | { |
117 | int i; | 118 | int i; |
@@ -210,7 +211,7 @@ kex_setup(char *proposal[PROPOSAL_MAX]) | |||
210 | return kex; | 211 | return kex; |
211 | } | 212 | } |
212 | 213 | ||
213 | void | 214 | static void |
214 | kex_kexinit_finish(Kex *kex) | 215 | kex_kexinit_finish(Kex *kex) |
215 | { | 216 | { |
216 | if (!(kex->flags & KEX_INIT_SENT)) | 217 | if (!(kex->flags & KEX_INIT_SENT)) |
@@ -230,7 +231,7 @@ kex_kexinit_finish(Kex *kex) | |||
230 | } | 231 | } |
231 | } | 232 | } |
232 | 233 | ||
233 | void | 234 | static void |
234 | choose_enc(Enc *enc, char *client, char *server) | 235 | choose_enc(Enc *enc, char *client, char *server) |
235 | { | 236 | { |
236 | char *name = match_list(client, server, NULL); | 237 | char *name = match_list(client, server, NULL); |
@@ -244,7 +245,7 @@ choose_enc(Enc *enc, char *client, char *server) | |||
244 | enc->iv = NULL; | 245 | enc->iv = NULL; |
245 | enc->key = NULL; | 246 | enc->key = NULL; |
246 | } | 247 | } |
247 | void | 248 | static void |
248 | choose_mac(Mac *mac, char *client, char *server) | 249 | choose_mac(Mac *mac, char *client, char *server) |
249 | { | 250 | { |
250 | char *name = match_list(client, server, NULL); | 251 | char *name = match_list(client, server, NULL); |
@@ -259,7 +260,7 @@ choose_mac(Mac *mac, char *client, char *server) | |||
259 | mac->key = NULL; | 260 | mac->key = NULL; |
260 | mac->enabled = 0; | 261 | mac->enabled = 0; |
261 | } | 262 | } |
262 | void | 263 | static void |
263 | choose_comp(Comp *comp, char *client, char *server) | 264 | choose_comp(Comp *comp, char *client, char *server) |
264 | { | 265 | { |
265 | char *name = match_list(client, server, NULL); | 266 | char *name = match_list(client, server, NULL); |
@@ -274,7 +275,7 @@ choose_comp(Comp *comp, char *client, char *server) | |||
274 | } | 275 | } |
275 | comp->name = name; | 276 | comp->name = name; |
276 | } | 277 | } |
277 | void | 278 | static void |
278 | choose_kex(Kex *k, char *client, char *server) | 279 | choose_kex(Kex *k, char *client, char *server) |
279 | { | 280 | { |
280 | k->name = match_list(client, server, NULL); | 281 | k->name = match_list(client, server, NULL); |
@@ -287,7 +288,7 @@ choose_kex(Kex *k, char *client, char *server) | |||
287 | } else | 288 | } else |
288 | fatal("bad kex alg %s", k->name); | 289 | fatal("bad kex alg %s", k->name); |
289 | } | 290 | } |
290 | void | 291 | static void |
291 | choose_hostkeyalg(Kex *k, char *client, char *server) | 292 | choose_hostkeyalg(Kex *k, char *client, char *server) |
292 | { | 293 | { |
293 | char *hostkeyalg = match_list(client, server, NULL); | 294 | char *hostkeyalg = match_list(client, server, NULL); |
@@ -299,7 +300,7 @@ choose_hostkeyalg(Kex *k, char *client, char *server) | |||
299 | xfree(hostkeyalg); | 300 | xfree(hostkeyalg); |
300 | } | 301 | } |
301 | 302 | ||
302 | void | 303 | static void |
303 | kex_choose_conf(Kex *kex) | 304 | kex_choose_conf(Kex *kex) |
304 | { | 305 | { |
305 | Newkeys *newkeys; | 306 | Newkeys *newkeys; |
@@ -359,7 +360,7 @@ kex_choose_conf(Kex *kex) | |||
359 | kex_prop_free(peer); | 360 | kex_prop_free(peer); |
360 | } | 361 | } |
361 | 362 | ||
362 | u_char * | 363 | static u_char * |
363 | derive_key(Kex *kex, int id, int need, u_char *hash, BIGNUM *shared_secret) | 364 | derive_key(Kex *kex, int id, int need, u_char *hash, BIGNUM *shared_secret) |
364 | { | 365 | { |
365 | Buffer b; | 366 | Buffer b; |