Review comment in sp_int file

pull/3119/head
Tesfa Mael 2020-08-04 15:37:20 -07:00
parent d03971e233
commit 5d7649c959
1 changed files with 10 additions and 8 deletions

View File

@ -192,7 +192,7 @@ int sp_read_unsigned_bin(sp_int* a, const byte* in, word32 inSz)
int i, j = 0, k;
/* Extra digit added to SP_INT_DIGITS to be used in calculations. */
if (inSz > SP_INT_DIGITS * (int)sizeof(a->dp[0])) {
if (inSz > (SP_INT_DIGITS - 1) * (int)sizeof(a->dp[0])) {
err = MP_VAL;
}
else if (inSz == 0) {
@ -1063,8 +1063,10 @@ int sp_add_d(sp_int* a, sp_int_digit d, sp_int* r)
}
}
r->dp[0] = t;
if (r != a) {
for (++i; i < a->used; i++)
r->dp[i] = a->dp[i];
}
return MP_OKAY;
}