Path: blob/master/libs/tomcrypt/src/misc/crypt/crypt_unregister_cipher.c
5972 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/8#include "tomcrypt.h"910/**11@file crypt_unregister_cipher.c12Unregister a cipher, Tom St Denis13*/1415/**16Unregister a cipher from the descriptor table17@param cipher The cipher descriptor to remove18@return CRYPT_OK on success19*/20int unregister_cipher(const struct ltc_cipher_descriptor *cipher)21{22int x;2324LTC_ARGCHK(cipher != NULL);2526/* is it already registered? */27LTC_MUTEX_LOCK(<c_cipher_mutex);28for (x = 0; x < TAB_SIZE; x++) {29if (XMEMCMP(&cipher_descriptor[x], cipher, sizeof(struct ltc_cipher_descriptor)) == 0) {30cipher_descriptor[x].name = NULL;31cipher_descriptor[x].ID = 255;32LTC_MUTEX_UNLOCK(<c_cipher_mutex);33return CRYPT_OK;34}35}36LTC_MUTEX_UNLOCK(<c_cipher_mutex);37return CRYPT_ERROR;38}394041