1 // SPDX-License-Identifier: BSD-2-Clause 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 #include "tomcrypt_private.h" 11 12 /** 13 @file crypt_unregister_cipher.c 14 Unregister a cipher, Tom St Denis 15 */ 16 17 /** 18 Unregister a cipher from the descriptor table 19 @param cipher The cipher descriptor to remove 20 @return CRYPT_OK on success 21 */ unregister_cipher(const struct ltc_cipher_descriptor * cipher)22int unregister_cipher(const struct ltc_cipher_descriptor *cipher) 23 { 24 int x; 25 26 LTC_ARGCHK(cipher != NULL); 27 28 /* is it already registered? */ 29 LTC_MUTEX_LOCK(<c_cipher_mutex); 30 for (x = 0; x < TAB_SIZE; x++) { 31 if (cipher_descriptor[x] == cipher) { 32 cipher_descriptor[x] = NULL; 33 LTC_MUTEX_UNLOCK(<c_cipher_mutex); 34 return CRYPT_OK; 35 } 36 } 37 LTC_MUTEX_UNLOCK(<c_cipher_mutex); 38 return CRYPT_ERROR; 39 } 40 41 /* ref: $Format:%D$ */ 42 /* git commit: $Format:%H$ */ 43 /* commit time: $Format:%ai$ */ 44