summaryrefslogtreecommitdiffstats
path: root/lib/libtls/tls_server.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-03-19 16:34:47 +0000
committerjsing <jsing@openbsd.org>2018-03-19 16:34:47 +0000
commitb9573a74af9f34d4eb2bda625e3f663704431e4b (patch)
treec2bd73f2a4362b8051a03e1bffe632d404fd4388 /lib/libtls/tls_server.c
parentDisallow "++minutes". (diff)
downloadwireguard-openbsd-b9573a74af9f34d4eb2bda625e3f663704431e4b.tar.xz
wireguard-openbsd-b9573a74af9f34d4eb2bda625e3f663704431e4b.zip
Automatically handle library initialisation for libtls.
Now that we have tls_init() under pthread_once(), automatically initialise libtls from the entry point functions (tls_config(), tls_client() and tls_server()) - this makes an explicit tls_init() call no longer a requirement. ok bcook@ beck@ inoguchi@
Diffstat (limited to 'lib/libtls/tls_server.c')
-rw-r--r--lib/libtls/tls_server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libtls/tls_server.c b/lib/libtls/tls_server.c
index 98b09574371..44bef6bb11d 100644
--- a/lib/libtls/tls_server.c
+++ b/lib/libtls/tls_server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_server.c,v 1.43 2018/02/08 05:56:49 jsing Exp $ */
+/* $OpenBSD: tls_server.c,v 1.44 2018/03/19 16:34:47 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -31,6 +31,9 @@ tls_server(void)
{
struct tls *ctx;
+ if (tls_init() == -1)
+ return (NULL);
+
if ((ctx = tls_new()) == NULL)
return (NULL);