Ejemplo n.º 1
0
def _get_ghash_clmul():
    """Return None if CLMUL implementation is not available"""

    if not _cpu_features.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
Ejemplo n.º 2
0
def _get_ghash_clmul():
    """Return None if CLMUL implementation is not available"""

    if not _cpu_features.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
Ejemplo n.º 3
0
def get_tests(config={}):
    from Crypto.Util import _cpu_features

    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 _cpu_features.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
Ejemplo n.º 4
0
def get_tests(config={}):
    from Crypto.Util import _cpu_features

    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 _cpu_features.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