1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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
This commit is contained in:
Enji Cooper 2019-04-24 04:50:03 +00:00
parent ac65c82761
commit b106e0fccc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346623

View File

@ -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