-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | AES and common modes using AES-NI when available.
--   
--   Cipher-aes128 is an implementation of AES and common modes of
--   operation. It borrows Hanquez's C AES code (see 'cipher-aes') but is
--   unique due to including compile-time detection of NI compiler support,
--   a slightly more functional interface for GCM operations, exposure of
--   <a>Ptr</a> based operations via the .Internal module, and build-in
--   crypto-api support. Cipher-aes128 was originally developed as
--   "'cipher-aes' plus trampolines", which has since been adopted into
--   cipher-aes.
@package cipher-aes128
@version 0.6.4

module Crypto.Cipher.AES128.Internal
data AESKey128
AESKey128 :: !RawKey128 -> ForeignPtr AESKeyStruct -> AESKey128
rawKey128 :: AESKey128 -> !RawKey128
expandedKey128 :: AESKey128 -> ForeignPtr AESKeyStruct
data AESKey192
AESKey192 :: !RawKey192 -> ForeignPtr AESKeyStruct -> AESKey192
rawKey192 :: AESKey192 -> !RawKey192
expandedKey192 :: AESKey192 -> ForeignPtr AESKeyStruct
data AESKey256
AESKey256 :: !RawKey256 -> ForeignPtr AESKeyStruct -> AESKey256
rawKey256 :: AESKey256 -> !RawKey256
expandedKey256 :: AESKey256 -> ForeignPtr AESKeyStruct
data RawKey128
RKey128 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey128
lowK128 :: RawKey128 -> {-# UNPACK #-} !Word64
highK128 :: RawKey128 -> {-# UNPACK #-} !Word64
data RawKey192
RKey192 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey192
lowK192 :: RawKey192 -> {-# UNPACK #-} !Word64
midK192 :: RawKey192 -> {-# UNPACK #-} !Word64
highK192 :: RawKey192 -> {-# UNPACK #-} !Word64
data RawKey256
RKey256 :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> RawKey256
aK256 :: RawKey256 -> {-# UNPACK #-} !Word64
bK256 :: RawKey256 -> {-# UNPACK #-} !Word64
cK256 :: RawKey256 -> {-# UNPACK #-} !Word64
dK256 :: RawKey256 -> {-# UNPACK #-} !Word64
data GCM k
GCM :: GCMpc -> k -> ForeignPtr CTXStruct -> GCM k
_gcmFP :: GCM k -> GCMpc
_keyFP :: GCM k -> k
_ctxFP2 :: GCM k -> ForeignPtr CTXStruct
data GCMpc
generateKey128 :: Ptr Word64 -> IO (Maybe AESKey128)
generateKey192 :: Ptr Word64 -> IO (Maybe AESKey192)
generateKey256 :: Ptr Word64 -> IO (Maybe AESKey256)
generateGCM :: GetExpanded k => k -> IO (GCM k)
precomputeGCMdata :: GetExpanded k => k -> IO GCMpc
encryptECB :: GetExpanded k => k -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
decryptECB :: GetExpanded k => k -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
encryptCTR :: GetExpanded k => k -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
decryptCTR :: GetExpanded k => k -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
encryptGCM :: GetExpanded k => k -> GCMpc -> Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr Word8 -> Ptr Word8 -> IO ()
decryptGCM :: GetExpanded k => k -> GCMpc -> Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr Word8 -> Ptr Word8 -> IO ()
cipherOnlyGCM :: GetExpanded k => GCM k -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
decipherOnlyGCM :: GetExpanded k => GCM k -> Ptr Word8 -> Ptr Word8 -> Int -> IO ()
finishGCM :: GetExpanded k => GCM k -> Ptr Word8 -> IO ()
aadGCM :: GetExpanded k => GCM k -> Ptr Word8 -> Int -> IO ()
instance GetExpanded AESKey128
instance GetExpanded AESKey192
instance GetExpanded AESKey256

module Crypto.Cipher.AES128
data AESKey128
data AESKey192
data AESKey256

-- | The BlockCipher class is intended as the generic interface targeted by
--   maintainers of Haskell cipher implementations.
--   
--   Minimum complete definition: blockSize, encryptBlock, decryptBlock,
--   buildKey, and keyLength.
--   
--   Instances must handle unaligned data
class Serialize k => BlockCipher k
blockSize :: BlockCipher k => Tagged * k BitLength
encryptBlock :: BlockCipher k => k -> ByteString -> ByteString
decryptBlock :: BlockCipher k => k -> ByteString -> ByteString
buildKey :: BlockCipher k => ByteString -> Maybe k
keyLength :: BlockCipher k => Tagged * k BitLength
ecb :: BlockCipher k => k -> ByteString -> ByteString
unEcb :: BlockCipher k => k -> ByteString -> ByteString
cbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
ctr :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCtr :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
ctrLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCtrLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
cfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
ofb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unOfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
cbcLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCbcLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
sivLazy :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
unSivLazy :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
siv :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
unSiv :: BlockCipher k => k -> k -> [ByteString] -> ByteString -> Maybe ByteString
ecbLazy :: BlockCipher k => k -> ByteString -> ByteString
unEcbLazy :: BlockCipher k => k -> ByteString -> ByteString
cfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unCfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
ofbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)
unOfbLazy :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)

-- | Build a symmetric key using the system entropy (see <a>Entropy</a>)
buildKeyIO :: BlockCipher k => IO k

-- | Obtain an <a>IV</a> made only of zeroes
zeroIV :: BlockCipher k => IV k
instance BlockCipher AESKey256
instance BlockCipher AESKey192
instance BlockCipher AESKey128
instance Serialize AESKey256
instance Serialize AESKey192
instance Serialize AESKey128
