-static void ossl_init_thread_stop(struct thread_local_inits_st *locals)
-{
- /* Can't do much about this */
- if (locals == NULL)
- return;
-
- if (locals->async) {
-#ifdef OPENSSL_INIT_DEBUG
- fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
- "ASYNC_cleanup_thread()\n");
-#endif
- ASYNC_cleanup_thread();
- }
-
- if (locals->err_state) {
-#ifdef OPENSSL_INIT_DEBUG
- fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_stop: "
- "err_delete_thread_state()\n");
-#endif
- err_delete_thread_state();
- }
-
- OPENSSL_free(locals);
-}
-
-void OPENSSL_thread_stop(void)
-{
- ossl_init_thread_stop(
- (struct thread_local_inits_st *)ossl_init_get_thread_local(0));
-}
-
-int ossl_init_thread_start(uint64_t opts)
-{
- struct thread_local_inits_st *locals;
-
- if (!OPENSSL_init_crypto(0, NULL))
- return 0;
-
- locals = ossl_init_get_thread_local(1);
-
- if (locals == NULL)
- return 0;
-
- if (opts & OPENSSL_INIT_THREAD_ASYNC) {
-#ifdef OPENSSL_INIT_DEBUG
- fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
- "marking thread for async\n");
-#endif
- locals->async = 1;
- }
-
- if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
-#ifdef OPENSSL_INIT_DEBUG
- fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
- "marking thread for err_state\n");
-#endif
- locals->err_state = 1;
- }
-
- return 1;
-}
-