summaryrefslogtreecommitdiff
path: root/src/crypto/reflibs/Crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/reflibs/Crypto')
-rw-r--r--src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs b/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
index 7f0ef20..9071d9f 100644
--- a/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
+++ b/src/crypto/reflibs/Crypto/Cipher/ChaChaPoly1305.hs
@@ -54,17 +54,17 @@ aeadAppendAAD aad st = st { stAAD = stAAD st ++ [ aad ] }
aeadFinalizeAAD :: AeadState -> AeadState
aeadFinalizeAAD = id
-encrypt :: ByteArray ba => ba -> AeadState -> ( ba, AeadState )
+encrypt :: ByteString -> AeadState -> ( ByteString, AeadState )
encrypt ptext st =
let Nonce nonce = stNonce st
- ( ctext, mac ) = P.encrypt (B.concat $ stAAD st) (stKey st) nonce (convert ptext)
- in ( convert ctext, st { stAuth = Just $ Auth mac } )
+ ( ctext, mac ) = P.encrypt (B.concat $ stAAD st) (stKey st) nonce ptext
+ in ( ctext, st { stAuth = Just $ Auth mac } )
-decrypt :: ByteArray ba => ( ba, Auth ) -> AeadState -> Maybe ba
+decrypt :: ( ByteString, Auth ) -> AeadState -> Maybe ByteString
decrypt ( ctext, auth ) st = do
let Nonce nonce = stNonce st
Auth mac = auth
- fmap convert $ P.decrypt (B.concat $ stAAD st) (stKey st) nonce ( convert ctext, mac )
+ P.decrypt (B.concat $ stAAD st) (stKey st) nonce ( ctext, mac )
aeadFinalize :: AeadState -> Auth
aeadFinalize st = case stAuth st of