Commit Graph

6 Commits

Author SHA1 Message Date
Luke Howard
3daef8a5fd roken: Windows version support helpers
Add helper functions for determining the version of Windows upon which we are
running.
2019-12-05 20:20:28 -05:00
Jeffrey Altman
434f76bcb7 lib/roken: rk_random_init HAVE_ARC4RANDOM #401
When arc4random() is available, rk_random_init() does not have to
call arc4random_stir().  ac4random_stir() will be called as a result
of the first call to arc4random().

Change-Id: I6f4a3be7c39752746657945ed15896472908f889
2018-12-26 16:49:06 -06:00
Rod Widdowson
136f8fb550 Windows: Avoid using deprecated function.
In VC15 GetVersionEx has been deprecated. In order to continue to
support Win2K use the undeprecated VerifyVersionInfoW API
(available since Win2K).

Inline helper functions used in latest Win10 SDK to simplify code.
2018-12-14 06:38:59 -05:00
Simon Wilkinson
e0dd26d963 roken: rand.c needs to include config.h
If we don't include config.h, we don't get the results of any
autoconf tests.
2015-04-13 08:38:14 +01:00
Jeffrey Altman
4cf66ae8e4 roken: use Win32 rand_s() for rk_random() when available
On Windows if the compiler and C RTL is >= 1400 then the rand_s()
function is available.  rand_s() unlike rand() makes use of the
RtlGenRandom() API to produce a random number between 0 and UINT_MAX.
If rand_s() is not available or fails, fallback to rand().

One of the benefits of rand_s() is that no initialization is required
so it will provide random output even if rk_random_init() is not called.

Change-Id: I2768155de744bd49604fc8237728bb205d637f2a
2015-04-11 01:35:32 -04:00
Love Hornquist Astrand
987faedb80 add random abstraction 2010-11-29 09:31:07 -08:00