Browse Source

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

Steffen Jaeckel 11 năm trước cách đây
mục cha
commit
a8598b0faf

+ 2 - 2
src/misc/crypt/crypt_unregister_prng.c

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