ARM Shanghai IoT Team (Internal) / newMiniTLS-GPL

Fork of MiniTLS-GPL by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ltc_multi.c Source File

ltc_multi.c

00001 /*
00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices
00003 Author: Donatien Garnier
00004 Copyright (C) 2013-2014 AppNearMe Ltd
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 *//* LibTomCrypt, modular cryptographic library -- Tom St Denis
00020  *
00021  * LibTomCrypt is a library that provides various cryptographic
00022  * algorithms in a highly modular and flexible manner.
00023  *
00024  * The library is free for all purposes without any express
00025  * guarantee it works.
00026  *
00027  * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
00028  */
00029 #include "ltc.h"
00030 
00031 #ifdef MPI
00032 #include "stdarg.h"
00033 
00034 
00035 int ltc_init_multi(void *a, ...)
00036 {
00037    void*     cur = a;
00038    int       np  = 0;
00039    va_list   args;
00040 
00041    va_start(args, a);
00042    while (cur != NULL) {
00043        /*if (*/mp_init(cur);/* != MINITLS_OK) {*/
00044           /* failed */
00045           /*va_list clean_list;
00046 
00047           va_start(clean_list, a);
00048           cur = a;
00049           while (np--) {
00050               mp_clear(cur);
00051               cur = va_arg(clean_list, void*);
00052           }
00053           va_end(clean_list);
00054           return MINITLS_ERR_MEMORY;
00055        }*/
00056        ++np;
00057        cur = va_arg(args, void*);
00058    }
00059    va_end(args);
00060    return MINITLS_OK;
00061 }
00062 
00063 void ltc_deinit_multi(void *a, ...)
00064 {
00065    void     *cur = a;
00066    va_list   args;
00067 
00068    va_start(args, a);
00069    while (cur != NULL) {
00070        mp_clear(cur);
00071        cur = va_arg(args, void *);
00072    }
00073    va_end(args);
00074 }
00075 
00076 #endif
00077 
00078 /* $Source: /cvs/libtom/libtomcrypt/src/math/multi.c,v $ */
00079 /* $Revision: 1.6 $ */
00080 /* $Date: 2006/12/28 01:27:23 $ */