forked from wolfSSL/wolfssl
Fix for fp_copy() when used with ALT_ECC_SIZE so any excess digits on the destination that we didn't write to are set to zero.
This commit is contained in:
@ -2177,13 +2177,20 @@ int mp_div_2d(fp_int* a, int b, fp_int* c, fp_int* d)
|
||||
}
|
||||
|
||||
#ifdef ALT_ECC_SIZE
|
||||
void fp_copy(fp_int *a, fp_int* b)
|
||||
void fp_copy(fp_int *a, fp_int *b)
|
||||
{
|
||||
if (a != b && b->size >= a->used) {
|
||||
int x, oldused;
|
||||
oldused = b->used;
|
||||
b->used = a->used;
|
||||
b->sign = a->sign;
|
||||
|
||||
XMEMCPY(b->dp, a->dp, a->used * sizeof(fp_digit));
|
||||
|
||||
/* zero any excess digits on the destination that we didn't write to */
|
||||
for (x = b->used; x < oldused; x++) {
|
||||
b->dp[x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user