{-# LINE 1 "src/Botan/Bindings/Cipher.hsc" #-}
{-# LANGUAGE CApiFFI #-}
module Botan.Bindings.Cipher where
import Botan.Bindings.Prelude
data {-# CTYPE "botan/ffi.h" "struct botan_cipher_struct" #-} BotanCipherStruct
newtype {-# CTYPE "botan/ffi.h" "botan_cipher_t" #-} BotanCipher
= MkBotanCipher { BotanCipher -> Ptr BotanCipherStruct
runBotanCipher :: Ptr BotanCipherStruct }
deriving newtype (BotanCipher -> BotanCipher -> Bool
(BotanCipher -> BotanCipher -> Bool)
-> (BotanCipher -> BotanCipher -> Bool) -> Eq BotanCipher
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotanCipher -> BotanCipher -> Bool
== :: BotanCipher -> BotanCipher -> Bool
$c/= :: BotanCipher -> BotanCipher -> Bool
/= :: BotanCipher -> BotanCipher -> Bool
Eq, Eq BotanCipher
Eq BotanCipher
-> (BotanCipher -> BotanCipher -> Ordering)
-> (BotanCipher -> BotanCipher -> Bool)
-> (BotanCipher -> BotanCipher -> Bool)
-> (BotanCipher -> BotanCipher -> Bool)
-> (BotanCipher -> BotanCipher -> Bool)
-> (BotanCipher -> BotanCipher -> BotanCipher)
-> (BotanCipher -> BotanCipher -> BotanCipher)
-> Ord BotanCipher
BotanCipher -> BotanCipher -> Bool
BotanCipher -> BotanCipher -> Ordering
BotanCipher -> BotanCipher -> BotanCipher
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: BotanCipher -> BotanCipher -> Ordering
compare :: BotanCipher -> BotanCipher -> Ordering
$c< :: BotanCipher -> BotanCipher -> Bool
< :: BotanCipher -> BotanCipher -> Bool
$c<= :: BotanCipher -> BotanCipher -> Bool
<= :: BotanCipher -> BotanCipher -> Bool
$c> :: BotanCipher -> BotanCipher -> Bool
> :: BotanCipher -> BotanCipher -> Bool
$c>= :: BotanCipher -> BotanCipher -> Bool
>= :: BotanCipher -> BotanCipher -> Bool
$cmax :: BotanCipher -> BotanCipher -> BotanCipher
max :: BotanCipher -> BotanCipher -> BotanCipher
$cmin :: BotanCipher -> BotanCipher -> BotanCipher
min :: BotanCipher -> BotanCipher -> BotanCipher
Ord, Ptr BotanCipher -> IO BotanCipher
Ptr BotanCipher -> Int -> IO BotanCipher
Ptr BotanCipher -> Int -> BotanCipher -> IO ()
Ptr BotanCipher -> BotanCipher -> IO ()
BotanCipher -> Int
(BotanCipher -> Int)
-> (BotanCipher -> Int)
-> (Ptr BotanCipher -> Int -> IO BotanCipher)
-> (Ptr BotanCipher -> Int -> BotanCipher -> IO ())
-> (forall b. Ptr b -> Int -> IO BotanCipher)
-> (forall b. Ptr b -> Int -> BotanCipher -> IO ())
-> (Ptr BotanCipher -> IO BotanCipher)
-> (Ptr BotanCipher -> BotanCipher -> IO ())
-> Storable BotanCipher
forall b. Ptr b -> Int -> IO BotanCipher
forall b. Ptr b -> Int -> BotanCipher -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: BotanCipher -> Int
sizeOf :: BotanCipher -> Int
$calignment :: BotanCipher -> Int
alignment :: BotanCipher -> Int
$cpeekElemOff :: Ptr BotanCipher -> Int -> IO BotanCipher
peekElemOff :: Ptr BotanCipher -> Int -> IO BotanCipher
$cpokeElemOff :: Ptr BotanCipher -> Int -> BotanCipher -> IO ()
pokeElemOff :: Ptr BotanCipher -> Int -> BotanCipher -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO BotanCipher
peekByteOff :: forall b. Ptr b -> Int -> IO BotanCipher
$cpokeByteOff :: forall b. Ptr b -> Int -> BotanCipher -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> BotanCipher -> IO ()
$cpeek :: Ptr BotanCipher -> IO BotanCipher
peek :: Ptr BotanCipher -> IO BotanCipher
$cpoke :: Ptr BotanCipher -> BotanCipher -> IO ()
poke :: Ptr BotanCipher -> BotanCipher -> IO ()
Storable)
foreign import capi safe "botan/ffi.h &botan_cipher_destroy"
botan_cipher_destroy
:: FinalizerPtr BotanCipherStruct
pattern BOTAN_CIPHER_MODE_CBC
, BOTAN_CIPHER_MODE_CFB
, BOTAN_CIPHER_MODE_XTS
:: (Eq a, IsString a) => a
pattern $mBOTAN_CIPHER_MODE_CBC :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_MODE_CBC :: forall a. (Eq a, IsString a) => a
BOTAN_CIPHER_MODE_CBC = "CBC"
pattern $mBOTAN_CIPHER_MODE_CFB :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_MODE_CFB :: forall a. (Eq a, IsString a) => a
BOTAN_CIPHER_MODE_CFB = "CFB"
pattern $mBOTAN_CIPHER_MODE_XTS :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_MODE_XTS :: forall a. (Eq a, IsString a) => a
BOTAN_CIPHER_MODE_XTS = "XTS"
pattern BOTAN_CBC_PADDING_PKCS7
, BOTAN_CBC_PADDING_ONE_AND_ZEROS
, BOTAN_CBC_PADDING_X9_23
, BOTAN_CBC_PADDING_ESP
, BOTAN_CBC_PADDING_CTS
, BOTAN_CBC_PADDING_NO_PADDING
:: (Eq a, IsString a) => a
pattern $mBOTAN_CBC_PADDING_PKCS7 :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_PKCS7 :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_PKCS7 = "PKCS7"
pattern $mBOTAN_CBC_PADDING_ONE_AND_ZEROS :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_ONE_AND_ZEROS :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_ONE_AND_ZEROS = "OneAndZeros"
pattern $mBOTAN_CBC_PADDING_X9_23 :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_X9_23 :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_X9_23 = "X9.23"
pattern $mBOTAN_CBC_PADDING_ESP :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_ESP :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_ESP = "ESP"
pattern $mBOTAN_CBC_PADDING_CTS :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_CTS :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_CTS = "CTS"
pattern $mBOTAN_CBC_PADDING_NO_PADDING :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CBC_PADDING_NO_PADDING :: forall a. (Eq a, IsString a) => a
BOTAN_CBC_PADDING_NO_PADDING = "NoPadding"
pattern BOTAN_AEAD_CHACHA20POLY1305
:: (Eq a, IsString a) => a
pattern $mBOTAN_AEAD_CHACHA20POLY1305 :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_CHACHA20POLY1305 :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_CHACHA20POLY1305 = "ChaCha20Poly1305"
pattern BOTAN_AEAD_MODE_GCM
, BOTAN_AEAD_MODE_OCB
, BOTAN_AEAD_MODE_EAX
, BOTAN_AEAD_MODE_SIV
, BOTAN_AEAD_MODE_CCM
:: (Eq a, IsString a) => a
pattern $mBOTAN_AEAD_MODE_GCM :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_MODE_GCM :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_MODE_GCM = "GCM"
pattern $mBOTAN_AEAD_MODE_OCB :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_MODE_OCB :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_MODE_OCB = "OCB"
pattern $mBOTAN_AEAD_MODE_EAX :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_MODE_EAX :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_MODE_EAX = "EAX"
pattern $mBOTAN_AEAD_MODE_SIV :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_MODE_SIV :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_MODE_SIV = "SIV"
pattern $mBOTAN_AEAD_MODE_CCM :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_AEAD_MODE_CCM :: forall a. (Eq a, IsString a) => a
BOTAN_AEAD_MODE_CCM = "CCM"
pattern BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION
, BOTAN_CIPHER_INIT_FLAG_ENCRYPT
, BOTAN_CIPHER_INIT_FLAG_DECRYPT
:: (Eq a, Num a) => a
pattern $mBOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION :: forall {r} {a}.
(Eq a, Num a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION :: forall a. (Eq a, Num a) => a
BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION = 1
{-# LINE 84 "src/Botan/Bindings/Cipher.hsc" #-}
pattern BOTAN_CIPHER_INIT_FLAG_ENCRYPT = 0
{-# LINE 85 "src/Botan/Bindings/Cipher.hsc" #-}
pattern BOTAN_CIPHER_INIT_FLAG_DECRYPT = 1
{-# LINE 86 "src/Botan/Bindings/Cipher.hsc" #-}
foreign import capi safe "botan/ffi.h botan_cipher_init"
botan_cipher_init
:: Ptr BotanCipher
-> ConstPtr CChar
-> Word32
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_name"
botan_cipher_name
:: BotanCipher
-> Ptr CChar
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_output_length"
botan_cipher_output_length
:: BotanCipher
-> CSize
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_valid_nonce_length"
botan_cipher_valid_nonce_length
:: BotanCipher
-> CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_get_tag_length"
botan_cipher_get_tag_length
:: BotanCipher
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_get_default_nonce_length"
botan_cipher_get_default_nonce_length
:: BotanCipher
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_get_update_granularity"
botan_cipher_get_update_granularity
:: BotanCipher
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_get_ideal_update_granularity"
botan_cipher_get_ideal_update_granularity
:: BotanCipher
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_query_keylen"
botan_cipher_query_keylen
:: BotanCipher
-> Ptr CSize
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_get_keyspec"
botan_cipher_get_keyspec
:: BotanCipher
-> Ptr CSize
-> Ptr CSize
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_set_key"
botan_cipher_set_key
:: BotanCipher
-> ConstPtr Word8
-> CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_reset"
botan_cipher_reset
:: BotanCipher
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_set_associated_data"
botan_cipher_set_associated_data
:: BotanCipher
-> ConstPtr Word8
-> CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_start"
botan_cipher_start
:: BotanCipher
-> ConstPtr Word8
-> CSize
-> IO CInt
pattern BOTAN_CIPHER_UPDATE_FLAG_NONE
, BOTAN_CIPHER_UPDATE_FLAG_FINAL
:: (Eq a, Num a) => a
pattern $mBOTAN_CIPHER_UPDATE_FLAG_NONE :: forall {r} {a}.
(Eq a, Num a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_UPDATE_FLAG_NONE :: forall a. (Eq a, Num a) => a
BOTAN_CIPHER_UPDATE_FLAG_NONE = 0
pattern $mBOTAN_CIPHER_UPDATE_FLAG_FINAL :: forall {r} {a}.
(Eq a, Num a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bBOTAN_CIPHER_UPDATE_FLAG_FINAL :: forall a. (Eq a, Num a) => a
BOTAN_CIPHER_UPDATE_FLAG_FINAL = 1
{-# LINE 211 "src/Botan/Bindings/Cipher.hsc" #-}
foreign import capi safe "botan/ffi.h botan_cipher_update"
botan_cipher_update
:: BotanCipher
-> Word32
-> Ptr Word8
-> CSize
-> Ptr CSize
-> ConstPtr Word8
-> CSize
-> Ptr CSize
-> IO CInt
foreign import capi safe "botan/ffi.h botan_cipher_clear"
botan_cipher_clear
:: BotanCipher
-> IO CInt