diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index d701cfcd8..21ae2353a 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -4425,9 +4425,6 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) * /* old number of used digits in c */ oldused = c->used; - /* sign always positive */ - c->sign = MP_ZPOS; - /* source alias */ tmpa = a->dp; @@ -4478,6 +4475,9 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) * ix = 1; } + /* sign always positive */ + c->sign = MP_ZPOS; + /* now zero to oldused */ while (ix++ < oldused) { *tmpc++ = 0;