comparison libtomcrypt/src/math/multi.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents f849a5ca2efc
children e9dba7abd939
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
3 * LibTomCrypt is a library that provides various cryptographic 3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 *
9 * Tom St Denis, [email protected], http://libtom.org
10 */ 8 */
11 #include "tomcrypt.h" 9 #include "tomcrypt.h"
12 10
13 #ifdef MPI 11 #ifdef LTC_MPI
14 #include <stdarg.h> 12 #include <stdarg.h>
15 13
16 int ltc_init_multi(void **a, ...) 14 int ltc_init_multi(void **a, ...)
17 { 15 {
18 void **cur = a; 16 void **cur = a;
30 while (np--) { 28 while (np--) {
31 mp_clear(*cur); 29 mp_clear(*cur);
32 cur = va_arg(clean_list, void**); 30 cur = va_arg(clean_list, void**);
33 } 31 }
34 va_end(clean_list); 32 va_end(clean_list);
33 va_end(args);
35 return CRYPT_MEM; 34 return CRYPT_MEM;
36 } 35 }
37 ++np; 36 ++np;
38 cur = va_arg(args, void**); 37 cur = va_arg(args, void**);
39 } 38 }
40 va_end(args); 39 va_end(args);
41 return CRYPT_OK; 40 return CRYPT_OK;
42 } 41 }
43 42
44 void ltc_deinit_multi(void *a, ...) 43 void ltc_deinit_multi(void *a, ...)
45 { 44 {
46 void *cur = a; 45 void *cur = a;
52 cur = va_arg(args, void *); 51 cur = va_arg(args, void *);
53 } 52 }
54 va_end(args); 53 va_end(args);
55 } 54 }
56 55
56 void ltc_cleanup_multi(void **a, ...)
57 {
58 void **cur = a;
59 va_list args;
60
61 va_start(args, a);
62 while (cur != NULL) {
63 if (*cur != NULL) {
64 mp_clear(*cur);
65 *cur = NULL;
66 }
67 cur = va_arg(args, void**);
68 }
69 va_end(args);
70 return;
71 }
72
57 #endif 73 #endif
58 74
59 /* $Source$ */ 75 /* ref: $Format:%D$ */
60 /* $Revision$ */ 76 /* git commit: $Format:%H$ */
61 /* $Date$ */ 77 /* commit time: $Format:%ai$ */