diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-26 10:31:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-26 10:31:00 -0400 |
commit | 2c6a13f5db2671038efbfdcdb9c63f4758bd2e18 (patch) | |
tree | a5c2f0fd8e76331db3f0d325a2b94cfa597fbb02 | |
parent | d91d51283a3b185f80027b9573e3506cfc8e777c (diff) | |
download | keysafe-2c6a13f5db2671038efbfdcdb9c63f4758bd2e18.tar.gz |
Fix embedded copy of Argon2 to not use Word64, fixing build on 32 bit systems.
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Crypto/Argon2.hs | 8 | ||||
-rw-r--r-- | Crypto/Argon2/FFI.hsc | 12 |
3 files changed, 12 insertions, 10 deletions
@@ -2,6 +2,8 @@ keysafe (0.20160923) UNRELEASED; urgency=medium * Makefile: Avoid rebuilding on make install, so that sudo make install works. * Added --chaff-max-delay option for slower chaffing. + * Fix embedded copy of Argon2 to not use Word64, fixing build on 32 bit + systems. -- Joey Hess <id@joeyh.name> Fri, 23 Sep 2016 10:40:55 -0400 diff --git a/Crypto/Argon2.hs b/Crypto/Argon2.hs index 0bc6ac9..a320354 100644 --- a/Crypto/Argon2.hs +++ b/Crypto/Argon2.hs @@ -152,9 +152,9 @@ variant _ b Argon2d = b -- will be throw. data Argon2Exception = -- | The length of the supplied password is outside the range supported by @libargon2@. - Argon2PasswordLengthOutOfRange !Word64 -- ^ The erroneous length. + Argon2PasswordLengthOutOfRange !CSize -- ^ The erroneous length. | -- | The length of the supplied salt is outside the range supported by @libargon2@. - Argon2SaltLengthOutOfRange !Word64 -- ^ The erroneous length. + Argon2SaltLengthOutOfRange !CSize -- ^ The erroneous length. | -- | Either too much or too little memory was requested via 'hashMemory'. Argon2MemoryUseOutOfRange !Word32 -- ^ The erroneous 'hashMemory' value. | -- | Either too few or too many iterations were requested via 'hashIterations'. @@ -167,7 +167,7 @@ data Argon2Exception instance Exception Argon2Exception -type Argon2Encoded = Word32 -> Word32 -> Word32 -> CString -> Word64 -> CString -> Word64 -> Word64 -> CString -> Word64 -> IO Int32 +type Argon2Encoded = Word32 -> Word32 -> Word32 -> CString -> CSize -> CString -> CSize -> CSize -> CString -> CSize -> IO Int32 hashEncoded' :: HashOptions -> BS.ByteString @@ -202,7 +202,7 @@ hashEncoded' options@HashOptions{..} password salt argon2i argon2d = fmap T.decodeUtf8 (BS.packCString out) where argon2 = variant argon2i argon2d hashVariant -type Argon2Unencoded = Word32 -> Word32 -> Word32 -> CString -> Word64 -> CString -> Word64 -> CString -> Word64 -> IO Int32 +type Argon2Unencoded = Word32 -> Word32 -> Word32 -> CString -> CSize -> CString -> CSize -> CString -> CSize -> IO Int32 hash' :: HashOptions -> BS.ByteString diff --git a/Crypto/Argon2/FFI.hsc b/Crypto/Argon2/FFI.hsc index e12d530..810a9a0 100644 --- a/Crypto/Argon2/FFI.hsc +++ b/Crypto/Argon2/FFI.hsc @@ -44,17 +44,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import Foreign import Foreign.C -foreign import ccall unsafe "argon2.h argon2i_hash_encoded" argon2i_hash_encoded :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> (#type const size_t) -> Ptr b -> (# type const size_t) -> (#type const size_t) -> CString -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2i_hash_encoded" argon2i_hash_encoded :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> CSize -> Ptr b -> CSize -> CSize -> CString -> CSize -> IO (#type int) -foreign import ccall unsafe "argon2.h argon2i_hash_raw" argon2i_hash_raw :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> (#type const size_t) -> Ptr b -> (#type size_t) -> Ptr c -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2i_hash_raw" argon2i_hash_raw :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> CSize -> Ptr b -> CSize -> Ptr c -> CSize -> IO (#type int) -foreign import ccall unsafe "argon2.h argon2d_hash_encoded" argon2d_hash_encoded :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> (#type const size_t) -> Ptr b -> (# type const size_t) -> (#type const size_t) -> CString -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2d_hash_encoded" argon2d_hash_encoded :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> CSize -> Ptr b -> CSize -> CSize -> CString -> CSize -> IO (#type int) -foreign import ccall unsafe "argon2.h argon2d_hash_raw" argon2d_hash_raw :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> (#type const size_t) -> Ptr b -> (#type size_t) -> Ptr c -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2d_hash_raw" argon2d_hash_raw :: (#type const uint32_t) -> (#type const uint32_t) -> (#type const uint32_t) -> Ptr a -> CSize -> Ptr b -> CSize -> Ptr c -> CSize -> IO (#type int) -foreign import ccall unsafe "argon2.h argon2i_verify" argon2i_verify :: CString -> Ptr a -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2i_verify" argon2i_verify :: CString -> Ptr a -> CSize -> IO (#type int) -foreign import ccall unsafe "argon2.h argon2d_verify" argon2d_verify :: CString -> Ptr a -> (#type const size_t) -> IO (#type int) +foreign import ccall unsafe "argon2.h argon2d_verify" argon2d_verify :: CString -> Ptr a -> CSize -> IO (#type int) pattern ARGON2_OK = (#const ARGON2_OK) pattern ARGON2_OUTPUT_PTR_NULL = (#const ARGON2_OUTPUT_PTR_NULL) |