diff libtommath/bn_mp_clear.c @ 1281:eebff2079bdc

use m_burn for mp_clear
author Matt Johnston <matt@ucc.asn.au>
date Thu, 17 Mar 2016 00:06:26 +0800
parents 5ff8218bcee9
children 3017bc7d6238
line wrap: on
line diff
--- a/libtommath/bn_mp_clear.c	Wed Mar 16 23:39:39 2016 +0800
+++ b/libtommath/bn_mp_clear.c	Thu Mar 17 00:06:26 2016 +0800
@@ -1,4 +1,5 @@
 #include <tommath.h>
+#include "dbutil.h"
 #ifdef BN_MP_CLEAR_C
 /* LibTomMath, multiple-precision integer library -- Tom St Denis
  *
@@ -19,17 +20,10 @@
 void
 mp_clear (mp_int * a)
 {
-  volatile mp_digit *p;
-  int len;
-
   /* only do anything if a hasn't been freed previously */
   if (a->dp != NULL) {
     /* first zero the digits */
-	len = a->alloc;
-	p = a->dp;
-	while (len--) {
-		*p++ = 0;
-	}
+	m_burn(a->dp, a->alloc * sizeof(*a->dp));
 
     /* free ram */
     XFREE(a->dp);