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

Yaron Keren yaron.keren at gmail.com
Mon Oct 7 11:57:50 PDT 2013


I'm trying to implement random_device for Windows using the CryptGenRandom
API, as in the attached non-working code.

The trouble is, I need to store a crypto handle sized 64 bits in
random_device whereas it has only an int (likely less than 64 bits) private
member for storage.

Is it OK to modify the private member __f_ type from int to uint64_t?

A uint64_t it can hold both the crypto handle on Windows and file handles
on Linux.

Yaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131007/5d9652e9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: random.cpp
Type: text/x-c++src
Size: 1965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131007/5d9652e9/attachment.cpp>


More information about the cfe-dev mailing list