diff options
-rw-r--r-- | bignum.c | 38 | ||||
-rw-r--r-- | buffer.c | 2 | ||||
-rw-r--r-- | cli-tcpfwd.c | 4 | ||||
-rw-r--r-- | common-kex.c | 48 | ||||
-rw-r--r-- | dbutil.c | 30 | ||||
-rw-r--r-- | dropbearkey.c | 30 | ||||
-rw-r--r-- | ecdsa.c | 4 | ||||
-rw-r--r-- | gensignkey.c | 32 | ||||
-rw-r--r-- | keyimport.c | 8 | ||||
-rw-r--r-- | list.h | 8 | ||||
-rw-r--r-- | packet.c | 4 | ||||
-rw-r--r-- | rsa.c | 30 | ||||
-rw-r--r-- | scp.c | 4 | ||||
-rw-r--r-- | svr-main.c | 2 | ||||
-rw-r--r-- | svr-tcpfwd.c | 2 |
15 files changed, 123 insertions, 123 deletions
@@ -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) { @@ -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-tcpfwd.c b/cli-tcpfwd.c index fec5dba..d5023cc 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 b233819..8c0c873 100644 --- a/common-kex.c +++ b/common-kex.c @@ -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 @@ const unsigned char dh_p_1[DH_P_1_LEN] = { /* 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 @@ 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'; } @@ -525,18 +525,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 */ @@ -544,18 +544,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; @@ -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 0d13b38..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) @@ -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 */ @@ -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; @@ -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; @@ -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,12 +60,12 @@ 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")) @@ -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; } @@ -441,9 +441,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 { @@ -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 d2f1427..5f87511 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 |