Minor haddock fixes
Fix some incorrect parameter descriptions and spelling/typos.
This commit is contained in:
parent
8cc91a7bfe
commit
4e1437d4fd
@ -166,7 +166,7 @@ withOCBKeyAndCopySt aes (AESOCB gcmSt) f =
|
|||||||
|
|
||||||
-- | Initialize a new context with a key
|
-- | Initialize a new context with a key
|
||||||
--
|
--
|
||||||
-- Key need to be of length 16, 24 or 32 bytes. any other values will cause undefined behavior
|
-- Key needs to be of length 16, 24 or 32 bytes. Any other values will return failure
|
||||||
initAES :: ByteArrayAccess key => key -> CryptoFailable AES
|
initAES :: ByteArrayAccess key => key -> CryptoFailable AES
|
||||||
initAES k
|
initAES k
|
||||||
| len == 16 = CryptoPassed $ initWithRounds 10
|
| len == 16 = CryptoPassed $ initWithRounds 10
|
||||||
@ -418,7 +418,7 @@ gcmInit ctx iv = unsafeDoIO $ do
|
|||||||
c_aes_gcm_init (castPtr gcmStPtr) k v (fromIntegral $ B.length iv)
|
c_aes_gcm_init (castPtr gcmStPtr) k v (fromIntegral $ B.length iv)
|
||||||
return $ AESGCM sm
|
return $ AESGCM sm
|
||||||
|
|
||||||
-- | append data which is going to just be authentified to the GCM context.
|
-- | append data which is only going to be authenticated to the GCM context.
|
||||||
--
|
--
|
||||||
-- need to happen after initialization and before appending encryption/decryption data.
|
-- need to happen after initialization and before appending encryption/decryption data.
|
||||||
{-# NOINLINE gcmAppendAAD #-}
|
{-# NOINLINE gcmAppendAAD #-}
|
||||||
@ -489,7 +489,7 @@ ocbInit ctx iv = unsafeDoIO $ do
|
|||||||
c_aes_ocb_init (castPtr ocbStPtr) k v (fromIntegral $ B.length iv)
|
c_aes_ocb_init (castPtr ocbStPtr) k v (fromIntegral $ B.length iv)
|
||||||
return $ AESOCB sm
|
return $ AESOCB sm
|
||||||
|
|
||||||
-- | append data which is going to just be authentified to the OCB context.
|
-- | append data which is going to just be authenticated to the OCB context.
|
||||||
--
|
--
|
||||||
-- need to happen after initialization and before appending encryption/decryption data.
|
-- need to happen after initialization and before appending encryption/decryption data.
|
||||||
{-# NOINLINE ocbAppendAAD #-}
|
{-# NOINLINE ocbAppendAAD #-}
|
||||||
|
|||||||
@ -49,10 +49,10 @@ aeadFinalize (AEAD impl st) n = (aeadImplFinalize impl) st n
|
|||||||
-- | Simple AEAD encryption
|
-- | Simple AEAD encryption
|
||||||
aeadSimpleEncrypt :: (ByteArrayAccess aad, ByteArray ba)
|
aeadSimpleEncrypt :: (ByteArrayAccess aad, ByteArray ba)
|
||||||
=> AEAD a -- ^ A new AEAD Context
|
=> AEAD a -- ^ A new AEAD Context
|
||||||
-> aad -- ^ Optional Authentified Header
|
-> aad -- ^ Optional Authentication data header
|
||||||
-> ba -- ^ Optional Plaintext
|
-> ba -- ^ Optional Plaintext
|
||||||
-> Int -- ^ Tag length
|
-> Int -- ^ Tag length
|
||||||
-> (AuthTag, ba) -- ^ Authentification tag and ciphertext
|
-> (AuthTag, ba) -- ^ Authentication tag and ciphertext
|
||||||
aeadSimpleEncrypt aeadIni header input taglen = (tag, output)
|
aeadSimpleEncrypt aeadIni header input taglen = (tag, output)
|
||||||
where aead = aeadAppendHeader aeadIni header
|
where aead = aeadAppendHeader aeadIni header
|
||||||
(output, aeadFinal) = aeadEncrypt aead input
|
(output, aeadFinal) = aeadEncrypt aead input
|
||||||
@ -61,9 +61,9 @@ aeadSimpleEncrypt aeadIni header input taglen = (tag, output)
|
|||||||
-- | Simple AEAD decryption
|
-- | Simple AEAD decryption
|
||||||
aeadSimpleDecrypt :: (ByteArrayAccess aad, ByteArray ba)
|
aeadSimpleDecrypt :: (ByteArrayAccess aad, ByteArray ba)
|
||||||
=> AEAD a -- ^ A new AEAD Context
|
=> AEAD a -- ^ A new AEAD Context
|
||||||
-> aad -- ^ Optional Authentified Header
|
-> aad -- ^ Optional Authentication data header
|
||||||
-> ba -- ^ Optional Plaintext
|
-> ba -- ^ Ciphertext
|
||||||
-> AuthTag -- ^ Tag length
|
-> AuthTag -- ^ The authentication tag
|
||||||
-> Maybe ba -- ^ Plaintext
|
-> Maybe ba -- ^ Plaintext
|
||||||
aeadSimpleDecrypt aeadIni header input authTag
|
aeadSimpleDecrypt aeadIni header input authTag
|
||||||
| tag == authTag = Just output
|
| tag == authTag = Just output
|
||||||
|
|||||||
@ -32,7 +32,7 @@ data KeySizeSpecifier =
|
|||||||
-- | Offset inside an XTS data unit, measured in block size.
|
-- | Offset inside an XTS data unit, measured in block size.
|
||||||
type DataUnitOffset = Word32
|
type DataUnitOffset = Word32
|
||||||
|
|
||||||
-- | Authentification Tag for AE cipher mode
|
-- | Authentication Tag for AE cipher mode
|
||||||
newtype AuthTag = AuthTag { unAuthTag :: Bytes }
|
newtype AuthTag = AuthTag { unAuthTag :: Bytes }
|
||||||
deriving (Show, ByteArrayAccess)
|
deriving (Show, ByteArrayAccess)
|
||||||
|
|
||||||
|
|||||||
@ -100,9 +100,9 @@ decryptSafer pk b = do
|
|||||||
blinder <- generateBlinder (private_n pk)
|
blinder <- generateBlinder (private_n pk)
|
||||||
return (decrypt (Just blinder) pk b)
|
return (decrypt (Just blinder) pk b)
|
||||||
|
|
||||||
-- | encrypt a bytestring using the public key and a CPRG random generator.
|
-- | encrypt a bytestring using the public key.
|
||||||
--
|
--
|
||||||
-- the message need to be smaller than the key size - 11
|
-- the message needs to be smaller than the key size - 11
|
||||||
encrypt :: MonadRandom m => PublicKey -> ByteString -> m (Either Error ByteString)
|
encrypt :: MonadRandom m => PublicKey -> ByteString -> m (Either Error ByteString)
|
||||||
encrypt pk m = do
|
encrypt pk m = do
|
||||||
r <- pad (public_size pk) m
|
r <- pad (public_size pk) m
|
||||||
|
|||||||
@ -75,7 +75,7 @@ data KAT_AEAD = KAT_AEAD
|
|||||||
{ aeadMode :: AEADMode
|
{ aeadMode :: AEADMode
|
||||||
, aeadKey :: ByteString -- ^ Key
|
, aeadKey :: ByteString -- ^ Key
|
||||||
, aeadIV :: ByteString -- ^ IV for initialization
|
, aeadIV :: ByteString -- ^ IV for initialization
|
||||||
, aeadHeader :: ByteString -- ^ Authentificated Header
|
, aeadHeader :: ByteString -- ^ Authenticated Header
|
||||||
, aeadPlaintext :: ByteString -- ^ Plaintext
|
, aeadPlaintext :: ByteString -- ^ Plaintext
|
||||||
, aeadCiphertext :: ByteString -- ^ Ciphertext
|
, aeadCiphertext :: ByteString -- ^ Ciphertext
|
||||||
, aeadTaglen :: Int -- ^ aead tag len
|
, aeadTaglen :: Int -- ^ aead tag len
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user