module Bindings.Nettle.Cipher.ChaChaPoly1305 where
import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word
c'CHACHA_POLY1305_BLOCK_SIZE = 64
c'CHACHA_POLY1305_BLOCK_SIZE :: (Num a) => a
c'CHACHA_POLY1305_KEY_SIZE = 32
c'CHACHA_POLY1305_KEY_SIZE :: (Num a) => a
c'CHACHA_POLY1305_NONCE_SIZE = 12
c'CHACHA_POLY1305_NONCE_SIZE :: (Num a) => a
c'CHACHA_POLY1305_DIGEST_SIZE = 16
c'CHACHA_POLY1305_DIGEST_SIZE :: (Num a) => a
data C'chacha_poly1305_ctx = C'chacha_poly1305_ctx{
} deriving (Eq,Show)
instance Storable C'chacha_poly1305_ctx where
sizeOf _ = 176
alignment _ = 8
peek _p = do
return $ C'chacha_poly1305_ctx
poke _p (C'chacha_poly1305_ctx) = do
return ()
foreign import ccall "nettle_chacha_poly1305_set_key" c'nettle_chacha_poly1305_set_key
:: Ptr C'chacha_poly1305_ctx -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_set_key" p'nettle_chacha_poly1305_set_key
:: FunPtr (Ptr C'chacha_poly1305_ctx -> Ptr CUChar -> IO ())
foreign import ccall "nettle_chacha_poly1305_set_nonce" c'nettle_chacha_poly1305_set_nonce
:: Ptr C'chacha_poly1305_ctx -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_set_nonce" p'nettle_chacha_poly1305_set_nonce
:: FunPtr (Ptr C'chacha_poly1305_ctx -> Ptr CUChar -> IO ())
foreign import ccall "nettle_chacha_poly1305_update" c'nettle_chacha_poly1305_update
:: Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_update" p'nettle_chacha_poly1305_update
:: FunPtr (Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> IO ())
foreign import ccall "nettle_chacha_poly1305_encrypt" c'nettle_chacha_poly1305_encrypt
:: Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_encrypt" p'nettle_chacha_poly1305_encrypt
:: FunPtr (Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO ())
foreign import ccall "nettle_chacha_poly1305_decrypt" c'nettle_chacha_poly1305_decrypt
:: Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_decrypt" p'nettle_chacha_poly1305_decrypt
:: FunPtr (Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO ())
foreign import ccall "nettle_chacha_poly1305_digest" c'nettle_chacha_poly1305_digest
:: Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> IO ()
foreign import ccall "&nettle_chacha_poly1305_digest" p'nettle_chacha_poly1305_digest
:: FunPtr (Ptr C'chacha_poly1305_ctx -> CUInt -> Ptr CUChar -> IO ())