1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
12 @file crypt_register_prng.c
13 Register a PRNG, Tom St Denis
17 Register a PRNG with the descriptor table
18 @param prng The PRNG you wish to register
19 @return value >= 0 if successfully added (or already present), -1 if unsuccessful
21 int register_prng(const struct ltc_prng_descriptor *prng)
25 LTC_ARGCHK(prng != NULL);
27 /* is it already registered? */
28 LTC_MUTEX_LOCK(<c_prng_mutex);
29 for (x = 0; x < TAB_SIZE; x++) {
30 if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
31 LTC_MUTEX_UNLOCK(<c_prng_mutex);
36 /* find a blank spot */
37 for (x = 0; x < TAB_SIZE; x++) {
38 if (prng_descriptor[x].name == NULL) {
39 XMEMCPY(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor));
40 LTC_MUTEX_UNLOCK(<c_prng_mutex);
46 LTC_MUTEX_UNLOCK(<c_prng_mutex);
50 /* ref: $Format:%D$ */
51 /* git commit: $Format:%H$ */
52 /* commit time: $Format:%ai$ */