diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-03-03 15:44:01 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-03-03 15:49:51 -0400 |
commit | fc39ddb96af70c14c5de739408b03a14ef2053bf (patch) | |
tree | d81aedc573531e1e0e45d110a1eae1e12c296d21 /Storage.hs | |
parent | 0e5dac41b5d08d72c3799d9cc52de0ed95c2e870 (diff) | |
download | keysafe-fc39ddb96af70c14c5de739408b03a14ef2053bf.tar.gz |
Updated to use raaz-0.1.1.
This commit was sponsored by John Peloquin on Patreon.
Diffstat (limited to 'Storage.hs')
-rw-r--r-- | Storage.hs | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -26,7 +26,6 @@ import Control.Concurrent.Async import qualified Data.Set as S import System.Random import System.Random.Shuffle -import qualified Raaz networkStorageLocations :: Maybe LocalStorageDirectory -> StorageLocations networkStorageLocations = StorageLocations . serverList @@ -171,25 +170,24 @@ storeChaff :: HostName -> Port -> Maybe Seconds -> IO () storeChaff hn port delayseconds = forever $ do say $ "Sending chaff to " ++ hn ++ " (press ctrl-c to stop)" say "Legend: + = successful upload, ! = upload failure" - prg <- Raaz.newPRG () :: IO Raaz.SystemPRG - randomname <- randomByteStringOfLength 128 prg + randomname <- randomByteStringOfLength 128 -- It's ok the use the testModeTunables here because -- the randomname is not something that can be feasibly guessed. -- Prefix "random chaff" to the name to avoid ever using a name -- that a real user might want to use. let sis = shareIdents testModeTunables (Name $ "random chaff:" <> randomname) AnyGpgKey - mapConcurrently (go sis prg) + mapConcurrently (go sis) [1..totalObjects (shareParams testModeTunables)] where server = networkStorage Untrusted Nothing $ Server (ServerName hn) [ServerAddress hn port] "chaff server" objsize = objectSize defaultTunables * shareOverhead defaultTunables maxmsdelay = ceiling $ 1000000 * fromMaybe 0 delayseconds - go sis prg n = do + go sis n = do msdelay <- getStdRandom (randomR (0, maxmsdelay)) delay msdelay - b <- randomByteStringOfLength objsize prg + b <- randomByteStringOfLength objsize let share = Share 0 (StorableObject b) let (is, sis') = nextShareIdents sis let i = S.toList is !! (n - 1) @@ -197,7 +195,7 @@ storeChaff hn port delayseconds = forever $ do case r of StoreSuccess -> progress "+" _ -> progress "!" - go sis' prg n + go sis' n -- | Shuffles the list, keeping Recommended first, then -- Alternate, and finally Untrusted. |