2019-09-16 13:50:38 +00:00
|
|
|
#include "tommath_private.h"
|
2006-03-08 13:16:18 +00:00
|
|
|
#ifdef BN_MP_CLEAR_C
|
2020-05-26 15:36:47 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
2006-03-08 13:16:18 +00:00
|
|
|
|
|
|
|
/* clear one (frees) */
|
2019-09-16 13:50:38 +00:00
|
|
|
void mp_clear(mp_int *a)
|
2006-03-08 13:16:18 +00:00
|
|
|
{
|
2019-09-16 13:50:38 +00:00
|
|
|
/* only do anything if a hasn't been freed previously */
|
|
|
|
if (a->dp != NULL) {
|
|
|
|
/* free ram */
|
2020-05-26 15:36:47 +00:00
|
|
|
MP_FREE_DIGITS(a->dp, a->alloc);
|
2006-03-08 13:16:18 +00:00
|
|
|
|
2019-09-16 13:50:38 +00:00
|
|
|
/* reset members to make debugging easier */
|
|
|
|
a->dp = NULL;
|
|
|
|
a->alloc = a->used = 0;
|
|
|
|
a->sign = MP_ZPOS;
|
|
|
|
}
|
2006-03-08 13:16:18 +00:00
|
|
|
}
|
|
|
|
#endif
|