summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-06 01:09:20 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-06 01:09:20 +0000
commit4c4f05e09647ec68becba9664b6b84e643fc0578 (patch)
treeb80be6bceb955898948ef10527b43fc4cf005d8e /sshconnect2.c
parentc78a187b1776cb45c07a4a138946f8370ed6e71d (diff)
- markus@cvs.openbsd.org 2001/03/05 17:17:21
[kex.c kex.h sshconnect2.c sshd.c] generate a 2*need size (~300 instead of 1024/2048) random private exponent during the DH key agreement. according to Niels (the great german advisor) this is safe since /etc/primes contains strong primes only. References: P. C. van Oorschot and M. J. Wiener, On Diffie-Hellman key agreement with short exponents, In Advances in Cryptology - EUROCRYPT'96, LNCS 1070, Springer-Verlag, 1996, pp.332-343.
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index 8b523232f..0baecf0a5 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.49 2001/02/28 09:57:07 markus Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.50 2001/03/05 17:17:21 markus Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/md5.h> 29#include <openssl/md5.h>
@@ -171,7 +171,7 @@ ssh_dh1_client(Kex *kex, char *host, struct sockaddr *hostaddr,
171 debug("Sending SSH2_MSG_KEXDH_INIT."); 171 debug("Sending SSH2_MSG_KEXDH_INIT.");
172 /* generate and send 'e', client DH public key */ 172 /* generate and send 'e', client DH public key */
173 dh = dh_new_group1(); 173 dh = dh_new_group1();
174 dh_gen_key(dh); 174 dh_gen_key(dh, kex->we_need * 8);
175 packet_start(SSH2_MSG_KEXDH_INIT); 175 packet_start(SSH2_MSG_KEXDH_INIT);
176 packet_put_bignum2(dh->pub_key); 176 packet_put_bignum2(dh->pub_key);
177 packet_send(); 177 packet_send();
@@ -316,7 +316,7 @@ ssh_dhgex_client(Kex *kex, char *host, struct sockaddr *hostaddr,
316 u_char *kbuf; 316 u_char *kbuf;
317 u_char *hash; 317 u_char *hash;
318 318
319 nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8); 319 nbits = dh_estimate(kex->we_need * 8);
320 320
321 debug("Sending SSH2_MSG_KEX_DH_GEX_REQUEST."); 321 debug("Sending SSH2_MSG_KEX_DH_GEX_REQUEST.");
322 packet_start(SSH2_MSG_KEX_DH_GEX_REQUEST); 322 packet_start(SSH2_MSG_KEX_DH_GEX_REQUEST);
@@ -342,7 +342,7 @@ ssh_dhgex_client(Kex *kex, char *host, struct sockaddr *hostaddr,
342 packet_get_bignum2(g, &dlen); 342 packet_get_bignum2(g, &dlen);
343 dh = dh_new_group(g, p); 343 dh = dh_new_group(g, p);
344 344
345 dh_gen_key(dh); 345 dh_gen_key(dh, kex->we_need * 8);
346 346
347#ifdef DEBUG_KEXDH 347#ifdef DEBUG_KEXDH
348 fprintf(stderr, "\np= "); 348 fprintf(stderr, "\np= ");