changeset 1124:6aeadee3f16b

merge
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:24:08 +0800
parents d7b752525b91 (diff) aaf576b27a10 (current diff)
children 7cb1f49d89a8
files cli-kex.c cli-session.c common-algo.c common-kex.c common-session.c keyimport.c
diffstat 24 files changed, 50 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/algo.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/algo.h	Thu Jun 04 23:24:08 2015 +0800
@@ -35,7 +35,7 @@
 
 struct Algo_Type {
 
-	const unsigned char *name; /* identifying name */
+	const char *name; /* identifying name */
 	char val; /* a value for this cipher, or -1 for invalid */
 	const void *data; /* algorithm specific data */
 	char usable; /* whether we can use this algorithm */
--- a/auth.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/auth.h	Thu Jun 04 23:24:08 2015 +0800
@@ -133,7 +133,7 @@
 	int no_x11_forwarding_flag;
 	int no_pty_flag;
 	/* "command=" option. */
-	unsigned char * forced_command;
+	char * forced_command;
 };
 #endif
 
--- a/channel.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/channel.h	Thu Jun 04 23:24:08 2015 +0800
@@ -135,7 +135,7 @@
 void recv_msg_channel_open_confirmation();
 void recv_msg_channel_open_failure();
 #endif
-void start_send_channel_request(struct Channel *channel, unsigned char *type);
+void start_send_channel_request(struct Channel *channel, char *type);
 
 void send_msg_request_success();
 void send_msg_request_failure();
--- a/chansession.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/chansession.h	Thu Jun 04 23:24:08 2015 +0800
@@ -39,14 +39,14 @@
 
 struct ChanSess {
 
-	unsigned char * cmd; /* command to exec */
+	char * cmd; /* command to exec */
 	pid_t pid; /* child process pid */
 
 	/* pty details */
 	int master; /* the master terminal fd*/
 	int slave;
-	unsigned char * tty;
-	unsigned char * term;
+	char * tty;
+	char * term;
 
 	/* exit details */
 	struct exitinfo exit;
--- a/cli-kex.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/cli-kex.c	Thu Jun 04 23:24:08 2015 +0800
@@ -322,7 +322,7 @@
 		}
 
 		/* Compare hostnames */
-		if (strncmp(cli_opts.remotehost, buf_getptr(line, hostlen),
+		if (strncmp(cli_opts.remotehost, (const char *) buf_getptr(line, hostlen),
 					hostlen) != 0) {
 			continue;
 		}
@@ -334,7 +334,7 @@
 			continue;
 		}
 
-		if (strncmp(buf_getptr(line, algolen), algoname, algolen) != 0) {
+		if (strncmp((const char *) buf_getptr(line, algolen), algoname, algolen) != 0) {
 			TRACE(("algo doesn't match"))
 			continue;
 		}
@@ -346,7 +346,7 @@
 		}
 
 		/* Now we're at the interesting hostkey */
-		ret = cmp_base64_key(keyblob, keybloblen, algoname, algolen,
+		ret = cmp_base64_key(keyblob, keybloblen, (const unsigned char *) algoname, algolen,
 						line, &fingerprint);
 
 		if (ret == DROPBEAR_SUCCESS) {
@@ -382,9 +382,9 @@
 		fseek(hostsfile, 0, SEEK_END); /* In case it wasn't opened append */
 		buf_setpos(line, 0);
 		buf_setlen(line, 0);
-		buf_putbytes(line, cli_opts.remotehost, hostlen);
+		buf_putbytes(line, (const unsigned char *) cli_opts.remotehost, hostlen);
 		buf_putbyte(line, ' ');
-		buf_putbytes(line, algoname, algolen);
+		buf_putbytes(line, (const unsigned char *) algoname, algolen);
 		buf_putbyte(line, ' ');
 		len = line->size - line->pos;
 		/* The only failure with base64 is buffer_overflow, but buf_getwriteptr
--- a/common-kex.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/common-kex.c	Thu Jun 04 23:24:08 2015 +0800
@@ -511,7 +511,7 @@
 
 	/* start the kex hash */
 	local_ident_len = strlen(LOCAL_IDENT);
-	remote_ident_len = strlen((char*)ses.remoteident);
+	remote_ident_len = strlen(ses.remoteident);
 
 	kexhashbuf_len = local_ident_len + remote_ident_len
 		+ ses.transkexinit->len + ses.payload->len
--- a/configure.ac	Thu Jun 04 23:08:50 2015 +0800
+++ b/configure.ac	Thu Jun 04 23:24:08 2015 +0800
@@ -265,7 +265,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 		]],
-		[[ struct sockaddr_storage s; ]])],
+		[[ if (sizeof(struct sockaddr_storage)) return 0 ]])],
 		[ ac_cv_have_struct_sockaddr_storage="yes" ],
 		[ ac_cv_have_struct_sockaddr_storage="no" ]
 	)
@@ -279,7 +279,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 		]],
-		[[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
+		[[ if (sizeof(struct sockaddr_in6)) return 0 ]])],
 		[ ac_cv_have_struct_sockaddr_in6="yes" ],
 		[ ac_cv_have_struct_sockaddr_in6="no" ]
 	)
@@ -293,7 +293,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 		]],
-		[[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
+		[[ if (sizeof(struct in6_addr)) return 0 ]])],
 		[ ac_cv_have_struct_in6_addr="yes" ],
 		[ ac_cv_have_struct_in6_addr="no" ]
 	)
@@ -308,7 +308,7 @@
 #include <sys/socket.h>
 #include <netdb.h>
 		]],
-		[[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
+		[[ if (sizeof(struct addrinfo)) return 0 ]])],
 		[ ac_cv_have_struct_addrinfo="yes" ],
 		[ ac_cv_have_struct_addrinfo="no" ]
 	)
--- a/dbrandom.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/dbrandom.c	Thu Jun 04 23:24:08 2015 +0800
@@ -141,7 +141,7 @@
 	return ret;
 }
 
-void addrandom(char * buf, unsigned int len)
+void addrandom(unsigned char * buf, unsigned int len)
 {
 	hash_state hs;
 
--- a/dbrandom.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/dbrandom.h	Thu Jun 04 23:24:08 2015 +0800
@@ -29,7 +29,7 @@
 
 void seedrandom();
 void genrandom(unsigned char* buf, unsigned int len);
-void addrandom(char * buf, unsigned int len);
+void addrandom(unsigned char * buf, unsigned int len);
 void gen_random_mpint(mp_int *max, mp_int *rand);
 
 #endif /* DROPBEAR_RANDOM_H_ */
--- a/ecc.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/ecc.h	Thu Jun 04 23:24:08 2015 +0800
@@ -12,7 +12,7 @@
 	int ltc_size; /* to match the byte sizes in ltc_ecc_sets[] */
 	const ltc_ecc_set_type *dp; /* curve domain parameters */
 	const struct ltc_hash_descriptor *hash_desc;
-	const unsigned char *name;
+	const char *name;
 };
 
 extern struct dropbear_ecc_curve ecc_curve_nistp256;
--- a/gendss.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/gendss.c	Thu Jun 04 23:24:08 2015 +0800
@@ -67,7 +67,7 @@
 
 static void getq(dropbear_dss_key *key) {
 
-	char buf[QSIZE];
+	unsigned char buf[QSIZE];
 
 	/* 160 bit prime */
 	genrandom(buf, QSIZE);
--- a/keyimport.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/keyimport.c	Thu Jun 04 23:24:08 2015 +0800
@@ -193,7 +193,7 @@
 static void base64_encode_fp(FILE * fp, unsigned char *data,
 		int datalen, int cpl)
 {
-    char out[100];
+	unsigned char out[100];
     int n;
 	unsigned long outlen;
 	int rawcpl;
@@ -445,7 +445,7 @@
 						ret->keyblob_size);
 			}
 			outlen = ret->keyblob_size - ret->keyblob_len;
-			if (base64_decode(buffer, len, 
+			if (base64_decode((const unsigned char *)buffer, len,
 						ret->keyblob + ret->keyblob_len, &outlen) != CRYPT_OK){
 				errmsg = "Error decoding base64";
 				goto error;
@@ -507,7 +507,7 @@
 	int i, num_integers = 0;
 	sign_key *retval = NULL;
 	char *errmsg;
-	char *modptr = NULL;
+	unsigned char *modptr = NULL;
 	int modlen = -9999;
 	enum signkey_type type;
 
@@ -646,7 +646,7 @@
 			 */
 			if (i == 1) {
 				/* Save the details for after we deal with number 2. */
-				modptr = (char *)p;
+				modptr = p;
 				modlen = len;
 			} else if (i >= 2 && i <= 5) {
 				buf_putstring(blobbuf, (const char*)p, len);
@@ -1043,7 +1043,7 @@
 		int curve_oid_len = 0;
 		const void* curve_oid = NULL;
 		unsigned long pubkey_size = 2*curve_size+1;
-		unsigned int k_size;
+		int k_size;
 		int err = 0;
 
 		/* version. less than 10 bytes */
--- a/libtomcrypt/src/ciphers/aes/aes.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/ciphers/aes/aes.c	Thu Jun 04 23:24:08 2015 +0800
@@ -122,9 +122,10 @@
  */
 int SETUP(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 {
-    int i, j;
+    int i;
     ulong32 temp, *rk;
 #ifndef ENCRYPT_ONLY
+    int j;
     ulong32 *rrk;
 #endif    
     LTC_ARGCHK(key  != NULL);
@@ -148,7 +149,9 @@
     LOAD32H(rk[2], key +  8);
     LOAD32H(rk[3], key + 12);
     if (keylen == 16) {
+        #ifndef ENCRYPT_ONLY
         j = 44;
+        #endif
         for (;;) {
             temp  = rk[3];
             rk[4] = rk[0] ^ setup_mix(temp) ^ rcon[i];
@@ -161,7 +164,9 @@
             rk += 4;
         }
     } else if (keylen == 24) {
+        #ifndef ENCRYPT_ONLY
         j = 52;   
+        #endif
         LOAD32H(rk[4], key + 16);
         LOAD32H(rk[5], key + 20);
         for (;;) {
@@ -182,7 +187,9 @@
             rk += 6;
         }
     } else if (keylen == 32) {
+        #ifndef ENCRYPT_ONLY
         j = 60;
+        #endif
         LOAD32H(rk[4], key + 16);
         LOAD32H(rk[5], key + 20);
         LOAD32H(rk[6], key + 24);
@@ -728,6 +735,7 @@
 */
 void ECB_DONE(symmetric_key *skey)
 {
+   (void)skey;
 }
 
 
--- a/libtomcrypt/src/ciphers/des.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/ciphers/des.c	Thu Jun 04 23:24:08 2015 +0800
@@ -1871,6 +1871,7 @@
 */
 void des3_done(symmetric_key *skey)
 {
+   (void)skey;
 }
 
 
--- a/libtomcrypt/src/ciphers/twofish/twofish.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/ciphers/twofish/twofish.c	Thu Jun 04 23:24:08 2015 +0800
@@ -684,6 +684,7 @@
 */
 void twofish_done(symmetric_key *skey)
 {
+   (void)skey;
 }
 
 /**
--- a/libtomcrypt/src/hashes/helper/hash_file.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/hashes/helper/hash_file.c	Thu Jun 04 23:24:08 2015 +0800
@@ -25,6 +25,7 @@
 int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen)
 {
 #ifdef LTC_NO_FILE
+    (void)hash; (void)fname; (void)out; (void)outlen;
     return CRYPT_NOP;
 #else
     FILE *in;
--- a/libtomcrypt/src/hashes/helper/hash_filehandle.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/hashes/helper/hash_filehandle.c	Thu Jun 04 23:24:08 2015 +0800
@@ -26,6 +26,7 @@
 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)
 {
 #ifdef LTC_NO_FILE
+    (void)hash; (void)in; (void)out; (void)outlen;
     return CRYPT_NOP;
 #else
     hash_state md;
--- a/libtomcrypt/src/mac/hmac/hmac_file.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/mac/hmac/hmac_file.c	Thu Jun 04 23:24:08 2015 +0800
@@ -32,6 +32,7 @@
                     unsigned char *out, unsigned long *outlen)
 {
 #ifdef LTC_NO_FILE
+    (void)hash; (void)fname; (void)key; (void)keylen; (void)out; (void)outlen;
     return CRYPT_NOP;
 #else
    hmac_state hmac;
--- a/libtomcrypt/src/misc/crypt/crypt_argchk.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/misc/crypt/crypt_argchk.c	Thu Jun 04 23:24:08 2015 +0800
@@ -21,7 +21,7 @@
 {
  fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n",
          v, d, s);
- (void)raise(SIGABRT);
+ abort();
 }
 #endif
 
--- a/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c	Thu Jun 04 23:24:08 2015 +0800
@@ -40,7 +40,7 @@
    int        i, j, err;
    void       *mu, *mp;
    unsigned long buf;
-   int        first, bitbuf, bitcpy, bitcnt, mode, digidx;
+   int        bitcnt, mode, digidx;
 
    LTC_ARGCHK(k       != NULL);
    LTC_ARGCHK(G       != NULL);
@@ -98,8 +98,6 @@
    bitcnt = 1;
    buf    = 0;
    digidx = mp_get_digit_count(k) - 1;
-   bitcpy = bitbuf = 0;
-   first  = 1;
 
    /* perform ops */
    for (;;) {
--- a/session.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/session.h	Thu Jun 04 23:24:08 2015 +0800
@@ -63,7 +63,7 @@
 /* Client */
 void cli_session(int sock_in, int sock_out, struct dropbear_progress_connection *progress) ATTRIB_NORETURN;
 void cli_connected(int result, int sock, void* userdata, const char *errstring);
-void cleantext(unsigned char* dirtytext);
+void cleantext(char* dirtytext);
 
 /* crypto parameters that are stored individually for transmit and receive */
 struct key_context_directional {
@@ -115,7 +115,7 @@
 	/* remotehost will be initially NULL as we delay
 	 * reading the remote version string. it will be set
 	 * by the time any recv_() packet methods are called */
-	unsigned char *remoteident; 
+	char *remoteident;
 
 	int maxfd; /* the maximum file descriptor to check with select() */
 
--- a/svr-authpubkeyoptions.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/svr-authpubkeyoptions.c	Thu Jun 04 23:24:08 2015 +0800
@@ -120,7 +120,7 @@
 	if (options_buf->len - options_buf->pos < len) {
 		return DROPBEAR_FAILURE;
 	}
-	if (strncasecmp(buf_getptr(options_buf, len), opt_name, len) == 0) {
+	if (strncasecmp((const char *) buf_getptr(options_buf, len), opt_name, len) == 0) {
 		buf_incrpos(options_buf, len);
 		return DROPBEAR_SUCCESS;
 	}
--- a/tcp-accept.c	Thu Jun 04 23:08:50 2015 +0800
+++ b/tcp-accept.c	Thu Jun 04 23:24:08 2015 +0800
@@ -75,7 +75,7 @@
 	}
 
 	if (send_msg_channel_open_init(fd, tcpinfo->chantype) == DROPBEAR_SUCCESS) {
-		unsigned char* addr = NULL;
+		char* addr = NULL;
 		unsigned int port = 0;
 
 		if (tcpinfo->tcp_type == direct) {
--- a/tcpfwd.h	Thu Jun 04 23:08:50 2015 +0800
+++ b/tcpfwd.h	Thu Jun 04 23:24:08 2015 +0800
@@ -31,16 +31,16 @@
 
 	/* For a direct-tcpip request, it's the addr/port we want the other
 	 * end to connect to */
-	unsigned char *sendaddr;
+	char *sendaddr;
 	unsigned int sendport;
 
 	/* This is the address/port that we listen on. The address has special
 	 * meanings as per the rfc, "" for all interfaces, "localhost" for 
 	 * localhost, or a normal interface name. */
-	unsigned char *listenaddr;
+	char *listenaddr;
 	unsigned int listenport;
 	/* The address that the remote host asked to listen on */
-	unsigned char *request_listenaddr;
+	char *request_listenaddr;
 
 	const struct ChanType *chantype;
 	enum {direct, forwarded} tcp_type;
@@ -48,9 +48,9 @@
 
 /* A forwarding entry */
 struct TCPFwdEntry {
-	const unsigned char* connectaddr;
+	const char *connectaddr;
 	unsigned int connectport;
-	const unsigned char* listenaddr;
+	const char *listenaddr;
 	unsigned int listenport;
 	unsigned int have_reply; /* is set to 1 after a reply has been received
 								when setting up the forwarding */