Esempio n. 1
0
def test_kem(kem_name):
    if not (helpers.is_kem_enabled_by_name(kem_name)):
        pytest.skip('Not enabled')

    helpers.run_subprocess([
        "qemu-" + platform.machine() + "-static", "-cpu", MINCPU,
        helpers.path_to_executable('test_kem'), kem_name
    ])
Esempio n. 2
0
def test_kem(kem_name):
    if not (helpers.is_kem_enabled_by_name(kem_name)):
        pytest.skip('Not enabled')

    Path('build/mem-benchmark').mkdir(parents=True, exist_ok=True)

    for i in range(3):
        helpers.run_subprocess(
            [helpers.path_to_executable('test_kem_mem'), kem_name,
             str(i)])
Esempio n. 3
0
def test_kem(kem_name):
    if not (helpers.is_build_portable()):
        pytest.skip("Portability not enabled")

    if not (helpers.is_kem_enabled_by_name(kem_name)):
        pytest.skip('Not enabled')

    helpers.run_subprocess([
        "qemu-" + platform.machine(), "-cpu", MIN_CPUS[platform.machine()],
        helpers.path_to_executable('test_kem'), kem_name
    ])
Esempio n. 4
0
def test_kem(kem_name):
    kats = helpers.get_kats("kem")
    if kem_name.startswith('SIDH'): pytest.skip('KATs not available for SIDH')
    if not (helpers.is_kem_enabled_by_name(kem_name)):
        pytest.skip('Not enabled')
    output = helpers.run_subprocess(
        [helpers.path_to_executable('kat_kem'), kem_name], )
    output = output.replace("\r\n", "\n")
    h256 = sha256()
    h256.update(output.encode())

    assert (kats[kem_name] == h256.hexdigest())
Esempio n. 5
0
def test_kem(kem_name):
    if kem_name.startswith('SIDH'): pytest.skip('KATs not available for SIDH')
    if not(helpers.is_kem_enabled_by_name(kem_name)): pytest.skip('Not enabled')
    output = helpers.run_subprocess(
        [helpers.path_to_executable('kat_kem'), kem_name],
    )
    output = output.replace("\r\n", "\n")
    kats = []
    for filename in os.listdir(os.path.join('tests', 'KATs', 'kem')):
        if filename.startswith(kem_name + '.') and filename.endswith('.kat'):
            with open(os.path.join('tests', 'KATs', 'kem', filename), 'r') as myfile:
                kats.append(myfile.read())
    assert(output in kats)
Esempio n. 6
0
def test_kem(kem_name):
    if not(helpers.is_kem_enabled_by_name(kem_name)): pytest.skip('Not enabled')
    helpers.run_subprocess(
        [helpers.path_to_executable('test_kem'), kem_name],
    )