Mercurial > dropbear
comparison libtommath/bn_mp_clear.c @ 1655:f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
* make key-generation compliant to FIPS 186.4
* fix includes in tommath_class.h
* update fuzzcorpus instead of error-out
* fixup fuzzing make-targets
* update Makefile.in
* apply necessary patches to ltm sources
* clean-up not required ltm files
* update to vanilla ltm 1.1.0
this already only contains the required files
* remove set/get double
author | Steffen Jaeckel <s_jaeckel@gmx.de> |
---|---|
date | Mon, 16 Sep 2019 15:50:38 +0200 |
parents | 8bba51a55704 |
children | 1051e4eea25a |
comparison
equal
deleted
inserted
replaced
1654:cc0fc5131c5c | 1655:f52919ffd3b1 |
---|---|
1 #include <tommath_private.h> | 1 #include "tommath_private.h" |
2 #include "dbhelpers.h" | 2 #include "dbhelpers.h" |
3 #ifdef BN_MP_CLEAR_C | 3 #ifdef BN_MP_CLEAR_C |
4 /* LibTomMath, multiple-precision integer library -- Tom St Denis | 4 /* LibTomMath, multiple-precision integer library -- Tom St Denis |
5 * | 5 * |
6 * LibTomMath is a library that provides multiple-precision | 6 * LibTomMath is a library that provides multiple-precision |
8 * | 8 * |
9 * The library was designed directly after the MPI library by | 9 * The library was designed directly after the MPI library by |
10 * Michael Fromberger but has been written from scratch with | 10 * Michael Fromberger but has been written from scratch with |
11 * additional optimizations in place. | 11 * additional optimizations in place. |
12 * | 12 * |
13 * The library is free for all purposes without any express | 13 * SPDX-License-Identifier: Unlicense |
14 * guarantee it works. | |
15 * | |
16 * Tom St Denis, [email protected], http://libtom.org | |
17 */ | 14 */ |
18 | 15 |
19 /* clear one (frees) */ | 16 /* clear one (frees) */ |
20 void | 17 void mp_clear(mp_int *a) |
21 mp_clear (mp_int * a) | |
22 { | 18 { |
23 /* only do anything if a hasn't been freed previously */ | 19 /* only do anything if a hasn't been freed previously */ |
24 if (a->dp != NULL) { | 20 if (a->dp != NULL) { |
25 /* first zero the digits */ | 21 /* first zero the digits */ |
26 m_burn(a->dp, a->alloc * sizeof(*a->dp)); | 22 m_burn(a->dp, (size_t)a->alloc * sizeof(*a->dp)); |
27 | 23 |
28 /* free ram */ | 24 /* free ram */ |
29 XFREE(a->dp); | 25 XFREE(a->dp); |
30 | 26 |
31 /* reset members to make debugging easier */ | 27 /* reset members to make debugging easier */ |
32 a->dp = NULL; | 28 a->dp = NULL; |
33 a->alloc = a->used = 0; | 29 a->alloc = a->used = 0; |
34 a->sign = MP_ZPOS; | 30 a->sign = MP_ZPOS; |
35 } | 31 } |
36 } | 32 } |
37 #endif | 33 #endif |
38 | 34 |
39 /* ref: $Format:%D$ */ | 35 /* ref: HEAD -> master, tag: v1.1.0 */ |
40 /* git commit: $Format:%H$ */ | 36 /* git commit: 08549ad6bc8b0cede0b357a9c341c5c6473a9c55 */ |
41 /* commit time: $Format:%ai$ */ | 37 /* commit time: 2019-01-28 20:32:32 +0100 */ |