Fix varrious signed/unsigned comparisons.

This commit is contained in:
Gregory Maxwell 2014-11-12 13:45:09 -08:00
parent e9e0e21a6f
commit 65a14abb48
4 changed files with 8 additions and 8 deletions

View file

@ -80,7 +80,7 @@ static void secp256k1_ecmult_gen_start(void) {
for (int j=0; j<64; j++) {
for (int i=0; i<16; i++) {
const unsigned char* raw = (const unsigned char*)(&prec[j*16 + i]);
for (int k=0; k<sizeof(secp256k1_ge_t); k++)
for (size_t k=0; k<sizeof(secp256k1_ge_t); k++)
ret->prec[j][k][i] = raw[k];
}
}
@ -105,7 +105,7 @@ static void secp256k1_ecmult_gen(secp256k1_gej_t *r, const secp256k1_scalar_t *g
int bits;
for (int j=0; j<64; j++) {
bits = secp256k1_scalar_get_bits(gn, j * 4, 4);
for (int k=0; k<sizeof(secp256k1_ge_t); k++)
for (size_t k=0; k<sizeof(secp256k1_ge_t); k++)
((unsigned char*)(&add))[k] = c->prec[j][k][bits];
secp256k1_gej_add_ge(r, r, &add);
}

View file

@ -222,7 +222,7 @@ static void secp256k1_fe_inv_all(size_t len, secp256k1_fe_t r[len], const secp25
r[0] = a[0];
int i = 0;
size_t i = 0;
while (++i < len) {
secp256k1_fe_mul(&r[i], &r[i - 1], &a[i]);
}
@ -246,7 +246,7 @@ static void secp256k1_fe_inv_all_var(size_t len, secp256k1_fe_t r[len], const se
r[0] = a[0];
int i = 0;
size_t i = 0;
while (++i < len) {
secp256k1_fe_mul(&r[i], &r[i - 1], &a[i]);
}

View file

@ -82,9 +82,9 @@ static void secp256k1_ge_set_gej_var(secp256k1_ge_t *r, secp256k1_gej_t *a) {
}
static void secp256k1_ge_set_all_gej_var(size_t len, secp256k1_ge_t r[len], const secp256k1_gej_t a[len]) {
int count = 0;
size_t count = 0;
secp256k1_fe_t az[len];
for (int i=0; i<len; i++) {
for (size_t i=0; i<len; i++) {
if (!a[i].infinity) {
az[count++] = a[i].z;
}
@ -94,7 +94,7 @@ static void secp256k1_ge_set_all_gej_var(size_t len, secp256k1_ge_t r[len], cons
secp256k1_fe_inv_all_var(count, azi, az);
count = 0;
for (int i=0; i<len; i++) {
for (size_t i=0; i<len; i++) {
r[i].infinity = a[i].infinity;
if (!a[i].infinity) {
secp256k1_fe_t *zi = &azi[count++];

View file

@ -57,7 +57,7 @@ static void secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const sec
}
int shift = 0;
while (shift < len && tmp[shift] == 0) shift++;
VERIFY_CHECK(len-shift <= rlen);
VERIFY_CHECK(len-shift <= (int)rlen);
memset(r, 0, rlen - len + shift);
if (len > shift) {
memcpy(r + rlen - len + shift, tmp + shift, len - shift);