Index: misc.c =================================================================== --- misc.c (revision 6638) +++ misc.c (working copy) @@ -238,9 +238,6 @@ size = 512; while (1) { -#ifdef _WINDOWS -#define vsnprintf _vsnprintf -#endif len = vsnprintf(buf, size, fmt, ap); if (len >= 0 && len < size) { /* This is the C99-specified criterion for snprintf to have Index: misc.h =================================================================== --- misc.h (revision 6638) +++ misc.h (working copy) @@ -81,6 +81,10 @@ #define max(x,y) ( (x) > (y) ? (x) : (y) ) #endif +#ifndef abort +#define abort() +#endif + #define GET_32BIT_LSB_FIRST(cp) \ (((unsigned long)(unsigned char)(cp)[0]) | \ ((unsigned long)(unsigned char)(cp)[1] << 8) | \ Index: puttyps.h =================================================================== --- puttyps.h (revision 6638) +++ puttyps.h (working copy) @@ -1,9 +1,10 @@ #ifndef PUTTY_PUTTYPS_H #define PUTTY_PUTTYPS_H -#ifdef _WINDOWS - +#ifdef _WINDOWS +#ifndef _WIN32_WCE // vc8... #include "winstuff.h" +#endif #elif defined(macintosh) @@ -13,6 +14,10 @@ #include "osx.h" +#elif defined(UNDER_CE) + +#include "wince\wince.h" + #else #include "unix.h" Index: ssh.c =================================================================== --- ssh.c (revision 6638) +++ ssh.c (working copy) @@ -1676,7 +1676,7 @@ { struct Packet *pkt = ssh_new_packet(); pkt->length = 4 + 8; /* space for length + max padding */ - ssh_pkt_addbyte(pkt, pkt_type); + ssh_pkt_addbyte(pkt, (unsigned char)pkt_type); pkt->body = pkt->data + pkt->length; return pkt; } @@ -4553,7 +4553,7 @@ /* Data for an agent message. Buffer it. */ while (len > 0) { if (c->u.a.lensofar < 4) { - unsigned int l = min(4 - c->u.a.lensofar, len); + unsigned int l = min((int)(4 - c->u.a.lensofar), len); memcpy(c->u.a.msglen + c->u.a.lensofar, p, l); p += l; @@ -4569,7 +4569,7 @@ } if (c->u.a.lensofar >= 4 && len > 0) { unsigned int l = - min(c->u.a.totallen - c->u.a.lensofar, + min((int)(c->u.a.totallen - c->u.a.lensofar), len); memcpy(c->u.a.message + c->u.a.lensofar, p, l); @@ -4630,8 +4630,8 @@ arg = ssh_tty_parse_boolean(val); break; } - ssh2_pkt_addbyte(pktout, ssh_ttymodes[i].opcode); - ssh2_pkt_addbyte(pktout, arg); + ssh2_pkt_addbyte(pktout, (unsigned char)ssh_ttymodes[i].opcode); + ssh2_pkt_addbyte(pktout, (unsigned char)arg); } @@ -5990,7 +5990,7 @@ case CHAN_AGENT: while (length > 0) { if (c->u.a.lensofar < 4) { - unsigned int l = min(4 - c->u.a.lensofar, length); + unsigned int l = min((int)(4 - c->u.a.lensofar), length); memcpy(c->u.a.msglen + c->u.a.lensofar, data, l); data += l; @@ -6006,7 +6006,7 @@ } if (c->u.a.lensofar >= 4 && length > 0) { unsigned int l = - min(c->u.a.totallen - c->u.a.lensofar, + min((int)(c->u.a.totallen - c->u.a.lensofar), length); memcpy(c->u.a.message + c->u.a.lensofar, data, l); @@ -6490,7 +6490,7 @@ arg = ssh_tty_parse_boolean(val); break; } - ssh2_pkt_addbyte(pktout, ssh_ttymodes[i].opcode); + ssh2_pkt_addbyte(pktout, (unsigned char)ssh_ttymodes[i].opcode); ssh2_pkt_adduint32(pktout, arg); } Index: sshaes.c =================================================================== --- sshaes.c (revision 6638) +++ sshaes.c (working copy) @@ -660,17 +660,17 @@ block[2]^=*keysched++, block[3]^=*keysched++, \ block[4]^=*keysched++, block[5]^=*keysched++, \ block[6]^=*keysched++, block[7]^=*keysched++) -#define MOVEWORD(i) ( block[i] = newstate[i] ) +#define AES_MOVEWORD(i) ( block[i] = newstate[i] ) /* * Macros for the encryption routine. There are three encryption * cores, for Nb=4,6,8. */ -#define MAKEWORD(i) ( newstate[i] = (E0[(block[i] >> 24) & 0xFF] ^ \ +#define AES_MAKEWORD(i) ( newstate[i] = (E0[(block[i] >> 24) & 0xFF] ^ \ E1[(block[(i+C1)%Nb] >> 16) & 0xFF] ^ \ E2[(block[(i+C2)%Nb] >> 8) & 0xFF] ^ \ E3[block[(i+C3)%Nb] & 0xFF]) ) -#define LASTWORD(i) ( newstate[i] = (Sbox[(block[i] >> 24) & 0xFF] << 24) | \ +#define AES_LASTWORD(i) ( newstate[i] = (Sbox[(block[i] >> 24) & 0xFF] << 24) | \ (Sbox[(block[(i+C1)%Nb] >> 16) & 0xFF] << 16) | \ (Sbox[(block[(i+C2)%Nb] >> 8) & 0xFF] << 8) | \ (Sbox[(block[(i+C3)%Nb] ) & 0xFF] ) ) @@ -687,24 +687,24 @@ word32 newstate[4]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_4; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); } ADD_ROUND_KEY_4; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); ADD_ROUND_KEY_4; } static void aes_encrypt_nb_6(AESContext * ctx, word32 * block) @@ -715,32 +715,32 @@ word32 newstate[6]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_6; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MAKEWORD(4); - MAKEWORD(5); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MAKEWORD(4); + AES_MAKEWORD(5); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); } ADD_ROUND_KEY_6; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - LASTWORD(4); - LASTWORD(5); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_LASTWORD(4); + AES_LASTWORD(5); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); ADD_ROUND_KEY_6; } static void aes_encrypt_nb_8(AESContext * ctx, word32 * block) @@ -751,55 +751,55 @@ word32 newstate[8]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_8; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MAKEWORD(4); - MAKEWORD(5); - MAKEWORD(6); - MAKEWORD(7); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); - MOVEWORD(6); - MOVEWORD(7); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MAKEWORD(4); + AES_MAKEWORD(5); + AES_MAKEWORD(6); + AES_MAKEWORD(7); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); + AES_MOVEWORD(6); + AES_MOVEWORD(7); } ADD_ROUND_KEY_8; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - LASTWORD(4); - LASTWORD(5); - LASTWORD(6); - LASTWORD(7); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); - MOVEWORD(6); - MOVEWORD(7); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_LASTWORD(4); + AES_LASTWORD(5); + AES_LASTWORD(6); + AES_LASTWORD(7); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); + AES_MOVEWORD(6); + AES_MOVEWORD(7); ADD_ROUND_KEY_8; } -#undef MAKEWORD -#undef LASTWORD +#undef AES_MAKEWORD +#undef AES_LASTWORD /* * Macros for the decryption routine. There are three decryption * cores, for Nb=4,6,8. */ -#define MAKEWORD(i) ( newstate[i] = (D0[(block[i] >> 24) & 0xFF] ^ \ +#define AES_MAKEWORD(i) ( newstate[i] = (D0[(block[i] >> 24) & 0xFF] ^ \ D1[(block[(i+C1)%Nb] >> 16) & 0xFF] ^ \ D2[(block[(i+C2)%Nb] >> 8) & 0xFF] ^ \ D3[block[(i+C3)%Nb] & 0xFF]) ) -#define LASTWORD(i) (newstate[i] = (Sboxinv[(block[i] >> 24) & 0xFF] << 24) | \ +#define AES_LASTWORD(i) (newstate[i] = (Sboxinv[(block[i] >> 24) & 0xFF] << 24) | \ (Sboxinv[(block[(i+C1)%Nb] >> 16) & 0xFF] << 16) | \ (Sboxinv[(block[(i+C2)%Nb] >> 8) & 0xFF] << 8) | \ (Sboxinv[(block[(i+C3)%Nb] ) & 0xFF] ) ) @@ -816,24 +816,24 @@ word32 newstate[4]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_4; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); } ADD_ROUND_KEY_4; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); ADD_ROUND_KEY_4; } static void aes_decrypt_nb_6(AESContext * ctx, word32 * block) @@ -844,32 +844,32 @@ word32 newstate[6]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_6; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MAKEWORD(4); - MAKEWORD(5); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MAKEWORD(4); + AES_MAKEWORD(5); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); } ADD_ROUND_KEY_6; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - LASTWORD(4); - LASTWORD(5); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_LASTWORD(4); + AES_LASTWORD(5); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); ADD_ROUND_KEY_6; } static void aes_decrypt_nb_8(AESContext * ctx, word32 * block) @@ -880,45 +880,45 @@ word32 newstate[8]; for (i = 0; i < ctx->Nr - 1; i++) { ADD_ROUND_KEY_8; - MAKEWORD(0); - MAKEWORD(1); - MAKEWORD(2); - MAKEWORD(3); - MAKEWORD(4); - MAKEWORD(5); - MAKEWORD(6); - MAKEWORD(7); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); - MOVEWORD(6); - MOVEWORD(7); + AES_MAKEWORD(0); + AES_MAKEWORD(1); + AES_MAKEWORD(2); + AES_MAKEWORD(3); + AES_MAKEWORD(4); + AES_MAKEWORD(5); + AES_MAKEWORD(6); + AES_MAKEWORD(7); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); + AES_MOVEWORD(6); + AES_MOVEWORD(7); } ADD_ROUND_KEY_8; - LASTWORD(0); - LASTWORD(1); - LASTWORD(2); - LASTWORD(3); - LASTWORD(4); - LASTWORD(5); - LASTWORD(6); - LASTWORD(7); - MOVEWORD(0); - MOVEWORD(1); - MOVEWORD(2); - MOVEWORD(3); - MOVEWORD(4); - MOVEWORD(5); - MOVEWORD(6); - MOVEWORD(7); + AES_LASTWORD(0); + AES_LASTWORD(1); + AES_LASTWORD(2); + AES_LASTWORD(3); + AES_LASTWORD(4); + AES_LASTWORD(5); + AES_LASTWORD(6); + AES_LASTWORD(7); + AES_MOVEWORD(0); + AES_MOVEWORD(1); + AES_MOVEWORD(2); + AES_MOVEWORD(3); + AES_MOVEWORD(4); + AES_MOVEWORD(5); + AES_MOVEWORD(6); + AES_MOVEWORD(7); ADD_ROUND_KEY_8; } -#undef MAKEWORD -#undef LASTWORD +#undef AES_MAKEWORD +#undef AES_LASTWORD /* Index: ssharcf.c =================================================================== --- ssharcf.c (revision 6638) +++ ssharcf.c (working copy) @@ -19,7 +19,7 @@ s = ctx->s; i = ctx->i; j = ctx->j; - for (k = 0; k < len; k++) { + for (k = 0; k < (unsigned int)len; k++) { i = (i + 1) & 0xff; j = (j + s[i]) & 0xff; tmp = s[i]; s[i] = s[j]; s[j] = tmp; Index: terminal.c =================================================================== --- terminal.c (revision 6638) +++ terminal.c (working copy) @@ -6377,7 +6377,7 @@ * Zero all the results, in case we abort half-way through. */ { - int i; + unsigned int i; for (i = 0; i < p->n_prompts; i++) memset(p->prompts[i]->result, 0, p->prompts[i]->result_len); } Index: tree234.c =================================================================== --- tree234.c (revision 6638) +++ tree234.c (working copy) @@ -468,7 +468,7 @@ { node234 *n; - if (!t->root) + if (!t || !t->root) return NULL; /* tree is empty */ if (index < 0 || index >= countnode234(t->root)) Index: windows/winstuff.h =================================================================== --- windows/winstuff.h (revision 6638) +++ windows/winstuff.h (working copy) @@ -15,6 +15,8 @@ #include "winhelp.h" +#define vsnprintf _vsnprintf + struct Filename { char path[FILENAME_MAX]; }; Index: x11fwd.c =================================================================== --- x11fwd.c (revision 6638) +++ x11fwd.c (working copy) @@ -485,7 +485,7 @@ char realauthdata[64]; int realauthlen = 0; int authstrlen = strlen(x11_authnames[pr->auth->realproto]); - int buflen; + int buflen = 0; static const char zeroes[4] = { 0,0,0,0 }; void *buf;