Fix for old compilers, variable declarations at beginning of functions

and /**/ comments
This commit is contained in:
Thorsten Horstmann 2015-02-24 20:51:18 +08:00
parent abeb9d64a3
commit ab9439519a
8 changed files with 18 additions and 17 deletions

View File

@ -87,7 +87,7 @@ const struct dropbear_cipher dropbear_nocipher =
#ifdef DROPBEAR_ENABLE_CBC_MODE #ifdef DROPBEAR_ENABLE_CBC_MODE
const struct dropbear_cipher_mode dropbear_mode_cbc = const struct dropbear_cipher_mode dropbear_mode_cbc =
{(void*)cbc_start, (void*)cbc_encrypt, (void*)cbc_decrypt}; {(void*)cbc_start, (void*)cbc_encrypt, (void*)cbc_decrypt};
#endif // DROPBEAR_ENABLE_CBC_MODE #endif /* DROPBEAR_ENABLE_CBC_MODE */
const struct dropbear_cipher_mode dropbear_mode_none = const struct dropbear_cipher_mode dropbear_mode_none =
{void_start, void_cipher, void_cipher}; {void_start, void_cipher, void_cipher};
@ -102,7 +102,7 @@ static int dropbear_big_endian_ctr_start(int cipher,
} }
const struct dropbear_cipher_mode dropbear_mode_ctr = const struct dropbear_cipher_mode dropbear_mode_ctr =
{(void*)dropbear_big_endian_ctr_start, (void*)ctr_encrypt, (void*)ctr_decrypt}; {(void*)dropbear_big_endian_ctr_start, (void*)ctr_encrypt, (void*)ctr_decrypt};
#endif // DROPBEAR_ENABLE_CTR_MODE #endif /* DROPBEAR_ENABLE_CTR_MODE */
/* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc. /* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc.
{&hash_desc, keysize, hashsize} */ {&hash_desc, keysize, hashsize} */

View File

@ -402,7 +402,7 @@ static void check_in_progress(struct Channel *channel) {
/* Send the close message and set the channel as closed */ /* Send the close message and set the channel as closed */
static void send_msg_channel_close(struct Channel *channel) { static void send_msg_channel_close(struct Channel *channel) {
TRACE(("enter send_msg_channel_close %p", channel)) TRACE(("enter send_msg_channel_close %p", (void*)channel))
if (channel->type->closehandler if (channel->type->closehandler
&& !channel->close_handler_done) { && !channel->close_handler_done) {
channel->type->closehandler(channel); channel->type->closehandler(channel);
@ -616,7 +616,7 @@ void recv_msg_channel_request() {
channel = getchannel(); channel = getchannel();
TRACE(("enter recv_msg_channel_request %p", channel)) TRACE(("enter recv_msg_channel_request %p", (void*)channel))
if (channel->sent_close) { if (channel->sent_close) {
TRACE(("leave recv_msg_channel_request: already closed channel")) TRACE(("leave recv_msg_channel_request: already closed channel"))
@ -1141,10 +1141,10 @@ void send_msg_request_failure() {
} }
struct Channel* get_any_ready_channel() { struct Channel* get_any_ready_channel() {
size_t i;
if (ses.chancount == 0) { if (ses.chancount == 0) {
return NULL; return NULL;
} }
size_t i;
for (i = 0; i < ses.chansize; i++) { for (i = 0; i < ses.chansize; i++) {
struct Channel *chan = ses.channels[i]; struct Channel *chan = ses.channels[i];
if (chan if (chan

View File

@ -399,16 +399,16 @@ static int ident_readln(int fd, char* buf, int count) {
} }
void ignore_recv_response() { void ignore_recv_response() {
// Do nothing /* Do nothing */
TRACE(("Ignored msg_request_response")) TRACE(("Ignored msg_request_response"))
} }
static void send_msg_keepalive() { static void send_msg_keepalive() {
CHECKCLEARTOWRITE();
time_t old_time_idle = ses.last_packet_time_idle; time_t old_time_idle = ses.last_packet_time_idle;
struct Channel *chan = get_any_ready_channel(); struct Channel *chan = get_any_ready_channel();
CHECKCLEARTOWRITE();
if (chan) { if (chan) {
/* Channel requests are preferable, more implementations /* Channel requests are preferable, more implementations
handle them than SSH_MSG_GLOBAL_REQUEST */ handle them than SSH_MSG_GLOBAL_REQUEST */

View File

@ -527,7 +527,7 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */
memcpy(origx, x, 10 * sizeof(limb)); memcpy(origx, x, 10 * sizeof(limb));
fsum(x, z); fsum(x, z);
fdifference(z, origx); // does x - z fdifference(z, origx); /* does x - z */
memcpy(origxprime, xprime, sizeof(limb) * 10); memcpy(origxprime, xprime, sizeof(limb) * 10);
fsum(xprime, zprime); fsum(xprime, zprime);
@ -554,7 +554,7 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */
fproduct(x2, xx, zz); fproduct(x2, xx, zz);
freduce_degree(x2); freduce_degree(x2);
freduce_coefficients(x2); freduce_coefficients(x2);
fdifference(zz, xx); // does zz = xx - zz fdifference(zz, xx); /* does zz = xx - zz */
memset(zzz + 10, 0, sizeof(limb) * 9); memset(zzz + 10, 0, sizeof(limb) * 9);
fscalar_product(zzz, zz, 121665); fscalar_product(zzz, zz, 121665);
/* No need to call freduce_degree here: /* No need to call freduce_degree here:
@ -641,9 +641,9 @@ cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
memcpy(resultz, nqz, sizeof(limb) * 10); memcpy(resultz, nqz, sizeof(limb) * 10);
} }
// ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
// Shamelessly copied from djb's code * Shamelessly copied from djb's code
// ----------------------------------------------------------------------------- * ----------------------------------------------------------------------------- */
static void static void
crecip(limb *out, const limb *z) { crecip(limb *out, const limb *z) {
limb z2[10]; limb z2[10];

View File

@ -868,12 +868,12 @@ out:
/* make sure that the socket closes */ /* make sure that the socket closes */
void m_close(int fd) { void m_close(int fd) {
int val;
if (fd == -1) { if (fd == -1) {
return; return;
} }
int val;
do { do {
val = close(fd); val = close(fd);
} while (val < 0 && errno == EINTR); } while (val < 0 && errno == EINTR);

View File

@ -1046,6 +1046,7 @@ static int openssh_write(const char *filename, sign_key *key,
const void* curve_oid = NULL; const void* curve_oid = NULL;
unsigned long pubkey_size = 2*curve_size+1; unsigned long pubkey_size = 2*curve_size+1;
unsigned int k_size; unsigned int k_size;
int err = 0;
/* version. less than 10 bytes */ /* version. less than 10 bytes */
buf_incrwritepos(seq_buf, buf_incrwritepos(seq_buf,
@ -1091,7 +1092,7 @@ static int openssh_write(const char *filename, sign_key *key,
buf_incrwritepos(seq_buf, buf_incrwritepos(seq_buf,
ber_write_id_len(buf_getwriteptr(seq_buf, 10), 3, 1+pubkey_size, 0)); ber_write_id_len(buf_getwriteptr(seq_buf, 10), 3, 1+pubkey_size, 0));
buf_putbyte(seq_buf, 0); buf_putbyte(seq_buf, 0);
int err = ecc_ansi_x963_export(*eck, buf_getwriteptr(seq_buf, pubkey_size), &pubkey_size); err = ecc_ansi_x963_export(*eck, buf_getwriteptr(seq_buf, pubkey_size), &pubkey_size);
if (err != CRYPT_OK) { if (err != CRYPT_OK) {
dropbear_exit("ECC error"); dropbear_exit("ECC error");
} }

View File

@ -234,7 +234,7 @@ static int newchansess(struct Channel *channel) {
struct ChanSess *chansess; struct ChanSess *chansess;
TRACE(("new chansess %p", channel)) TRACE(("new chansess %p", (void*)channel))
dropbear_assert(channel->typedata == NULL); dropbear_assert(channel->typedata == NULL);

View File

@ -175,7 +175,7 @@ void x11cleanup(struct ChanSess *chansess) {
m_free(chansess->x11authprot); m_free(chansess->x11authprot);
m_free(chansess->x11authcookie); m_free(chansess->x11authcookie);
TRACE(("chansess %p", chansess)) TRACE(("chansess %p", (void*)chansess))
if (chansess->x11listener != NULL) { if (chansess->x11listener != NULL) {
remove_listener(chansess->x11listener); remove_listener(chansess->x11listener);
chansess->x11listener = NULL; chansess->x11listener = NULL;