Remove support for building without cryptohash.

This will prevent backporting to wheezy, but it's time to simplify the
code.
This commit is contained in:
Joey Hess 2015-02-04 13:41:26 -04:00
parent d7800f7923
commit 95c1593098
5 changed files with 4 additions and 31 deletions

View file

@ -32,9 +32,7 @@ type HashSize = Int
hashes :: [Hash]
hashes = concat
[ map SHAHash [256, 1, 512, 224, 384]
#ifdef WITH_CRYPTOHASH
, map SkeinHash [256, 512]
#endif
]
{- The SHA256E backend is the default, so genBackendE comes first. -}
@ -178,10 +176,8 @@ shaHasher hashsize filesize
skeinHasher :: HashSize -> (L.ByteString -> String)
skeinHasher hashsize
#ifdef WITH_CRYPTOHASH
| hashsize == 256 = show . skein256
| hashsize == 512 = show . skein512
#endif
| otherwise = error $ "unsupported skein size " ++ show hashsize
{- A varient of the SHA256E backend, for testing that needs special keys

View file

@ -81,11 +81,6 @@ buildFlags = filter (not . null)
#ifdef WITH_TDFA
, "TDFA"
#endif
#ifdef WITH_CRYPTOHASH
, "CryptoHash"
#else
#warning Building without CryptoHash.
#endif
#ifdef WITH_TORRENTPARSER
, "TorrentParser"
#else

View file

@ -1,8 +1,4 @@
{- Convenience wrapper around cryptohash.
- Falls back to SHA if it's not available.
-}
{-# LANGUAGE CPP #-}
{- Convenience wrapper around cryptohash. -}
module Utility.Hash (
sha1,
@ -10,10 +6,8 @@ module Utility.Hash (
sha256,
sha384,
sha512,
#ifdef WITH_CRYPTOHASH
skein256,
skein512,
#endif
prop_hashes_stable
) where
@ -21,9 +15,6 @@ import qualified Data.ByteString.Lazy as L
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
#ifndef WITH_CRYPTOHASH
import Data.Digest.Pure.SHA
#else
import Crypto.Hash
sha1 :: L.ByteString -> Digest SHA1
@ -51,8 +42,6 @@ skein256 = hashlazy
skein512 :: L.ByteString -> Digest Skein512_512
skein512 = hashlazy
#endif
{- Check that all the hashes continue to hash the same. -}
prop_hashes_stable :: Bool
prop_hashes_stable = all (\(hasher, result) -> hasher foo == result)
@ -61,10 +50,8 @@ prop_hashes_stable = all (\(hasher, result) -> hasher foo == result)
, (show . sha256, "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae")
, (show . sha384, "98c11ffdfdd540676b1a137cb1a22b2a70350c9a44171d6b1180c6be5cbb2ee3f79d532c8a1dd9ef2e8e08e752a3babb")
, (show . sha512, "f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7")
#ifdef WITH_CRYPTOHASH
, (show . skein256, "a04efd9a0aeed6ede40fe5ce0d9361ae7b7d88b524aa19917b9315f1ecf00d33")
, (show . skein512, "fd8956898113510180aa4658e6c0ac85bd74fb47f4a4ba264a6b705d7a8e8526756e75aecda12cff4f1aca1a4c2830fbf57f458012a66b2b15a3dd7d251690a7")
#endif
]
where
foo = L.fromChunks [T.encodeUtf8 $ T.pack "foo"]

1
debian/changelog vendored
View file

@ -28,6 +28,7 @@ git-annex (5.20150114) UNRELEASED; urgency=medium
that has been tuned in incompatable ways.
* Support annex.tune.objecthash1, annex.tune.objecthashlower, and
annex.tune.branchhash1.
* Remove support for building without cryptohash.
-- Joey Hess <id@joeyh.name> Tue, 13 Jan 2015 17:03:39 -0400

View file

@ -87,9 +87,6 @@ Flag Quvi
Flag Tahoe
Description: Enable the tahoe special remote
Flag CryptoHash
Description: Enable use of cryptohash for checksumming
Flag DesktopNotify
Description: Enable desktop environment notifications
@ -112,7 +109,8 @@ Executable git-annex
base (>= 4.5 && < 4.9), monad-control, exceptions (>= 0.6), transformers,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance,
SafeSemaphore, uuid, random, dlist, unix-compat, async, stm (>= 2.3),
data-default, case-insensitive, http-conduit, http-types
data-default, case-insensitive, http-conduit, http-types,
cryptohash (>= 0.10.0)
CC-Options: -Wall
GHC-Options: -Wall
Extensions: PackageImports
@ -148,10 +146,6 @@ Executable git-annex
CPP-Options: -DWITH_TDFA
else
Build-Depends: regex-compat
if flag(CryptoHash)
Build-Depends: cryptohash (>= 0.10.0)
CPP-Options: -DWITH_CRYPTOHASH
if flag(S3)
Build-Depends: conduit, resourcet, conduit-extra, aws (>= 0.9.2), http-client