diff --git a/bn_mp_decr.c b/bn_mp_decr.c index 7e8c2ea..c6a1572 100644 --- a/bn_mp_decr.c +++ b/bn_mp_decr.c @@ -6,12 +6,12 @@ /* Decrement "a" by one like "a--". Changes input! */ mp_err mp_decr(mp_int *a) { - mp_err err = MP_OKAY; if (MP_IS_ZERO(a)) { mp_set(a,1uL); a->sign = MP_NEG; return MP_OKAY; } else if (a->sign == MP_NEG) { + mp_err err; a->sign = MP_ZPOS; if ((err = mp_incr(a)) != MP_OKAY) { return err; diff --git a/bn_mp_incr.c b/bn_mp_incr.c index d72a5b4..5d0039e 100644 --- a/bn_mp_incr.c +++ b/bn_mp_incr.c @@ -6,11 +6,11 @@ /* Increment "a" by one like "a++". Changes input! */ mp_err mp_incr(mp_int *a) { - mp_err err = MP_OKAY; if (MP_IS_ZERO(a)) { mp_set(a,1uL); return MP_OKAY; } else if (a->sign == MP_NEG) { + mp_err err; a->sign = MP_ZPOS; if ((err = mp_decr(a)) != MP_OKAY) { return err; diff --git a/bn_mp_kronecker.c b/bn_mp_kronecker.c index f6b33cd..8245e84 100644 --- a/bn_mp_kronecker.c +++ b/bn_mp_kronecker.c @@ -20,7 +20,7 @@ mp_err mp_kronecker(const mp_int *a, const mp_int *p, int *c) { mp_int a1, p1, r; - mp_err err = MP_OKAY; + mp_err err; int v, k; static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1}; @@ -28,16 +28,15 @@ mp_err mp_kronecker(const mp_int *a, const mp_int *p, int *c) if (MP_IS_ZERO(p)) { if ((a->used == 1) && (a->dp[0] == 1u)) { *c = 1; - return err; } else { *c = 0; - return err; } + return MP_OKAY; } if (MP_IS_EVEN(a) && MP_IS_EVEN(p)) { *c = 0; - return err; + return MP_OKAY; } if ((err = mp_init_copy(&a1, a)) != MP_OKAY) {