correct haddock
This commit is contained in:
parent
41039c7b5b
commit
d9ba6034c4
@ -1,5 +1,5 @@
|
||||
-- |
|
||||
-- Module : Crypto.Internal.Bytes
|
||||
-- Module : Crypto.Internal.Memory
|
||||
-- License : BSD-style
|
||||
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
|
||||
-- Stability : stable
|
||||
|
||||
@ -10,15 +10,12 @@ module Crypto.Random.Entropy
|
||||
) where
|
||||
|
||||
import Data.Maybe (catMaybes)
|
||||
import Data.SecureMem
|
||||
import Crypto.Internal.ByteArray
|
||||
|
||||
import Crypto.Random.Types
|
||||
import Crypto.Random.Entropy.Unsafe
|
||||
|
||||
-- | Get some entropy from the system source of entropy
|
||||
getEntropy :: Int -> IO Random
|
||||
getEntropy :: ByteArray byteArray => Int -> IO byteArray
|
||||
getEntropy n = do
|
||||
backends <- catMaybes `fmap` sequence supportedBackends
|
||||
out <- allocateSecureMem n
|
||||
withSecureMemPtr out $ replenish n backends
|
||||
return $ Random out
|
||||
byteArrayAlloc n (replenish n backends)
|
||||
|
||||
@ -14,7 +14,7 @@ module Crypto.Random.EntropyPool
|
||||
|
||||
import Control.Concurrent.MVar
|
||||
import Crypto.Random.Entropy.Unsafe
|
||||
import Crypto.Random.Types
|
||||
import Crypto.Internal.ByteArray
|
||||
import Data.SecureMem
|
||||
import Data.Word (Word8)
|
||||
import Data.Maybe (catMaybes)
|
||||
@ -66,8 +66,5 @@ getEntropyPtr (EntropyPool backends posM sm) n outPtr =
|
||||
copyLoop (d `plusPtr` m) s (wrappedPos + m) (left - m)
|
||||
|
||||
-- | Grab a chunk of entropy from the entropy pool.
|
||||
getEntropyFrom :: EntropyPool -> Int -> IO Random
|
||||
getEntropyFrom pool n = do
|
||||
out <- allocateSecureMem n
|
||||
withSecureMemPtr out $ getEntropyPtr pool n
|
||||
return $ Random out
|
||||
getEntropyFrom :: ByteArray byteArray => EntropyPool -> Int -> IO byteArray
|
||||
getEntropyFrom pool n = byteArrayAlloc n (getEntropyPtr pool n)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user