summaryrefslogtreecommitdiff
path: root/src/Crypto/Tox.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Crypto/Tox.hs')
-rw-r--r--src/Crypto/Tox.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Crypto/Tox.hs b/src/Crypto/Tox.hs
index 307a5db5..37725aea 100644
--- a/src/Crypto/Tox.hs
+++ b/src/Crypto/Tox.hs
@@ -29,7 +29,8 @@ module Crypto.Tox
29 , Plain 29 , Plain
30 , encodePlain 30 , encodePlain
31 , decodePlain 31 , decodePlain
32 , computeSharedSecret 32 -- , computeSharedSecret
33 , lookupSharedSecret
33 , encrypt 34 , encrypt
34 , decrypt 35 , decrypt
35 , Nonce8(..) 36 , Nonce8(..)
@@ -98,6 +99,8 @@ newtype Encrypted8 a = E8 (Encrypted (a,Nonce8))
98 99
99newtype (f ∘ g) x = Composed { uncomposed :: f (g x) } 100newtype (f ∘ g) x = Composed { uncomposed :: f (g x) }
100 101
102infixr ∘
103
101newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess) 104newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess)
102instance Ord Auth where 105instance Ord Auth where
103 compare (Auth a) (Auth b) = comparing (BA.convert :: Poly1305.Auth -> Bytes) a b 106 compare (Auth a) (Auth b) = comparing (BA.convert :: Poly1305.Auth -> Bytes) a b
@@ -246,6 +249,11 @@ computeSharedSecret sk recipient nonce = State hash crypt
246 -- Since rs is 32 bytes, this pattern should never fail... 249 -- Since rs is 32 bytes, this pattern should never fail...
247 Cryptonite.CryptoPassed hash = Poly1305.initialize rs 250 Cryptonite.CryptoPassed hash = Poly1305.initialize rs
248 251
252lookupSharedSecret :: TransportCrypto -> SecretKey -> PublicKey -> Nonce24 -> IO State
253lookupSharedSecret crypto sk recipient nonce = do
254 -- TODO
255 return $ computeSharedSecret sk recipient nonce
256
249hsalsa20 :: (ByteArrayAccess t, ByteArrayAccess t1) => t1 -> t -> BA.ScrubbedBytes 257hsalsa20 :: (ByteArrayAccess t, ByteArrayAccess t1) => t1 -> t -> BA.ScrubbedBytes
250hsalsa20 k n = BA.append a b 258hsalsa20 k n = BA.append a b
251 where 259 where