Skip to content

Commit

Permalink
Remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
guanzhi committed May 23, 2024
1 parent 31dafbc commit adc181f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/gmssl/sm2_z256.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 3 additions & 6 deletions src/sm2_z256.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/sm9_z256.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down

0 comments on commit adc181f

Please sign in to comment.