From 350edcbb9de0d3782890ccc560c761244c67ef32 Mon Sep 17 00:00:00 2001 From: Florian Friesdorf Date: Mon, 27 Feb 2012 23:49:11 +0000 Subject: include upstream patch for salsa validation with gcc4.6 http://sourceforge.net/apps/trac/cryptopp/changeset/529 svn path=/nixpkgs/branches/stdenv-updates/; revision=32638 --- pkgs/development/libraries/crypto++/default.nix | 6 ++- .../libraries/crypto++/salsa-gcc4.6.patch | 62 ++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/crypto++/salsa-gcc4.6.patch (limited to 'pkgs/development/libraries') diff --git a/pkgs/development/libraries/crypto++/default.nix b/pkgs/development/libraries/crypto++/default.nix index 138ee6eb27f5..8f39de41e55b 100644 --- a/pkgs/development/libraries/crypto++/default.nix +++ b/pkgs/development/libraries/crypto++/default.nix @@ -8,8 +8,10 @@ stdenv.mkDerivation rec { sha256 = "0s7jhvnfihikqp1iwpdz03fad62xkjxci6jiahrh6f3sn664vrwq"; }; - patches = [ ./pic.patch ] - ++ stdenv.lib.optional (stdenv.system != "i686-cygwin") ./dll.patch; + patches = [ + ./pic.patch + ./salsa-gcc4.6.patch + ] ++ stdenv.lib.optional (stdenv.system != "i686-cygwin") ./dll.patch; buildInputs = [ unzip ] diff --git a/pkgs/development/libraries/crypto++/salsa-gcc4.6.patch b/pkgs/development/libraries/crypto++/salsa-gcc4.6.patch new file mode 100644 index 000000000000..609d2f55d223 --- /dev/null +++ b/pkgs/development/libraries/crypto++/salsa-gcc4.6.patch @@ -0,0 +1,62 @@ +From fbccde3578feddb16f07be981da1d0f26209fd04 Mon Sep 17 00:00:00 2001 +From: weidai +Date: Sun, 5 Jun 2011 21:07:11 +0000 +Subject: [PATCH 1/4] fix Salsa validation failure when compiling with GCC 4.6 + (https://sourceforge.net/apps/trac/cryptopp/ticket/12) + +git-svn-id: https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk@529 57ff6487-cd31-0410-9ec3-f628ee90f5f0 +--- + c5/salsa.cpp | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +# NOTE: remove the c5 path component + +diff --git a/salsa.cpp b/salsa.cpp +index bd216ee..bdc5d75 100755 +--- a/salsa.cpp ++++ b/salsa.cpp +@@ -122,17 +122,17 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output + if (HasSSE2()) + { + #if CRYPTOPP_BOOL_X64 +- #define REG_output %4 +- #define REG_input %1 ++ #define REG_output %1 ++ #define REG_input %0 + #define REG_iterationCount %2 +- #define REG_state %3 +- #define REG_rounds %0 ++ #define REG_state %4 /* constant */ ++ #define REG_rounds %3 /* constant */ + #define REG_roundsLeft eax + #define REG_temp32 edx + #define REG_temp rdx +- #define SSE2_WORKSPACE %5 ++ #define SSE2_WORKSPACE %5 /* constant */ + +- FixedSizeAlignedSecBlock workspace; ++ CRYPTOPP_ALIGN_DATA(16) byte workspace[16*32]; + #else + #define REG_output edi + #define REG_input eax +@@ -457,12 +457,13 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output + #ifdef __GNUC__ + AS_POP_IF86( bx) + ".att_syntax prefix;" +- : + #if CRYPTOPP_BOOL_X64 +- : "r" (m_rounds), "r" (input), "r" (iterationCount), "r" (m_state.data()), "r" (output), "r" (workspace.m_ptr) +- : "%eax", "%edx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" ++ : "+r" (input), "+r" (output), "+r" (iterationCount) ++ : "r" (m_rounds), "r" (m_state.m_ptr), "r" (workspace) ++ : "%eax", "%rdx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" + #else +- : "d" (m_rounds), "a" (input), "c" (iterationCount), "S" (m_state.data()), "D" (output) ++ : "+a" (input), "+D" (output), "+c" (iterationCount) ++ : "d" (m_rounds), "S" (m_state.m_ptr) + : "memory", "cc" + #endif + ); +-- +1.7.9.2 + -- cgit 1.4.1