summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_init.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2023-04-23 13:43:47 +0000
committercvs2svn <admin@example.com>2023-04-23 13:43:47 +0000
commite2496982472bdf233be95c5ea72d1c4dc6c91db3 (patch)
tree316488e5daf86864d8466bce0e5b000d85768378 /src/lib/libssl/ssl_init.c
parent097d0cf840b9007212bcd2516ed5e18939e6da3d (diff)
downloadopenbsd-tb_20230422.tar.gz
openbsd-tb_20230422.tar.bz2
openbsd-tb_20230422.zip
This commit was manufactured by cvs2git to create tag 'tb_20230422'.tb_20230422
Diffstat (limited to '')
-rw-r--r--src/lib/libssl/ssl_init.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/lib/libssl/ssl_init.c b/src/lib/libssl/ssl_init.c
deleted file mode 100644
index 65f38e25db..0000000000
--- a/src/lib/libssl/ssl_init.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/* $OpenBSD: ssl_init.c,v 1.3 2022/11/26 16:08:55 tb Exp $ */
2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/* OpenSSL style init */
19
20#include <pthread.h>
21#include <stdio.h>
22
23#include <openssl/objects.h>
24
25#include "ssl_local.h"
26
27static pthread_t ssl_init_thread;
28
29static void
30OPENSSL_init_ssl_internal(void)
31{
32 ssl_init_thread = pthread_self();
33 SSL_load_error_strings();
34 SSL_library_init();
35}
36
37int
38OPENSSL_init_ssl(uint64_t opts, const void *settings)
39{
40 static pthread_once_t once = PTHREAD_ONCE_INIT;
41
42 if (pthread_equal(pthread_self(), ssl_init_thread))
43 return 1; /* don't recurse */
44
45 OPENSSL_init_crypto(opts, settings);
46
47 if (pthread_once(&once, OPENSSL_init_ssl_internal) != 0)
48 return 0;
49
50 return 1;
51}