summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/math/multi.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-17 19:29:51 +0800
commit7e8094d53a1c01ac671156ff2e67157b64d01a3a (patch)
treec88345f5bdd118eb9414dff5ab5c307bb1806c57 /libtomcrypt/src/math/multi.c
parentf7a664f127d3dfde0e7c7a9ca74b1d14f9a2f983 (diff)
parentf042eb41ab0d31f8ba0c5ccc9c848ad01f08f986 (diff)
merge from main
--HG-- branch : fuzz
Diffstat (limited to 'libtomcrypt/src/math/multi.c')
-rw-r--r--libtomcrypt/src/math/multi.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/libtomcrypt/src/math/multi.c b/libtomcrypt/src/math/multi.c
index 593f353..da5bb60 100644
--- a/libtomcrypt/src/math/multi.c
+++ b/libtomcrypt/src/math/multi.c
@@ -5,12 +5,10 @@
*
* The library is free for all purposes without any express
* guarantee it works.
- *
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
-#ifdef MPI
+#ifdef LTC_MPI
#include <stdarg.h>
int ltc_init_multi(void **a, ...)
@@ -32,13 +30,14 @@ int ltc_init_multi(void **a, ...)
cur = va_arg(clean_list, void**);
}
va_end(clean_list);
+ va_end(args);
return CRYPT_MEM;
}
++np;
cur = va_arg(args, void**);
}
va_end(args);
- return CRYPT_OK;
+ return CRYPT_OK;
}
void ltc_deinit_multi(void *a, ...)
@@ -54,8 +53,25 @@ void ltc_deinit_multi(void *a, ...)
va_end(args);
}
+void ltc_cleanup_multi(void **a, ...)
+{
+ void **cur = a;
+ va_list args;
+
+ va_start(args, a);
+ while (cur != NULL) {
+ if (*cur != NULL) {
+ mp_clear(*cur);
+ *cur = NULL;
+ }
+ cur = va_arg(args, void**);
+ }
+ va_end(args);
+ return;
+}
+
#endif
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref: $Format:%D$ */
+/* git commit: $Format:%H$ */
+/* commit time: $Format:%ai$ */