#include <openssl/crypto.h>
#include <openssl/core_numbers.h>
-#include "internal/cryptlib_int.h"
-#include "internal/providercommon.h"
+#include "crypto/cryptlib.h"
+#include "prov/providercommon.h"
#include "internal/thread_once.h"
#ifdef FIPS_MODE
static void init_thread_stop(void *arg, THREAD_EVENT_HANDLER **hands)
{
- THREAD_EVENT_HANDLER *curr, *prev = NULL;
+ THREAD_EVENT_HANDLER *curr, *prev = NULL, *tmp;
/* Can't do much about this */
if (hands == NULL)
curr = *hands;
while (curr != NULL) {
if (arg != NULL && curr->arg != arg) {
+ prev = curr;
curr = curr->next;
continue;
}
curr->handfn(curr->arg);
- prev = curr;
+ if (prev == NULL)
+ *hands = curr->next;
+ else
+ prev->next = curr->next;
+
+ tmp = curr;
curr = curr->next;
- if (prev == *hands)
- *hands = curr;
- OPENSSL_free(prev);
+
+ OPENSSL_free(tmp);
}
}
int i;
gtr = get_global_tevent_register();
+ if (gtr == NULL)
+ return 0;
if (!all)
CRYPTO_THREAD_write_lock(gtr->lock);
for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {