]> andersk Git - openssh.git/blobdiff - sshconnect1.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / sshconnect1.c
index ab521621416d5035e00a5fe48e5df1c1b1fa708a..fd07bbf7418a15b7c87d1816c811cdc7829acd88 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect1.c,v 1.66 2006/07/22 20:48:23 stevesk Exp $ */
+/* $OpenBSD: sshconnect1.c,v 1.70 2006/11/06 21:25:28 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 
 #include "includes.h"
 
+#include <sys/types.h>
+#include <sys/socket.h>
+
 #include <openssl/bn.h>
 #include <openssl/md5.h>
 
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <signal.h>
+#include <pwd.h>
 
+#include "xmalloc.h"
 #include "ssh.h"
 #include "ssh1.h"
-#include "xmalloc.h"
 #include "rsa.h"
 #include "buffer.h"
 #include "packet.h"
+#include "key.h"
+#include "cipher.h"
 #include "kex.h"
 #include "uidswap.h"
 #include "log.h"
 #include "readconf.h"
-#include "key.h"
 #include "authfd.h"
 #include "sshconnect.h"
 #include "authfile.h"
 #include "misc.h"
-#include "cipher.h"
 #include "canohost.h"
+#include "hostfile.h"
 #include "auth.h"
 
 /* Session id for the current session. */
@@ -554,14 +563,20 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
         * the first 16 bytes of the session id.
         */
        if ((key = BN_new()) == NULL)
-               fatal("respond_to_rsa_challenge: BN_new failed");
-       BN_set_word(key, 0);
+               fatal("ssh_kex: BN_new failed");
+       if (BN_set_word(key, 0) == 0)
+               fatal("ssh_kex: BN_set_word failed");
        for (i = 0; i < SSH_SESSION_KEY_LENGTH; i++) {
-               BN_lshift(key, key, 8);
-               if (i < 16)
-                       BN_add_word(key, session_key[i] ^ session_id[i]);
-               else
-                       BN_add_word(key, session_key[i]);
+               if (BN_lshift(key, key, 8) == 0)
+                       fatal("ssh_kex: BN_lshift failed");
+               if (i < 16) {
+                       if (BN_add_word(key, session_key[i] ^ session_id[i])
+                           == 0)
+                               fatal("ssh_kex: BN_add_word failed");
+               } else {
+                       if (BN_add_word(key, session_key[i]) == 0)
+                               fatal("ssh_kex: BN_add_word failed");
+               }
        }
 
        /*
This page took 0.34391 seconds and 4 git commands to generate.