question about RtlGenRandom (SystemFunction036) and urandom

Juan Lang juan.lang at gmail.com
Wed Jul 15 10:58:38 CDT 2009


> Thanks for the quick response! Actually it seems that rand_s()
> uses RtlGenRandom[2], and MSDN claims the function can be used for
> cryptographically secure random numbers[1].

I don't see anything on that page that says that it can be used for
cryptographically secure random numbers, not that we've defined that
term.  I do see that it generates pseudorandom numbers, which
/dev/urandom does as well, and rand() notably does not.

> If win32 apps rely on this method for security, I figured maybe this
> would be reason enough to at least keep the FIXME in there (slightly
> worried about similarities to Debian's OpenSSL incident, although that
> was much more severe).

This is different.  Our RtlGenRandom generates pseudorandom numbers as
well as /dev/urandom does.  How random that is depends on the kernel
you're running and how large the entropy pool is when we call into it.

>  [2] its use of RtlGenRandom:
>    http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx

You didn't reference this, but I'll comment on it anyway:  The main
point of this is that it's possible to get pseudorandom numbers using
RtlGenRandom, and doing so doesn't require that you load crypt32.
crypt32 is fairly large, so if all you want is a pseudorandom number,
and nothing else to do with the Win32 crypto API, there's a less
expensive way to get one.  How strong that pseudorandom number is is
unknown.
--Juan



More information about the wine-devel mailing list