Merge pull request #150 from libtom/pr/conversion-related-troubles
conversion related troubles (int, size_t, ptrdiff_t ..)
This commit is contained in:
commit
6596746c5d
@ -50,7 +50,7 @@ int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outle
|
|||||||
*outlen = hash_descriptor[hash].hashsize;
|
*outlen = hash_descriptor[hash].hashsize;
|
||||||
do {
|
do {
|
||||||
x = fread(buf, 1, sizeof(buf), in);
|
x = fread(buf, 1, sizeof(buf), in);
|
||||||
if ((err = hash_descriptor[hash].process(&md, buf, x)) != CRYPT_OK) {
|
if ((err = hash_descriptor[hash].process(&md, buf, (unsigned long)x)) != CRYPT_OK) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
} while (x == sizeof(buf));
|
} while (x == sizeof(buf));
|
||||||
|
@ -35,7 +35,8 @@ int f9_file(int cipher,
|
|||||||
#ifdef LTC_NO_FILE
|
#ifdef LTC_NO_FILE
|
||||||
return CRYPT_NOP;
|
return CRYPT_NOP;
|
||||||
#else
|
#else
|
||||||
int err, x;
|
size_t x;
|
||||||
|
int err;
|
||||||
f9_state f9;
|
f9_state f9;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
unsigned char buf[512];
|
unsigned char buf[512];
|
||||||
@ -57,7 +58,7 @@ int f9_file(int cipher,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
x = fread(buf, 1, sizeof(buf), in);
|
x = fread(buf, 1, sizeof(buf), in);
|
||||||
if ((err = f9_process(&f9, buf, x)) != CRYPT_OK) {
|
if ((err = f9_process(&f9, buf, (unsigned long)x)) != CRYPT_OK) {
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ int omac_file(int cipher,
|
|||||||
#ifdef LTC_NO_FILE
|
#ifdef LTC_NO_FILE
|
||||||
return CRYPT_NOP;
|
return CRYPT_NOP;
|
||||||
#else
|
#else
|
||||||
int err, x;
|
size_t x;
|
||||||
|
int err;
|
||||||
omac_state omac;
|
omac_state omac;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
unsigned char buf[512];
|
unsigned char buf[512];
|
||||||
@ -57,7 +58,7 @@ int omac_file(int cipher,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
x = fread(buf, 1, sizeof(buf), in);
|
x = fread(buf, 1, sizeof(buf), in);
|
||||||
if ((err = omac_process(&omac, buf, x)) != CRYPT_OK) {
|
if ((err = omac_process(&omac, buf, (unsigned long)x)) != CRYPT_OK) {
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ int pmac_file(int cipher,
|
|||||||
#ifdef LTC_NO_FILE
|
#ifdef LTC_NO_FILE
|
||||||
return CRYPT_NOP;
|
return CRYPT_NOP;
|
||||||
#else
|
#else
|
||||||
int err, x;
|
size_t x;
|
||||||
|
int err;
|
||||||
pmac_state pmac;
|
pmac_state pmac;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
unsigned char buf[512];
|
unsigned char buf[512];
|
||||||
@ -58,7 +59,7 @@ int pmac_file(int cipher,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
x = fread(buf, 1, sizeof(buf), in);
|
x = fread(buf, 1, sizeof(buf), in);
|
||||||
if ((err = pmac_process(&pmac, buf, x)) != CRYPT_OK) {
|
if ((err = pmac_process(&pmac, buf, (unsigned long)x)) != CRYPT_OK) {
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ int xcbc_file(int cipher,
|
|||||||
#ifdef LTC_NO_FILE
|
#ifdef LTC_NO_FILE
|
||||||
return CRYPT_NOP;
|
return CRYPT_NOP;
|
||||||
#else
|
#else
|
||||||
int err, x;
|
size_t x;
|
||||||
|
int err;
|
||||||
xcbc_state xcbc;
|
xcbc_state xcbc;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
unsigned char buf[512];
|
unsigned char buf[512];
|
||||||
@ -57,7 +58,7 @@ int xcbc_file(int cipher,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
x = fread(buf, 1, sizeof(buf), in);
|
x = fread(buf, 1, sizeof(buf), in);
|
||||||
if ((err = xcbc_process(&xcbc, buf, x)) != CRYPT_OK) {
|
if ((err = xcbc_process(&xcbc, buf, (unsigned long)x)) != CRYPT_OK) {
|
||||||
fclose(in);
|
fclose(in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ static int _base64_encode_internal(const unsigned char *in, unsigned long inlen
|
|||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
/* return ok */
|
/* return ok */
|
||||||
*outlen = p - out;
|
*outlen = (unsigned long)(p - out);
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ int der_encode_setof(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
XMEMCPY(out, buf, hdrlen);
|
XMEMCPY(out, buf, hdrlen);
|
||||||
|
|
||||||
/* copy+sort using edges+indecies to output from buffer */
|
/* copy+sort using edges+indecies to output from buffer */
|
||||||
for (y = hdrlen, x = 0; x < inlen; x++) {
|
for (y = (unsigned long)hdrlen, x = 0; x < inlen; x++) {
|
||||||
XMEMCPY(out+y, edges[x].start, edges[x].size);
|
XMEMCPY(out+y, edges[x].start, edges[x].size);
|
||||||
y += edges[x].size;
|
y += edges[x].size;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user