From owner-svn-src-user@freebsd.org Mon May 20 16:23:36 2019 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 337E015B1B7F for ; Mon, 20 May 2019 16:23:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C9BD8858DC; Mon, 20 May 2019 16:23:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81B8E20C19; Mon, 20 May 2019 16:23:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4KGNZlq019117; Mon, 20 May 2019 16:23:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4KGNZU0019116; Mon, 20 May 2019 16:23:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905201623.x4KGNZU0019116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Mon, 20 May 2019 16:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r347994 - user/ngie/bug-237403/tests/sys/opencrypto X-SVN-Group: user X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: user/ngie/bug-237403/tests/sys/opencrypto X-SVN-Commit-Revision: 347994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C9BD8858DC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 16:23:36 -0000 Author: ngie Date: Mon May 20 16:23:35 2019 New Revision: 347994 URL: https://svnweb.freebsd.org/changeset/base/347994 Log: Replace more instances of .decode('hex') with binascii.unhexlify for py3 compatibility Modified: user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py Modified: user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py ============================================================================== --- user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py Mon May 20 16:16:28 2019 (r347993) +++ user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py Mon May 20 16:23:35 2019 (r347994) @@ -248,15 +248,15 @@ def GenTestCase(cname): if Nlen != 12: # OCF only supports 12 byte IVs continue - key = data['Key'].decode('hex') - nonce = data['Nonce'].decode('hex') + key = binascii.unhexlify(data['Key']) + nonce = binascii.unhexlify(data['Nonce']) Alen = int(data['Alen']) if Alen != 0: - aad = data['Adata'].decode('hex') + aad = binascii.unhexlify(data['Adata']) else: aad = None - payload = data['Payload'].decode('hex') - ct = data['CT'].decode('hex') + payload = binascii.unhexlify(data['Payload']) + ct = binascii.unhexlify(data['CT']) try: c = Crypto(crid=crid, @@ -291,14 +291,14 @@ def GenTestCase(cname): if Tlen != 16: # OCF only supports 16 byte tags continue - key = data['Key'].decode('hex') - nonce = data['Nonce'].decode('hex') + key = binascii.unhexlify(data['Key']) + nonce = binascii.unhexlify(data['Nonce']) Alen = int(data['Alen']) if Alen != 0: - aad = data['Adata'].decode('hex') + aad = binascii.unhexlify(data['Adata']) else: aad = None - ct = data['CT'].decode('hex') + ct = binascii.unhexlify(data['CT']) tag = ct[-16:] ct = ct[:-16] @@ -320,7 +320,7 @@ def GenTestCase(cname): r = Crypto.decrypt(c, payload, nonce, aad, tag) - payload = data['Payload'].decode('hex') + payload = binascii.unhexlify(data['Payload']) plen = int(data('Plen')) payload = payload[:plen] self.assertEqual(r, payload, @@ -405,9 +405,9 @@ def GenTestCase(cname): continue for data in lines: - msg = data['Msg'].decode('hex') + msg = binascii.unhexlify(data['Msg']) msg = msg[:int(data['Len'])] - md = data['MD'].decode('hex') + md = binascii.unhexlify(data['MD']) try: c = Crypto(mac=alg, crid=crid,