diff options
Diffstat (limited to 'xorg-server/os/auth.c')
-rw-r--r-- | xorg-server/os/auth.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xorg-server/os/auth.c b/xorg-server/os/auth.c index 5fcb538c4..df05a5717 100644 --- a/xorg-server/os/auth.c +++ b/xorg-server/os/auth.c @@ -303,11 +303,23 @@ GenerateAuthorization(unsigned name_length, void GenerateRandomData(int len, char *buf) { +#ifdef _MSC_VER + static HANDLE hAdvApi32; + static BOOLEAN (_stdcall * RtlGenRandom)(void *,unsigned long); + + if (!hAdvApi32) + { + hAdvApi32=LoadLibrary("advapi32.dll"); + RtlGenRandom=(BOOLEAN (_stdcall *)(void*,unsigned long))GetProcAddress(hAdvApi32,"SystemFunction036"); + } + RtlGenRandom(buf, len); +#else int fd; fd = open("/dev/urandom", O_RDONLY); read(fd, buf, len); close(fd); +#endif } #endif /* XCSECURITY */ |