diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-07 16:25:12 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-07 16:25:12 -0400 |
commit | 39707fda6289740729bef8cb214a2bf3f555b86e (patch) | |
tree | 98fa699a499b2ef679f88785d65aaee445c748c4 /Tunables.hs | |
parent | 460edfad8ed45412050822dfdf84f2d54015fb04 (diff) | |
download | keysafe-39707fda6289740729bef8cb214a2bf3f555b86e.tar.gz |
finish AES decryption puzzle implementation
Diffstat (limited to 'Tunables.hs')
-rw-r--r-- | Tunables.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Tunables.hs b/Tunables.hs index f5832b4..79fb2a8 100644 --- a/Tunables.hs +++ b/Tunables.hs @@ -5,16 +5,19 @@ import Cost import qualified Crypto.Argon2 as Argon2 data Tunables = Tunables - { argonOptions :: Argon2.HashOptions + { objectSize :: Int + -- ^ size of objects stored in keysafe, in bytes + , argonOptions :: Argon2.HashOptions , argonCost :: Cost CreationOp -- ^ should correspond to the argonOptions - , decryptionCost :: Cost DecryptionOp - -- ^ controls the decryption cost + , decryptionPuzzleCost :: Cost DecryptionOp + -- ^ cost of decryption puzzle } defaultTunables :: Tunables defaultTunables = Tunables - { argonOptions = Argon2.HashOptions + { objectSize = 1024*64 -- 64 kb + , argonOptions = Argon2.HashOptions { Argon2.hashIterations = 10000 , Argon2.hashMemory = 131072 -- 128 mebibtyes per thread , Argon2.hashParallelism = 4 -- 4 threads @@ -30,13 +33,14 @@ defaultTunables = Tunables -- This is set to only 1 minute because GPUs are quite a lot -- faster than CPUs at AES, and so setting it higher would make -- clients too slow at key recovery. - , decryptionCost = GPUCost (Seconds 60) + , decryptionPuzzleCost = GPUCost (Seconds 60) } -- | Dials back cryptographic difficulty, not for production use. testModeTunables :: Tunables testModeTunables = Tunables - { argonOptions = Argon2.defaultHashOptions - , argonCost = CPUCost (Seconds 0) - , decryptionCost = GPUCost (Seconds 0) + { objectSize = 1024*64 + , argonOptions = Argon2.defaultHashOptions + , argonCost = CPUCost (Seconds (2*600)) + , decryptionPuzzleCost = GPUCost (Seconds 60) } |