summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-09-04 19:06:09 -0400
committerjoe <joe@jerkface.net>2017-09-04 19:06:09 -0400
commit4f9ad88773271a46ed1df899ad9a360de6c09a4e (patch)
tree4126630dbfda2a87871db89006cd239cf91298e2
parent279605e44d6078f4171e81f5a9539e414d1a3d25 (diff)
Stubs for symmetric encryption.
-rw-r--r--ToxCrypto.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ToxCrypto.hs b/ToxCrypto.hs
index 87f64c9a..9dea7477 100644
--- a/ToxCrypto.hs
+++ b/ToxCrypto.hs
@@ -39,6 +39,8 @@ module ToxCrypto
39 , State(..) 39 , State(..)
40 , zeros32 40 , zeros32
41 , zeros24 41 , zeros24
42 , decryptSymmetric
43 , encryptSymmetric
42 ) where 44 ) where
43 45
44import qualified Crypto.Cipher.Salsa as Salsa 46import qualified Crypto.Cipher.Salsa as Salsa
@@ -162,6 +164,12 @@ storePlain a = Plain <$> BA.create (sizeOf a) (`poke` a)
162retrievePlain :: Storable a => Plain Storable a -> IO a 164retrievePlain :: Storable a => Plain Storable a -> IO a
163retrievePlain (Plain bs) = BA.withByteArray bs peek 165retrievePlain (Plain bs) = BA.withByteArray bs peek
164 166
167decryptSymmetric :: SymmetricKey -> Nonce24 -> Encrypted a -> Either String (Plain s a)
168decryptSymmetric sym nonce e = _todo
169
170encryptSymmetric :: SymmetricKey -> Nonce24 -> Plain s x -> Encrypted x
171encryptSymmetric = _todo
172
165data State = State Poly1305.State XSalsa.State 173data State = State Poly1305.State XSalsa.State
166 174
167decrypt :: State -> Encrypted a -> Either String (Plain s a) 175decrypt :: State -> Encrypted a -> Either String (Plain s a)