The unified diff between revisions [8f758678..] and [e0186764..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'bn_mp_clear.c'
#
#
# patch "bn_mp_clear.c"
# from [246c4a2b16e20f7d0a43f1fc990c3a7f1ead9bfb]
# to [88da3976df72ea9ec9f9e4586b10bac6c7022fa2]
#
============================================================
--- bn_mp_clear.c 246c4a2b16e20f7d0a43f1fc990c3a7f1ead9bfb
+++ bn_mp_clear.c 88da3976df72ea9ec9f9e4586b10bac6c7022fa2
@@ -19,14 +19,17 @@ mp_clear (mp_int * a)
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);