Avoid unnecessary OpenSSL deps

This commit is contained in:
Julian Ospald 2020-04-09 18:27:07 +02:00
parent f78e7b1cbc
commit c782bc44de
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 12 additions and 7 deletions

View File

@ -47,6 +47,9 @@ common attoparsec
common base
build-depends: base >=4.12 && <5
common base16-bytestring
build-depends: base16-bytestring >= 0.1.1.6
common binary
build-depends: binary >=0.8.6.0
@ -65,6 +68,9 @@ common concurrent-output
common containers
build-depends: containers >=0.6
common cryptohash-sha256
build-depends: cryptohash-sha256 >= 0.11.101.0
common generics-sop
build-depends: generics-sop >=0.5
@ -74,9 +80,6 @@ common haskus-utils-types
common haskus-utils-variant
build-depends: haskus-utils-variant >=3.0
common hopenssl
build-depends: hopenssl >=2.2.4
common hpath
build-depends: hpath >=0.11
@ -223,7 +226,7 @@ library
import:
config
, base
, HsOpenSSL
, base16-bytestring
, aeson
, ascii-string
, async
@ -234,10 +237,10 @@ library
, case-insensitive
, concurrent-output
, containers
, cryptohash-sha256
, generics-sop
, haskus-utils-types
, haskus-utils-variant
, hopenssl
, hpath
, hpath-directory
, hpath-filepath
@ -301,6 +304,7 @@ library
if !flag(curl)
import:
, HsOpenSSL
, http-io-streams
, io-streams
, terminal-progress-bar

View File

@ -45,7 +45,6 @@ import GHC.IO.Exception
import HPath
import HPath.IO as HIO
import Haskus.Utils.Variant.Excepts
import OpenSSL.Digest
import Optics
import Prelude hiding ( abs
, readFile
@ -54,6 +53,8 @@ import Prelude hiding ( abs
import System.IO.Error
import URI.ByteString
import qualified Crypto.Hash.SHA256 as SHA256
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Lazy as L
import qualified Data.CaseInsensitive as CI
import qualified Data.Map.Strict as M
@ -400,7 +401,7 @@ checkDigest dli file = do
let p' = toFilePath file
lift $ $(logInfo) [i|verifying digest of: #{p'}|]
c <- liftIO $ readFile file
let cDigest = E.decodeUtf8 . toHex . digest (digestByName "sha256") $ c
let cDigest = E.decodeUtf8 . B16.encode . SHA256.hashlazy $ c
eDigest = view dlHash dli
when ((cDigest /= eDigest) && verify) $ throwE (DigestError cDigest eDigest)