summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/arc4random/arc4random_win.h
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2015-03-08 16:48:49 +0000
committercvs2svn <admin@example.com>2015-03-08 16:48:49 +0000
commitdecf84ba5550c1656a7fdb51b5b81969590c3f03 (patch)
tree44872802e872bdfd60730fa9cf01d9d5751251c1 /src/lib/libcrypto/arc4random/arc4random_win.h
parent7a8f138352aa4eb7b65ac4b1a5fe7630fbee1427 (diff)
downloadopenbsd-libressl-v2.1.5.tar.gz
openbsd-libressl-v2.1.5.tar.bz2
openbsd-libressl-v2.1.5.zip
This commit was manufactured by cvs2git to create branch 'OPENBSD_5_7'.libressl-v2.1.5
Diffstat (limited to 'src/lib/libcrypto/arc4random/arc4random_win.h')
-rw-r--r--src/lib/libcrypto/arc4random/arc4random_win.h75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/lib/libcrypto/arc4random/arc4random_win.h b/src/lib/libcrypto/arc4random/arc4random_win.h
deleted file mode 100644
index 48a1bda128..0000000000
--- a/src/lib/libcrypto/arc4random/arc4random_win.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/* $OpenBSD: arc4random_win.h,v 1.5 2015/01/15 06:57:18 deraadt Exp $ */
2
3/*
4 * Copyright (c) 1996, David Mazieres <dm@uun.org>
5 * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
6 * Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
7 * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * Stub functions for portability.
24 */
25
26#include <windows.h>
27
28static volatile HANDLE arc4random_mtx = NULL;
29
30/*
31 * Initialize the mutex on the first lock attempt. On collision, each thread
32 * will attempt to allocate a mutex and compare-and-swap it into place as the
33 * global mutex. On failure to swap in the global mutex, the mutex is closed.
34 */
35#define _ARC4_LOCK() { \
36 if (!arc4random_mtx) { \
37 HANDLE p = CreateMutex(NULL, FALSE, NULL); \
38 if (InterlockedCompareExchangePointer((void **)&arc4random_mtx, (void *)p, NULL)) \
39 CloseHandle(p); \
40 } \
41 WaitForSingleObject(arc4random_mtx, INFINITE); \
42} \
43
44#define _ARC4_UNLOCK() ReleaseMutex(arc4random_mtx)
45
46static inline void
47_getentropy_fail(void)
48{
49 TerminateProcess(GetCurrentProcess(), 0);
50}
51
52static inline int
53_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
54{
55 *rsp = calloc(1, sizeof(**rsp));
56 if (*rsp == NULL)
57 return (-1);
58
59 *rsxp = calloc(1, sizeof(**rsxp));
60 if (*rsxp == NULL) {
61 free(*rsp);
62 return (-1);
63 }
64 return (0);
65}
66
67static inline void
68_rs_forkhandler(void)
69{
70}
71
72static inline void
73_rs_forkdetect(void)
74{
75}