summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/ntdll.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-12-13 22:59:31 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-12-13 22:59:31 +0100
commit74f7872f89dc8ecad500c5d5c4e03b4757f6418d (patch)
tree7b9f8a573c50009c9ad42a653fec8fac94557e1b /winsup/cygwin/ntdll.h
parent80f4987f02e50721e4cc62f6d70bc602324d32ad (diff)
downloadcygnal-74f7872f89dc8ecad500c5d5c4e03b4757f6418d.tar.gz
cygnal-74f7872f89dc8ecad500c5d5c4e03b4757f6418d.tar.bz2
cygnal-74f7872f89dc8ecad500c5d5c4e03b4757f6418d.zip
Rearrange RNG code slightly
In preparation of exporting getentropy/getrandom to userspace, rearrange code a bit: - Define RtlGenRandom in ntdll.h. - Drop calls to getentropy in favor of RtlGenRandom (fhandler_socket, fhandler_dev_random). - Add try/except blocks in fhandler_dev_random to return EFAULT rather than crashing if buffer pointer is invalid. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/ntdll.h')
-rw-r--r--winsup/cygwin/ntdll.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 448eadf20..bf5a7cf80 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -1608,4 +1608,10 @@ extern "C"
}
}
+
+/* There's a bug in ntsecapi.h (Mingw as well as MSFT). SystemFunction036
+ is, in fact, a WINAPI function, but it's not defined as such. Therefore
+ we have to do it correctly here. *Strictly*, this is not ntdll... */
+#define RtlGenRandom SystemFunction036
+extern "C" BOOLEAN WINAPI RtlGenRandom (PVOID, ULONG);
#endif