Deleted Added
full compact
sshconnect1.c (162856) sshconnect1.c (164149)
1/* $OpenBSD: sshconnect1.c,v 1.69 2006/08/03 03:34:42 deraadt Exp $ */
1/* $OpenBSD: sshconnect1.c,v 1.70 2006/11/06 21:25:28 markus Exp $ */
2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
6 * Code to connect to a remote host, and to perform the client side of the
7 * login (authentication) dialog.
8 *
9 * As far as I am concerned, the code I have written for this software

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

558 }
559
560 /*
561 * According to the protocol spec, the first byte of the session key
562 * is the highest byte of the integer. The session key is xored with
563 * the first 16 bytes of the session id.
564 */
565 if ((key = BN_new()) == NULL)
2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
6 * Code to connect to a remote host, and to perform the client side of the
7 * login (authentication) dialog.
8 *
9 * As far as I am concerned, the code I have written for this software

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

558 }
559
560 /*
561 * According to the protocol spec, the first byte of the session key
562 * is the highest byte of the integer. The session key is xored with
563 * the first 16 bytes of the session id.
564 */
565 if ((key = BN_new()) == NULL)
566 fatal("respond_to_rsa_challenge: BN_new failed");
567 BN_set_word(key, 0);
566 fatal("ssh_kex: BN_new failed");
567 if (BN_set_word(key, 0) == 0)
568 fatal("ssh_kex: BN_set_word failed");
568 for (i = 0; i < SSH_SESSION_KEY_LENGTH; i++) {
569 for (i = 0; i < SSH_SESSION_KEY_LENGTH; i++) {
569 BN_lshift(key, key, 8);
570 if (i < 16)
571 BN_add_word(key, session_key[i] ^ session_id[i]);
572 else
573 BN_add_word(key, session_key[i]);
570 if (BN_lshift(key, key, 8) == 0)
571 fatal("ssh_kex: BN_lshift failed");
572 if (i < 16) {
573 if (BN_add_word(key, session_key[i] ^ session_id[i])
574 == 0)
575 fatal("ssh_kex: BN_add_word failed");
576 } else {
577 if (BN_add_word(key, session_key[i]) == 0)
578 fatal("ssh_kex: BN_add_word failed");
579 }
574 }
575
576 /*
577 * Encrypt the integer using the public key and host key of the
578 * server (key with smaller modulus first).
579 */
580 if (BN_cmp(server_key->rsa->n, host_key->rsa->n) < 0) {
581 /* Public key has smaller modulus. */

--- 166 unchanged lines hidden ---
580 }
581
582 /*
583 * Encrypt the integer using the public key and host key of the
584 * server (key with smaller modulus first).
585 */
586 if (BN_cmp(server_key->rsa->n, host_key->rsa->n) < 0) {
587 /* Public key has smaller modulus. */

--- 166 unchanged lines hidden ---