-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid hash when cryptonite package is loaded, too #4
Comments
My guess is that this is due to a clash of C function names that are used in FFI calls. |
Is the |
No, it's actually wrong. I updated the code snippet above. |
Here is a new version #!/bin/bash
cat > Tmp.hs << EOF
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Crypto.Hash.BLAKE2.BLAKE2b
main = print $ hash 64 mempty "abc"
EOF
function get-id { ghc-pkg field $1 id | cut -d ' ' -f 2 ; }
rm -f out
ghc ./Tmp.hs -o out
echo ghc ./Tmp.hs -o out
./out
rm -f out
ghc -package-id `get-id blake2` ./Tmp.hs -o out
echo ghc -package-id `get-id blake2` ./Tmp.hs -o out
./out
rm -f out
ghc -package-id `get-id cryptonite` ./Tmp.hs -o out
echo ghc -package-id `get-id cryptonite` ./Tmp.hs -o out
./out
rm -f out
ghc -package-id `get-id blake2` -package-id `get-id cryptonite` ./Tmp.hs -o out
echo ghc -package-id `get-id blake2` -package-id `get-id cryptonite` ./Tmp.hs -o out
./out And here is the result on my system:
|
I guess, the first three cases are just luck, and one should simply refrain from using cryptonite and blake2 together to avoid name clashes for the c functions. |
If one package is using wrapping and the other is not, how could a conflict exist? |
The
hash
function returns a value with all bytes set to0x00
when also thecryptonite
package is loaded. The script below exposes the issue on my system. But it has been found to only show up randomly, so it may be necessary to build both packages in a sandbox a few times in order to reproduce the issue.The text was updated successfully, but these errors were encountered: