summaryrefslogtreecommitdiffstats
path: root/distrib/special
diff options
context:
space:
mode:
authorbcook <bcook@openbsd.org>2018-11-11 06:41:28 +0000
committerbcook <bcook@openbsd.org>2018-11-11 06:41:28 +0000
commit3938ed1ebd7560655156b4463ed629b56b149c35 (patch)
tree0017d2ce22455fa146c3cc54b66e3d7908a3776e /distrib/special
parentwhen encapsulating mpls, map the mpls qos value to an ip tos. (diff)
downloadwireguard-openbsd-3938ed1ebd7560655156b4463ed629b56b149c35.tar.xz
wireguard-openbsd-3938ed1ebd7560655156b4463ed629b56b149c35.zip
Add automatic threading initialization for libcrypto.
This implements automatic thread support initialization in libcrypto. This does not remove any functions from the ABI, but does turn them into no-ops. Stub implementations of pthread_mutex_(init|lock|unlock) are provided for ramdisks. This does not implement the new OpenSSL 1.1 thread API internally, keeping the original CRYTPO_lock / CRYPTO_add_lock functions for library locking. For -portable, crypto_lock.c can be reimplemented with OS-specific primitives as needed. ok beck@, tb@, looks sane guenther@
Diffstat (limited to 'distrib/special')
-rw-r--r--distrib/special/libstubs/Makefile4
-rw-r--r--distrib/special/libstubs/pthread_mutex.c40
2 files changed, 42 insertions, 2 deletions
diff --git a/distrib/special/libstubs/Makefile b/distrib/special/libstubs/Makefile
index 06f83aae313..19b8f4b5901 100644
--- a/distrib/special/libstubs/Makefile
+++ b/distrib/special/libstubs/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.19 2018/03/08 16:07:36 beck Exp $
+# $OpenBSD: Makefile,v 1.20 2018/11/11 06:41:28 bcook Exp $
.include <bsd.own.mk>
LIB= stubs
SRCS= db.c setlocale.c sha1.c sha2.c getgrent.c getpwent.c \
- ethers.c pthread_once.c \
+ ethers.c pthread_mutex.c pthread_once.c \
mbrtowc_sb.c sscanf.c vfprintf.c vfscanf.c
SRCS+= asr.c \
asr_utils.c \
diff --git a/distrib/special/libstubs/pthread_mutex.c b/distrib/special/libstubs/pthread_mutex.c
new file mode 100644
index 00000000000..b4693dc9911
--- /dev/null
+++ b/distrib/special/libstubs/pthread_mutex.c
@@ -0,0 +1,40 @@
+/* $OpenBSD: pthread_mutex.c,v 1.1 2018/11/11 06:41:28 bcook Exp $ */
+/*
+ * Copyright (c) 2018 Brent Cook <bcook@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <pthread.h>
+
+int
+pthread_mutex_init(pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr)
+{
+ return (0);
+}
+DEF_STRONG(pthread_mutex_init);
+
+int
+pthread_mutex_lock(pthread_mutex_t *mutex)
+{
+ return (0);
+}
+DEF_STRONG(pthread_mutex_lock);
+
+int
+pthread_mutex_unlock(pthread_mutex_t *mutex)
+{
+ return (0);
+}
+DEF_STRONG(pthread_mutex_unlock);