Skip to content

Commit

Permalink
Merge pull request #7038 from SparkiDev/heapmath_mp_add_d
Browse files Browse the repository at this point in the history
Heapmath mp_add_d: fix for when a and c same pointer
  • Loading branch information
JacobBarthelmeh authored Dec 7, 2023
2 parents 9d0bb4c + 226c631 commit 5caa71e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wolfcrypt/src/integer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5caa71e

Please sign in to comment.