/src/dropbear/libtommath/bn_mp_clear.c
Line | Count | Source |
1 | | #include "tommath_private.h" |
2 | | #ifdef BN_MP_CLEAR_C |
3 | | /* LibTomMath, multiple-precision integer library -- Tom St Denis */ |
4 | | /* SPDX-License-Identifier: Unlicense */ |
5 | | |
6 | | /* clear one (frees) */ |
7 | | void mp_clear(mp_int *a) |
8 | 54.5k | { |
9 | | /* only do anything if a hasn't been freed previously */ |
10 | 54.5k | if (a->dp != NULL) { |
11 | | /* free ram */ |
12 | 54.5k | MP_FREE_DIGITS(a->dp, a->alloc); |
13 | | |
14 | | /* reset members to make debugging easier */ |
15 | 54.5k | a->dp = NULL; |
16 | 54.5k | a->alloc = a->used = 0; |
17 | 54.5k | a->sign = MP_ZPOS; |
18 | 54.5k | } |
19 | 54.5k | } |
20 | | #endif |