Removed support for building with the old cryptohash library.
Building with that library made git-annex not support SHA3; it's time for that to always be supported in case SHA2 dominoes.
This commit is contained in:
parent
622b3fface
commit
40327cab6e
5 changed files with 5 additions and 29 deletions
|
@ -5,8 +5,6 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Backend.Hash (
|
||||
backends,
|
||||
testKeyBackend,
|
||||
|
@ -36,9 +34,7 @@ data Hash
|
|||
hashes :: [Hash]
|
||||
hashes = concat
|
||||
[ map (SHA2Hash . HashSize) [256, 512, 224, 384]
|
||||
#ifdef WITH_CRYPTONITE
|
||||
, map (SHA3Hash . HashSize) [256, 512, 224, 384]
|
||||
#endif
|
||||
, map (SkeinHash . HashSize) [256, 512]
|
||||
, [SHA1Hash]
|
||||
, [MD5Hash]
|
||||
|
@ -212,12 +208,10 @@ shaHasher (HashSize hashsize) filesize
|
|||
|
||||
sha3Hasher :: HashSize -> (L.ByteString -> String)
|
||||
sha3Hasher (HashSize hashsize)
|
||||
#ifdef WITH_CRYPTONITE
|
||||
| hashsize == 256 = show . sha3_256
|
||||
| hashsize == 224 = show . sha3_224
|
||||
| hashsize == 384 = show . sha3_384
|
||||
| hashsize == 512 = show . sha3_512
|
||||
#endif
|
||||
| otherwise = error $ "unsupported SHA3 size " ++ show hashsize
|
||||
|
||||
skeinHasher :: HashSize -> (L.ByteString -> String)
|
||||
|
|
|
@ -38,6 +38,9 @@ git-annex (6.20170215) UNRELEASED; urgency=medium
|
|||
a hash). This ensures that signed git commits of annexed files
|
||||
will remain secure, as long as git-annex is using a secure hashing
|
||||
backend.
|
||||
* Removed support for building with the old cryptohash library.
|
||||
Building with that library made git-annex not support SHA3; it's time
|
||||
for that to always be supported in case SHA2 dominoes.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 14 Feb 2017 15:54:25 -0400
|
||||
|
||||
|
|
|
@ -4,20 +4,16 @@
|
|||
- because of https://github.com/vincenthz/hs-cryptohash/issues/36
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Utility.Hash (
|
||||
sha1,
|
||||
sha2_224,
|
||||
sha2_256,
|
||||
sha2_384,
|
||||
sha2_512,
|
||||
#ifdef WITH_CRYPTONITE
|
||||
sha3_224,
|
||||
sha3_256,
|
||||
sha3_384,
|
||||
sha3_512,
|
||||
#endif
|
||||
skein256,
|
||||
skein512,
|
||||
md5,
|
||||
|
@ -31,12 +27,8 @@ import qualified Data.ByteString.Lazy as L
|
|||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as T
|
||||
import qualified Data.ByteString as S
|
||||
#ifdef WITH_CRYPTONITE
|
||||
import "cryptonite" Crypto.MAC.HMAC
|
||||
import "cryptonite" Crypto.Hash
|
||||
#else
|
||||
import "cryptohash" Crypto.Hash
|
||||
#endif
|
||||
|
||||
sha1 :: L.ByteString -> Digest SHA1
|
||||
sha1 = hashlazy
|
||||
|
@ -53,7 +45,6 @@ sha2_384 = hashlazy
|
|||
sha2_512 :: L.ByteString -> Digest SHA512
|
||||
sha2_512 = hashlazy
|
||||
|
||||
#ifdef WITH_CRYPTONITE
|
||||
sha3_224 :: L.ByteString -> Digest SHA3_224
|
||||
sha3_224 = hashlazy
|
||||
|
||||
|
@ -65,7 +56,6 @@ sha3_384 = hashlazy
|
|||
|
||||
sha3_512 :: L.ByteString -> Digest SHA3_512
|
||||
sha3_512 = hashlazy
|
||||
#endif
|
||||
|
||||
skein256 :: L.ByteString -> Digest Skein256_256
|
||||
skein256 = hashlazy
|
||||
|
@ -86,12 +76,10 @@ prop_hashes_stable = all (\(hasher, result) -> hasher foo == result)
|
|||
, (show . sha2_512, "f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7")
|
||||
, (show . skein256, "a04efd9a0aeed6ede40fe5ce0d9361ae7b7d88b524aa19917b9315f1ecf00d33")
|
||||
, (show . skein512, "fd8956898113510180aa4658e6c0ac85bd74fb47f4a4ba264a6b705d7a8e8526756e75aecda12cff4f1aca1a4c2830fbf57f458012a66b2b15a3dd7d251690a7")
|
||||
#ifdef WITH_CRYPTONITE
|
||||
, (show . sha3_224, "f4f6779e153c391bbd29c95e72b0708e39d9166c7cea51d1f10ef58a")
|
||||
, (show . sha3_256, "76d3bc41c9f588f7fcd0d5bf4718f8f84b1c41b20882703100b9eb9413807c01")
|
||||
, (show . sha3_384, "665551928d13b7d84ee02734502b018d896a0fb87eed5adb4c87ba91bbd6489410e11b0fbcc06ed7d0ebad559e5d3bb5")
|
||||
, (show . sha3_512, "4bca2b137edc580fe50a88983ef860ebaca36c857b1f492839d6d7392452a63c82cbebc68e3b70a2a1480b4bb5d437a7cba6ecf9d89f9ff3ccd14cd6146ea7e7")
|
||||
#endif
|
||||
, (show . md5, "acbd18db4cc2f85cedef654fccc4a4d8")
|
||||
]
|
||||
where
|
||||
|
|
|
@ -295,9 +295,6 @@ Flag network-uri
|
|||
Description: Get Network.URI from the network-uri package
|
||||
Default: True
|
||||
|
||||
Flag Cryptonite
|
||||
Description: Use the cryptonite library, instead of the older cryptohash
|
||||
|
||||
Flag Dbus
|
||||
Description: Enable dbus support
|
||||
|
||||
|
@ -362,7 +359,8 @@ Executable git-annex
|
|||
byteable,
|
||||
stm-chans,
|
||||
securemem,
|
||||
crypto-api
|
||||
crypto-api,
|
||||
cryptonite
|
||||
CC-Options: -Wall
|
||||
GHC-Options: -Wall -fno-warn-tabs
|
||||
Extensions: PackageImports
|
||||
|
@ -383,12 +381,6 @@ Executable git-annex
|
|||
else
|
||||
Build-Depends: network (< 2.6), network (>= 2.4)
|
||||
|
||||
if flag(Cryptonite)
|
||||
Build-Depends: cryptonite
|
||||
CPP-Options: -DWITH_CRYPTONITE
|
||||
else
|
||||
Build-Depends: cryptohash (>= 0.11.0)
|
||||
|
||||
if (os(windows))
|
||||
Build-Depends: Win32, Win32-extras, unix-compat (>= 0.4.1.3), setenv,
|
||||
process (>= 1.3.0.0)
|
||||
|
|
|
@ -4,7 +4,6 @@ flags:
|
|||
production: true
|
||||
assistant: true
|
||||
pairing: true
|
||||
cryptonite: true
|
||||
network-uri: true
|
||||
s3: true
|
||||
testsuite: true
|
||||
|
|
Loading…
Add table
Reference in a new issue