Deleted Added
full compact
kexdh.c (92555) kexdh.c (98675)
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include "includes.h"
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include "includes.h"
26RCSID("$OpenBSD: kexdh.c,v 1.17 2002/02/28 15:46:33 markus Exp $");
26RCSID("$OpenBSD: kexdh.c,v 1.18 2002/03/18 17:50:31 provos Exp $");
27
28#include <openssl/crypto.h>
29#include <openssl/bn.h>
30
31#include "xmalloc.h"
32#include "buffer.h"
33#include "bufaux.h"
34#include "key.h"
35#include "kex.h"
36#include "log.h"
37#include "packet.h"
38#include "dh.h"
39#include "ssh2.h"
27
28#include <openssl/crypto.h>
29#include <openssl/bn.h>
30
31#include "xmalloc.h"
32#include "buffer.h"
33#include "bufaux.h"
34#include "key.h"
35#include "kex.h"
36#include "log.h"
37#include "packet.h"
38#include "dh.h"
39#include "ssh2.h"
40#include "monitor_wrap.h"
40
41static u_char *
42kex_dh_hash(
43 char *client_version_string,
44 char *server_version_string,
45 char *ckexinit, int ckexinitlen,
46 char *skexinit, int skexinitlen,
47 u_char *serverhostkeyblob, int sbloblen,

--- 222 unchanged lines hidden (view full) ---

270 if (kex->session_id == NULL) {
271 kex->session_id_len = 20;
272 kex->session_id = xmalloc(kex->session_id_len);
273 memcpy(kex->session_id, hash, kex->session_id_len);
274 }
275
276 /* sign H */
277 /* XXX hashlen depends on KEX */
41
42static u_char *
43kex_dh_hash(
44 char *client_version_string,
45 char *server_version_string,
46 char *ckexinit, int ckexinitlen,
47 char *skexinit, int skexinitlen,
48 u_char *serverhostkeyblob, int sbloblen,

--- 222 unchanged lines hidden (view full) ---

271 if (kex->session_id == NULL) {
272 kex->session_id_len = 20;
273 kex->session_id = xmalloc(kex->session_id_len);
274 memcpy(kex->session_id, hash, kex->session_id_len);
275 }
276
277 /* sign H */
278 /* XXX hashlen depends on KEX */
278 key_sign(server_host_key, &signature, &slen, hash, 20);
279 PRIVSEP(key_sign(server_host_key, &signature, &slen, hash, 20));
279
280 /* destroy_sensitive_data(); */
281
282 /* send server hostkey, DH pubkey 'f' and singed H */
283 packet_start(SSH2_MSG_KEXDH_REPLY);
284 packet_put_string(server_host_key_blob, sbloblen);
285 packet_put_bignum2(dh->pub_key); /* f */
286 packet_put_string(signature, slen);

--- 20 unchanged lines hidden ---
280
281 /* destroy_sensitive_data(); */
282
283 /* send server hostkey, DH pubkey 'f' and singed H */
284 packet_start(SSH2_MSG_KEXDH_REPLY);
285 packet_put_string(server_host_key_blob, sbloblen);
286 packet_put_bignum2(dh->pub_key); /* f */
287 packet_put_string(signature, slen);

--- 20 unchanged lines hidden ---