diff options
author | bcook <> | 2014-07-20 20:51:13 +0000 |
---|---|---|
committer | bcook <> | 2014-07-20 20:51:13 +0000 |
commit | f34324d947b29b5a35a325bbd3901294355b4f39 (patch) | |
tree | 3cffc18607d7ee2f36193cbc2c6420f39f8d8d9f /src/lib/libcrypto/crypto/arc4random_solaris.h | |
parent | 6f021fc4705d719c57993c7f3e916ed71f4480eb (diff) | |
download | openbsd-f34324d947b29b5a35a325bbd3901294355b4f39.tar.gz openbsd-f34324d947b29b5a35a325bbd3901294355b4f39.tar.bz2 openbsd-f34324d947b29b5a35a325bbd3901294355b4f39.zip |
Move more OS-specific functionality to arc4random.h headers.
Move <sys/mman.h> and raise(SIGKILL) calls to OS-specific headers.
On OpenBSD, move thread_private.h as well to arc4random.h.
On Windows, use TerminateProcess on getentropy failure.
ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/crypto/arc4random_solaris.h')
-rw-r--r-- | src/lib/libcrypto/crypto/arc4random_solaris.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libcrypto/crypto/arc4random_solaris.h b/src/lib/libcrypto/crypto/arc4random_solaris.h index 18b1bd54e0..2082a4728f 100644 --- a/src/lib/libcrypto/crypto/arc4random_solaris.h +++ b/src/lib/libcrypto/crypto/arc4random_solaris.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: arc4random_solaris.h,v 1.6 2014/07/19 15:29:25 bcook Exp $ */ | 1 | /* $OpenBSD: arc4random_solaris.h,v 1.7 2014/07/20 20:51:13 bcook Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> | 4 | * Copyright (c) 1996, David Mazieres <dm@uun.org> |
@@ -22,7 +22,10 @@ | |||
22 | * Stub functions for portability. | 22 | * Stub functions for portability. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <sys/mman.h> | ||
26 | |||
25 | #include <pthread.h> | 27 | #include <pthread.h> |
28 | #include <signal.h> | ||
26 | 29 | ||
27 | static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; | 30 | static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; |
28 | #define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) | 31 | #define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx) |
@@ -30,6 +33,12 @@ static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; | |||
30 | 33 | ||
31 | #define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f)) | 34 | #define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f)) |
32 | 35 | ||
36 | static inline void | ||
37 | _getentropy_fail(void) | ||
38 | { | ||
39 | raise(SIGKILL); | ||
40 | } | ||
41 | |||
33 | static volatile sig_atomic_t _rs_forked; | 42 | static volatile sig_atomic_t _rs_forked; |
34 | 43 | ||
35 | static inline void | 44 | static inline void |