[cfe-dev] [libcxx] random_device for Windows needs more storage

Yaron Keren yaron.keren at gmail.com
Mon Oct 7 14:53:03 PDT 2013


Hi,

Just found out both Visual C++ and MingW supply the rand_s() function
(implemented in MSVCRT), which wraps one of the above functions in a very
easy to use and version:

http://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx

Microsoft own random_device uses it,

Yaron



2013/10/8 Aaron Ballman <aaron at aaronballman.com>

> On Mon, Oct 7, 2013 at 5:31 PM, Yaron Keren <yaron.keren at gmail.com> wrote:
> > Nick, I have seen RtlGenRandom, but I didn't initally use it since
> Microsoft
> > is recommending to use CryptGenRandom instead:
> >
> >
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx
> >
> > [The RtlGenRandom function is available for use in the operating systems
> > specified in the Requirements section. It may be altered or unavailable
> in
> > subsequent versions. Instead, use the CryptGenRandom function.]
> >
> > Due to backward compatibility it's very low chance RtlGenRandom will
> > actually go away, I'll use it.
>
> I don't believe we should be using this function.  Technically, the
> documentation states this is available for use with the operating
> systems listed in the Requirements section, which only lists XP and
> Server 2003.  Relying on this outside of those platforms is not only
> bad form, but to boot, in order to use them, you need to dynamically
> load SystemFunction036 from AdvApi32.dll.
>
> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131008/67bd9d95/attachment.html>


More information about the cfe-dev mailing list