diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-03-08 19:07:58 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-03-08 19:07:58 +0000 |
commit | 8edd4a48a39640822abe6ddb7b2a1d5b2da4ea70 (patch) | |
tree | dd40a3ea9cdcc06c8c63bd2ee71c2c2c0ea11549 /dev-python/tpm2-pytss/files | |
parent | 7825305c5ddf11fffe24fa30453c4e8468f64305 (diff) |
gentoo auto-resync : 08:03:2024 - 19:07:58
Diffstat (limited to 'dev-python/tpm2-pytss/files')
3 files changed, 0 insertions, 158 deletions
diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch deleted file mode 100644 index 4aaecd935c22..000000000000 --- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-internal-crypto-fix-_MyRSAPrivateNumbers-with-crypto.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0fbb9d099370c0a7031dd13990986538f586836a Mon Sep 17 00:00:00 2001 -From: Erik Larsson <who+github@cnackers.org> -Date: Fri, 26 Jan 2024 12:01:41 +0100 -Subject: [PATCH 3/3] internal/crypto: fix _MyRSAPrivateNumbers with - cryptograpy >= 42.0.1 - -RSAPrivateNumbers was moved to a rust implementation in 42.0.1. -So inheritance is no longer possible, so turn the class into a -wrapper instead of a subclass. - -Fixes #561 - -Signed-off-by: Erik Larsson <who+github@cnackers.org> ---- - src/tpm2_pytss/internal/crypto.py | 21 +++++++++------------ - 1 file changed, 9 insertions(+), 12 deletions(-) - -diff --git a/src/tpm2_pytss/internal/crypto.py b/src/tpm2_pytss/internal/crypto.py -index 93e5181..42030c5 100644 ---- a/src/tpm2_pytss/internal/crypto.py -+++ b/src/tpm2_pytss/internal/crypto.py -@@ -23,7 +23,7 @@ from cryptography.hazmat.primitives.ciphers.algorithms import AES, Camellia - from cryptography.hazmat.primitives.ciphers import modes, Cipher, CipherAlgorithm - from cryptography.hazmat.backends import default_backend - from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature --from typing import Tuple, Type -+from typing import Tuple, Type, Any - import secrets - import sys - -@@ -220,7 +220,7 @@ def public_to_key(obj): - return key - - --class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers): -+class _MyRSAPrivateNumbers: - def __init__(self, p: int, n: int, e: int, pubnums: rsa.RSAPublicNumbers): - - q = n // p -@@ -231,7 +231,12 @@ class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers): - dmq1 = rsa.rsa_crt_dmq1(d, q) - iqmp = rsa.rsa_crt_iqmp(p, q) - -- super().__init__(p, q, d, dmp1, dmq1, iqmp, pubnums) -+ self._private_numbers = rsa.RSAPrivateNumbers( -+ p, q, d, dmp1, dmq1, iqmp, pubnums -+ ) -+ -+ def private_key(self, *args: Any, **kwargs: Any) -> rsa.RSAPrivateKey: -+ return self._private_numbers.private_key(*args, **kwargs) - - @staticmethod - def _xgcd(a: int, b: int) -> Tuple[int, int, int]: -@@ -251,15 +256,7 @@ class _MyRSAPrivateNumbers(rsa.RSAPrivateNumbers): - # - @staticmethod - def _modinv(a, m): -- -- if sys.version_info < (3, 8): -- g, x, y = _MyRSAPrivateNumbers._xgcd(a, m) -- if g != 1: -- raise Exception("modular inverse does not exist") -- else: -- return x % m -- else: -- return pow(a, -1, m) -+ return pow(a, -1, m) - - @staticmethod - def _generate_d(p, q, e, n): --- -2.43.0 - diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch deleted file mode 100644 index c1aeaee4dcd1..000000000000 --- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch +++ /dev/null @@ -1,45 +0,0 @@ -From e4006e6066c015d9ed55befa9b98247fbdcafd7d Mon Sep 17 00:00:00 2001 -From: Erik Larsson <who+github@cnackers.org> -Date: Mon, 26 Jun 2023 12:15:41 +0200 -Subject: [PATCH] test: add check for renamed cryptography types - -Some types have changed their names in newer cryptography release, so add them to the tests - -Signed-off-by: Erik Larsson <who+github@cnackers.org> ---- - test/test_crypto.py | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/test/test_crypto.py b/test/test_crypto.py -index 92cda00..7d7466e 100644 ---- a/test/test_crypto.py -+++ b/test/test_crypto.py -@@ -596,11 +596,23 @@ class CryptoTest(TSS2_EsapiTest): - - with self.assertRaises(ValueError) as e: - TPMT_SENSITIVE.from_pem(der) -- self.assertEqual(str(e.exception), "unsupported key type: _DSAPrivateKey") -+ self.assertIn( -+ str(e.exception), -+ ( -+ "unsupported key type: _DSAPrivateKey", -+ "unsupported key type: DSAPrivateKey", -+ ), -+ ) - - with self.assertRaises(ValueError) as e: - TPMT_PUBLIC.from_pem(dsa_public_key) -- self.assertEqual(str(e.exception), "unsupported key type: _DSAPublicKey") -+ self.assertIn( -+ str(e.exception), -+ ( -+ "unsupported key type: _DSAPublicKey", -+ "unsupported key type: DSAPublicKey", -+ ), -+ ) - - def test_from_pem_with_symmetric(self): - sym = TPMT_SYM_DEF_OBJECT(algorithm=TPM2_ALG.AES) --- -2.41.0 - diff --git a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch deleted file mode 100644 index 6e99688b76ba..000000000000 --- a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-disable-pcr_set_auth_value-and-pcr_set_auth_pol.patch +++ /dev/null @@ -1,40 +0,0 @@ -From c55775c30c06bf3a3066b4047cb51cb42f1e403d Mon Sep 17 00:00:00 2001 -From: Erik Larsson <who+github@cnackers.org> -Date: Sat, 6 Jan 2024 06:25:54 +0100 -Subject: [PATCH 2/3] test: disable pcr_set_auth_value and pcr_set_auth_policy - tests for swtpm - -Since [commit][1] in libtpms setting auth values/policies for PCRs are no longer supported. - -[1]: https://github.com/stefanberger/libtpms/commit/af4fc0e66df6d012c61aee7c418148fb261d77a9 - -Signed-off-by: Erik Larsson <who+github@cnackers.org> ---- - test/test_esapi.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/test/test_esapi.py b/test/test_esapi.py -index 269a43b..e0b6d35 100644 ---- a/test/test_esapi.py -+++ b/test/test_esapi.py -@@ -3585,6 +3585,8 @@ class TestEsys(TSS2_EsapiTest): - self.ectx.pcr_allocate(pcrsels, session3=object()) - - def test_pcr_set_auth_policy(self): -+ if getattr(self.tcti, "name", "") == "swtpm": -+ self.skipTest("pcr_set_auth_policy not supported by swtpm") - - policy = b"0123456789ABCDEF0123456789ABCDEF" - self.ectx.pcr_set_auth_policy(policy, TPM2_ALG.SHA256, ESYS_TR.PCR20) -@@ -3630,6 +3632,8 @@ class TestEsys(TSS2_EsapiTest): - ) - - def test_pcr_set_auth_value(self): -+ if getattr(self.tcti, "name", "") == "swtpm": -+ self.skipTest("pcr_set_auth_value not supported by swtpm") - - self.ectx.pcr_set_auth_value(ESYS_TR.PCR20, b"password") - self.ectx.tr_set_auth(ESYS_TR.PCR20, b"password") --- -2.43.0 - |