Skip to content

Commit 8c79baa

Browse files
committed
initialize values used by unsigned bin
1 parent bdc1f89 commit 8c79baa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wolfcrypt/src/sp_int.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18066,6 +18066,7 @@ int sp_read_unsigned_bin(sp_int* a, const byte* in, word32 inSz)
1806618066
/* Load full digits at a time from in. */
1806718067
int i;
1806818068
int j = 0;
18069+
int k;
1806918070

1807018071
a->used = (sp_size_t)((inSz + SP_WORD_SIZEOF - 1) / SP_WORD_SIZEOF);
1807118072

@@ -18077,6 +18078,9 @@ int sp_read_unsigned_bin(sp_int* a, const byte* in, word32 inSz)
1807718078
a->dp[j++] = *(sp_int_digit*)(in + i - (SP_WORD_SIZEOF - 1));
1807818079
}
1807918080
#else
18081+
for (k = 0; k < (int)a->used; k++) {
18082+
a->dp[k] = 0;
18083+
}
1808018084
/* Construct digit from required number of bytes. */
1808118085
for (i = (int)(inSz-1); i >= SP_WORD_SIZEOF - 1; i -= SP_WORD_SIZEOF) {
1808218086
a->dp[j] = ((sp_int_digit)in[i - 0] << 0)

0 commit comments

Comments
 (0)