diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2015-08-17 11:22:29 -0700 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2015-08-17 11:22:29 -0700 |
commit | edfddd7b86ae3cc6b1b2440216d4b83cdd9f321b (patch) | |
tree | 243150dab7af42c35c08dd056ee854bad24a1bdd /lib/freebl/mpi/mpi.c | |
parent | 03d2e2d3d9d618778194c3759dee4bc625310f55 (diff) | |
download | nss-hg-edfddd7b86ae3cc6b1b2440216d4b83cdd9f321b.tar.gz |
Bug 1182667 - Enable warnings as errors, r=rrelyea
Diffstat (limited to 'lib/freebl/mpi/mpi.c')
-rw-r--r-- | lib/freebl/mpi/mpi.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/freebl/mpi/mpi.c b/lib/freebl/mpi/mpi.c index 2a3719b88..43ce83ae6 100644 --- a/lib/freebl/mpi/mpi.c +++ b/lib/freebl/mpi/mpi.c @@ -1095,7 +1095,7 @@ mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c) mp_int s, x; mp_err res; mp_digit d; - int dig, bit; + unsigned int dig, bit; ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); @@ -1470,7 +1470,7 @@ mp_err s_mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *m, mp_int *c mp_int s, x, mu; mp_err res; mp_digit d; - int dig, bit; + unsigned int dig, bit; ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); @@ -2004,7 +2004,7 @@ mp_size mp_trailing_zeros(const mp_int *mp) { mp_digit d; mp_size n = 0; - int ix; + unsigned int ix; if (!mp || !MP_DIGITS(mp) || !mp_cmp_z(mp)) return n; @@ -2916,8 +2916,7 @@ void s_mp_exch(mp_int *a, mp_int *b) mp_err s_mp_lshd(mp_int *mp, mp_size p) { mp_err res; - mp_size pos; - int ix; + unsigned int ix; if(p == 0) return MP_OKAY; @@ -2928,14 +2927,13 @@ mp_err s_mp_lshd(mp_int *mp, mp_size p) if((res = s_mp_pad(mp, USED(mp) + p)) != MP_OKAY) return res; - pos = USED(mp) - 1; - /* Shift all the significant figures over as needed */ - for(ix = pos - p; ix >= 0; ix--) + for (ix = USED(mp) - p; ix-- > 0;) { DIGIT(mp, ix + p) = DIGIT(mp, ix); + } /* Fill the bottom digits with zeroes */ - for(ix = 0; ix < p; ix++) + for(ix = 0; (mp_size)ix < p; ix++) DIGIT(mp, ix) = 0; return MP_OKAY; @@ -3046,7 +3044,7 @@ void s_mp_div_2(mp_int *mp) mp_err s_mp_mul_2(mp_int *mp) { mp_digit *pd; - int ix, used; + unsigned int ix, used; mp_digit kin = 0; /* Shift digits leftward by 1 bit */ @@ -4672,10 +4670,10 @@ mp_read_unsigned_octets(mp_int *mp, const unsigned char *str, mp_size len) /* }}} */ /* {{{ mp_unsigned_octet_size(mp) */ -int +unsigned int mp_unsigned_octet_size(const mp_int *mp) { - int bytes; + unsigned int bytes; int ix; mp_digit d = 0; @@ -4712,12 +4710,12 @@ mp_err mp_to_unsigned_octets(const mp_int *mp, unsigned char *str, mp_size maxlen) { int ix, pos = 0; - int bytes; + unsigned int bytes; ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); bytes = mp_unsigned_octet_size(mp); - ARGCHK(bytes >= 0 && bytes <= maxlen, MP_BADARG); + ARGCHK(bytes <= maxlen, MP_BADARG); /* Iterate over each digit... */ for(ix = USED(mp) - 1; ix >= 0; ix--) { @@ -4744,12 +4742,12 @@ mp_err mp_to_signed_octets(const mp_int *mp, unsigned char *str, mp_size maxlen) { int ix, pos = 0; - int bytes; + unsigned int bytes; ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); bytes = mp_unsigned_octet_size(mp); - ARGCHK(bytes >= 0 && bytes <= maxlen, MP_BADARG); + ARGCHK(bytes <= maxlen, MP_BADARG); /* Iterate over each digit... */ for(ix = USED(mp) - 1; ix >= 0; ix--) { @@ -4784,12 +4782,12 @@ mp_err mp_to_fixlen_octets(const mp_int *mp, unsigned char *str, mp_size length) { int ix, pos = 0; - int bytes; + unsigned int bytes; ARGCHK(mp != NULL && str != NULL && !SIGN(mp), MP_BADARG); bytes = mp_unsigned_octet_size(mp); - ARGCHK(bytes >= 0 && bytes <= length, MP_BADARG); + ARGCHK(bytes <= length, MP_BADARG); /* place any needed leading zeros */ for (;length > bytes; --length) { |