kexgexc.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 2000 Niels Provos. All rights reserved.
* Copyright (c) 2001 Markus Friedl. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#pragma ident "%Z%%M% %I% %E% SMI"
#include "xmalloc.h"
#include "buffer.h"
#include "bufaux.h"
#include "key.h"
#include "kex.h"
#include "log.h"
#include "packet.h"
#include "dh.h"
#include "ssh2.h"
#include "compat.h"
#include "monitor_wrap.h"
void
{
if (datafellows & SSH_OLD_DHGEX) {
debug("SSH2_MSG_KEX_DH_GEX_REQUEST_OLD sent");
/* Old GEX request */
min = DH_GRP_MIN;
max = DH_GRP_MAX;
} else {
debug("SSH2_MSG_KEX_DH_GEX_REQUEST sent");
/* New GEX request */
min = DH_GRP_MIN;
max = DH_GRP_MAX;
}
#ifdef DEBUG_KEXDH
#endif
packet_send();
debug("expecting SSH2_MSG_KEX_DH_GEX_GROUP");
fatal("BN_new");
fatal("BN_new");
fatal("DH_GEX group out of range: %d !< %d !< %d",
dh = dh_new_group(g, p);
#ifdef DEBUG_KEXDH
#endif
debug("SSH2_MSG_KEX_DH_GEX_INIT sent");
/* generate and send 'e', client DH public key */
packet_send();
debug("expecting SSH2_MSG_KEX_DH_GEX_REPLY");
/* key, cert */
if (server_host_key == NULL)
fatal("cannot decode server_host_key_blob");
fatal("type mismatch for decoded server_host_key_blob");
fatal("cannot verify server_host_key");
fatal("server_host_key verification failed");
/* DH paramter f, server public DH key */
fatal("dh_server_pub == NULL");
#ifdef DEBUG_KEXDH
#endif
/* signed H */
packet_disconnect("bad server public DH value");
#ifdef DEBUG_KEXDH
#endif
fatal("kexgex_client: BN_new failed");
if (datafellows & SSH_OLD_DHGEX)
/* calc and verify H */
hash = kexgex_hash(
);
/* have keys, free DH */
fatal("key_verify failed for server_host_key");
/* save session id */
}
}