diff --git a/Crypto/Cipher/Salsa.hs b/Crypto/Cipher/Salsa.hs index da4c2bb..1297179 100644 --- a/Crypto/Cipher/Salsa.hs +++ b/Crypto/Cipher/Salsa.hs @@ -13,20 +13,18 @@ module Crypto.Cipher.Salsa , State ) where -import Control.Applicative import Data.SecureMem import Data.ByteString (ByteString) import qualified Data.ByteString.Internal as B import qualified Data.ByteString as B import Crypto.Internal.Compat +import Crypto.Internal.Imports import Data.Byteable -import Data.Word import Data.Bits (xor) import Foreign.Ptr import Foreign.ForeignPtr import Foreign.C.Types import Foreign.Storable -import System.IO.Unsafe -- | Salsa context data State = State Int -- number of rounds @@ -72,7 +70,7 @@ combine prev@(State nbRounds prevSt prevOut) src -- without having to generate any extra bytes let (b1,b2) = B.splitAt outputLen prevOut in (B.pack $ B.zipWith xor b1 src, State nbRounds prevSt b2) - | otherwise = unsafePerformIO $ do + | otherwise = unsafeDoIO $ do -- adjusted len is the number of bytes lefts to generate after -- copying from the previous buffer. let adjustedLen = outputLen - prevBufLen diff --git a/Crypto/Internal/ByteArray.hs b/Crypto/Internal/ByteArray.hs index 7960869..495e177 100644 --- a/Crypto/Internal/ByteArray.hs +++ b/Crypto/Internal/ByteArray.hs @@ -34,14 +34,13 @@ module Crypto.Internal.ByteArray , byteArrayMapAsWord128 ) where -import Control.Applicative ((<$>), (<*>)) -import Data.Word import Data.SecureMem import Crypto.Internal.Memory import Crypto.Internal.Compat import Crypto.Internal.Endian import Crypto.Internal.Bytes (bufXor, bufCopy, bufSet) import Crypto.Internal.Words +import Crypto.Internal.Imports hiding (empty) import Foreign.Ptr import Foreign.Storable import Foreign.ForeignPtr diff --git a/Crypto/Internal/Bytes.hs b/Crypto/Internal/Bytes.hs index 17be2e7..b6e2fbb 100644 --- a/Crypto/Internal/Bytes.hs +++ b/Crypto/Internal/Bytes.hs @@ -16,14 +16,13 @@ module Crypto.Internal.Bytes , bufSet ) where -import Control.Applicative ((<$>), (<*>)) +import Crypto.Internal.Imports import Foreign.Ptr (Ptr, plusPtr) import Foreign.ForeignPtr (withForeignPtr) import Foreign.Storable (peek, poke, pokeByteOff) import Foreign.Marshal.Alloc (allocaBytesAligned) import Data.ByteString (ByteString) import Data.Bits (xor) -import Data.Word (Word8) import Data.ByteString.Internal (toForeignPtr) import Data.ByteString.Internal (memcpy) diff --git a/Crypto/Number/F2m.hs b/Crypto/Number/F2m.hs index ce4677d..3eb6749 100644 --- a/Crypto/Number/F2m.hs +++ b/Crypto/Number/F2m.hs @@ -22,9 +22,9 @@ module Crypto.Number.F2m , divF2m ) where -import Control.Applicative ((<$>)) import Data.Bits ((.&.),(.|.),xor,shift,testBit) import Crypto.Number.Basic +import Crypto.Internal.Imports type BinaryPolynomial = Integer diff --git a/Crypto/Number/Generate.hs b/Crypto/Number/Generate.hs index 292b3e7..79081cf 100644 --- a/Crypto/Number/Generate.hs +++ b/Crypto/Number/Generate.hs @@ -12,12 +12,12 @@ module Crypto.Number.Generate , generateBits ) where -import Control.Applicative -import Crypto.Number.Basic -import Crypto.Number.Serialize -import Crypto.Random.Types +import Crypto.Internal.Imports +import Crypto.Number.Basic +import Crypto.Number.Serialize +import Crypto.Random.Types import qualified Data.ByteString as B -import Data.Bits ((.|.), (.&.), shiftR) +import Data.Bits ((.|.), (.&.), shiftR) -- | generate a positive integer x, s.t. 0 <= x < m diff --git a/Crypto/Number/Prime.hs b/Crypto/Number/Prime.hs index 33750f2..ddf0835 100644 --- a/Crypto/Number/Prime.hs +++ b/Crypto/Number/Prime.hs @@ -26,7 +26,7 @@ module Crypto.Number.Prime , isCoprime ) where -import Control.Applicative +import Crypto.Internal.Imports import Crypto.Number.Generate import Crypto.Number.Basic (sqrti, gcde_binary) diff --git a/Crypto/PubKey/Curve25519.hs b/Crypto/PubKey/Curve25519.hs index a4dfb53..83f8cfe 100644 --- a/Crypto/PubKey/Curve25519.hs +++ b/Crypto/PubKey/Curve25519.hs @@ -22,7 +22,6 @@ module Crypto.PubKey.Curve25519 , toPublic ) where -import Control.Applicative import Data.Byteable import Data.ByteString (ByteString) import Data.ByteString.Char8 () @@ -32,6 +31,7 @@ import Data.Word import Foreign.Ptr import Crypto.Internal.Compat +import Crypto.Internal.Imports -- | A Curve25519 Secret key newtype SecretKey = SecretKey SecureMem diff --git a/Crypto/PubKey/DH.hs b/Crypto/PubKey/DH.hs index b3ad183..d87b1f0 100644 --- a/Crypto/PubKey/DH.hs +++ b/Crypto/PubKey/DH.hs @@ -19,7 +19,7 @@ module Crypto.PubKey.DH , getShared ) where -import Control.Applicative +import Crypto.Internal.Imports import Crypto.Number.ModArithmetic (expSafe) import Crypto.Number.Prime (generateSafePrime) import Crypto.Number.Generate (generateMax)