Path: blob/master/libs/tomcrypt/src/misc/crypt/crypt_find_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_find_cipher.c12Find a cipher in the descriptor tables, Tom St Denis13*/1415/**16Find a registered cipher by name17@param name The name of the cipher to look for18@return >= 0 if found, -1 if not present19*/20int find_cipher(const char *name)21{22int x;23LTC_ARGCHK(name != NULL);24LTC_MUTEX_LOCK(<c_cipher_mutex);25for (x = 0; x < TAB_SIZE; x++) {26if (cipher_descriptor[x].name != NULL && !XSTRCMP(cipher_descriptor[x].name, name)) {27LTC_MUTEX_UNLOCK(<c_cipher_mutex);28return x;29}30}31LTC_MUTEX_UNLOCK(<c_cipher_mutex);32return -1;33}343536