summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-02-24 12:03:03 +1100
committerDamien Miller <djm@mindrot.org>2003-02-24 12:03:03 +1100
commit8e7fb335235bd6a7f8387a40bf71eaf9798f6f7e (patch)
tree46ba3e898aebfc99e531d793bccac6c0eba5e87d /kex.c
parent1587fb8a174f57a064d603bbd595c3369aa697aa (diff)
- markus@cvs.openbsd.org 2003/02/16 17:09:57
[kex.c kexdh.c kexgex.c kex.h sshconnect2.c sshd.c ssh-keyscan.c] split kex into client and server code, no need to link server code into the client; ok provos@
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/kex.c b/kex.c
index 0a861fb97..2c1cacfec 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kex.c,v 1.53 2003/02/02 10:56:08 markus Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.54 2003/02/16 17:09:57 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29 29
@@ -44,11 +44,6 @@ RCSID("$OpenBSD: kex.c,v 1.53 2003/02/02 10:56:08 markus Exp $");
44 44
45#define KEX_COOKIE_LEN 16 45#define KEX_COOKIE_LEN 16
46 46
47/* Use privilege separation for sshd */
48int use_privsep;
49struct monitor *pmonitor;
50
51
52/* prototype */ 47/* prototype */
53static void kex_kexinit_finish(Kex *); 48static void kex_kexinit_finish(Kex *);
54static void kex_choose_conf(Kex *); 49static void kex_choose_conf(Kex *);
@@ -237,14 +232,10 @@ kex_kexinit_finish(Kex *kex)
237 232
238 kex_choose_conf(kex); 233 kex_choose_conf(kex);
239 234
240 switch (kex->kex_type) { 235 if (kex->kex_type >= 0 && kex->kex_type < KEX_MAX &&
241 case DH_GRP1_SHA1: 236 kex->kex[kex->kex_type] != NULL) {
242 kexdh(kex); 237 (kex->kex[kex->kex_type])(kex);
243 break; 238 } else {
244 case DH_GEX_SHA1:
245 kexgex(kex);
246 break;
247 default:
248 fatal("Unsupported key exchange %d", kex->kex_type); 239 fatal("Unsupported key exchange %d", kex->kex_type);
249 } 240 }
250} 241}
@@ -301,9 +292,9 @@ choose_kex(Kex *k, char *client, char *server)
301 if (k->name == NULL) 292 if (k->name == NULL)
302 fatal("no kex alg"); 293 fatal("no kex alg");
303 if (strcmp(k->name, KEX_DH1) == 0) { 294 if (strcmp(k->name, KEX_DH1) == 0) {
304 k->kex_type = DH_GRP1_SHA1; 295 k->kex_type = KEX_DH_GRP1_SHA1;
305 } else if (strcmp(k->name, KEX_DHGEX) == 0) { 296 } else if (strcmp(k->name, KEX_DHGEX) == 0) {
306 k->kex_type = DH_GEX_SHA1; 297 k->kex_type = KEX_DH_GEX_SHA1;
307 } else 298 } else
308 fatal("bad kex alg %s", k->name); 299 fatal("bad kex alg %s", k->name);
309} 300}