[Cryptech-Commits] [sw/libhal] branch master updated: Kludge cryptech_backup into working with Python 3.8

git at cryptech.is git at cryptech.is
Sun Sep 6 21:34:09 UTC 2020


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository sw/libhal.

The following commit(s) were added to refs/heads/master by this push:
     new 68f2f6f  Kludge cryptech_backup into working with Python 3.8
68f2f6f is described below

commit 68f2f6f9c908d4f51036505b50ab42436e720143
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun Sep 6 17:31:04 2020 -0400

    Kludge cryptech_backup into working with Python 3.8
    
    PyCrypto is past EOL and we really should move on, but not this close
    to a release.  Working around the deprecated time.clock function is
    sick but appears to be harmless given the way that function is used in
    PyCrypto's internal RNG.  Would be better just to use os.urandom() but
    that would be a much larger change.
    
    In theory, PyCryptodome is a drop-in replacement for PyCrypto which
    would solve this problem for us.  Unfortunately, it's much less of a
    drop-in than its documentation suggests, even before one gets into
    Debian and pip disagreeing on what its name should be.  Maybe someday,
    but not today.
---
 cryptech_backup | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/cryptech_backup b/cryptech_backup
index def2a31..a15c9c0 100755
--- a/cryptech_backup
+++ b/cryptech_backup
@@ -381,6 +381,15 @@ class SoftKEKEK(object):
 
     oid_aesKeyWrap = b"\x60\x86\x48\x01\x65\x03\x04\x01\x30"
 
+    # This is sick, but probably harmless, and lets us keep using
+    # PyCrypto for a little longer.
+
+    try:
+        import time
+        time.clock
+    except AttributeError:
+        time.clock = time.process_time
+
     def parse_EncryptedPrivateKeyInfo(self, der):
         from Crypto.Util.asn1 import DerObject, DerSequence, DerOctetString, DerObjectId
         encryptedPrivateKeyInfo = DerSequence()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list