diff options
author | joe <joe@jerkface.net> | 2017-11-29 16:56:13 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-11-29 16:56:13 -0500 |
commit | c604eeb6046c27fefc6eefbf389f21c989a55929 (patch) | |
tree | 1934f8fb61ba61e86eb64f38171f64d866f50025 | |
parent | b116e11ef79e1b3f290e3c6994bfe52dd9ab27e5 (diff) |
Disabled curve 25519 backport for newer cryptonite library.
-rw-r--r-- | Presence/Presence.hs | 5 | ||||
-rw-r--r-- | dht-client.cabal | 39 | ||||
-rw-r--r-- | src/Crypto/Tox.hs | 7 | ||||
-rw-r--r-- | src/Network/Tox.hs | 8 | ||||
-rw-r--r-- | src/Network/Tox/NodeId.hs | 5 | ||||
-rw-r--r-- | src/Network/Tox/Onion/Handlers.hs | 5 |
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) | |||
38 | import Data.XML.Types (Event) | 39 | import Data.XML.Types (Event) |
39 | import System.Posix.Types (UserID,CPid) | 40 | import System.Posix.Types (UserID,CPid) |
40 | import Control.Applicative | 41 | import Control.Applicative |
42 | #ifdef CRYPTONITE_BACKPORT | ||
41 | import Crypto.Error.Types (CryptoFailable (..)) | 43 | import Crypto.Error.Types (CryptoFailable (..)) |
44 | #else | ||
45 | import Crypto.Error | ||
46 | #endif | ||
42 | import Crypto.PubKey.Curve25519 (SecretKey,toPublic) | 47 | import Crypto.PubKey.Curve25519 (SecretKey,toPublic) |
43 | import Text.Read (readMaybe) | 48 | import 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 | ||
59 | flag cryptonite-backport | ||
60 | description: Backport curve 25519 to older cryptonite library. | ||
61 | default: False | ||
62 | |||
59 | library | 63 | library |
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 | ||
235 | executable dht | 244 | executable 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 | |||
63 | import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric | 63 | import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric |
64 | import qualified Crypto.Cipher.Salsa as Salsa | 64 | import qualified Crypto.Cipher.Salsa as Salsa |
65 | import qualified Crypto.Cipher.XSalsa as XSalsa | 65 | import qualified Crypto.Cipher.XSalsa as XSalsa |
66 | import Crypto.ECC.Class | ||
67 | import qualified Crypto.Error as Cryptonite | 66 | import qualified Crypto.Error as Cryptonite |
68 | import qualified Crypto.MAC.Poly1305 as Poly1305 | 67 | import qualified Crypto.MAC.Poly1305 as Poly1305 |
69 | import Crypto.PubKey.Curve25519 | 68 | import Crypto.PubKey.Curve25519 |
@@ -90,7 +89,13 @@ import Foreign.Storable | |||
90 | import System.Endian | 89 | import System.Endian |
91 | import qualified Data.ByteString.Internal | 90 | import qualified Data.ByteString.Internal |
92 | import Control.Concurrent.STM | 91 | import Control.Concurrent.STM |
92 | #ifdef CRYPTONITE_BACKPORT | ||
93 | import Crypto.ECC.Class | ||
93 | import Crypto.Error.Types (CryptoFailable (..), throwCryptoError) | 94 | import Crypto.Error.Types (CryptoFailable (..), throwCryptoError) |
95 | #else | ||
96 | import Crypto.ECC | ||
97 | import Crypto.Error | ||
98 | #endif | ||
94 | import Network.Socket (SockAddr) | 99 | import Network.Socket (SockAddr) |
95 | import GHC.Exts (Word(..),inline) | 100 | import GHC.Exts (Word(..),inline) |
96 | import GHC.Prim | 101 | import 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 | |||
25 | import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric | 26 | import qualified Crypto.Cipher.ChaChaPoly1305 as Symmetric |
26 | import qualified Crypto.Cipher.Salsa as Salsa | 27 | import qualified Crypto.Cipher.Salsa as Salsa |
27 | import qualified Crypto.Cipher.XSalsa as XSalsa | 28 | import qualified Crypto.Cipher.XSalsa as XSalsa |
28 | import Crypto.ECC.Class | ||
29 | import qualified Crypto.Error as Cryptonite | 29 | import qualified Crypto.Error as Cryptonite |
30 | #ifdef CRYPTONITE_BACKPORT | ||
31 | import Crypto.ECC.Class | ||
30 | import Crypto.Error.Types | 32 | import Crypto.Error.Types |
33 | #else | ||
34 | import Crypto.ECC | ||
35 | import Crypto.Error | ||
36 | #endif | ||
31 | import qualified Crypto.MAC.Poly1305 as Poly1305 | 37 | import qualified Crypto.MAC.Poly1305 as Poly1305 |
32 | import Crypto.PubKey.Curve25519 | 38 | import Crypto.PubKey.Curve25519 |
33 | import Crypto.PubKey.ECC.Types | 39 | import 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 | |||
37 | import Control.Applicative | 37 | import Control.Applicative |
38 | import Control.Arrow | 38 | import Control.Arrow |
39 | import Control.Monad | 39 | import Control.Monad |
40 | #ifdef CRYPTONITE_BACKPORT | ||
40 | import Crypto.Error.Types (CryptoFailable (..), | 41 | import Crypto.Error.Types (CryptoFailable (..), |
41 | throwCryptoError) | 42 | throwCryptoError) |
43 | #else | ||
44 | import Crypto.Error | ||
45 | #endif | ||
46 | |||
42 | import Crypto.PubKey.Curve25519 | 47 | import Crypto.PubKey.Curve25519 |
43 | import qualified Data.Aeson as JSON | 48 | import 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 #-} |
3 | module Network.Tox.Onion.Handlers where | 4 | module Network.Tox.Onion.Handlers where |
@@ -11,8 +12,12 @@ import qualified Network.QueryResponse as QR (Client) | |||
11 | import Crypto.Tox | 12 | import Crypto.Tox |
12 | import qualified Data.Wrapper.PSQ as PSQ | 13 | import qualified Data.Wrapper.PSQ as PSQ |
13 | ;import Data.Wrapper.PSQ (PSQ) | 14 | ;import Data.Wrapper.PSQ (PSQ) |
15 | #ifdef CRYPTONITE_BACKPORT | ||
14 | import Crypto.Error.Types (CryptoFailable (..), | 16 | import Crypto.Error.Types (CryptoFailable (..), |
15 | throwCryptoError) | 17 | throwCryptoError) |
18 | #else | ||
19 | import Crypto.Error | ||
20 | #endif | ||
16 | import Control.Arrow | 21 | import Control.Arrow |
17 | 22 | ||
18 | import System.IO | 23 | import System.IO |