Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[DEVOPS-393] Fix segfault in cryptonite #1693

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ with pkgs.lib;
with pkgs.haskell.lib;

let
addConfigureFlags = flags: drv: overrideCabal drv (drv: {
configureFlags = flags;
});
cardanoPkgs = ((import ./pkgs { inherit pkgs; }).override {
overrides = self: super: {
cardano-sl = overrideCabal super.cardano-sl (drv: {
Expand Down Expand Up @@ -68,8 +65,9 @@ let
postPatch = ":";
});

# Gold linker fixes
cryptonite = addConfigureFlags ["--ghc-option=-optl-pthread"] super.cryptonite;
# TODO: get rid of pthreads option once cryptonite 0.25 is released
# DEVOPS-393: https://github.com/haskell-crypto/cryptonite/issues/193
cryptonite = appendPatch (appendConfigureFlag super.cryptonite "--ghc-option=-optl-pthread") ./pkgs/cryptonite-segfault-blake.patch;

# Darwin fixes upstreamed in nixpkgs commit 71bebd52547f4486816fd320bb3dc6314f139e67
hinotify = if pkgs.stdenv.isDarwin then self.hfsevents else super.hinotify;
Expand Down
13 changes: 13 additions & 0 deletions pkgs/cryptonite-segfault-blake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Crypto/Hash/Blake2b.hs b/Crypto/Hash/Blake2b.hs
index c22c284..19c68ba 100644
--- a/Crypto/Hash/Blake2b.hs
+++ b/Crypto/Hash/Blake2b.hs
@@ -85,7 +85,7 @@ instance HashAlgorithm Blake2b_512 where
foreign import ccall unsafe "cryptonite_blake2b_init"
c_blake2b_init :: Ptr (Context a) -> Word32 -> IO ()

-foreign import ccall "cryptonite_blake2b_update"
+foreign import ccall unsafe "cryptonite_blake2b_update"
c_blake2b_update :: Ptr (Context a) -> Ptr Word8 -> Word32 -> IO ()

foreign import ccall unsafe "cryptonite_blake2b_finalize"