summaryrefslogtreecommitdiffhomepage
path: root/Encryption.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-10-07 10:18:31 -0400
committerJoey Hess <joeyh@joeyh.name>2016-10-07 10:21:02 -0400
commit3e432c60d2c6b3fecd920e8053ba4e9a75965dbd (patch)
tree4d6d8bda9efe4fae54e5509703b30aa2097239f9 /Encryption.hs
parent8069f11684819fb229cfe9e40c680732776c7c9c (diff)
downloadkeysafe-3e432c60d2c6b3fecd920e8053ba4e9a75965dbd.tar.gz
Removed dependency on crypto-random.
Use raaz for random bytestring generation exclusively. It was already used in all important places, but chaffing was using crypto-random. Note that System.Random is used for delays during chaffing and by random-shuffle.
Diffstat (limited to 'Encryption.hs')
-rw-r--r--Encryption.hs8
1 files changed, 1 insertions, 7 deletions
diff --git a/Encryption.hs b/Encryption.hs
index 12edbc6..880095d 100644
--- a/Encryption.hs
+++ b/Encryption.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedStrings, MultiParamTypeClasses, DataKinds #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
{- Copyright 2016 Joey Hess <id@joeyh.name>
-
@@ -15,8 +14,6 @@ import ExpensiveHash
import ByteStrings
import Data.Monoid
import Data.Maybe
-import Data.Word
-import Control.Monad
import qualified Raaz
import qualified Raaz.Cipher.AES as Raaz
import qualified Raaz.Cipher.Internal as Raaz
@@ -152,12 +149,9 @@ genIV (Name name) =
type SaltPrefix = B.ByteString
genRandomSaltPrefix :: Raaz.SystemPRG -> Tunables -> IO SaltPrefix
-genRandomSaltPrefix prg tunables = B.pack <$> replicateM n randbyte
+genRandomSaltPrefix prg tunables = randomByteStringOfLength n prg
where
n = randomSaltBytes $ keyEncryptionKeyTunable tunables
- randbyte = Raaz.random prg :: IO Word8
-
-instance Raaz.Random Word8
-- | Make an AES key out of a hash value.
--