Files
gentoo/dev-python/tpm2-pytss/files/tpm2-pytss-2.3.0-cryptography-fix-support-for-cryptography-47.patch
Christopher Byrne d310825b5f dev-python/tpm2-pytss: Fix comaptiblity with >=dev-python/cryptogrpahy-47
Also, one of the tests because tpm2-tss implements a newer spec
than what tpm2-pytss expects, so skip it.

Closes: https://bugs.gentoo.org/978394
Signed-off-by: Christopher Byrne <salah.coronya@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/46534
Signed-off-by: Sam James <sam@gentoo.org>
2026-07-09 20:22:03 +01:00

47 lines
1.6 KiB
Diff

From 5d15cad4bde28902a4becb8e2a8e915aba8abbd0 Mon Sep 17 00:00:00 2001
From: Erik Larsson <who+github@cnackers.org>
Date: Sun, 26 Apr 2026 11:50:55 +0200
Subject: [PATCH 1/4] cryptography: fix support for cryptography 47.
The abstract classes now require deepcopy support, so add that.
Signed-off-by: Erik Larsson <who+github@cnackers.org>
---
src/tpm2_pytss/cryptography.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/tpm2_pytss/cryptography.py b/src/tpm2_pytss/cryptography.py
index 5b8432c..20dc34b 100644
--- a/src/tpm2_pytss/cryptography.py
+++ b/src/tpm2_pytss/cryptography.py
@@ -263,6 +263,14 @@ class tpm_rsa_private_key(rsa.RSAPrivateKey):
ectx=self._ectx, handle=self._handle, session=self._session
)
+ def __deepcopy__(self, memo: dict) -> "tpm_rsa_private_key":
+ """Retuns a copy of the private key.
+
+ Notes:
+ This behaves as a shallow copy as we don't copy the ESAPI context.
+ """
+ return self.__copy__()
+
class tpm_ecc_private_key(ec.EllipticCurvePrivateKey):
"""Interface to a TPM ECC key for use with the cryptography module.
@@ -440,3 +448,11 @@ class tpm_ecc_private_key(ec.EllipticCurvePrivateKey):
return tpm_ecc_private_key(
ectx=self._ectx, handle=self._handle, session=self._session
)
+
+ def __deepcopy__(self, memo: dict) -> "tpm_ecc_private_key":
+ """Retuns a copy of the private key.
+
+ Notes:
+ This behaves as a shallow copy as we don't copy the ESAPI context.
+ """
+ return self.__copy__()
--
2.54.0