[PATCH]std::random_device for win32 (MinGW) ABI implementation

sotrdg sotrdg euloanty@live.com
Fri Oct 12 17:46:00 GMT 2018


The implementation is on the GitHub.

https://github.com/euloanty/mingw-std-random_device/blob/master/random_device_gcc_withcxx11abi/random.cc


This implementation does several changes towards the original random.cc.


  1.  Type Erasure Abstractions for various random_devices so we can choose any of them to use if necessary.
  2.  Solve security issue of setvbuf(fp,nullptr,_IONBF,0); In order to avoid seeds leaking to other processes after releasing the buffer of std::FILE*.
  3.  For amd64 platform, random_device will prefer using rdseed instruction instead of rdrand instruction
  4.  For Windows, random_device will get seeds from RtlGenRandom and buffer it.
  5.  Legacy support for mt19937.
I’ve put it on the GitHub for anyone.


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



More information about the Libstdc++ mailing list