diff --git a/patches/siphash-1.0.3.patch b/patches/siphash-1.0.3.patch new file mode 100644 index 0000000000000000000000000000000000000000..b3e16255628a4a02d6aa0a5705a7efeac6ae75ec --- /dev/null +++ b/patches/siphash-1.0.3.patch @@ -0,0 +1,21 @@ +diff --git a/Crypto/MAC/SipHash.hs b/Crypto/MAC/SipHash.hs +index ac1da7a..d86e3f5 100644 +--- a/Crypto/MAC/SipHash.hs ++++ b/Crypto/MAC/SipHash.hs +@@ -27,6 +27,7 @@ import Foreign.ForeignPtr + import Foreign.Ptr + import Foreign.Storable + import System.Endian (fromLE64) ++import System.IO.Unsafe (unsafeDupablePerformIO) + + -- | SigHash Key + data SipKey = SipKey {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64 +@@ -43,7 +44,7 @@ hash = hashWith 2 4 + + -- | same as 'hash', except also specifies the number of sipround iterations for compression and digest. + hashWith :: Int -> Int -> SipKey -> ByteString -> SipHash +-hashWith c d key (PS ps s fl) = inlinePerformIO $ withForeignPtr ps (\ptr -> runHash (initSip key) (ptr `plusPtr` s) fl) ++hashWith c d key (PS ps s fl) = unsafeDupablePerformIO $ withForeignPtr ps (\ptr -> runHash (initSip key) (ptr `plusPtr` s) fl) + where runHash !st !ptr l + | l > 7 = fromLE64 `fmap` peek (castPtr ptr) >>= \v -> runHash (process st v) (ptr `plusPtr` 8) (l-8) + | otherwise = do