diff --git a/patching/patches/pwstore-fast-2.4.patch b/patching/patches/pwstore-fast-2.4.patch new file mode 100644 index 00000000..1d0ed6bf --- /dev/null +++ b/patching/patches/pwstore-fast-2.4.patch @@ -0,0 +1,47 @@ +diff -ru orig/Crypto/PasswordStore.hs new/Crypto/PasswordStore.hs +--- orig/Crypto/PasswordStore.hs 2013-09-17 11:48:49.178111970 +0300 ++++ new/Crypto/PasswordStore.hs 2013-09-17 11:48:49.000000000 +0300 +@@ -1,4 +1,5 @@ + {-# LANGUAGE OverloadedStrings, BangPatterns #-} ++{-# LANGUAGE CPP #-} + -- | + -- Module : Crypto.PasswordStore + -- Copyright : (c) Peter Scott, 2011 +@@ -149,8 +150,8 @@ + -> ByteString + -- ^ The encoded message + hmacSHA256 secret msg = +- let digest = SHA.hmacSha256 (BL.fromStrict secret) (BL.fromStrict msg) +- in BL.toStrict . SHA.bytestringDigest $ digest ++ let digest = SHA.hmacSha256 (fromStrict secret) (fromStrict msg) ++ in toStrict . SHA.bytestringDigest $ digest + + -- | PBKDF2 key-derivation function. + -- For details see @http://tools.ietf.org/html/rfc2898@. +@@ -403,3 +404,26 @@ + where (a, g') = randomR ('\NUL', '\255') g + salt = makeSalt $ B.pack $ map fst (rands gen 16) + newgen = snd $ last (rands gen 16) ++ ++#if !MIN_VERSION_base(4, 6, 0) ++-- | Strict version of 'modifySTRef' ++modifySTRef' :: STRef s a -> (a -> a) -> ST s () ++modifySTRef' ref f = do ++ x <- readSTRef ref ++ let x' = f x ++ x' `seq` writeSTRef ref x' ++#endif ++ ++#if MIN_VERSION_bytestring(0, 10, 0) ++toStrict :: BL.ByteString -> BS.ByteString ++toStrict = BL.toStrict ++ ++fromStrict :: BS.ByteString -> BL.ByteString ++fromStrict = BL.fromStrict ++#else ++toStrict :: BL.ByteString -> BS.ByteString ++toStrict = BS.concat . BL.toChunks ++ ++fromStrict :: BS.ByteString -> BL.ByteString ++fromStrict = BL.fromChunks . return ++#endif