summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-29 16:56:13 -0500
committerjoe <joe@jerkface.net>2017-11-29 16:56:13 -0500
commitc604eeb6046c27fefc6eefbf389f21c989a55929 (patch)
tree1934f8fb61ba61e86eb64f38171f64d866f50025
parentb116e11ef79e1b3f290e3c6994bfe52dd9ab27e5 (diff)
Disabled curve 25519 backport for newer cryptonite library.
-rw-r--r--Presence/Presence.hs5
-rw-r--r--dht-client.cabal39
-rw-r--r--src/Crypto/Tox.hs7
-rw-r--r--src/Network/Tox.hs8
-rw-r--r--src/Network/Tox/NodeId.hs5
-rw-r--r--src/Network/Tox/Onion/Handlers.hs5
6 files changed, 52 insertions, 17 deletions
diff --git a/Presence/Presence.hs b/Presence/Presence.hs
index ed1c5033..c556a170 100644
--- a/Presence/Presence.hs
+++ b/Presence/Presence.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE ExistentialQuantification #-} 2{-# LANGUAGE ExistentialQuantification #-}
2{-# LANGUAGE LambdaCase #-} 3{-# LANGUAGE LambdaCase #-}
3{-# LANGUAGE OverloadedStrings #-} 4{-# LANGUAGE OverloadedStrings #-}
@@ -38,7 +39,11 @@ import Data.Int (Int8)
38import Data.XML.Types (Event) 39import Data.XML.Types (Event)
39import System.Posix.Types (UserID,CPid) 40import System.Posix.Types (UserID,CPid)
40import Control.Applicative 41import Control.Applicative
42#ifdef CRYPTONITE_BACKPORT
41import Crypto.Error.Types (CryptoFailable (..)) 43import Crypto.Error.Types (CryptoFailable (..))
44#else
45import Crypto.Error
46#endif
42import Crypto.PubKey.Curve25519 (SecretKey,toPublic) 47import Crypto.PubKey.Curve25519 (SecretKey,toPublic)
43import Text.Read (readMaybe) 48import Text.Read (readMaybe)
44 49
diff --git a/dht-client.cabal b/dht-client.cabal
index 023f837e..b71f75de 100644
--- a/dht-client.cabal
+++ b/dht-client.cabal
@@ -56,13 +56,17 @@ flag xmpp
56 description: Include code for xmpp clients 56 description: Include code for xmpp clients
57 default: True 57 default: True
58 58
59flag cryptonite-backport
60 description: Backport curve 25519 to older cryptonite library.
61 default: False
62
59library 63library
60 default-language: Haskell2010 64 default-language: Haskell2010
61 default-extensions: PatternGuards 65 default-extensions: PatternGuards
62 , OverloadedStrings 66 , OverloadedStrings
63 , RecordWildCards 67 , RecordWildCards
64 , NondecreasingIndentation 68 , NondecreasingIndentation
65 hs-source-dirs: src, cryptonite-backport, ., Presence 69 hs-source-dirs: src, ., Presence
66 exposed-modules: Network.SocketLike 70 exposed-modules: Network.SocketLike
67 Data.Digest.CRC32C 71 Data.Digest.CRC32C
68 Data.Bits.ByteString 72 Data.Bits.ByteString
@@ -152,7 +156,6 @@ library
152 , contravariant 156 , contravariant
153 , xml-types 157 , xml-types
154 158
155 , cryptonite
156 , memory 159 , memory
157 , time 160 , time
158 , random 161 , random
@@ -199,20 +202,8 @@ library
199 202
200 203
201 other-modules: Paths_dht_client 204 other-modules: Paths_dht_client
202 Crypto.Cipher.Salsa
203 Crypto.Cipher.XSalsa
204 Crypto.ECC.Class
205 Crypto.ECC.Simple.Prim
206 Crypto.ECC.Simple.Types
207 Crypto.Error.Types
208 Crypto.Internal.ByteArray
209 Crypto.Internal.Compat
210 Crypto.Internal.DeepSeq
211 Crypto.Internal.Imports
212 Crypto.PubKey.Curve25519
213 205
214 C-sources: cbits/cryptonite_xsalsa.c, cbits/cryptonite_salsa.c, 206 C-sources: Presence/monitortty.c
215 Presence/monitortty.c
216 207
217 -- if flag(aeson) 208 -- if flag(aeson)
218 build-depends: aeson, aeson-pretty, unordered-containers, vector 209 build-depends: aeson, aeson-pretty, unordered-containers, vector
@@ -231,6 +222,24 @@ library
231 ghc-options: -fwarn-missing-signatures -fdefer-typed-holes 222 ghc-options: -fwarn-missing-signatures -fdefer-typed-holes
232 ghc-prof-options: 223 ghc-prof-options:
233 224
225 if flag(cryptonite-backport)
226 cpp-options: -DCRYPTONITE_BACKPORT
227 hs-source-dirs: cryptonite-backport
228 C-sources: cbits/cryptonite_xsalsa.c, cbits/cryptonite_salsa.c,
229 other-modules: Crypto.Cipher.Salsa
230 Crypto.Cipher.XSalsa
231 Crypto.ECC.Class
232 Crypto.ECC.Simple.Prim
233 Crypto.ECC.Simple.Types
234 Crypto.Error.Types
235 Crypto.Internal.ByteArray
236 Crypto.Internal.Compat
237 Crypto.Internal.DeepSeq
238 Crypto.Internal.Imports
239 Crypto.PubKey.Curve25519
240 build-depends: cryptonite < 0.22
241 else
242 build-depends: cryptonite >= 0.22
234 243
235executable dht 244executable dht
236 hs-source-dirs: examples 245 hs-source-dirs: examples
diff --git a/src/Crypto/Tox.hs b/src/Crypto/Tox.hs
index a43e3379..8bb822d8 100644
--- a/src/Crypto/Tox.hs
+++ b/src/Crypto/Tox.hs
@@ -63,7 +63,6 @@ import Control.Monad
63import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric 63import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric
64import qualified Crypto.Cipher.Salsa as Salsa 64import qualified Crypto.Cipher.Salsa as Salsa
65import qualified Crypto.Cipher.XSalsa as XSalsa 65import qualified Crypto.Cipher.XSalsa as XSalsa
66import Crypto.ECC.Class
67import qualified Crypto.Error as Cryptonite 66import qualified Crypto.Error as Cryptonite
68import qualified Crypto.MAC.Poly1305 as Poly1305 67import qualified Crypto.MAC.Poly1305 as Poly1305
69import Crypto.PubKey.Curve25519 68import Crypto.PubKey.Curve25519
@@ -90,7 +89,13 @@ import Foreign.Storable
90import System.Endian 89import System.Endian
91import qualified Data.ByteString.Internal 90import qualified Data.ByteString.Internal
92import Control.Concurrent.STM 91import Control.Concurrent.STM
92#ifdef CRYPTONITE_BACKPORT
93import Crypto.ECC.Class
93import Crypto.Error.Types (CryptoFailable (..), throwCryptoError) 94import Crypto.Error.Types (CryptoFailable (..), throwCryptoError)
95#else
96import Crypto.ECC
97import Crypto.Error
98#endif
94import Network.Socket (SockAddr) 99import Network.Socket (SockAddr)
95import GHC.Exts (Word(..),inline) 100import GHC.Exts (Word(..),inline)
96import GHC.Prim 101import GHC.Prim
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index aa95df81..b3c4cedc 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE DeriveDataTypeable #-} 2{-# LANGUAGE DeriveDataTypeable #-}
2{-# LANGUAGE DeriveFoldable #-} 3{-# LANGUAGE DeriveFoldable #-}
3{-# LANGUAGE DeriveFunctor #-} 4{-# LANGUAGE DeriveFunctor #-}
@@ -25,9 +26,14 @@ import Control.Monad.Fix
25import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric 26import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric
26import qualified Crypto.Cipher.Salsa as Salsa 27import qualified Crypto.Cipher.Salsa as Salsa
27import qualified Crypto.Cipher.XSalsa as XSalsa 28import qualified Crypto.Cipher.XSalsa as XSalsa
28import Crypto.ECC.Class
29import qualified Crypto.Error as Cryptonite 29import qualified Crypto.Error as Cryptonite
30#ifdef CRYPTONITE_BACKPORT
31import Crypto.ECC.Class
30import Crypto.Error.Types 32import Crypto.Error.Types
33#else
34import Crypto.ECC
35import Crypto.Error
36#endif
31import qualified Crypto.MAC.Poly1305 as Poly1305 37import qualified Crypto.MAC.Poly1305 as Poly1305
32import Crypto.PubKey.Curve25519 38import Crypto.PubKey.Curve25519
33import Crypto.PubKey.ECC.Types 39import Crypto.PubKey.ECC.Types
diff --git a/src/Network/Tox/NodeId.hs b/src/Network/Tox/NodeId.hs
index 0ffc3d22..fbf6702a 100644
--- a/src/Network/Tox/NodeId.hs
+++ b/src/Network/Tox/NodeId.hs
@@ -37,8 +37,13 @@ import Debug.Trace
37import Control.Applicative 37import Control.Applicative
38import Control.Arrow 38import Control.Arrow
39import Control.Monad 39import Control.Monad
40#ifdef CRYPTONITE_BACKPORT
40import Crypto.Error.Types (CryptoFailable (..), 41import Crypto.Error.Types (CryptoFailable (..),
41 throwCryptoError) 42 throwCryptoError)
43#else
44import Crypto.Error
45#endif
46
42import Crypto.PubKey.Curve25519 47import Crypto.PubKey.Curve25519
43import qualified Data.Aeson as JSON 48import qualified Data.Aeson as JSON
44 ;import Data.Aeson (FromJSON, ToJSON, (.=)) 49 ;import Data.Aeson (FromJSON, ToJSON, (.=))
diff --git a/src/Network/Tox/Onion/Handlers.hs b/src/Network/Tox/Onion/Handlers.hs
index e792aa50..af515315 100644
--- a/src/Network/Tox/Onion/Handlers.hs
+++ b/src/Network/Tox/Onion/Handlers.hs
@@ -1,3 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE LambdaCase #-} 2{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE PatternSynonyms #-} 3{-# LANGUAGE PatternSynonyms #-}
3module Network.Tox.Onion.Handlers where 4module Network.Tox.Onion.Handlers where
@@ -11,8 +12,12 @@ import qualified Network.QueryResponse as QR (Client)
11import Crypto.Tox 12import Crypto.Tox
12import qualified Data.Wrapper.PSQ as PSQ 13import qualified Data.Wrapper.PSQ as PSQ
13 ;import Data.Wrapper.PSQ (PSQ) 14 ;import Data.Wrapper.PSQ (PSQ)
15#ifdef CRYPTONITE_BACKPORT
14import Crypto.Error.Types (CryptoFailable (..), 16import Crypto.Error.Types (CryptoFailable (..),
15 throwCryptoError) 17 throwCryptoError)
18#else
19import Crypto.Error
20#endif
16import Control.Arrow 21import Control.Arrow
17 22
18import System.IO 23import System.IO