summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--auth-krb4.c4
-rw-r--r--auth-options.c4
-rw-r--r--auth-options.h4
-rw-r--r--auth-rh-rsa.c6
-rw-r--r--auth-rhosts.c4
-rw-r--r--auth-rsa.c12
-rw-r--r--auth1.c12
-rw-r--r--auth2-skey.c4
-rw-r--r--auth2.c14
-rw-r--r--authfd.c30
-rw-r--r--authfd.h16
-rw-r--r--authfile.c14
-rw-r--r--bufaux.c28
-rw-r--r--bufaux.h10
-rw-r--r--buffer.c16
-rw-r--r--buffer.h20
-rw-r--r--canohost.c4
-rw-r--r--channels.c32
-rw-r--r--cipher.c14
-rw-r--r--cipher.h4
-rw-r--r--clientloop.c22
-rw-r--r--compress.c10
-rw-r--r--crc32.c14
-rw-r--r--crc32.h4
-rw-r--r--deattack.c16
-rw-r--r--deattack.h2
-rw-r--r--getput.h26
-rw-r--r--hmac.c14
-rw-r--r--hmac.h8
-rw-r--r--hostfile.c16
-rw-r--r--hostfile.h4
-rw-r--r--kex.c26
-rw-r--r--kex.h16
-rw-r--r--key.c30
-rw-r--r--key.h12
-rw-r--r--log.c6
-rw-r--r--login.c6
-rw-r--r--match.c6
-rw-r--r--match.h2
-rw-r--r--mpaux.c14
-rw-r--r--mpaux.h6
-rw-r--r--packet.c80
-rw-r--r--packet.h22
-rw-r--r--pty.c2
-rw-r--r--radix.c20
-rw-r--r--readconf.c10
-rw-r--r--rsa.c6
-rw-r--r--scp.c18
-rw-r--r--servconf.c4
-rw-r--r--servconf.h16
-rw-r--r--serverloop.c18
-rw-r--r--session.c22
-rw-r--r--sftp-server.c10
-rw-r--r--ssh-agent.c40
-rw-r--r--ssh-dss.c30
-rw-r--r--ssh-dss.h8
-rw-r--r--ssh-keygen.c10
-rw-r--r--ssh-keyscan.c6
-rw-r--r--ssh-rsa.c20
-rw-r--r--ssh-rsa.h8
-rw-r--r--ssh.c8
-rw-r--r--ssh.h10
-rw-r--r--sshconnect.c50
-rw-r--r--sshconnect1.c32
-rw-r--r--sshconnect2.c46
-rw-r--r--sshd.c50
-rw-r--r--tildexpand.c4
-rw-r--r--uidswap.c4
-rw-r--r--uidswap.h2
-rw-r--r--uuencode.c12
-rw-r--r--uuencode.h6
72 files changed, 586 insertions, 528 deletions
diff --git a/ChangeLog b/ChangeLog
index 16898e192..db18b729c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
120001222
2 - Updated RCSID for pty.c
3 - (bal) OpenBSD CVS Updates:
4 - markus@cvs.openbsd.org 2000/12/21 15:10:16
5 [auth-rh-rsa.c hostfile.c hostfile.h sshconnect.c]
6 print keyfile:line for changed hostkeys, for deraadt@, ok deraadt@
7 - markus@cvs.openbsd.org 2000/12/20 19:26:56
8 [authfile.c]
9 allow ssh -i userkey for root
10 - markus@cvs.openbsd.org 2000/12/20 19:37:21
11 [authfd.c authfd.h kex.c sshconnect2.c sshd.c uidswap.c uidswap.h]
12 fix prototypes; from stevesk@pobox.com
13 - markus@cvs.openbsd.org 2000/12/20 19:32:08
14 [sshd.c]
15 init pointer to NULL; report from Jan.Ivan@cern.ch
16 - markus@cvs.openbsd.org 2000/12/19 23:17:54
17 [auth-krb4.c auth-options.c auth-options.h auth-rhosts.c auth-rsa.c
18 auth1.c auth2-skey.c auth2.c authfd.c authfd.h authfile.c bufaux.c
19 bufaux.h buffer.c canohost.c channels.c clientloop.c compress.c
20 crc32.c deattack.c getput.h hmac.c hmac.h hostfile.c kex.c kex.h
21 key.c key.h log.c login.c match.c match.h mpaux.c mpaux.h packet.c
22 packet.h radix.c readconf.c rsa.c scp.c servconf.c servconf.h
23 serverloop.c session.c sftp-server.c ssh-agent.c ssh-dss.c ssh-dss.h
24 ssh-keygen.c ssh-keyscan.c ssh-rsa.c ssh-rsa.h ssh.c ssh.h uuencode.c
25 uuencode.h sshconnect1.c sshconnect2.c sshd.c tildexpand.c]
26 replace 'unsigned bla' with 'u_bla' everywhere. also replace 'char
27 unsigned' with u_char.
28
120001221 2920001221
2 - (stevesk) OpenBSD CVS updates: 30 - (stevesk) OpenBSD CVS updates:
3 - markus@cvs.openbsd.org 2000/12/19 15:43:45 31 - markus@cvs.openbsd.org 2000/12/19 15:43:45
diff --git a/auth-krb4.c b/auth-krb4.c
index 21a9625e3..80e8f4292 100644
--- a/auth-krb4.c
+++ b/auth-krb4.c
@@ -28,7 +28,7 @@
28#include "ssh.h" 28#include "ssh.h"
29#include "servconf.h" 29#include "servconf.h"
30 30
31RCSID("$OpenBSD: auth-krb4.c,v 1.19 2000/10/03 18:03:02 markus Exp $"); 31RCSID("$OpenBSD: auth-krb4.c,v 1.20 2000/12/19 23:17:54 markus Exp $");
32 32
33#ifdef KRB4 33#ifdef KRB4
34char *ticket = NULL; 34char *ticket = NULL;
@@ -46,7 +46,7 @@ auth_krb4_password(struct passwd * pw, const char *password)
46 AUTH_DAT adata; 46 AUTH_DAT adata;
47 KTEXT_ST tkt; 47 KTEXT_ST tkt;
48 struct hostent *hp; 48 struct hostent *hp;
49 unsigned long faddr; 49 u_long faddr;
50 char localhost[MAXHOSTNAMELEN]; 50 char localhost[MAXHOSTNAMELEN];
51 char phost[INST_SZ]; 51 char phost[INST_SZ];
52 char realm[REALM_SZ]; 52 char realm[REALM_SZ];
diff --git a/auth-options.c b/auth-options.c
index 181bf7321..c598f70df 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: auth-options.c,v 1.6 2000/11/15 22:31:36 markus Exp $"); 17RCSID("$OpenBSD: auth-options.c,v 1.7 2000/12/19 23:17:54 markus Exp $");
18 18
19#include "ssh.h" 19#include "ssh.h"
20#include "packet.h" 20#include "packet.h"
@@ -54,7 +54,7 @@ auth_clear_options(void)
54 54
55/* return 1 if access is granted, 0 if not. side effect: sets key option flags */ 55/* return 1 if access is granted, 0 if not. side effect: sets key option flags */
56int 56int
57auth_parse_options(struct passwd *pw, char *options, unsigned long linenum) 57auth_parse_options(struct passwd *pw, char *options, u_long linenum)
58{ 58{
59 const char *cp; 59 const char *cp;
60 if (!options) 60 if (!options)
diff --git a/auth-options.h b/auth-options.h
index 00fae2230..76d420d23 100644
--- a/auth-options.h
+++ b/auth-options.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* $OpenBSD: auth-options.h,v 1.5 2000/10/16 09:38:44 djm Exp $ */ 14/* $OpenBSD: auth-options.h,v 1.6 2000/12/19 23:17:55 markus Exp $ */
15 15
16#ifndef AUTH_OPTIONS_H 16#ifndef AUTH_OPTIONS_H
17#define AUTH_OPTIONS_H 17#define AUTH_OPTIONS_H
@@ -24,7 +24,7 @@ extern char *forced_command;
24extern struct envstring *custom_environment; 24extern struct envstring *custom_environment;
25 25
26/* return 1 if access is granted, 0 if not. side effect: sets key option flags */ 26/* return 1 if access is granted, 0 if not. side effect: sets key option flags */
27int auth_parse_options(struct passwd *pw, char *options, unsigned long linenum); 27int auth_parse_options(struct passwd *pw, char *options, u_long linenum);
28/* reset options flags */ 28/* reset options flags */
29void auth_clear_options(void); 29void auth_clear_options(void);
30 30
diff --git a/auth-rh-rsa.c b/auth-rh-rsa.c
index a9f17ef83..48c075e66 100644
--- a/auth-rh-rsa.c
+++ b/auth-rh-rsa.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: auth-rh-rsa.c,v 1.18 2000/11/12 19:50:37 markus Exp $"); 16RCSID("$OpenBSD: auth-rh-rsa.c,v 1.19 2000/12/21 15:10:16 markus Exp $");
17 17
18#include "packet.h" 18#include "packet.h"
19#include "ssh.h" 19#include "ssh.h"
@@ -60,7 +60,7 @@ auth_rhosts_rsa(struct passwd *pw, const char *client_user, RSA *client_host_key
60 60
61 /* Check if we know the host and its host key. */ 61 /* Check if we know the host and its host key. */
62 host_status = check_host_in_hostfile(SSH_SYSTEM_HOSTFILE, canonical_hostname, 62 host_status = check_host_in_hostfile(SSH_SYSTEM_HOSTFILE, canonical_hostname,
63 client_key, found); 63 client_key, found, NULL);
64 64
65 /* Check user host file unless ignored. */ 65 /* Check user host file unless ignored. */
66 if (host_status != HOST_OK && !options.ignore_user_known_hosts) { 66 if (host_status != HOST_OK && !options.ignore_user_known_hosts) {
@@ -80,7 +80,7 @@ auth_rhosts_rsa(struct passwd *pw, const char *client_user, RSA *client_host_key
80 /* XXX race between stat and the following open() */ 80 /* XXX race between stat and the following open() */
81 temporarily_use_uid(pw->pw_uid); 81 temporarily_use_uid(pw->pw_uid);
82 host_status = check_host_in_hostfile(user_hostfile, canonical_hostname, 82 host_status = check_host_in_hostfile(user_hostfile, canonical_hostname,
83 client_key, found); 83 client_key, found, NULL);
84 restore_uid(); 84 restore_uid();
85 } 85 }
86 xfree(user_hostfile); 86 xfree(user_hostfile);
diff --git a/auth-rhosts.c b/auth-rhosts.c
index 8314e23a1..fb7dabe7a 100644
--- a/auth-rhosts.c
+++ b/auth-rhosts.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: auth-rhosts.c,v 1.16 2000/10/03 18:03:03 markus Exp $"); 17RCSID("$OpenBSD: auth-rhosts.c,v 1.17 2000/12/19 23:17:55 markus Exp $");
18 18
19#include "packet.h" 19#include "packet.h"
20#include "ssh.h" 20#include "ssh.h"
@@ -152,7 +152,7 @@ auth_rhosts(struct passwd *pw, const char *client_user)
152 const char *hostname, *ipaddr; 152 const char *hostname, *ipaddr;
153 struct stat st; 153 struct stat st;
154 static const char *rhosts_files[] = {".shosts", ".rhosts", NULL}; 154 static const char *rhosts_files[] = {".shosts", ".rhosts", NULL};
155 unsigned int rhosts_file_index; 155 u_int rhosts_file_index;
156 156
157 /* no user given */ 157 /* no user given */
158 if (pw == NULL) 158 if (pw == NULL)
diff --git a/auth-rsa.c b/auth-rsa.c
index 72cb909d7..3daf4d13c 100644
--- a/auth-rsa.c
+++ b/auth-rsa.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: auth-rsa.c,v 1.33 2000/11/14 23:42:40 markus Exp $"); 17RCSID("$OpenBSD: auth-rsa.c,v 1.34 2000/12/19 23:17:55 markus Exp $");
18 18
19#include "rsa.h" 19#include "rsa.h"
20#include "packet.h" 20#include "packet.h"
@@ -37,7 +37,7 @@ extern ServerOptions options;
37 * Session identifier that is used to bind key exchange and authentication 37 * Session identifier that is used to bind key exchange and authentication
38 * responses to a particular session. 38 * responses to a particular session.
39 */ 39 */
40extern unsigned char session_id[16]; 40extern u_char session_id[16];
41 41
42/* 42/*
43 * The .ssh/authorized_keys file contains public keys, one per line, in the 43 * The .ssh/authorized_keys file contains public keys, one per line, in the
@@ -60,9 +60,9 @@ auth_rsa_challenge_dialog(RSA *pk)
60{ 60{
61 BIGNUM *challenge, *encrypted_challenge; 61 BIGNUM *challenge, *encrypted_challenge;
62 BN_CTX *ctx; 62 BN_CTX *ctx;
63 unsigned char buf[32], mdbuf[16], response[16]; 63 u_char buf[32], mdbuf[16], response[16];
64 MD5_CTX md; 64 MD5_CTX md;
65 unsigned int i; 65 u_int i;
66 int plen, len; 66 int plen, len;
67 67
68 encrypted_challenge = BN_new(); 68 encrypted_challenge = BN_new();
@@ -122,9 +122,9 @@ auth_rsa(struct passwd *pw, BIGNUM *client_n)
122{ 122{
123 char line[8192], file[1024]; 123 char line[8192], file[1024];
124 int authenticated; 124 int authenticated;
125 unsigned int bits; 125 u_int bits;
126 FILE *f; 126 FILE *f;
127 unsigned long linenum = 0; 127 u_long linenum = 0;
128 struct stat st; 128 struct stat st;
129 RSA *pk; 129 RSA *pk;
130 130
diff --git a/auth1.c b/auth1.c
index fec73e3a2..5c906b60b 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.7 2000/11/10 01:04:40 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.8 2000/12/19 23:17:55 markus Exp $");
14 14
15#ifdef HAVE_OSF_SIA 15#ifdef HAVE_OSF_SIA
16# include <sia.h> 16# include <sia.h>
@@ -81,14 +81,14 @@ do_authloop(struct passwd * pw, char *luser)
81{ 81{
82 int authenticated = 0; 82 int authenticated = 0;
83 int attempt = 0; 83 int attempt = 0;
84 unsigned int bits; 84 u_int bits;
85 RSA *client_host_key; 85 RSA *client_host_key;
86 BIGNUM *n; 86 BIGNUM *n;
87 char *client_user, *password; 87 char *client_user, *password;
88 char user[1024]; 88 char user[1024];
89 unsigned int dlen; 89 u_int dlen;
90 int plen, nlen, elen; 90 int plen, nlen, elen;
91 unsigned int ulen; 91 u_int ulen;
92 int type = 0; 92 int type = 0;
93 void (*authlog) (const char *fmt,...) = verbose; 93 void (*authlog) (const char *fmt,...) = verbose;
94 94
@@ -149,7 +149,7 @@ do_authloop(struct passwd * pw, char *luser)
149 /* Try Kerberos v4 authentication. */ 149 /* Try Kerberos v4 authentication. */
150 KTEXT_ST auth; 150 KTEXT_ST auth;
151 char *tkt_user = NULL; 151 char *tkt_user = NULL;
152 char *kdata = packet_get_string((unsigned int *) &auth.length); 152 char *kdata = packet_get_string((u_int *) &auth.length);
153 packet_integrity_check(plen, 4 + auth.length, type); 153 packet_integrity_check(plen, 4 + auth.length, type);
154 154
155 if (auth.length < MAX_KTXT_LEN) 155 if (auth.length < MAX_KTXT_LEN)
@@ -394,7 +394,7 @@ do_authentication()
394{ 394{
395 struct passwd *pw, pwcopy; 395 struct passwd *pw, pwcopy;
396 int plen; 396 int plen;
397 unsigned int ulen; 397 u_int ulen;
398 char *user; 398 char *user;
399 399
400 /* Get the name of the user that we wish to log in as. */ 400 /* Get the name of the user that we wish to log in as. */
diff --git a/auth2-skey.c b/auth2-skey.c
index e29205d4b..dbf24f67a 100644
--- a/auth2-skey.c
+++ b/auth2-skey.c
@@ -1,5 +1,5 @@
1#include "includes.h" 1#include "includes.h"
2RCSID("$OpenBSD: auth2-skey.c,v 1.1 2000/10/11 20:14:38 markus Exp $"); 2RCSID("$OpenBSD: auth2-skey.c,v 1.2 2000/12/19 23:17:55 markus Exp $");
3 3
4#ifdef SKEY 4#ifdef SKEY
5#include "ssh.h" 5#include "ssh.h"
@@ -62,7 +62,7 @@ input_userauth_info_response(int type, int plen, void *ctxt)
62{ 62{
63 Authctxt *authctxt = ctxt; 63 Authctxt *authctxt = ctxt;
64 int authenticated = 0; 64 int authenticated = 0;
65 unsigned int nresp, rlen; 65 u_int nresp, rlen;
66 char *resp, *method; 66 char *resp, *method;
67 67
68 if (authctxt == NULL) 68 if (authctxt == NULL)
diff --git a/auth2.c b/auth2.c
index 030e28da1..a0e6d577e 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2.c,v 1.22 2000/12/03 11:15:02 markus Exp $"); 26RCSID("$OpenBSD: auth2.c,v 1.23 2000/12/19 23:17:55 markus Exp $");
27 27
28#ifdef HAVE_OSF_SIA 28#ifdef HAVE_OSF_SIA
29# include <sia.h> 29# include <sia.h>
@@ -57,7 +57,7 @@ RCSID("$OpenBSD: auth2.c,v 1.22 2000/12/03 11:15:02 markus Exp $");
57 57
58/* import */ 58/* import */
59extern ServerOptions options; 59extern ServerOptions options;
60extern unsigned char *session_id2; 60extern u_char *session_id2;
61extern int session_id2_len; 61extern int session_id2_len;
62 62
63#ifdef WITH_AIXAUTHENTICATE 63#ifdef WITH_AIXAUTHENTICATE
@@ -151,7 +151,7 @@ void
151input_service_request(int type, int plen, void *ctxt) 151input_service_request(int type, int plen, void *ctxt)
152{ 152{
153 Authctxt *authctxt = ctxt; 153 Authctxt *authctxt = ctxt;
154 unsigned int len; 154 u_int len;
155 int accept = 0; 155 int accept = 0;
156 char *service = packet_get_string(&len); 156 char *service = packet_get_string(&len);
157 packet_done(); 157 packet_done();
@@ -363,7 +363,7 @@ userauth_passwd(Authctxt *authctxt)
363 char *password; 363 char *password;
364 int authenticated = 0; 364 int authenticated = 0;
365 int change; 365 int change;
366 unsigned int len; 366 u_int len;
367 change = packet_get_char(); 367 change = packet_get_char();
368 if (change) 368 if (change)
369 log("password change not supported"); 369 log("password change not supported");
@@ -425,7 +425,7 @@ userauth_pubkey(Authctxt *authctxt)
425 Buffer b; 425 Buffer b;
426 Key *key; 426 Key *key;
427 char *pkalg, *pkblob, *sig; 427 char *pkalg, *pkblob, *sig;
428 unsigned int alen, blen, slen; 428 u_int alen, blen, slen;
429 int have_sig, pktype; 429 int have_sig, pktype;
430 int authenticated = 0; 430 int authenticated = 0;
431 431
@@ -539,7 +539,7 @@ char *
539authmethods_get(void) 539authmethods_get(void)
540{ 540{
541 Authmethod *method = NULL; 541 Authmethod *method = NULL;
542 unsigned int size = 0; 542 u_int size = 0;
543 char *list; 543 char *list;
544 544
545 for (method = authmethods; method->name != NULL; method++) { 545 for (method = authmethods; method->name != NULL; method++) {
@@ -588,7 +588,7 @@ user_key_allowed(struct passwd *pw, Key *key)
588 char line[8192], file[1024]; 588 char line[8192], file[1024];
589 int found_key = 0; 589 int found_key = 0;
590 FILE *f; 590 FILE *f;
591 unsigned long linenum = 0; 591 u_long linenum = 0;
592 struct stat st; 592 struct stat st;
593 Key *found; 593 Key *found;
594 594
diff --git a/authfd.c b/authfd.c
index 9036a8d89..e2456e39e 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: authfd.c,v 1.30 2000/11/12 19:50:37 markus Exp $"); 38RCSID("$OpenBSD: authfd.c,v 1.32 2000/12/20 19:37:21 markus Exp $");
39 39
40#include "ssh.h" 40#include "ssh.h"
41#include "rsa.h" 41#include "rsa.h"
@@ -62,7 +62,7 @@ int decode_reply(int type);
62/* Returns the number of the authentication fd, or -1 if there is none. */ 62/* Returns the number of the authentication fd, or -1 if there is none. */
63 63
64int 64int
65ssh_get_authentication_socket() 65ssh_get_authentication_socket(void)
66{ 66{
67 const char *authsocket; 67 const char *authsocket;
68 int sock, len; 68 int sock, len;
@@ -171,7 +171,7 @@ ssh_close_authentication_socket(int sock)
171 */ 171 */
172 172
173AuthenticationConnection * 173AuthenticationConnection *
174ssh_get_authentication_connection() 174ssh_get_authentication_connection(void)
175{ 175{
176 AuthenticationConnection *auth; 176 AuthenticationConnection *auth;
177 int sock; 177 int sock;
@@ -272,9 +272,9 @@ ssh_get_first_identity(AuthenticationConnection *auth, char **comment, int versi
272Key * 272Key *
273ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int version) 273ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int version)
274{ 274{
275 unsigned int bits; 275 u_int bits;
276 unsigned char *blob; 276 u_char *blob;
277 unsigned int blen; 277 u_int blen;
278 Key *key = NULL; 278 Key *key = NULL;
279 279
280 /* Return failure if no more entries. */ 280 /* Return failure if no more entries. */
@@ -322,9 +322,9 @@ ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int versio
322int 322int
323ssh_decrypt_challenge(AuthenticationConnection *auth, 323ssh_decrypt_challenge(AuthenticationConnection *auth,
324 Key* key, BIGNUM *challenge, 324 Key* key, BIGNUM *challenge,
325 unsigned char session_id[16], 325 u_char session_id[16],
326 unsigned int response_type, 326 u_int response_type,
327 unsigned char response[16]) 327 u_char response[16])
328{ 328{
329 Buffer buffer; 329 Buffer buffer;
330 int success = 0; 330 int success = 0;
@@ -373,13 +373,13 @@ ssh_decrypt_challenge(AuthenticationConnection *auth,
373int 373int
374ssh_agent_sign(AuthenticationConnection *auth, 374ssh_agent_sign(AuthenticationConnection *auth,
375 Key *key, 375 Key *key,
376 unsigned char **sigp, int *lenp, 376 u_char **sigp, int *lenp,
377 unsigned char *data, int datalen) 377 u_char *data, int datalen)
378{ 378{
379 extern int datafellows; 379 extern int datafellows;
380 Buffer msg; 380 Buffer msg;
381 unsigned char *blob; 381 u_char *blob;
382 unsigned int blen; 382 u_int blen;
383 int type, flags = 0; 383 int type, flags = 0;
384 int ret = -1; 384 int ret = -1;
385 385
@@ -502,8 +502,8 @@ ssh_remove_identity(AuthenticationConnection *auth, Key *key)
502{ 502{
503 Buffer msg; 503 Buffer msg;
504 int type; 504 int type;
505 unsigned char *blob; 505 u_char *blob;
506 unsigned int blen; 506 u_int blen;
507 507
508 buffer_init(&msg); 508 buffer_init(&msg);
509 509
diff --git a/authfd.h b/authfd.h
index 65471ad7c..29d1847b5 100644
--- a/authfd.h
+++ b/authfd.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: authfd.h,v 1.14 2000/11/12 19:50:37 markus Exp $"); */ 14/* RCSID("$OpenBSD: authfd.h,v 1.16 2000/12/20 19:37:21 markus Exp $"); */
15 15
16#ifndef AUTHFD_H 16#ifndef AUTHFD_H
17#define AUTHFD_H 17#define AUTHFD_H
@@ -51,7 +51,7 @@ typedef struct {
51} AuthenticationConnection; 51} AuthenticationConnection;
52 52
53/* Returns the number of the authentication fd, or -1 if there is none. */ 53/* Returns the number of the authentication fd, or -1 if there is none. */
54int ssh_get_authentication_socket(); 54int ssh_get_authentication_socket(void);
55 55
56/* 56/*
57 * This should be called for any descriptor returned by 57 * This should be called for any descriptor returned by
@@ -66,7 +66,7 @@ void ssh_close_authentication_socket(int authfd);
66 * connection could not be opened. The connection should be closed by the 66 * connection could not be opened. The connection should be closed by the
67 * caller by calling ssh_close_authentication_connection(). 67 * caller by calling ssh_close_authentication_connection().
68 */ 68 */
69AuthenticationConnection *ssh_get_authentication_connection(); 69AuthenticationConnection *ssh_get_authentication_connection(void);
70 70
71/* 71/*
72 * Closes the connection to the authentication agent and frees any associated 72 * Closes the connection to the authentication agent and frees any associated
@@ -101,16 +101,16 @@ Key *ssh_get_next_identity(AuthenticationConnection *auth, char **comment, int v
101int 101int
102ssh_decrypt_challenge(AuthenticationConnection *auth, 102ssh_decrypt_challenge(AuthenticationConnection *auth,
103 Key *key, BIGNUM * challenge, 103 Key *key, BIGNUM * challenge,
104 unsigned char session_id[16], 104 u_char session_id[16],
105 unsigned int response_type, 105 u_int response_type,
106 unsigned char response[16]); 106 u_char response[16]);
107 107
108/* Requests the agent to sign data using key */ 108/* Requests the agent to sign data using key */
109int 109int
110ssh_agent_sign(AuthenticationConnection *auth, 110ssh_agent_sign(AuthenticationConnection *auth,
111 Key *key, 111 Key *key,
112 unsigned char **sigp, int *lenp, 112 u_char **sigp, int *lenp,
113 unsigned char *data, int datalen); 113 u_char *data, int datalen);
114 114
115/* 115/*
116 * Adds an identity to the authentication server. This call is not meant to 116 * Adds an identity to the authentication server. This call is not meant to
diff --git a/authfile.c b/authfile.c
index 86dcdee28..7a1b74a7f 100644
--- a/authfile.c
+++ b/authfile.c
@@ -131,8 +131,8 @@ save_private_key_rsa1(const char *filename, const char *passphrase,
131 buffer_append_space(&encrypted, &cp, buffer_len(&buffer)); 131 buffer_append_space(&encrypted, &cp, buffer_len(&buffer));
132 132
133 cipher_set_key_string(&ciphercontext, cipher, passphrase); 133 cipher_set_key_string(&ciphercontext, cipher, passphrase);
134 cipher_encrypt(&ciphercontext, (unsigned char *) cp, 134 cipher_encrypt(&ciphercontext, (u_char *) cp,
135 (unsigned char *) buffer_ptr(&buffer), buffer_len(&buffer)); 135 (u_char *) buffer_ptr(&buffer), buffer_len(&buffer));
136 memset(&ciphercontext, 0, sizeof(ciphercontext)); 136 memset(&ciphercontext, 0, sizeof(ciphercontext));
137 137
138 /* Destroy temporary data. */ 138 /* Destroy temporary data. */
@@ -258,7 +258,7 @@ load_public_key_rsa(const char *filename, RSA * pub, char **comment_return)
258 * Make sure it begins with the id string. Consume the id string 258 * Make sure it begins with the id string. Consume the id string
259 * from the buffer. 259 * from the buffer.
260 */ 260 */
261 for (i = 0; i < (unsigned int) strlen(AUTHFILE_ID_STRING) + 1; i++) 261 for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)
262 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) { 262 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {
263 debug3("Bad RSA1 key file %.200s.", filename); 263 debug3("Bad RSA1 key file %.200s.", filename);
264 buffer_free(&buffer); 264 buffer_free(&buffer);
@@ -348,7 +348,7 @@ load_private_key_rsa1(int fd, const char *filename,
348 * Make sure it begins with the id string. Consume the id string 348 * Make sure it begins with the id string. Consume the id string
349 * from the buffer. 349 * from the buffer.
350 */ 350 */
351 for (i = 0; i < (unsigned int) strlen(AUTHFILE_ID_STRING) + 1; i++) 351 for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++)
352 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) { 352 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {
353 debug3("Bad RSA1 key file %.200s.", filename); 353 debug3("Bad RSA1 key file %.200s.", filename);
354 buffer_free(&buffer); 354 buffer_free(&buffer);
@@ -383,8 +383,8 @@ load_private_key_rsa1(int fd, const char *filename,
383 383
384 /* Rest of the buffer is encrypted. Decrypt it using the passphrase. */ 384 /* Rest of the buffer is encrypted. Decrypt it using the passphrase. */
385 cipher_set_key_string(&ciphercontext, cipher, passphrase); 385 cipher_set_key_string(&ciphercontext, cipher, passphrase);
386 cipher_decrypt(&ciphercontext, (unsigned char *) cp, 386 cipher_decrypt(&ciphercontext, (u_char *) cp,
387 (unsigned char *) buffer_ptr(&buffer), buffer_len(&buffer)); 387 (u_char *) buffer_ptr(&buffer), buffer_len(&buffer));
388 memset(&ciphercontext, 0, sizeof(ciphercontext)); 388 memset(&ciphercontext, 0, sizeof(ciphercontext));
389 buffer_free(&buffer); 389 buffer_free(&buffer);
390 390
@@ -508,7 +508,7 @@ load_private_key(const char *filename, const char *passphrase, Key *key,
508 if (check_ntsec(filename)) 508 if (check_ntsec(filename))
509#endif 509#endif
510 if (fstat(fd, &st) < 0 || 510 if (fstat(fd, &st) < 0 ||
511 (st.st_uid != 0 && st.st_uid != getuid()) || 511 (st.st_uid != 0 && getuid() != 0 && st.st_uid != getuid()) ||
512 (st.st_mode & 077) != 0) { 512 (st.st_mode & 077) != 0) {
513 close(fd); 513 close(fd);
514 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 514 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
diff --git a/bufaux.c b/bufaux.c
index a3f220f89..5853ee600 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: bufaux.c,v 1.13 2000/09/07 20:27:50 deraadt Exp $"); 40RCSID("$OpenBSD: bufaux.c,v 1.14 2000/12/19 23:17:55 markus Exp $");
41 41
42#include "ssh.h" 42#include "ssh.h"
43#include <openssl/bn.h> 43#include <openssl/bn.h>
@@ -54,7 +54,7 @@ buffer_put_bignum(Buffer *buffer, BIGNUM *value)
54{ 54{
55 int bits = BN_num_bits(value); 55 int bits = BN_num_bits(value);
56 int bin_size = (bits + 7) / 8; 56 int bin_size = (bits + 7) / 8;
57 char unsigned *buf = xmalloc(bin_size); 57 u_char *buf = xmalloc(bin_size);
58 int oi; 58 int oi;
59 char msg[2]; 59 char msg[2];
60 60
@@ -81,7 +81,7 @@ int
81buffer_get_bignum(Buffer *buffer, BIGNUM *value) 81buffer_get_bignum(Buffer *buffer, BIGNUM *value)
82{ 82{
83 int bits, bytes; 83 int bits, bytes;
84 unsigned char buf[2], *bin; 84 u_char buf[2], *bin;
85 85
86 /* Get the number for bits. */ 86 /* Get the number for bits. */
87 buffer_get(buffer, (char *) buf, 2); 87 buffer_get(buffer, (char *) buf, 2);
@@ -90,7 +90,7 @@ buffer_get_bignum(Buffer *buffer, BIGNUM *value)
90 bytes = (bits + 7) / 8; 90 bytes = (bits + 7) / 8;
91 if (buffer_len(buffer) < bytes) 91 if (buffer_len(buffer) < bytes)
92 fatal("buffer_get_bignum: input buffer too small"); 92 fatal("buffer_get_bignum: input buffer too small");
93 bin = (unsigned char*) buffer_ptr(buffer); 93 bin = (u_char*) buffer_ptr(buffer);
94 BN_bin2bn(bin, bytes, value); 94 BN_bin2bn(bin, bytes, value);
95 buffer_consume(buffer, bytes); 95 buffer_consume(buffer, bytes);
96 96
@@ -104,7 +104,7 @@ void
104buffer_put_bignum2(Buffer *buffer, BIGNUM *value) 104buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
105{ 105{
106 int bytes = BN_num_bytes(value) + 1; 106 int bytes = BN_num_bytes(value) + 1;
107 unsigned char *buf = xmalloc(bytes); 107 u_char *buf = xmalloc(bytes);
108 int oi; 108 int oi;
109 int hasnohigh = 0; 109 int hasnohigh = 0;
110 buf[0] = '\0'; 110 buf[0] = '\0';
@@ -117,7 +117,7 @@ buffer_put_bignum2(Buffer *buffer, BIGNUM *value)
117 if (value->neg) { 117 if (value->neg) {
118 /**XXX should be two's-complement */ 118 /**XXX should be two's-complement */
119 int i, carry; 119 int i, carry;
120 unsigned char *uc = buf; 120 u_char *uc = buf;
121 log("negativ!"); 121 log("negativ!");
122 for(i = bytes-1, carry = 1; i>=0; i--) { 122 for(i = bytes-1, carry = 1; i>=0; i--) {
123 uc[i] ^= 0xff; 123 uc[i] ^= 0xff;
@@ -135,7 +135,7 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
135{ 135{
136 /**XXX should be two's-complement */ 136 /**XXX should be two's-complement */
137 int len; 137 int len;
138 unsigned char *bin = (unsigned char *)buffer_get_string(buffer, (unsigned int *)&len); 138 u_char *bin = (u_char *)buffer_get_string(buffer, (u_int *)&len);
139 BN_bin2bn(bin, len, value); 139 BN_bin2bn(bin, len, value);
140 xfree(bin); 140 xfree(bin);
141 return len; 141 return len;
@@ -144,10 +144,10 @@ buffer_get_bignum2(Buffer *buffer, BIGNUM *value)
144/* 144/*
145 * Returns an integer from the buffer (4 bytes, msb first). 145 * Returns an integer from the buffer (4 bytes, msb first).
146 */ 146 */
147unsigned int 147u_int
148buffer_get_int(Buffer *buffer) 148buffer_get_int(Buffer *buffer)
149{ 149{
150 unsigned char buf[4]; 150 u_char buf[4];
151 buffer_get(buffer, (char *) buf, 4); 151 buffer_get(buffer, (char *) buf, 4);
152 return GET_32BIT(buf); 152 return GET_32BIT(buf);
153} 153}
@@ -156,7 +156,7 @@ buffer_get_int(Buffer *buffer)
156 * Stores an integer in the buffer in 4 bytes, msb first. 156 * Stores an integer in the buffer in 4 bytes, msb first.
157 */ 157 */
158void 158void
159buffer_put_int(Buffer *buffer, unsigned int value) 159buffer_put_int(Buffer *buffer, u_int value)
160{ 160{
161 char buf[4]; 161 char buf[4];
162 PUT_32BIT(buf, value); 162 PUT_32BIT(buf, value);
@@ -172,9 +172,9 @@ buffer_put_int(Buffer *buffer, unsigned int value)
172 * to the returned string, and is not counted in length. 172 * to the returned string, and is not counted in length.
173 */ 173 */
174char * 174char *
175buffer_get_string(Buffer *buffer, unsigned int *length_ptr) 175buffer_get_string(Buffer *buffer, u_int *length_ptr)
176{ 176{
177 unsigned int len; 177 u_int len;
178 char *value; 178 char *value;
179 /* Get the length. */ 179 /* Get the length. */
180 len = buffer_get_int(buffer); 180 len = buffer_get_int(buffer);
@@ -196,7 +196,7 @@ buffer_get_string(Buffer *buffer, unsigned int *length_ptr)
196 * Stores and arbitrary binary string in the buffer. 196 * Stores and arbitrary binary string in the buffer.
197 */ 197 */
198void 198void
199buffer_put_string(Buffer *buffer, const void *buf, unsigned int len) 199buffer_put_string(Buffer *buffer, const void *buf, u_int len)
200{ 200{
201 buffer_put_int(buffer, len); 201 buffer_put_int(buffer, len);
202 buffer_append(buffer, buf, len); 202 buffer_append(buffer, buf, len);
@@ -215,7 +215,7 @@ buffer_get_char(Buffer *buffer)
215{ 215{
216 char ch; 216 char ch;
217 buffer_get(buffer, &ch, 1); 217 buffer_get(buffer, &ch, 1);
218 return (unsigned char) ch; 218 return (u_char) ch;
219} 219}
220 220
221/* 221/*
diff --git a/bufaux.h b/bufaux.h
index 4f53858f7..6c73d4fb3 100644
--- a/bufaux.h
+++ b/bufaux.h
@@ -10,7 +10,7 @@
10 * called by a name other than "ssh" or "Secure Shell". 10 * called by a name other than "ssh" or "Secure Shell".
11 */ 11 */
12 12
13/* RCSID("$OpenBSD: bufaux.h,v 1.8 2000/09/07 20:27:50 deraadt Exp $"); */ 13/* RCSID("$OpenBSD: bufaux.h,v 1.9 2000/12/19 23:17:55 markus Exp $"); */
14 14
15#ifndef BUFAUX_H 15#ifndef BUFAUX_H
16#define BUFAUX_H 16#define BUFAUX_H
@@ -29,10 +29,10 @@ int buffer_get_bignum(Buffer * buffer, BIGNUM * value);
29int buffer_get_bignum2(Buffer *buffer, BIGNUM * value); 29int buffer_get_bignum2(Buffer *buffer, BIGNUM * value);
30 30
31/* Returns an integer from the buffer (4 bytes, msb first). */ 31/* Returns an integer from the buffer (4 bytes, msb first). */
32unsigned int buffer_get_int(Buffer * buffer); 32u_int buffer_get_int(Buffer * buffer);
33 33
34/* Stores an integer in the buffer in 4 bytes, msb first. */ 34/* Stores an integer in the buffer in 4 bytes, msb first. */
35void buffer_put_int(Buffer * buffer, unsigned int value); 35void buffer_put_int(Buffer * buffer, u_int value);
36 36
37/* Returns a character from the buffer (0 - 255). */ 37/* Returns a character from the buffer (0 - 255). */
38int buffer_get_char(Buffer * buffer); 38int buffer_get_char(Buffer * buffer);
@@ -48,10 +48,10 @@ void buffer_put_char(Buffer * buffer, int value);
48 * stored there. A null character will be automatically appended to the 48 * stored there. A null character will be automatically appended to the
49 * returned string, and is not counted in length. 49 * returned string, and is not counted in length.
50 */ 50 */
51char *buffer_get_string(Buffer * buffer, unsigned int *length_ptr); 51char *buffer_get_string(Buffer * buffer, u_int *length_ptr);
52 52
53/* Stores and arbitrary binary string in the buffer. */ 53/* Stores and arbitrary binary string in the buffer. */
54void buffer_put_string(Buffer * buffer, const void *buf, unsigned int len); 54void buffer_put_string(Buffer * buffer, const void *buf, u_int len);
55void buffer_put_cstring(Buffer *buffer, const char *s); 55void buffer_put_cstring(Buffer *buffer, const char *s);
56 56
57#endif /* BUFAUX_H */ 57#endif /* BUFAUX_H */
diff --git a/buffer.c b/buffer.c
index d993c8bcd..668c17383 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: buffer.c,v 1.8 2000/09/07 20:27:50 deraadt Exp $"); 15RCSID("$OpenBSD: buffer.c,v 1.9 2000/12/19 23:17:55 markus Exp $");
16 16
17#include "xmalloc.h" 17#include "xmalloc.h"
18#include "buffer.h" 18#include "buffer.h"
@@ -53,7 +53,7 @@ buffer_clear(Buffer *buffer)
53/* Appends data to the buffer, expanding it if necessary. */ 53/* Appends data to the buffer, expanding it if necessary. */
54 54
55void 55void
56buffer_append(Buffer *buffer, const char *data, unsigned int len) 56buffer_append(Buffer *buffer, const char *data, u_int len)
57{ 57{
58 char *cp; 58 char *cp;
59 buffer_append_space(buffer, &cp, len); 59 buffer_append_space(buffer, &cp, len);
@@ -67,7 +67,7 @@ buffer_append(Buffer *buffer, const char *data, unsigned int len)
67 */ 67 */
68 68
69void 69void
70buffer_append_space(Buffer *buffer, char **datap, unsigned int len) 70buffer_append_space(Buffer *buffer, char **datap, u_int len)
71{ 71{
72 /* If the buffer is empty, start using it from the beginning. */ 72 /* If the buffer is empty, start using it from the beginning. */
73 if (buffer->offset == buffer->end) { 73 if (buffer->offset == buffer->end) {
@@ -100,7 +100,7 @@ restart:
100 100
101/* Returns the number of bytes of data in the buffer. */ 101/* Returns the number of bytes of data in the buffer. */
102 102
103unsigned int 103u_int
104buffer_len(Buffer *buffer) 104buffer_len(Buffer *buffer)
105{ 105{
106 return buffer->end - buffer->offset; 106 return buffer->end - buffer->offset;
@@ -109,7 +109,7 @@ buffer_len(Buffer *buffer)
109/* Gets data from the beginning of the buffer. */ 109/* Gets data from the beginning of the buffer. */
110 110
111void 111void
112buffer_get(Buffer *buffer, char *buf, unsigned int len) 112buffer_get(Buffer *buffer, char *buf, u_int len)
113{ 113{
114 if (len > buffer->end - buffer->offset) 114 if (len > buffer->end - buffer->offset)
115 fatal("buffer_get: trying to get more bytes than in buffer"); 115 fatal("buffer_get: trying to get more bytes than in buffer");
@@ -120,7 +120,7 @@ buffer_get(Buffer *buffer, char *buf, unsigned int len)
120/* Consumes the given number of bytes from the beginning of the buffer. */ 120/* Consumes the given number of bytes from the beginning of the buffer. */
121 121
122void 122void
123buffer_consume(Buffer *buffer, unsigned int bytes) 123buffer_consume(Buffer *buffer, u_int bytes)
124{ 124{
125 if (bytes > buffer->end - buffer->offset) 125 if (bytes > buffer->end - buffer->offset)
126 fatal("buffer_consume: trying to get more bytes than in buffer"); 126 fatal("buffer_consume: trying to get more bytes than in buffer");
@@ -130,7 +130,7 @@ buffer_consume(Buffer *buffer, unsigned int bytes)
130/* Consumes the given number of bytes from the end of the buffer. */ 130/* Consumes the given number of bytes from the end of the buffer. */
131 131
132void 132void
133buffer_consume_end(Buffer *buffer, unsigned int bytes) 133buffer_consume_end(Buffer *buffer, u_int bytes)
134{ 134{
135 if (bytes > buffer->end - buffer->offset) 135 if (bytes > buffer->end - buffer->offset)
136 fatal("buffer_consume_end: trying to get more bytes than in buffer"); 136 fatal("buffer_consume_end: trying to get more bytes than in buffer");
@@ -151,7 +151,7 @@ void
151buffer_dump(Buffer *buffer) 151buffer_dump(Buffer *buffer)
152{ 152{
153 int i; 153 int i;
154 unsigned char *ucp = (unsigned char *) buffer->buf; 154 u_char *ucp = (u_char *) buffer->buf;
155 155
156 for (i = buffer->offset; i < buffer->end; i++) 156 for (i = buffer->offset; i < buffer->end; i++)
157 fprintf(stderr, " %02x", ucp[i]); 157 fprintf(stderr, " %02x", ucp[i]);
diff --git a/buffer.h b/buffer.h
index 522036a41..f3c509dfa 100644
--- a/buffer.h
+++ b/buffer.h
@@ -11,16 +11,16 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: buffer.h,v 1.6 2000/09/07 20:27:50 deraadt Exp $"); */ 14/* RCSID("$OpenBSD: buffer.h,v 1.7 2000/12/19 23:17:55 markus Exp $"); */
15 15
16#ifndef BUFFER_H 16#ifndef BUFFER_H
17#define BUFFER_H 17#define BUFFER_H
18 18
19typedef struct { 19typedef struct {
20 char *buf; /* Buffer for data. */ 20 char *buf; /* Buffer for data. */
21 unsigned int alloc; /* Number of bytes allocated for data. */ 21 u_int alloc; /* Number of bytes allocated for data. */
22 unsigned int offset; /* Offset of first byte containing data. */ 22 u_int offset; /* Offset of first byte containing data. */
23 unsigned int end; /* Offset of last byte containing data. */ 23 u_int end; /* Offset of last byte containing data. */
24} Buffer; 24} Buffer;
25/* Initializes the buffer structure. */ 25/* Initializes the buffer structure. */
26void buffer_init(Buffer * buffer); 26void buffer_init(Buffer * buffer);
@@ -33,26 +33,26 @@ void buffer_free(Buffer * buffer);
33void buffer_clear(Buffer * buffer); 33void buffer_clear(Buffer * buffer);
34 34
35/* Appends data to the buffer, expanding it if necessary. */ 35/* Appends data to the buffer, expanding it if necessary. */
36void buffer_append(Buffer * buffer, const char *data, unsigned int len); 36void buffer_append(Buffer * buffer, const char *data, u_int len);
37 37
38/* 38/*
39 * Appends space to the buffer, expanding the buffer if necessary. This does 39 * Appends space to the buffer, expanding the buffer if necessary. This does
40 * not actually copy the data into the buffer, but instead returns a pointer 40 * not actually copy the data into the buffer, but instead returns a pointer
41 * to the allocated region. 41 * to the allocated region.
42 */ 42 */
43void buffer_append_space(Buffer * buffer, char **datap, unsigned int len); 43void buffer_append_space(Buffer * buffer, char **datap, u_int len);
44 44
45/* Returns the number of bytes of data in the buffer. */ 45/* Returns the number of bytes of data in the buffer. */
46unsigned int buffer_len(Buffer * buffer); 46u_int buffer_len(Buffer * buffer);
47 47
48/* Gets data from the beginning of the buffer. */ 48/* Gets data from the beginning of the buffer. */
49void buffer_get(Buffer * buffer, char *buf, unsigned int len); 49void buffer_get(Buffer * buffer, char *buf, u_int len);
50 50
51/* Consumes the given number of bytes from the beginning of the buffer. */ 51/* Consumes the given number of bytes from the beginning of the buffer. */
52void buffer_consume(Buffer * buffer, unsigned int bytes); 52void buffer_consume(Buffer * buffer, u_int bytes);
53 53
54/* Consumes the given number of bytes from the end of the buffer. */ 54/* Consumes the given number of bytes from the end of the buffer. */
55void buffer_consume_end(Buffer * buffer, unsigned int bytes); 55void buffer_consume_end(Buffer * buffer, u_int bytes);
56 56
57/* Returns a pointer to the first used byte in the buffer. */ 57/* Returns a pointer to the first used byte in the buffer. */
58char *buffer_ptr(Buffer * buffer); 58char *buffer_ptr(Buffer * buffer);
diff --git a/canohost.c b/canohost.c
index 6d36dd11a..506446d05 100644
--- a/canohost.c
+++ b/canohost.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: canohost.c,v 1.16 2000/10/21 17:04:22 markus Exp $"); 15RCSID("$OpenBSD: canohost.c,v 1.17 2000/12/19 23:17:55 markus Exp $");
16 16
17#include "packet.h" 17#include "packet.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -136,7 +136,7 @@ check_ip_options:
136 */ 136 */
137 /* IP options -- IPv4 only */ 137 /* IP options -- IPv4 only */
138 if (from.ss_family == AF_INET) { 138 if (from.ss_family == AF_INET) {
139 unsigned char options[200], *ucp; 139 u_char options[200], *ucp;
140 char text[1024], *cp; 140 char text[1024], *cp;
141 socklen_t option_size; 141 socklen_t option_size;
142 int ipproto; 142 int ipproto;
diff --git a/channels.c b/channels.c
index 8c0a7a455..3c2f15f2a 100644
--- a/channels.c
+++ b/channels.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: channels.c,v 1.76 2000/12/19 22:43:44 markus Exp $"); 43RCSID("$OpenBSD: channels.c,v 1.77 2000/12/19 23:17:56 markus Exp $");
44 44
45#include "ssh.h" 45#include "ssh.h"
46#include "packet.h" 46#include "packet.h"
@@ -95,14 +95,14 @@ char *x11_saved_proto = NULL;
95 95
96/* Saved X11 authentication data. This is the real data. */ 96/* Saved X11 authentication data. This is the real data. */
97char *x11_saved_data = NULL; 97char *x11_saved_data = NULL;
98unsigned int x11_saved_data_len = 0; 98u_int x11_saved_data_len = 0;
99 99
100/* 100/*
101 * Fake X11 authentication data. This is what the server will be sending us; 101 * Fake X11 authentication data. This is what the server will be sending us;
102 * we should replace any occurrences of this by the real data. 102 * we should replace any occurrences of this by the real data.
103 */ 103 */
104char *x11_fake_data = NULL; 104char *x11_fake_data = NULL;
105unsigned int x11_fake_data_len; 105u_int x11_fake_data_len;
106 106
107/* 107/*
108 * Data structure for storing which hosts are permitted for forward requests. 108 * Data structure for storing which hosts are permitted for forward requests.
@@ -436,15 +436,15 @@ channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset)
436int 436int
437x11_open_helper(Channel *c) 437x11_open_helper(Channel *c)
438{ 438{
439 unsigned char *ucp; 439 u_char *ucp;
440 unsigned int proto_len, data_len; 440 u_int proto_len, data_len;
441 441
442 /* Check if the fixed size part of the packet is in buffer. */ 442 /* Check if the fixed size part of the packet is in buffer. */
443 if (buffer_len(&c->output) < 12) 443 if (buffer_len(&c->output) < 12)
444 return 0; 444 return 0;
445 445
446 /* Parse the lengths of variable-length fields. */ 446 /* Parse the lengths of variable-length fields. */
447 ucp = (unsigned char *) buffer_ptr(&c->output); 447 ucp = (u_char *) buffer_ptr(&c->output);
448 if (ucp[0] == 0x42) { /* Byte order MSB first. */ 448 if (ucp[0] == 0x42) { /* Byte order MSB first. */
449 proto_len = 256 * ucp[6] + ucp[7]; 449 proto_len = 256 * ucp[6] + ucp[7];
450 data_len = 256 * ucp[8] + ucp[9]; 450 data_len = 256 * ucp[8] + ucp[9];
@@ -1066,7 +1066,7 @@ channel_input_data(int type, int plen, void *ctxt)
1066{ 1066{
1067 int id; 1067 int id;
1068 char *data; 1068 char *data;
1069 unsigned int data_len; 1069 u_int data_len;
1070 Channel *c; 1070 Channel *c;
1071 1071
1072 /* Get the channel number and verify it. */ 1072 /* Get the channel number and verify it. */
@@ -1112,7 +1112,7 @@ channel_input_extended_data(int type, int plen, void *ctxt)
1112 int id; 1112 int id;
1113 int tcode; 1113 int tcode;
1114 char *data; 1114 char *data;
1115 unsigned int data_len; 1115 u_int data_len;
1116 Channel *c; 1116 Channel *c;
1117 1117
1118 /* Get the channel number and verify it. */ 1118 /* Get the channel number and verify it. */
@@ -1155,7 +1155,7 @@ channel_input_extended_data(int type, int plen, void *ctxt)
1155int 1155int
1156channel_not_very_much_buffered_data() 1156channel_not_very_much_buffered_data()
1157{ 1157{
1158 unsigned int i; 1158 u_int i;
1159 Channel *c; 1159 Channel *c;
1160 1160
1161 for (i = 0; i < channels_alloc; i++) { 1161 for (i = 0; i < channels_alloc; i++) {
@@ -1423,7 +1423,7 @@ channel_max_fd()
1423int 1423int
1424channel_still_open() 1424channel_still_open()
1425{ 1425{
1426 unsigned int i; 1426 u_int i;
1427 for (i = 0; i < channels_alloc; i++) 1427 for (i = 0; i < channels_alloc; i++)
1428 switch (channels[i].type) { 1428 switch (channels[i].type) {
1429 case SSH_CHANNEL_FREE: 1429 case SSH_CHANNEL_FREE:
@@ -1786,7 +1786,7 @@ channel_input_port_open(int type, int plen, void *ctxt)
1786 u_short host_port; 1786 u_short host_port;
1787 char *host, *originator_string; 1787 char *host, *originator_string;
1788 int remote_channel, sock = -1, newch, i, denied; 1788 int remote_channel, sock = -1, newch, i, denied;
1789 unsigned int host_len, originator_len; 1789 u_int host_len, originator_len;
1790 1790
1791 /* Get remote channel number. */ 1791 /* Get remote channel number. */
1792 remote_channel = packet_get_int(); 1792 remote_channel = packet_get_int();
@@ -1996,7 +1996,7 @@ x11_create_display_inet(int screen_number, int x11_display_offset)
1996 1996
1997static 1997static
1998int 1998int
1999connect_local_xsocket(unsigned int dnr) 1999connect_local_xsocket(u_int dnr)
2000{ 2000{
2001 static const char *const x_sockets[] = { 2001 static const char *const x_sockets[] = {
2002 X_UNIX_PATH "%u", 2002 X_UNIX_PATH "%u",
@@ -2129,7 +2129,7 @@ x11_input_open(int type, int plen, void *ctxt)
2129{ 2129{
2130 int remote_channel, sock = 0, newch; 2130 int remote_channel, sock = 0, newch;
2131 char *remote_host; 2131 char *remote_host;
2132 unsigned int remote_len; 2132 u_int remote_len;
2133 2133
2134 /* Get remote channel number. */ 2134 /* Get remote channel number. */
2135 remote_channel = packet_get_int(); 2135 remote_channel = packet_get_int();
@@ -2200,8 +2200,8 @@ void
2200x11_request_forwarding_with_spoofing(int client_session_id, 2200x11_request_forwarding_with_spoofing(int client_session_id,
2201 const char *proto, const char *data) 2201 const char *proto, const char *data)
2202{ 2202{
2203 unsigned int data_len = (unsigned int) strlen(data) / 2; 2203 u_int data_len = (u_int) strlen(data) / 2;
2204 unsigned int i, value; 2204 u_int i, value;
2205 char *new_data; 2205 char *new_data;
2206 int screen_number; 2206 int screen_number;
2207 const char *cp; 2207 const char *cp;
@@ -2241,7 +2241,7 @@ x11_request_forwarding_with_spoofing(int client_session_id,
2241 /* Convert the fake data into hex. */ 2241 /* Convert the fake data into hex. */
2242 new_data = xmalloc(2 * data_len + 1); 2242 new_data = xmalloc(2 * data_len + 1);
2243 for (i = 0; i < data_len; i++) 2243 for (i = 0; i < data_len; i++)
2244 sprintf(new_data + 2 * i, "%02x", (unsigned char) x11_fake_data[i]); 2244 sprintf(new_data + 2 * i, "%02x", (u_char) x11_fake_data[i]);
2245 2245
2246 /* Send the request packet. */ 2246 /* Send the request packet. */
2247 if (compat20) { 2247 if (compat20) {
diff --git a/cipher.c b/cipher.c
index 788028c13..89e3c279f 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: cipher.c,v 1.40 2000/12/09 13:41:52 markus Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.41 2000/12/19 23:17:56 markus Exp $");
39 39
40#include "ssh.h" 40#include "ssh.h"
41#include "xmalloc.h" 41#include "xmalloc.h"
@@ -177,7 +177,7 @@ des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src,
177void 177void
178blowfish_setkey(CipherContext *cc, const u_char *key, u_int keylen) 178blowfish_setkey(CipherContext *cc, const u_char *key, u_int keylen)
179{ 179{
180 BF_set_key(&cc->u.bf.key, keylen, (unsigned char *)key); 180 BF_set_key(&cc->u.bf.key, keylen, (u_char *)key);
181} 181}
182void 182void
183blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) 183blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen)
@@ -207,7 +207,7 @@ blowfish_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src,
207 * and after encryption/decryption. Thus the swap_bytes stuff (yuk). 207 * and after encryption/decryption. Thus the swap_bytes stuff (yuk).
208 */ 208 */
209static void 209static void
210swap_bytes(const unsigned char *src, unsigned char *dst, int n) 210swap_bytes(const u_char *src, u_char *dst, int n)
211{ 211{
212 char c[4]; 212 char c[4];
213 213
@@ -260,7 +260,7 @@ arcfour_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len)
260void 260void
261cast_setkey(CipherContext *cc, const u_char *key, u_int keylen) 261cast_setkey(CipherContext *cc, const u_char *key, u_int keylen)
262{ 262{
263 CAST_set_key(&cc->u.cast.key, keylen, (unsigned char *) key); 263 CAST_set_key(&cc->u.cast.key, keylen, (u_char *) key);
264} 264}
265void 265void
266cast_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) 266cast_setiv(CipherContext *cc, const u_char *iv, u_int ivlen)
@@ -419,10 +419,10 @@ Cipher ciphers[] = {
419 419
420/*--*/ 420/*--*/
421 421
422unsigned int 422u_int
423cipher_mask_ssh1(int client) 423cipher_mask_ssh1(int client)
424{ 424{
425 unsigned int mask = 0; 425 u_int mask = 0;
426 mask |= 1 << SSH_CIPHER_3DES; /* Mandatory */ 426 mask |= 1 << SSH_CIPHER_3DES; /* Mandatory */
427 mask |= 1 << SSH_CIPHER_BLOWFISH; 427 mask |= 1 << SSH_CIPHER_BLOWFISH;
428 if (client) { 428 if (client) {
@@ -541,7 +541,7 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher,
541 const char *passphrase) 541 const char *passphrase)
542{ 542{
543 MD5_CTX md; 543 MD5_CTX md;
544 unsigned char digest[16]; 544 u_char digest[16];
545 545
546 MD5_Init(&md); 546 MD5_Init(&md);
547 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); 547 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
diff --git a/cipher.h b/cipher.h
index 752d0347e..6d929aaff 100644
--- a/cipher.h
+++ b/cipher.h
@@ -32,7 +32,7 @@
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35/* RCSID("$OpenBSD: cipher.h,v 1.24 2000/12/09 13:41:52 markus Exp $"); */ 35/* RCSID("$OpenBSD: cipher.h,v 1.25 2000/12/19 23:17:56 markus Exp $"); */
36 36
37#ifndef CIPHER_H 37#ifndef CIPHER_H
38#define CIPHER_H 38#define CIPHER_H
@@ -103,7 +103,7 @@ struct Cipher {
103 void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int); 103 void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int);
104}; 104};
105 105
106unsigned int cipher_mask_ssh1(int client); 106u_int cipher_mask_ssh1(int client);
107Cipher *cipher_by_name(const char *name); 107Cipher *cipher_by_name(const char *name);
108Cipher *cipher_by_number(int id); 108Cipher *cipher_by_number(int id);
109int cipher_number(const char *name); 109int cipher_number(const char *name);
diff --git a/clientloop.c b/clientloop.c
index 3a0f977b0..44a79d0e0 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.41 2000/12/05 20:34:10 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.42 2000/12/19 23:17:56 markus Exp $");
63 63
64#include "xmalloc.h" 64#include "xmalloc.h"
65#include "ssh.h" 65#include "ssh.h"
@@ -123,8 +123,8 @@ static int stdin_eof; /* EOF has been encountered on standard error. */
123static Buffer stdin_buffer; /* Buffer for stdin data. */ 123static Buffer stdin_buffer; /* Buffer for stdin data. */
124static Buffer stdout_buffer; /* Buffer for stdout data. */ 124static Buffer stdout_buffer; /* Buffer for stdout data. */
125static Buffer stderr_buffer; /* Buffer for stderr data. */ 125static Buffer stderr_buffer; /* Buffer for stderr data. */
126static unsigned long stdin_bytes, stdout_bytes, stderr_bytes; 126static u_long stdin_bytes, stdout_bytes, stderr_bytes;
127static unsigned int buffer_high;/* Soft max buffer size. */ 127static u_int buffer_high;/* Soft max buffer size. */
128static int max_fd; /* Maximum file descriptor number in select(). */ 128static int max_fd; /* Maximum file descriptor number in select(). */
129static int connection_in; /* Connection to server (input). */ 129static int connection_in; /* Connection to server (input). */
130static int connection_out; /* Connection to server (output). */ 130static int connection_out; /* Connection to server (output). */
@@ -280,7 +280,7 @@ client_check_initial_eof_on_stdin()
280 * and also process it as an escape character if 280 * and also process it as an escape character if
281 * appropriate. 281 * appropriate.
282 */ 282 */
283 if ((unsigned char) buf[0] == escape_char) 283 if ((u_char) buf[0] == escape_char)
284 escape_pending = 1; 284 escape_pending = 1;
285 else { 285 else {
286 buffer_append(&stdin_buffer, buf, 1); 286 buffer_append(&stdin_buffer, buf, 1);
@@ -300,7 +300,7 @@ client_check_initial_eof_on_stdin()
300void 300void
301client_make_packets_from_stdin_data() 301client_make_packets_from_stdin_data()
302{ 302{
303 unsigned int len; 303 u_int len;
304 304
305 /* Send buffered stdin data to the server. */ 305 /* Send buffered stdin data to the server. */
306 while (buffer_len(&stdin_buffer) > 0 && 306 while (buffer_len(&stdin_buffer) > 0 &&
@@ -522,8 +522,8 @@ process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
522 char string[1024]; 522 char string[1024];
523 pid_t pid; 523 pid_t pid;
524 int bytes = 0; 524 int bytes = 0;
525 unsigned int i; 525 u_int i;
526 unsigned char ch; 526 u_char ch;
527 char *s; 527 char *s;
528 528
529 for (i = 0; i < len; i++) { 529 for (i = 0; i < len; i++) {
@@ -984,7 +984,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
984void 984void
985client_input_stdout_data(int type, int plen, void *ctxt) 985client_input_stdout_data(int type, int plen, void *ctxt)
986{ 986{
987 unsigned int data_len; 987 u_int data_len;
988 char *data = packet_get_string(&data_len); 988 char *data = packet_get_string(&data_len);
989 packet_integrity_check(plen, 4 + data_len, type); 989 packet_integrity_check(plen, 4 + data_len, type);
990 buffer_append(&stdout_buffer, data, data_len); 990 buffer_append(&stdout_buffer, data, data_len);
@@ -995,7 +995,7 @@ client_input_stdout_data(int type, int plen, void *ctxt)
995void 995void
996client_input_stderr_data(int type, int plen, void *ctxt) 996client_input_stderr_data(int type, int plen, void *ctxt)
997{ 997{
998 unsigned int data_len; 998 u_int data_len;
999 char *data = packet_get_string(&data_len); 999 char *data = packet_get_string(&data_len);
1000 packet_integrity_check(plen, 4 + data_len, type); 1000 packet_integrity_check(plen, 4 + data_len, type);
1001 buffer_append(&stderr_buffer, data, data_len); 1001 buffer_append(&stderr_buffer, data, data_len);
@@ -1113,7 +1113,7 @@ client_input_channel_open(int type, int plen, void *ctxt)
1113{ 1113{
1114 Channel *c = NULL; 1114 Channel *c = NULL;
1115 char *ctype; 1115 char *ctype;
1116 unsigned int len; 1116 u_int len;
1117 int rchan; 1117 int rchan;
1118 int rmaxpack; 1118 int rmaxpack;
1119 int rwindow; 1119 int rwindow;
@@ -1213,7 +1213,7 @@ void
1213client_input_channel_req(int id, void *arg) 1213client_input_channel_req(int id, void *arg)
1214{ 1214{
1215 Channel *c = NULL; 1215 Channel *c = NULL;
1216 unsigned int len; 1216 u_int len;
1217 int success = 0; 1217 int success = 0;
1218 int reply; 1218 int reply;
1219 char *rtype; 1219 char *rtype;
diff --git a/compress.c b/compress.c
index 93266ed9f..3c05886e1 100644
--- a/compress.c
+++ b/compress.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: compress.c,v 1.9 2000/09/07 20:27:50 deraadt Exp $"); 15RCSID("$OpenBSD: compress.c,v 1.10 2000/12/19 23:17:56 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "buffer.h" 18#include "buffer.h"
@@ -73,13 +73,13 @@ buffer_compress(Buffer * input_buffer, Buffer * output_buffer)
73 return; 73 return;
74 74
75 /* Input is the contents of the input buffer. */ 75 /* Input is the contents of the input buffer. */
76 outgoing_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); 76 outgoing_stream.next_in = (u_char *) buffer_ptr(input_buffer);
77 outgoing_stream.avail_in = buffer_len(input_buffer); 77 outgoing_stream.avail_in = buffer_len(input_buffer);
78 78
79 /* Loop compressing until deflate() returns with avail_out != 0. */ 79 /* Loop compressing until deflate() returns with avail_out != 0. */
80 do { 80 do {
81 /* Set up fixed-size output buffer. */ 81 /* Set up fixed-size output buffer. */
82 outgoing_stream.next_out = (unsigned char *)buf; 82 outgoing_stream.next_out = (u_char *)buf;
83 outgoing_stream.avail_out = sizeof(buf); 83 outgoing_stream.avail_out = sizeof(buf);
84 84
85 /* Compress as much data into the buffer as possible. */ 85 /* Compress as much data into the buffer as possible. */
@@ -112,12 +112,12 @@ buffer_uncompress(Buffer * input_buffer, Buffer * output_buffer)
112 char buf[4096]; 112 char buf[4096];
113 int status; 113 int status;
114 114
115 incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); 115 incoming_stream.next_in = (u_char *) buffer_ptr(input_buffer);
116 incoming_stream.avail_in = buffer_len(input_buffer); 116 incoming_stream.avail_in = buffer_len(input_buffer);
117 117
118 for (;;) { 118 for (;;) {
119 /* Set up fixed-size output buffer. */ 119 /* Set up fixed-size output buffer. */
120 incoming_stream.next_out = (unsigned char *) buf; 120 incoming_stream.next_out = (u_char *) buf;
121 incoming_stream.avail_out = sizeof(buf); 121 incoming_stream.avail_out = sizeof(buf);
122 122
123 status = inflate(&incoming_stream, Z_PARTIAL_FLUSH); 123 status = inflate(&incoming_stream, Z_PARTIAL_FLUSH);
diff --git a/crc32.c b/crc32.c
index a4e1f27b0..4774c8ba1 100644
--- a/crc32.c
+++ b/crc32.c
@@ -31,7 +31,7 @@
31 * tions for all combinations of data and CRC register values 31 * tions for all combinations of data and CRC register values
32 * 32 *
33 * The values must be right-shifted by eight bits by the "updcrc 33 * The values must be right-shifted by eight bits by the "updcrc
34 * logic; the shift must be unsigned (bring in zeroes). On some 34 * logic; the shift must be u_(bring in zeroes). On some
35 * hardware you could probably optimize the shift in assembler by 35 * hardware you could probably optimize the shift in assembler by
36 * using byte-swap instructions 36 * using byte-swap instructions
37 * polynomial $edb88320 37 * polynomial $edb88320
@@ -39,11 +39,11 @@
39 39
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: crc32.c,v 1.7 2000/09/07 20:27:51 deraadt Exp $"); 42RCSID("$OpenBSD: crc32.c,v 1.8 2000/12/19 23:17:56 markus Exp $");
43 43
44#include "crc32.h" 44#include "crc32.h"
45 45
46static unsigned int crc32_tab[] = { 46static u_int crc32_tab[] = {
47 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 47 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
48 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 48 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
49 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 49 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
@@ -100,11 +100,11 @@ static unsigned int crc32_tab[] = {
100 100
101/* Return a 32-bit CRC of the contents of the buffer. */ 101/* Return a 32-bit CRC of the contents of the buffer. */
102 102
103unsigned int 103u_int
104ssh_crc32(const unsigned char *s, unsigned int len) 104ssh_crc32(const u_char *s, u_int len)
105{ 105{
106 unsigned int i; 106 u_int i;
107 unsigned int crc32val; 107 u_int crc32val;
108 108
109 crc32val = 0; 109 crc32val = 0;
110 for (i = 0; i < len; i ++) { 110 for (i = 0; i < len; i ++) {
diff --git a/crc32.h b/crc32.h
index 58c4fbacd..88e786989 100644
--- a/crc32.h
+++ b/crc32.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: crc32.h,v 1.8 2000/09/07 20:27:51 deraadt Exp $"); */ 14/* RCSID("$OpenBSD: crc32.h,v 1.9 2000/12/19 23:17:56 markus Exp $"); */
15 15
16#ifndef CRC32_H 16#ifndef CRC32_H
17#define CRC32_H 17#define CRC32_H
@@ -20,6 +20,6 @@
20 * This computes a 32 bit CRC of the data in the buffer, and returns the CRC. 20 * This computes a 32 bit CRC of the data in the buffer, and returns the CRC.
21 * The polynomial used is 0xedb88320. 21 * The polynomial used is 0xedb88320.
22 */ 22 */
23unsigned int ssh_crc32(const unsigned char *buf, unsigned int len); 23u_int ssh_crc32(const u_char *buf, u_int len);
24 24
25#endif /* CRC32_H */ 25#endif /* CRC32_H */
diff --git a/deattack.c b/deattack.c
index df1d22409..c3c3f08d2 100644
--- a/deattack.c
+++ b/deattack.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: deattack.c,v 1.10 2000/10/31 13:18:53 markus Exp $ */ 1/* $OpenBSD: deattack.c,v 1.11 2000/12/19 23:17:56 markus Exp $ */
2 2
3/* 3/*
4 * Cryptographic attack detector for ssh - source code 4 * Cryptographic attack detector for ssh - source code
@@ -51,16 +51,16 @@ void
51crc_update(u_int32_t *a, u_int32_t b) 51crc_update(u_int32_t *a, u_int32_t b)
52{ 52{
53 b ^= *a; 53 b ^= *a;
54 *a = ssh_crc32((unsigned char *) &b, sizeof(b)); 54 *a = ssh_crc32((u_char *) &b, sizeof(b));
55} 55}
56 56
57/* detect if a block is used in a particular pattern */ 57/* detect if a block is used in a particular pattern */
58int 58int
59check_crc(unsigned char *S, unsigned char *buf, u_int32_t len, 59check_crc(u_char *S, u_char *buf, u_int32_t len,
60 unsigned char *IV) 60 u_char *IV)
61{ 61{
62 u_int32_t crc; 62 u_int32_t crc;
63 unsigned char *c; 63 u_char *c;
64 64
65 crc = 0; 65 crc = 0;
66 if (IV && !CMP(S, IV)) { 66 if (IV && !CMP(S, IV)) {
@@ -82,14 +82,14 @@ check_crc(unsigned char *S, unsigned char *buf, u_int32_t len,
82 82
83/* Detect a crc32 compensation attack on a packet */ 83/* Detect a crc32 compensation attack on a packet */
84int 84int
85detect_attack(unsigned char *buf, u_int32_t len, unsigned char *IV) 85detect_attack(u_char *buf, u_int32_t len, u_char *IV)
86{ 86{
87 static u_int16_t *h = (u_int16_t *) NULL; 87 static u_int16_t *h = (u_int16_t *) NULL;
88 static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE; 88 static u_int32_t n = HASH_MINSIZE / HASH_ENTRYSIZE;
89 register u_int32_t i, j; 89 register u_int32_t i, j;
90 u_int32_t l; 90 u_int32_t l;
91 register unsigned char *c; 91 register u_char *c;
92 unsigned char *d; 92 u_char *d;
93 93
94 if (len > (SSH_MAXBLOCKS * SSH_BLOCKSIZE) || 94 if (len > (SSH_MAXBLOCKS * SSH_BLOCKSIZE) ||
95 len % SSH_BLOCKSIZE != 0) { 95 len % SSH_BLOCKSIZE != 0) {
diff --git a/deattack.h b/deattack.h
index 6ce54dedb..22930f619 100644
--- a/deattack.h
+++ b/deattack.h
@@ -24,5 +24,5 @@
24#define DEATTACK_OK 0 24#define DEATTACK_OK 0
25#define DEATTACK_DETECTED 1 25#define DEATTACK_DETECTED 1
26 26
27int detect_attack(unsigned char *buf, u_int32_t len, unsigned char IV[8]); 27int detect_attack(u_char *buf, u_int32_t len, u_char IV[8]);
28#endif 28#endif
diff --git a/getput.h b/getput.h
index 19ff5e14b..b8e83453a 100644
--- a/getput.h
+++ b/getput.h
@@ -11,20 +11,20 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: getput.h,v 1.5 2000/09/07 20:27:51 deraadt Exp $"); */ 14/* RCSID("$OpenBSD: getput.h,v 1.6 2000/12/19 23:17:56 markus Exp $"); */
15 15
16#ifndef GETPUT_H 16#ifndef GETPUT_H
17#define GETPUT_H 17#define GETPUT_H
18 18
19/*------------ macros for storing/extracting msb first words -------------*/ 19/*------------ macros for storing/extracting msb first words -------------*/
20 20
21#define GET_32BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 24) | \ 21#define GET_32BIT(cp) (((u_long)(u_char)(cp)[0] << 24) | \
22 ((unsigned long)(unsigned char)(cp)[1] << 16) | \ 22 ((u_long)(u_char)(cp)[1] << 16) | \
23 ((unsigned long)(unsigned char)(cp)[2] << 8) | \ 23 ((u_long)(u_char)(cp)[2] << 8) | \
24 ((unsigned long)(unsigned char)(cp)[3])) 24 ((u_long)(u_char)(cp)[3]))
25 25
26#define GET_16BIT(cp) (((unsigned long)(unsigned char)(cp)[0] << 8) | \ 26#define GET_16BIT(cp) (((u_long)(u_char)(cp)[0] << 8) | \
27 ((unsigned long)(unsigned char)(cp)[1])) 27 ((u_long)(u_char)(cp)[1]))
28 28
29#define PUT_32BIT(cp, value) do { \ 29#define PUT_32BIT(cp, value) do { \
30 (cp)[0] = (value) >> 24; \ 30 (cp)[0] = (value) >> 24; \
@@ -39,14 +39,14 @@
39/*------------ macros for storing/extracting lsb first words -------------*/ 39/*------------ macros for storing/extracting lsb first words -------------*/
40 40
41#define GET_32BIT_LSB_FIRST(cp) \ 41#define GET_32BIT_LSB_FIRST(cp) \
42 (((unsigned long)(unsigned char)(cp)[0]) | \ 42 (((u_long)(u_char)(cp)[0]) | \
43 ((unsigned long)(unsigned char)(cp)[1] << 8) | \ 43 ((u_long)(u_char)(cp)[1] << 8) | \
44 ((unsigned long)(unsigned char)(cp)[2] << 16) | \ 44 ((u_long)(u_char)(cp)[2] << 16) | \
45 ((unsigned long)(unsigned char)(cp)[3] << 24)) 45 ((u_long)(u_char)(cp)[3] << 24))
46 46
47#define GET_16BIT_LSB_FIRST(cp) \ 47#define GET_16BIT_LSB_FIRST(cp) \
48 (((unsigned long)(unsigned char)(cp)[0]) | \ 48 (((u_long)(u_char)(cp)[0]) | \
49 ((unsigned long)(unsigned char)(cp)[1] << 8)) 49 ((u_long)(u_char)(cp)[1] << 8))
50 50
51#define PUT_32BIT_LSB_FIRST(cp, value) do { \ 51#define PUT_32BIT_LSB_FIRST(cp, value) do { \
52 (cp)[0] = (value); \ 52 (cp)[0] = (value); \
diff --git a/hmac.c b/hmac.c
index 48a176304..6c3883e67 100644
--- a/hmac.c
+++ b/hmac.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: hmac.c,v 1.4 2000/09/07 20:27:51 deraadt Exp $"); 26RCSID("$OpenBSD: hmac.c,v 1.5 2000/12/19 23:17:56 markus Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29#include "ssh.h" 29#include "ssh.h"
@@ -31,16 +31,16 @@ RCSID("$OpenBSD: hmac.c,v 1.4 2000/09/07 20:27:51 deraadt Exp $");
31 31
32#include <openssl/hmac.h> 32#include <openssl/hmac.h>
33 33
34unsigned char * 34u_char *
35hmac( 35hmac(
36 EVP_MD *evp_md, 36 EVP_MD *evp_md,
37 unsigned int seqno, 37 u_int seqno,
38 unsigned char *data, int datalen, 38 u_char *data, int datalen,
39 unsigned char *key, int keylen) 39 u_char *key, int keylen)
40{ 40{
41 HMAC_CTX c; 41 HMAC_CTX c;
42 static unsigned char m[EVP_MAX_MD_SIZE]; 42 static u_char m[EVP_MAX_MD_SIZE];
43 unsigned char b[4]; 43 u_char b[4];
44 44
45 if (key == NULL) 45 if (key == NULL)
46 fatal("hmac: no key"); 46 fatal("hmac: no key");
diff --git a/hmac.h b/hmac.h
index 281300e25..9872b29f5 100644
--- a/hmac.h
+++ b/hmac.h
@@ -24,11 +24,11 @@
24#ifndef HMAC_H 24#ifndef HMAC_H
25#define HMAC_H 25#define HMAC_H
26 26
27unsigned char * 27u_char *
28hmac( 28hmac(
29 EVP_MD *evp_md, 29 EVP_MD *evp_md,
30 unsigned int seqno, 30 u_int seqno,
31 unsigned char *data, int datalen, 31 u_char *data, int datalen,
32 unsigned char *key, int len); 32 u_char *key, int len);
33 33
34#endif 34#endif
diff --git a/hostfile.c b/hostfile.c
index 3b0f286fd..1c3fb22ad 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: hostfile.c,v 1.21 2000/11/12 19:50:37 markus Exp $"); 39RCSID("$OpenBSD: hostfile.c,v 1.23 2000/12/21 15:10:16 markus Exp $");
40 40
41#include "packet.h" 41#include "packet.h"
42#include "match.h" 42#include "match.h"
@@ -52,7 +52,7 @@ RCSID("$OpenBSD: hostfile.c,v 1.21 2000/11/12 19:50:37 markus Exp $");
52 */ 52 */
53 53
54int 54int
55hostfile_read_key(char **cpp, unsigned int *bitsp, Key *ret) 55hostfile_read_key(char **cpp, u_int *bitsp, Key *ret)
56{ 56{
57 char *cp; 57 char *cp;
58 58
@@ -74,7 +74,7 @@ hostfile_read_key(char **cpp, unsigned int *bitsp, Key *ret)
74} 74}
75 75
76int 76int
77auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n) 77auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n)
78{ 78{
79 Key *k = key_new(KEY_RSA1); 79 Key *k = key_new(KEY_RSA1);
80 int ret = hostfile_read_key(cpp, bitsp, k); 80 int ret = hostfile_read_key(cpp, bitsp, k);
@@ -107,12 +107,13 @@ hostfile_check_key(int bits, Key *key, const char *host, const char *filename, i
107 */ 107 */
108 108
109HostStatus 109HostStatus
110check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found) 110check_host_in_hostfile(const char *filename, const char *host, Key *key,
111 Key *found, int *numret)
111{ 112{
112 FILE *f; 113 FILE *f;
113 char line[8192]; 114 char line[8192];
114 int linenum = 0; 115 int linenum = 0;
115 unsigned int kbits, hostlen; 116 u_int kbits, hostlen;
116 char *cp, *cp2; 117 char *cp, *cp2;
117 HostStatus end_return; 118 HostStatus end_return;
118 119
@@ -149,7 +150,7 @@ check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *fo
149 ; 150 ;
150 151
151 /* Check if the host name matches. */ 152 /* Check if the host name matches. */
152 if (match_hostname(host, cp, (unsigned int) (cp2 - cp)) != 1) 153 if (match_hostname(host, cp, (u_int) (cp2 - cp)) != 1)
153 continue; 154 continue;
154 155
155 /* Got a match. Skip host name. */ 156 /* Got a match. Skip host name. */
@@ -164,6 +165,9 @@ check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *fo
164 if (!hostfile_check_key(kbits, found, host, filename, linenum)) 165 if (!hostfile_check_key(kbits, found, host, filename, linenum))
165 continue; 166 continue;
166 167
168 if (numret != NULL)
169 *numret = linenum;
170
167 /* Check if the current key is the same as the given key. */ 171 /* Check if the current key is the same as the given key. */
168 if (key_equal(key, found)) { 172 if (key_equal(key, found)) {
169 /* Ok, they match. */ 173 /* Ok, they match. */
diff --git a/hostfile.h b/hostfile.h
index 9c2353bf9..dbdbd8f33 100644
--- a/hostfile.h
+++ b/hostfile.h
@@ -21,8 +21,10 @@
21typedef enum { 21typedef enum {
22 HOST_OK, HOST_NEW, HOST_CHANGED 22 HOST_OK, HOST_NEW, HOST_CHANGED
23} HostStatus; 23} HostStatus;
24
24HostStatus 25HostStatus
25check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found); 26check_host_in_hostfile(const char *filename, const char *host, Key *key,
27 Key *found, int *line);
26 28
27/* 29/*
28 * Appends an entry to the host file. Returns false if the entry could not 30 * Appends an entry to the host file. Returns false if the entry could not
diff --git a/kex.c b/kex.c
index 3a74fdac4..de315705e 100644
--- a/kex.c
+++ b/kex.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kex.c,v 1.14 2000/12/15 17:30:14 provos Exp $"); 26RCSID("$OpenBSD: kex.c,v 1.16 2000/12/20 19:37:22 markus Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -51,7 +51,7 @@ Buffer *
51kex_init(char *myproposal[PROPOSAL_MAX]) 51kex_init(char *myproposal[PROPOSAL_MAX])
52{ 52{
53 int first_kex_packet_follows = 0; 53 int first_kex_packet_follows = 0;
54 unsigned char cookie[KEX_COOKIE_LEN]; 54 u_char cookie[KEX_COOKIE_LEN];
55 u_int32_t rand = 0; 55 u_int32_t rand = 0;
56 int i; 56 int i;
57 Buffer *ki = xmalloc(sizeof(*ki)); 57 Buffer *ki = xmalloc(sizeof(*ki));
@@ -190,7 +190,7 @@ dh_new_group(BIGNUM *gen, BIGNUM *modulus)
190} 190}
191 191
192DH * 192DH *
193dh_new_group1() 193dh_new_group1(void)
194{ 194{
195 static char *gen = "2", *group1 = 195 static char *gen = "2", *group1 =
196 "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1" 196 "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1"
@@ -204,7 +204,7 @@ dh_new_group1()
204} 204}
205 205
206void 206void
207dump_digest(unsigned char *digest, int len) 207dump_digest(u_char *digest, int len)
208{ 208{
209 int i; 209 int i;
210 for (i = 0; i< len; i++){ 210 for (i = 0; i< len; i++){
@@ -215,7 +215,7 @@ dump_digest(unsigned char *digest, int len)
215 fprintf(stderr, "\n"); 215 fprintf(stderr, "\n");
216} 216}
217 217
218unsigned char * 218u_char *
219kex_hash( 219kex_hash(
220 char *client_version_string, 220 char *client_version_string,
221 char *server_version_string, 221 char *server_version_string,
@@ -227,7 +227,7 @@ kex_hash(
227 BIGNUM *shared_secret) 227 BIGNUM *shared_secret)
228{ 228{
229 Buffer b; 229 Buffer b;
230 static unsigned char digest[EVP_MAX_MD_SIZE]; 230 static u_char digest[EVP_MAX_MD_SIZE];
231 EVP_MD *evp_md = EVP_sha1(); 231 EVP_MD *evp_md = EVP_sha1();
232 EVP_MD_CTX md; 232 EVP_MD_CTX md;
233 233
@@ -264,7 +264,7 @@ kex_hash(
264 return digest; 264 return digest;
265} 265}
266 266
267unsigned char * 267u_char *
268kex_hash_gex( 268kex_hash_gex(
269 char *client_version_string, 269 char *client_version_string,
270 char *server_version_string, 270 char *server_version_string,
@@ -277,7 +277,7 @@ kex_hash_gex(
277 BIGNUM *shared_secret) 277 BIGNUM *shared_secret)
278{ 278{
279 Buffer b; 279 Buffer b;
280 static unsigned char digest[EVP_MAX_MD_SIZE]; 280 static u_char digest[EVP_MAX_MD_SIZE];
281 EVP_MD *evp_md = EVP_sha1(); 281 EVP_MD *evp_md = EVP_sha1();
282 EVP_MD_CTX md; 282 EVP_MD_CTX md;
283 283
@@ -317,8 +317,8 @@ kex_hash_gex(
317 return digest; 317 return digest;
318} 318}
319 319
320unsigned char * 320u_char *
321derive_key(int id, int need, char unsigned *hash, BIGNUM *shared_secret) 321derive_key(int id, int need, u_char *hash, BIGNUM *shared_secret)
322{ 322{
323 Buffer b; 323 Buffer b;
324 EVP_MD *evp_md = EVP_sha1(); 324 EVP_MD *evp_md = EVP_sha1();
@@ -326,7 +326,7 @@ derive_key(int id, int need, char unsigned *hash, BIGNUM *shared_secret)
326 char c = id; 326 char c = id;
327 int have; 327 int have;
328 int mdsz = evp_md->md_size; 328 int mdsz = evp_md->md_size;
329 unsigned char *digest = xmalloc(((need+mdsz-1)/mdsz)*mdsz); 329 u_char *digest = xmalloc(((need+mdsz-1)/mdsz)*mdsz);
330 330
331 buffer_init(&b); 331 buffer_init(&b);
332 buffer_put_bignum2(&b, shared_secret); 332 buffer_put_bignum2(&b, shared_secret);
@@ -512,12 +512,12 @@ kex_choose_conf(char *cprop[PROPOSAL_MAX], char *sprop[PROPOSAL_MAX], int server
512} 512}
513 513
514int 514int
515kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret) 515kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret)
516{ 516{
517 int i; 517 int i;
518 int mode; 518 int mode;
519 int ctos; 519 int ctos;
520 unsigned char *keys[NKEYS]; 520 u_char *keys[NKEYS];
521 521
522 for (i = 0; i < NKEYS; i++) 522 for (i = 0; i < NKEYS; i++)
523 keys[i] = derive_key('A'+i, k->we_need, hash, shared_secret); 523 keys[i] = derive_key('A'+i, k->we_need, hash, shared_secret);
diff --git a/kex.h b/kex.h
index b445cee63..143769a31 100644
--- a/kex.h
+++ b/kex.h
@@ -62,15 +62,15 @@ struct Enc {
62 char *name; 62 char *name;
63 Cipher *cipher; 63 Cipher *cipher;
64 int enabled; 64 int enabled;
65 unsigned char *key; 65 u_char *key;
66 unsigned char *iv; 66 u_char *iv;
67}; 67};
68struct Mac { 68struct Mac {
69 char *name; 69 char *name;
70 int enabled; 70 int enabled;
71 EVP_MD *md; 71 EVP_MD *md;
72 int mac_len; 72 int mac_len;
73 unsigned char *key; 73 u_char *key;
74 int key_len; 74 int key_len;
75}; 75};
76struct Comp { 76struct Comp {
@@ -97,15 +97,15 @@ kex_exchange_kexinit(
97Kex * 97Kex *
98kex_choose_conf(char *cprop[PROPOSAL_MAX], 98kex_choose_conf(char *cprop[PROPOSAL_MAX],
99 char *sprop[PROPOSAL_MAX], int server); 99 char *sprop[PROPOSAL_MAX], int server);
100int kex_derive_keys(Kex *k, unsigned char *hash, BIGNUM *shared_secret); 100int kex_derive_keys(Kex *k, u_char *hash, BIGNUM *shared_secret);
101void packet_set_kex(Kex *k); 101void packet_set_kex(Kex *k);
102int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub); 102int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub);
103DH *dh_new_group_asc(const char *, const char *); 103DH *dh_new_group_asc(const char *, const char *);
104DH *dh_new_group(BIGNUM *, BIGNUM *); 104DH *dh_new_group(BIGNUM *, BIGNUM *);
105void dh_gen_key(); 105void dh_gen_key(DH *);
106DH *dh_new_group1(); 106DH *dh_new_group1(void);
107 107
108unsigned char * 108u_char *
109kex_hash( 109kex_hash(
110 char *client_version_string, 110 char *client_version_string,
111 char *server_version_string, 111 char *server_version_string,
@@ -116,7 +116,7 @@ kex_hash(
116 BIGNUM *server_dh_pub, 116 BIGNUM *server_dh_pub,
117 BIGNUM *shared_secret); 117 BIGNUM *shared_secret);
118 118
119unsigned char * 119u_char *
120kex_hash_gex( 120kex_hash_gex(
121 char *client_version_string, 121 char *client_version_string,
122 char *server_version_string, 122 char *server_version_string,
diff --git a/key.c b/key.c
index a6b25b7ae..f9474b16b 100644
--- a/key.c
+++ b/key.c
@@ -46,7 +46,7 @@
46#include "buffer.h" 46#include "buffer.h"
47#include "bufaux.h" 47#include "bufaux.h"
48 48
49RCSID("$OpenBSD: key.c,v 1.12 2000/11/12 19:50:37 markus Exp $"); 49RCSID("$OpenBSD: key.c,v 1.13 2000/12/19 23:17:56 markus Exp $");
50 50
51Key * 51Key *
52key_new(int type) 52key_new(int type)
@@ -163,7 +163,7 @@ char *
163key_fingerprint(Key *k) 163key_fingerprint(Key *k)
164{ 164{
165 static char retval[(EVP_MAX_MD_SIZE+1)*3]; 165 static char retval[(EVP_MAX_MD_SIZE+1)*3];
166 unsigned char *blob = NULL; 166 u_char *blob = NULL;
167 int len = 0; 167 int len = 0;
168 int nlen, elen; 168 int nlen, elen;
169 169
@@ -190,7 +190,7 @@ key_fingerprint(Key *k)
190 } 190 }
191 if (blob != NULL) { 191 if (blob != NULL) {
192 int i; 192 int i;
193 unsigned char digest[EVP_MAX_MD_SIZE]; 193 u_char digest[EVP_MAX_MD_SIZE];
194 EVP_MD *md = EVP_md5(); 194 EVP_MD *md = EVP_md5();
195 EVP_MD_CTX ctx; 195 EVP_MD_CTX ctx;
196 EVP_DigestInit(&ctx, md); 196 EVP_DigestInit(&ctx, md);
@@ -273,7 +273,7 @@ key_read(Key *ret, char **cpp)
273 char *cp, *space; 273 char *cp, *space;
274 int len, n, type; 274 int len, n, type;
275 u_int bits; 275 u_int bits;
276 unsigned char *blob; 276 u_char *blob;
277 277
278 cp = *cpp; 278 cp = *cpp;
279 279
@@ -380,7 +380,7 @@ int
380key_write(Key *key, FILE *f) 380key_write(Key *key, FILE *f)
381{ 381{
382 int success = 0; 382 int success = 0;
383 unsigned int bits = 0; 383 u_int bits = 0;
384 384
385 if (key->type == KEY_RSA1 && key->rsa != NULL) { 385 if (key->type == KEY_RSA1 && key->rsa != NULL) {
386 /* size of modulus 'n' */ 386 /* size of modulus 'n' */
@@ -395,7 +395,7 @@ key_write(Key *key, FILE *f)
395 } else if ((key->type == KEY_DSA && key->dsa != NULL) || 395 } else if ((key->type == KEY_DSA && key->dsa != NULL) ||
396 (key->type == KEY_RSA && key->rsa != NULL)) { 396 (key->type == KEY_RSA && key->rsa != NULL)) {
397 int len, n; 397 int len, n;
398 unsigned char *blob, *uu; 398 u_char *blob, *uu;
399 key_to_blob(key, &blob, &len); 399 key_to_blob(key, &blob, &len);
400 uu = xmalloc(2*len); 400 uu = xmalloc(2*len);
401 n = uuencode(blob, len, uu, 2*len); 401 n = uuencode(blob, len, uu, 2*len);
@@ -452,7 +452,7 @@ key_size(Key *k){
452} 452}
453 453
454RSA * 454RSA *
455rsa_generate_private_key(unsigned int bits) 455rsa_generate_private_key(u_int bits)
456{ 456{
457 RSA *private; 457 RSA *private;
458 private = RSA_generate_key(bits, 35, NULL, NULL); 458 private = RSA_generate_key(bits, 35, NULL, NULL);
@@ -462,7 +462,7 @@ rsa_generate_private_key(unsigned int bits)
462} 462}
463 463
464DSA* 464DSA*
465dsa_generate_private_key(unsigned int bits) 465dsa_generate_private_key(u_int bits)
466{ 466{
467 DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL); 467 DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL);
468 if (private == NULL) 468 if (private == NULL)
@@ -475,7 +475,7 @@ dsa_generate_private_key(unsigned int bits)
475} 475}
476 476
477Key * 477Key *
478key_generate(int type, unsigned int bits) 478key_generate(int type, u_int bits)
479{ 479{
480 Key *k = key_new(KEY_UNSPEC); 480 Key *k = key_new(KEY_UNSPEC);
481 switch (type) { 481 switch (type) {
@@ -587,11 +587,11 @@ key_from_blob(char *blob, int blen)
587} 587}
588 588
589int 589int
590key_to_blob(Key *key, unsigned char **blobp, unsigned int *lenp) 590key_to_blob(Key *key, u_char **blobp, u_int *lenp)
591{ 591{
592 Buffer b; 592 Buffer b;
593 int len; 593 int len;
594 unsigned char *buf; 594 u_char *buf;
595 595
596 if (key == NULL) { 596 if (key == NULL) {
597 error("key_to_blob: key == NULL"); 597 error("key_to_blob: key == NULL");
@@ -630,8 +630,8 @@ key_to_blob(Key *key, unsigned char **blobp, unsigned int *lenp)
630int 630int
631key_sign( 631key_sign(
632 Key *key, 632 Key *key,
633 unsigned char **sigp, int *lenp, 633 u_char **sigp, int *lenp,
634 unsigned char *data, int datalen) 634 u_char *data, int datalen)
635{ 635{
636 switch(key->type){ 636 switch(key->type){
637 case KEY_DSA: 637 case KEY_DSA:
@@ -650,8 +650,8 @@ key_sign(
650int 650int
651key_verify( 651key_verify(
652 Key *key, 652 Key *key,
653 unsigned char *signature, int signaturelen, 653 u_char *signature, int signaturelen,
654 unsigned char *data, int datalen) 654 u_char *data, int datalen)
655{ 655{
656 switch(key->type){ 656 switch(key->type){
657 case KEY_DSA: 657 case KEY_DSA:
diff --git a/key.h b/key.h
index b6c3eb010..91f4d0055 100644
--- a/key.h
+++ b/key.h
@@ -47,24 +47,24 @@ int key_write(Key *key, FILE *f);
47int key_read(Key *key, char **cpp); 47int key_read(Key *key, char **cpp);
48u_int key_size(Key *k); 48u_int key_size(Key *k);
49 49
50Key *key_generate(int type, unsigned int bits); 50Key *key_generate(int type, u_int bits);
51Key *key_from_private(Key *k); 51Key *key_from_private(Key *k);
52int key_type_from_name(char *name); 52int key_type_from_name(char *name);
53 53
54Key *key_from_blob(char *blob, int blen); 54Key *key_from_blob(char *blob, int blen);
55int key_to_blob(Key *key, unsigned char **blobp, unsigned int *lenp); 55int key_to_blob(Key *key, u_char **blobp, u_int *lenp);
56char *key_ssh_name(Key *k); 56char *key_ssh_name(Key *k);
57 57
58int 58int
59key_sign( 59key_sign(
60 Key *key, 60 Key *key,
61 unsigned char **sigp, int *lenp, 61 u_char **sigp, int *lenp,
62 unsigned char *data, int datalen); 62 u_char *data, int datalen);
63 63
64int 64int
65key_verify( 65key_verify(
66 Key *key, 66 Key *key,
67 unsigned char *signature, int signaturelen, 67 u_char *signature, int signaturelen,
68 unsigned char *data, int datalen); 68 u_char *data, int datalen);
69 69
70#endif 70#endif
diff --git a/log.c b/log.c
index e75c6c46f..896bd2392 100644
--- a/log.c
+++ b/log.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: log.c,v 1.11 2000/09/30 16:27:43 markus Exp $"); 39RCSID("$OpenBSD: log.c,v 1.12 2000/12/19 23:17:57 markus Exp $");
40 40
41#include "ssh.h" 41#include "ssh.h"
42#include "xmalloc.h" 42#include "xmalloc.h"
@@ -155,7 +155,7 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context)
155 } 155 }
156 } 156 }
157 fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx\n", 157 fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx\n",
158 (unsigned long) proc, (unsigned long) context); 158 (u_long) proc, (u_long) context);
159} 159}
160 160
161/* Cleanup and exit */ 161/* Cleanup and exit */
@@ -172,7 +172,7 @@ fatal_cleanup(void)
172 for (cu = fatal_cleanups; cu; cu = next_cu) { 172 for (cu = fatal_cleanups; cu; cu = next_cu) {
173 next_cu = cu->next; 173 next_cu = cu->next;
174 debug("Calling cleanup 0x%lx(0x%lx)", 174 debug("Calling cleanup 0x%lx(0x%lx)",
175 (unsigned long) cu->proc, (unsigned long) cu->context); 175 (u_long) cu->proc, (u_long) cu->context);
176 (*cu->proc) (cu->context); 176 (*cu->proc) (cu->context);
177 } 177 }
178 exit(255); 178 exit(255);
diff --git a/login.c b/login.c
index b13b84dc1..649648faf 100644
--- a/login.c
+++ b/login.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: login.c,v 1.15 2000/09/07 20:27:52 deraadt Exp $"); 42RCSID("$OpenBSD: login.c,v 1.16 2000/12/19 23:17:57 markus Exp $");
43 43
44#include "loginrec.h" 44#include "loginrec.h"
45 45
@@ -49,9 +49,9 @@ RCSID("$OpenBSD: login.c,v 1.15 2000/09/07 20:27:52 deraadt Exp $");
49 * The host the user logged in from will be returned in buf. 49 * The host the user logged in from will be returned in buf.
50 */ 50 */
51 51
52unsigned long 52u_long
53get_last_login_time(uid_t uid, const char *logname, 53get_last_login_time(uid_t uid, const char *logname,
54 char *buf, unsigned int bufsize) 54 char *buf, u_int bufsize)
55{ 55{
56 struct logininfo li; 56 struct logininfo li;
57 57
diff --git a/match.c b/match.c
index c373129b8..895ecab37 100644
--- a/match.c
+++ b/match.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: match.c,v 1.9 2000/09/07 20:27:52 deraadt Exp $"); 15RCSID("$OpenBSD: match.c,v 1.10 2000/12/19 23:17:57 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18 18
@@ -87,12 +87,12 @@ match_pattern(const char *s, const char *pattern)
87 */ 87 */
88 88
89int 89int
90match_hostname(const char *host, const char *pattern, unsigned int len) 90match_hostname(const char *host, const char *pattern, u_int len)
91{ 91{
92 char sub[1024]; 92 char sub[1024];
93 int negated; 93 int negated;
94 int got_positive; 94 int got_positive;
95 unsigned int i, subi; 95 u_int i, subi;
96 96
97 got_positive = 0; 97 got_positive = 0;
98 for (i = 0; i < len;) { 98 for (i = 0; i < len;) {
diff --git a/match.h b/match.h
index 564f5abf9..5afbe326c 100644
--- a/match.h
+++ b/match.h
@@ -26,6 +26,6 @@ int match_pattern(const char *s, const char *pattern);
26 * indicate negation). Returns -1 if negation matches, 1 if there is 26 * indicate negation). Returns -1 if negation matches, 1 if there is
27 * a positive match, 0 if there is no match at all. 27 * a positive match, 0 if there is no match at all.
28 */ 28 */
29int match_hostname(const char *host, const char *pattern, unsigned int len); 29int match_hostname(const char *host, const char *pattern, u_int len);
30 30
31#endif 31#endif
diff --git a/mpaux.c b/mpaux.c
index 1ee8df194..6b586ec04 100644
--- a/mpaux.c
+++ b/mpaux.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: mpaux.c,v 1.14 2000/09/07 20:27:52 deraadt Exp $"); 16RCSID("$OpenBSD: mpaux.c,v 1.15 2000/12/19 23:17:57 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include "getput.h" 19#include "getput.h"
@@ -22,15 +22,15 @@ RCSID("$OpenBSD: mpaux.c,v 1.14 2000/09/07 20:27:52 deraadt Exp $");
22#include <openssl/md5.h> 22#include <openssl/md5.h>
23 23
24void 24void
25compute_session_id(unsigned char session_id[16], 25compute_session_id(u_char session_id[16],
26 unsigned char cookie[8], 26 u_char cookie[8],
27 BIGNUM* host_key_n, 27 BIGNUM* host_key_n,
28 BIGNUM* session_key_n) 28 BIGNUM* session_key_n)
29{ 29{
30 unsigned int host_key_bytes = BN_num_bytes(host_key_n); 30 u_int host_key_bytes = BN_num_bytes(host_key_n);
31 unsigned int session_key_bytes = BN_num_bytes(session_key_n); 31 u_int session_key_bytes = BN_num_bytes(session_key_n);
32 unsigned int bytes = host_key_bytes + session_key_bytes; 32 u_int bytes = host_key_bytes + session_key_bytes;
33 unsigned char *buf = xmalloc(bytes); 33 u_char *buf = xmalloc(bytes);
34 MD5_CTX md; 34 MD5_CTX md;
35 35
36 BN_bn2bin(host_key_n, buf); 36 BN_bn2bin(host_key_n, buf);
diff --git a/mpaux.h b/mpaux.h
index 9de17276b..b3f15e4a5 100644
--- a/mpaux.h
+++ b/mpaux.h
@@ -12,7 +12,7 @@
12 * called by a name other than "ssh" or "Secure Shell". 12 * called by a name other than "ssh" or "Secure Shell".
13 */ 13 */
14 14
15/* RCSID("$OpenBSD: mpaux.h,v 1.8 2000/09/07 20:27:52 deraadt Exp $"); */ 15/* RCSID("$OpenBSD: mpaux.h,v 1.9 2000/12/19 23:17:57 markus Exp $"); */
16 16
17#ifndef MPAUX_H 17#ifndef MPAUX_H
18#define MPAUX_H 18#define MPAUX_H
@@ -23,8 +23,8 @@
23 * representations of host_key_n, session_key_n, and the cookie. 23 * representations of host_key_n, session_key_n, and the cookie.
24 */ 24 */
25void 25void
26compute_session_id(unsigned char session_id[16], 26compute_session_id(u_char session_id[16],
27 unsigned char cookie[8], 27 u_char cookie[8],
28 BIGNUM * host_key_n, 28 BIGNUM * host_key_n,
29 BIGNUM * session_key_n); 29 BIGNUM * session_key_n);
30 30
diff --git a/packet.c b/packet.c
index 3e8ab2383..f055c4f2e 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.39 2000/12/06 22:58:15 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.40 2000/12/19 23:17:57 markus Exp $");
41 41
42#include "xmalloc.h" 42#include "xmalloc.h"
43#include "buffer.h" 43#include "buffer.h"
@@ -84,7 +84,7 @@ static int connection_out = -1;
84static int cipher_type = SSH_CIPHER_NONE; 84static int cipher_type = SSH_CIPHER_NONE;
85 85
86/* Protocol flags for the remote side. */ 86/* Protocol flags for the remote side. */
87static unsigned int remote_protocol_flags = 0; 87static u_int remote_protocol_flags = 0;
88 88
89/* Encryption context for receiving data. This is only used for decryption. */ 89/* Encryption context for receiving data. This is only used for decryption. */
90static CipherContext receive_context; 90static CipherContext receive_context;
@@ -167,8 +167,8 @@ packet_set_connection(int fd_in, int fd_out)
167 connection_in = fd_in; 167 connection_in = fd_in;
168 connection_out = fd_out; 168 connection_out = fd_out;
169 cipher_type = SSH_CIPHER_NONE; 169 cipher_type = SSH_CIPHER_NONE;
170 cipher_init(&send_context, none, (unsigned char *) "", 0, NULL, 0); 170 cipher_init(&send_context, none, (u_char *) "", 0, NULL, 0);
171 cipher_init(&receive_context, none, (unsigned char *) "", 0, NULL, 0); 171 cipher_init(&receive_context, none, (u_char *) "", 0, NULL, 0);
172 if (!initialized) { 172 if (!initialized) {
173 initialized = 1; 173 initialized = 1;
174 buffer_init(&input); 174 buffer_init(&input);
@@ -281,7 +281,7 @@ packet_close()
281/* Sets remote side protocol flags. */ 281/* Sets remote side protocol flags. */
282 282
283void 283void
284packet_set_protocol_flags(unsigned int protocol_flags) 284packet_set_protocol_flags(u_int protocol_flags)
285{ 285{
286 remote_protocol_flags = protocol_flags; 286 remote_protocol_flags = protocol_flags;
287 channel_set_options((protocol_flags & SSH_PROTOFLAG_HOST_IN_FWD_OPEN) != 0); 287 channel_set_options((protocol_flags & SSH_PROTOFLAG_HOST_IN_FWD_OPEN) != 0);
@@ -289,7 +289,7 @@ packet_set_protocol_flags(unsigned int protocol_flags)
289 289
290/* Returns the remote protocol flags set earlier by the above function. */ 290/* Returns the remote protocol flags set earlier by the above function. */
291 291
292unsigned int 292u_int
293packet_get_protocol_flags() 293packet_get_protocol_flags()
294{ 294{
295 return remote_protocol_flags; 295 return remote_protocol_flags;
@@ -318,7 +318,7 @@ packet_start_compression(int level)
318 318
319void 319void
320packet_encrypt(CipherContext * cc, void *dest, void *src, 320packet_encrypt(CipherContext * cc, void *dest, void *src,
321 unsigned int bytes) 321 u_int bytes)
322{ 322{
323 cipher_encrypt(cc, dest, src, bytes); 323 cipher_encrypt(cc, dest, src, bytes);
324} 324}
@@ -329,7 +329,7 @@ packet_encrypt(CipherContext * cc, void *dest, void *src,
329 */ 329 */
330 330
331void 331void
332packet_decrypt(CipherContext *context, void *dest, void *src, unsigned int bytes) 332packet_decrypt(CipherContext *context, void *dest, void *src, u_int bytes)
333{ 333{
334 /* 334 /*
335 * Cryptographic attack detector for ssh - Modifications for packet.c 335 * Cryptographic attack detector for ssh - Modifications for packet.c
@@ -350,7 +350,7 @@ packet_decrypt(CipherContext *context, void *dest, void *src, unsigned int bytes
350 */ 350 */
351 351
352void 352void
353packet_set_encryption_key(const unsigned char *key, unsigned int keylen, 353packet_set_encryption_key(const u_char *key, u_int keylen,
354 int number) 354 int number)
355{ 355{
356 Cipher *cipher = cipher_by_number(number); 356 Cipher *cipher = cipher_by_number(number);
@@ -410,7 +410,7 @@ packet_put_char(int value)
410/* Appends an integer to the packet data. */ 410/* Appends an integer to the packet data. */
411 411
412void 412void
413packet_put_int(unsigned int value) 413packet_put_int(u_int value)
414{ 414{
415 buffer_put_int(&outgoing_packet, value); 415 buffer_put_int(&outgoing_packet, value);
416} 416}
@@ -418,7 +418,7 @@ packet_put_int(unsigned int value)
418/* Appends a string to packet data. */ 418/* Appends a string to packet data. */
419 419
420void 420void
421packet_put_string(const char *buf, unsigned int len) 421packet_put_string(const char *buf, u_int len)
422{ 422{
423 buffer_put_string(&outgoing_packet, buf, len); 423 buffer_put_string(&outgoing_packet, buf, len);
424} 424}
@@ -429,7 +429,7 @@ packet_put_cstring(const char *str)
429} 429}
430 430
431void 431void
432packet_put_raw(const char *buf, unsigned int len) 432packet_put_raw(const char *buf, u_int len)
433{ 433{
434 buffer_append(&outgoing_packet, buf, len); 434 buffer_append(&outgoing_packet, buf, len);
435} 435}
@@ -458,7 +458,7 @@ packet_send1()
458{ 458{
459 char buf[8], *cp; 459 char buf[8], *cp;
460 int i, padding, len; 460 int i, padding, len;
461 unsigned int checksum; 461 u_int checksum;
462 u_int32_t rand = 0; 462 u_int32_t rand = 0;
463 463
464 /* 464 /*
@@ -493,7 +493,7 @@ packet_send1()
493 buffer_consume(&outgoing_packet, 8 - padding); 493 buffer_consume(&outgoing_packet, 8 - padding);
494 494
495 /* Add check bytes. */ 495 /* Add check bytes. */
496 checksum = ssh_crc32((unsigned char *) buffer_ptr(&outgoing_packet), 496 checksum = ssh_crc32((u_char *) buffer_ptr(&outgoing_packet),
497 buffer_len(&outgoing_packet)); 497 buffer_len(&outgoing_packet));
498 PUT_32BIT(buf, checksum); 498 PUT_32BIT(buf, checksum);
499 buffer_append(&outgoing_packet, buf, 4); 499 buffer_append(&outgoing_packet, buf, 4);
@@ -530,12 +530,12 @@ packet_send1()
530void 530void
531packet_send2() 531packet_send2()
532{ 532{
533 unsigned char *macbuf = NULL; 533 u_char *macbuf = NULL;
534 char *cp; 534 char *cp;
535 unsigned int packet_length = 0; 535 u_int packet_length = 0;
536 unsigned int i, padlen, len; 536 u_int i, padlen, len;
537 u_int32_t rand = 0; 537 u_int32_t rand = 0;
538 static unsigned int seqnr = 0; 538 static u_int seqnr = 0;
539 int type; 539 int type;
540 Enc *enc = NULL; 540 Enc *enc = NULL;
541 Mac *mac = NULL; 541 Mac *mac = NULL;
@@ -604,7 +604,7 @@ packet_send2()
604 /* compute MAC over seqnr and packet(length fields, payload, padding) */ 604 /* compute MAC over seqnr and packet(length fields, payload, padding) */
605 if (mac && mac->enabled) { 605 if (mac && mac->enabled) {
606 macbuf = hmac( mac->md, seqnr, 606 macbuf = hmac( mac->md, seqnr,
607 (unsigned char *) buffer_ptr(&outgoing_packet), 607 (u_char *) buffer_ptr(&outgoing_packet),
608 buffer_len(&outgoing_packet), 608 buffer_len(&outgoing_packet),
609 mac->key, mac->key_len 609 mac->key, mac->key_len
610 ); 610 );
@@ -742,16 +742,16 @@ packet_read_expect(int *payload_len_ptr, int expected_type)
742int 742int
743packet_read_poll1(int *payload_len_ptr) 743packet_read_poll1(int *payload_len_ptr)
744{ 744{
745 unsigned int len, padded_len; 745 u_int len, padded_len;
746 unsigned char *ucp; 746 u_char *ucp;
747 char buf[8], *cp; 747 char buf[8], *cp;
748 unsigned int checksum, stored_checksum; 748 u_int checksum, stored_checksum;
749 749
750 /* Check if input size is less than minimum packet size. */ 750 /* Check if input size is less than minimum packet size. */
751 if (buffer_len(&input) < 4 + 8) 751 if (buffer_len(&input) < 4 + 8)
752 return SSH_MSG_NONE; 752 return SSH_MSG_NONE;
753 /* Get length of incoming packet. */ 753 /* Get length of incoming packet. */
754 ucp = (unsigned char *) buffer_ptr(&input); 754 ucp = (u_char *) buffer_ptr(&input);
755 len = GET_32BIT(ucp); 755 len = GET_32BIT(ucp);
756 if (len < 1 + 2 + 2 || len > 256 * 1024) 756 if (len < 1 + 2 + 2 || len > 256 * 1024)
757 packet_disconnect("Bad packet length %d.", len); 757 packet_disconnect("Bad packet length %d.", len);
@@ -778,7 +778,7 @@ packet_read_poll1(int *payload_len_ptr)
778#endif 778#endif
779 779
780 /* Compute packet checksum. */ 780 /* Compute packet checksum. */
781 checksum = ssh_crc32((unsigned char *) buffer_ptr(&incoming_packet), 781 checksum = ssh_crc32((u_char *) buffer_ptr(&incoming_packet),
782 buffer_len(&incoming_packet) - 4); 782 buffer_len(&incoming_packet) - 4);
783 783
784 /* Skip padding. */ 784 /* Skip padding. */
@@ -790,7 +790,7 @@ packet_read_poll1(int *payload_len_ptr)
790 packet_disconnect("packet_read_poll: len %d != buffer_len %d.", 790 packet_disconnect("packet_read_poll: len %d != buffer_len %d.",
791 len, buffer_len(&incoming_packet)); 791 len, buffer_len(&incoming_packet));
792 792
793 ucp = (unsigned char *) buffer_ptr(&incoming_packet) + len - 4; 793 ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4;
794 stored_checksum = GET_32BIT(ucp); 794 stored_checksum = GET_32BIT(ucp);
795 if (checksum != stored_checksum) 795 if (checksum != stored_checksum)
796 packet_disconnect("Corrupted check bytes on input."); 796 packet_disconnect("Corrupted check bytes on input.");
@@ -811,18 +811,18 @@ packet_read_poll1(int *payload_len_ptr)
811 *payload_len_ptr = buffer_len(&incoming_packet); 811 *payload_len_ptr = buffer_len(&incoming_packet);
812 812
813 /* Return type. */ 813 /* Return type. */
814 return (unsigned char) buf[0]; 814 return (u_char) buf[0];
815} 815}
816 816
817int 817int
818packet_read_poll2(int *payload_len_ptr) 818packet_read_poll2(int *payload_len_ptr)
819{ 819{
820 unsigned int padlen, need; 820 u_int padlen, need;
821 unsigned char buf[8], *macbuf; 821 u_char buf[8], *macbuf;
822 unsigned char *ucp; 822 u_char *ucp;
823 char *cp; 823 char *cp;
824 static unsigned int packet_length = 0; 824 static u_int packet_length = 0;
825 static unsigned int seqnr = 0; 825 static u_int seqnr = 0;
826 int type; 826 int type;
827 int maclen, block_size; 827 int maclen, block_size;
828 Enc *enc = NULL; 828 Enc *enc = NULL;
@@ -848,7 +848,7 @@ packet_read_poll2(int *payload_len_ptr)
848 buffer_append_space(&incoming_packet, &cp, block_size); 848 buffer_append_space(&incoming_packet, &cp, block_size);
849 packet_decrypt(&receive_context, cp, buffer_ptr(&input), 849 packet_decrypt(&receive_context, cp, buffer_ptr(&input),
850 block_size); 850 block_size);
851 ucp = (unsigned char *) buffer_ptr(&incoming_packet); 851 ucp = (u_char *) buffer_ptr(&incoming_packet);
852 packet_length = GET_32BIT(ucp); 852 packet_length = GET_32BIT(ucp);
853 if (packet_length < 1 + 4 || packet_length > 256 * 1024) { 853 if (packet_length < 1 + 4 || packet_length > 256 * 1024) {
854 buffer_dump(&incoming_packet); 854 buffer_dump(&incoming_packet);
@@ -883,7 +883,7 @@ packet_read_poll2(int *payload_len_ptr)
883 */ 883 */
884 if (mac && mac->enabled) { 884 if (mac && mac->enabled) {
885 macbuf = hmac( mac->md, seqnr, 885 macbuf = hmac( mac->md, seqnr,
886 (unsigned char *) buffer_ptr(&incoming_packet), 886 (u_char *) buffer_ptr(&incoming_packet),
887 buffer_len(&incoming_packet), 887 buffer_len(&incoming_packet),
888 mac->key, mac->key_len 888 mac->key, mac->key_len
889 ); 889 );
@@ -926,7 +926,7 @@ packet_read_poll2(int *payload_len_ptr)
926 packet_length = 0; 926 packet_length = 0;
927 927
928 /* extract packet type */ 928 /* extract packet type */
929 type = (unsigned char)buf[0]; 929 type = (u_char)buf[0];
930 930
931 if (type == SSH2_MSG_NEWKEYS) { 931 if (type == SSH2_MSG_NEWKEYS) {
932 if (kex==NULL || mac==NULL || enc==NULL || comp==NULL) 932 if (kex==NULL || mac==NULL || enc==NULL || comp==NULL)
@@ -949,7 +949,7 @@ packet_read_poll2(int *payload_len_ptr)
949 fprintf(stderr, "read/plain[%d]:\r\n",type); 949 fprintf(stderr, "read/plain[%d]:\r\n",type);
950 buffer_dump(&incoming_packet); 950 buffer_dump(&incoming_packet);
951#endif 951#endif
952 return (unsigned char)type; 952 return (u_char)type;
953} 953}
954 954
955int 955int
@@ -1018,24 +1018,24 @@ packet_read_poll(int *payload_len_ptr)
1018 */ 1018 */
1019 1019
1020void 1020void
1021packet_process_incoming(const char *buf, unsigned int len) 1021packet_process_incoming(const char *buf, u_int len)
1022{ 1022{
1023 buffer_append(&input, buf, len); 1023 buffer_append(&input, buf, len);
1024} 1024}
1025 1025
1026/* Returns a character from the packet. */ 1026/* Returns a character from the packet. */
1027 1027
1028unsigned int 1028u_int
1029packet_get_char() 1029packet_get_char()
1030{ 1030{
1031 char ch; 1031 char ch;
1032 buffer_get(&incoming_packet, &ch, 1); 1032 buffer_get(&incoming_packet, &ch, 1);
1033 return (unsigned char) ch; 1033 return (u_char) ch;
1034} 1034}
1035 1035
1036/* Returns an integer from the packet data. */ 1036/* Returns an integer from the packet data. */
1037 1037
1038unsigned int 1038u_int
1039packet_get_int() 1039packet_get_int()
1040{ 1040{
1041 return buffer_get_int(&incoming_packet); 1041 return buffer_get_int(&incoming_packet);
@@ -1081,7 +1081,7 @@ packet_remaining(void)
1081 */ 1081 */
1082 1082
1083char * 1083char *
1084packet_get_string(unsigned int *length_ptr) 1084packet_get_string(u_int *length_ptr)
1085{ 1085{
1086 return buffer_get_string(&incoming_packet, length_ptr); 1086 return buffer_get_string(&incoming_packet, length_ptr);
1087} 1087}
diff --git a/packet.h b/packet.h
index 7a3935399..597fbb151 100644
--- a/packet.h
+++ b/packet.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: packet.h,v 1.17 2000/09/07 20:27:52 deraadt Exp $"); */ 14/* RCSID("$OpenBSD: packet.h,v 1.18 2000/12/19 23:17:57 markus Exp $"); */
15 15
16#ifndef PACKET_H 16#ifndef PACKET_H
17#define PACKET_H 17#define PACKET_H
@@ -46,17 +46,17 @@ void packet_close(void);
46 * encrypted independently of each other. Cipher types are defined in ssh.h. 46 * encrypted independently of each other. Cipher types are defined in ssh.h.
47 */ 47 */
48void 48void
49packet_set_encryption_key(const unsigned char *key, unsigned int keylen, 49packet_set_encryption_key(const u_char *key, u_int keylen,
50 int cipher_type); 50 int cipher_type);
51 51
52/* 52/*
53 * Sets remote side protocol flags for the current connection. This can be 53 * Sets remote side protocol flags for the current connection. This can be
54 * called at any time. 54 * called at any time.
55 */ 55 */
56void packet_set_protocol_flags(unsigned int flags); 56void packet_set_protocol_flags(u_int flags);
57 57
58/* Returns the remote protocol flags set earlier by the above function. */ 58/* Returns the remote protocol flags set earlier by the above function. */
59unsigned int packet_get_protocol_flags(void); 59u_int packet_get_protocol_flags(void);
60 60
61/* Enables compression in both directions starting from the next packet. */ 61/* Enables compression in both directions starting from the next packet. */
62void packet_start_compression(int level); 62void packet_start_compression(int level);
@@ -77,16 +77,16 @@ void packet_start(int type);
77void packet_put_char(int ch); 77void packet_put_char(int ch);
78 78
79/* Appends an integer to the packet data. */ 79/* Appends an integer to the packet data. */
80void packet_put_int(unsigned int value); 80void packet_put_int(u_int value);
81 81
82/* Appends an arbitrary precision integer to packet data. */ 82/* Appends an arbitrary precision integer to packet data. */
83void packet_put_bignum(BIGNUM * value); 83void packet_put_bignum(BIGNUM * value);
84void packet_put_bignum2(BIGNUM * value); 84void packet_put_bignum2(BIGNUM * value);
85 85
86/* Appends a string to packet data. */ 86/* Appends a string to packet data. */
87void packet_put_string(const char *buf, unsigned int len); 87void packet_put_string(const char *buf, u_int len);
88void packet_put_cstring(const char *str); 88void packet_put_cstring(const char *str);
89void packet_put_raw(const char *buf, unsigned int len); 89void packet_put_raw(const char *buf, u_int len);
90 90
91/* 91/*
92 * Finalizes and sends the packet. If the encryption key has been set, 92 * Finalizes and sends the packet. If the encryption key has been set,
@@ -117,13 +117,13 @@ int packet_read_poll(int *packet_len_ptr);
117 * Buffers the given amount of input characters. This is intended to be used 117 * Buffers the given amount of input characters. This is intended to be used
118 * together with packet_read_poll. 118 * together with packet_read_poll.
119 */ 119 */
120void packet_process_incoming(const char *buf, unsigned int len); 120void packet_process_incoming(const char *buf, u_int len);
121 121
122/* Returns a character (0-255) from the packet data. */ 122/* Returns a character (0-255) from the packet data. */
123unsigned int packet_get_char(void); 123u_int packet_get_char(void);
124 124
125/* Returns an integer from the packet data. */ 125/* Returns an integer from the packet data. */
126unsigned int packet_get_int(void); 126u_int packet_get_int(void);
127 127
128/* 128/*
129 * Returns an arbitrary precision integer from the packet data. The integer 129 * Returns an arbitrary precision integer from the packet data. The integer
@@ -139,7 +139,7 @@ char *packet_get_raw(int *length_ptr);
139 * no longer needed. The length_ptr argument may be NULL, or point to an 139 * no longer needed. The length_ptr argument may be NULL, or point to an
140 * integer into which the length of the string is stored. 140 * integer into which the length of the string is stored.
141 */ 141 */
142char *packet_get_string(unsigned int *length_ptr); 142char *packet_get_string(u_int *length_ptr);
143 143
144/* 144/*
145 * Logs the error in syslog using LOG_INFO, constructs and sends a disconnect 145 * Logs the error in syslog using LOG_INFO, constructs and sends a disconnect
diff --git a/pty.c b/pty.c
index d05cb89a7..37a907822 100644
--- a/pty.c
+++ b/pty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: pty.c,v 1.18 2000/12/13 06:36:05 deraadt Exp $"); 15RCSID("$OpenBSD: pty.c,v 1.19 2000/12/20 20:00:34 markus Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
diff --git a/radix.c b/radix.c
index 842920484..939d0f7fc 100644
--- a/radix.c
+++ b/radix.c
@@ -25,14 +25,14 @@
25#include "includes.h" 25#include "includes.h"
26#include "uuencode.h" 26#include "uuencode.h"
27 27
28RCSID("$OpenBSD: radix.c,v 1.13 2000/09/07 20:27:52 deraadt Exp $"); 28RCSID("$OpenBSD: radix.c,v 1.14 2000/12/19 23:17:57 markus Exp $");
29 29
30#ifdef AFS 30#ifdef AFS
31#include <krb.h> 31#include <krb.h>
32 32
33typedef unsigned char my_u_char; 33typedef u_char my_u_char;
34typedef unsigned int my_u_int32_t; 34typedef u_int my_u_int32_t;
35typedef unsigned short my_u_short; 35typedef u_short my_u_short;
36 36
37/* Nasty macros from BIND-4.9.2 */ 37/* Nasty macros from BIND-4.9.2 */
38 38
@@ -89,7 +89,7 @@ typedef unsigned short my_u_short;
89 89
90 90
91int 91int
92creds_to_radix(CREDENTIALS *creds, unsigned char *buf, size_t buflen) 92creds_to_radix(CREDENTIALS *creds, u_char *buf, size_t buflen)
93{ 93{
94 char *p, *s; 94 char *p, *s;
95 int len; 95 int len;
@@ -123,8 +123,8 @@ creds_to_radix(CREDENTIALS *creds, unsigned char *buf, size_t buflen)
123 123
124 PUTLONG(creds->issue_date, p); 124 PUTLONG(creds->issue_date, p);
125 { 125 {
126 unsigned int endTime; 126 u_int endTime;
127 endTime = (unsigned int) krb_life_to_time(creds->issue_date, 127 endTime = (u_int) krb_life_to_time(creds->issue_date,
128 creds->lifetime); 128 creds->lifetime);
129 PUTLONG(endTime, p); 129 PUTLONG(endTime, p);
130 } 130 }
@@ -139,7 +139,7 @@ creds_to_radix(CREDENTIALS *creds, unsigned char *buf, size_t buflen)
139 p += creds->ticket_st.length; 139 p += creds->ticket_st.length;
140 len = p - temp; 140 len = p - temp;
141 141
142 return (uuencode((unsigned char *)temp, len, (char *)buf, buflen)); 142 return (uuencode((u_char *)temp, len, (char *)buf, buflen));
143} 143}
144 144
145int 145int
@@ -151,7 +151,7 @@ radix_to_creds(const char *buf, CREDENTIALS *creds)
151 char version; 151 char version;
152 char temp[2048]; 152 char temp[2048];
153 153
154 len = uudecode(buf, (unsigned char *)temp, sizeof(temp)); 154 len = uudecode(buf, (u_char *)temp, sizeof(temp));
155 if (len < 0) 155 if (len < 0)
156 return 0; 156 return 0;
157 157
@@ -184,7 +184,7 @@ radix_to_creds(const char *buf, CREDENTIALS *creds)
184 GETLONG(creds->issue_date, p); 184 GETLONG(creds->issue_date, p);
185 len -= 4; 185 len -= 4;
186 { 186 {
187 unsigned int endTime; 187 u_int endTime;
188 GETLONG(endTime, p); 188 GETLONG(endTime, p);
189 len -= 4; 189 len -= 4;
190 creds->lifetime = krb_time_to_life(creds->issue_date, endTime); 190 creds->lifetime = krb_time_to_life(creds->issue_date, endTime);
diff --git a/readconf.c b/readconf.c
index c821d8408..6f5ac8ca6 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.50 2000/11/12 19:50:37 markus Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.51 2000/12/19 23:17:57 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "readconf.h" 18#include "readconf.h"
@@ -215,7 +215,7 @@ add_remote_forward(Options *options, u_short port, const char *host,
215static OpCodes 215static OpCodes
216parse_token(const char *cp, const char *filename, int linenum) 216parse_token(const char *cp, const char *filename, int linenum)
217{ 217{
218 unsigned int i; 218 u_int i;
219 219
220 for (i = 0; keywords[i].name; i++) 220 for (i = 0; keywords[i].name; i++)
221 if (strcasecmp(cp, keywords[i].name) == 0) 221 if (strcasecmp(cp, keywords[i].name) == 0)
@@ -573,10 +573,10 @@ parse_int:
573 if (!arg || *arg == '\0') 573 if (!arg || *arg == '\0')
574 fatal("%.200s line %d: Missing argument.", filename, linenum); 574 fatal("%.200s line %d: Missing argument.", filename, linenum);
575 if (arg[0] == '^' && arg[2] == 0 && 575 if (arg[0] == '^' && arg[2] == 0 &&
576 (unsigned char) arg[1] >= 64 && (unsigned char) arg[1] < 128) 576 (u_char) arg[1] >= 64 && (u_char) arg[1] < 128)
577 value = (unsigned char) arg[1] & 31; 577 value = (u_char) arg[1] & 31;
578 else if (strlen(arg) == 1) 578 else if (strlen(arg) == 1)
579 value = (unsigned char) arg[0]; 579 value = (u_char) arg[0];
580 else if (strcmp(arg, "none") == 0) 580 else if (strcmp(arg, "none") == 0)
581 value = -2; 581 value = -2;
582 else { 582 else {
diff --git a/rsa.c b/rsa.c
index 8ef7b22ce..e5eea29f5 100644
--- a/rsa.c
+++ b/rsa.c
@@ -60,7 +60,7 @@
60 */ 60 */
61 61
62#include "includes.h" 62#include "includes.h"
63RCSID("$OpenBSD: rsa.c,v 1.17 2000/11/12 19:50:37 markus Exp $"); 63RCSID("$OpenBSD: rsa.c,v 1.18 2000/12/19 23:17:57 markus Exp $");
64 64
65#include "rsa.h" 65#include "rsa.h"
66#include "ssh.h" 66#include "ssh.h"
@@ -69,7 +69,7 @@ RCSID("$OpenBSD: rsa.c,v 1.17 2000/11/12 19:50:37 markus Exp $");
69void 69void
70rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) 70rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key)
71{ 71{
72 unsigned char *inbuf, *outbuf; 72 u_char *inbuf, *outbuf;
73 int len, ilen, olen; 73 int len, ilen, olen;
74 74
75 if (BN_num_bits(key->e) < 2 || !BN_is_odd(key->e)) 75 if (BN_num_bits(key->e) < 2 || !BN_is_odd(key->e))
@@ -97,7 +97,7 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key)
97void 97void
98rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) 98rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key)
99{ 99{
100 unsigned char *inbuf, *outbuf; 100 u_char *inbuf, *outbuf;
101 int len, ilen, olen; 101 int len, ilen, olen;
102 102
103 olen = BN_num_bytes(key->n); 103 olen = BN_num_bytes(key->n);
diff --git a/scp.c b/scp.c
index 0323409b9..1fb87f42b 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.46 2000/12/16 09:53:57 markus Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.47 2000/12/19 23:17:57 markus Exp $");
79 79
80#include "ssh.h" 80#include "ssh.h"
81#include "xmalloc.h" 81#include "xmalloc.h"
@@ -115,7 +115,7 @@ void addargs(char *fmt, ...) __attribute__((format(printf, 1, 2)));
115static struct timeval start; 115static struct timeval start;
116 116
117/* Number of bytes of current file transferred so far. */ 117/* Number of bytes of current file transferred so far. */
118volatile unsigned long statbytes; 118volatile u_long statbytes;
119 119
120/* Total size of current file. */ 120/* Total size of current file. */
121off_t totalbytes = 0; 121off_t totalbytes = 0;
@@ -547,16 +547,16 @@ syserr: run_err("%s: %s", name, strerror(errno));
547 * versions expecting microseconds. 547 * versions expecting microseconds.
548 */ 548 */
549 (void) sprintf(buf, "T%lu 0 %lu 0\n", 549 (void) sprintf(buf, "T%lu 0 %lu 0\n",
550 (unsigned long) stb.st_mtime, 550 (u_long) stb.st_mtime,
551 (unsigned long) stb.st_atime); 551 (u_long) stb.st_atime);
552 (void) atomicio(write, remout, buf, strlen(buf)); 552 (void) atomicio(write, remout, buf, strlen(buf));
553 if (response() < 0) 553 if (response() < 0)
554 goto next; 554 goto next;
555 } 555 }
556#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) 556#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
557 sprintf(buf, "C%04o %lu %s\n", 557 sprintf(buf, "C%04o %lu %s\n",
558 (unsigned int) (stb.st_mode & FILEMODEMASK), 558 (u_int) (stb.st_mode & FILEMODEMASK),
559 (unsigned long) stb.st_size, last); 559 (u_long) stb.st_size, last);
560 if (verbose_mode) { 560 if (verbose_mode) {
561 fprintf(stderr, "Sending file modes: %s", buf); 561 fprintf(stderr, "Sending file modes: %s", buf);
562 fflush(stderr); 562 fflush(stderr);
@@ -624,8 +624,8 @@ rsource(name, statp)
624 last++; 624 last++;
625 if (pflag) { 625 if (pflag) {
626 (void) sprintf(path, "T%lu 0 %lu 0\n", 626 (void) sprintf(path, "T%lu 0 %lu 0\n",
627 (unsigned long) statp->st_mtime, 627 (u_long) statp->st_mtime,
628 (unsigned long) statp->st_atime); 628 (u_long) statp->st_atime);
629 (void) atomicio(write, remout, path, strlen(path)); 629 (void) atomicio(write, remout, path, strlen(path));
630 if (response() < 0) { 630 if (response() < 0) {
631 closedir(dirp); 631 closedir(dirp);
@@ -633,7 +633,7 @@ rsource(name, statp)
633 } 633 }
634 } 634 }
635 (void) sprintf(path, "D%04o %d %.1024s\n", 635 (void) sprintf(path, "D%04o %d %.1024s\n",
636 (unsigned int) (statp->st_mode & FILEMODEMASK), 0, last); 636 (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
637 if (verbose_mode) 637 if (verbose_mode)
638 fprintf(stderr, "Entering directory: %s", path); 638 fprintf(stderr, "Entering directory: %s", path);
639 (void) atomicio(write, remout, path, strlen(path)); 639 (void) atomicio(write, remout, path, strlen(path));
diff --git a/servconf.c b/servconf.c
index 5da55de03..8dd6e7d88 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.54 2000/11/12 19:50:38 markus Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.55 2000/12/19 23:17:57 markus Exp $");
14 14
15#include "ssh.h" 15#include "ssh.h"
16#include "servconf.h" 16#include "servconf.h"
@@ -269,7 +269,7 @@ static ServerOpCodes
269parse_token(const char *cp, const char *filename, 269parse_token(const char *cp, const char *filename,
270 int linenum) 270 int linenum)
271{ 271{
272 unsigned int i; 272 u_int i;
273 273
274 for (i = 0; keywords[i].name; i++) 274 for (i = 0; keywords[i].name; i++)
275 if (strcasecmp(cp, keywords[i].name) == 0) 275 if (strcasecmp(cp, keywords[i].name) == 0)
diff --git a/servconf.h b/servconf.h
index 3ecf6a00d..7d5016662 100644
--- a/servconf.h
+++ b/servconf.h
@@ -11,7 +11,7 @@
11 * called by a name other than "ssh" or "Secure Shell". 11 * called by a name other than "ssh" or "Secure Shell".
12 */ 12 */
13 13
14/* RCSID("$OpenBSD: servconf.h,v 1.31 2000/11/12 19:50:38 markus Exp $"); */ 14/* RCSID("$OpenBSD: servconf.h,v 1.32 2000/12/19 23:17:58 markus Exp $"); */
15 15
16#ifndef SERVCONF_H 16#ifndef SERVCONF_H
17#define SERVCONF_H 17#define SERVCONF_H
@@ -26,8 +26,8 @@
26#define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 26#define MAX_HOSTKEYS 256 /* Max # hostkeys. */
27 27
28typedef struct { 28typedef struct {
29 unsigned int num_ports; 29 u_int num_ports;
30 unsigned int ports_from_cmdline; 30 u_int ports_from_cmdline;
31 u_short ports[MAX_PORTS]; /* Port number to listen on. */ 31 u_short ports[MAX_PORTS]; /* Port number to listen on. */
32 char *listen_addr; /* Address on which the server listens. */ 32 char *listen_addr; /* Address on which the server listens. */
33 struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ 33 struct addrinfo *listen_addrs; /* Addresses on which the server listens. */
@@ -88,16 +88,16 @@ typedef struct {
88 * passwords. */ 88 * passwords. */
89 int use_login; /* If true, login(1) is used */ 89 int use_login; /* If true, login(1) is used */
90 int allow_tcp_forwarding; 90 int allow_tcp_forwarding;
91 unsigned int num_allow_users; 91 u_int num_allow_users;
92 char *allow_users[MAX_ALLOW_USERS]; 92 char *allow_users[MAX_ALLOW_USERS];
93 unsigned int num_deny_users; 93 u_int num_deny_users;
94 char *deny_users[MAX_DENY_USERS]; 94 char *deny_users[MAX_DENY_USERS];
95 unsigned int num_allow_groups; 95 u_int num_allow_groups;
96 char *allow_groups[MAX_ALLOW_GROUPS]; 96 char *allow_groups[MAX_ALLOW_GROUPS];
97 unsigned int num_deny_groups; 97 u_int num_deny_groups;
98 char *deny_groups[MAX_DENY_GROUPS]; 98 char *deny_groups[MAX_DENY_GROUPS];
99 99
100 unsigned int num_subsystems; 100 u_int num_subsystems;
101 char *subsystem_name[MAX_SUBSYSTEMS]; 101 char *subsystem_name[MAX_SUBSYSTEMS];
102 char *subsystem_command[MAX_SUBSYSTEMS]; 102 char *subsystem_command[MAX_SUBSYSTEMS];
103 103
diff --git a/serverloop.c b/serverloop.c
index 79ef3607b..57e7f1f73 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.36 2000/12/05 20:34:10 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.38 2000/12/19 23:17:58 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "ssh.h" 41#include "ssh.h"
@@ -70,7 +70,7 @@ static int fdout_eof = 0; /* EOF encountered reading from fdout. */
70static int fderr_eof = 0; /* EOF encountered readung from fderr. */ 70static int fderr_eof = 0; /* EOF encountered readung from fderr. */
71static int connection_in; /* Connection to client (input). */ 71static int connection_in; /* Connection to client (input). */
72static int connection_out; /* Connection to client (output). */ 72static int connection_out; /* Connection to client (output). */
73static unsigned int buffer_high;/* "Soft" max buffer size. */ 73static u_int buffer_high;/* "Soft" max buffer size. */
74static int max_fd; /* Max file descriptor number for select(). */ 74static int max_fd; /* Max file descriptor number for select(). */
75 75
76/* 76/*
@@ -179,7 +179,7 @@ make_packets_from_stdout_data()
179 */ 179 */
180void 180void
181wait_until_can_do_something(fd_set * readset, fd_set * writeset, 181wait_until_can_do_something(fd_set * readset, fd_set * writeset,
182 unsigned int max_time_milliseconds) 182 u_int max_time_milliseconds)
183{ 183{
184 struct timeval tv, *tvp; 184 struct timeval tv, *tvp;
185 int ret; 185 int ret;
@@ -402,9 +402,9 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
402 int wait_status; /* Status returned by wait(). */ 402 int wait_status; /* Status returned by wait(). */
403 pid_t wait_pid; /* pid returned by wait(). */ 403 pid_t wait_pid; /* pid returned by wait(). */
404 int waiting_termination = 0; /* Have displayed waiting close message. */ 404 int waiting_termination = 0; /* Have displayed waiting close message. */
405 unsigned int max_time_milliseconds; 405 u_int max_time_milliseconds;
406 unsigned int previous_stdout_buffer_bytes; 406 u_int previous_stdout_buffer_bytes;
407 unsigned int stdout_buffer_bytes; 407 u_int stdout_buffer_bytes;
408 int type; 408 int type;
409 409
410 debug("Entering interactive session."); 410 debug("Entering interactive session.");
@@ -578,7 +578,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
578 578
579 /* Wait for the child to exit. Get its exit status. */ 579 /* Wait for the child to exit. Get its exit status. */
580 wait_pid = wait(&wait_status); 580 wait_pid = wait(&wait_status);
581 if (wait_pid < 0) { 581 if (wait_pid == -1) {
582 /* 582 /*
583 * It is possible that the wait was handled by SIGCHLD 583 * It is possible that the wait was handled by SIGCHLD
584 * handler. This may result in either: this call 584 * handler. This may result in either: this call
@@ -683,7 +683,7 @@ void
683server_input_stdin_data(int type, int plen, void *ctxt) 683server_input_stdin_data(int type, int plen, void *ctxt)
684{ 684{
685 char *data; 685 char *data;
686 unsigned int data_len; 686 u_int data_len;
687 687
688 /* Stdin data from the client. Append it to the buffer. */ 688 /* Stdin data from the client. Append it to the buffer. */
689 /* Ignore any data if the client has closed stdin. */ 689 /* Ignore any data if the client has closed stdin. */
@@ -789,7 +789,7 @@ server_input_channel_open(int type, int plen, void *ctxt)
789{ 789{
790 Channel *c = NULL; 790 Channel *c = NULL;
791 char *ctype; 791 char *ctype;
792 unsigned int len; 792 u_int len;
793 int rchan; 793 int rchan;
794 int rmaxpack; 794 int rmaxpack;
795 int rwindow; 795 int rwindow;
diff --git a/session.c b/session.c
index 1e996f95a..a376aa963 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.44 2000/11/14 23:44:19 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.45 2000/12/19 23:17:58 markus Exp $");
37 37
38#include "xmalloc.h" 38#include "xmalloc.h"
39#include "ssh.h" 39#include "ssh.h"
@@ -137,7 +137,7 @@ extern ServerOptions options;
137extern char *__progname; 137extern char *__progname;
138extern int log_stderr; 138extern int log_stderr;
139extern int debug_flag; 139extern int debug_flag;
140extern unsigned int utmp_len; 140extern u_int utmp_len;
141 141
142extern int startup_pipe; 142extern int startup_pipe;
143 143
@@ -218,7 +218,7 @@ do_authenticated(struct passwd * pw)
218 char *command; 218 char *command;
219 int n_bytes; 219 int n_bytes;
220 int plen; 220 int plen;
221 unsigned int proto_len, data_len, dlen; 221 u_int proto_len, data_len, dlen;
222 222
223 /* 223 /*
224 * Cancel the alarm we set to limit the time taken for 224 * Cancel the alarm we set to limit the time taken for
@@ -783,10 +783,10 @@ do_login(Session *s, const char *command)
783 * already exists, its value is overriden. 783 * already exists, its value is overriden.
784 */ 784 */
785void 785void
786child_set_env(char ***envp, unsigned int *envsizep, const char *name, 786child_set_env(char ***envp, u_int *envsizep, const char *name,
787 const char *value) 787 const char *value)
788{ 788{
789 unsigned int i, namelen; 789 u_int i, namelen;
790 char **env; 790 char **env;
791 791
792 /* 792 /*
@@ -824,7 +824,7 @@ child_set_env(char ***envp, unsigned int *envsizep, const char *name,
824 * and assignments of the form name=value. No other forms are allowed. 824 * and assignments of the form name=value. No other forms are allowed.
825 */ 825 */
826void 826void
827read_environment_file(char ***env, unsigned int *envsize, 827read_environment_file(char ***env, u_int *envsize,
828 const char *filename) 828 const char *filename)
829{ 829{
830 FILE *f; 830 FILE *f;
@@ -1009,7 +1009,7 @@ do_child(const char *command, struct passwd * pw, const char *term,
1009 char buf[256]; 1009 char buf[256];
1010 char cmd[1024]; 1010 char cmd[1024];
1011 FILE *f = NULL; 1011 FILE *f = NULL;
1012 unsigned int envsize, i; 1012 u_int envsize, i;
1013 char **env; 1013 char **env;
1014 extern char **environ; 1014 extern char **environ;
1015 struct stat st; 1015 struct stat st;
@@ -1579,7 +1579,7 @@ session_window_change_req(Session *s)
1579int 1579int
1580session_pty_req(Session *s) 1580session_pty_req(Session *s)
1581{ 1581{
1582 unsigned int len; 1582 u_int len;
1583 char *term_modes; /* encoded terminal modes */ 1583 char *term_modes; /* encoded terminal modes */
1584 1584
1585 if (no_pty_flag) 1585 if (no_pty_flag)
@@ -1628,7 +1628,7 @@ session_pty_req(Session *s)
1628int 1628int
1629session_subsystem_req(Session *s) 1629session_subsystem_req(Session *s)
1630{ 1630{
1631 unsigned int len; 1631 u_int len;
1632 int success = 0; 1632 int success = 0;
1633 char *subsys = packet_get_string(&len); 1633 char *subsys = packet_get_string(&len);
1634 int i; 1634 int i;
@@ -1724,7 +1724,7 @@ session_shell_req(Session *s)
1724int 1724int
1725session_exec_req(Session *s) 1725session_exec_req(Session *s)
1726{ 1726{
1727 unsigned int len; 1727 u_int len;
1728 char *command = packet_get_string(&len); 1728 char *command = packet_get_string(&len);
1729 packet_done(); 1729 packet_done();
1730 if (forced_command) { 1730 if (forced_command) {
@@ -1762,7 +1762,7 @@ session_auth_agent_req(Session *s)
1762void 1762void
1763session_input_channel_req(int id, void *arg) 1763session_input_channel_req(int id, void *arg)
1764{ 1764{
1765 unsigned int len; 1765 u_int len;
1766 int reply; 1766 int reply;
1767 int success = 0; 1767 int success = 0;
1768 char *rtype; 1768 char *rtype;
diff --git a/sftp-server.c b/sftp-server.c
index 8a77e58c2..7113bce82 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: sftp-server.c,v 1.8 2000/12/19 22:43:44 markus Exp $"); 25RCSID("$OpenBSD: sftp-server.c,v 1.9 2000/12/19 23:17:58 markus Exp $");
26 26
27#include "ssh.h" 27#include "ssh.h"
28#include "buffer.h" 28#include "buffer.h"
@@ -944,13 +944,13 @@ process_rename(void)
944void 944void
945process(void) 945process(void)
946{ 946{
947 unsigned int msg_len; 947 u_int msg_len;
948 unsigned int type; 948 u_int type;
949 unsigned char *cp; 949 u_char *cp;
950 950
951 if (buffer_len(&iqueue) < 5) 951 if (buffer_len(&iqueue) < 5)
952 return; /* Incomplete message. */ 952 return; /* Incomplete message. */
953 cp = (unsigned char *) buffer_ptr(&iqueue); 953 cp = (u_char *) buffer_ptr(&iqueue);
954 msg_len = GET_32BIT(cp); 954 msg_len = GET_32BIT(cp);
955 if (msg_len > 256 * 1024) { 955 if (msg_len > 256 * 1024) {
956 error("bad message "); 956 error("bad message ");
diff --git a/ssh-agent.c b/ssh-agent.c
index 00e813218..9c0a583e8 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.44 2000/12/19 22:43:45 markus Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.45 2000/12/19 23:17:58 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: ssh-agent.c,v 1.44 2000/12/19 22:43:45 markus Exp $"); 40RCSID("$OpenBSD: ssh-agent.c,v 1.45 2000/12/19 23:17:58 markus Exp $");
41 41
42#include "ssh.h" 42#include "ssh.h"
43#include "rsa.h" 43#include "rsa.h"
@@ -66,7 +66,7 @@ typedef struct {
66 Buffer output; 66 Buffer output;
67} SocketEntry; 67} SocketEntry;
68 68
69unsigned int sockets_alloc = 0; 69u_int sockets_alloc = 0;
70SocketEntry *sockets = NULL; 70SocketEntry *sockets = NULL;
71 71
72typedef struct { 72typedef struct {
@@ -151,8 +151,8 @@ process_request_identities(SocketEntry *e, int version)
151 buffer_put_bignum(&msg, id->key->rsa->e); 151 buffer_put_bignum(&msg, id->key->rsa->e);
152 buffer_put_bignum(&msg, id->key->rsa->n); 152 buffer_put_bignum(&msg, id->key->rsa->n);
153 } else { 153 } else {
154 unsigned char *blob; 154 u_char *blob;
155 unsigned int blen; 155 u_int blen;
156 key_to_blob(id->key, &blob, &blen); 156 key_to_blob(id->key, &blob, &blen);
157 buffer_put_string(&msg, blob, blen); 157 buffer_put_string(&msg, blob, blen);
158 xfree(blob); 158 xfree(blob);
@@ -173,8 +173,8 @@ process_authentication_challenge1(SocketEntry *e)
173 int i, len; 173 int i, len;
174 Buffer msg; 174 Buffer msg;
175 MD5_CTX md; 175 MD5_CTX md;
176 unsigned char buf[32], mdbuf[16], session_id[16]; 176 u_char buf[32], mdbuf[16], session_id[16];
177 unsigned int response_type; 177 u_int response_type;
178 178
179 buffer_init(&msg); 179 buffer_init(&msg);
180 key = key_new(KEY_RSA1); 180 key = key_new(KEY_RSA1);
@@ -235,8 +235,8 @@ process_sign_request2(SocketEntry *e)
235{ 235{
236 extern int datafellows; 236 extern int datafellows;
237 Key *key, *private; 237 Key *key, *private;
238 unsigned char *blob, *data, *signature = NULL; 238 u_char *blob, *data, *signature = NULL;
239 unsigned int blen, dlen, slen = 0; 239 u_int blen, dlen, slen = 0;
240 int flags; 240 int flags;
241 Buffer msg; 241 Buffer msg;
242 int ok = -1; 242 int ok = -1;
@@ -279,9 +279,9 @@ void
279process_remove_identity(SocketEntry *e, int version) 279process_remove_identity(SocketEntry *e, int version)
280{ 280{
281 Key *key = NULL, *private; 281 Key *key = NULL, *private;
282 unsigned char *blob; 282 u_char *blob;
283 unsigned int blen; 283 u_int blen;
284 unsigned int bits; 284 u_int bits;
285 int success = 0; 285 int success = 0;
286 286
287 switch(version){ 287 switch(version){
@@ -339,7 +339,7 @@ process_remove_identity(SocketEntry *e, int version)
339void 339void
340process_remove_all_identities(SocketEntry *e, int version) 340process_remove_all_identities(SocketEntry *e, int version)
341{ 341{
342 unsigned int i; 342 u_int i;
343 Idtab *tab = idtab_lookup(version); 343 Idtab *tab = idtab_lookup(version);
344 344
345 /* Loop over all identities and clear the keys. */ 345 /* Loop over all identities and clear the keys. */
@@ -463,12 +463,12 @@ send:
463void 463void
464process_message(SocketEntry *e) 464process_message(SocketEntry *e)
465{ 465{
466 unsigned int msg_len; 466 u_int msg_len;
467 unsigned int type; 467 u_int type;
468 unsigned char *cp; 468 u_char *cp;
469 if (buffer_len(&e->input) < 5) 469 if (buffer_len(&e->input) < 5)
470 return; /* Incomplete message. */ 470 return; /* Incomplete message. */
471 cp = (unsigned char *) buffer_ptr(&e->input); 471 cp = (u_char *) buffer_ptr(&e->input);
472 msg_len = GET_32BIT(cp); 472 msg_len = GET_32BIT(cp);
473 if (msg_len > 256 * 1024) { 473 if (msg_len > 256 * 1024) {
474 shutdown(e->fd, SHUT_RDWR); 474 shutdown(e->fd, SHUT_RDWR);
@@ -527,7 +527,7 @@ process_message(SocketEntry *e)
527void 527void
528new_socket(int type, int fd) 528new_socket(int type, int fd)
529{ 529{
530 unsigned int i, old_alloc; 530 u_int i, old_alloc;
531 if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) 531 if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
532 error("fcntl O_NONBLOCK: %s", strerror(errno)); 532 error("fcntl O_NONBLOCK: %s", strerror(errno));
533 533
@@ -559,7 +559,7 @@ new_socket(int type, int fd)
559void 559void
560prepare_select(fd_set *readset, fd_set *writeset) 560prepare_select(fd_set *readset, fd_set *writeset)
561{ 561{
562 unsigned int i; 562 u_int i;
563 for (i = 0; i < sockets_alloc; i++) 563 for (i = 0; i < sockets_alloc; i++)
564 switch (sockets[i].type) { 564 switch (sockets[i].type) {
565 case AUTH_SOCKET: 565 case AUTH_SOCKET:
@@ -579,7 +579,7 @@ prepare_select(fd_set *readset, fd_set *writeset)
579void 579void
580after_select(fd_set *readset, fd_set *writeset) 580after_select(fd_set *readset, fd_set *writeset)
581{ 581{
582 unsigned int i; 582 u_int i;
583 int len, sock; 583 int len, sock;
584 socklen_t slen; 584 socklen_t slen;
585 char buf[1024]; 585 char buf[1024];
diff --git a/ssh-dss.c b/ssh-dss.c
index fea1fe2d5..96b1565d2 100644
--- a/ssh-dss.c
+++ b/ssh-dss.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-dss.c,v 1.1 2000/11/12 19:50:38 markus Exp $"); 26RCSID("$OpenBSD: ssh-dss.c,v 1.2 2000/12/19 23:17:58 markus Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "xmalloc.h" 29#include "xmalloc.h"
@@ -44,18 +44,18 @@ RCSID("$OpenBSD: ssh-dss.c,v 1.1 2000/11/12 19:50:38 markus Exp $");
44int 44int
45ssh_dss_sign( 45ssh_dss_sign(
46 Key *key, 46 Key *key,
47 unsigned char **sigp, int *lenp, 47 u_char **sigp, int *lenp,
48 unsigned char *data, int datalen) 48 u_char *data, int datalen)
49{ 49{
50 unsigned char *digest; 50 u_char *digest;
51 unsigned char *ret; 51 u_char *ret;
52 DSA_SIG *sig; 52 DSA_SIG *sig;
53 EVP_MD *evp_md = EVP_sha1(); 53 EVP_MD *evp_md = EVP_sha1();
54 EVP_MD_CTX md; 54 EVP_MD_CTX md;
55 unsigned int rlen; 55 u_int rlen;
56 unsigned int slen; 56 u_int slen;
57 unsigned int len; 57 u_int len;
58 unsigned char sigblob[SIGBLOB_LEN]; 58 u_char sigblob[SIGBLOB_LEN];
59 Buffer b; 59 Buffer b;
60 60
61 if (key == NULL || key->type != KEY_DSA || key->dsa == NULL) { 61 if (key == NULL || key->type != KEY_DSA || key->dsa == NULL) {
@@ -113,17 +113,17 @@ ssh_dss_sign(
113int 113int
114ssh_dss_verify( 114ssh_dss_verify(
115 Key *key, 115 Key *key,
116 unsigned char *signature, int signaturelen, 116 u_char *signature, int signaturelen,
117 unsigned char *data, int datalen) 117 u_char *data, int datalen)
118{ 118{
119 Buffer b; 119 Buffer b;
120 unsigned char *digest; 120 u_char *digest;
121 DSA_SIG *sig; 121 DSA_SIG *sig;
122 EVP_MD *evp_md = EVP_sha1(); 122 EVP_MD *evp_md = EVP_sha1();
123 EVP_MD_CTX md; 123 EVP_MD_CTX md;
124 unsigned char *sigblob; 124 u_char *sigblob;
125 char *txt; 125 char *txt;
126 unsigned int len, dlen; 126 u_int len, dlen;
127 int rlen; 127 int rlen;
128 int ret; 128 int ret;
129 129
@@ -159,7 +159,7 @@ ssh_dss_verify(
159 buffer_free(&b); 159 buffer_free(&b);
160 return -1; 160 return -1;
161 } 161 }
162 sigblob = (unsigned char *)buffer_get_string(&b, &len); 162 sigblob = (u_char *)buffer_get_string(&b, &len);
163 rlen = buffer_len(&b); 163 rlen = buffer_len(&b);
164 if(rlen != 0) { 164 if(rlen != 0) {
165 error("remaining bytes in signature %d", rlen); 165 error("remaining bytes in signature %d", rlen);
diff --git a/ssh-dss.h b/ssh-dss.h
index 7b376e82f..4252f3942 100644
--- a/ssh-dss.h
+++ b/ssh-dss.h
@@ -27,13 +27,13 @@
27int 27int
28ssh_dss_sign( 28ssh_dss_sign(
29 Key *key, 29 Key *key,
30 unsigned char **sigp, int *lenp, 30 u_char **sigp, int *lenp,
31 unsigned char *data, int datalen); 31 u_char *data, int datalen);
32 32
33int 33int
34ssh_dss_verify( 34ssh_dss_verify(
35 Key *key, 35 Key *key,
36 unsigned char *signature, int signaturelen, 36 u_char *signature, int signaturelen,
37 unsigned char *data, int datalen); 37 u_char *data, int datalen);
38 38
39#endif 39#endif
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 89c03d901..533cf192e 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.35 2000/11/25 17:19:33 markus Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.36 2000/12/19 23:17:58 markus Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -137,7 +137,7 @@ do_convert_to_ssh2(struct passwd *pw)
137{ 137{
138 Key *k; 138 Key *k;
139 int len; 139 int len;
140 unsigned char *blob; 140 u_char *blob;
141 struct stat st; 141 struct stat st;
142 142
143 if (!have_identity) 143 if (!have_identity)
@@ -171,7 +171,7 @@ buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
171 int bytes = (bits + 7) / 8; 171 int bytes = (bits + 7) / 8;
172 if (buffer_len(b) < bytes) 172 if (buffer_len(b) < bytes)
173 fatal("buffer_get_bignum_bits: input buffer too small"); 173 fatal("buffer_get_bignum_bits: input buffer too small");
174 BN_bin2bn((unsigned char *)buffer_ptr(b), bytes, value); 174 BN_bin2bn((u_char *)buffer_ptr(b), bytes, value);
175 buffer_consume(b, bytes); 175 buffer_consume(b, bytes);
176} 176}
177 177
@@ -275,7 +275,7 @@ do_convert_from_ssh2(struct passwd *pw)
275 *p = '\0'; 275 *p = '\0';
276 strlcat(encoded, line, sizeof(encoded)); 276 strlcat(encoded, line, sizeof(encoded));
277 } 277 }
278 blen = uudecode(encoded, (unsigned char *)blob, sizeof(blob)); 278 blen = uudecode(encoded, (u_char *)blob, sizeof(blob));
279 if (blen < 0) { 279 if (blen < 0) {
280 fprintf(stderr, "uudecode failed.\n"); 280 fprintf(stderr, "uudecode failed.\n");
281 exit(1); 281 exit(1);
@@ -332,7 +332,7 @@ do_fingerprint(struct passwd *pw)
332 Key *public; 332 Key *public;
333 char *comment = NULL, *cp, *ep, line[16*1024]; 333 char *comment = NULL, *cp, *ep, line[16*1024];
334 int i, skip = 0, num = 1, invalid = 1, success = 0; 334 int i, skip = 0, num = 1, invalid = 1, success = 0;
335 unsigned int ignore; 335 u_int ignore;
336 struct stat st; 336 struct stat st;
337 337
338 if (!have_identity) 338 if (!have_identity)
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index bd20fea2d..d85cc337f 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10#include "includes.h" 10#include "includes.h"
11RCSID("$OpenBSD: ssh-keyscan.c,v 1.5 2000/12/19 22:48:08 markus Exp $"); 11RCSID("$OpenBSD: ssh-keyscan.c,v 1.6 2000/12/19 23:17:58 markus Exp $");
12 12
13#ifdef HAVE_SYS_QUEUE_H 13#ifdef HAVE_SYS_QUEUE_H
14#include <sys/queue.h> 14#include <sys/queue.h>
@@ -53,7 +53,7 @@ int ncon;
53 * associated with file descriptor n is held in fdcon[n]. 53 * associated with file descriptor n is held in fdcon[n].
54 */ 54 */
55typedef struct Connection { 55typedef struct Connection {
56 unsigned char c_status; /* State of connection on this file desc. */ 56 u_char c_status; /* State of connection on this file desc. */
57#define CS_UNUSED 0 /* File descriptor unused */ 57#define CS_UNUSED 0 /* File descriptor unused */
58#define CS_CON 1 /* Waiting to connect/read greeting */ 58#define CS_CON 1 /* Waiting to connect/read greeting */
59#define CS_SIZE 2 /* Waiting to read initial packet size */ 59#define CS_SIZE 2 /* Waiting to read initial packet size */
@@ -83,7 +83,7 @@ con *fdcon;
83 83
84typedef struct { 84typedef struct {
85 char *buf; 85 char *buf;
86 unsigned int size; 86 u_int size;
87 int lineno; 87 int lineno;
88 const char *filename; 88 const char *filename;
89 FILE *stream; 89 FILE *stream;
diff --git a/ssh-rsa.c b/ssh-rsa.c
index cc31154d9..0f44051bc 100644
--- a/ssh-rsa.c
+++ b/ssh-rsa.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: ssh-rsa.c,v 1.1 2000/11/12 19:50:38 markus Exp $"); 26RCSID("$OpenBSD: ssh-rsa.c,v 1.2 2000/12/19 23:17:58 markus Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "xmalloc.h" 29#include "xmalloc.h"
@@ -44,13 +44,13 @@ RCSID("$OpenBSD: ssh-rsa.c,v 1.1 2000/11/12 19:50:38 markus Exp $");
44int 44int
45ssh_rsa_sign( 45ssh_rsa_sign(
46 Key *key, 46 Key *key,
47 unsigned char **sigp, int *lenp, 47 u_char **sigp, int *lenp,
48 unsigned char *data, int datalen) 48 u_char *data, int datalen)
49{ 49{
50 EVP_MD *evp_md = EVP_sha1(); 50 EVP_MD *evp_md = EVP_sha1();
51 EVP_MD_CTX md; 51 EVP_MD_CTX md;
52 unsigned char *digest, *sig, *ret; 52 u_char *digest, *sig, *ret;
53 unsigned int slen, dlen, len; 53 u_int slen, dlen, len;
54 int ok; 54 int ok;
55 Buffer b; 55 Buffer b;
56 56
@@ -109,15 +109,15 @@ ssh_rsa_sign(
109int 109int
110ssh_rsa_verify( 110ssh_rsa_verify(
111 Key *key, 111 Key *key,
112 unsigned char *signature, int signaturelen, 112 u_char *signature, int signaturelen,
113 unsigned char *data, int datalen) 113 u_char *data, int datalen)
114{ 114{
115 Buffer b; 115 Buffer b;
116 EVP_MD *evp_md = EVP_sha1(); 116 EVP_MD *evp_md = EVP_sha1();
117 EVP_MD_CTX md; 117 EVP_MD_CTX md;
118 char *ktype; 118 char *ktype;
119 unsigned char *sigblob, *digest; 119 u_char *sigblob, *digest;
120 unsigned int len, dlen; 120 u_int len, dlen;
121 int rlen; 121 int rlen;
122 int ret; 122 int ret;
123 123
@@ -135,7 +135,7 @@ ssh_rsa_verify(
135 return -1; 135 return -1;
136 } 136 }
137 xfree(ktype); 137 xfree(ktype);
138 sigblob = (unsigned char *)buffer_get_string(&b, &len); 138 sigblob = (u_char *)buffer_get_string(&b, &len);
139 rlen = buffer_len(&b); 139 rlen = buffer_len(&b);
140 buffer_free(&b); 140 buffer_free(&b);
141 if(rlen != 0) { 141 if(rlen != 0) {
diff --git a/ssh-rsa.h b/ssh-rsa.h
index 29a0c029c..fac96c724 100644
--- a/ssh-rsa.h
+++ b/ssh-rsa.h
@@ -27,13 +27,13 @@
27int 27int
28ssh_rsa_sign( 28ssh_rsa_sign(
29 Key *key, 29 Key *key,
30 unsigned char **sigp, int *lenp, 30 u_char **sigp, int *lenp,
31 unsigned char *data, int datalen); 31 u_char *data, int datalen);
32 32
33int 33int
34ssh_rsa_verify( 34ssh_rsa_verify(
35 Key *key, 35 Key *key,
36 unsigned char *signature, int signaturelen, 36 u_char *signature, int signaturelen,
37 unsigned char *data, int datalen); 37 u_char *data, int datalen);
38 38
39#endif 39#endif
diff --git a/ssh.c b/ssh.c
index c4ff5eed1..92564b97e 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.77 2000/12/12 23:11:48 markus Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.78 2000/12/19 23:17:58 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/dsa.h> 45#include <openssl/dsa.h>
@@ -400,10 +400,10 @@ main(int ac, char **av)
400 break; 400 break;
401 case 'e': 401 case 'e':
402 if (optarg[0] == '^' && optarg[2] == 0 && 402 if (optarg[0] == '^' && optarg[2] == 0 &&
403 (unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128) 403 (u_char) optarg[1] >= 64 && (u_char) optarg[1] < 128)
404 options.escape_char = (unsigned char) optarg[1] & 31; 404 options.escape_char = (u_char) optarg[1] & 31;
405 else if (strlen(optarg) == 1) 405 else if (strlen(optarg) == 1)
406 options.escape_char = (unsigned char) optarg[0]; 406 options.escape_char = (u_char) optarg[0];
407 else if (strcmp(optarg, "none") == 0) 407 else if (strcmp(optarg, "none") == 0)
408 options.escape_char = -2; 408 options.escape_char = -2;
409 else { 409 else {
diff --git a/ssh.h b/ssh.h
index 996b504a4..530006792 100644
--- a/ssh.h
+++ b/ssh.h
@@ -12,7 +12,7 @@
12 * called by a name other than "ssh" or "Secure Shell". 12 * called by a name other than "ssh" or "Secure Shell".
13 */ 13 */
14 14
15/* RCSID("$OpenBSD: ssh.h,v 1.55 2000/11/25 17:19:33 markus Exp $"); */ 15/* RCSID("$OpenBSD: ssh.h,v 1.56 2000/12/19 23:17:58 markus Exp $"); */
16 16
17#ifndef SSH_H 17#ifndef SSH_H
18#define SSH_H 18#define SSH_H
@@ -296,9 +296,9 @@
296 * information is not available. This must be called before record_login. 296 * information is not available. This must be called before record_login.
297 * The host from which the user logged in is stored in buf. 297 * The host from which the user logged in is stored in buf.
298 */ 298 */
299unsigned long 299u_long
300get_last_login_time(uid_t uid, const char *logname, 300get_last_login_time(uid_t uid, const char *logname,
301 char *buf, unsigned int bufsize); 301 char *buf, u_int bufsize);
302 302
303/* 303/*
304 * Records that the user has logged in. This does many things normally done 304 * Records that the user has logged in. This does many things normally done
@@ -377,7 +377,7 @@ int auth_rsa(struct passwd * pw, BIGNUM * client_n);
377 * Parses an RSA key (number of bits, e, n) from a string. Moves the pointer 377 * Parses an RSA key (number of bits, e, n) from a string. Moves the pointer
378 * over the key. Skips any whitespace at the beginning and at end. 378 * over the key. Skips any whitespace at the beginning and at end.
379 */ 379 */
380int auth_rsa_read_key(char **cpp, unsigned int *bitsp, BIGNUM * e, BIGNUM * n); 380int auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n);
381 381
382/* 382/*
383 * Returns the name of the machine at the other end of the socket. The 383 * Returns the name of the machine at the other end of the socket. The
@@ -543,7 +543,7 @@ int auth_krb4_password(struct passwd * pw, const char *password);
543int auth_kerberos_tgt(struct passwd * pw, const char *string); 543int auth_kerberos_tgt(struct passwd * pw, const char *string);
544int auth_afs_token(struct passwd * pw, const char *token_string); 544int auth_afs_token(struct passwd * pw, const char *token_string);
545 545
546int creds_to_radix(CREDENTIALS * creds, unsigned char *buf, size_t buflen); 546int creds_to_radix(CREDENTIALS * creds, u_char *buf, size_t buflen);
547int radix_to_creds(const char *buf, CREDENTIALS * creds); 547int radix_to_creds(const char *buf, CREDENTIALS * creds);
548#endif /* AFS */ 548#endif /* AFS */
549 549
diff --git a/sshconnect.c b/sshconnect.c
index b54e75a8a..647aec797 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.83 2000/11/30 22:53:35 markus Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.85 2000/12/21 15:10:17 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/dsa.h> 19#include <openssl/dsa.h>
@@ -472,6 +472,8 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
472 int local = 0, host_ip_differ = 0; 472 int local = 0, host_ip_differ = 0;
473 int salen; 473 int salen;
474 char ntop[NI_MAXHOST]; 474 char ntop[NI_MAXHOST];
475 int host_line = -1, ip_line = -1;
476 const char *host_file = NULL, *ip_file = NULL;
475 477
476 /* 478 /*
477 * Force accepting of the host key for loopback/localhost. The 479 * Force accepting of the host key for loopback/localhost. The
@@ -508,11 +510,17 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
508 if (options.proxy_command != NULL && options.check_host_ip) 510 if (options.proxy_command != NULL && options.check_host_ip)
509 options.check_host_ip = 0; 511 options.check_host_ip = 0;
510 512
511 if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), 513
512 NULL, 0, NI_NUMERICHOST) != 0) 514
513 fatal("check_host_key: getnameinfo failed"); 515 if (options.proxy_command == NULL) {
514 ip = xstrdup(ntop); 516 if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop),
515 517 NULL, 0, NI_NUMERICHOST) != 0)
518 fatal("check_host_key: getnameinfo failed");
519 ip = xstrdup(ntop);
520 } else {
521 ip = xstrdup("<no hostip for proxy command>");
522 }
523
516 /* 524 /*
517 * Store the host key from the known host file in here so that we can 525 * Store the host key from the known host file in here so that we can
518 * compare it with the key for the IP address. 526 * compare it with the key for the IP address.
@@ -523,19 +531,25 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
523 * Check if the host key is present in the user\'s list of known 531 * Check if the host key is present in the user\'s list of known
524 * hosts or in the systemwide list. 532 * hosts or in the systemwide list.
525 */ 533 */
526 host_status = check_host_in_hostfile(user_hostfile, host, host_key, file_key); 534 host_file = user_hostfile;
527 if (host_status == HOST_NEW) 535 host_status = check_host_in_hostfile(host_file, host, host_key, file_key, &host_line);
528 host_status = check_host_in_hostfile(system_hostfile, host, host_key, file_key); 536 if (host_status == HOST_NEW) {
537 host_file = system_hostfile;
538 host_status = check_host_in_hostfile(host_file, host, host_key, file_key, &host_line);
539 }
529 /* 540 /*
530 * Also perform check for the ip address, skip the check if we are 541 * Also perform check for the ip address, skip the check if we are
531 * localhost or the hostname was an ip address to begin with 542 * localhost or the hostname was an ip address to begin with
532 */ 543 */
533 if (options.check_host_ip && !local && strcmp(host, ip)) { 544 if (options.check_host_ip && !local && strcmp(host, ip)) {
534 Key *ip_key = key_new(host_key->type); 545 Key *ip_key = key_new(host_key->type);
535 ip_status = check_host_in_hostfile(user_hostfile, ip, host_key, ip_key);
536 546
537 if (ip_status == HOST_NEW) 547 ip_file = user_hostfile;
538 ip_status = check_host_in_hostfile(system_hostfile, ip, host_key, ip_key); 548 ip_status = check_host_in_hostfile(ip_file, ip, host_key, ip_key, &ip_line);
549 if (ip_status == HOST_NEW) {
550 ip_file = system_hostfile;
551 ip_status = check_host_in_hostfile(ip_file, ip, host_key, ip_key, &ip_line);
552 }
539 if (host_status == HOST_CHANGED && 553 if (host_status == HOST_CHANGED &&
540 (ip_status != HOST_CHANGED || !key_equal(ip_key, file_key))) 554 (ip_status != HOST_CHANGED || !key_equal(ip_key, file_key)))
541 host_ip_differ = 1; 555 host_ip_differ = 1;
@@ -551,6 +565,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
551 /* The host is known and the key matches. */ 565 /* The host is known and the key matches. */
552 debug("Host '%.200s' is known and matches the %s host key.", 566 debug("Host '%.200s' is known and matches the %s host key.",
553 host, type); 567 host, type);
568 debug("Found key in %s:%d", host_file, host_line);
554 if (options.check_host_ip) { 569 if (options.check_host_ip) {
555 if (ip_status == HOST_NEW) { 570 if (ip_status == HOST_NEW) {
556 if (!add_host_to_hostfile(user_hostfile, ip, host_key)) 571 if (!add_host_to_hostfile(user_hostfile, ip, host_key))
@@ -559,9 +574,13 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
559 else 574 else
560 log("Warning: Permanently added the %s host key for IP address '%.30s' to the list of known hosts.", 575 log("Warning: Permanently added the %s host key for IP address '%.30s' to the list of known hosts.",
561 type, ip); 576 type, ip);
562 } else if (ip_status != HOST_OK) 577 } else if (ip_status != HOST_OK) {
563 log("Warning: the %s host key for '%.200s' differs from the key for the IP address '%.30s'", 578 log("Warning: the %s host key for '%.200s' differs from the key for the IP address '%.30s'",
564 type, host, ip); 579 type, host, ip);
580 log("Found key in %s:%d", host_file, host_line);
581 if (ip_line != -1)
582 log("Offending key for IP in %s:%d", ip_file, ip_line);
583 }
565 } 584 }
566 break; 585 break;
567 case HOST_NEW: 586 case HOST_NEW:
@@ -612,7 +631,9 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
612 error("and the key for the according IP address %s", ip); 631 error("and the key for the according IP address %s", ip);
613 error("%s. This could either mean that", msg); 632 error("%s. This could either mean that", msg);
614 error("DNS SPOOFING is happening or the IP address for the host"); 633 error("DNS SPOOFING is happening or the IP address for the host");
615 error("and its host key have changed at the same time"); 634 error("and its host key have changed at the same time.");
635 if (ip_line != -1)
636 error("Offending key for IP in %s:%d", ip_file, ip_line);
616 } 637 }
617 /* The host key has changed. */ 638 /* The host key has changed. */
618 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 639 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
@@ -624,6 +645,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
624 error("Please contact your system administrator."); 645 error("Please contact your system administrator.");
625 error("Add correct host key in %.100s to get rid of this message.", 646 error("Add correct host key in %.100s to get rid of this message.",
626 user_hostfile); 647 user_hostfile);
648 error("Offending key in %s:%d", host_file, host_line);
627 649
628 /* 650 /*
629 * If strict host key checking is in use, the user will have 651 * If strict host key checking is in use, the user will have
diff --git a/sshconnect1.c b/sshconnect1.c
index f95c031da..d6230529f 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect1.c,v 1.12 2000/12/10 17:01:53 markus Exp $"); 16RCSID("$OpenBSD: sshconnect1.c,v 1.13 2000/12/19 23:17:58 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19#include <openssl/dsa.h> 19#include <openssl/dsa.h>
@@ -34,8 +34,8 @@ RCSID("$OpenBSD: sshconnect1.c,v 1.12 2000/12/10 17:01:53 markus Exp $");
34#include "authfile.h" 34#include "authfile.h"
35 35
36/* Session id for the current session. */ 36/* Session id for the current session. */
37unsigned char session_id[16]; 37u_char session_id[16];
38unsigned int supported_authentications = 0; 38u_int supported_authentications = 0;
39 39
40extern Options options; 40extern Options options;
41extern char *__progname; 41extern char *__progname;
@@ -50,8 +50,8 @@ try_agent_authentication()
50 int type; 50 int type;
51 char *comment; 51 char *comment;
52 AuthenticationConnection *auth; 52 AuthenticationConnection *auth;
53 unsigned char response[16]; 53 u_char response[16];
54 unsigned int i; 54 u_int i;
55 int plen, clen; 55 int plen, clen;
56 Key *key; 56 Key *key;
57 BIGNUM *challenge; 57 BIGNUM *challenge;
@@ -146,7 +146,7 @@ try_agent_authentication()
146void 146void
147respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) 147respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv)
148{ 148{
149 unsigned char buf[32], response[16]; 149 u_char buf[32], response[16];
150 MD5_CTX md; 150 MD5_CTX md;
151 int i, len; 151 int i, len;
152 152
@@ -441,7 +441,7 @@ try_kerberos_authentication()
441 debug("Kerberos V4 authentication accepted."); 441 debug("Kerberos V4 authentication accepted.");
442 442
443 /* Get server's response. */ 443 /* Get server's response. */
444 reply = packet_get_string((unsigned int *) &auth.length); 444 reply = packet_get_string((u_int *) &auth.length);
445 memcpy(auth.dat, reply, auth.length); 445 memcpy(auth.dat, reply, auth.length);
446 xfree(reply); 446 xfree(reply);
447 447
@@ -506,7 +506,7 @@ send_kerberos_tgt()
506 debug("Kerberos V4 ticket expired: %s", TKT_FILE); 506 debug("Kerberos V4 ticket expired: %s", TKT_FILE);
507 return 0; 507 return 0;
508 } 508 }
509 creds_to_radix(creds, (unsigned char *)buffer, sizeof buffer); 509 creds_to_radix(creds, (u_char *)buffer, sizeof buffer);
510 xfree(creds); 510 xfree(creds);
511 511
512 packet_start(SSH_CMSG_HAVE_KERBEROS_TGT); 512 packet_start(SSH_CMSG_HAVE_KERBEROS_TGT);
@@ -545,10 +545,10 @@ send_afs_tokens(void)
545 p = buf; 545 p = buf;
546 546
547 /* Get secret token. */ 547 /* Get secret token. */
548 memcpy(&creds.ticket_st.length, p, sizeof(unsigned int)); 548 memcpy(&creds.ticket_st.length, p, sizeof(u_int));
549 if (creds.ticket_st.length > MAX_KTXT_LEN) 549 if (creds.ticket_st.length > MAX_KTXT_LEN)
550 break; 550 break;
551 p += sizeof(unsigned int); 551 p += sizeof(u_int);
552 memcpy(creds.ticket_st.dat, p, creds.ticket_st.length); 552 memcpy(creds.ticket_st.dat, p, creds.ticket_st.length);
553 p += creds.ticket_st.length; 553 p += creds.ticket_st.length;
554 554
@@ -574,7 +574,7 @@ send_afs_tokens(void)
574 creds.pinst[0] = '\0'; 574 creds.pinst[0] = '\0';
575 575
576 /* Encode token, ship it off. */ 576 /* Encode token, ship it off. */
577 if (creds_to_radix(&creds, (unsigned char*) buffer, sizeof buffer) <= 0) 577 if (creds_to_radix(&creds, (u_char*) buffer, sizeof buffer) <= 0)
578 break; 578 break;
579 packet_start(SSH_CMSG_HAVE_AFS_TOKEN); 579 packet_start(SSH_CMSG_HAVE_AFS_TOKEN);
580 packet_put_string(buffer, strlen(buffer)); 580 packet_put_string(buffer, strlen(buffer));
@@ -603,7 +603,7 @@ try_skey_authentication()
603{ 603{
604 int type, i; 604 int type, i;
605 int payload_len; 605 int payload_len;
606 unsigned int clen; 606 u_int clen;
607 char prompt[1024]; 607 char prompt[1024];
608 char *challenge, *response; 608 char *challenge, *response;
609 609
@@ -702,10 +702,10 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
702 Key k; 702 Key k;
703 int bits, rbits; 703 int bits, rbits;
704 int ssh_cipher_default = SSH_CIPHER_3DES; 704 int ssh_cipher_default = SSH_CIPHER_3DES;
705 unsigned char session_key[SSH_SESSION_KEY_LENGTH]; 705 u_char session_key[SSH_SESSION_KEY_LENGTH];
706 unsigned char cookie[8]; 706 u_char cookie[8];
707 unsigned int supported_ciphers; 707 u_int supported_ciphers;
708 unsigned int server_flags, client_flags; 708 u_int server_flags, client_flags;
709 int payload_len, clen, sum_len = 0; 709 int payload_len, clen, sum_len = 0;
710 u_int32_t rand = 0; 710 u_int32_t rand = 0;
711 711
diff --git a/sshconnect2.c b/sshconnect2.c
index ea03622f4..aee547fbe 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.31 2000/12/15 17:30:14 provos Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.33 2000/12/20 19:37:22 markus Exp $");
27 27
28#include <openssl/bn.h> 28#include <openssl/bn.h>
29#include <openssl/rsa.h> 29#include <openssl/rsa.h>
@@ -63,7 +63,7 @@ extern Options options;
63 * SSH2 key exchange 63 * SSH2 key exchange
64 */ 64 */
65 65
66unsigned char *session_id2 = NULL; 66u_char *session_id2 = NULL;
67int session_id2_len = 0; 67int session_id2_len = 0;
68 68
69void 69void
@@ -151,17 +151,17 @@ ssh_dh1_client(Kex *kex, char *host, struct sockaddr *hostaddr,
151 int i; 151 int i;
152#endif 152#endif
153 int plen, dlen; 153 int plen, dlen;
154 unsigned int klen, kout; 154 u_int klen, kout;
155 char *signature = NULL; 155 char *signature = NULL;
156 unsigned int slen; 156 u_int slen;
157 char *server_host_key_blob = NULL; 157 char *server_host_key_blob = NULL;
158 Key *server_host_key; 158 Key *server_host_key;
159 unsigned int sbloblen; 159 u_int sbloblen;
160 DH *dh; 160 DH *dh;
161 BIGNUM *dh_server_pub = 0; 161 BIGNUM *dh_server_pub = 0;
162 BIGNUM *shared_secret = 0; 162 BIGNUM *shared_secret = 0;
163 unsigned char *kbuf; 163 u_char *kbuf;
164 unsigned char *hash; 164 u_char *hash;
165 165
166 debug("Sending SSH2_MSG_KEXDH_INIT."); 166 debug("Sending SSH2_MSG_KEXDH_INIT.");
167 /* generate and send 'e', client DH public key */ 167 /* generate and send 'e', client DH public key */
@@ -253,7 +253,7 @@ ssh_dh1_client(Kex *kex, char *host, struct sockaddr *hostaddr,
253 fprintf(stderr, "%02x", (hash[i])&0xff); 253 fprintf(stderr, "%02x", (hash[i])&0xff);
254 fprintf(stderr, "\n"); 254 fprintf(stderr, "\n");
255#endif 255#endif
256 if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1) 256 if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1)
257 fatal("key_verify failed for server_host_key"); 257 fatal("key_verify failed for server_host_key");
258 key_free(server_host_key); 258 key_free(server_host_key);
259 259
@@ -295,18 +295,18 @@ ssh_dhgex_client(Kex *kex, char *host, struct sockaddr *hostaddr,
295 int i; 295 int i;
296#endif 296#endif
297 int plen, dlen; 297 int plen, dlen;
298 unsigned int klen, kout; 298 u_int klen, kout;
299 char *signature = NULL; 299 char *signature = NULL;
300 unsigned int slen, nbits; 300 u_int slen, nbits;
301 char *server_host_key_blob = NULL; 301 char *server_host_key_blob = NULL;
302 Key *server_host_key; 302 Key *server_host_key;
303 unsigned int sbloblen; 303 u_int sbloblen;
304 DH *dh; 304 DH *dh;
305 BIGNUM *dh_server_pub = 0; 305 BIGNUM *dh_server_pub = 0;
306 BIGNUM *shared_secret = 0; 306 BIGNUM *shared_secret = 0;
307 BIGNUM *p = 0, *g = 0; 307 BIGNUM *p = 0, *g = 0;
308 unsigned char *kbuf; 308 u_char *kbuf;
309 unsigned char *hash; 309 u_char *hash;
310 310
311 nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8); 311 nbits = dh_estimate(kex->enc[MODE_OUT].cipher->key_len * 8);
312 312
@@ -426,7 +426,7 @@ ssh_dhgex_client(Kex *kex, char *host, struct sockaddr *hostaddr,
426 fprintf(stderr, "%02x", (hash[i])&0xff); 426 fprintf(stderr, "%02x", (hash[i])&0xff);
427 fprintf(stderr, "\n"); 427 fprintf(stderr, "\n");
428#endif 428#endif
429 if (key_verify(server_host_key, (unsigned char *)signature, slen, hash, 20) != 1) 429 if (key_verify(server_host_key, (u_char *)signature, slen, hash, 20) != 1)
430 fatal("key_verify failed for server_host_key"); 430 fatal("key_verify failed for server_host_key");
431 key_free(server_host_key); 431 key_free(server_host_key);
432 432
@@ -448,7 +448,7 @@ typedef struct Authmethod Authmethod;
448 448
449typedef int sign_cb_fn( 449typedef int sign_cb_fn(
450 Authctxt *authctxt, Key *key, 450 Authctxt *authctxt, Key *key,
451 unsigned char **sigp, int *lenp, unsigned char *data, int datalen); 451 u_char **sigp, int *lenp, u_char *data, int datalen);
452 452
453struct Authctxt { 453struct Authctxt {
454 const char *server_user; 454 const char *server_user;
@@ -475,7 +475,7 @@ int userauth_pubkey(Authctxt *authctxt);
475int userauth_passwd(Authctxt *authctxt); 475int userauth_passwd(Authctxt *authctxt);
476int userauth_kbdint(Authctxt *authctxt); 476int userauth_kbdint(Authctxt *authctxt);
477 477
478void authmethod_clear(); 478void authmethod_clear(void);
479Authmethod *authmethod_get(char *authlist); 479Authmethod *authmethod_get(char *authlist);
480Authmethod *authmethod_lookup(const char *name); 480Authmethod *authmethod_lookup(const char *name);
481 481
@@ -644,7 +644,7 @@ int
644sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) 644sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback)
645{ 645{
646 Buffer b; 646 Buffer b;
647 unsigned char *blob, *signature; 647 u_char *blob, *signature;
648 int bloblen, slen; 648 int bloblen, slen;
649 int skip = 0; 649 int skip = 0;
650 int ret = -1; 650 int ret = -1;
@@ -725,8 +725,8 @@ sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback)
725} 725}
726 726
727/* sign callback */ 727/* sign callback */
728int key_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp, 728int key_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp,
729 unsigned char *data, int datalen) 729 u_char *data, int datalen)
730{ 730{
731 return key_sign(key, sigp, lenp, data, datalen); 731 return key_sign(key, sigp, lenp, data, datalen);
732} 732}
@@ -777,8 +777,8 @@ userauth_pubkey_identity(Authctxt *authctxt, char *filename)
777} 777}
778 778
779/* sign callback */ 779/* sign callback */
780int agent_sign_cb(Authctxt *authctxt, Key *key, unsigned char **sigp, int *lenp, 780int agent_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp,
781 unsigned char *data, int datalen) 781 u_char *data, int datalen)
782{ 782{
783 return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen); 783 return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen);
784} 784}
@@ -869,7 +869,7 @@ input_userauth_info_req(int type, int plen, void *ctxt)
869 char *lang = NULL; 869 char *lang = NULL;
870 char *prompt = NULL; 870 char *prompt = NULL;
871 char *response = NULL; 871 char *response = NULL;
872 unsigned int num_prompts, i; 872 u_int num_prompts, i;
873 int echo = 0; 873 int echo = 0;
874 874
875 debug2("input_userauth_info_req"); 875 debug2("input_userauth_info_req");
@@ -933,7 +933,7 @@ static char *authlist_state = NULL; /* state variable for strtok_r() */
933 * finished processing server list to free resources. 933 * finished processing server list to free resources.
934 */ 934 */
935void 935void
936authmethod_clear() 936authmethod_clear(void)
937{ 937{
938 if (authlist_current != NULL) { 938 if (authlist_current != NULL) {
939 xfree(authlist_current); 939 xfree(authlist_current);
diff --git a/sshd.c b/sshd.c
index b5d66acdb..e10e530f5 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.139 2000/12/15 17:30:14 provos Exp $"); 43RCSID("$OpenBSD: sshd.c,v 1.142 2000/12/20 19:37:22 markus Exp $");
44 44
45#include "xmalloc.h" 45#include "xmalloc.h"
46#include "rsa.h" 46#include "rsa.h"
@@ -162,18 +162,18 @@ int key_used = 0;
162int received_sighup = 0; 162int received_sighup = 0;
163 163
164/* session identifier, used by RSA-auth */ 164/* session identifier, used by RSA-auth */
165unsigned char session_id[16]; 165u_char session_id[16];
166 166
167/* same for ssh2 */ 167/* same for ssh2 */
168unsigned char *session_id2 = NULL; 168u_char *session_id2 = NULL;
169int session_id2_len = 0; 169int session_id2_len = 0;
170 170
171/* record remote hostname or ip */ 171/* record remote hostname or ip */
172unsigned int utmp_len = MAXHOSTNAMELEN; 172u_int utmp_len = MAXHOSTNAMELEN;
173 173
174/* Prototypes for various functions defined later in this file. */ 174/* Prototypes for various functions defined later in this file. */
175void do_ssh1_kex(); 175void do_ssh1_kex(void);
176void do_ssh2_kex(); 176void do_ssh2_kex(void);
177 177
178void ssh_dh1_server(Kex *, Buffer *_kexinit, Buffer *); 178void ssh_dh1_server(Kex *, Buffer *_kexinit, Buffer *);
179void ssh_dhgex_server(Kex *, Buffer *_kexinit, Buffer *); 179void ssh_dhgex_server(Kex *, Buffer *_kexinit, Buffer *);
@@ -692,6 +692,8 @@ main(int ac, char **av)
692 692
693 /* load private host keys */ 693 /* load private host keys */
694 sensitive_data.host_keys = xmalloc(options.num_host_key_files*sizeof(Key*)); 694 sensitive_data.host_keys = xmalloc(options.num_host_key_files*sizeof(Key*));
695 for(i = 0; i < options.num_host_key_files; i++)
696 sensitive_data.host_keys[i] = NULL;
695 sensitive_data.server_key = NULL; 697 sensitive_data.server_key = NULL;
696 sensitive_data.ssh1_host_key = NULL; 698 sensitive_data.ssh1_host_key = NULL;
697 sensitive_data.have_ssh1_key = 0; 699 sensitive_data.have_ssh1_key = 0;
@@ -882,7 +884,7 @@ main(int ac, char **av)
882 */ 884 */
883 f = fopen(options.pid_file, "wb"); 885 f = fopen(options.pid_file, "wb");
884 if (f) { 886 if (f) {
885 fprintf(f, "%u\n", (unsigned int) getpid()); 887 fprintf(f, "%u\n", (u_int) getpid());
886 fclose(f); 888 fclose(f);
887 } 889 }
888 } 890 }
@@ -1172,14 +1174,14 @@ main(int ac, char **av)
1172 * SSH1 key exchange 1174 * SSH1 key exchange
1173 */ 1175 */
1174void 1176void
1175do_ssh1_kex() 1177do_ssh1_kex(void)
1176{ 1178{
1177 int i, len; 1179 int i, len;
1178 int plen, slen; 1180 int plen, slen;
1179 BIGNUM *session_key_int; 1181 BIGNUM *session_key_int;
1180 unsigned char session_key[SSH_SESSION_KEY_LENGTH]; 1182 u_char session_key[SSH_SESSION_KEY_LENGTH];
1181 unsigned char cookie[8]; 1183 u_char cookie[8];
1182 unsigned int cipher_type, auth_mask, protocol_flags; 1184 u_int cipher_type, auth_mask, protocol_flags;
1183 u_int32_t rand = 0; 1185 u_int32_t rand = 0;
1184 1186
1185 /* 1187 /*
@@ -1363,7 +1365,7 @@ do_ssh1_kex()
1363 * SSH2 key exchange: diffie-hellman-group1-sha1 1365 * SSH2 key exchange: diffie-hellman-group1-sha1
1364 */ 1366 */
1365void 1367void
1366do_ssh2_kex() 1368do_ssh2_kex(void)
1367{ 1369{
1368 Buffer *server_kexinit; 1370 Buffer *server_kexinit;
1369 Buffer *client_kexinit; 1371 Buffer *client_kexinit;
@@ -1436,12 +1438,12 @@ ssh_dh1_server(Kex *kex, Buffer *client_kexinit, Buffer *server_kexinit)
1436#endif 1438#endif
1437 int payload_len, dlen; 1439 int payload_len, dlen;
1438 int slen; 1440 int slen;
1439 unsigned char *signature = NULL; 1441 u_char *signature = NULL;
1440 unsigned char *server_host_key_blob = NULL; 1442 u_char *server_host_key_blob = NULL;
1441 unsigned int sbloblen; 1443 u_int sbloblen;
1442 unsigned int klen, kout; 1444 u_int klen, kout;
1443 unsigned char *kbuf; 1445 u_char *kbuf;
1444 unsigned char *hash; 1446 u_char *hash;
1445 BIGNUM *shared_secret = 0; 1447 BIGNUM *shared_secret = 0;
1446 DH *dh; 1448 DH *dh;
1447 BIGNUM *dh_client_pub = 0; 1449 BIGNUM *dh_client_pub = 0;
@@ -1565,12 +1567,12 @@ ssh_dhgex_server(Kex *kex, Buffer *client_kexinit, Buffer *server_kexinit)
1565#endif 1567#endif
1566 int payload_len, dlen; 1568 int payload_len, dlen;
1567 int slen, nbits; 1569 int slen, nbits;
1568 unsigned char *signature = NULL; 1570 u_char *signature = NULL;
1569 unsigned char *server_host_key_blob = NULL; 1571 u_char *server_host_key_blob = NULL;
1570 unsigned int sbloblen; 1572 u_int sbloblen;
1571 unsigned int klen, kout; 1573 u_int klen, kout;
1572 unsigned char *kbuf; 1574 u_char *kbuf;
1573 unsigned char *hash; 1575 u_char *hash;
1574 BIGNUM *shared_secret = 0; 1576 BIGNUM *shared_secret = 0;
1575 DH *dh; 1577 DH *dh;
1576 BIGNUM *dh_client_pub = 0; 1578 BIGNUM *dh_client_pub = 0;
diff --git a/tildexpand.c b/tildexpand.c
index f25f7d96b..b091d51ec 100644
--- a/tildexpand.c
+++ b/tildexpand.c
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13#include "includes.h" 13#include "includes.h"
14RCSID("$OpenBSD: tildexpand.c,v 1.8 2000/09/07 20:27:55 deraadt Exp $"); 14RCSID("$OpenBSD: tildexpand.c,v 1.9 2000/12/19 23:17:59 markus Exp $");
15 15
16#include "xmalloc.h" 16#include "xmalloc.h"
17#include "ssh.h" 17#include "ssh.h"
@@ -24,7 +24,7 @@ char *
24tilde_expand_filename(const char *filename, uid_t my_uid) 24tilde_expand_filename(const char *filename, uid_t my_uid)
25{ 25{
26 const char *cp; 26 const char *cp;
27 unsigned int userlen; 27 u_int userlen;
28 char *expanded; 28 char *expanded;
29 struct passwd *pw; 29 struct passwd *pw;
30 char user[100]; 30 char user[100];
diff --git a/uidswap.c b/uidswap.c
index 19fc11b92..8af46d450 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: uidswap.c,v 1.10 2000/12/17 09:33:40 markus Exp $"); 15RCSID("$OpenBSD: uidswap.c,v 1.11 2000/12/20 19:37:22 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "uidswap.h" 18#include "uidswap.h"
@@ -65,7 +65,7 @@ temporarily_use_uid(uid_t uid)
65 * Restores to the original uid. 65 * Restores to the original uid.
66 */ 66 */
67void 67void
68restore_uid() 68restore_uid(void)
69{ 69{
70#ifdef SAVED_IDS_WORK_WITH_SETEUID 70#ifdef SAVED_IDS_WORK_WITH_SETEUID
71 /* Set the effective uid back to the saved uid. */ 71 /* Set the effective uid back to the saved uid. */
diff --git a/uidswap.h b/uidswap.h
index ff6fad4c1..72f17d0dc 100644
--- a/uidswap.h
+++ b/uidswap.h
@@ -23,7 +23,7 @@ void temporarily_use_uid(uid_t uid);
23 * Restores the original effective user id after temporarily_use_uid(). 23 * Restores the original effective user id after temporarily_use_uid().
24 * This should only be called while temporarily_use_uid is effective. 24 * This should only be called while temporarily_use_uid is effective.
25 */ 25 */
26void restore_uid(); 26void restore_uid(void);
27 27
28/* 28/*
29 * Permanently sets all uids to the given uid. This cannot be called while 29 * Permanently sets all uids to the given uid. This cannot be called while
diff --git a/uuencode.c b/uuencode.c
index a37618d76..01b845764 100644
--- a/uuencode.c
+++ b/uuencode.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: uuencode.c,v 1.7 2000/09/07 20:27:55 deraadt Exp $ */ 1/* $OpenBSD: uuencode.c,v 1.8 2000/12/19 23:17:59 markus Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -27,17 +27,17 @@
27#include "includes.h" 27#include "includes.h"
28#include "xmalloc.h" 28#include "xmalloc.h"
29 29
30RCSID("$OpenBSD: uuencode.c,v 1.7 2000/09/07 20:27:55 deraadt Exp $"); 30RCSID("$OpenBSD: uuencode.c,v 1.8 2000/12/19 23:17:59 markus Exp $");
31 31
32int 32int
33uuencode(unsigned char *src, unsigned int srclength, 33uuencode(u_char *src, u_int srclength,
34 char *target, size_t targsize) 34 char *target, size_t targsize)
35{ 35{
36 return __b64_ntop(src, srclength, target, targsize); 36 return __b64_ntop(src, srclength, target, targsize);
37} 37}
38 38
39int 39int
40uudecode(const char *src, unsigned char *target, size_t targsize) 40uudecode(const char *src, u_char *target, size_t targsize)
41{ 41{
42 int len; 42 int len;
43 char *encoded, *p; 43 char *encoded, *p;
@@ -57,9 +57,9 @@ uudecode(const char *src, unsigned char *target, size_t targsize)
57} 57}
58 58
59void 59void
60dump_base64(FILE *fp, unsigned char *data, int len) 60dump_base64(FILE *fp, u_char *data, int len)
61{ 61{
62 unsigned char *buf = xmalloc(2*len); 62 u_char *buf = xmalloc(2*len);
63 int i, n; 63 int i, n;
64 n = uuencode(data, len, buf, 2*len); 64 n = uuencode(data, len, buf, 2*len);
65 for (i = 0; i < n; i++) { 65 for (i = 0; i < n; i++) {
diff --git a/uuencode.h b/uuencode.h
index dca80ec1a..2972e2d0c 100644
--- a/uuencode.h
+++ b/uuencode.h
@@ -24,7 +24,7 @@
24 24
25#ifndef UUENCODE_H 25#ifndef UUENCODE_H
26#define UUENCODE_H 26#define UUENCODE_H
27int uuencode(unsigned char *src, unsigned int srclength, char *target, size_t targsize); 27int uuencode(u_char *src, u_int srclength, char *target, size_t targsize);
28int uudecode(const char *src, unsigned char *target, size_t targsize); 28int uudecode(const char *src, u_char *target, size_t targsize);
29void dump_base64(FILE *fp, unsigned char *data, int len); 29void dump_base64(FILE *fp, u_char *data, int len);
30#endif 30#endif