From b106e0fccc13639e28755b4acc1393c58312e2de Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 24 Apr 2019 04:50:03 +0000 Subject: [PATCH] Chase PEP-3110 Replace `except Environment, e:` with `except Environment as e` for compatibility between python 2.x and python 3.x. While here, fix a bad indentation change from r346620 by reindenting the code properly. MFC after: 2 months --- tests/sys/opencrypto/cryptotest.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/sys/opencrypto/cryptotest.py b/tests/sys/opencrypto/cryptotest.py index ebd5bca24e5e..e223b5b08115 100644 --- a/tests/sys/opencrypto/cryptotest.py +++ b/tests/sys/opencrypto/cryptotest.py @@ -124,7 +124,7 @@ def runGCM(self, fname, mode): mac=self._gmacsizes[len(cipherkey)], mackey=cipherkey, crid=crid, maclen=16) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test algorithms the driver does not support. if e.errno != errno.EOPNOTSUPP: raise @@ -133,7 +133,7 @@ def runGCM(self, fname, mode): if mode == 'ENCRYPT': try: rct, rtag = c.encrypt(pt, iv, aad) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test inputs the driver does not support. if e.errno != errno.EINVAL: raise @@ -153,7 +153,7 @@ def runGCM(self, fname, mode): else: try: rpt, rtag = c.decrypt(*args) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test inputs the driver does not support. if e.errno != errno.EINVAL: raise @@ -221,7 +221,7 @@ def runXTS(self, fname, meth): try: c = Crypto(meth, cipherkey, crid=crid) r = curfun(c, pt, iv) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test hashes the driver does not support. if e.errno != errno.EOPNOTSUPP: raise @@ -252,7 +252,7 @@ def runCCMEncrypt(self, fname): mackey=key, maclen=16) r, tag = Crypto.encrypt(c, payload, nonce, aad) - except EnvironmentError, e: + except EnvironmentError as e: if e.errno != errno.EOPNOTSUPP: raise continue @@ -294,7 +294,7 @@ def runCCMDecrypt(self, fname): key=key, mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC, mackey=key, maclen=16) - except EnvironmentError, e: + except EnvironmentError as e: if e.errno != errno.EOPNOTSUPP: raise continue @@ -388,13 +388,13 @@ def runSHA(self, fname): for data in lines: msg = data['Msg'].decode('hex') - msg = msg[:int(data['Len'])] + msg = msg[:int(data['Len'])] md = data['MD'].decode('hex') try: c = Crypto(mac=alg, crid=crid, maclen=hashlen) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test hashes the driver does not support. if e.errno != errno.EOPNOTSUPP: raise @@ -451,7 +451,7 @@ def runSHA1HMAC(self, fname): try: c = Crypto(mac=alg, mackey=key, crid=crid, maclen=hashlen) - except EnvironmentError, e: + except EnvironmentError as e: # Can't test hashes the driver does not support. if e.errno != errno.EOPNOTSUPP: raise