summaryrefslogtreecommitdiff
path: root/bn_mp_clear.c
diff options
context:
space:
mode:
Diffstat (limited to 'bn_mp_clear.c')
-rw-r--r--bn_mp_clear.c11
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);