Mercurial > dropbear
changeset 857:c19acba28590
use oldstyle comments
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 14 Nov 2013 22:03:30 +0800 |
parents | f56c41030c15 |
children | 220f55d540ae |
files | algo.h cli-agentfwd.c cli-chansession.c cli-main.c cli-runopts.c cli-session.c cli-tcpfwd.c common-algo.c common-kex.c common-session.c crypto_desc.h ecc.c ecc.h ecdsa.c ecdsa.h gensignkey.c keyimport.c ltc_prng.c ltc_prng.h options.h packet.c random.c scp.c session.h signkey.c signkey.h svr-runopts.c svr-tcpfwd.c |
diffstat | 28 files changed, 72 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/algo.h Thu Nov 14 21:45:50 2013 +0800 +++ b/algo.h Thu Nov 14 22:03:30 2013 +0800 @@ -76,8 +76,8 @@ struct dropbear_hash { const struct ltc_hash_descriptor *hash_desc; const unsigned long keysize; - // hashsize may be truncated from the size returned by hash_desc, - // eg sha1-96 + /* hashsize may be truncated from the size returned by hash_desc, + eg sha1-96 */ const unsigned char hashsize; };
--- a/cli-agentfwd.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-agentfwd.c Thu Nov 14 22:03:30 2013 +0800 @@ -73,8 +73,8 @@ return fd; } -// handle a request for a connection to the locally running ssh-agent -// or forward. +/* handle a request for a connection to the locally running ssh-agent + or forward. */ static int new_agent_chan(struct Channel * channel) { int fd = -1; @@ -94,7 +94,6 @@ channel->readfd = fd; channel->writefd = fd; - // success return 0; }
--- a/cli-chansession.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-chansession.c Thu Nov 14 22:03:30 2013 +0800 @@ -433,7 +433,7 @@ } -// returns 1 if the character should be consumed, 0 to pass through +/* returns 1 if the character should be consumed, 0 to pass through */ static int do_escape(unsigned char c) { switch (c) { @@ -442,10 +442,10 @@ return 1; break; case 0x1a: - // ctrl-z + /* ctrl-z */ cli_tty_cleanup(); kill(getpid(), SIGTSTP); - // after continuation + /* after continuation */ cli_tty_setup(); cli_ses.winchange = 1; return 1; @@ -459,8 +459,8 @@ char c; int skip_char = 0; - // only handle escape characters if they are read one at a time. simplifies - // the code and avoids nasty people putting ~. at the start of a line to paste + /* only handle escape characters if they are read one at a time. simplifies + the code and avoids nasty people putting ~. at the start of a line to paste */ if (*len != 1) { cli_ses.last_char = 0x0; return;
--- a/cli-main.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-main.c Thu Nov 14 22:03:30 2013 +0800 @@ -143,4 +143,4 @@ *sock_in = *sock_out = -1; } } -#endif // ENABLE_CLI_PROXYCMD +#endif /* ENABLE_CLI_PROXYCMD */
--- a/cli-runopts.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-runopts.c Thu Nov 14 22:03:30 2013 +0800 @@ -216,7 +216,7 @@ switch (argv[i][1]) { case 'y': /* always accept the remote hostkey */ if (cli_opts.always_accept_key) { - // twice means no checking at all + /* twice means no checking at all */ cli_opts.no_hostkey_check = 1; } cli_opts.always_accept_key = 1; @@ -481,7 +481,7 @@ sign_key * key = (sign_key*)iter->item; len += 3 + strlen(key->filename); } - len += 30; // space for -W <size>, terminator. + len += 30; /* space for -W <size>, terminator. */ ret = m_malloc(len); total = 0; @@ -619,7 +619,7 @@ port = strchr(cli_opts.remotehost, '%'); if (!port) { - // legacy separator + /* legacy separator */ port = strchr(cli_opts.remotehost, '/'); } if (port) {
--- a/cli-session.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-session.c Thu Nov 14 22:03:30 2013 +0800 @@ -175,7 +175,7 @@ } static void recv_msg_service_accept(void) { - // do nothing, if it failed then the server MUST have disconnected + /* do nothing, if it failed then the server MUST have disconnected */ } /* This function drives the progress of the session - it initiates KEX,
--- a/cli-tcpfwd.c Thu Nov 14 21:45:50 2013 +0800 +++ b/cli-tcpfwd.c Thu Nov 14 22:03:30 2013 +0800 @@ -193,8 +193,8 @@ struct TCPFwdEntry *fwd = (struct TCPFwdEntry*)iter->item; if (!fwd->listenaddr) { - // we store the addresses so that we can compare them - // when the server sends them back + /* we store the addresses so that we can compare them + when the server sends them back */ if (opts.listen_fwd_all) { fwd->listenaddr = m_strdup(""); } else {
--- a/common-algo.c Thu Nov 14 21:45:50 2013 +0800 +++ b/common-algo.c Thu Nov 14 22:03:30 2013 +0800 @@ -395,7 +395,7 @@ for (i = 0; i < clicount; i++) { for (j = 0; j < servcount; j++) { if (!(servnames[j] && clinames[i])) { - // unusable algos are NULL + /* unusable algos are NULL */ continue; } if (strcmp(servnames[j], clinames[i]) == 0) { @@ -458,7 +458,7 @@ return 0; } -#endif // DROPBEAR_NONE_CIPHER +#endif /* DROPBEAR_NONE_CIPHER */ #ifdef ENABLE_USER_ALGO_LIST @@ -539,4 +539,4 @@ memcpy(algos, new_algos, sizeof(*new_algos) * (num_ret+1)); return num_ret; } -#endif // ENABLE_USER_ALGO_LIST +#endif /* ENABLE_USER_ALGO_LIST */
--- a/common-kex.c Thu Nov 14 21:45:50 2013 +0800 +++ b/common-kex.c Thu Nov 14 22:03:30 2013 +0800 @@ -685,7 +685,7 @@ void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them, sign_key *hostkey) { const struct dropbear_kex *algo_kex = ses.newkeys->algo_kex; - // public keys from client and server + /* public keys from client and server */ ecc_key *Q_C, *Q_S, *Q_them; Q_them = buf_get_ecc_raw_pubkey(pub_them, algo_kex->ecc_curve);
--- a/common-session.c Thu Nov 14 21:45:50 2013 +0800 +++ b/common-session.c Thu Nov 14 22:03:30 2013 +0800 @@ -266,7 +266,7 @@ void send_session_identification() { buffer *writebuf = buf_new(strlen(LOCAL_IDENT "\r\n") + 1); buf_putbytes(writebuf, LOCAL_IDENT "\r\n", strlen(LOCAL_IDENT "\r\n")); - buf_putbyte(writebuf, 0x0); // packet type + buf_putbyte(writebuf, 0x0); /* packet type */ buf_setpos(writebuf, 0); enqueue(&ses.writequeue, writebuf); }
--- a/crypto_desc.h Thu Nov 14 21:45:50 2013 +0800 +++ b/crypto_desc.h Thu Nov 14 22:03:30 2013 +0800 @@ -5,5 +5,5 @@ extern int dropbear_ltc_prng; -#endif // _CRYPTO_DESC_H +#endif /* _CRYPTO_DESC_H */
--- a/ecc.c Thu Nov 14 21:45:50 2013 +0800 +++ b/ecc.c Thu Nov 14 22:03:30 2013 +0800 @@ -80,8 +80,8 @@ return key; } -// Copied from libtomcrypt ecc_import.c (version there is static), modified -// for different mp_int pointer without LTC_SOURCE +/* Copied from libtomcrypt ecc_import.c (version there is static), modified + for different mp_int pointer without LTC_SOURCE */ static int ecc_is_point(ecc_key *key) { mp_int *prime, *b, *t1, *t2; @@ -191,7 +191,7 @@ goto out; } - // SEC1 3.2.3.1 Check that Q != 0 + /* SEC1 3.2.3.1 Check that Q != 0 */ if (mp_cmp_d(key->pubkey.x, 0) == LTC_MP_EQ) { TRACE(("failed, x == 0")) goto out; @@ -216,8 +216,8 @@ } -// a modified version of libtomcrypt's "ecc_shared_secret" to output -// a mp_int instead. +/* a modified version of libtomcrypt's "ecc_shared_secret" to output + a mp_int instead. */ mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, ecc_key *private_key) { ecc_point *result = NULL;
--- a/ecc.h Thu Nov 14 21:45:50 2013 +0800 +++ b/ecc.h Thu Nov 14 22:03:30 2013 +0800 @@ -9,8 +9,8 @@ #ifdef DROPBEAR_ECC struct dropbear_ecc_curve { - int ltc_size; // to match the byte sizes in ltc_ecc_sets[] - const ltc_ecc_set_type *dp; // curve domain parameters + 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; }; @@ -23,8 +23,8 @@ void dropbear_ecc_fill_dp(); struct dropbear_ecc_curve* curve_for_dp(const ltc_ecc_set_type *dp); -// "pubkey" refers to a point, but LTC uses ecc_key structure for both public -// and private keys +/* "pubkey" refers to a point, but LTC uses ecc_key structure for both public + and private keys */ void buf_put_ecc_raw_pubkey_string(buffer *buf, ecc_key *key); ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve); int buf_get_ecc_privkey_string(buffer *buf, ecc_key *key); @@ -33,4 +33,4 @@ #endif -#endif // _DROPBEAR_ECC_H \ No newline at end of file +#endif /* _DROPBEAR_ECC_H */
--- a/ecdsa.c Thu Nov 14 21:45:50 2013 +0800 +++ b/ecdsa.c Thu Nov 14 22:03:30 2013 +0800 @@ -35,7 +35,7 @@ } ecc_key *gen_ecdsa_priv_key(unsigned int bit_size) { - const ltc_ecc_set_type *dp = NULL; // curve domain parameters + const ltc_ecc_set_type *dp = NULL; /* curve domain parameters */ ecc_key *new_key = NULL; switch (bit_size) { #ifdef DROPBEAR_ECC_256 @@ -82,9 +82,9 @@ struct dropbear_ecc_curve **curve; ecc_key *new_key = NULL; - // string "ecdsa-sha2-[identifier]" + /* string "ecdsa-sha2-[identifier]" */ key_ident = buf_getstring(buf, &key_ident_len); - // string "[identifier]" + /* string "[identifier]" */ identifier = buf_getstring(buf, &identifier_len); if (key_ident_len != identifier_len + strlen("ecdsa-sha2-")) { @@ -106,7 +106,7 @@ goto out; } - // string Q + /* string Q */ q_buf = buf_getstringbuf(buf); new_key = buf_get_ecc_raw_pubkey(q_buf, *curve); @@ -183,7 +183,7 @@ } for (;;) { - ecc_key R_key; // ephemeral key + ecc_key R_key; /* ephemeral key */ if (ecc_make_key_ex(NULL, dropbear_ltc_prng, &R_key, key->dp) != CRYPT_OK) { goto out; } @@ -191,7 +191,7 @@ goto out; } if (ltc_mp.compare_d(r, 0) == LTC_MP_EQ) { - // try again + /* try again */ ecc_free(&R_key); continue; } @@ -223,7 +223,7 @@ snprintf((char*)key_ident, sizeof(key_ident), "ecdsa-sha2-%s", curve->name); buf_putstring(buf, key_ident, strlen(key_ident)); - // enough for nistp521 + /* enough for nistp521 */ sigbuf = buf_new(200); buf_putmpint(sigbuf, (mp_int*)r); buf_putmpint(sigbuf, (mp_int*)s); @@ -245,8 +245,8 @@ } } -// returns values in s and r -// returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE +/* returns values in s and r + returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ static int buf_get_ecdsa_verify_params(buffer *buf, void *r, void* s) { int ret = DROPBEAR_FAILURE; @@ -417,4 +417,4 @@ -#endif // DROPBEAR_ECDSA +#endif /* DROPBEAR_ECDSA */
--- a/ecdsa.h Thu Nov 14 21:45:50 2013 +0800 +++ b/ecdsa.h Thu Nov 14 22:03:30 2013 +0800 @@ -32,4 +32,4 @@ #endif -#endif // _ECDSA_H_ +#endif /* _ECDSA_H_ */
--- a/gensignkey.c Thu Nov 14 21:45:50 2013 +0800 +++ b/gensignkey.c Thu Nov 14 22:03:30 2013 +0800 @@ -10,7 +10,7 @@ #define RSA_DEFAULT_SIZE 2048 #define DSS_DEFAULT_SIZE 1024 -// Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE +/* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ static int buf_writefile(buffer * buf, const char * filename) { int ret = DROPBEAR_FAILURE; int fd = -1;
--- a/keyimport.c Thu Nov 14 21:45:50 2013 +0800 +++ b/keyimport.c Thu Nov 14 22:03:30 2013 +0800 @@ -672,14 +672,14 @@ ecc_key *ecc = NULL; const struct dropbear_ecc_curve *curve = NULL; - // See SEC1 v2, Appendix C.4 - // OpenSSL (so OpenSSH) seems to include the optional parts. + /* See SEC1 v2, Appendix C.4 */ + /* OpenSSL (so OpenSSH) seems to include the optional parts. */ - // privateKey OCTET STRING, + /* privateKey OCTET STRING, */ ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, &id, &len, &flags); p += ret; - // id==4 for octet string + /* id==4 for octet string */ if (ret < 0 || id != 4 || key->keyblob+key->keyblob_len-p < len) { errmsg = "ASN.1 decoding failure"; @@ -689,11 +689,11 @@ private_key_len = len; p += len; - // parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, + /* parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, */ ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, &id, &len, &flags); p += ret; - // id==0 + /* id==0 */ if (ret < 0 || id != 0) { errmsg = "ASN.1 decoding failure"; goto error; @@ -702,7 +702,7 @@ ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, &id, &len, &flags); p += ret; - // id==6 for object + /* id==6 for object */ if (ret < 0 || id != 6 || key->keyblob+key->keyblob_len-p < len) { errmsg = "ASN.1 decoding failure"; @@ -737,11 +737,11 @@ } p += len; - // publicKey [1] BIT STRING OPTIONAL + /* publicKey [1] BIT STRING OPTIONAL */ ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, &id, &len, &flags); p += ret; - // id==1 + /* id==1 */ if (ret < 0 || id != 1) { errmsg = "ASN.1 decoding failure"; goto error; @@ -750,7 +750,7 @@ ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, &id, &len, &flags); p += ret; - // id==3 for bit string + /* id==3 for bit string */ if (ret < 0 || id != 3 || key->keyblob+key->keyblob_len-p < len) { errmsg = "ASN.1 decoding failure"; @@ -775,7 +775,7 @@ *signkey_key_ptr(retkey, retkey->type) = ecc; } -#endif // DROPBEAR_ECDSA +#endif /* DROPBEAR_ECDSA */ /* * Now put together the actual key. Simplest way to do this is @@ -1012,7 +1012,7 @@ memcpy(outblob+pos, numbers[i].start, numbers[i].bytes); pos += numbers[i].bytes; } - } // end RSA and DSS handling + } /* end RSA and DSS handling */ #ifdef DROPBEAR_ECDSA if (key->type == DROPBEAR_SIGNKEY_ECDSA_NISTP256 @@ -1067,7 +1067,7 @@ buf_incrwritepos(seq_buf, ber_write_id_len(buf_getwriteptr(seq_buf, 10), 0, 2+curve_oid_len, 0xa0)); - // object == 6 + /* object == 6 */ buf_incrwritepos(seq_buf, ber_write_id_len(buf_getwriteptr(seq_buf, 10), 6, curve_oid_len, 0)); buf_putbytes(seq_buf, curve_oid, curve_oid_len);
--- a/ltc_prng.c Thu Nov 14 21:45:50 2013 +0800 +++ b/ltc_prng.c Thu Nov 14 22:03:30 2013 +0800 @@ -134,4 +134,4 @@ }; -#endif // DROPBEAR_LTC_PRNG +#endif /* DROPBEAR_LTC_PRNG */
--- a/ltc_prng.h Thu Nov 14 21:45:50 2013 +0800 +++ b/ltc_prng.h Thu Nov 14 22:03:30 2013 +0800 @@ -8,6 +8,6 @@ extern const struct ltc_prng_descriptor dropbear_prng_desc; -#endif // DROPBEAR_LTC_PRNG +#endif /* DROPBEAR_LTC_PRNG */ -#endif // _LTC_PRNG_H_DROPBEAR \ No newline at end of file +#endif /* _LTC_PRNG_H_DROPBEAR */
--- a/options.h Thu Nov 14 21:45:50 2013 +0800 +++ b/options.h Thu Nov 14 22:03:30 2013 +0800 @@ -171,7 +171,7 @@ #endif /* Whether to do reverse DNS lookups. */ -//#define DO_HOST_LOOKUP +/*#define DO_HOST_LOOKUP */ /* Whether to print the message of the day (MOTD). This doesn't add much code * size */
--- a/packet.c Thu Nov 14 21:45:50 2013 +0800 +++ b/packet.c Thu Nov 14 22:03:30 2013 +0800 @@ -98,7 +98,7 @@ writebuf = (buffer*)examine(&ses.writequeue); len = writebuf->len - 1 - writebuf->pos; if (len > written) { - // partial buffer write + /* partial buffer write */ buf_incrpos(writebuf, written); written = 0; } else {
--- a/random.c Thu Nov 14 21:45:50 2013 +0800 +++ b/random.c Thu Nov 14 22:03:30 2013 +0800 @@ -225,8 +225,8 @@ pid = getpid(); sha1_process(&hs, (void*)&pid, sizeof(pid)); - // gettimeofday() doesn't completely fill out struct timeval on - // OS X (10.8.3), avoid valgrind warnings by clearing it first + /* gettimeofday() doesn't completely fill out struct timeval on + OS X (10.8.3), avoid valgrind warnings by clearing it first */ memset(&tv, 0x0, sizeof(tv)); gettimeofday(&tv, NULL); sha1_process(&hs, (void*)&tv, sizeof(tv));
--- a/scp.c Thu Nov 14 21:45:50 2013 +0800 +++ b/scp.c Thu Nov 14 22:03:30 2013 +0800 @@ -494,8 +494,8 @@ if (verbose_mode) addargs(&alist, "-v"); #if 0 - // Disabled since dbclient won't understand them - // and scp works fine without them. + /* Disabled since dbclient won't understand them + and scp works fine without them. */ addargs(&alist, "-x"); addargs(&alist, "-oClearAllForwardings yes"); addargs(&alist, "-n");
--- a/session.h Thu Nov 14 21:45:50 2013 +0800 +++ b/session.h Thu Nov 14 22:03:30 2013 +0800 @@ -241,7 +241,7 @@ struct clientsession { - // XXX - move these to kexstate? + /* XXX - move these to kexstate? */ struct kex_dh_param *dh_param; struct kex_ecdh_param *ecdh_param; struct kex_curve25519_param *curve25519_param;
--- a/signkey.c Thu Nov 14 21:45:50 2013 +0800 +++ b/signkey.c Thu Nov 14 22:03:30 2013 +0800 @@ -40,7 +40,7 @@ "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521" -#endif // DROPBEAR_ECDSA +#endif /* DROPBEAR_ECDSA */ }; /* malloc a new sign_key and set the dss and rsa keys to NULL */
--- a/signkey.h Thu Nov 14 21:45:50 2013 +0800 +++ b/signkey.h Thu Nov 14 22:03:30 2013 +0800 @@ -40,9 +40,9 @@ DROPBEAR_SIGNKEY_ECDSA_NISTP256, DROPBEAR_SIGNKEY_ECDSA_NISTP384, DROPBEAR_SIGNKEY_ECDSA_NISTP521, - DROPBEAR_SIGNKEY_ECDSA_KEYGEN, // just "ecdsa" for keygen -#endif // DROPBEAR_ECDSA +#endif /* DROPBEAR_ECDSA */ DROPBEAR_SIGNKEY_NUM_NAMED, + DROPBEAR_SIGNKEY_ECDSA_KEYGEN = 70, /* just "ecdsa" for keygen */ DROPBEAR_SIGNKEY_ANY = 80, DROPBEAR_SIGNKEY_NONE = 90, };
--- a/svr-runopts.c Thu Nov 14 21:45:50 2013 +0800 +++ b/svr-runopts.c Thu Nov 14 22:03:30 2013 +0800 @@ -436,7 +436,7 @@ loadhostkey_helper("ECDSA521", (void**)&read_key->ecckey521, (void**)&svr_opts.hostkey->ecckey521, fatal_duplicate); } #endif -#endif // DROPBEAR_ECDSA +#endif /* DROPBEAR_ECDSA */ sign_key_free(read_key); TRACE(("leave loadhostkey")) }
--- a/svr-tcpfwd.c Thu Nov 14 21:45:50 2013 +0800 +++ b/svr-tcpfwd.c Thu Nov 14 22:03:30 2013 +0800 @@ -211,7 +211,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