return (unsigned long) pthread_self();
}
+void shutdown_ssl(void)
+{
+ ERR_free_strings();
+
+ /* Openssl requires these while shutdown.
+ * Didn't find a way to get out of this clean.
+ * int i, n = CRYPTO_num_locks();
+ * for (i = 0; i < n; i++)
+ * free(SSLCritters[i]);
+ * free(SSLCritters);
+ */
+}
+
/**
* \brief initialize ssl engine
* load certs and initialize openssl internals
if (!SSLCritters) {
lprintf(1, "citserver: can't allocate memory!!\n");
/* Nothing's been initialized, just die */
+ ShutDownWebcit();
exit(WC_EXIT_SSL);
} else {
int a;
lprintf(1,
"citserver: can't allocate memory!!\n");
/** Nothing's been initialized, just die */
+ ShutDownWebcit();
exit(WC_EXIT_SSL);
}
pthread_mutex_init(SSLCritters[a], NULL);
}
else {
lprintf(3, "Cannot write key: %s\n", CTDL_KEY_PATH);
+ ShutDownWebcit();
exit(0);
}
RSA_free(rsa);
}
else {
lprintf(3, "Cannot write key: %s\n", CTDL_CSR_PATH);
+ ShutDownWebcit();
exit(0);
}
}
}
else {
lprintf(3, "Cannot write key: %s\n", CTDL_CER_PATH);
+ ShutDownWebcit();
exit(0);
}
}
int client_read_to(int *sock, char *buf, int bytes, int timeout);
int lprintf(int loglevel, const char *format, ...);
void wc_backtrace(void);
+void ShutDownWebcit(void);
+void shutdown_ssl(void);