From c39e463c678503351a8096ad70c48da826fde7dc Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 30 Mar 2018 11:35:08 -0400 Subject: [PATCH] Prefer cyrptodomex if present For compatibility, accept PyCrypto. However if Cryptodomex is present (explicit version of cryptodome), use that. This is an easier path to a modern supported AES implementation that continues to support older, but still prevalent long term linux distributions. Another project required cryptodome, and evidently it caused problems due to some interoperability with things that truly needed PyCrypto. Change-Id: I3c0601bc0b6ae56417e712b50337ec1c20eb89a2 --- pyghmi/ipmi/private/session.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index f425fad7..fc1d46cb 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -27,7 +27,10 @@ import socket import struct import threading -from Crypto.Cipher import AES +try: + from Cryptodome.Cipher import AES +except ImportError: + from Crypto.Cipher import AES import pyghmi.exceptions as exc from pyghmi.ipmi.private import constants