summaryrefslogtreecommitdiff
path: root/dev-python/tpm2-pytss
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-05-10 00:01:14 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-05-10 00:01:14 +0100
commit17e5f1ea4a2e1c5664f96480ca46348d008e8711 (patch)
tree7166d1b58a582290a4ad23ff5882cca911b8035c /dev-python/tpm2-pytss
parenta0ce545d52f231499bf9f3644493113d8af58ec9 (diff)
gentoo auto-resync : 10:05:2024 - 00:01:13
Diffstat (limited to 'dev-python/tpm2-pytss')
-rw-r--r--dev-python/tpm2-pytss/Manifest5
-rw-r--r--dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch83
-rw-r--r--dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch53
-rw-r--r--dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch28
-rw-r--r--dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild6
5 files changed, 174 insertions, 1 deletions
diff --git a/dev-python/tpm2-pytss/Manifest b/dev-python/tpm2-pytss/Manifest
index 63c74c07ecff..50abc7693bc1 100644
--- a/dev-python/tpm2-pytss/Manifest
+++ b/dev-python/tpm2-pytss/Manifest
@@ -1,3 +1,6 @@
+AUX tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch 3152 BLAKE2B 8fc273a652720dd11ba697516f30bcbd5acee740dfed649355f8e25de97394b1c7c5d1f338801f14fa9618445f85e850ab40238d78c601dd22ed6e2db686115b SHA512 1c713002e215f0b5be5c436753e390d9f2e3b8b8ca4350ea5246685ed8d6beb87d858fd7c9cd1b24908af0e1057dfe7474c6e091e95a782c3bc430aa327b50d7
+AUX tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch 1944 BLAKE2B b7f9e517427b2b25dc42730b7b39bf055f890b66c6f0b34e04ee495755fc98162c1af11d2520b9b08aa16396e1c574116e5ffb323ce41dbc0ab7fba4a2b4438d SHA512 ae6a8f9d544b4770a58821655cfd622cc6ed0d6e556cc40dc58097715ccf4d3fa84db82ead598409b50d73a2d63924d7519aa9ffef530456c65be1ae5ad13812
+AUX tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch 1048 BLAKE2B 3d858726c61b216e5e22ed4af4ef0d34a68030d4260c15aa76f2516a3ccb130d6e6003e54fb35f8614e17751fdb91834ecd1b502825214bd29dba453c9e7ed36 SHA512 56033320e62b25a1b5da1241dd3fa8f1170d9320c575ca46a66fc255f26a9c807cd4425fada5cdd18626468281f3f9303faff4fd1e276ab2e0e2f7c1e0284222
DIST tpm2-pytss-2.2.1.tar.gz 208114 BLAKE2B fe07f38a6c19bc2b2baf079184f39d3ef28268900a35e14bfa22abb61dd956fdb286560ab6d35d66160147296e590fa3dac3d015f9919e1966f43179c1bdcdb1 SHA512 0acaa37d118d71edb123c5e88ef5af5dd78a73b0f8db15500866b6799d98e4c6107f9da1b8c1bce1c9061e9df85d735a39d9335cea65cac0e058db83aed8ad06
-EBUILD tpm2-pytss-2.2.1.ebuild 941 BLAKE2B 5d249a0c5a214281fd8d846fd6e946e506580e7dac30054afbae57bf450624726db3a8293f47bf535cd091e61361bf8b32322571465636a7a9b2db7be34ab47f SHA512 07ef46e0fc35711c3cb89fbde64f16af34ab598cd175a1a228cf475a205ecc10792723c0de02c97a7137d2d4a573920b8fe39e922a78e33035b20749024f0639
+EBUILD tpm2-pytss-2.2.1.ebuild 1193 BLAKE2B 8e2a9993c80247f2c5ea8bb53091062b3a1bff6facaa24c1c187bcb47a764088e29ff4204e108a5012ec92cf086b92b9072b9c81007cea642bdeddba93e7deb2 SHA512 6ab8a9f9a22fb9ba9d5248b49066c42a4b8fafb9c0776a00e56f46efb5759f536c99b661e15ecc88fa935687ae8deab618356c66dad576efdd79d2af190cff6e
MISC metadata.xml 648 BLAKE2B e4de9aae579210454f1a71043de7073c1aa7ead9c5acdea48ec2c8ebf5665ebb6837f198b6de49f7ae58bd1f5062ed4f8ca7092df56d8904aecd16bc226d95cd SHA512 dd87ec10b28530281c08d57d86a5004178e4eda729a43690ad4ab84effe246b34d777ec56c66d61a1e0335d2b9c1599366aa55bc58477f7c2dfa4eec5ab7d9ac
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch
new file mode 100644
index 000000000000..ff18af2015c6
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch
@@ -0,0 +1,83 @@
+From a04715c5ef5bc3d6b30b1354d64db1762bc42b9c Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Fri, 12 Apr 2024 19:49:52 +0200
+Subject: [PATCH 1/2] Revert "test: skip some FAPI tests if testing agains
+ tpm2-tss master branch."
+
+This reverts commit 9e948984676b38f71e923a6e167340dc99554ac0.
+
+Fixed in tpm2-tss master branch, so remove the temporary fixes.
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ test/test_fapi.py | 19 +++++--------------
+ 1 file changed, 5 insertions(+), 14 deletions(-)
+
+diff --git a/test/test_fapi.py b/test/test_fapi.py
+index f702fc9..6b77c66 100644
+--- a/test/test_fapi.py
++++ b/test/test_fapi.py
+@@ -13,7 +13,7 @@ from cryptography.hazmat.primitives.asymmetric.padding import PSS
+
+ from tpm2_pytss import *
+
+-from tpm2_pytss.internal.utils import is_bug_fixed, _lib_version_atleast
++from tpm2_pytss.internal.utils import is_bug_fixed
+
+ from .TSS2_BaseTest import TpmSimulator
+ from tpm2_pytss.TSS2_Exception import TSS2_Exception
+@@ -614,8 +614,7 @@ class Common:
+ self.fapi.sign(key_path, b"\x22" * 32)
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2084",
+ )
+ def test_write_authorize_nv(self, esys):
+@@ -662,8 +661,7 @@ class Common:
+ self.fapi.quote(path=key_path, pcrs=[7, 9])
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2084",
+ )
+ def test_authorize_policy(self, sign_key):
+@@ -728,9 +726,7 @@ class Common:
+ self.fapi.quote(path=key_path, pcrs=[7, 9])
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2"),
+- reason="tpm2-tss bug, see #2080",
++ not is_bug_fixed(fixed_in="3.2"), reason="tpm2-tss bug, see #2080"
+ )
+ def test_policy_signed(self, cryptography_key):
+ # create external signing key used by the signing authority external to the TPM
+@@ -792,10 +788,6 @@ class Common:
+ with pytest.raises(TSS2_Exception):
+ self.fapi.sign(path=key_path, digest=b"\x11" * 32)
+
+- @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170"),
+- reason="issue on master branch.",
+- )
+ def test_policy_branched(self):
+ pcr_index = 15
+ pcr_data = b"ABCDEF"
+@@ -913,8 +905,7 @@ class Common:
+ self.fapi.delete(path=nv_path)
+
+ @pytest.mark.skipif(
+- _lib_version_atleast("tss2-fapi", "4.0.1-170")
+- or not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
++ not is_bug_fixed(fixed_in="3.2", backports=["2.4.7", "3.0.5", "3.1.1"]),
+ reason="tpm2-tss bug, see #2089",
+ )
+ def test_policy_action(self):
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch
new file mode 100644
index 000000000000..2938e1938940
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch
@@ -0,0 +1,53 @@
+From 5a33c767be196328948baef569de084d97d62384 Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Tue, 26 Mar 2024 13:25:10 +0100
+Subject: [PATCH] cryptography: fixes for newer version of cryptography
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ src/tpm2_pytss/internal/crypto.py | 1 +
+ test/test_encoding.py | 2 +-
+ test/test_policy.py | 2 +-
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/tpm2_pytss/internal/crypto.py b/src/tpm2_pytss/internal/crypto.py
+index 42030c5..f9d8c34 100644
+--- a/src/tpm2_pytss/internal/crypto.py
++++ b/src/tpm2_pytss/internal/crypto.py
+@@ -25,6 +25,7 @@ from cryptography.hazmat.backends import default_backend
+ from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature
+ from typing import Tuple, Type, Any
+ import secrets
++import inspect
+ import sys
+
+ _curvetable = (
+diff --git a/test/test_encoding.py b/test/test_encoding.py
+index 1f58562..8cf4b51 100644
+--- a/test/test_encoding.py
++++ b/test/test_encoding.py
+@@ -1406,7 +1406,7 @@ class ToolsTest(TSS2_BaseTest):
+ def test_tools_decode_tpm2b_name(self):
+ if not self.has_tools:
+ self.skipTest("tools not in path")
+- key = ec.generate_private_key(ec.SECP256R1).public_key()
++ key = ec.generate_private_key(ec.SECP256R1()).public_key()
+ kb = key.public_bytes(
+ serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo
+ )
+diff --git a/test/test_policy.py b/test/test_policy.py
+index f18aa8a..5f56e21 100644
+--- a/test/test_policy.py
++++ b/test/test_policy.py
+@@ -47,7 +47,7 @@ class TestPolicy(TSS2_EsapiTest):
+ super().setUp()
+ self._has_secp192r1 = True
+ try:
+- ec.generate_private_key(ec.SECP192R1)
++ ec.generate_private_key(ec.SECP192R1())
+ except Exception:
+ self._has_secp192r1 = False
+
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch
new file mode 100644
index 000000000000..99f65025434f
--- /dev/null
+++ b/dev-python/tpm2-pytss/files/tpm2-pytss-2.2.1-scripts-update-regex-for-defines.patch
@@ -0,0 +1,28 @@
+From b02fdc8e259fe977c1065389c042be69e2985bdf Mon Sep 17 00:00:00 2001
+From: Erik Larsson <who+github@cnackers.org>
+Date: Sat, 20 Apr 2024 10:32:55 +0200
+Subject: [PATCH 2/2] scripts: update regex for #defines
+
+Commit fdb3594b27aee315ad56af361512800266672582 in tpm2-tss changed
+the structure of some defines, so fix the regex.
+
+Signed-off-by: Erik Larsson <who+github@cnackers.org>
+---
+ scripts/prepare_headers.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/scripts/prepare_headers.py b/scripts/prepare_headers.py
+index 6ca9b64..a7529b3 100644
+--- a/scripts/prepare_headers.py
++++ b/scripts/prepare_headers.py
+@@ -32,6 +32,7 @@ def remove_common_guards(s):
+
+ # Restructure #defines with ...
+ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(.*?\) \(.*?\)\)", "\g<1>...", s)
++ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(\(.*?\) .*\)", "\g<1>...", s)
+ s = re.sub("(#define [A-Za-z0-9_]+) +\(\(.*?\).*?\) ", "\g<1>...", s)
+ s = re.sub(
+ "(#define [A-Za-z0-9_]+) .*\n.*?.*\)\)", "\g<1>...", s, flags=re.MULTILINE
+--
+2.43.2
+
diff --git a/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild b/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
index aa01cc807256..a14aa4203d81 100644
--- a/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
+++ b/dev-python/tpm2-pytss/tpm2-pytss-2.2.1.ebuild
@@ -39,6 +39,12 @@ BDEPEND="
dev-python/setuptools-scm[${PYTHON_USEDEP}]
"
+PATCHES=(
+ "${FILESDIR}/${PN}-2.2.1-cryptography-fixes-for-newer-version-of-cryptography.patch"
+ "${FILESDIR}/${PN}-2.2.1-Revert-test-skip-some-FAPI-tests-if-testing-agains-t.patch"
+ "${FILESDIR}/${PN}-2.2.1-scripts-update-regex-for-defines.patch"
+ )
+
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
distutils_enable_tests pytest