Implement getentropy for Cygwin

* miscfuncs.cc (getentropy): Move fhandler_dev_random::crypt_gen_random
	here and rename to getentropy.  Fix type and return values to match
	getentropy requirements.
	* miscfuncs.h (getentropy): Add prototype.
	* fhandler.h (fhandler_dev_random::crypt_gen_random): Remove prototype.
	* fhandler_random.cc (fhandler_dev_random::crypt_gen_random): Drop.
	(fhandler_dev_random::write): Use getentropy instead.
	(fhandler_dev_random::read): Ditto.
	* fhandler_socket.cc (fhandler_socket::af_local_set_secret): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2016-03-18 14:46:20 +01:00
parent e0fc33322d
commit dcf31cdc99
5 changed files with 27 additions and 30 deletions

View File

@@ -15,6 +15,8 @@ details. */
#define likely(X) __builtin_expect (!!(X), 1)
#define unlikely(X) __builtin_expect (!!(X), 0)
extern "C" int getentropy (void *ptr, size_t len);
int __reg1 winprio_to_nice (DWORD);
DWORD __reg1 nice_to_winprio (int &);