-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Securely erase memory contents by writing zeros to it. -- -- Securely erase memory contents by writing zeros to it. @package memzero @version 0.1 -- | This module exports tools for zeroing memory. That is, filling a chunk -- of memory with zeros. -- -- The exported functions behave like the ones named the same way in -- base, with the only differences being that zeroing is -- performed on the allocated memory before release, and that they are -- generalized to run on MonadIO and MonadMask for your -- convenience. -- -- It is recommended to import this module qualified. -- --
-- import qualified Memzero --module Memzero -- | memzero p size sets size bytes starting at -- p to zero. -- -- This behaves like memzero', but takes an Int for your -- convenience, seeing most Haskell libraries, including base, -- use Int for counting purposes (sic). It fails if said -- Int is negative. memzero :: forall a m. MonadIO m => Ptr a -> Int -> m () -- | memzero' p size' sets size bytes starting at -- p to zero. memzero' :: forall a m. MonadIO m => Ptr a -> CSize -> m () -- | alloca behaves exactly like base's alloca, but -- the memory is zeroed as soon as the passed in function returns. alloca :: forall a b m. (Storable a, MonadIO m, MonadMask m) => (Ptr a -> m b) -> m b -- | allocaBytes size behaves exactly like base's -- allocaBytes, but the memory is zeroed as soon as the passed in -- function returns. allocaBytes :: forall a b m. (MonadIO m, MonadMask m) => Int -> (Ptr a -> m b) -> m b -- | allocaBytesAligned size alignment behaves exactly like -- base's allocaBytesAligned, but the memory is zeroed as -- soon as the passed in function returns. allocaBytesAligned :: forall a b m. (MonadIO m, MonadMask m) => Int -> Int -> (Ptr a -> m b) -> m b -- | mallocForeignPtr behaves exactly like base's -- mallocForeignPtr, but the memory is zeroed by a C finalizer -- before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrConcFinalizer on the obtained ForeignPtr -- will fail. You can only add C finalizers to it using -- addForeignPtrFinalizer. If you need to add IO -- finalizers, use mallocForeignPtrConc instead. mallocForeignPtr :: forall a m. (Storable a, MonadIO m) => m (ForeignPtr a) -- | mallocForeignPtrBytes size behaves exactly like -- base's mallocForeignPtrBytes, but the memory is zeroed -- by a C finalizer before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrConcFinalizer on the obtained ForeignPtr -- will fail. You can only add C finalizers to it using -- addForeignPtrFinalizer. If you need to add IO -- finalizers, use mallocForeignPtrConcBytes instead. mallocForeignPtrBytes :: forall a m. MonadIO m => Int -> m (ForeignPtr a) -- | mallocForeignPtrAlignedBytes size alignment behaves -- exactly like base's mallocForeignPtrAlignedBytes, but -- the memory is zeroed by a C finalizer before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrConcFinalizer on the obtained ForeignPtr -- will fail. You can only add C finalizers to it using -- addForeignPtrFinalizer. If you need to add IO -- finalizers, use mallocForeignPtrConcAlignedBytes instead. mallocForeignPtrAlignedBytes :: forall a m. MonadIO m => Int -> Int -> m (ForeignPtr a) -- | mallocForeignPtrConc behaves exactly like base's -- mallocForeignPtr, but the memory is zeroed by an IO -- finalizer before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrFinalizer on the obtained ForeignPtr will -- fail. You can only add IO finalizers to it using -- addForeignPtrConcFinalizer. If you need to add C finalizers, -- use mallocForeignPtr instead. mallocForeignPtrConc :: forall a m. (Storable a, MonadIO m) => m (ForeignPtr a) -- | mallocForeignPtrConcBytes size behaves exactly like -- base's mallocForeignPtrBytes, but the memory is zeroed -- by an IO finalizer before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrFinalizer on the obtained ForeignPtr will -- fail. You can only add IO finalizers to it using -- addForeignPtrConcFinalizer. If you need to add C finalizers, -- use mallocForeignPtrBytes instead. mallocForeignPtrConcBytes :: forall a m. MonadIO m => Int -> m (ForeignPtr a) -- | mallocForeignPtrConcAlignedBytes size alignment -- behaves exactly like base's -- mallocForeignPtrAlignedBytes, but the memory is zeroed by an -- IO finalizer before release. -- -- C finalizers and IO finalizers can't be mixed, so using -- addForeignPtrFinalizer on the obtained ForeignPtr will -- fail. You can only add IO finalizers to it using -- addForeignPtrConcFinalizer. If you need to add C finalizers, -- use mallocForeignPtrAlignedBytes instead. mallocForeignPtrConcAlignedBytes :: forall a m. MonadIO m => Int -> Int -> m (ForeignPtr a) -- | This FinalizerEnvPtr zeroes CSize bytes starting at -- Ptr a, and afterwards frees the Ptr -- CSize. finalizerEnvFree :: FinalizerEnvPtr CSize a -- | This FinalizerEnvPtr zeroes CSize bytes starting at -- Ptr a. -- -- Contrary to finalizerEnvFree, this doesn't free -- the Ptr CSize. finalizerEnv :: FinalizerEnvPtr CSize a