git.iko.soy/typeable/entropy
on main help sign in
Code clean for, one last windows build-test prior to push.
commit9932e9a5f9999686f9d0d803caedaefaf9dd809e authorThomas M. DuBuisson <tommd@galois.com> dateThu 29 May 2014, 10:09 (12 years ago) parent17469e6
3 files changed+7−6
Setup.hs+1−1 System/EntropyWindows.hs+5−4 entropy.cabal+1−1
Setup.hs+1−1
@@ -29,7 +29,7 @@ cArgs :: [String]
2929cArgs = ["-DHAVE_RDRAND"]
3030
3131cArgsHC :: [String]
32−cArgsHC = map ("-optc" ++) cArgs
32+cArgsHC = cArgs ++ map ("-optc" ++) cArgs
3333
3434canUseRDRAND :: FilePath -> IO Bool
3535canUseRDRAND cc = do
System/EntropyWindows.hs+5−4
@@ -66,7 +66,7 @@ data CryptHandle
6666msDefProv :: String
6767msDefProv = "Microsoft Base Cryptographic Provider v1.0"
6868provRSAFull :: Word32
69−provRSAFull = fromIntegral 1
69+provRSAFull = 1
7070cryptVerifyContext :: Word32
7171cryptVerifyContext = fromIntegral 0xF0000000
7272
@@ -79,10 +79,10 @@ foreign import stdcall unsafe "CryptReleaseContext"
7979 c_cryptReleaseCtx :: Word32 -> Word32 -> IO Int32
8080
8181cryptAcquireCtx :: IO Word32
82−cryptAcquireCtx =
82+cryptAcquireCtx =
8383 alloca $ \handlePtr ->
8484 withCString msDefProv $ \provName -> do
85− stat <- c_cryptAcquireCtx handlePtr nullPtr provName (fromIntegral 1) (fromIntegral cryptVerifyContext)
85+ stat <- c_cryptAcquireCtx handlePtr nullPtr provName provRSAFull cryptVerifyContext
8686 if (toBool stat)
8787 then peek handlePtr
8888 else fail "c_cryptAcquireCtx"
@@ -90,7 +90,7 @@ cryptAcquireCtx =
9090cryptGenRandom :: Word32 -> Int -> IO B.ByteString
9191cryptGenRandom h i =
9292 BI.create i $ \c_buffer -> do
93− stat <- c_cryptGenRandom (fromIntegral h) (fromIntegral i) c_buffer
93+ stat <- c_cryptGenRandom h (fromIntegral i) c_buffer
9494 if (toBool stat)
9595 then return ()
9696 else fail "c_cryptGenRandom"
@@ -113,6 +113,7 @@ openHandle = do
113113 liftM CH cryptAcquireCtx
114114
115115-- |Close the `CryptHandle`
116+closeHandle :: CryptHandle -> IO ()
116117closeHandle (CH h) = cryptReleaseCtx h
117118
118119-- |Read from `CryptHandle`
entropy.cabal+1−1
@@ -30,7 +30,7 @@ flag halvm
3030 description: Build for the HaLVM
3131 default: False
3232library
33− ghc-options: -Wall -O2
33+ ghc-options: -O2
3434 exposed-modules: System.Entropy
3535 if os(windows)
3636 other-modules: System.EntropyWindows