Backport patch about renamed cryptography objects

This commit is contained in:
Jakub Jelen 2023-08-16 11:24:20 +02:00
parent ab31b8224a
commit 822ccb3040
2 changed files with 45 additions and 0 deletions

View File

@ -39,3 +39,46 @@ diff -up tpm2-pytss-2.1.0/test/test_policy.py.old tpm2-pytss-2.1.0/test/test_pol
private_key = textwrap.dedent(
"""
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 92cda009..7d7466e2 100644
--- a/test/test_crypto.py
+++ b/test/test_crypto.py
@@ -596,11 +596,23 @@ def test_unsupported_key(self):
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)

View File

@ -9,6 +9,8 @@ Summary: TPM 2.0 TSS Bindings for Python
License: BSD-2-Clause
URL: https://github.com/tpm2-software/tpm2-pytss
Source: %{pypi_source %{pypi_name}}
# https://github.com/tpm2-software/tpm2-pytss/issues/527
# https://github.com/tpm2-software/tpm2-pytss/commit/e4006e6066c015d9ed55befa9b98247fbdcafd7d
Patch0: python-tpm2-pytss-1.2.0-openssl.patch
# https://github.com/tpm2-software/tpm2-pytss/commit/916c47ef6c30c2c6688f207bb780a2f4e6ef5384
Patch1: python-tpm2-pytss-2.1.0-i686.patch