From b61a1138bd599c34ba5b9a813e740a60e82fff24 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Sat, 19 Jul 2014 14:34:38 +0000 Subject: [PATCH] move _ARC4_LOCK/UNLOCK primitives from thread_private into OS-specific modules --- src/lib/libcrypto/arc4random/arc4random_linux.h | 8 +++++++- src/lib/libcrypto/arc4random/arc4random_osx.h | 8 +++++++- src/lib/libcrypto/arc4random/arc4random_solaris.h | 9 ++++++++- src/lib/libcrypto/crypto/arc4random_linux.h | 8 +++++++- src/lib/libcrypto/crypto/arc4random_osx.h | 8 +++++++- src/lib/libcrypto/crypto/arc4random_solaris.h | 9 ++++++++- 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/lib/libcrypto/arc4random/arc4random_linux.h b/src/lib/libcrypto/arc4random/arc4random_linux.h index 992ee6bb..29dad3b9 100644 --- a/src/lib/libcrypto/arc4random/arc4random_linux.h +++ b/src/lib/libcrypto/arc4random/arc4random_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_linux.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_linux.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/src/lib/libcrypto/arc4random/arc4random_osx.h b/src/lib/libcrypto/arc4random/arc4random_osx.h index 27428800..55932bb8 100644 --- a/src/lib/libcrypto/arc4random/arc4random_osx.h +++ b/src/lib/libcrypto/arc4random/arc4random_osx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_osx.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_osx.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/src/lib/libcrypto/arc4random/arc4random_solaris.h b/src/lib/libcrypto/arc4random/arc4random_solaris.h index 128f61e0..e5ebbfb7 100644 --- a/src/lib/libcrypto/arc4random/arc4random_solaris.h +++ b/src/lib/libcrypto/arc4random/arc4random_solaris.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_solaris.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -21,6 +21,13 @@ /* * Stub functions for portability. */ + +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/src/lib/libcrypto/crypto/arc4random_linux.h b/src/lib/libcrypto/crypto/arc4random_linux.h index 992ee6bb..29dad3b9 100644 --- a/src/lib/libcrypto/crypto/arc4random_linux.h +++ b/src/lib/libcrypto/crypto/arc4random_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_linux.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_linux.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/src/lib/libcrypto/crypto/arc4random_osx.h b/src/lib/libcrypto/crypto/arc4random_osx.h index 27428800..55932bb8 100644 --- a/src/lib/libcrypto/crypto/arc4random_osx.h +++ b/src/lib/libcrypto/crypto/arc4random_osx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_osx.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_osx.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -22,6 +22,12 @@ * Stub functions for portability. */ +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void diff --git a/src/lib/libcrypto/crypto/arc4random_solaris.h b/src/lib/libcrypto/crypto/arc4random_solaris.h index 128f61e0..e5ebbfb7 100644 --- a/src/lib/libcrypto/crypto/arc4random_solaris.h +++ b/src/lib/libcrypto/crypto/arc4random_solaris.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_solaris.h,v 1.4 2014/07/19 13:02:28 bcook Exp $ */ +/* $OpenBSD: arc4random_solaris.h,v 1.5 2014/07/19 14:34:38 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -21,6 +21,13 @@ /* * Stub functions for portability. */ + +#include + +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx) + static volatile sig_atomic_t _rs_forked; static inline void