summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--dh.c28
-rw-r--r--dh.h3
-rw-r--r--kex.c4
-rw-r--r--kex.h4
-rw-r--r--kexdhc.c13
-rw-r--r--kexdhs.c13
-rw-r--r--monitor.c3
-rw-r--r--myproposal.h6
-rw-r--r--ssh-keyscan.c3
-rw-r--r--sshconnect2.c3
-rw-r--r--sshd.c3
12 files changed, 72 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fb1d4664..1d2563ba8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,11 @@
15 - pedro@cvs.openbsd.org 2004/06/03 12:22:20 15 - pedro@cvs.openbsd.org 2004/06/03 12:22:20
16 [sftp-client.c sftp.c] 16 [sftp-client.c sftp.c]
17 initialize pointers, ok markus@ 17 initialize pointers, ok markus@
18 - djm@cvs.openbsd.org 2004/06/13 12:53:24
19 [dh.c dh.h kex.c kex.h kexdhc.c kexdhs.c monitor.c myproposal.h]
20 [ssh-keyscan.c sshconnect2.c sshd.c]
21 implement diffie-hellman-group14-sha1 kex method (trivial extension to
22 existing diffie-hellman-group1-sha1); ok markus@
18 23
1920040603 2420040603
20 - (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions. 25 - (dtucker) [auth-pam.c] Don't use pam_* namespace for sshd's PAM functions.
@@ -1199,4 +1204,4 @@
1199 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1204 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1200 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1205 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1201 1206
1202$Id: ChangeLog,v 1.3379 2004/06/15 00:28:56 djm Exp $ 1207$Id: ChangeLog,v 1.3380 2004/06/15 00:30:09 djm Exp $
diff --git a/dh.c b/dh.c
index afd1e05d0..176fb7469 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: dh.c,v 1.29 2004/02/27 22:49:27 dtucker Exp $"); 26RCSID("$OpenBSD: dh.c,v 1.30 2004/06/13 12:53:24 djm Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29 29
@@ -115,8 +115,9 @@ choose_dh(int min, int wantbits, int max)
115 115
116 if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL && 116 if ((f = fopen(_PATH_DH_MODULI, "r")) == NULL &&
117 (f = fopen(_PATH_DH_PRIMES, "r")) == NULL) { 117 (f = fopen(_PATH_DH_PRIMES, "r")) == NULL) {
118 logit("WARNING: %s does not exist, using old modulus", _PATH_DH_MODULI); 118 logit("WARNING: %s does not exist, using fixed modulus",
119 return (dh_new_group1()); 119 _PATH_DH_MODULI);
120 return (dh_new_group14());
120 } 121 }
121 122
122 linenum = 0; 123 linenum = 0;
@@ -169,7 +170,7 @@ choose_dh(int min, int wantbits, int max)
169 return (dh_new_group(dhg.g, dhg.p)); 170 return (dh_new_group(dhg.g, dhg.p));
170} 171}
171 172
172/* diffie-hellman-group1-sha1 */ 173/* diffie-hellman-groupN-sha1 */
173 174
174int 175int
175dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) 176dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
@@ -272,6 +273,25 @@ dh_new_group1(void)
272 return (dh_new_group_asc(gen, group1)); 273 return (dh_new_group_asc(gen, group1));
273} 274}
274 275
276DH *
277dh_new_group14(void)
278{
279 static char *gen = "2", *group14 =
280 "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1"
281 "29024E08" "8A67CC74" "020BBEA6" "3B139B22" "514A0879" "8E3404DD"
282 "EF9519B3" "CD3A431B" "302B0A6D" "F25F1437" "4FE1356D" "6D51C245"
283 "E485B576" "625E7EC6" "F44C42E9" "A637ED6B" "0BFF5CB6" "F406B7ED"
284 "EE386BFB" "5A899FA5" "AE9F2411" "7C4B1FE6" "49286651" "ECE45B3D"
285 "C2007CB8" "A163BF05" "98DA4836" "1C55D39A" "69163FA8" "FD24CF5F"
286 "83655D23" "DCA3AD96" "1C62F356" "208552BB" "9ED52907" "7096966D"
287 "670C354E" "4ABC9804" "F1746C08" "CA18217C" "32905E46" "2E36CE3B"
288 "E39E772C" "180E8603" "9B2783A2" "EC07A28F" "B5C55DF0" "6F4C52C9"
289 "DE2BCBF6" "95581718" "3995497C" "EA956AE5" "15D22618" "98FA0510"
290 "15728E5A" "8AACAA68" "FFFFFFFF" "FFFFFFFF";
291
292 return (dh_new_group_asc(gen, group14));
293}
294
275/* 295/*
276 * Estimates the group order for a Diffie-Hellman group that has an 296 * Estimates the group order for a Diffie-Hellman group that has an
277 * attack complexity approximately the same as O(2**bits). Estimate 297 * attack complexity approximately the same as O(2**bits). Estimate
diff --git a/dh.h b/dh.h
index a0c97b2ff..723dd08e4 100644
--- a/dh.h
+++ b/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.7 2001/06/26 17:27:23 markus Exp $ */ 1/* $OpenBSD: dh.h,v 1.8 2004/06/13 12:53:24 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Niels Provos. All rights reserved. 4 * Copyright (c) 2000 Niels Provos. All rights reserved.
@@ -36,6 +36,7 @@ DH *choose_dh(int, int, int);
36DH *dh_new_group_asc(const char *, const char *); 36DH *dh_new_group_asc(const char *, const char *);
37DH *dh_new_group(BIGNUM *, BIGNUM *); 37DH *dh_new_group(BIGNUM *, BIGNUM *);
38DH *dh_new_group1(void); 38DH *dh_new_group1(void);
39DH *dh_new_group14(void);
39 40
40void dh_gen_key(DH *, int); 41void dh_gen_key(DH *, int);
41int dh_pub_is_valid(DH *, BIGNUM *); 42int dh_pub_is_valid(DH *, BIGNUM *);
diff --git a/kex.c b/kex.c
index fa5de7ed8..cda8bf9b7 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.58 2004/05/09 01:26:48 djm Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.59 2004/06/13 12:53:24 djm Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29 29
@@ -293,6 +293,8 @@ choose_kex(Kex *k, char *client, char *server)
293 fatal("no kex alg"); 293 fatal("no kex alg");
294 if (strcmp(k->name, KEX_DH1) == 0) { 294 if (strcmp(k->name, KEX_DH1) == 0) {
295 k->kex_type = KEX_DH_GRP1_SHA1; 295 k->kex_type = KEX_DH_GRP1_SHA1;
296 } else if (strcmp(k->name, KEX_DH14) == 0) {
297 k->kex_type = KEX_DH_GRP14_SHA1;
296 } else if (strcmp(k->name, KEX_DHGEX) == 0) { 298 } else if (strcmp(k->name, KEX_DHGEX) == 0) {
297 k->kex_type = KEX_DH_GEX_SHA1; 299 k->kex_type = KEX_DH_GEX_SHA1;
298 } else 300 } else
diff --git a/kex.h b/kex.h
index 437735047..d9e9d6522 100644
--- a/kex.h
+++ b/kex.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.h,v 1.34 2004/05/21 08:43:03 markus Exp $ */ 1/* $OpenBSD: kex.h,v 1.35 2004/06/13 12:53:24 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -32,6 +32,7 @@
32#include "key.h" 32#include "key.h"
33 33
34#define KEX_DH1 "diffie-hellman-group1-sha1" 34#define KEX_DH1 "diffie-hellman-group1-sha1"
35#define KEX_DH14 "diffie-hellman-group14-sha1"
35#define KEX_DHGEX "diffie-hellman-group-exchange-sha1" 36#define KEX_DHGEX "diffie-hellman-group-exchange-sha1"
36 37
37enum kex_init_proposals { 38enum kex_init_proposals {
@@ -56,6 +57,7 @@ enum kex_modes {
56 57
57enum kex_exchange { 58enum kex_exchange {
58 KEX_DH_GRP1_SHA1, 59 KEX_DH_GRP1_SHA1,
60 KEX_DH_GRP14_SHA1,
59 KEX_DH_GEX_SHA1, 61 KEX_DH_GEX_SHA1,
60 KEX_MAX 62 KEX_MAX
61}; 63};
diff --git a/kexdhc.c b/kexdhc.c
index fe6dc53f8..f48bd4678 100644
--- a/kexdhc.c
+++ b/kexdhc.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kexdhc.c,v 1.1 2003/02/16 17:09:57 markus Exp $"); 26RCSID("$OpenBSD: kexdhc.c,v 1.2 2004/06/13 12:53:24 djm Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29#include "key.h" 29#include "key.h"
@@ -44,7 +44,16 @@ kexdh_client(Kex *kex)
44 u_int klen, kout, slen, sbloblen; 44 u_int klen, kout, slen, sbloblen;
45 45
46 /* generate and send 'e', client DH public key */ 46 /* generate and send 'e', client DH public key */
47 dh = dh_new_group1(); 47 switch (kex->kex_type) {
48 case KEX_DH_GRP1_SHA1:
49 dh = dh_new_group1();
50 break;
51 case KEX_DH_GRP14_SHA1:
52 dh = dh_new_group14();
53 break;
54 default:
55 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type);
56 }
48 dh_gen_key(dh, kex->we_need * 8); 57 dh_gen_key(dh, kex->we_need * 8);
49 packet_start(SSH2_MSG_KEXDH_INIT); 58 packet_start(SSH2_MSG_KEXDH_INIT);
50 packet_put_bignum2(dh->pub_key); 59 packet_put_bignum2(dh->pub_key);
diff --git a/kexdhs.c b/kexdhs.c
index f04bce825..225e65592 100644
--- a/kexdhs.c
+++ b/kexdhs.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kexdhs.c,v 1.1 2003/02/16 17:09:57 markus Exp $"); 26RCSID("$OpenBSD: kexdhs.c,v 1.2 2004/06/13 12:53:24 djm Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29#include "key.h" 29#include "key.h"
@@ -45,7 +45,16 @@ kexdh_server(Kex *kex)
45 u_int slen; 45 u_int slen;
46 46
47 /* generate server DH public key */ 47 /* generate server DH public key */
48 dh = dh_new_group1(); 48 switch (kex->kex_type) {
49 case KEX_DH_GRP1_SHA1:
50 dh = dh_new_group1();
51 break;
52 case KEX_DH_GRP14_SHA1:
53 dh = dh_new_group14();
54 break;
55 default:
56 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type);
57 }
49 dh_gen_key(dh, kex->we_need * 8); 58 dh_gen_key(dh, kex->we_need * 8);
50 59
51 debug("expecting SSH2_MSG_KEXDH_INIT"); 60 debug("expecting SSH2_MSG_KEXDH_INIT");
diff --git a/monitor.c b/monitor.c
index 2200eb09d..c287a2da1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor.c,v 1.57 2004/05/11 19:01:43 deraadt Exp $"); 28RCSID("$OpenBSD: monitor.c,v 1.58 2004/06/13 12:53:24 djm Exp $");
29 29
30#include <openssl/dh.h> 30#include <openssl/dh.h>
31 31
@@ -1546,6 +1546,7 @@ mm_get_kex(Buffer *m)
1546 fatal("mm_get_get: internal error: bad session id"); 1546 fatal("mm_get_get: internal error: bad session id");
1547 kex->we_need = buffer_get_int(m); 1547 kex->we_need = buffer_get_int(m);
1548 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 1548 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1549 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1549 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 1550 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1550 kex->server = 1; 1551 kex->server = 1;
1551 kex->hostkey_type = buffer_get_int(m); 1552 kex->hostkey_type = buffer_get_int(m);
diff --git a/myproposal.h b/myproposal.h
index 8b431d9d2..228ed6882 100644
--- a/myproposal.h
+++ b/myproposal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: myproposal.h,v 1.15 2003/05/17 04:27:52 markus Exp $ */ 1/* $OpenBSD: myproposal.h,v 1.16 2004/06/13 12:53:24 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -23,7 +23,9 @@
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26#define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1" 26#define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1," \
27 "diffie-hellman-group14-sha1," \
28 "diffie-hellman-group1-sha1"
27#define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss" 29#define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss"
28#define KEX_DEFAULT_ENCRYPT \ 30#define KEX_DEFAULT_ENCRYPT \
29 "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour," \ 31 "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour," \
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 266b23cb3..c4a2414b1 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include "includes.h" 9#include "includes.h"
10RCSID("$OpenBSD: ssh-keyscan.c,v 1.47 2004/03/08 09:38:05 djm Exp $"); 10RCSID("$OpenBSD: ssh-keyscan.c,v 1.48 2004/06/13 12:53:24 djm Exp $");
11 11
12#include "openbsd-compat/sys-queue.h" 12#include "openbsd-compat/sys-queue.h"
13 13
@@ -349,6 +349,7 @@ keygrab_ssh2(con *c)
349 "ssh-dss": "ssh-rsa"; 349 "ssh-dss": "ssh-rsa";
350 c->c_kex = kex_setup(myproposal); 350 c->c_kex = kex_setup(myproposal);
351 c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 351 c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
352 c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
352 c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; 353 c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
353 c->c_kex->verify_host_key = hostjump; 354 c->c_kex->verify_host_key = hostjump;
354 355
diff --git a/sshconnect2.c b/sshconnect2.c
index 06d884285..68d56d020 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.137 2004/05/08 00:21:31 djm Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.138 2004/06/13 12:53:24 djm Exp $");
27 27
28#include "openbsd-compat/sys-queue.h" 28#include "openbsd-compat/sys-queue.h"
29 29
@@ -120,6 +120,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr)
120 /* start key exchange */ 120 /* start key exchange */
121 kex = kex_setup(myproposal); 121 kex = kex_setup(myproposal);
122 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 122 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
123 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
123 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; 124 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
124 kex->client_version_string=client_version_string; 125 kex->client_version_string=client_version_string;
125 kex->server_version_string=server_version_string; 126 kex->server_version_string=server_version_string;
diff --git a/sshd.c b/sshd.c
index 332a189e8..5f3878119 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.291 2004/05/09 01:19:28 djm Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.292 2004/06/13 12:53:24 djm Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -1774,6 +1774,7 @@ do_ssh2_kex(void)
1774 /* start key exchange */ 1774 /* start key exchange */
1775 kex = kex_setup(myproposal); 1775 kex = kex_setup(myproposal);
1776 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 1776 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1777 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1777 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 1778 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1778 kex->server = 1; 1779 kex->server = 1;
1779 kex->client_version_string=client_version_string; 1780 kex->client_version_string=client_version_string;