Remove warnings

This commit is contained in:
Zhi Guan
2024-05-23 16:28:54 +08:00
parent 31dafbc65d
commit adc181fa91
3 changed files with 5 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ void sm2_z256_rshift(sm2_z256_t r, const sm2_z256_t a, unsigned int nbits);
uint64_t sm2_z256_add(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
uint64_t sm2_z256_sub(sm2_z256_t r, const sm2_z256_t a, const sm2_z256_t b);
void sm2_z256_mul(sm2_z512_t r, const sm2_z256_t a, const sm2_z256_t b);
uint64_t sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i);
int sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i);
void sm2_z256_from_hex(sm2_z256_t r, const char *hex);
int sm2_z256_equ_hex(const sm2_z256_t a, const char *hex);
int sm2_z256_print(FILE *fp, int ind, int fmt, const char *label, const sm2_z256_t a);

View File

@@ -331,7 +331,7 @@ static uint64_t sm2_z512_add(sm2_z512_t r, const sm2_z512_t a, const sm2_z512_t
return c;
}
uint64_t sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i)
int sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i)
{
uint64_t mask = (1 << window_size) - 1;
uint64_t wbits;
@@ -346,10 +346,10 @@ uint64_t sm2_z256_get_booth(const sm2_z256_t a, unsigned int window_size, int i)
j = j % 64;
wbits = a[n] >> j;
if ((64 - j) < (window_size + 1) && n < 3) {
if ((64 - j) < (int)(window_size + 1) && n < 3) {
wbits |= a[n + 1] << (64 - j);
}
return (wbits & mask) - ((wbits >> 1) & mask);
return (int)(wbits & mask) - (int)((wbits >> 1) & mask);
}
void sm2_z256_from_hex(sm2_z256_t r, const char *hex)
@@ -1459,11 +1459,8 @@ void sm2_z256_point_mul(SM2_Z256_POINT *R, const sm2_z256_t k, const SM2_Z256_PO
int sm2_z256_point_print(FILE *fp, int fmt, int ind, const char *label, const SM2_Z256_POINT *P)
{
sm2_z256_t x;
sm2_z256_t y;
uint8_t affine[64];
if (sm2_z256_point_is_at_infinity(P) == 1) {
format_print(fp, fmt, ind, "%s: point_at_infinity\n", label);
} else {

View File

@@ -385,7 +385,7 @@ void sm9_z256_to_hex(const sm9_z256_t r, char hex[64])
{
int i;
for (i = 3; i >= 0; i--) {
(void)sprintf(hex + 16*(3-i), "%016llx", r[i]);
(void)sprintf(hex + 16*(3-i), "%016lx", r[i]);
}
}