Skip to content

Commit 5caa71e

Browse files
Merge pull request #7038 from SparkiDev/heapmath_mp_add_d
Heapmath mp_add_d: fix for when a and c same pointer
2 parents 9d0bb4c + 226c631 commit 5caa71e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wolfcrypt/src/integer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,9 +4425,6 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) *
44254425
/* old number of used digits in c */
44264426
oldused = c->used;
44274427

4428-
/* sign always positive */
4429-
c->sign = MP_ZPOS;
4430-
44314428
/* source alias */
44324429
tmpa = a->dp;
44334430

@@ -4478,6 +4475,9 @@ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) /* //NOLINT(misc-no-recursion) *
44784475
ix = 1;
44794476
}
44804477

4478+
/* sign always positive */
4479+
c->sign = MP_ZPOS;
4480+
44814481
/* now zero to oldused */
44824482
while (ix++ < oldused) {
44834483
*tmpc++ = 0;

0 commit comments

Comments
 (0)