forked from wolfSSL/wolfssl
Fix for integer.c s_mp_add
output to make sure it grows if not set.
This commit is contained in:
@@ -1713,7 +1713,7 @@ int s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* init result */
|
/* init result */
|
||||||
if (c->alloc < max_ab + 1) {
|
if (c->dp == NULL || c->alloc < max_ab + 1) {
|
||||||
if ((res = mp_grow (c, max_ab + 1)) != MP_OKAY) {
|
if ((res = mp_grow (c, max_ab + 1)) != MP_OKAY) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1757,7 +1757,7 @@ int s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
|||||||
if (min_ab != max_ab) {
|
if (min_ab != max_ab) {
|
||||||
for (; i < max_ab; i++) {
|
for (; i < max_ab; i++) {
|
||||||
/* T[i] = X[i] + U */
|
/* T[i] = X[i] + U */
|
||||||
*tmpc = x->dp[i] + u; // NOLINT(clang-analyzer-core.NullDereference) /* clang-tidy 13 false positive */
|
*tmpc = x->dp[i] + u;
|
||||||
|
|
||||||
/* U = carry bit of T[i] */
|
/* U = carry bit of T[i] */
|
||||||
u = *tmpc >> ((mp_digit)DIGIT_BIT);
|
u = *tmpc >> ((mp_digit)DIGIT_BIT);
|
||||||
|
Reference in New Issue
Block a user