version 1.2, 2005/11/04 05:15:59 |
version 1.2.2.2, 2006/11/08 00:17:14 |
|
|
|
/* $OpenBSD$ */ |
/* |
/* |
* Copyright (c) 2000 Niels Provos. All rights reserved. |
* Copyright (c) 2000 Niels Provos. All rights reserved. |
* Copyright (c) 2001 Markus Friedl. All rights reserved. |
* Copyright (c) 2001 Markus Friedl. All rights reserved. |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
#include "includes.h" |
#include <sys/param.h> |
RCSID("$OpenBSD$"); |
|
|
|
|
#include <stdio.h> |
|
#include <string.h> |
|
#include <signal.h> |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
|
#include "buffer.h" |
#include "key.h" |
#include "key.h" |
|
#include "cipher.h" |
#include "kex.h" |
#include "kex.h" |
#include "log.h" |
#include "log.h" |
#include "packet.h" |
#include "packet.h" |
#include "dh.h" |
#include "dh.h" |
#include "ssh2.h" |
#include "ssh2.h" |
#include "compat.h" |
#include "compat.h" |
|
#ifdef GSSAPI |
|
#include "ssh-gss.h" |
|
#endif |
#include "monitor_wrap.h" |
#include "monitor_wrap.h" |
|
|
void |
void |
|
|
Key *server_host_key; |
Key *server_host_key; |
DH *dh; |
DH *dh; |
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; |
u_char *kbuf, *hash, *signature = NULL, *server_host_key_blob = NULL; |
u_int sbloblen, klen, kout, slen, hashlen; |
u_int sbloblen, klen, slen, hashlen; |
int min = -1, max = -1, nbits = -1, type; |
int min = -1, max = -1, nbits = -1, type, kout; |
|
|
if (kex->load_host_key == NULL) |
if (kex->load_host_key == NULL) |
fatal("Cannot load hostkey"); |
fatal("Cannot load hostkey"); |
|
|
|
|
klen = DH_size(dh); |
klen = DH_size(dh); |
kbuf = xmalloc(klen); |
kbuf = xmalloc(klen); |
kout = DH_compute_key(kbuf, dh_client_pub, dh); |
if ((kout = DH_compute_key(kbuf, dh_client_pub, dh)) < 0) |
|
fatal("DH_compute_key: failed"); |
#ifdef DEBUG_KEXDH |
#ifdef DEBUG_KEXDH |
dump_digest("shared secret", kbuf, kout); |
dump_digest("shared secret", kbuf, kout); |
#endif |
#endif |
if ((shared_secret = BN_new()) == NULL) |
if ((shared_secret = BN_new()) == NULL) |
fatal("kexgex_server: BN_new failed"); |
fatal("kexgex_server: BN_new failed"); |
BN_bin2bn(kbuf, kout, shared_secret); |
if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) |
|
fatal("kexgex_server: BN_bin2bn failed"); |
memset(kbuf, 0, klen); |
memset(kbuf, 0, klen); |
xfree(kbuf); |
xfree(kbuf); |
|
|