at master 2.8 kB view raw
1diff --git a/Crypto/KDF/Argon2.hs b/Crypto/KDF/Argon2.hs 2index 044ba00..31dc6f1 100644 3--- a/Crypto/KDF/Argon2.hs 4+++ b/Crypto/KDF/Argon2.hs 5@@ -12,6 +12,7 @@ 6 -- File started from Argon2.hs, from Oliver Charles 7 -- at https://github.com/ocharles/argon2 8 -- 9+{-# LANGUAGE DataKinds #-} 10 module Crypto.KDF.Argon2 11 ( 12 Options(..) 13@@ -32,6 +33,7 @@ import Control.Monad (when) 14 import Data.Word 15 import Foreign.C 16 import Foreign.Ptr 17+import Data.Proxy 18 19 -- | Which variant of Argon2 to use. You should choose the variant that is most 20 -- applicable to your intention to hash inputs. 21@@ -100,33 +102,12 @@ defaultOptions = 22 } 23 24 hash :: (ByteArrayAccess password, ByteArrayAccess salt, ByteArray out) 25- => Options 26+ => [Proxy "cryptonite:Crypto.KDF.Argon2.hash is known to be broken on this architecture. See https://github.com/haskell-crypto/cryptonite/issues/360"] 27 -> password 28 -> salt 29 -> Int 30 -> CryptoFailable out 31-hash options password salt outLen 32- | saltLen < saltMinLength = CryptoFailed CryptoError_SaltTooSmall 33- | outLen < outputMinLength = CryptoFailed CryptoError_OutputLengthTooSmall 34- | outLen > outputMaxLength = CryptoFailed CryptoError_OutputLengthTooBig 35- | otherwise = CryptoPassed $ B.allocAndFreeze outLen $ \out -> do 36- res <- B.withByteArray password $ \pPass -> 37- B.withByteArray salt $ \pSalt -> 38- argon2_hash (iterations options) 39- (memory options) 40- (parallelism options) 41- pPass 42- (csizeOfInt passwordLen) 43- pSalt 44- (csizeOfInt saltLen) 45- out 46- (csizeOfInt outLen) 47- (cOfVariant $ variant options) 48- (cOfVersion $ version options) 49- when (res /= 0) $ error "argon2: hash: internal error" 50- where 51- saltLen = B.length salt 52- passwordLen = B.length password 53+hash options password salt outLen = error "cryptonite:Crypto.KDF.Argon2.hash is known to be broken on this architecture. See https://github.com/haskell-crypto/cryptonite/issues/360" 54 55 data Pass 56 data Salt 57diff --git a/tests/KAT_Argon2.hs b/tests/KAT_Argon2.hs 58index a347fc5..fdba079 100644 59--- a/tests/KAT_Argon2.hs 60+++ b/tests/KAT_Argon2.hs 61@@ -32,7 +32,7 @@ kdfTests = zipWith toKDFTest is vectors 62 where 63 toKDFTest i v = 64 testCase (show i) 65- (CryptoPassed (kdfResult v) @=? Argon2.hash (kdfOptions v) (kdfPass v) (kdfSalt v) (B.length $ kdfResult v)) 66+ (pure ()) 67 68 is :: [Int] 69 is = [1..]