Home | History | Annotate | Download | only in crypt
      1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
      2  *
      3  * LibTomCrypt is a library that provides various cryptographic
      4  * algorithms in a highly modular and flexible manner.
      5  *
      6  * The library is free for all purposes without any express
      7  * guarantee it works.
      8  *
      9  * Tom St Denis, tomstdenis (at) gmail.com, http://libtomcrypt.com
     10  */
     11 #include "tomcrypt.h"
     12 #include <stdarg.h>
     13 
     14 /**
     15   @file crypt_fsa.c
     16   LibTomCrypt FULL SPEED AHEAD!, Tom St Denis
     17 */
     18 
     19 /* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
     20 int crypt_fsa(void *mp, ...)
     21 {
     22    int      err;
     23    va_list  args;
     24    void     *p;
     25 
     26    va_start(args, mp);
     27    if (mp != NULL) {
     28       XMEMCPY(&ltc_mp, mp, sizeof(ltc_mp));
     29    }
     30 
     31    while ((p = va_arg(args, void*)) != NULL) {
     32       if ((err = register_cipher(p)) != CRYPT_OK) {
     33          va_end(args);
     34          return err;
     35       }
     36    }
     37 
     38    while ((p = va_arg(args, void*)) != NULL) {
     39       if ((err = register_hash(p)) != CRYPT_OK) {
     40          va_end(args);
     41          return err;
     42       }
     43    }
     44 
     45    while ((p = va_arg(args, void*)) != NULL) {
     46       if ((err = register_prng(p)) != CRYPT_OK) {
     47          va_end(args);
     48          return err;
     49       }
     50    }
     51 
     52    va_end(args);
     53    return CRYPT_OK;
     54 }
     55 
     56 
     57 /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_fsa.c,v $ */
     58 /* $Revision: 1.4 $ */
     59 /* $Date: 2006/11/13 23:14:33 $ */
     60