aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unit-tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/unit-tests.py b/unit-tests.py
index c2f7171..526379c 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -41,6 +41,7 @@ import unittest
import datetime
import binascii
import logging
+import time
import sys
from struct import pack, unpack
@@ -76,6 +77,20 @@ except ImportError:
ecdsa_loaded = False
+# PyCrypto has been deprecated, at some point we should move on to
+# pycryptodome, cryptography.io, or some other modern thing. For the
+# moment, an awful kludge to let PyCrypto hobble a little further with
+# Python 3.8.
+#
+# Given that PyCrypto is using this as input to its random number
+# generator, you should not use any keys generated by PyCrypto with
+# this hack in place for any serious purpose: they're fine as
+# throwaway test keys, but not for securing any data you care about.
+
+if pycrypto_loaded and not hasattr(time, "clock") and hasattr(time, "process_time"):
+ time.clock = time.process_time
+
+
logger = logging.getLogger("unit-tests")