git.iko.soy/typeable/entropy
on main help sign in
Fix the build with Clang on Windows
dcdaa91Ryan Scott
System/EntropyWindows.hs+14−15
@@ -31,21 +31,20 @@ import Foreign.Marshal.Alloc (alloca)
31import Foreign.Marshal.Utils (toBool)
31import Foreign.Marshal.Utils (toBool)
32import Foreign.Storable (peek)
32import Foreign.Storable (peek)
33
33
34−{- C example for windows rng - taken from a blog, can't recall which one but thank you!
34+-- C example for windows rng - taken from a blog, can't recall which one but thank you!
35− #include <Windows.h>
35+-- #include <Windows.h>
36− #include <Wincrypt.h>
36+-- #include <Wincrypt.h>
37− ...
37+-- ...
38− //
38+-- //
39− // DISCLAIMER: Don't forget to check your error codes!!
39+-- // DISCLAIMER: Don't forget to check your error codes!!
40− // I am not checking as to make the example simple...
40+-- // I am not checking as to make the example simple...
41− //
41+-- //
42− HCRYPTPROV hCryptCtx = NULL;
42+-- HCRYPTPROV hCryptCtx = NULL;
43− BYTE randomArray[128];
43+-- BYTE randomArray[128];
44−
44+--
45− CryptAcquireContext(&hCryptCtx, NULL, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
45+-- CryptAcquireContext(&hCryptCtx, NULL, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
46− CryptGenRandom(hCryptCtx, 128, randomArray);
46+-- CryptGenRandom(hCryptCtx, 128, randomArray);
47− CryptReleaseContext(hCryptCtx, 0);
47+-- CryptReleaseContext(hCryptCtx, 0);
48−-}
49
48
50
49
51#ifdef arch_i386
50#ifdef arch_i386