Skip tests with missing test vectors instead of failing.

This copes more gracefully when older version of the nist-kat package
are intalled that don't have newer test vectors such as CCM or plain
SHA.

If the nist-kat package is not installed at all, this still fails with
an error.

Reviewed by:	cem
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D20034
This commit is contained in:
John Baldwin 2019-04-24 00:10:21 +00:00
parent 9583ab8aa3
commit aeb5c8e609
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346614

View File

@ -42,7 +42,9 @@
katdir = '/usr/local/share/nist-kat'
def katg(base, glob):
assert os.path.exists(os.path.join(katdir, base)), "Please 'pkg install nist-kat'"
assert os.path.exists(katdir), "Please 'pkg install nist-kat'"
if not os.path.exists(os.path.join(katdir, base)):
raise unittest.SkipTest("Missing %s test vectors" % (base))
return iglob(os.path.join(katdir, base, glob))
aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ]