def _get_ghash_clmul(): """Return None if CLMUL implementation is not available""" if not _cpuid.have_clmul(): return None try: api = _ghash_api_template.replace("%imp%", "clmul") lib = load_pycryptodome_raw_lib("Crypto.Hash._ghash_clmul", api) result = _build_impl(lib, "clmul") except OSError: result = None return result
def get_tests(config={}): from Crypto.Util import _cpuid wycheproof_warnings = config.get('wycheproof_warnings') tests = [] tests += list_test_cases(GcmTests) tests += list_test_cases(GcmFSMTests) tests += [ TestVectors() ] tests += [ TestVectorsWycheproof(wycheproof_warnings) ] tests += list_test_cases(TestVectorsGueronKrasnov) tests += [ TestVariableLength() ] if config.get('slow_tests'): tests += list_test_cases(NISTTestVectorsGCM) if _cpuid.have_clmul(): tests += [ TestVectorsWycheproof(wycheproof_warnings, use_clmul=False) ] tests += [ TestVariableLength(use_clmul = False) ] if config.get('slow_tests'): tests += list_test_cases(NISTTestVectorsGCM_no_clmul) else: print "Skipping test of PCLMULDQD in AES GCM" return tests