cleanup module imports
This commit is contained in:
parent
63cd28e3c2
commit
b487aef898
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user