Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/opencrypto/cryptotest.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
katdir = '/usr/local/share/nist-kat' | katdir = '/usr/local/share/nist-kat' | ||||
def katg(base, glob): | def katg(base, glob): | ||||
assert os.path.exists(katdir), "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)): | if not os.path.exists(os.path.join(katdir, base)): | ||||
raise unittest.SkipTest("Missing %s test vectors" % (base)) | raise unittest.SkipTest("Missing %s test vectors" % (base)) | ||||
return iglob(os.path.join(katdir, base, glob)) | return iglob(os.path.join(katdir, base, glob)) | ||||
aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ] | aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] | ||||
desmodules = [ 'cryptosoft0', ] | desmodules = [ 'cryptosoft0', ] | ||||
shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ] | shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] | ||||
def GenTestCase(cname): | def GenTestCase(cname): | ||||
try: | try: | ||||
crid = cryptodev.Crypto.findcrid(cname) | crid = cryptodev.Crypto.findcrid(cname) | ||||
except IOError: | except IOError: | ||||
return None | return None | ||||
class GendCryptoTestCase(unittest.TestCase): | class GendCryptoTestCase(unittest.TestCase): | ||||
▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | class GendCryptoTestCase(unittest.TestCase): | ||||
self.assertEqual(r[:tlen], mac, "Actual: " + \ | self.assertEqual(r[:tlen], mac, "Actual: " + \ | ||||
repr(binascii.hexlify(r)) + " Expected: " + repr(data)) | repr(binascii.hexlify(r)) + " Expected: " + repr(data)) | ||||
return GendCryptoTestCase | return GendCryptoTestCase | ||||
cryptosoft = GenTestCase('cryptosoft0') | cryptosoft = GenTestCase('cryptosoft0') | ||||
aesni = GenTestCase('aesni0') | aesni = GenTestCase('aesni0') | ||||
armv8crypto = GenTestCase('armv8crypto0') | |||||
ccr = GenTestCase('ccr0') | ccr = GenTestCase('ccr0') | ||||
ccp = GenTestCase('ccp0') | ccp = GenTestCase('ccp0') | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
unittest.main() | unittest.main() |