From 67d912af0a71ce2f755b783cf9fad121a9d4b633 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Thu, 14 Feb 2019 04:42:07 +0100 Subject: [PATCH 1/3] ibm-sw-tpm2: init at 1332 --- pkgs/tools/security/ibm-sw-tpm2/default.nix | 39 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 41 insertions(+) create mode 100644 pkgs/tools/security/ibm-sw-tpm2/default.nix diff --git a/pkgs/tools/security/ibm-sw-tpm2/default.nix b/pkgs/tools/security/ibm-sw-tpm2/default.nix new file mode 100644 index 00000000000..cec31cec377 --- /dev/null +++ b/pkgs/tools/security/ibm-sw-tpm2/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, lib, openssl }: + +stdenv.mkDerivation rec { + pname = "ibm-sw-tpm2"; + version = "1332"; + + src = fetchurl { + url = "mirror://sourceforge/ibmswtpm2/ibmtpm${version}.tar.gz"; + sha256 = "1zdhi8acd4jfp1v7ibd86hcv0g39yk8qrnhxjmmgzn8i7npr70cf"; + }; + + buildInputs = [ openssl ]; + + sourceRoot = "src"; + + prePatch = '' + # Fix hardcoded path to GCC. + substituteInPlace makefile --replace /usr/bin/gcc "${stdenv.cc}/bin/cc" + + # Remove problematic default CFLAGS. + substituteInPlace makefile \ + --replace -Werror "" \ + --replace -O0 "" \ + --replace -ggdb "" + ''; + + installPhase = '' + mkdir -p $out/bin + cp tpm_server $out/bin + ''; + + meta = with lib; { + description = "IBM's Software TPM 2.0, an implementation of the TCG TPM 2.0 specification"; + homepage = https://sourceforge.net/projects/ibmswtpm2/; + platforms = platforms.linux; + maintainers = with maintainers; [ delroth ]; + license = licenses.bsd3; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8dc8d14bc97..fd5f55db264 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3363,6 +3363,8 @@ in iannix = libsForQt5.callPackage ../applications/audio/iannix { }; + ibm-sw-tpm2 = callPackage ../tools/security/ibm-sw-tpm2 { }; + ibniz = callPackage ../tools/graphics/ibniz { }; icecast = callPackage ../servers/icecast { }; From 0cb599293b4d005d57caf21f5c3b511235b580cd Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Thu, 14 Feb 2019 05:17:13 +0100 Subject: [PATCH 2/3] tpm2-tss: init at 2.2.0 --- .../libraries/tpm2-tss/default.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 49 insertions(+) create mode 100644 pkgs/development/libraries/tpm2-tss/default.nix diff --git a/pkgs/development/libraries/tpm2-tss/default.nix b/pkgs/development/libraries/tpm2-tss/default.nix new file mode 100644 index 00000000000..0ea8107cad1 --- /dev/null +++ b/pkgs/development/libraries/tpm2-tss/default.nix @@ -0,0 +1,47 @@ +{ stdenv, lib, fetchurl +, cmocka, doxygen, ibm-sw-tpm2, iproute, openssl, perl, pkgconfig, procps +, uthash, which }: + +stdenv.mkDerivation rec { + pname = "tpm2-tss"; + version = "2.2.0"; + + src = fetchurl { + url = "https://github.com/tpm2-software/${pname}/releases/download/${version}/${pname}-${version}.tar.gz"; + sha256 = "10r5wgrq21p0y700gh5iirh26pc5gsaib2b8b2nzmbr27apiw4y9"; + }; + + nativeBuildInputs = [ + doxygen perl pkgconfig + # For unit tests and integration tests. + ibm-sw-tpm2 iproute procps which + ]; + buildInputs = [ + openssl + # For unit tests and integration tests. + cmocka uthash + ]; + + postPatch = "patchShebangs script"; + + configureFlags = [ + "--enable-unit" + "--enable-integration" + ]; + + doCheck = true; + + postInstall = '' + # Do not install the upstream udev rules, they rely on specific + # users/groups which aren't guaranteed to exist on the system. + rm -R $out/lib/udev + ''; + + meta = with lib; { + description = "OSS implementation of the TCG TPM2 Software Stack (TSS2)"; + homepage = https://github.com/tpm2-software/tpm2-tss; + license = licenses.bsd2; + platforms = platforms.linux; + maintainers = with maintainers; [ delroth ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fd5f55db264..e225431542a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12837,6 +12837,8 @@ in totem-pl-parser = callPackage ../development/libraries/totem-pl-parser { }; + tpm2-tss = callPackage ../development/libraries/tpm2-tss { }; + tremor = callPackage ../development/libraries/tremor { }; twolame = callPackage ../development/libraries/twolame { }; From d21e4f1ab414c22a35aa7194e0842f15cf5b49c9 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Thu, 14 Feb 2019 06:12:32 +0100 Subject: [PATCH 3/3] tpm2-tools: init at 3.1.3 --- pkgs/tools/security/tpm2-tools/default.nix | 38 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 pkgs/tools/security/tpm2-tools/default.nix diff --git a/pkgs/tools/security/tpm2-tools/default.nix b/pkgs/tools/security/tpm2-tools/default.nix new file mode 100644 index 00000000000..84369e6ea54 --- /dev/null +++ b/pkgs/tools/security/tpm2-tools/default.nix @@ -0,0 +1,38 @@ +{ stdenv, fetchurl, fetchpatch, lib +, cmocka, curl, pandoc, pkgconfig, openssl, tpm2-tss }: + +stdenv.mkDerivation rec { + pname = "tpm2-tools"; + version = "3.1.3"; + + src = fetchurl { + url = "https://github.com/tpm2-software/${pname}/releases/download/${version}/${pname}-${version}.tar.gz"; + sha256 = "05is1adwcg7y2p121yldd8m1gigdnzf9izbjazvsr6yg95pmg5fc"; + }; + + patches = [ + (fetchpatch { + name = "tests-tss-2.2.0-compat.patch"; + url = "https://patch-diff.githubusercontent.com/raw/tpm2-software/tpm2-tools/pull/1322.patch"; + sha256 = "0yy5qbgbd13d7cl8pzsji95a6qnwiik5s2cyqj35jd8blymikqxh"; + }) + ]; + + nativeBuildInputs = [ pandoc pkgconfig ]; + buildInputs = [ + curl openssl tpm2-tss + # For unit tests. + cmocka + ]; + + configureFlags = [ "--enable-unit" ]; + doCheck = true; + + meta = with lib; { + description = "Command line tools that provide access to a TPM 2.0 compatible device"; + homepage = https://github.com/tpm2-software/tpm2-tools; + license = licenses.bsd3; + platforms = platforms.linux; + maintainers = with maintainers; [ delroth ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e225431542a..2dd4e5465bd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5829,6 +5829,8 @@ in tpm-luks = callPackage ../tools/security/tpm-luks { }; + tpm2-tools = callPackage ../tools/security/tpm2-tools { }; + trezord = callPackage ../servers/trezord { }; tthsum = callPackage ../applications/misc/tthsum { };