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 #include "tomcrypt.h" 10 11 /** 12 @file crypt_find_prng.c 13 Find a PRNG, Tom St Denis 14 */ 15 16 /** 17 Find a registered PRNG by name 18 @param name The name of the PRNG to look for 19 @return >= 0 if found, -1 if not present 20 */ 21 int find_prng(const char *name) 22 { 23 int x; 24 LTC_ARGCHK(name != NULL); 25 LTC_MUTEX_LOCK(<c_prng_mutex); 26 for (x = 0; x < TAB_SIZE; x++) { 27 if ((prng_descriptor[x].name != NULL) && XSTRCMP(prng_descriptor[x].name, name) == 0) { 28 LTC_MUTEX_UNLOCK(<c_prng_mutex); 29 return x; 30 } 31 } 32 LTC_MUTEX_UNLOCK(<c_prng_mutex); 33 return -1; 34 } 35 36 37 /* ref: HEAD -> master, tag: v1.18.2 */ 38 /* git commit: 7e7eb695d581782f04b24dc444cbfde86af59853 */ 39 /* commit time: 2018-07-01 22:49:01 +0200 */ 40