document why RtlGenRandom is used

This commit is contained in:
Aaron Zauner 2016-06-15 21:50:33 +08:00
parent ba9c296108
commit 77c05fce0c

View File

@ -25,6 +25,12 @@
#include "utils.h" #include "utils.h"
#ifdef _WIN32 #ifdef _WIN32
/* `RtlGenRandom` is used over `CryptGenRandom` on Microsoft Windows based systems:
* - `CryptGenRandom` requires pulling in `CryptoAPI` which causes unnecessary
* memory overhead if no other Cryptography functionally is required.
* - `RtlGenRandom` is thus called directly instead. A detailed explaination
* can be found here: https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/
*/
# include <windows.h> # include <windows.h>
# define RtlGenRandom SystemFunction036 # define RtlGenRandom SystemFunction036
# if defined(__cplusplus) # if defined(__cplusplus)