summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2016-03-15 21:41:06 +0800
committerMatt Johnston <matt@ucc.asn.au>2016-03-15 21:41:06 +0800
commit645b2541732cebbccd499c4e8bf18f86d77bff0f (patch)
tree3e6f647d212466933d744e47dcdbcf97ff00ecfc
parentfdc61f3ab2c07f3f8d0546ee83b1a6776cc1786e (diff)
parent9bda22e70219c3056c07837803d0289b76453adb (diff)
Merge branch '20151231_indent' of https://github.com/fperrad/dropbear into fperrad-20151231_indent
-rw-r--r--bignum.c38
-rw-r--r--buffer.c2
-rw-r--r--cli-auth.c12
-rw-r--r--cli-tcpfwd.c4
-rw-r--r--common-kex.c44
-rw-r--r--dbutil.c30
-rw-r--r--dropbearkey.c40
-rw-r--r--ecdsa.c4
-rw-r--r--gensignkey.c32
-rw-r--r--keyimport.c8
-rw-r--r--list.h8
-rw-r--r--packet.c6
-rw-r--r--rsa.c40
-rw-r--r--scp.c4
-rw-r--r--signkey.c8
-rw-r--r--svr-main.c2
-rw-r--r--svr-tcpfwd.c2
17 files changed, 142 insertions, 142 deletions
diff --git a/bignum.c b/bignum.c
index 4400969..3758052 100644
--- a/bignum.c
+++ b/bignum.c
@@ -39,33 +39,33 @@ void m_mp_init(mp_int *mp) {
* 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) {
diff --git a/buffer.c b/buffer.c
index 1e5a864..cd974e3 100644
--- a/buffer.c
+++ b/buffer.c
@@ -98,7 +98,7 @@ buffer* buf_newcopy(buffer* buf) {
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;
}
diff --git a/cli-auth.c b/cli-auth.c
index da0d9d5..59d455b 100644
--- a/cli-auth.c
+++ b/cli-auth.c
@@ -332,12 +332,12 @@ char* getpass_or_cancel(char* prompt)
char* password = NULL;
#ifdef DROPBEAR_PASSWORD_ENV
- /* Password provided in an environment var */
- password = getenv(DROPBEAR_PASSWORD_ENV);
- if (password)
- {
- return password;
- }
+ /* Password provided in an environment var */
+ password = getenv(DROPBEAR_PASSWORD_ENV);
+ if (password)
+ {
+ return password;
+ }
#endif
password = getpass(prompt);
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c
index b32d9e0..c3a1350 100644
--- a/cli-tcpfwd.c
+++ b/cli-tcpfwd.c
@@ -231,7 +231,7 @@ void setup_remotetcp() {
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 @@ static int newtcpforwarded(struct Channel * channel) {
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;
diff --git a/common-kex.c b/common-kex.c
index d403bd2..c7004e6 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -308,17 +308,17 @@ static void gen_new_keys() {
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';
}
@@ -484,18 +484,18 @@ void recv_msg_kexinit() {
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 */
@@ -503,18 +503,18 @@ void recv_msg_kexinit() {
/* 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;
diff --git a/dbutil.c b/dbutil.c
index 7c7c069..93b03a3 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -157,26 +157,26 @@ void debug_start_net()
{
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, ...) {
diff --git a/dropbearkey.c b/dropbearkey.c
index 7eb2f3f..644de94 100644
--- a/dropbearkey.c
+++ b/dropbearkey.c
@@ -105,25 +105,25 @@ static void printhelp(char * progname) {
/* 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)
@@ -238,13 +238,13 @@ int main(int argc, char ** argv) {
}
check_signkey_bits(keytype, bits);;
- }
+ }
fprintf(stderr, "Generating key, this may take a while...\n");
- if (signkey_generate(keytype, bits, filename) == DROPBEAR_FAILURE)
- {
- dropbear_exit("Failed to generate key.\n");
- }
+ if (signkey_generate(keytype, bits, filename) == DROPBEAR_FAILURE)
+ {
+ dropbear_exit("Failed to generate key.\n");
+ }
printpubfile(filename);
diff --git a/ecdsa.c b/ecdsa.c
index 5568131..14558b6 100644
--- a/ecdsa.c
+++ b/ecdsa.c
@@ -385,12 +385,12 @@ int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf) {
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;
}
diff --git a/gensignkey.c b/gensignkey.c
index e6c40e0..cdc16e6 100644
--- a/gensignkey.c
+++ b/gensignkey.c
@@ -52,28 +52,28 @@ out:
/* 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)
diff --git a/keyimport.c b/keyimport.c
index d45914f..66a6df7 100644
--- a/keyimport.c
+++ b/keyimport.c
@@ -194,13 +194,13 @@ static void base64_encode_fp(FILE * fp, unsigned char *data,
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 @@ static void base64_encode_fp(FILE * fp, unsigned char *data,
datalen -= n;
fwrite(out, 1, outlen, fp);
fputc('\n', fp);
- }
+ }
}
/*
* Read an ASN.1/BER identifier and length pair.
@@ -1056,7 +1056,7 @@ static int openssh_write(const char *filename, sign_key *key,
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 */
diff --git a/list.h b/list.h
index 35c0d49..b26a212 100644
--- a/list.h
+++ b/list.h
@@ -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;
diff --git a/packet.c b/packet.c
index 19b5759..f827ab8 100644
--- a/packet.c
+++ b/packet.c
@@ -576,8 +576,8 @@ void encrypt_packet() {
}
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;
@@ -645,7 +645,7 @@ static void make_mac(unsigned int seqno, const struct key_context_directional *
dropbear_exit("HMAC error");
}
- bufsize = MAX_MAC_LEN;
+ bufsize = MAX_MAC_LEN;
if (hmac_done(&hmac, output_mac, &bufsize) != CRYPT_OK) {
dropbear_exit("HMAC error");
}
diff --git a/rsa.c b/rsa.c
index 193e577..4fa4088 100644
--- a/rsa.c
+++ b/rsa.c
@@ -47,7 +47,7 @@ static void rsa_pad_em(dropbear_rsa_key * key,
* 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,21 +60,21 @@ int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key) {
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"))
- ret = DROPBEAR_SUCCESS;
+ ret = DROPBEAR_SUCCESS;
out:
- if (ret == DROPBEAR_FAILURE) {
- m_free(key->e);
- m_free(key->n);
- }
+ if (ret == DROPBEAR_FAILURE) {
+ m_free(key->e);
+ m_free(key->n);
+ }
return ret;
}
@@ -82,7 +82,7 @@ out:
* 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 @@ int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key) {
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;
}
diff --git a/scp.c b/scp.c
index 8c94ec8..73262fa 100644
--- a/scp.c
+++ b/scp.c
@@ -440,9 +440,9 @@ main(int argc, char **argv)
*/
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 {
diff --git a/signkey.c b/signkey.c
index ac5d887..55f34e7 100644
--- a/signkey.c
+++ b/signkey.c
@@ -317,15 +317,15 @@ void buf_put_priv_key(buffer* buf, sign_key *key, enum signkey_type type) {
#ifdef DROPBEAR_DSS
if (type == DROPBEAR_SIGNKEY_DSS) {
buf_put_dss_priv_key(buf, key->dsskey);
- TRACE(("leave buf_put_priv_key: dss done"))
- return;
+ TRACE(("leave buf_put_priv_key: dss done"))
+ return;
}
#endif
#ifdef DROPBEAR_RSA
if (type == DROPBEAR_SIGNKEY_RSA) {
buf_put_rsa_priv_key(buf, key->rsakey);
- TRACE(("leave buf_put_priv_key: rsa done"))
- return;
+ TRACE(("leave buf_put_priv_key: rsa done"))
+ return;
}
#endif
#ifdef DROPBEAR_ECDSA
diff --git a/svr-main.c b/svr-main.c
index af56a7c..28fc9b0 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -398,7 +398,7 @@ static void commonsetup() {
* 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 */
diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c
index 9d051bf..1abd0ac 100644
--- a/svr-tcpfwd.c
+++ b/svr-tcpfwd.c
@@ -194,7 +194,7 @@ static int svr_remotetcpreq() {
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