diff options
author | Matt Johnston <matt@ucc.asn.au> | 2005-01-02 17:09:26 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2005-01-02 17:09:26 +0000 |
commit | 0131b96a9152eff23e165eac31d2f6d2621934c8 (patch) | |
tree | 4b15ae42be884904bdf59d506abf0f4490eddc47 | |
parent | 106861d6fd0ee1169310a1908e2b08feec8b9c56 (diff) | |
download | dropbear-0131b96a9152eff23e165eac31d2f6d2621934c8.tar.gz |
make pointers volatile so that memory zeroing won't get optimised awayLTM_DB_0.44
-rw-r--r-- | bn_mp_clear.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bn_mp_clear.c b/bn_mp_clear.c index 5342648..1dc053b 100644 --- a/bn_mp_clear.c +++ b/bn_mp_clear.c @@ -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); |