From 57b578189b4b6c868dc17772e0655347a330e37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 23 Sep 2012 20:50:24 +0200 Subject: [PATCH] Adding cryptodev-linux, and made openssl use it optionally. I'm trying to get the CESA of the sheevaplug available to openssl. --- .../development/libraries/openssl/default.nix | 8 +++-- pkgs/os-specific/linux/cryptodev/default.nix | 29 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 ++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 pkgs/os-specific/linux/cryptodev/default.nix diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index 575b57eb872..48574a332c8 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchurl, perl }: +{ stdenv, fetchurl, perl +, withCryptodev ? false, cryptodevHeaders }: let name = "openssl-1.0.0i"; @@ -45,6 +46,8 @@ stdenv.mkDerivation { patches = patchesCross false; + buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders; + buildNativeInputs = [ perl ]; # On x86_64-darwin, "./config" misdetects the system as @@ -52,7 +55,8 @@ stdenv.mkDerivation { configureScript = if stdenv.system == "x86_64-darwin" then "./Configure darwin64-x86_64-cc" else "./config"; - configureFlags = "shared --libdir=lib"; + configureFlags = "shared --libdir=lib" + + stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"; makeFlags = "MANDIR=$(out)/share/man"; diff --git a/pkgs/os-specific/linux/cryptodev/default.nix b/pkgs/os-specific/linux/cryptodev/default.nix new file mode 100644 index 00000000000..4d748903493 --- /dev/null +++ b/pkgs/os-specific/linux/cryptodev/default.nix @@ -0,0 +1,29 @@ +{ fetchurl, stdenv, kernel, onlyHeaders ? false }: + +stdenv.mkDerivation rec { + name = "cryptodev-linux-1.5"; + + src = fetchurl { + url = "http://download.gna.org/cryptodev-linux/${name}.tar.gz"; + sha256 = "13hybl5p0ck0vgi2gxmiwa2810gcfk78kdy17ai8nczj8il15mn0"; + }; + + buildPhase = if (!onlyHeaders) then '' + make -C ${kernel}/lib/modules/${kernel.modDirVersion}/build \ + INSTALL_PATH=$out + '' else ":"; + + installPhase = stdenv.lib.optionalString (!onlyHeaders) '' + make -C ${kernel}/lib/modules/${kernel.modDirVersion}/build \ + INSTALL_PATH=$out SUBDIRS=`pwd` modules_install + '' + '' + mkdir -p $out/include/crypto + cp crypto/cryptodev.h $out/include/crypto + ''; + + meta = { + description = "Device that allows access to Linux kernel cryptographic drivers"; + homepage = http://home.gna.org/cryptodev-linux/; + license = "GPLv2+"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 47c2561b565..9988ae8da32 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4605,6 +4605,10 @@ let openssl = callPackage ../development/libraries/openssl { fetchurl = fetchurlBoot; + cryptodevHeaders = linuxPackages.cryptodev.override { + fetchurl = fetchurlBoot; + onlyHeaders = true; + }; }; ortp = callPackage ../development/libraries/ortp { }; @@ -5869,6 +5873,8 @@ let blcr = callPackage ../os-specific/linux/blcr { }; + cryptodev = callPackage ../os-specific/linux/cryptodev { }; + e1000e = callPackage ../os-specific/linux/e1000e {}; exmap = callPackage ../os-specific/linux/exmap { };