Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 May 2019 16:16:28 +0000 (UTC)
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r347993 - user/ngie/bug-237403/tests/sys/opencrypto
Message-ID:  <201905201616.x4KGGSTN013922@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon May 20 16:16:28 2019
New Revision: 347993
URL: https://svnweb.freebsd.org/changeset/base/347993

Log:
  Fix some improper binascii conversions
  
  .encode should use .hexlify, not .unhexlify.

Modified:
  user/ngie/bug-237403/tests/sys/opencrypto/cryptodev.py
  user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py

Modified: user/ngie/bug-237403/tests/sys/opencrypto/cryptodev.py
==============================================================================
--- user/ngie/bug-237403/tests/sys/opencrypto/cryptodev.py	Mon May 20 16:00:32 2019	(r347992)
+++ user/ngie/bug-237403/tests/sys/opencrypto/cryptodev.py	Mon May 20 16:16:28 2019	(r347993)
@@ -552,15 +552,15 @@ if __name__ == '__main__':
         c = Crypto(CRYPTO_AES_ICM, key)
         enc = c.encrypt(pt, iv)
 
-        print('enc:', binascii.unhexlify(enc))
-        print(' ct:', binascii.unhexlify(ct))
+        print('enc:', binascii.hexlify(enc))
+        print(' ct:', binascii.hexlify(ct))
 
         assert ct == enc
 
         dec = c.decrypt(ct, iv)
 
-        print('dec:', binascii.unhexlify(dec))
-        print(' pt:', binascii.unhexlify(pt))
+        print('dec:', binascii.hexlify(dec))
+        print(' pt:', binascii.hexlify(pt))
 
         assert pt == dec
     elif False:

Modified: user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py
==============================================================================
--- user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py	Mon May 20 16:00:32 2019	(r347992)
+++ user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py	Mon May 20 16:16:28 2019	(r347993)
@@ -164,8 +164,8 @@ def GenTestCase(cname):
                                 if e.errno != errno.EINVAL:
                                     raise
                                 continue
-                            data['rpt'] = binascii.unhexlify(rpt)
-                            data['rtag'] = binascii.unhexlify(rtag)
+                            data['rpt'] = binascii.hexlify(rpt)
+                            data['rtag'] = binascii.hexlify(rtag)
                             self.assertEqual(rpt, pt,
                                 repr(data))
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905201616.x4KGGSTN013922>