|
|
770374 |
diff -U0 openssh-6.4p1/ChangeLog.3des-dh-size openssh-6.4p1/ChangeLog
|
|
|
770374 |
--- openssh-6.4p1/ChangeLog.3des-dh-size 2014-01-28 14:15:25.178358616 +0100
|
|
|
770374 |
+++ openssh-6.4p1/ChangeLog 2014-01-28 14:18:24.678444650 +0100
|
|
|
770374 |
@@ -0,0 +1,15 @@
|
|
|
770374 |
+20140126
|
|
|
770374 |
+ - OpenBSD CVS Sync
|
|
|
770374 |
+ - dtucker@cvs.openbsd.org 2014/01/25 10:12:50
|
|
|
770374 |
+ [cipher.c cipher.h kex.c kex.h kexgexc.c]
|
|
|
770374 |
+ Add a special case for the DH group size for 3des-cbc, which has an
|
|
|
770374 |
+ effective strength much lower than the key size. This causes problems
|
|
|
770374 |
+ with some cryptlib implementations, which don't support group sizes larger
|
|
|
770374 |
+ than 4k but also don't use the largest group size it does support as
|
|
|
770374 |
+ specified in the RFC. Based on a patch from Petr Lautrbach at Redhat,
|
|
|
770374 |
+ reduced by me with input from Markus. ok djm@ markus@
|
|
|
770374 |
+ - markus@cvs.openbsd.org 2014/01/25 20:35:37
|
|
|
770374 |
+ [kex.c]
|
|
|
770374 |
+ dh_need needs to be set to max(seclen, blocksize, ivlen, mac_len)
|
|
|
770374 |
+ ok dtucker@, noted by mancha
|
|
|
770374 |
+
|
|
|
770374 |
diff -up openssh-6.4p1/cipher.c.3des-dh-size openssh-6.4p1/cipher.c
|
|
|
770374 |
--- openssh-6.4p1/cipher.c.3des-dh-size 2014-01-28 14:15:25.101359008 +0100
|
|
|
770374 |
+++ openssh-6.4p1/cipher.c 2014-01-28 14:17:48.119630792 +0100
|
|
|
770374 |
@@ -1,4 +1,4 @@
|
|
|
770374 |
-/* $OpenBSD: cipher.c,v 1.89 2013/05/17 00:13:13 djm Exp $ */
|
|
|
770374 |
+/* $OpenBSD: cipher.c,v 1.94 2014/01/25 10:12:50 dtucker Exp $ */
|
|
|
770374 |
/*
|
|
|
770374 |
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
|
|
770374 |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
|
|
770374 |
@@ -144,6 +144,14 @@ cipher_keylen(const Cipher *c)
|
|
|
770374 |
}
|
|
|
770374 |
|
|
|
770374 |
u_int
|
|
|
770374 |
+cipher_seclen(const Cipher *c)
|
|
|
770374 |
+{
|
|
|
770374 |
+ if (strcmp("3des-cbc", c->name) == 0)
|
|
|
770374 |
+ return 14;
|
|
|
770374 |
+ return cipher_keylen(c);
|
|
|
770374 |
+}
|
|
|
770374 |
+
|
|
|
770374 |
+u_int
|
|
|
770374 |
cipher_authlen(const Cipher *c)
|
|
|
770374 |
{
|
|
|
770374 |
return (c->auth_len);
|
|
|
770374 |
diff -up openssh-6.4p1/cipher.h.3des-dh-size openssh-6.4p1/cipher.h
|
|
|
770374 |
--- openssh-6.4p1/cipher.h.3des-dh-size 2014-01-28 14:15:25.178358616 +0100
|
|
|
770374 |
+++ openssh-6.4p1/cipher.h 2014-01-28 14:17:17.858784879 +0100
|
|
|
770374 |
@@ -1,4 +1,4 @@
|
|
|
770374 |
-/* $OpenBSD: cipher.h,v 1.40 2013/04/19 01:06:50 djm Exp $ */
|
|
|
770374 |
+/* $OpenBSD: cipher.h,v 1.44 2014/01/25 10:12:50 dtucker Exp $ */
|
|
|
770374 |
|
|
|
770374 |
/*
|
|
|
770374 |
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
|
|
770374 |
@@ -95,6 +95,7 @@ void cipher_cleanup(CipherContext *);
|
|
|
770374 |
int cipher_set_key_string(CipherContext *, const Cipher *, const char *, int);
|
|
|
770374 |
u_int cipher_blocksize(const Cipher *);
|
|
|
770374 |
u_int cipher_keylen(const Cipher *);
|
|
|
770374 |
+u_int cipher_seclen(const Cipher *);
|
|
|
770374 |
u_int cipher_authlen(const Cipher *);
|
|
|
770374 |
u_int cipher_ivlen(const Cipher *);
|
|
|
770374 |
u_int cipher_is_cbc(const Cipher *);
|
|
|
770374 |
diff -up openssh-6.4p1/kex.c.3des-dh-size openssh-6.4p1/kex.c
|
|
|
770374 |
--- openssh-6.4p1/kex.c.3des-dh-size 2014-01-28 14:15:25.165358682 +0100
|
|
|
770374 |
+++ openssh-6.4p1/kex.c 2014-01-28 14:19:22.038152586 +0100
|
|
|
770374 |
@@ -1,4 +1,4 @@
|
|
|
770374 |
-/* $OpenBSD: kex.c,v 1.91 2013/05/17 00:13:13 djm Exp $ */
|
|
|
770374 |
+/* $OpenBSD: kex.c,v 1.97 2014/01/25 20:35:37 markus Exp $ */
|
|
|
770374 |
/*
|
|
|
770374 |
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
|
|
770374 |
*
|
|
|
770374 |
@@ -494,7 +494,7 @@ kex_choose_conf(Kex *kex)
|
|
|
770374 |
char **my, **peer;
|
|
|
770374 |
char **cprop, **sprop;
|
|
|
770374 |
int nenc, nmac, ncomp;
|
|
|
770374 |
- u_int mode, ctos, need, authlen;
|
|
|
770374 |
+ u_int mode, ctos, need, dh_need, authlen;
|
|
|
770374 |
int first_kex_follows, type;
|
|
|
770374 |
|
|
|
770374 |
my = kex_buf2prop(&kex->my, NULL);
|
|
|
770374 |
@@ -545,20 +545,21 @@ kex_choose_conf(Kex *kex)
|
|
|
770374 |
choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], sprop[PROPOSAL_KEX_ALGS]);
|
|
|
770374 |
choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS],
|
|
|
770374 |
sprop[PROPOSAL_SERVER_HOST_KEY_ALGS]);
|
|
|
770374 |
- need = 0;
|
|
|
770374 |
+ need = dh_need = 0;
|
|
|
770374 |
for (mode = 0; mode < MODE_MAX; mode++) {
|
|
|
770374 |
newkeys = kex->newkeys[mode];
|
|
|
770374 |
- if (need < newkeys->enc.key_len)
|
|
|
770374 |
- need = newkeys->enc.key_len;
|
|
|
770374 |
- if (need < newkeys->enc.block_size)
|
|
|
770374 |
- need = newkeys->enc.block_size;
|
|
|
770374 |
- if (need < newkeys->enc.iv_len)
|
|
|
770374 |
- need = newkeys->enc.iv_len;
|
|
|
770374 |
- if (need < newkeys->mac.key_len)
|
|
|
770374 |
- need = newkeys->mac.key_len;
|
|
|
770374 |
+ need = MAX(need, newkeys->enc.key_len);
|
|
|
770374 |
+ need = MAX(need, newkeys->enc.block_size);
|
|
|
770374 |
+ need = MAX(need, newkeys->enc.iv_len);
|
|
|
770374 |
+ need = MAX(need, newkeys->mac.key_len);
|
|
|
770374 |
+ dh_need = MAX(dh_need, cipher_seclen(newkeys->enc.cipher));
|
|
|
770374 |
+ dh_need = MAX(dh_need, newkeys->enc.block_size);
|
|
|
770374 |
+ dh_need = MAX(dh_need, newkeys->enc.iv_len);
|
|
|
770374 |
+ dh_need = MAX(dh_need, newkeys->mac.key_len);
|
|
|
770374 |
}
|
|
|
770374 |
/* XXX need runden? */
|
|
|
770374 |
kex->we_need = need;
|
|
|
770374 |
+ kex->dh_need = dh_need;
|
|
|
770374 |
|
|
|
770374 |
/* ignore the next message if the proposals do not match */
|
|
|
770374 |
if (first_kex_follows && !proposals_match(my, peer) &&
|
|
|
770374 |
diff -up openssh-6.4p1/kexgexc.c.3des-dh-size openssh-6.4p1/kexgexc.c
|
|
|
770374 |
--- openssh-6.4p1/kexgexc.c.3des-dh-size 2014-01-28 14:15:25.165358682 +0100
|
|
|
770374 |
+++ openssh-6.4p1/kexgexc.c 2014-01-28 14:19:09.718215323 +0100
|
|
|
770374 |
@@ -1,4 +1,4 @@
|
|
|
770374 |
-/* $OpenBSD: kexgexc.c,v 1.13 2013/05/17 00:13:13 djm Exp $ */
|
|
|
770374 |
+/* $OpenBSD: kexgexc.c,v 1.16 2014/01/25 10:12:50 dtucker Exp $ */
|
|
|
770374 |
/*
|
|
|
770374 |
* Copyright (c) 2000 Niels Provos. All rights reserved.
|
|
|
770374 |
* Copyright (c) 2001 Markus Friedl. All rights reserved.
|
|
|
770374 |
@@ -60,7 +60,7 @@ kexgex_client(Kex *kex)
|
|
|
770374 |
int min, max, nbits;
|
|
|
770374 |
DH *dh;
|
|
|
770374 |
|
|
|
770374 |
- nbits = dh_estimate(kex->we_need * 8);
|
|
|
770374 |
+ nbits = dh_estimate(kex->dh_need * 8);
|
|
|
770374 |
|
|
|
770374 |
if (datafellows & SSH_OLD_DHGEX) {
|
|
|
770374 |
/* Old GEX request */
|
|
|
770374 |
diff -up openssh-6.4p1/kex.h.3des-dh-size openssh-6.4p1/kex.h
|
|
|
770374 |
--- openssh-6.4p1/kex.h.3des-dh-size 2014-01-28 14:15:25.142358799 +0100
|
|
|
770374 |
+++ openssh-6.4p1/kex.h 2014-01-28 14:18:49.431318614 +0100
|
|
|
770374 |
@@ -1,4 +1,4 @@
|
|
|
770374 |
-/* $OpenBSD: kex.h,v 1.56 2013/07/19 07:37:48 markus Exp $ */
|
|
|
770374 |
+/* $OpenBSD: kex.h,v 1.61 2014/01/25 10:12:50 dtucker Exp $ */
|
|
|
770374 |
|
|
|
770374 |
/*
|
|
|
770374 |
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
|
|
770374 |
@@ -125,6 +125,7 @@ struct Kex {
|
|
|
770374 |
u_int session_id_len;
|
|
|
770374 |
Newkeys *newkeys[MODE_MAX];
|
|
|
770374 |
u_int we_need;
|
|
|
770374 |
+ u_int dh_need;
|
|
|
770374 |
int server;
|
|
|
770374 |
char *name;
|
|
|
770374 |
int hostkey_type;
|