linux-sgx/0104-pccsadmin-only-import-pypac-module-on-Windows.patch
Daniel P. Berrangé 12589a1af6 Port to pycryptography and pyasn1 and make keyring optional
pyOpenSSL 24.0.0 removed several APIs required by pccsadmin, so
porting to pycryptography is required on Fedora. Since RHEL does
not ship pyOpenSSL, the port is useful here too.

Using pyasn1 instead of asn1 gives stronger validation during
parsing and brings compatibility with RHEL that lacks python3-asn1

The keyring package needs to be optional on RHEL which lacks this
module (currently).

Also drop the inappropriate pccs port number change

Related: https://issues.redhat.com/browse/RHEL-121612
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-12-10 11:17:54 +00:00

36 lines
1.2 KiB
Diff

From eca1c479b23dd8e8c87e90988204c08b5e0c3edc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Fri, 4 Oct 2024 17:41:37 +0100
Subject: [PATCH 104/126] pccsadmin: only import 'pypac' module on Windows
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The PACSession object is only used in a code path that runs on
Windows, so don't try to import this on Linux, to avoid the
redundant dependency.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tools/PccsAdminTool/lib/intelsgx/pcs.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/PccsAdminTool/lib/intelsgx/pcs.py b/tools/PccsAdminTool/lib/intelsgx/pcs.py
index 9f1d224..046c781 100644
--- a/tools/PccsAdminTool/lib/intelsgx/pcs.py
+++ b/tools/PccsAdminTool/lib/intelsgx/pcs.py
@@ -5,8 +5,9 @@ import json
import binascii
from urllib import parse
from OpenSSL import crypto
-from pypac import PACSession
from platform import system
+if system() == 'Windows':
+ from pypac import PACSession
from lib.intelsgx.credential import Credentials
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
--
2.51.1