raaz-0.3.2: Fast and type safe cryptography.
Safe HaskellNone
LanguageHaskell2010

Buffer

Synopsis

Documentation

type BufferPtr = AlignedBlockPtr BufferAlignment Prim #

data Buffer (n :: Nat) Source #

A buffer buf :: Buffer n is a memory element that has enough space for the n blocks of the primitive and, if required by the implementation, any additional blocks that might be used for padding of the last chunk of message.

Instances

Instances details
KnownNat n => Memory (Buffer n) Source # 
Instance details

Defined in Buffer

Methods

memoryAlloc :: Alloc (Buffer n)

unsafeToPointer :: Buffer n -> Ptr Word8

KnownNat n => ReadAccessible (Buffer n) Source # 
Instance details

Defined in Buffer

Methods

beforeReadAdjustment :: Buffer n -> IO ()

readAccess :: Buffer n -> [Access]

KnownNat n => WriteAccessible (Buffer n) Source # 
Instance details

Defined in Buffer

Methods

writeAccess :: Buffer n -> [Access]

afterWriteAdjustment :: Buffer n -> IO ()

withBufferPtr :: KnownNat n => (BufferPtr -> BlockCount Prim -> a) -> Buffer n -> a Source #

Run the action on the buffer pointer.

unsafeWithBufferPtr :: KnownNat n => (BufferPtr -> a) -> Buffer n -> a Source #

This takes a buffer pointer action and runs it with the underlying pointer associated with the buffer. The action is supposed to use

memsetBuffer :: KnownNat n => Word8 -> Buffer n -> IO () Source #

Memset the given buffer.

Some unsafe functions

unsafeGetBufferPointer :: Buffer n -> BufferPtr Source #

Get the underlying pointer for the buffer.

bufferSize :: KnownNat n => Proxy (Buffer n) -> BlockCount Prim Source #

The size of data (measured in blocks) that can be safely processed inside this buffer.