mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Fix various trivial compiler warnings
[originally from svn r983]
This commit is contained in:
parent
aaeecbb4ea
commit
6b58ab6ad4
7
sftp.c
7
sftp.c
@ -99,7 +99,7 @@ static void sftp_pkt_addstring(struct sftp_packet *pkt, char *data) {
|
||||
*/
|
||||
|
||||
static unsigned char sftp_pkt_getbyte(struct sftp_packet *pkt) {
|
||||
unsigned long value;
|
||||
unsigned char value;
|
||||
if (pkt->length - pkt->savedpos < 1)
|
||||
return 0; /* arrgh, no way to decline (FIXME?) */
|
||||
value = (unsigned char) pkt->data[pkt->savedpos];
|
||||
@ -182,7 +182,6 @@ int sftp_send(struct sftp_packet *pkt) {
|
||||
struct sftp_packet *sftp_recv(void) {
|
||||
struct sftp_packet *pkt;
|
||||
char x[4];
|
||||
int p, ret;
|
||||
|
||||
if (!sftp_recvdata(x, 4))
|
||||
return NULL;
|
||||
@ -372,7 +371,6 @@ struct fxp_handle *fxp_open(char *path, int type) {
|
||||
return NULL;
|
||||
}
|
||||
if (pktin->type == SSH_FXP_HANDLE) {
|
||||
int count;
|
||||
char *hstring;
|
||||
struct fxp_handle *handle;
|
||||
int len;
|
||||
@ -411,7 +409,6 @@ struct fxp_handle *fxp_opendir(char *path) {
|
||||
return NULL;
|
||||
}
|
||||
if (pktin->type == SSH_FXP_HANDLE) {
|
||||
int count;
|
||||
char *hstring;
|
||||
struct fxp_handle *handle;
|
||||
int len;
|
||||
@ -557,7 +554,7 @@ int fxp_write(struct fxp_handle *handle, char *buffer, uint64 offset, int len) {
|
||||
id = sftp_pkt_getuint32(pktin);
|
||||
if (id != 0xDCB) {
|
||||
fxp_internal_error("request ID mismatch\n");
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
fxp_got_status(pktin);
|
||||
return fxp_errtype == SSH_FX_OK;
|
||||
|
@ -591,7 +591,6 @@ struct ssh2_userkey *ssh2_load_userkey(char *filename, char *passphrase) {
|
||||
{
|
||||
char realhash[41];
|
||||
unsigned char binary[20];
|
||||
SHA_State s;
|
||||
|
||||
SHA_Simple(private_blob, private_blob_len, binary);
|
||||
for (i = 0; i < 20; i++)
|
||||
@ -634,7 +633,6 @@ char *ssh2_userkey_loadpub(char *filename, char **algorithm, int *pub_blob_len)
|
||||
FILE *fp;
|
||||
char header[40], *b;
|
||||
const struct ssh_signkey *alg;
|
||||
int cipher, cipherblk;
|
||||
unsigned char *public_blob;
|
||||
int public_blob_len;
|
||||
int i;
|
||||
|
12
sshrsa.c
12
sshrsa.c
@ -310,8 +310,6 @@ static void *rsa2_createkey(unsigned char *pub_blob, int pub_len,
|
||||
static void *rsa2_openssh_createkey(unsigned char **blob, int *len) {
|
||||
char **b = (char **)blob;
|
||||
struct RSAKey *rsa;
|
||||
char *p;
|
||||
int slen;
|
||||
|
||||
rsa = smalloc(sizeof(struct RSAKey));
|
||||
if (!rsa) return NULL;
|
||||
@ -392,6 +390,8 @@ static unsigned char asn1_weird_stuff[] = {
|
||||
0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14,
|
||||
};
|
||||
|
||||
#define ASN1_LEN ( (int) sizeof(asn1_weird_stuff) )
|
||||
|
||||
static int rsa2_verifysig(void *key, char *sig, int siglen,
|
||||
char *data, int datalen) {
|
||||
struct RSAKey *rsa = (struct RSAKey *)key;
|
||||
@ -419,12 +419,12 @@ static int rsa2_verifysig(void *key, char *sig, int siglen,
|
||||
if (bignum_byte(out, bytes-2) != 1)
|
||||
ret = 0;
|
||||
/* Most of the rest should be FF. */
|
||||
for (i = bytes-3; i >= 20 + sizeof(asn1_weird_stuff); i--) {
|
||||
for (i = bytes-3; i >= 20 + ASN1_LEN; i--) {
|
||||
if (bignum_byte(out, i) != 0xFF)
|
||||
ret = 0;
|
||||
}
|
||||
/* Then we expect to see the asn1_weird_stuff. */
|
||||
for (i = 20 + sizeof(asn1_weird_stuff) - 1, j=0; i >= 20; i--,j++) {
|
||||
for (i = 20 + ASN1_LEN - 1, j=0; i >= 20; i--,j++) {
|
||||
if (bignum_byte(out, i) != asn1_weird_stuff[j])
|
||||
ret = 0;
|
||||
}
|
||||
@ -452,9 +452,9 @@ unsigned char *rsa2_sign(void *key, char *data, int datalen, int *siglen) {
|
||||
bytes = smalloc(nbytes);
|
||||
|
||||
bytes[0] = 1;
|
||||
for (i = 1; i < nbytes-20-sizeof(asn1_weird_stuff); i++)
|
||||
for (i = 1; i < nbytes-20-ASN1_LEN; i++)
|
||||
bytes[i] = 0xFF;
|
||||
for (i = nbytes-20-sizeof(asn1_weird_stuff), j=0; i < nbytes-20; i++,j++)
|
||||
for (i = nbytes-20-ASN1_LEN, j=0; i < nbytes-20; i++,j++)
|
||||
bytes[i] = asn1_weird_stuff[j];
|
||||
for (i = nbytes-20, j=0; i < nbytes; i++,j++)
|
||||
bytes[i] = hash[j];
|
||||
|
Loading…
Reference in New Issue
Block a user