Index: sys/opencrypto/crypto.c =================================================================== --- sys/opencrypto/crypto.c +++ sys/opencrypto/crypto.c @@ -460,7 +460,7 @@ CRYPTDEB("dev newsession failed"); } else { CRYPTDEB("no driver"); - err = EINVAL; + err = EOPNOTSUPP; } CRYPTO_DRIVER_UNLOCK(); return err; Index: tests/sys/opencrypto/cryptotest.py =================================================================== --- tests/sys/opencrypto/cryptotest.py +++ tests/sys/opencrypto/cryptotest.py @@ -30,6 +30,7 @@ # from __future__ import print_function +import errno import cryptodev import itertools import os @@ -284,8 +285,14 @@ if len(key) > blocksize: continue - c = Crypto(mac=alg, mackey=key, - crid=crid) + try: + c = Crypto(mac=alg, mackey=key, + crid=crid) + except EnvironmentError, e: + # Can't test hashes the driver does not support. + if e.errno != errno.EOPNOTSUPP: + raise + continue _, r = c.encrypt(msg, iv="")