changeset 1250:2bb4c662d1c2

more hard tab
author Francois Perrad <francois.perrad@gadz.org>
date Fri, 01 Jan 2016 15:02:09 +0100
parents c6346c63281b
children 52a456a3add0
files bignum.c buffer.c cli-tcpfwd.c common-kex.c dbutil.c dropbearkey.c ecdsa.c gensignkey.c keyimport.c list.h packet.c rsa.c scp.c svr-main.c svr-tcpfwd.c
diffstat 15 files changed, 123 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/bignum.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/bignum.c	Fri Jan 01 15:02:09 2016 +0100
@@ -39,33 +39,33 @@
  * on error */
 void m_mp_init_multi(mp_int *mp, ...) 
 {
-    mp_int* cur_arg = mp;
-    va_list args;
+	mp_int* cur_arg = mp;
+	va_list args;
 
-    va_start(args, mp);        /* init args to next argument from caller */
-    while (cur_arg != NULL) {
-        if (mp_init(cur_arg) != MP_OKAY) {
+	va_start(args, mp);        /* init args to next argument from caller */
+	while (cur_arg != NULL) {
+		if (mp_init(cur_arg) != MP_OKAY) {
 			dropbear_exit("Mem alloc error");
-        }
-        cur_arg = va_arg(args, mp_int*);
-    }
-    va_end(args);
+		}
+		cur_arg = va_arg(args, mp_int*);
+	}
+	va_end(args);
 }
 
 void m_mp_alloc_init_multi(mp_int **mp, ...) 
 {
-    mp_int** cur_arg = mp;
-    va_list args;
+	mp_int** cur_arg = mp;
+	va_list args;
 
-    va_start(args, mp);        /* init args to next argument from caller */
-    while (cur_arg != NULL) {
-    	*cur_arg = m_malloc(sizeof(mp_int));
-        if (mp_init(*cur_arg) != MP_OKAY) {
+	va_start(args, mp);        /* init args to next argument from caller */
+	while (cur_arg != NULL) {
+		*cur_arg = m_malloc(sizeof(mp_int));
+		if (mp_init(*cur_arg) != MP_OKAY) {
 			dropbear_exit("Mem alloc error");
-        }
-        cur_arg = va_arg(args, mp_int**);
-    }
-    va_end(args);
+		}
+		cur_arg = va_arg(args, mp_int**);
+	}
+	va_end(args);
 }
 
 void bytes_to_mp(mp_int *mp, const unsigned char* bytes, unsigned int len) {
--- a/buffer.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/buffer.c	Fri Jan 01 15:02:09 2016 +0100
@@ -98,7 +98,7 @@
 	ret = buf_new(buf->len);
 	ret->len = buf->len;
 	if (buf->len > 0) {
-	    memcpy(ret->data, buf->data, buf->len);
+		memcpy(ret->data, buf->data, buf->len);
 	}
 	return ret;
 }
--- a/cli-tcpfwd.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/cli-tcpfwd.c	Fri Jan 01 15:02:09 2016 +0100
@@ -231,7 +231,7 @@
 
 static int newtcpforwarded(struct Channel * channel) {
 
-    char *origaddr = NULL;
+	char *origaddr = NULL;
 	unsigned int origport;
 	m_list_elem * iter = NULL;
 	struct TCPFwdEntry *fwd;
@@ -267,7 +267,7 @@
 
 	if (iter == NULL) {
 		/* We didn't request forwarding on that port */
-        	cleantext(origaddr);
+		cleantext(origaddr);
 		dropbear_log(LOG_INFO, "Server sent unrequested forward from \"%s:%d\"", 
                 origaddr, origport);
 		goto out;
--- a/common-kex.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/common-kex.c	Fri Jan 01 15:02:09 2016 +0100
@@ -40,7 +40,7 @@
 /* diffie-hellman-group1-sha1 value for p */
 const unsigned char dh_p_1[DH_P_1_LEN] = {
 	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2,
-    0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
+	0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
 	0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6,
 	0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
 	0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D,
@@ -54,7 +54,7 @@
 /* diffie-hellman-group14-sha1 value for p */
 const unsigned char dh_p_14[DH_P_14_LEN] = {
 	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, 
-    0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 
+	0x21, 0x68, 0xC2, 0x34, 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1,
 	0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, 0x02, 0x0B, 0xBE, 0xA6,
 	0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
 	0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D,
@@ -349,17 +349,17 @@
 	ses.hash = NULL;
 
 	if (IS_DROPBEAR_CLIENT) {
-	    trans_IV	= C2S_IV;
-	    recv_IV		= S2C_IV;
-	    trans_key	= C2S_key;
-	    recv_key	= S2C_key;
+		trans_IV	= C2S_IV;
+		recv_IV		= S2C_IV;
+		trans_key	= C2S_key;
+		recv_key	= S2C_key;
 		mactransletter = 'E';
 		macrecvletter = 'F';
 	} else {
-	    trans_IV	= S2C_IV;
-	    recv_IV		= C2S_IV;
-	    trans_key	= S2C_key;
-	    recv_key	= C2S_key;
+		trans_IV	= S2C_IV;
+		recv_IV		= C2S_IV;
+		trans_key	= S2C_key;
+		recv_key	= C2S_key;
 		mactransletter = 'F';
 		macrecvletter = 'E';
 	}
@@ -525,18 +525,18 @@
 		read_kex_algos();
 
 		/* V_C, the client's version string (CR and NL excluded) */
-	    buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
+		buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
 		/* V_S, the server's version string (CR and NL excluded) */
-	    buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
+		buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
 
 		/* I_C, the payload of the client's SSH_MSG_KEXINIT */
-	    buf_putstring(ses.kexhashbuf,
+		buf_putstring(ses.kexhashbuf,
 			(const char*)ses.transkexinit->data, ses.transkexinit->len);
 		/* I_S, the payload of the server's SSH_MSG_KEXINIT */
-	    buf_setpos(ses.payload, ses.payload_beginning);
-	    buf_putstring(ses.kexhashbuf, 
-	    	(const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
-	    	ses.payload->len-ses.payload->pos);
+		buf_setpos(ses.payload, ses.payload_beginning);
+		buf_putstring(ses.kexhashbuf,
+			(const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
+			ses.payload->len-ses.payload->pos);
 		ses.requirenext = SSH_MSG_KEXDH_REPLY;
 	} else {
 		/* SERVER */
@@ -544,18 +544,18 @@
 		/* read the peer's choice of algos */
 		read_kex_algos();
 		/* V_C, the client's version string (CR and NL excluded) */
-	    buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
+		buf_putstring(ses.kexhashbuf, ses.remoteident, remote_ident_len);
 		/* V_S, the server's version string (CR and NL excluded) */
-	    buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
+		buf_putstring(ses.kexhashbuf, LOCAL_IDENT, local_ident_len);
 
 		/* I_C, the payload of the client's SSH_MSG_KEXINIT */
-	    buf_setpos(ses.payload, ses.payload_beginning);
-	    buf_putstring(ses.kexhashbuf, 
-	    	(const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
-	    	ses.payload->len-ses.payload->pos);
+		buf_setpos(ses.payload, ses.payload_beginning);
+		buf_putstring(ses.kexhashbuf, 
+			(const char*)buf_getptr(ses.payload, ses.payload->len-ses.payload->pos),
+			ses.payload->len-ses.payload->pos);
 
 		/* I_S, the payload of the server's SSH_MSG_KEXINIT */
-	    buf_putstring(ses.kexhashbuf,
+		buf_putstring(ses.kexhashbuf,
 			(const char*)ses.transkexinit->data, ses.transkexinit->len);
 
 		ses.requirenext = SSH_MSG_KEXDH_INIT;
--- a/dbutil.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/dbutil.c	Fri Jan 01 15:02:09 2016 +0100
@@ -157,26 +157,26 @@
 {
 	if (getenv("DROPBEAR_DEBUG_NET_TIMESTAMP"))
 	{
-    	/* Timestamps start from first network activity */
-	    struct timeval tv;
-	    gettimeofday(&tv, NULL);
-	    debug_start_time = tv.tv_sec + (tv.tv_usec / 1000000.0);
-	    TRACE(("Resetting Dropbear TRACE timestamps"))
+		/* Timestamps start from first network activity */
+		struct timeval tv;
+		gettimeofday(&tv, NULL);
+		debug_start_time = tv.tv_sec + (tv.tv_usec / 1000000.0);
+		TRACE(("Resetting Dropbear TRACE timestamps"))
 	}
 }
 
 static double time_since_start()
 {
-    double nowf;
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    nowf = tv.tv_sec + (tv.tv_usec / 1000000.0);
-    if (debug_start_time < 0)
-    {
-        debug_start_time = nowf;
-        return 0;
-    }
-    return nowf - debug_start_time;
+	double nowf;
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	nowf = tv.tv_sec + (tv.tv_usec / 1000000.0);
+	if (debug_start_time < 0)
+	{
+		debug_start_time = nowf;
+		return 0;
+	}
+	return nowf - debug_start_time;
 }
 
 void dropbear_trace(const char* format, ...) {
--- a/dropbearkey.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/dropbearkey.c	Fri Jan 01 15:02:09 2016 +0100
@@ -105,25 +105,25 @@
 /* fails fatally */
 static void check_signkey_bits(enum signkey_type type, int bits)
 {
-        switch (type) {
+	switch (type) {
 #ifdef DROPBEAR_RSA
-            case DROPBEAR_SIGNKEY_RSA:
-                if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
-                	dropbear_exit("Bits must satisfy 512 <= bits <= 4096, and be a"
-                            " multiple of 8\n");
-                }
-                break;
+		case DROPBEAR_SIGNKEY_RSA:
+			if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
+				dropbear_exit("Bits must satisfy 512 <= bits <= 4096, and be a"
+				              " multiple of 8\n");
+			}
+			break;
 #endif
 #ifdef DROPEAR_DSS
-            case DROPBEAR_SIGNKEY_DSS:
-                if (bits != 1024) {
-                    dropbear_exit("DSS keys have a fixed size of 1024 bits\n");
-                    exit(EXIT_FAILURE);
-                }
+		case DROPBEAR_SIGNKEY_DSS:
+			if (bits != 1024) {
+				dropbear_exit("DSS keys have a fixed size of 1024 bits\n");
+				exit(EXIT_FAILURE);
+			}
 #endif
-			default:
-				(void)0; /* quiet, compiler. ecdsa handles checks itself */
-        }
+		default:
+			(void)0; /* quiet, compiler. ecdsa handles checks itself */
+	}
 }
 
 #if defined(DBMULTI_dropbearkey) || !defined(DROPBEAR_MULTI)
--- a/ecdsa.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/ecdsa.c	Fri Jan 01 15:02:09 2016 +0100
@@ -385,12 +385,12 @@
 			goto out; 
 		}
 
-    	/* reduce */
+		/* reduce */
 		if (ltc_mp.ecc_map(mG, m, mp) != CRYPT_OK) { 
 			goto out; 
 		}
 	} else {
-      /* use Shamir's trick to compute u1*mG + u2*mQ using half of the doubles */
+		/* use Shamir's trick to compute u1*mG + u2*mQ using half of the doubles */
 		if (ltc_mp.ecc_mul2add(mG, u1, mQ, u2, mG, m) != CRYPT_OK) { 
 			goto out; 
 		}
--- a/gensignkey.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/gensignkey.c	Fri Jan 01 15:02:09 2016 +0100
@@ -52,28 +52,28 @@
 /* returns 0 on failure */
 static int get_default_bits(enum signkey_type keytype)
 {
-        switch (keytype) {
+	switch (keytype) {
 #ifdef DROPBEAR_RSA
-            case DROPBEAR_SIGNKEY_RSA:
-				return RSA_DEFAULT_SIZE;
+		case DROPBEAR_SIGNKEY_RSA:
+			return RSA_DEFAULT_SIZE;
 #endif
 #ifdef DROPBEAR_DSS
-            case DROPBEAR_SIGNKEY_DSS:
-                return DSS_DEFAULT_SIZE;
+		case DROPBEAR_SIGNKEY_DSS:
+			return DSS_DEFAULT_SIZE;
 #endif
 #ifdef DROPBEAR_ECDSA
-            case DROPBEAR_SIGNKEY_ECDSA_KEYGEN:
-                return ECDSA_DEFAULT_SIZE;
-            case DROPBEAR_SIGNKEY_ECDSA_NISTP521:
-            	return 521;
-            case DROPBEAR_SIGNKEY_ECDSA_NISTP384:
-            	return 384;
-            case DROPBEAR_SIGNKEY_ECDSA_NISTP256:
-            	return 256;
+		case DROPBEAR_SIGNKEY_ECDSA_KEYGEN:
+			return ECDSA_DEFAULT_SIZE;
+		case DROPBEAR_SIGNKEY_ECDSA_NISTP521:
+			return 521;
+		case DROPBEAR_SIGNKEY_ECDSA_NISTP384:
+			return 384;
+		case DROPBEAR_SIGNKEY_ECDSA_NISTP256:
+			return 256;
 #endif
-            default:
-                return 0;
-		}
+		default:
+			return 0;
+	}
 }
 
 int signkey_generate(enum signkey_type keytype, int bits, const char* filename)
--- a/keyimport.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/keyimport.c	Fri Jan 01 15:02:09 2016 +0100
@@ -194,13 +194,13 @@
 		int datalen, int cpl)
 {
 	unsigned char out[100];
-    int n;
+	int n;
 	unsigned long outlen;
 	int rawcpl;
 	rawcpl = cpl * 3 / 4;
 	dropbear_assert((unsigned int)cpl < sizeof(out));
 
-    while (datalen > 0) {
+	while (datalen > 0) {
 		n = (datalen < rawcpl ? datalen : rawcpl);
 		outlen = sizeof(out);
 		base64_encode(data, n, out, &outlen);
@@ -208,7 +208,7 @@
 		datalen -= n;
 		fwrite(out, 1, outlen, fp);
 		fputc('\n', fp);
-    }
+	}
 }
 /*
  * Read an ASN.1/BER identifier and length pair.
@@ -1056,7 +1056,7 @@
 		dropbear_assert(k_size <= curve_size);
 		buf_incrwritepos(seq_buf,
 			ber_write_id_len(buf_getwriteptr(seq_buf, 10), 4, k_size, 0));
-	    mp_to_unsigned_bin((*eck)->k, buf_getwriteptr(seq_buf, k_size));
+		mp_to_unsigned_bin((*eck)->k, buf_getwriteptr(seq_buf, k_size));
 		buf_incrwritepos(seq_buf, k_size);
 
 		/* SECGCurveNames */
--- a/list.h	Thu Dec 31 15:59:01 2015 +0100
+++ b/list.h	Fri Jan 01 15:02:09 2016 +0100
@@ -4,17 +4,17 @@
 struct _m_list;
 
 struct _m_list_elem {
-    void *item;
+	void *item;
 	struct _m_list_elem *next;
 	struct _m_list_elem *prev;
-    struct _m_list *list;
+	struct _m_list *list;
 };
 	
 typedef struct _m_list_elem m_list_elem;
 
 struct _m_list {
-    m_list_elem *first;
-    m_list_elem *last;
+	m_list_elem *first;
+	m_list_elem *last;
 };
 
 typedef struct _m_list m_list;
--- a/packet.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/packet.c	Fri Jan 01 15:02:09 2016 +0100
@@ -576,8 +576,8 @@
 	}
 	buf_incrpos(writebuf, len);
 
-    /* stick the MAC on it */
-    buf_putbytes(writebuf, mac_bytes, mac_size);
+	/* stick the MAC on it */
+	buf_putbytes(writebuf, mac_bytes, mac_size);
 
 	/* Update counts */
 	ses.kexstate.datatrans += writebuf->len;
--- a/rsa.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/rsa.c	Fri Jan 01 15:02:09 2016 +0100
@@ -47,7 +47,7 @@
  * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
 int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key) {
 
-    int ret = DROPBEAR_FAILURE;
+	int ret = DROPBEAR_FAILURE;
 	TRACE(("enter buf_get_rsa_pub_key"))
 	dropbear_assert(key != NULL);
 	m_mp_alloc_init_multi(&key->e, &key->n, NULL);
@@ -60,12 +60,12 @@
 	if (buf_getmpint(buf, key->e) == DROPBEAR_FAILURE
 	 || buf_getmpint(buf, key->n) == DROPBEAR_FAILURE) {
 		TRACE(("leave buf_get_rsa_pub_key: failure"))
-	    goto out;
+		goto out;
 	}
 
 	if (mp_count_bits(key->n) < MIN_RSA_KEYLEN) {
 		dropbear_log(LOG_WARNING, "RSA key too short");
-	    goto out;
+		goto out;
 	}
 
 	TRACE(("leave buf_get_rsa_pub_key: success"))
@@ -82,7 +82,7 @@
  * Loads a private rsa key from a buffer
  * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
 int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key) {
-    int ret = DROPBEAR_FAILURE;
+	int ret = DROPBEAR_FAILURE;
 
 	TRACE(("enter buf_get_rsa_priv_key"))
 	dropbear_assert(key != NULL);
@@ -99,34 +99,34 @@
 	m_mp_alloc_init_multi(&key->d, NULL);
 	if (buf_getmpint(buf, key->d) == DROPBEAR_FAILURE) {
 		TRACE(("leave buf_get_rsa_priv_key: d: ret == DROPBEAR_FAILURE"))
-	    goto out;
+		goto out;
 	}
 
 	if (buf->pos == buf->len) {
-    	/* old Dropbear private keys didn't keep p and q, so we will ignore them*/
+		/* old Dropbear private keys didn't keep p and q, so we will ignore them*/
 	} else {
 		m_mp_alloc_init_multi(&key->p, &key->q, NULL);
 
 		if (buf_getmpint(buf, key->p) == DROPBEAR_FAILURE) {
 			TRACE(("leave buf_get_rsa_priv_key: p: ret == DROPBEAR_FAILURE"))
-		    goto out;
+			goto out;
 		}
 
 		if (buf_getmpint(buf, key->q) == DROPBEAR_FAILURE) {
 			TRACE(("leave buf_get_rsa_priv_key: q: ret == DROPBEAR_FAILURE"))
-		    goto out;
+			goto out;
 		}
 	}
 
-    ret = DROPBEAR_SUCCESS;
+	ret = DROPBEAR_SUCCESS;
 out:
-    if (ret == DROPBEAR_FAILURE) {
-        m_free(key->d);
-        m_free(key->p);
-        m_free(key->q);
-    }
+	if (ret == DROPBEAR_FAILURE) {
+		m_free(key->d);
+		m_free(key->p);
+		m_free(key->q);
+	}
 	TRACE(("leave buf_get_rsa_priv_key"))
-    return ret;
+	return ret;
 }
 	
 
--- a/scp.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/scp.c	Fri Jan 01 15:02:09 2016 +0100
@@ -441,9 +441,9 @@
 	 */
 	if (do_cmd_pid != -1 && errs == 0) {
 		if (remin != -1)
-		    (void) close(remin);
+			(void) close(remin);
 		if (remout != -1)
-		    (void) close(remout);
+			(void) close(remout);
 		if (waitpid(do_cmd_pid, &status, 0) == -1)
 			errs = 1;
 		else {
--- a/svr-main.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/svr-main.c	Fri Jan 01 15:02:09 2016 +0100
@@ -398,7 +398,7 @@
 	 * otherwise we might end up blatting error messages to the socket */
 	load_all_hostkeys();
 
-    seedrandom();
+	seedrandom();
 }
 
 /* Set up listening sockets for all the requested ports */
--- a/svr-tcpfwd.c	Thu Dec 31 15:59:01 2015 +0100
+++ b/svr-tcpfwd.c	Fri Jan 01 15:02:09 2016 +0100
@@ -194,7 +194,7 @@
 
 	tcpinfo->request_listenaddr = request_addr;
 	if (!opts.listen_fwd_all || (strcmp(request_addr, "localhost") == 0) ) {
-        /* NULL means "localhost only" */
+		/* NULL means "localhost only" */
 		tcpinfo->listenaddr = NULL;
 	}
 	else