mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
make pointers volatile so that memory zeroing won't get optimised away
--HG-- branch : libtommath extra : convert_revision : e0186764b7d023da96c6f248b0378af701d3c7c4
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user