vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen 132f8f
diff -up openssh-6.8p1/compat.c.cisco-dh openssh-6.8p1/compat.c
Jakub Jelen 132f8f
--- openssh-6.8p1/compat.c.cisco-dh	2015-03-17 06:49:20.000000000 +0100
Jakub Jelen 132f8f
+++ openssh-6.8p1/compat.c	2015-03-19 12:57:58.862606969 +0100
Petr Lautrbach 08fe9e
@@ -167,6 +167,7 @@ compat_datafellows(const char *version)
Petr Lautrbach 08fe9e
 					SSH_BUG_SCANNER },
Petr Lautrbach 08fe9e
 		{ "Probe-*",
Petr Lautrbach 08fe9e
 					SSH_BUG_PROBE },
Petr Lautrbach 08fe9e
+		{ "Cisco-*",		SSH_BUG_MAX4096DH },
Petr Lautrbach 08fe9e
 		{ NULL,			0 }
Petr Lautrbach 08fe9e
 	};
Petr Lautrbach 08fe9e
 
Jakub Jelen 132f8f
diff -up openssh-6.8p1/compat.h.cisco-dh openssh-6.8p1/compat.h
Jakub Jelen 132f8f
--- openssh-6.8p1/compat.h.cisco-dh	2015-03-17 06:49:20.000000000 +0100
Jakub Jelen 132f8f
+++ openssh-6.8p1/compat.h	2015-03-19 12:57:58.862606969 +0100
Petr Lautrbach 08fe9e
@@ -60,6 +60,7 @@
Petr Lautrbach 08fe9e
 #define SSH_NEW_OPENSSH		0x04000000
Petr Lautrbach 08fe9e
 #define SSH_BUG_DYNAMIC_RPORT	0x08000000
Petr Lautrbach 08fe9e
 #define SSH_BUG_CURVE25519PAD	0x10000000
Petr Lautrbach 08fe9e
+#define SSH_BUG_MAX4096DH       0x20000000
Petr Lautrbach 08fe9e
 
Petr Lautrbach 08fe9e
 void     enable_compat13(void);
Petr Lautrbach 08fe9e
 void     enable_compat20(void);
Jakub Jelen 132f8f
diff -up openssh-6.8p1/kexgexc.c.cisco-dh openssh-6.8p1/kexgexc.c
Jakub Jelen 132f8f
--- openssh-6.8p1/kexgexc.c.cisco-dh	2015-03-19 12:57:58.862606969 +0100
Jakub Jelen 132f8f
+++ openssh-6.8p1/kexgexc.c	2015-03-19 13:11:52.320519969 +0100
Jakub Jelen 132f8f
@@ -64,8 +64,27 @@ kexgex_client(struct ssh *ssh)
Petr Lautrbach 08fe9e
 
Jakub Jelen 132f8f
 	kex->min = DH_GRP_MIN;
Jakub Jelen 132f8f
 	kex->max = DH_GRP_MAX;
Petr Lautrbach 08fe9e
+
Petr Lautrbach 08fe9e
+	/* Servers with MAX4096DH need a preferred size (nbits) <= 4096.
Petr Lautrbach 08fe9e
+ 	 * We need to also ensure that min < nbits < max */
Petr Lautrbach 08fe9e
+
Petr Lautrbach 08fe9e
+	if (datafellows & SSH_BUG_MAX4096DH) {
Petr Lautrbach 08fe9e
+		/* The largest min for these servers is 4096 */
Jakub Jelen 132f8f
+		kex->min = MIN(kex->min, 4096);
Petr Lautrbach 08fe9e
+	}
Petr Lautrbach 08fe9e
+
Jakub Jelen 132f8f
 	kex->nbits = nbits;
Jakub Jelen 132f8f
-	if (ssh->compat & SSH_OLD_DHGEX) {
Jakub Jelen 132f8f
+	kex->nbits = MIN(nbits, kex->max);
Jakub Jelen 132f8f
+	kex->nbits = MAX(nbits, kex->min);
Petr Lautrbach 08fe9e
+
Jakub Jelen 132f8f
+	if (ssh->compat & SSH_BUG_MAX4096DH) {
Petr Lautrbach 08fe9e
+		/* Cannot have a nbits > 4096 for these servers */
Jakub Jelen 132f8f
+		kex->nbits = MIN(kex->nbits, 4096);
Petr Lautrbach 08fe9e
+		/* nbits has to be powers of two */
Jakub Jelen 132f8f
+		if (kex->nbits == 3072)
Jakub Jelen 132f8f
+			kex->nbits = 4096;
Petr Lautrbach 08fe9e
+	}
Jakub Jelen 132f8f
+	if (ssh->compat & SSH_OLD_DHGEX) {	/* Old GEX request */
Petr Lautrbach 08fe9e
 		/* Old GEX request */
Jakub Jelen 132f8f
 		if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_REQUEST_OLD))
Jakub Jelen 132f8f
 		    != 0 ||