From e58b4efb3625699ae7ad24f94030d3039704216b8dabd0b204d1650bc170ac74 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 11 Jul 2022 16:38:58 +0000 Subject: [PATCH] Accepting request 988380 from home:aplanas:branches:security tpm2-pytss contains the Python bindings to call the tpm2-tss libraries (mainly FAPI and ESAPI interfaces) OBS-URL: https://build.opensuse.org/request/show/988380 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-tpm2-pytss?expand=0&rev=1 --- .gitattributes | 23 +++++ .gitignore | 1 + ...rypto-fix-test_ecc_bad_curves-assert.patch | 25 +++++ _service | 18 ++++ python-tpm2-pytss.changes | 4 + python-tpm2-pytss.spec | 98 +++++++++++++++++++ tpm2-pytss-1.2.0.tar.gz | 3 + 7 files changed, 172 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-test_crypto-fix-test_ecc_bad_curves-assert.patch create mode 100644 _service create mode 100644 python-tpm2-pytss.changes create mode 100644 python-tpm2-pytss.spec create mode 100644 tpm2-pytss-1.2.0.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-test_crypto-fix-test_ecc_bad_curves-assert.patch b/0001-test_crypto-fix-test_ecc_bad_curves-assert.patch new file mode 100644 index 0000000..3d8d06e --- /dev/null +++ b/0001-test_crypto-fix-test_ecc_bad_curves-assert.patch @@ -0,0 +1,25 @@ +From b88dc903e7d304851ed651f3a9aea24656a5681c Mon Sep 17 00:00:00 2001 +From: Alberto Planas +Date: Mon, 11 Jul 2022 11:54:47 +0200 +Subject: [PATCH 1/1] test_crypto: fix test_ecc_bad_curves assert + +--- + test/test_crypto.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/test_crypto.py b/test/test_crypto.py +index 1120c7b..f65b465 100644 +--- a/test/test_crypto.py ++++ b/test/test_crypto.py +@@ -581,7 +581,7 @@ class CryptoTest(TSS2_EsapiTest): + def test_ecc_bad_curves(self): + with self.assertRaises(ValueError) as e: + pub = TPMT_PUBLIC.from_pem(ecc_bad_curve) +- self.assertEqual(str(e.exception), "unsupported curve: sect163r2") ++ self.assertEqual(str(e.exception), "Unsupported key format") + + pub = TPMT_PUBLIC.from_pem(ecc_public_key) + pub.parameters.eccDetail.curveID = TPM2_ECC.NONE +-- +2.36.1 + diff --git a/_service b/_service new file mode 100644 index 0000000..3987d70 --- /dev/null +++ b/_service @@ -0,0 +1,18 @@ + + + tpm2-pytss + 1.2.0 + git + disable + https://github.com/tpm2-software/tpm2-pytss.git + @PARENT_TAG@ + [v]?([^\+]+)(.*) + \1 + enable + + + *.tar + gz + + + diff --git a/python-tpm2-pytss.changes b/python-tpm2-pytss.changes new file mode 100644 index 0000000..2f488e1 --- /dev/null +++ b/python-tpm2-pytss.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Mon Jul 11 07:35:34 UTC 2022 - Alberto Planas Dominguez + +- Initial package for 1.2.0 diff --git a/python-tpm2-pytss.spec b/python-tpm2-pytss.spec new file mode 100644 index 0000000..ad3e7ac --- /dev/null +++ b/python-tpm2-pytss.spec @@ -0,0 +1,98 @@ +# +# spec file for package python-tpm2-pytss +# +# Copyright (c) 2022 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define pythons python3 +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define srcname tpm2-pytss +%bcond_with test +Name: python-%{srcname} +Version: 1.2.0 +Release: 0 +Summary: Python bindings for TSS +License: BSD-2-Clause +URL: https://github.com/tpm2-software/tpm2-pkcs11 +Source: %{srcname}-%{version}.tar.gz +Patch0: 0001-test_crypto-fix-test_ecc_bad_curves-assert.patch +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module asn1crypto} +BuildRequires: %{python_module cffi} +BuildRequires: %{python_module cryptography} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module packaging} +BuildRequires: %{python_module pkgconfig} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: pkgconfig +BuildRequires: python-rpm-macros +BuildRequires: pkgconfig(tss2-esys) +BuildRequires: pkgconfig(tss2-fapi) +Requires: python3-PyYAML +Requires: python3-asn1crypto +Requires: python3-cffi +Requires: python3-cryptography +Requires: python3-packaging +Requires: python3-setuptools +Requires: pkgconfig(tss2-esys) +Requires: pkgconfig(tss2-fapi) +%if %{with test} +# SECTION test requirements +BuildRequires: %{python_module pytest} +BuildRequires: swtpm +# /SECTION +%endif +%python_subpackages + +%description +TPM2 TSS Python bindings for Enhanced System API (ESYS), Feature API +(FAPI), Marshaling (MU), TCTI Loader (TCTILdr) and RC Decoding +(rcdecode) libraries. It also contains utility methods for wrapping +keys to TPM 2.0 data structures for importation into the TPM, +unwrapping keys and exporting them from the TPM, TPM-less +makecredential command and name calculations, TSS2 PEM Key format +support, importing Keys from PEM, DER and SSH formats, conversion from +tpm2-tools based command line strings and loading tpm2-tools context +files. + +%prep +%autosetup -p1 -n %{srcname}-%{version} + +%build +# Provides a PKG-INFO with "version" for setuptools_scm +cat < PKG-INFO +Metadata-Version: 1.1 +Version: %{version} +EOF +export CFLAGS="%{optflags}" +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} + +%if %{with test} +%check +%pytest_arch +%endif + +%files %{python_files} +%license LICENSE +%{python_sitearch}/tpm2_pytss +%{python_sitearch}/tpm2_pytss-%{version}*-info + +%changelog diff --git a/tpm2-pytss-1.2.0.tar.gz b/tpm2-pytss-1.2.0.tar.gz new file mode 100644 index 0000000..f23e8f0 --- /dev/null +++ b/tpm2-pytss-1.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22649ac0f02500498a76a364d94efef7834035f2d7536412d078baa131e9a87e +size 183892