diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-03 12:33:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-03 12:33:38 -0400 |
commit | 94b766a439a85b5e16318b94d739ef4eaea3153b (patch) | |
tree | e6b4f3f9d6731597776d79e8c157f20dfab44db0 /Backend | |
parent | 9a7b0fa5cc16994509cf7482df68a07319dd6937 (diff) |
allow building w/o cryptohash
Mostly for the debian stable autobuilds, which have a too old version
to use the Crypto.Hash module.
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/Hash.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Backend/Hash.hs b/Backend/Hash.hs index 9cef3cae1..96a9bab3c 100644 --- a/Backend/Hash.hs +++ b/Backend/Hash.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Backend.Hash (backends) where import Common.Annex @@ -27,7 +29,9 @@ 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. -} @@ -143,7 +147,7 @@ shaHasher hashsize filesize | hashsize == 224 = use SysConfig.sha224 sha224 | hashsize == 384 = use SysConfig.sha384 sha384 | hashsize == 512 = use SysConfig.sha512 sha512 - | otherwise = error $ "bad sha size " ++ show hashsize + | otherwise = error $ "unsupported sha size " ++ show hashsize where use Nothing hasher = Left $ show . hasher use (Just c) hasher @@ -157,6 +161,8 @@ shaHasher hashsize filesize skeinHasher :: HashSize -> (L.ByteString -> String) skeinHasher hashsize +#ifdef WITH_CRYPTOHASH | hashsize == 256 = show . skein256 | hashsize == 512 = show . skein512 - | otherwise = error $ "bad skein size " ++ show hashsize +#endif + | otherwise = error $ "unsupported skein size " ++ show hashsize |