fix unregister_prng() where always the first prng would have been removed

This commit is contained in:
Steffen Jaeckel 2014-08-05 17:46:37 +02:00
parent 3cda802deb
commit a8598b0faf

View File

@ -25,11 +25,11 @@ int unregister_prng(const struct ltc_prng_descriptor *prng)
int x;
LTC_ARGCHK(prng != NULL);
/* is it already registered? */
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) != 0) {
if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
prng_descriptor[x].name = NULL;
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return CRYPT_OK;