summaryrefslogtreecommitdiff
path: root/app-crypt/tpm2-openssl
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-09-14 22:48:30 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-09-14 22:48:30 +0100
commitea7f3f690b55cdfa8b2d350b03c1dfc0c8357a51 (patch)
tree4b5a746c80bd7aacbe83448c66643e9dc4dcc105 /app-crypt/tpm2-openssl
parentcdb999af22d9aa464bfd480fc9f5ebda71fc89e2 (diff)
gentoo auto-resync : 14:09:2023 - 22:48:30
Diffstat (limited to 'app-crypt/tpm2-openssl')
-rw-r--r--app-crypt/tpm2-openssl/Manifest4
-rw-r--r--app-crypt/tpm2-openssl/files/tpm2-openssl-1.1.1-tests-include-base-provider-required-to-load-ecparam.patch25
-rw-r--r--app-crypt/tpm2-openssl/metadata.xml15
-rw-r--r--app-crypt/tpm2-openssl/tpm2-openssl-1.1.1.ebuild97
4 files changed, 141 insertions, 0 deletions
diff --git a/app-crypt/tpm2-openssl/Manifest b/app-crypt/tpm2-openssl/Manifest
new file mode 100644
index 000000000000..c3e8f9b3cf70
--- /dev/null
+++ b/app-crypt/tpm2-openssl/Manifest
@@ -0,0 +1,4 @@
+AUX tpm2-openssl-1.1.1-tests-include-base-provider-required-to-load-ecparam.patch 892 BLAKE2B 25314711ddf35721fb3b8c3c0b077d29f4a097df226dd986f48411bbb79f9e6a30c7bab9a2d19daad85498d5c648833c918c41060fae3f5e22d91d45e7f546ef SHA512 ad5ad95f3fa91a876032472dcaad55384421daf6d9f7b80381dcf0284471006b58a4c0b1bcad2f0ed3df132e6e8da3eec44e9a20413d3685fe1f69b7de150c5b
+DIST tpm2-openssl-1.1.1.tar.gz 415093 BLAKE2B 4f05b04ad059b9e5232bde2426102628927c71360cda5c3a1df02f951a8ecd6e1e036a6373ac5d7fc8209415874c52544eca3195e2361a165bc2c91f99ad85b1 SHA512 be4f114b21d15e6baeb7e756a787619d01f20171e86ebc42ea098c98d59ffd2ba648885b345b9d1a9dc3339199eaa6db8335f039587be338c1126e23349b8812
+EBUILD tpm2-openssl-1.1.1.ebuild 2269 BLAKE2B 2b3cadf7e1a5452ca39a7a720e0ebc7ebfe6ad70b8de366c1f2fed0d7bc0b638f6b9e5f359d16aafe2791adca74b39510dc0aadc292e1dd5ee727dcfbddd8c6a SHA512 6c419a5394d6d8cace118b8362c2ce7e8bfd7dcda3d417a72e7bbe96681c13cf1cef0f99d5ba4332bb1bf54d4678e74ca188966bff72c6035e061117ff6c1bb3
+MISC metadata.xml 495 BLAKE2B 2859f35839200edede18d42a8c1e04c3eb2a8983e35a6aa73352d20f5f1a9b8e2685091ab6c121442bbc23ef232ab701cfe1e5eb2f1e2fbd8c3fa1cafd51b749 SHA512 cf93a17e4ef6cf8e9294fadd0b7a33ccf21196bf648f1239a99cb0d8675c130e7e5ab7990b9a292f0814072ee3d234085d92e250f72b86ad854d81a68a642879
diff --git a/app-crypt/tpm2-openssl/files/tpm2-openssl-1.1.1-tests-include-base-provider-required-to-load-ecparam.patch b/app-crypt/tpm2-openssl/files/tpm2-openssl-1.1.1-tests-include-base-provider-required-to-load-ecparam.patch
new file mode 100644
index 000000000000..5a5554628600
--- /dev/null
+++ b/app-crypt/tpm2-openssl/files/tpm2-openssl-1.1.1-tests-include-base-provider-required-to-load-ecparam.patch
@@ -0,0 +1,25 @@
+From 483030d85563e26a62e4baeac3b0fdca0e314199 Mon Sep 17 00:00:00 2001
+From: Petr Gotthard <petr.gotthard@advantech.cz>
+Date: Fri, 23 Dec 2022 10:46:40 +0100
+Subject: [PATCH] tests: include base provider required to load ecparam
+
+---
+ test/ec_genpkey_parameters.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/ec_genpkey_parameters.sh b/test/ec_genpkey_parameters.sh
+index 406b558..a4f68d7 100755
+--- a/test/ec_genpkey_parameters.sh
++++ b/test/ec_genpkey_parameters.sh
+@@ -6,7 +6,7 @@ set -eufx
+ openssl ecparam -name prime256v1 -out testparam.pem
+
+ # generate private key as PEM
+-openssl genpkey -provider tpm2 -paramfile testparam.pem -out testkey.pem
++openssl genpkey -provider tpm2 -provider base -paramfile testparam.pem -out testkey.pem
+
+ # display private key info
+ openssl ec -provider tpm2 -provider base -in testkey.pem -check -text -noout
+--
+2.39.2
+
diff --git a/app-crypt/tpm2-openssl/metadata.xml b/app-crypt/tpm2-openssl/metadata.xml
new file mode 100644
index 000000000000..f02af2f290cf
--- /dev/null
+++ b/app-crypt/tpm2-openssl/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>salah.coronya@gmail.com</email>
+ <name>Christopher Byrne</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">tpm2-software/tpm2-openssl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-crypt/tpm2-openssl/tpm2-openssl-1.1.1.ebuild b/app-crypt/tpm2-openssl/tpm2-openssl-1.1.1.ebuild
new file mode 100644
index 000000000000..54fda1a513cb
--- /dev/null
+++ b/app-crypt/tpm2-openssl/tpm2-openssl-1.1.1.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="OpenSSL Provider for TPM2 integration"
+HOMEPAGE="https://github.com/tpm2-software/tpm2-openssl"
+SRC_URI="https://github.com/tpm2-software/tpm2-openssl/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=app-crypt/tpm2-tss-3.2.0:=
+ >=dev-libs/openssl-3:="
+DEPEND="${RDEPEND}
+ test? (
+ app-crypt/swtpm[gnutls]
+ app-crypt/tpm2-abrmd
+ app-crypt/tpm2-tools
+ )"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=( "${FILESDIR}"/${P}-tests-include-base-provider-required-to-load-ecparam.patch )
+
+src_test() {
+ dbus_run() {
+ (
+ # start isolated dbus session bus
+ local dbus_data=$(dbus-launch --sh-syntax) || exit
+ eval "${dbus_data}"
+
+ $@
+ ret=${?}
+
+ kill "${DBUS_SESSION_BUS_PID}"
+ exit "${ret}"
+ ) || die
+ }
+
+ tpm2_run_with_emulator() {
+ local -x XDG_CONFIG_HOME="${T}"/.config/swtpm
+ "${BROOT}"/usr/share/swtpm/swtpm-create-user-config-files || die
+
+ mkdir -p "${XDG_CONFIG_HOME}"/mytpm1 || die
+ local swtpm_setup_args=(
+ --tpm2
+ --tpmstate "${XDG_CONFIG_HOME}"/mytpm1
+ --createek
+ --allow-signing
+ --decryption
+ --create-ek-cert
+ --create-platform-cert
+ --lock-nvram
+ --overwrite
+ --display
+ )
+ swtpm_setup "${swtpm_setup_args[@]}" || die
+
+ local swtpm_socket_args=(
+ --tpm2
+ --tpmstate dir="${XDG_CONFIG_HOME}"/mytpm1
+ --flags startup-clear
+ --ctrl type=unixio,path="${XDG_CONFIG_HOME}"/mytpm1/swtpm.socket.ctrl
+ --server type=unixio,path="${XDG_CONFIG_HOME}"/mytpm1/swtpm.socket
+ --pid file="${XDG_CONFIG_HOME}"/mytpm1/swtpm.pid
+ --daemon
+ )
+ swtpm socket "${swtpm_socket_args[@]}" || die
+
+ local tpm2_abrmd_args=(
+ --logger=stdout
+ --tcti=swtpm:path="${XDG_CONFIG_HOME}"/mytpm1/swtpm.socket
+ --session
+ --flush-all
+ )
+ tpm2-abrmd "${tpm2_abrmd_args[@]}" &
+
+ local -x TPM2OPENSSL_TCTI="tabrmd:bus_type=session"
+ local -x TPM2TOOLS_TCTI="tabrmd:bus_type=session"
+
+ $@ || die
+
+ # When swtpm dies, tmp2-abrmd will exit
+ kill $(< "${XDG_CONFIG_HOME}"/mytpm1/swtpm.pid) || die
+ }
+
+ dbus_run tpm2_run_with_emulator make check
+}
+
+src_install() {
+ default
+ find "${ED}" -iname '*.la' -delete || die
+}