1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 3 #include "tomcrypt_private.h" 4 5 /** 6 @file crypt_unregister_prng.c 7 Unregister a PRNG, Tom St Denis 8 */ 9 10 /** 11 Unregister a PRNG from the descriptor table 12 @param prng The PRNG descriptor to remove 13 @return CRYPT_OK on success 14 */ unregister_prng(const struct ltc_prng_descriptor * prng)15int unregister_prng(const struct ltc_prng_descriptor *prng) 16 { 17 int x; 18 19 LTC_ARGCHK(prng != NULL); 20 21 /* is it already registered? */ 22 LTC_MUTEX_LOCK(<c_prng_mutex); 23 for (x = 0; x < TAB_SIZE; x++) { 24 if (prng_descriptor[x] == prng) { 25 prng_descriptor[x] = NULL; 26 LTC_MUTEX_UNLOCK(<c_prng_mutex); 27 return CRYPT_OK; 28 } 29 } 30 LTC_MUTEX_UNLOCK(<c_prng_mutex); 31 return CRYPT_ERROR; 32 } 33