Commit 59b0174a authored by Matt Johnston's avatar Matt Johnston
Browse files

make pointers volatile so that memory zeroing won't get optimised away

--HG--
branch : libtommath
extra : convert_revision : e0186764b7d023da96c6f248b0378af701d3c7c4
parent dd32d7d8
......@@ -19,14 +19,17 @@
void
mp_clear (mp_int * a)
{
int i;
volatile mp_digit *p;
int len;
/* only do anything if a hasn't been freed previously */
if (a->dp != NULL) {
/* first zero the digits */
for (i = 0; i < a->used; i++) {
a->dp[i] = 0;
}
len = a->alloc;
p = a->dp;
while (len--) {
*p++ = 0;
}
/* free ram */
XFREE(a->dp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment